all files / grid/renderer/ date-filter-ui.js

93.75% Statements 30/32
70% Branches 7/10
85.71% Functions 6/7
93.75% Lines 30/32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60   11× 11× 11×                                                          
define(["require", "exports", "@syncfusion/ej2-calendars", "@syncfusion/ej2-base", "@syncfusion/ej2-base"], function (require, exports, ej2_calendars_1, ej2_base_1, ej2_base_2) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var DateFilterUI = (function () {
        function DateFilterUI(parent, serviceLocator, filterSettings) {
            this.parent = parent;
            this.locator = serviceLocator;
            this.fltrSettings = filterSettings;
        }
        DateFilterUI.prototype.create = function (args) {
            var intl = new ej2_base_2.Internationalization();
            var colFormat = args.column.format;
            var format = args.column.type === 'date' ? intl.getDatePattern({ type: 'date', skeleton: colFormat }, false)
                : intl.getDatePattern({ type: 'dateTime', skeleton: colFormat }, false);
            this.dialogObj = args.dialogObj;
            this.inputElem = ej2_base_1.createElement('input', { className: 'e-flmenu-input', id: 'dateui-' + args.column.uid });
            args.target.appendChild(this.inputElem);
            Iif (args.column.type === 'date') {
                this.datePickerObj = new ej2_calendars_1.DatePicker({
                    format: format,
                    cssClass: 'e-popup-flmenu',
                    placeholder: args.localizeText.getConstant('ChooseDate'),
                    width: '100%',
                    locale: this.parent.locale,
                    enableRtl: this.parent.enableRtl,
                    open: this.openPopup.bind(this),
                });
            }
            else Eif (args.column.type === 'datetime') {
                this.datePickerObj = new ej2_calendars_1.DateTimePicker({
                    format: format,
                    cssClass: 'e-popup-flmenu',
                    placeholder: args.localizeText.getConstant('ChooseDate'),
                    width: '100%',
                    locale: this.parent.locale,
                    enableRtl: this.parent.enableRtl,
                    open: this.openPopup.bind(this),
                });
            }
            this.datePickerObj.appendTo(this.inputElem);
        };
        DateFilterUI.prototype.write = function (args) {
            var columns = this.fltrSettings.columns;
            var dateuiObj = document.querySelector('#dateui-' + args.column.uid).ej2_instances[0];
            dateuiObj.value = !ej2_base_1.isNullOrUndefined(args.filteredValue) ? new Date(args.filteredValue) : null;
        };
        DateFilterUI.prototype.read = function (element, column, filterOptr, filterObj) {
            var dateuiObj = document.querySelector('#dateui-' + column.uid).ej2_instances[0];
            var filterValue = dateuiObj.value;
            filterValue = ej2_base_1.isNullOrUndefined(filterValue) ? null : filterValue;
            filterObj.filterByColumn(column.field, filterOptr, filterValue, 'and', true);
        };
        DateFilterUI.prototype.openPopup = function (args) {
            args.popup.element.style.zIndex = (this.dialogObj.zIndex + 1).toString();
        };
        return DateFilterUI;
    }());
    exports.DateFilterUI = DateFilterUI;
});