<commit_before>define(function(require) {
    'use strict';

    var ColumnManagerComponent;
    var _ = require('underscore');
    var Backgrid = require('backgrid');
    var tools = require('oroui/js/tools');
    var BaseComponent = require('oroui/js/app/components/base/component');
    var ColumnFilterModel = require('orodatagrid/js/app/models/column-manager/column-filter-model');
    var ColumnFilterView = require('orodatagrid/js/app/views/column-manager/column-manager-filter-view');
    var ColumnManagerCollectionView = require('orodatagrid/js/app/views/column-manager/column-manager-collection-view');
    var ColumnManagerView = require('orodatagrid/js/app/views/column-manager/column-manager-view');

    /**
     * @class ColumnManagerComponent
     * @extends BaseComponent
     */
    ColumnManagerComponent = BaseComponent.extend({
        /**
         * Full collection of columns
         * @type {Backgrid.Columns}
         */
        columns: null,

        /**
         * Collection of manageable columns
         * @type {Backgrid.Columns}
         */
        managedColumns: null,

        /**
         * Instance of grid
         * @type {Backgrid.Grid}
         */
        grid: null,

        /**
         * Check if sorting enabled
         * @type {boolean}
         */
        addSorting: true,

        /**
         * @inheritDoc
         */
        initialize: function(options) {
            if (!(options.columns instanceof Backgrid.Columns)) {
                throw new TypeError('The "columns" option have to be instance of Backgrid.Columns');
            }

            if (!(options.grid instanceof Backgrid.Grid)) {
                throw new TypeError('The "grid" option have to be instance of Backgrid.Grid');
            }

            _.extend(this, _.pick(options, ['columns', 'grid']));

            this.managedColumns = options.managedColumns;

            this.addSorting = options.addSorting;

            this.columnFilterModel = new ColumnFilterModel();

            this.createViews = _.bind(this._createViews, this, options);

            this._applyState(this.grid.collection, this.grid.collection.state);

            ColumnManagerComponent.__super__.initialize.apply(this, arguments);
        },

        /**
         * @inheritDoc
         */
        dispose: function() {
            if (this.disposed) {
                return;
            }

            // remove properties to prevent disposing them with the columns manager
            delete this.columns;
            delete this.grid;

            ColumnManagerComponent.__super__.dispose.apply(this, arguments);
        },

        /**
         * @inheritDoc
         */
        delegateListeners: function() {
            this.listenTo(this.grid.collection, 'updateState', this._applyState);
            this.listenTo(this.managedColumns, 'change:renderable', this._pushState);
            this.listenTo(this.managedColumns, 'sort', function() {
                this.columns.sort();
            });

            return ColumnManagerComponent.__super__.delegateListeners.apply(this, arguments);
        },

        /**
         * Creates views for column manager
         *
         * @param {Object} options
         * @protected
         */
        _createViews: function(options) {
            // index of first manageable column
            var orderShift = this.managedColumns[0] ? this.managedColumns[0].get('order') : 0;
            this.columnManagerView = new ColumnManagerView({
                el: options._sourceElement,
                collection: this.managedColumns,
                columnFilterModel: this.columnFilterModel
            });
            this.columnFilterView = new ColumnFilterView({
                el: this.columnManagerView.$('.column-manager-filter').get(0),
                model: this.columnFilterModel
            });
            this.columnManagerCollectionView = new ColumnManagerCollectionView({
                el: this.columnManagerView.$('.column-manager-table').get(0),
                collection: this.managedColumns,<commit_msg>BB-7499: Disable filtres (#7218)<commit_after>define(function(require) {
    'use strict';

    var ColumnManagerComponent;
    var _ = require('underscore');
    var Backgrid = require('backgrid');
    var tools = require('oroui/js/tools');
    var BaseComponent = require('oroui/js/app/components/base/component');
    var ColumnFilterModel = require('orodatagrid/js/app/models/column-manager/column-filter-model');
    var ColumnFilterView = require('orodatagrid/js/app/views/column-manager/column-manager-filter-view');
    var ColumnManagerCollectionView = require('orodatagrid/js/app/views/column-manager/column-manager-collection-view');
    var ColumnManagerView = require('orodatagrid/js/app/views/column-manager/column-manager-view');
    var module = require('module');
    var config = module.config();

    config = _.extend({
        enableFilters: true
    }, config);

    /**
     * @class ColumnManagerComponent
     * @extends BaseComponent
     */
    ColumnManagerComponent = BaseComponent.extend({
        /**
         * Full collection of columns
         * @type {Backgrid.Columns}
         */
        columns: null,

        /**
         * Collection of manageable columns
         * @type {Backgrid.Columns}
         */
        managedColumns: null,

        /**
         * Instance of grid
         * @type {Backgrid.Grid}
         */
        grid: null,

        /**
         * Check if sorting enabled
         * @type {boolean}
         */
        addSorting: true,

        /**
         * Check if filters enabled
         * @type {boolean}
         */
        enableFilters: config.enableFilters,

        /**
         * @inheritDoc
         */
        initialize: function(options) {
            if (!(options.columns instanceof Backgrid.Columns)) {
                throw new TypeError('The "columns" option have to be instance of Backgrid.Columns');
            }

            if (!(options.grid instanceof Backgrid.Grid)) {
                throw new TypeError('The "grid" option have to be instance of Backgrid.Grid');
            }

            _.extend(this, _.pick(options, ['columns', 'grid']));

            this.managedColumns = options.managedColumns;

            this.addSorting = options.addSorting;

            this.columnFilterModel = new ColumnFilterModel();

            this.createViews = _.bind(this._createViews, this, options);

            this._applyState(this.grid.collection, this.grid.collection.state);

            ColumnManagerComponent.__super__.initialize.apply(this, arguments);
        },

        /**
         * @inheritDoc
         */
        dispose: function() {
            if (this.disposed) {
                return;
            }

            // remove properties to prevent disposing them with the columns manager
            delete this.columns;
            delete this.grid;
            delete this.enableFilters;

            ColumnManagerComponent.__super__.dispose.apply(this, arguments);
        },

        /**
         * @inheritDoc
         */
        delegateListeners: function() {
            this.listenTo(this.grid.collection, 'updateState', this._applyState);
            this.listenTo(this.managedColumns, 'change:renderable', this._pushState);
            this.listenTo(this.managedColumns, 'sort', function() {
                this.columns.sort();
            });

            return ColumnManagerComponent.__super__.delegateListeners.apply(this, arguments);
        },

        /**
         * Creates views for column manager
         *
         * @param {Object} options
         * @protected
         */
        _createViews: function(options) {
            // index of first manageable column
            var orderShift = this.managedColumns[0] ? this.managedColumns[0].get('order') : 0;
            this.columnManagerView = new ColumnManagerView({
                el: options._sourceElement,
                collection: this.managedColumns,
                columnFilterModel: this.columnFilterModel
            });

            if (this.enableFilters) {
                this.columnFilterView = new ColumnFilterView({
                    el: this.columnManagerView.$('.column-manager-filter').get(0),
                    model: this.columnFilterModel
                });
            }

            this.columnManagerCollectionView = new ColumnManagerCollectionView({
                el: this.columnManagerView.$('.column-manager-table').get(0),
                collection: this.managedColumns,
{'fraction_non_alphanumeric': 0.11083916083916084, 'fraction_numerical': 0.002097902097902098, 'mean_word_length': 1.9427297668038408, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2566722', 'n_tokens_mistral': 2178, 'n_tokens_neox': 2105, 'n_words': 423}