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

    angular
        .module('dpDataSelection')
        .component('dpSbiFilter', {
            bindings: {
                availableFilters: '=',
                activeFilters: '='
            },
            templateUrl: 'modules/data-selection/components/sbi-filter/sbi-filter.html',
            controller: DpSbiFilterController,
            controllerAs: 'vm'
        });

    DpSbiFilterController.$inject = ['$scope', 'store', 'ACTIONS', 'DATA_SELECTION_CONFIG'];

    function DpSbiFilterController ($scope, store, ACTIONS, DATA_SELECTION_CONFIG) {
        const vm = this,
            expandedFilters = [];

        vm.sbiCode = vm.activeFilters.sbi_code && vm.activeFilters.sbi_code.replace(/['\[\]]/g, '');
        vm.showOptionCounts = false;
        vm.showMoreThreshold = 10;

        vm.addFilter = function (filterSlug, options) {
            var filters = {...vm.activeFilters};

            filters[filterSlug] =
                '[' + options.split(',').map(data => '\'' + data.trim() + '\'').join(', ') + ']';

            applyFilters(filters);
        };

        vm.onSubmit = () => {
            vm.addFilter('sbi_code', vm.sbiCode);
        };

        vm.showExpandButton = function (filterSlug) {
            return !vm.isExpandedFilter(filterSlug) && getAvailableOptions(filterSlug).length > vm.showMoreThreshold;
        };

        vm.nrHiddenOptions = function (filter) {
            return filter.numberOfOptions - filter.options.length;
        };

        vm.expandFilter = function (filterSlug) {
            expandedFilters.push(filterSlug);<commit_msg>added support for removing filter when emptying sbi input tg-4511<commit_after>(function () {
    'use strict';

    angular
        .module('dpDataSelection')
        .component('dpSbiFilter', {
            bindings: {
                availableFilters: '=',
                activeFilters: '='
            },
            templateUrl: 'modules/data-selection/components/sbi-filter/sbi-filter.html',
            controller: DpSbiFilterController,
            controllerAs: 'vm'
        });

    DpSbiFilterController.$inject = ['$scope', 'store', 'ACTIONS', 'DATA_SELECTION_CONFIG'];

    function DpSbiFilterController ($scope, store, ACTIONS, DATA_SELECTION_CONFIG) {
        const vm = this,
            expandedFilters = [];

        vm.sbiCode = vm.activeFilters.sbi_code && vm.activeFilters.sbi_code.replace(/['\[\]]/g, '');
        vm.showOptionCounts = false;
        vm.showMoreThreshold = 10;

        vm.onSubmit = () => {
            vm.addFilter('sbi_code', vm.sbiCode);
        };

        vm.addFilter = function (filterSlug, string) {
            const filters = {...vm.activeFilters};

            if (string === '') {
                delete filters[filterSlug];
            } else {
                filters[filterSlug] = '[' + string.split(',').map(data => '\'' + data.trim() + '\'').join(', ') + ']';
            }

            applyFilters(filters);
        };

        vm.showExpandButton = function (filterSlug) {
            return !vm.isExpandedFilter(filterSlug) && getAvailableOptions(filterSlug).length > vm.showMoreThreshold;
        };

        vm.nrHiddenOptions = function (filter) {
            return filter.numberOfOptions - filter.options.length;
        };

        vm.expandFilter = function (filterSlug) {
            expandedFilters.push(filterSlug);
{'fraction_non_alphanumeric': 0.14056107539450613, 'fraction_numerical': 0.0023378141437755697, 'mean_word_length': 2.089350180505415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3751367', 'n_tokens_mistral': 982, 'n_tokens_neox': 978, 'n_words': 151}