<commit_before>Ext.ux.form.FinderField = Ext.extend(Ext.form.TwinTriggerField, {
    trigger1Class: 'x-form-clear-trigger',
    trigger2Class: 'p-form-finder-trigger',
    hiddenValue: '',
    hideTrigger1: true,

    initComponent: function () {
        if (this.element) {
            this.siteroot_id = this.element.siteroot_id;
            this.language = this.element.language;
        }

        if (this.readonly) {
            this.editable = false;
            this.readOnly = true;
            this.hideTrigger = true;
            this.ctCls = 'x-item-disabled';
        }

        Ext.ux.form.FinderField.superclass.initComponent.call(this);
    },

    onRender: function(ct, position) {
        Ext.ux.form.FinderField.superclass.onRender.call(this, ct, position);

        this.hiddenField = Ext.DomHelper.insertAfter(this.el, {
            tag: 'input',
            name: this.hiddenName,
            type: 'hidden',
            value: Ext.encode(this.hiddenValue)
        }, true);
    },

    /**
     * Clears any text/value currently set in the field
     */
    clearValue : function(){
        if (this.hiddenField){
            this.setHiddenValue(null);
        }
        this.setRawValue('');
        this.lastSelectionText = '';
        this.applyEmptyText();
        this.value = '';
    },

    reset: Ext.form.Field.prototype.reset.createSequence(function () {
        this.triggers[0].hide();
    }),

    onViewClick: Ext.form.ComboBox.prototype.onViewClick.createSequence(function () {
        this.triggers[0].show();
    }),

    onTrigger2Click: function () {
        this.onTriggerClick();
    },

    onTrigger1Click: function () {
        if (this.disabled) {
            return;
        }
        this.clearValue();
        this.triggers[0].hide();
        this.onClear();
        this.fireEvent('clear', this);
    },

    initValue: function() {
        Ext.ux.form.FinderField.superclass.initValue.call(this);

        this.setHiddenFieldValue(this.hiddenValue);
    },

    setHiddenValue: function(value) {
        this.hiddenValue = value;
        this.setHiddenFieldValue(value);
    },

    setHiddenFieldValue: function(value) {
        if (this.hiddenField) {
            if (value) {
                this.hiddenField.dom.value = Ext.encode(value);
            } else {
                this.hiddenField.dom.value = '';
            }
        }
    },

    setValue: function(v) {
        if (v && !this.readOnly) {
            this.hideTrigger1 = false;

            if (this.triggers) {
                this.triggers[0].show();
            }
        }

        Ext.ux.form.FinderField.superclass.setValue.call(this, v);

        this.setHiddenFieldValue(this.hiddenValue);
    },

    validateValue: function (value) {
        return true;
    },

    onSelect: function (record, index) {
        Ext.ux.form.FinderField.superclass.onSelect.call(this, record, index);

        this.setHiddenValue({
            type: record.data.type,
            tid: record.data.tid,
            eid: record.data.eid
        });
    },

    onClear: function () {
        Ext.ux.form.setValue.superclass.onClear.call(this);<commit_msg>fixes<commit_after>Ext.ux.form.FinderField = Ext.extend(Ext.form.TwinTriggerField, {
    trigger1Class: 'x-form-clear-trigger',
    trigger2Class: 'p-form-finder-trigger',
    hiddenValue: '',
    hideTrigger1: true,

    initComponent: function () {
        if (this.element) {
            this.siteroot_id = this.element.siteroot_id;
            this.language = this.element.language;
        }

        if (this.readonly) {
            this.editable = false;
            this.readOnly = true;
            this.hideTrigger = true;
            this.ctCls = 'x-item-disabled';
        }

        Ext.ux.form.FinderField.superclass.initComponent.call(this);
    },

    onRender: function(ct, position) {
        Ext.ux.form.FinderField.superclass.onRender.call(this, ct, position);

        this.hiddenField = Ext.DomHelper.insertAfter(this.el, {
            tag: 'input',
            name: this.hiddenName,
            type: 'hidden',
            value: Ext.encode(this.hiddenValue)
        }, true);
    },

    /**
     * Clears any text/value currently set in the field
     */
    clearValue : function(){
        if (this.hiddenField){
            this.setHiddenValue(null);
        }
        this.setRawValue('');
        this.lastSelectionText = '';
        this.applyEmptyText();
        this.value = '';
    },

    reset: Ext.form.Field.prototype.reset.createSequence(function () {
        this.triggers[0].hide();
    }),

    onViewClick: Ext.form.ComboBox.prototype.onViewClick.createSequence(function () {
        this.triggers[0].show();
    }),

    onTrigger2Click: function () {
        this.onTriggerClick();
    },

    onTrigger1Click: function () {
        if (this.disabled) {
            return;
        }
        this.clearValue();
        this.triggers[0].hide();
        this.onClear();
        this.fireEvent('clear', this);
    },

    initValue: function() {
        Ext.ux.form.FinderField.superclass.initValue.call(this);

        this.setHiddenFieldValue(this.hiddenValue);
    },

    setHiddenValue: function(value) {
        this.hiddenValue = value;
        this.setHiddenFieldValue(value);
    },

    setHiddenFieldValue: function(value) {
        if (this.hiddenField) {
            if (value) {
                this.hiddenField.dom.value = Ext.encode(value);
            } else {
                this.hiddenField.dom.value = '';
            }
        }
    },

    setValue: function(v) {
        if (v && !this.readOnly) {
            this.hideTrigger1 = false;

            if (this.triggers) {
                this.triggers[0].show();
            }
        }

        Ext.ux.form.FinderField.superclass.setValue.call(this, v);

        this.setHiddenFieldValue(this.hiddenValue);
    },

    validateValue: function (value) {
        return true;
    },

    onSelect: function (record, index) {
        Ext.ux.form.FinderField.superclass.onSelect.call(this, record, index);

        this.setHiddenValue({
            type: record.data.type,
            tid: record.data.tid,
            eid: record.data.eid
        });
    },

    onClear: function () {
        Ext.ux.form.FinderField.superclass.onClear.call(this);
{'fraction_non_alphanumeric': 0.13268046122255567, 'fraction_numerical': 0.00315905860053704, 'mean_word_length': 1.8794906775807185, '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': '7312582', 'n_tokens_mistral': 1915, 'n_tokens_neox': 1876, 'n_words': 269}