<commit_before>import Vue from "vue";
import {Grid, ComponentUtil} from "ag-grid/main";
import {VueFrameworkFactory} from "./vueFrameworkFactory";
import {VueFrameworkComponentWrapper} from "./vueFrameworkComponentWrapper";

const watchedProperties = {};
const props = ['gridOptions'];
ComponentUtil.ALL_PROPERTIES.forEach((propertyName) => {
    props.push(propertyName);

    watchedProperties[propertyName] = function (val, oldVal) {
        this.processChanges(propertyName, val, oldVal);
    };
});
ComponentUtil.EVENTS.forEach((eventName) => {
    props.push(eventName);
});

export default Vue.extend({
    template: '<div></div>',
    props: props,
    data() {
        return {
            _initialised: false,
            _destroyed: false,
        }
    },
    methods: {
        globalEventListener(eventType, event) {
            if (this._destroyed) {
                return;
            }

            // generically look up the eventType
            let emitter = this[eventType];
            if (emitter) {
                emitter(event);
            } else {
                // the app isn't listening for this - ignore it
            }
        },
        processChanges(propertyName, val, oldVal) {
            if (this._initialised) {
                let changes = {};
                changes[propertyName] = {currentValue: val, previousValue: oldVal};
                ComponentUtil.processOnChange(changes, this.gridOptions, this.gridOptions.api, this.gridOptions.columnApi);
            }
        }
    },
    mounted() {
        let frameworkComponentWrapper = new VueFrameworkComponentWrapper(this);
        let vueFrameworkFactory = new VueFrameworkFactory(this.$el, this);
        let gridOptions = ComponentUtil.copyAttributesToGridOptions(this.gridOptions, this);

        let gridParams = {
            globalEventListener: this.globalEventListener.bind(this),
            frameworkFactory: vueFrameworkFactory,
            seedBeanInstances: {
                frameworkComponentWrapper: frameworkComponentWrapper
            }
        };

        new Grid(this.$el, gridOptions, gridParams);

        this._initialised = true;
    },
    watch: watchedProperties,
    destroyed() {
        if (this._initialised) {
            this.gridOptions.api.destroy();
            this._destroyed = true;
        }
    }
});
<commit_msg>Release 17.1.0 creating branch<commit_after>import Vue from "vue";
import {ComponentUtil, Grid} from "ag-grid/main";
import {VueFrameworkFactory} from "./vueFrameworkFactory";
import {VueFrameworkComponentWrapper} from "./vueFrameworkComponentWrapper";

const watchedProperties = {};
const props = {
    gridOptions: {
        default: function () {
            return {}
        }
    }
};
ComponentUtil.ALL_PROPERTIES.forEach((propertyName) => {
    // props.push(propertyName);
    props[propertyName] = {};

    watchedProperties[propertyName] = function (val, oldVal) {
        this.processChanges(propertyName, val, oldVal);
    };
});
ComponentUtil.EVENTS.forEach((eventName) => {
    // props.push(eventName);
    props[eventName] = {};
});

export default Vue.extend({
    template: '<div></div>',
    props: props,
    data() {
        return {
            _initialised: false,
            _destroyed: false,
        }
    },
    methods: {
        globalEventListener(eventType, event) {
            if (this._destroyed) {
                return;
            }

            // generically look up the eventType
            let emitter = this[eventType];
            if (emitter) {
                emitter(event);
            } else {
                // the app isn't listening for this - ignore it
            }
        },
        processChanges(propertyName, val, oldVal) {
            if (this._initialised) {
                let changes = {};
                changes[propertyName] = {currentValue: val, previousValue: oldVal};
                ComponentUtil.processOnChange(changes, this.gridOptions, this.gridOptions.api, this.gridOptions.columnApi);
            }
        }
    },
    mounted() {
        let frameworkComponentWrapper = new VueFrameworkComponentWrapper(this);
        let vueFrameworkFactory = new VueFrameworkFactory(this.$el, this);
        let gridOptions = ComponentUtil.copyAttributesToGridOptions(this.gridOptions, this);

        let gridParams = {
            globalEventListener: this.globalEventListener.bind(this),
            frameworkFactory: vueFrameworkFactory,
            seedBeanInstances: {
                frameworkComponentWrapper: frameworkComponentWrapper
            }
        };

        new Grid(this.$el, gridOptions, gridParams);

        this._initialised = true;
    },
    watch: watchedProperties,
    destroyed() {
        if (this._initialised) {
            if(this.gridOptions.api) {
                this.gridOptions.api.destroy();
            }
            this._destroyed = true;
        }
    }
});

{'fraction_non_alphanumeric': 0.10838238278871525, 'fraction_numerical': 0.0008118530545971179, 'mean_word_length': 2.1468710089399745, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3575818', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1258, 'n_words': 259}