<commit_before>﻿
namespace Serenity {

    @Decorators.registerClass()
    @Decorators.resizable()
    @Decorators.responsive()
    export class ColumnPickerDialog extends Serenity.TemplatedDialog<any> {

        private ulVisible: JQuery;
        private ulHidden: JQuery;
        private colById: Q.Dictionary<Slick.Column>;

        public allColumns: Slick.Column[];
        public visibleColumns: string[];
        public defaultColumns: string[];
        public done: () => void;

        constructor() {
            super();

            new Serenity.QuickSearchInput(this.byId("Search"), {
                onSearch: (fld, txt, done) => {
                    txt = Q.trimToNull(txt);
                    if (txt != null)
                        txt = Select2.util.stripDiacritics(txt.toLowerCase());

                    this.element.find('li').each((x, e) => {
                        $(e).toggle(!txt || Select2.util.stripDiacritics(
                            $(e).text().toLowerCase()).indexOf(txt) >= 0);
                    });
                }
            });

            this.ulVisible = this.byId("VisibleCols");
            this.ulHidden = this.byId("HiddenCols");
        }

        public static createToolButton(grid: DataGrid<any, any>): ToolButton {
            function onClick() {
                var picker = new Serenity.ColumnPickerDialog();
                picker.allColumns = (grid as any).allColumns;
                if ((grid as any).initialSettings) {
                    var initialSettings = (grid as any).initialSettings as PersistedGridSettings;
                    if (initialSettings.columns && initialSettings.columns.length)
                        picker.defaultColumns = initialSettings.columns.map(x => x.id);<commit_msg>Wait cursor not removed after ColumnPicker quick search (#4574)<commit_after>﻿
namespace Serenity {

    @Decorators.registerClass()
    @Decorators.resizable()
    @Decorators.responsive()
    export class ColumnPickerDialog extends Serenity.TemplatedDialog<any> {

        private ulVisible: JQuery;
        private ulHidden: JQuery;
        private colById: Q.Dictionary<Slick.Column>;

        public allColumns: Slick.Column[];
        public visibleColumns: string[];
        public defaultColumns: string[];
        public done: () => void;

        constructor() {
            super();

            new Serenity.QuickSearchInput(this.byId("Search"), {
                onSearch: (fld, txt, done) => {
                    txt = Q.trimToNull(txt);
                    if (txt != null)
                        txt = Select2.util.stripDiacritics(txt.toLowerCase());

                    this.element.find('li').each((x, e) => {
                        $(e).toggle(!txt || Select2.util.stripDiacritics(
                            $(e).text().toLowerCase()).indexOf(txt) >= 0);
                    });
                    done && done(true);
                }
            });

            this.ulVisible = this.byId("VisibleCols");
            this.ulHidden = this.byId("HiddenCols");
        }

        public static createToolButton(grid: DataGrid<any, any>): ToolButton {
            function onClick() {
                var picker = new Serenity.ColumnPickerDialog();
                picker.allColumns = (grid as any).allColumns;
                if ((grid as any).initialSettings) {
                    var initialSettings = (grid as any).initialSettings as PersistedGridSettings;
                    if (initialSettings.columns && initialSettings.columns.length)
                        picker.defaultColumns = initialSettings.columns.map(x => x.id);
{'fraction_non_alphanumeric': 0.11644591611479028, 'fraction_numerical': 0.0027593818984547464, 'mean_word_length': 1.7927580893682589, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '4552558', 'n_tokens_mistral': 953, 'n_tokens_neox': 909, 'n_words': 189}