smart-webcomponents-react 14.2.39 → 14.2.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/accordion.esm.js +2 -2
- package/accordion/accordion.umd.js +2 -2
- package/alertwindow/alertwindow.esm.js +1 -1
- package/alertwindow/alertwindow.umd.js +1 -1
- package/array/array.esm.js +1 -1
- package/array/array.umd.js +1 -1
- package/barcode/barcode.esm.js +1 -1
- package/barcode/barcode.umd.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +1 -1
- package/breadcrumb/breadcrumb.umd.js +1 -1
- package/button/button.esm.js +4 -4
- package/button/button.umd.js +4 -4
- package/buttongroup/buttongroup.esm.js +1 -1
- package/buttongroup/buttongroup.umd.js +1 -1
- package/calendar/calendar.esm.js +1 -1
- package/calendar/calendar.umd.js +1 -1
- package/card/card.esm.js +1 -1
- package/card/card.umd.js +1 -1
- package/cardview/cardview.esm.js +1 -1
- package/cardview/cardview.umd.js +1 -1
- package/carousel/carousel.esm.js +1 -1
- package/carousel/carousel.umd.js +1 -1
- package/chart/chart.esm.js +1 -1
- package/chart/chart.umd.js +1 -1
- package/checkbox/checkbox.esm.js +1 -1
- package/checkbox/checkbox.umd.js +1 -1
- package/checkinput/checkinput.esm.js +1 -1
- package/checkinput/checkinput.umd.js +1 -1
- package/chip/chip.esm.js +1 -1
- package/chip/chip.umd.js +1 -1
- package/colorinput/colorinput.esm.js +1 -1
- package/colorinput/colorinput.umd.js +1 -1
- package/colorpanel/colorpanel.esm.js +1 -1
- package/colorpanel/colorpanel.umd.js +1 -1
- package/colorpicker/colorpicker.esm.js +1 -1
- package/colorpicker/colorpicker.umd.js +1 -1
- package/columnpanel/columnpanel.esm.js +1 -1
- package/columnpanel/columnpanel.umd.js +1 -1
- package/combobox/combobox.esm.js +3 -3
- package/combobox/combobox.umd.js +3 -3
- package/countryinput/countryinput.esm.js +1 -1
- package/countryinput/countryinput.umd.js +1 -1
- package/customizationdialog/customizationdialog.esm.js +1 -1
- package/customizationdialog/customizationdialog.umd.js +1 -1
- package/dateinput/dateinput.esm.js +1 -1
- package/dateinput/dateinput.umd.js +1 -1
- package/daterangeinput/daterangeinput.esm.js +1 -1
- package/daterangeinput/daterangeinput.umd.js +1 -1
- package/datetimepicker/datetimepicker.esm.js +1 -1
- package/datetimepicker/datetimepicker.umd.js +1 -1
- package/dialogwindow/dialogwindow.esm.js +1 -1
- package/dialogwindow/dialogwindow.umd.js +1 -1
- package/dockinglayout/dockinglayout.esm.js +1 -1
- package/dockinglayout/dockinglayout.umd.js +1 -1
- package/dropdownbutton/dropdownbutton.esm.js +1 -1
- package/dropdownbutton/dropdownbutton.umd.js +1 -1
- package/dropdownlist/dropdownlist.esm.js +3 -3
- package/dropdownlist/dropdownlist.umd.js +3 -3
- package/editor/editor.esm.js +1 -1
- package/editor/editor.umd.js +1 -1
- package/element/element.esm.js +1 -1
- package/element/element.umd.js +1 -1
- package/fileupload/fileupload.esm.js +1 -1
- package/fileupload/fileupload.umd.js +1 -1
- package/filterbuilder/filterbuilder.esm.js +1 -1
- package/filterbuilder/filterbuilder.umd.js +1 -1
- package/filterpanel/filterpanel.esm.js +1 -1
- package/filterpanel/filterpanel.umd.js +1 -1
- package/form/form.esm.js +3 -3
- package/form/form.umd.js +3 -3
- package/ganttchart/ganttchart.esm.js +1 -1
- package/ganttchart/ganttchart.umd.js +1 -1
- package/gauge/gauge.esm.js +1 -1
- package/gauge/gauge.umd.js +1 -1
- package/grid/grid.esm.js +1 -1
- package/grid/grid.umd.js +1 -1
- package/grouppanel/grouppanel.esm.js +1 -1
- package/grouppanel/grouppanel.umd.js +1 -1
- package/index.d.ts +12 -0
- package/input/input.esm.js +1 -1
- package/input/input.umd.js +1 -1
- package/kanban/kanban.esm.js +1 -1
- package/kanban/kanban.umd.js +1 -1
- package/layout/layout.esm.js +5 -5
- package/layout/layout.umd.js +5 -5
- package/led/led.esm.js +1 -1
- package/led/led.umd.js +1 -1
- package/listbox/listbox.esm.js +3 -3
- package/listbox/listbox.umd.js +3 -3
- package/listmenu/listmenu.esm.js +3 -3
- package/listmenu/listmenu.umd.js +3 -3
- package/map/map.esm.js +1 -1
- package/map/map.umd.js +1 -1
- package/maskedtextbox/maskedtextbox.esm.js +1 -1
- package/maskedtextbox/maskedtextbox.umd.js +1 -1
- package/menu/menu.esm.js +3 -3
- package/menu/menu.umd.js +3 -3
- package/multicolumnfilterpanel/multicolumnfilterpanel.esm.js +1 -1
- package/multicolumnfilterpanel/multicolumnfilterpanel.umd.js +1 -1
- package/multicomboinput/multicomboinput.esm.js +1 -1
- package/multicomboinput/multicomboinput.umd.js +1 -1
- package/multiinput/multiinput.esm.js +1 -1
- package/multiinput/multiinput.umd.js +1 -1
- package/multilinetextbox/multilinetextbox.esm.js +3 -3
- package/multilinetextbox/multilinetextbox.umd.js +3 -3
- package/multilinewindow/multilinewindow.esm.js +1 -1
- package/multilinewindow/multilinewindow.umd.js +1 -1
- package/multisplitbutton/multisplitbutton.esm.js +3 -3
- package/multisplitbutton/multisplitbutton.umd.js +3 -3
- package/numberinput/numberinput.esm.js +1 -1
- package/numberinput/numberinput.umd.js +1 -1
- package/numerictextbox/numerictextbox.esm.js +1 -1
- package/numerictextbox/numerictextbox.umd.js +1 -1
- package/package.json +1 -1
- package/pager/pager.esm.js +1 -1
- package/pager/pager.umd.js +1 -1
- package/passwordinput/passwordinput.esm.js +1 -1
- package/passwordinput/passwordinput.umd.js +1 -1
- package/passwordtextbox/passwordtextbox.esm.js +1 -1
- package/passwordtextbox/passwordtextbox.umd.js +1 -1
- package/path/path.esm.js +1 -1
- package/path/path.umd.js +1 -1
- package/phoneinput/phoneinput.esm.js +1 -1
- package/phoneinput/phoneinput.umd.js +1 -1
- package/pivottable/pivottable.esm.js +1 -1
- package/pivottable/pivottable.umd.js +1 -1
- package/progressbar/progressbar.esm.js +2 -2
- package/progressbar/progressbar.umd.js +2 -2
- package/progresswindow/progresswindow.esm.js +1 -1
- package/progresswindow/progresswindow.umd.js +1 -1
- package/promptwindow/promptwindow.esm.js +1 -1
- package/promptwindow/promptwindow.umd.js +1 -1
- package/qrcode/qrcode.esm.js +1 -1
- package/qrcode/qrcode.umd.js +1 -1
- package/querybuilder/querybuilder.d.ts +7 -0
- package/querybuilder/querybuilder.esm.js +2 -2
- package/querybuilder/querybuilder.umd.js +2 -2
- package/radiobutton/radiobutton.esm.js +1 -1
- package/radiobutton/radiobutton.umd.js +1 -1
- package/rating/rating.esm.js +1 -1
- package/rating/rating.umd.js +1 -1
- package/scheduler/scheduler.esm.js +1 -1
- package/scheduler/scheduler.umd.js +1 -1
- package/scrollbar/scrollbar.esm.js +1 -1
- package/scrollbar/scrollbar.umd.js +1 -1
- package/slider/slider.esm.js +1 -1
- package/slider/slider.umd.js +1 -1
- package/sortable/sortable.esm.js +1 -1
- package/sortable/sortable.umd.js +1 -1
- package/sortpanel/sortpanel.esm.js +1 -1
- package/sortpanel/sortpanel.umd.js +1 -1
- package/source/modules/smart.accordion.js +1 -1
- package/source/modules/smart.array.js +1 -1
- package/source/modules/smart.barcode.js +1 -1
- package/source/modules/smart.breadcrumb.js +1 -1
- package/source/modules/smart.button.js +1 -1
- package/source/modules/smart.buttongroup.js +1 -1
- package/source/modules/smart.calendar.js +2 -2
- package/source/modules/smart.card.js +1 -1
- package/source/modules/smart.cardview.js +2 -2
- package/source/modules/smart.carousel.js +1 -1
- package/source/modules/smart.chart.js +1 -1
- package/source/modules/smart.checkbox.js +1 -1
- package/source/modules/smart.checkinput.js +1 -1
- package/source/modules/smart.chip.js +1 -1
- package/source/modules/smart.colorinput.js +1 -1
- package/source/modules/smart.colorpanel.js +1 -1
- package/source/modules/smart.colorpicker.js +1 -1
- package/source/modules/smart.combobox.js +1 -1
- package/source/modules/smart.common.js +21 -21
- package/source/modules/smart.countryinput.js +1 -1
- package/source/modules/smart.dateinput.js +3 -3
- package/source/modules/smart.daterangeinput.js +3 -3
- package/source/modules/smart.datetimepicker.js +2 -2
- package/source/modules/smart.dockinglayout.js +1 -1
- package/source/modules/smart.dropdownbutton.js +1 -1
- package/source/modules/smart.dropdownlist.js +1 -1
- package/source/modules/smart.editor.js +1 -1
- package/source/modules/smart.element.js +1 -1
- package/source/modules/smart.fileupload.js +1 -1
- package/source/modules/smart.form.js +1 -1
- package/source/modules/smart.formulaparser.js +1 -1
- package/source/modules/smart.ganttchart.js +3 -3
- package/source/modules/smart.gauge.js +1 -1
- package/source/modules/smart.grid.js +16 -16
- package/source/modules/smart.gridpanel.js +3 -3
- package/source/modules/smart.input.js +1 -1
- package/source/modules/smart.kanban.js +4 -4
- package/source/modules/smart.layout.js +1 -1
- package/source/modules/smart.led.js +1 -1
- package/source/modules/smart.listbox.js +1 -1
- package/source/modules/smart.listmenu.js +1 -1
- package/source/modules/smart.map.js +1 -1
- package/source/modules/smart.maskedtextbox.js +1 -1
- package/source/modules/smart.menu.js +1 -1
- package/source/modules/smart.multicomboinput.js +2 -2
- package/source/modules/smart.multiinput.js +1 -1
- package/source/modules/smart.multilinetextbox.js +1 -1
- package/source/modules/smart.multisplitbutton.js +1 -1
- package/source/modules/smart.numberinput.js +1 -1
- package/source/modules/smart.numerictextbox.js +1 -1
- package/source/modules/smart.pager.js +1 -1
- package/source/modules/smart.passwordinput.js +1 -1
- package/source/modules/smart.passwordtextbox.js +1 -1
- package/source/modules/smart.path.js +1 -1
- package/source/modules/smart.phoneinput.js +1 -1
- package/source/modules/smart.pivottable.js +3 -3
- package/source/modules/smart.progressbar.js +1 -1
- package/source/modules/smart.qrcode.js +1 -1
- package/source/modules/smart.querybuilder.js +3 -3
- package/source/modules/smart.radiobutton.js +1 -1
- package/source/modules/smart.rating.js +1 -1
- package/source/modules/smart.router.js +1 -1
- package/source/modules/smart.scheduler.js +3 -3
- package/source/modules/smart.scrollbar.js +1 -1
- package/source/modules/smart.slider.js +1 -1
- package/source/modules/smart.sortable.js +1 -1
- package/source/modules/smart.splitter.js +1 -1
- package/source/modules/smart.switchbutton.js +1 -1
- package/source/modules/smart.table.js +2 -2
- package/source/modules/smart.tabs.js +1 -1
- package/source/modules/smart.tank.js +1 -1
- package/source/modules/smart.textarea.js +1 -1
- package/source/modules/smart.textbox.js +1 -1
- package/source/modules/smart.timeinput.js +1 -1
- package/source/modules/smart.timepicker.js +1 -1
- package/source/modules/smart.toast.js +1 -1
- package/source/modules/smart.tooltip.js +1 -1
- package/source/modules/smart.tree.js +1 -1
- package/source/modules/smart.validator.js +1 -1
- package/source/modules/smart.window.js +1 -1
- package/source/smart.accordion.js +1 -1
- package/source/smart.ajax.js +1 -1
- package/source/smart.array.js +1 -1
- package/source/smart.barcode.js +1 -1
- package/source/smart.bootstrap.js +1 -1
- package/source/smart.breadcrumb.js +1 -1
- package/source/smart.button.js +1 -1
- package/source/smart.buttongroup.js +1 -1
- package/source/smart.calendar.js +2 -2
- package/source/smart.card.js +1 -1
- package/source/smart.cardview.js +1 -1
- package/source/smart.carousel.js +1 -1
- package/source/smart.chart.annotations.js +1 -1
- package/source/smart.chart.api.js +1 -1
- package/source/smart.chart.core.js +1 -1
- package/source/smart.chart.js +1 -1
- package/source/smart.chart.rangeselector.js +1 -1
- package/source/smart.chart.waterfall.js +1 -1
- package/source/smart.checkbox.js +1 -1
- package/source/smart.checkinput.js +1 -1
- package/source/smart.chip.js +1 -1
- package/source/smart.colorinput.js +1 -1
- package/source/smart.colorpanel.js +1 -1
- package/source/smart.colorpicker.js +1 -1
- package/source/smart.combobox.js +1 -1
- package/source/smart.complex.js +1 -1
- package/source/smart.core.js +1 -1
- package/source/smart.countryinput.js +1 -1
- package/source/smart.data.js +1 -1
- package/source/smart.date.js +1 -1
- package/source/smart.dateformatpanel.js +1 -1
- package/source/smart.dateinput.js +2 -2
- package/source/smart.daterangeinput.js +1 -1
- package/source/smart.datetimepicker.js +1 -1
- package/source/smart.dockinglayout.js +1 -1
- package/source/smart.draw.js +1 -1
- package/source/smart.dropdownbutton.js +1 -1
- package/source/smart.dropdownlist.js +1 -1
- package/source/smart.editor.js +1 -1
- package/source/smart.element.js +1 -1
- package/source/smart.elements.js +18 -18
- package/source/smart.export.js +1 -1
- package/source/smart.fileupload.js +1 -1
- package/source/smart.filter.js +1 -1
- package/source/smart.filterbuilder.js +2 -2
- package/source/smart.filterpanel.js +2 -2
- package/source/smart.form.js +1 -1
- package/source/smart.format.js +1 -1
- package/source/smart.formulaparser.js +1 -1
- package/source/smart.ganttchart.js +1 -1
- package/source/smart.gauge.js +1 -1
- package/source/smart.grid.cell.js +2 -2
- package/source/smart.grid.chart.js +1 -1
- package/source/smart.grid.column.js +1 -1
- package/source/smart.grid.core.js +2 -2
- package/source/smart.grid.dialog.js +2 -2
- package/source/smart.grid.edit.js +2 -2
- package/source/smart.grid.export.js +1 -1
- package/source/smart.grid.filter.js +1 -1
- package/source/smart.grid.group.js +1 -1
- package/source/smart.grid.js +1 -1
- package/source/smart.grid.menu.js +2 -2
- package/source/smart.grid.pager.js +1 -1
- package/source/smart.grid.reorder.js +1 -1
- package/source/smart.grid.resize.js +2 -2
- package/source/smart.grid.row.js +2 -2
- package/source/smart.grid.select.js +2 -2
- package/source/smart.grid.sort.js +1 -1
- package/source/smart.grid.toolbar.js +2 -2
- package/source/smart.grid.tree.js +1 -1
- package/source/smart.grid.view.js +2 -2
- package/source/smart.gridpanel.js +1 -1
- package/source/smart.input.js +1 -1
- package/source/smart.kanban.js +2 -2
- package/source/smart.layout.js +1 -1
- package/source/smart.led.js +1 -1
- package/source/smart.listbox.js +1 -1
- package/source/smart.listmenu.js +1 -1
- package/source/smart.map.js +1 -1
- package/source/smart.maskedtextbox.js +1 -1
- package/source/smart.math.js +1 -1
- package/source/smart.menu.js +1 -1
- package/source/smart.multicomboinput.js +2 -2
- package/source/smart.multiinput.js +1 -1
- package/source/smart.multilinetextbox.js +1 -1
- package/source/smart.multisplitbutton.js +1 -1
- package/source/smart.numberformatpanel.js +1 -1
- package/source/smart.numberinput.js +1 -1
- package/source/smart.numeric.js +1 -1
- package/source/smart.numerictextbox.js +1 -1
- package/source/smart.pager.js +1 -1
- package/source/smart.passwordinput.js +1 -1
- package/source/smart.passwordtextbox.js +1 -1
- package/source/smart.path.js +1 -1
- package/source/smart.phoneinput.js +1 -1
- package/source/smart.pivottable.js +1 -1
- package/source/smart.powerbutton.js +1 -1
- package/source/smart.progressbar.js +1 -1
- package/source/smart.qrcode.js +1 -1
- package/source/smart.radiobutton.js +1 -1
- package/source/smart.rating.js +1 -1
- package/source/smart.router.js +1 -1
- package/source/smart.scheduler.js +2 -2
- package/source/smart.scrollbar.js +1 -1
- package/source/smart.slider.js +1 -1
- package/source/smart.sortable.js +1 -1
- package/source/smart.splitter.js +1 -1
- package/source/smart.switchbutton.js +1 -1
- package/source/smart.table.js +2 -2
- package/source/smart.tabs.js +1 -1
- package/source/smart.tank.js +1 -1
- package/source/smart.textarea.js +1 -1
- package/source/smart.textbox.js +1 -1
- package/source/smart.tickintervalhandler.js +1 -1
- package/source/smart.timeinput.js +1 -1
- package/source/smart.timepicker.js +1 -1
- package/source/smart.toast.js +1 -1
- package/source/smart.tooltip.js +1 -1
- package/source/smart.tree.js +1 -1
- package/source/smart.validationpanel.js +1 -1
- package/source/smart.validator.js +1 -1
- package/source/smart.window.js +1 -1
- package/source/styles/components/smart.base.css +1 -1
- package/source/styles/components/smart.grid.css +1 -1
- package/source/styles/default/scss/smart.grid.scss +57 -3
- package/source/styles/default/smart.grid.css +41 -3
- package/source/styles/default/smart.variables.css +8 -0
- package/source/styles/font/smart-icons.eot +0 -0
- package/source/styles/font/smart-icons.svg +296 -286
- package/source/styles/font/smart-icons.ttf +0 -0
- package/source/styles/font/smart-icons.woff +0 -0
- package/source/styles/font/smart-icons.woff2 +0 -0
- package/source/styles/smart.default.css +2 -2
- package/source/typescript/smart.elements.d.ts +12 -0
- package/source/typescript/smart.grid.d.ts +5 -0
- package/source/typescript/smart.querybuilder.d.ts +7 -0
- package/splitter/splitter.esm.js +3 -3
- package/splitter/splitter.umd.js +3 -3
- package/switchbutton/switchbutton.esm.js +1 -1
- package/switchbutton/switchbutton.umd.js +1 -1
- package/table/table.esm.js +1 -1
- package/table/table.umd.js +1 -1
- package/tabs/tabs.esm.js +3 -3
- package/tabs/tabs.umd.js +3 -3
- package/tabswindow/tabswindow.esm.js +1 -1
- package/tabswindow/tabswindow.umd.js +1 -1
- package/tank/tank.esm.js +1 -1
- package/tank/tank.umd.js +1 -1
- package/textarea/textarea.esm.js +1 -1
- package/textarea/textarea.umd.js +1 -1
- package/textbox/textbox.esm.js +3 -3
- package/textbox/textbox.umd.js +3 -3
- package/timeinput/timeinput.esm.js +1 -1
- package/timeinput/timeinput.umd.js +1 -1
- package/timepicker/timepicker.esm.js +1 -1
- package/timepicker/timepicker.umd.js +1 -1
- package/toast/toast.esm.js +1 -1
- package/toast/toast.umd.js +1 -1
- package/tooltip/tooltip.esm.js +1 -1
- package/tooltip/tooltip.umd.js +1 -1
- package/tree/tree.esm.js +3 -3
- package/tree/tree.umd.js +3 -3
- package/validator/validator.esm.js +1 -1
- package/validator/validator.umd.js +1 -1
- package/waitwindow/waitwindow.esm.js +1 -1
- package/waitwindow/waitwindow.umd.js +1 -1
- package/window/window.esm.js +1 -1
- package/window/window.umd.js +1 -1
|
@@ -1292,7 +1292,7 @@ Smart("smart-button",class extends Smart.ContentElement{static get properties(){
|
|
|
1292
1292
|
/***/ 5810:
|
|
1293
1293
|
/***/ (() => {
|
|
1294
1294
|
|
|
1295
|
-
Smart("smart-calendar",class extends Smart.BaseElement{static get properties(){return{animationSettings:{value:null,type:"object"},calendarMode:{value:"default",allowedValues:["default","classic"],type:"string"},dayNameFormat:{value:"firstTwoLetters",allowedValues:["narrow","firstTwoLetters","long","short"],type:"string"},dateFormatFunction:{value:null,type:"function"},disableAutoNavigation:{value:!1,type:"boolean"},displayMode:{value:"month",allowedValues:["month","year","decade"],type:"string"},displayModeView:{value:"table",allowedValues:["table","list"],type:"string"},dropDownHeight:{value:"200",type:"string"},dropDownWidth:{value:"",type:"string"},firstDayOfWeek:{value:0,type:"number",defaultValue:0,validator:"_firstDayOfWeekValidator"},footerTemplate:{value:null,type:"any"},headerTemplate:{value:null,type:"any"},hideDayNames:{value:!1,type:"boolean"},hideOtherMonthDays:{value:!1,type:"boolean"},hideTooltipArrow:{value:!1,type:"boolean"},importantDates:{value:[],type:"array",defaultValue:[]},importantDatesTemplate:{value:null,type:"any"},max:{value:new Date(2100,1,1),type:"any",defaultValue:new Date(2100,1,1)},min:{value:new Date(1900,1,1),type:"any",defaultValue:new Date(1900,1,1)},months:{value:1,type:"number",defaultValue:1,validator:"_monthsValidator"},monthNameFormat:{value:"long",allowedValues:["narrow","firstTwoLetters","long","short","2-digit","numeric"],type:"string"},name:{value:"",type:"string"},restrictedDates:{value:[],type:"array",defaultValue:[]},scrollButtonsNavigationMode:{value:"landscape",allowedValues:["portrait","landscape"],type:"string"},scrollButtonsPosition:{value:"both",allowedValues:["near","far","both"],type:"string"},selectedDates:{value:[],reflectToAttribute:!1,type:"array"},selectionMode:{value:"default",allowedValues:["none","default","one","oneExtended","many","zeroOrMany","oneOrMany","zeroOrOne","week","range"],type:"string"},spinButtonsDelay:{value:80,type:"number"},spinButtonsInitialDelay:{value:0,type:"number"},titleTemplate:{value:null,type:"any"},tooltip:{value:!1,type:"boolean"},tooltipArrow:{value:!0,type:"boolean"},tooltipArrowDirection:{allowedValues:["bottom","top","left","right","none"],value:"bottom",type:"string"},tooltipDelay:{value:100,type:"number"},tooltipOffset:{value:[],type:"array"},tooltipPosition:{value:"auto",allowedValues:["auto","bottom","top","left","right","absolute"],type:"string"},tooltipTemplate:{value:null,type:"any"},view:{value:"portrait",allowedValues:["landscape","portrait"],type:"string"},viewSections:{value:["header"],type:"array"},weekNumbers:{value:!1,type:"boolean"},weeks:{value:6,type:"number",defaultValue:6,validator:"_weeksValidator"},yearFormat:{value:"numeric",allowedValues:["2-digit","numeric"],type:"string"}}}static get listeners(){return{"container.down":"_downHandler","document.up":"_documentUpHandler","body.move":"_moveHandler","container.wheel":"_containerWheelHandler","body.focus":"_bodyFocusStateHandler","body.blur":"_bodyBlurStateHandler","header.click":"_headerClickHandler","header.change":"_headerChangeHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler","container.mouseover":"_mouseEventsHandler","container.mouseout":"_mouseEventsHandler","container.open":"_popupEventHandler","container.close":"_popupEventHandler"}}static get methods(){return{select:"select(date=new Date(): date|string): void",clearSelection:"clearSelection(): void",today:"today(): date",navigate:"navigate(step: date|string|int): bool"}}static get styleUrls(){return["smart.calendar.css"]}template(){return'<div id="container" role="presentation">\n <div id="title" class="smart-calendar-title" role="heading" aria-level="1">\n <div id="yearContainer" class="smart-calendar-year-container" role="button"></div>\n <div id="dateContainer" class="smart-calendar-date-container smart-calendar-selected" role="button"></div>\n </div>\n <div id="calendarContainer" class="smart-calendar-container">\n <div id="header" class="smart-calendar-header">\n <smart-repeat-button prev-month class="smart-calendar-button" id="previousMonthButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Previous month">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n <div id="dateElement" class="smart-calendar-date-element" role="presentation">\n <div id="defaultHeaderDate" role="button"></div>\n <div id="classicHeaderDate">\n <div id="monthElement" class="smart-calendar-month-element" disabled="[[disabled]]" role="presentation">\n </div>\n <input class="smart-calendar-year-element" id="yearElement" disabled="[[disabled]]" readonly="[[readonly]]" aria-label="Year" />\n <span class="smart-calendar-year-elements">\n <smart-repeat-button next-year class="smart-calendar-button" id="nextYearButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Next year">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button prev-year class="smart-calendar-button" id="previousYearButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Previous year">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n </div>\n <smart-repeat-button next-month class="smart-calendar-button" id="nextMonthButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Next month">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n </div>\n <div id="body" class="smart-content smart-calendar-body" role="presentation">\n <div id="monthsContainer" class="smart-calendar-months-container" role="presentation">\n <div id="month" class="smart-calendar-month" role="grid">\n <div id="monthName" class="smart-calendar-month-name"></div>\n <div id="weekTitles" class="smart-calendar-week-titles" role="row">\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n </div>\n <div id="weeks" class="smart-calendar-weeks" role="rowgroup">\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n </div>\n </div>\n </div>\n <div id="dateViewContainer" class="smart-calendar-date-view-container smart-hidden">\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n </div>\n <div id="monthsSeparator" class="smart-calendar-month-separator"></div>\n <div id="nextMonthsContainer" class="smart-calendar-next-months-container" aria-hidden="true"></div>\n <div id="animationPanel" class="smart-calendar-animation-panel smart-hidden"></div>\n </div>\n <div id="footer" class="smart-calendar-footer smart-hidden">\n <div id="selectedDatesRange"></div>\n </div>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>\n </div>'}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const a=e.dataset.property,n=e.selectedDates.toString();a&&void 0!==t[a]&&(t[a]=n)}}}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const n=this;switch(e){case"animationSettings":n._applyAnimationSettings();break;case"disabled":case"unfocusable":n._setFocusable();break;case"calendarMode":case"dropDownWidth":case"dropDownHeight":n.displayMode="month",n._refreshHeaderElements(),n._refreshCalendarMode(),n._setDisplayModeContent();break;case"dayNameFormat":n._refreshDayOfWeekTitles(n.$.month);break;case"dateFormatFunction":{let e=n.$.monthsContainer.children;for(let t=0;t<e.length;t++)e[t].firstElementChild.innerHTML=a?a(e[t]._date):n._monthsNames[e[t]._date.getMonth()]+" "+e[t]._date.toLocaleDateString(n.locale,{year:n.yearFormat});n._refreshHeaderTitle();break}case"displayMode":if("classic"===n.calendarMode&&"month"!==a){n[e]="month";break}n._setDisplayMode(t,a);break;case"displayModeView":n._applyAnimationSettings(!0),"month"!==n.displayMode&&n._setDisplayModeContent();break;case"firstDayOfWeek":n._handleMonths(),n._refreshDayOfWeekTitles();break;case"hideTooltipArrow":n.$.tooltip&&(n.$.tooltip.arrow=!a);break;case"titleTemplate":case"headerTemplate":case"footerTemplate":n._handleLayoutTemplate(n.$[e.split(/[T]/)[0]],a),"titleTemplate"===e?n._refreshTitle():"headerTemplate"===e?n._refreshHeaderTitle():n._refreshFooter();break;case"importantDates":n.importantDates=n._getValidDates(a),n._refreshImportantDates();break;case"importantDatesTemplate":n._handleImportantDateTemplate(),n._refreshImportantDates();break;case"locale":n._refreshMonthNames(),n._refreshDayOfWeekTitles(),n._refreshHeaderTitle(),n._refreshTitle(),n._refreshFooter(),n.displayMode&&"month"!==n.displayMode&&n._setDisplayModeContent();break;case"max":case"min":n._validateMinMax(e,a,t),n._validateSelectedDates(),n._noFocusingRequired=!1,n._refreshHeaderElements();break;case"months":n._handleMonths();break;case"monthNameFormat":n._refreshCalendarMode(),n._refreshHeaderTitle();break;case"restrictedDates":n._setRestrictedDates(n.restrictedDates=n._getValidDates(a));break;case"rightToLeft":n._refreshDayOfWeekTitles(),n._handleMonths();break;case"scrollButtonsNavigationMode":n._setScrollButtonsNavigationMode();break;case"selectedDates":if(n._clearSelection(!0),n._validateSelectedDates(n._getValidDates(a)),n._applySelectionMode(!0),n._viewDates){let e=n.selectedDates[n.selectedDates.length-1];n._isDateInView(e)?n.selectedDates.map((e=>n._selectDate(e,!0,!0))):n._handleMonths(e)}n._refreshFooter(),n._setWeeksVisibility(n.$.monthsContainer),n.$.hiddenInput.value=n.selectedDates.toString(),n.isInitialized&&(n.$.fireEvent("change",{value:n.selectedDates}),n._updateTargetValue()),n._refreshTitle(),"month"!==n.displayMode&&n._setDisplayModeContent();break;case"selectionMode":n._applySelectionMode(!1,t),n._refreshTitle();break;case"tooltip":n._handleTooltip();break;case"tooltipArrow":case"tooltipArrowDirection":case"tooltipDelay":case"tooltipOffset":case"tooltipPosition":case"tooltipTemplate":if(n.$.tooltip){const t=e.replace("tooltip","");n.$.tooltip[t.charAt(0).toLowerCase()+t.slice(1)]=a}break;case"view":n._refreshTitle();break;case"viewSections":a.indexOf("title")>-1?n.$title.removeClass("smart-hidden"):n.$title.addClass("smart-hidden"),n._refreshTitle(),a.indexOf("header")>-1?n.$header.removeClass("smart-hidden"):n.$header.addClass("smart-hidden"),n._refreshHeaderTitle(),a.indexOf("footer")>-1?n.$footer.removeClass("smart-hidden"):n.$footer.addClass("smart-hidden"),n._refreshFooter(),n._setFocusable();break;case"weeks":n._setWeeksVisibility(n.$.monthsContainer);break;case"yearFormat":if(n._refreshCalendarMode(),n._refreshFooter(),n.months>1&&"month"===n.displayMode){let e=n._animationStarted?n.$.nextMonthsContainer.children:n.$.monthsContainer.children;for(let t=0;t<e.length;t++)e[t].firstElementChild.innerHTML=n.dateFormatFunction?n.dateFormatFunction(e[t]._date):n._monthsNames[e[t]._date.getMonth()]+" "+e[t]._date.toLocaleDateString(n.locale,{year:a})}n._refreshTitle(),n._refreshHeaderTitle()}}ready(){super.ready();const e=this;e._keysPressed={},e._applyAnimationSettings(),e.importantDates=e._getValidDates(e.importantDates),e.restrictedDates=e._getValidDates(e.restrictedDates)}render(){const e=this;e.setAttribute("role","dialog"),e._refreshMonthNames(),e._validateMinMax(),e._validateSelectedDates(e._getValidDates(e.selectedDates)),e._handleLayoutTemplate(e.$.title,e.titleTemplate),e._handleLayoutTemplate(e.$.header,e.headerTemplate),e._handleLayoutTemplate(e.$.footer,e.footerTemplate),e._handleImportantDateTemplate(),e._setFocusable(),e._refreshDayOfWeekTitles(),e._applySelectionMode(!0),e._handleMonths(0===e.selectedDates.length?new Date((new Date).setHours(0,0,0,0)):e.selectedDates[e.selectedDates.length-1]),e._handleTooltip(),e._updateViewSectionsVisibility(),e._setScrollButtonsNavigationMode(),e._refreshCalendarMode(),e._setDisplayMode(),e._refreshTitle(),e._refreshFooter(),e._refreshImportantDates(),e.$.monthElement&&e.$.monthElement._setDropDownSize&&e.$.monthElement._setDropDownSize(),e._changeEventFired=0,e.$.hiddenInput.value=e.selectedDates.toString(),e.shadowRoot&&e.appendChild(e.$.hiddenInput),e.isInitialized=!0,super.render()}refresh(){this.isInitialized&&this.render()}_updateViewSectionsVisibility(){const e=this;e.viewSections.indexOf("title")>-1?e.$title.removeClass("smart-hidden"):e.$title.addClass("smart-hidden"),e.viewSections.indexOf("header")>-1?e.$header.removeClass("smart-hidden"):e.$header.addClass("smart-hidden"),e.viewSections.indexOf("footer")>-1?e.$footer.removeClass("smart-hidden"):e.$footer.addClass("smart-hidden")}clearSelection(){this._clearSelection()}_setFocusable(){const e=this;let t=e.tabIndex>0?e.tabIndex:0;function a(e,a){if(a)return e&&e instanceof a?("function"==typeof e._setFocusable&&e.isCompleted?e.unfocusable=t<=-1:e.setAttribute("tabindex",t),e):e||void 0}(e.disabled||e.unfocusable)&&(t=-1),e.$.previousMonthButton=a(e.$.previousMonthButton,Smart.Button),e.$.nextMonthButton=a(e.$.nextMonthButton,Smart.Button),e.$.nextYearButton=a(e.$.nextYearButton,Smart.Button),e.$.previousYearButton=a(e.$.previousYearButton,Smart.Button),e.$.monthElement=a(e.$.monthElement,Smart.Input),e.$.yearElement=a(e.$.yearElement,HTMLInputElement),e.viewSections.indexOf("title")>-1&&(e.$.dateContainer.setAttribute("tabindex",t),e.$.yearContainer.setAttribute("tabindex",t)),e.$.body.setAttribute("tabindex",t),"default"===e.calendarMode?e.$.dateElement.setAttribute("tabindex",t):e.$.dateElement.removeAttribute("tabindex"),e.unfocusable?e.removeAttribute("tabindex"):e.tabIndex=e.readonly&&!e.disabled?e.tabIndex>0?e.tabIndex:0:t}static get requires(){return{"Smart.DropDownList":"smart.dropdownlist.js","Smart.ListBox":"smart.listbox.js","Smart.RepeatButton":"smart.button.js","Smart.Tooltip":"smart.tooltip.js"}}navigate(e){const t=this;let a,n,l;if(e){if("number"==typeof e){if(e=parseInt(e),isNaN(e)||0===e)return!1;if(6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode){let l,i;t._focusedCell||t._focusCell();const s=[].slice.call(t._focusedCell.closest(".smart-calendar-weeks").children).filter((e=>!e.classList.contains("smart-hidden")));e<0?(i=s[0].querySelectorAll(".smart-calendar-cell"),l=t.rightToLeft?i[i.length-1]:i[0]):(i=s[s.length-1].querySelectorAll(".smart-calendar-cell"),l=t.rightToLeft?i[0]:i[i.length-1]),n=new Date(l.value),n.setDate(n.getDate()+e),a=n}else a=t._getNextDate(e)}else{if(a=e=t._getValidDate(e),l=!0,isNaN(a.getTime()))return!1;const i=t._viewDates[0];if(i&&a.getMonth()===i.getMonth()&&a.getFullYear()===i.getFullYear())return!1;6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&(n=a)}return!(!a||t.$.fireEvent("navigationChanging",{value:new Date(a),type:t.displayMode}).defaultPrevented||("month"!==t.displayMode?(!l&&t.hasAnimation?(t.$nextMonthsContainer.addClass("smart-calendar-date-view-container"),"list"===t.displayModeView?t._setDisplayModeContent(a):t._navigationDate&&t._navigationDate.getTime()===a.getTime()||t._animateNavigation(a,e)):t._setDisplayModeContent(a),t.$.fireEvent("navigationChange",{value:new Date(a),type:t.displayMode}),0):(t.hasAnimation?(t._animateNavigation(a,e),t.$nextMonthsContainer.hasClass("smart-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-date-view-container")):(t._handleMonths(a),t._refreshHeaderElements(),t._refreshHeaderTitle()),n&&(t._focusCell(t._getCellByDate(n,t._animationStarted?t.$.nextMonthsContainer:void 0),!0),t._updateWeeksVisibility(e)),t.$.fireEvent("navigationChange",{value:new Date(a),type:t.displayMode}),0)))}}set value(e){this.select(e)}get value(){return this.selectedDates&&this.selectedDates.length>0?this.selectedDates[0]:null}select(e){const t=this;t._viewDates&&void 0!==t._viewDates[0]&&"none"!==t.selectionMode&&e&&(e=t._getValidDate(e))instanceof Date&&("one"===t.selectionMode&&t.selectedDates.map(Number).indexOf(e.getTime())>-1||e.getTime()<t.min.getTime()||e.getTime()>t.max.getTime()||("one"!==t.selectionMode&&"default"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._clearSelection(!0),t._selectDate(e),1!==t.selectedDates.length||t._isDateInView(t.selectedDates[0])||t._handleMonths(t.selectedDates[0])))}today(){const e=this;let t=new Date;return t.setHours(0,0,0,0),t.getTime()<e.min.getTime()||t.getTime()>e.max.getTime()?t=new Date(e.max):e._selectDate(t),e._handleMonths(t),t}_animateNavigation(e,t,a){const n=this;n._navigationDate=e,n._animationSettings||n._applyAnimationSettings(),n.$animationPanel.addClass("smart-hidden"),n.$.dateViewContainer.style.transform="",n.$.dateViewContainer.style.opacity="",n.$.monthsContainer.style.transform="",n.$.monthsContainer.style.opacity="";const l="month"!==n.displayMode?n.$.dateViewContainer:n.$.monthsContainer,i=n.$.body[n._animationSettings.scrollMax]-n.$.body[n._animationSettings.size];n._scrollStep=n.$.body[n._animationSettings.size]*n._animationSettings.startSpeed,n._animationStarted&&n._getMonthCells(n.$.monthsContainer,n.rightToLeft).map((e=>{n._setCellState(e,"restricted",!1),n._setCellState(e,"selected",!1),n._setCellState(e,"otherMonth",!1),n._setCellState(e,"focus",!1),n._setCellState(e,"important",!1),n._setCellState(e,"today",!1),n._setCellState(e,"disabled",!1),n._setCellState(e,"hover",!1)})),n._animationStarted=!0,"month"!==n.displayMode?(n._setCellState(n._focusedCell,"focus",!1),n._setDisplayModeContent(e,n.$.nextMonthsContainer)):n._handleMonths(e,n.$.nextMonthsContainer),n.rightToLeft&&(t*=-1),a||(t>0?(l.style.order=1,n.$.nextMonthsContainer.style.order=3,(!n._animationStarted||n._animationStarted&&n.$.body[n._animationSettings.scrollSize]>n.$.body[n._animationSettings.scrollMax]*n._animationSettings.resetThreshold*2)&&(n.$.body[n._animationSettings.scrollSize]=0)):(l.style.order=3,n.$.nextMonthsContainer.style.order=1,(!n._animationStarted||n._animationStarted&&n.$.body[n._animationSettings.scrollSize]<n.$.body[n._animationSettings.scrollMax]*n._animationSettings.resetThreshold)&&(n.$.body[n._animationSettings.scrollSize]=n.$.body[n._animationSettings.scrollMax]))),cancelAnimationFrame(n._animationId),n._animationId=requestAnimationFrame((function e(){let a=t>0?n.$.body[n._animationSettings.scrollSize]>=i:0===n.$.body[n._animationSettings.scrollSize],l=n._scrollStep/2;a?n._animateNavigationCompleted():(t>0&&n.$.body[n._animationSettings.scrollSize]>i*n._animationSettings.easeThreshold?(l=Math.max(n.$.body[n._animationSettings.scrollSize]/n._animationSettings.stepEaseSize,Math.abs(l-(i-n.$.body[n._animationSettings.scrollSize])*n._animationSettings.step)),n._scrollStep=n._scrollStep*n._animationSettings.step+l):t<0&&n.$.body[n._animationSettings.scrollSize]<i*n._animationSettings.easeThreshold&&(l=Math.max(n.$.body[n._animationSettings.scrollMax]/n._animationSettings.stepEaseSize,Math.abs(l-n.$.body[n._animationSettings.scrollSize]*n._animationSettings.step)),n._scrollStep=n._scrollStep*n._animationSettings.step+l),n.$.body[n._animationSettings.scrollSize]+=t>0?n._scrollStep:-n._scrollStep,n._animationId=requestAnimationFrame(e))}))}_animateNavigationCompleted(){const e=this;let t,a,n,l="month"!==e.displayMode?e.$.dateViewContainer:e.$.monthsContainer;if(cancelAnimationFrame(e._animationId),"month"!==e.displayMode){let i=[].slice.call(l.children).indexOf(e._focusedCell);l.innerHTML=e.$.nextMonthsContainer.innerHTML;let s,o=l.children[i];a=l.children,n=e.$.nextMonthsContainer.children;for(let t=0;t<a.length;t++)a[t].value=n[t].value,a[t].restricted=n[t].restricted,a[t].important=n[t].important,a[t].otherMonth=n[t].otherMonth,a[t].value.getTime()<=e.max.getTime()&&(s=a[t]);t=o&&o.value.getTime()>=e.max.getTime()?s.value:e._focusedCell?e._focusedCell.value:void 0}else{let i=l.children,s=e.$.nextMonthsContainer.children;e._focusedCell&&e.$.nextMonthsContainer.contains(e._focusedCell)&&(t=e._focusedCell.value);for(let t=0;t<i.length&&s[t]._date;t++){i[t]._date=s[t]._date,i[t].innerHTML=s[t].innerHTML,a=e._getMonthCells(i[t]),n=e._getMonthCells(s[t]);for(let e=0;e<a.length;e++)a[e].value=n[e].value,a[e].restricted=n[e].restricted,a[e].important=n[e].important,a[e].otherMonth=n[e].otherMonth,a[e].removeAttribute("focus")}e._selectedCells.length>0&&(e._selectedCells=e._selectedCells.map((t=>e._getCellByDate(t.value))).filter((e=>void 0!==e)))}e._focusCell(e._getCellByDate(t)),l.style.order=1,e.$.nextMonthsContainer.style.order=3,e.$.body[e._animationSettings.scrollSize]=0,e._animationStarted=!1,delete e._navigationDate}_applyAnimationSettings(e){const t=this;t._animationSettings=t.animationSettings?t.animationSettings:t._animationSettings||{},"portrait"===t.scrollButtonsNavigationMode?(t._animationSettings.scrollMax="scrollHeight",t._animationSettings.size="offsetHeight",t._animationSettings.scrollSize="scrollTop"):(t._animationSettings.scrollMax="scrollWidth",t._animationSettings.size="offsetWidth",t._animationSettings.scrollSize="scrollLeft"),e||(t._animationSettings.startSpeed=t._animationSettings.startSpeed?t._animationSettings.startSpeed:.2,t._animationSettings.easeThreshold=t._animationSettings.easeThreshold?t._animationSettings.easeThreshold:.5,t._animationSettings.step=t._animationSettings.step?t._animationSettings.step:.25,t._animationSettings.stepEaseSize=t._animationSettings.stepEaseSize?t._animationSettings.stepEaseSize:200,t._animationSettings.resetThreshold=t._animationSettings.resetThreshold?t._animationSettings.resetThreshold:.2)}_applySelectionMode(e,t){const a=this;let n=[],l=!!e,i=a.selectionMode;function s(e,t){const n=a.$.monthsContainer.children;for(let l=0;l<n.length;l++)a._getMonthCells(n[l]).map((n=>{a._setCellState(n,e,t)}))}switch("many"===i&&"range"===i||s("hover",!1),a._newRangeSelectionStarted=a.selectedDates.length>0&&"range"===i,-1!==["default","many","zeroOrMany","oneOrMany","week","range"].indexOf(i)?Array.from(a.getElementsByClassName("smart-calendar-month")).forEach((e=>e.setAttribute("aria-multiselectable",!0))):Array.from(a.getElementsByClassName("smart-calendar-month")).forEach((e=>e.removeAttribute("aria-multiselectable"))),"none"!==i&&"none"!==t||s("selected",!1),i){case"none":return void a._clearSelection(l);case"range":return void(a.selectedDates.length>1&&a._selectMultipleDates(a.selectedDates[0],a.selectedDates[a.selectedDates.length-1]));case"many":case"default":case"oneOrMany":if(0===a.selectedDates.length){n.push(new Date(Math.min(Math.max(a.min.getTime(),(new Date).setHours(0,0,0,0)),a.max.getTime())));break}return;case"oneExtended":case"one":if(1===a.selectedDates.length)return;a.selectedDates.length>1?(n.push(a.selectedDates[a.selectedDates.length-1]),a._clearSelection(l)):n.push(new Date(Math.min(Math.max(a.min.getTime(),(new Date).setHours(0,0,0,0)),a.max.getTime())));break;case"zeroOrOne":if(a.selectedDates.length>1){n.push(a.selectedDates[a.selectedDates.length-1]),a._clearSelection(l);break}return;case"zeroOrMany":return;case"week":if(a.selectedDates.length>=1){let e=a.selectedDates[a.selectedDates.length-1];for(let t=0;t<7;t++)n.push(new Date(e)),e.setDate(e.getDate()+1);a._clearSelection(l)}}if(a.selectedDates=[],e)return void(a.selectedDates=n);const o=n.length;for(let e=0;e<o;e++)a._selectDate(n[e],e<o-1)}_clearSelection(e){const t=this,a=t.selectedDates.slice(0),n=t.selectionMode;if(t.isRendered){if(t._selectedCells&&t._selectedCells.map((e=>{t._setCellState(e,"selected",!1)})),t.selectedDates=[],t._selectedCells=[],"many"===n||"range"===n){const e=t.$.monthsContainer.children;for(let a=0;a<e.length;a++)t._getMonthCells(e[a]).map((e=>{t._setCellState(e,"hover",!1)}))}t.$.footer&&t._refreshFooter(),t.$.hiddenInput.value=t.selectedDates.toString(),!e&&t.isInitialized&&a.length&&(t.$.fireEvent("change",{value:[]}),t._updateTargetValue()),t.$.title&&t._refreshTitle()}else t.set("selectedDates",[])}_bodyBlurStateHandler(e){this._bodyStateHandler(e),this.$.fireEvent("blur")}_bodyFocusStateHandler(e){this._bodyStateHandler(e),this.$.fireEvent("focus")}_bodyStateHandler(e){const t=this;if(t._focusedCell){if("blur"===e.type||"focus"===e.type&&t._noFocusingRequired)return t._noFocusingRequired=!1,void t._setCellState(t._focusedCell,"focus",!1);if("month"!==t.displayMode)return void("focus"!==e.type||t.$.dateViewContainer.querySelector("smart-calendar-cell[focus]")||t._setCellState(t._focusedCell||t.$.dateViewContainer.querySelector(".smart-calendar-cell"),"focus",!0))}"focus"===e.type&&t._focusCell()}_containerWheelHandler(e){const t=this;if(t.disabled||t.readonly||"month"!==t.displayMode&&"list"===t.displayModeView)return;let a,n;n=document.activeElement,t.shadowRoot?n=t.shadowRoot.activeElement:t.isInShadowDOM&&(n=t.getRootNode().activeElement),t.$.yearElement===n&&(a=12),(n&&t.shadowRoot||n.closest("smart-calendar")===t)&&(a=e.target===t.$.yearElement?12:1),a&&(e.preventDefault(),a=12===a?a:a*t.months,e.deltaY>0?t.navigate(-a):t.navigate(a))}_downHandler(e){const t=this;let a=e.originalEvent.target;if(t._dragStartDetails=void 0,t.disabled||t.readonly)return;if(t.hasRippleAnimation&&(a.value instanceof Date||a.parentElement&&a.parentElement.classList.contains("smart-calendar-title")||a.parentElement===t.$.dateElement)&&Smart.Utilities.Animation.Ripple.animate(a,e.pageX,e.pageY),a=e.originalEvent.target.closest(".smart-calendar-header"),e.originalEvent.target.closest(".smart-calendar-year-container")&&"decade"!==t.displayMode){if("classic"===t.calendarMode)return;return void t._showDateView("year")}if(e.originalEvent.target.closest(".smart-calendar-date-container")&&"month"!==t.displayMode){if("classic"===t.calendarMode)return;return void t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell,"month")}if(t._animationStarted&&t._animateNavigationCompleted(),Smart.Utilities.Core.isMobile&&e.originalEvent.target.closest(".smart-calendar-body")===t.$.body)return void(t._dragStartDetails={x:e.pageX,y:e.pageY,startTime:Date.now(),target:e.originalEvent.target});if(a=e.originalEvent.target,a.closest(".smart-calendar-week")||a.parentElement===t.$.dateViewContainer){for(;a&&!(a.value instanceof Date);)a=a.parentElement;return void(a&&("month"!==t.displayMode?t._displayModeHandler(a):t._weeksDownHandler(e,a)))}if(a.closest(".smart-calendar-month-element"))return;if(e.originalEvent.stopPropagation(),"list"===t.displayModeView&&"month"!==t.displayMode)return a=(t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target).closest("smart-list-item"),void(a&&t._displayModeHandler(a));const n=document.scrollingElement||document.documentElement,l=n.scrollLeft,i=n.scrollTop;t.unfocusable||t.focus(),window.scrollTo(l,i)}_displayModeHandler(e,t){const a=this;if(a._animationStarted&&a._animateNavigationCompleted(),e instanceof HTMLElement&&e.closest(".smart-calendar-week")&&e.otherMonth){if("decade"===a.displayMode&&(e.value.getFullYear()<a.min.getFullYear()||e.value.getFullYear()>a.max.getFullYear()))return;if("year"===a.displayMode&&(e.value.getFullYear()<a.min.getFullYear()||e.value.getFullYear()===a.min.getFullYear()&&e.value.getMonth()<a.min.getMonth()||e.value.getFullYear()>a.max.getFullYear()||e.value.getFullYear()===a.max.getFullYear()&&e.value.getMonth()>a.max.getMonth()))return}switch(t=t||a.displayMode){case"year":t="month";break;case"decade":t="year"}if(a.displayMode===t)return;const n=a.$.listViewContainer,l=n&&n.contains(e);a.$.fireEvent("displayModeChanging",{oldDisplayMode:a.displayMode,newDisplayMode:t}).defaultPrevented||(a.set("displayMode",t),a.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),e.parentElement!==a.$.dateViewContainer||e.disabled||e.restricted||a._focusCell(e),a.hasAnimation?(l&&e instanceof HTMLLIElement?e.offsetHeight?a.$.animationPanel.style.transformOrigin=e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px":a.$.animationPanel.style.transformOrigin=n.offsetLeft+n.offsetWidth/2+"px "+(n.offsetTop+n.offsetHeight/2)+"px":(a.$.dateViewContainer.style.order=1,a.$.nextMonthsContainer.style.order=3,e=a._focusedCell,a.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px"),a._animateView(1,e)):a._setDisplayModeContent(e.value instanceof Date?e.value:new Date(e.getAttribute("value")||e.value)))}_animateView(e,t){const a=this;let n,l,i=t instanceof Date?t:new Date(t.getAttribute("value")||t.value),s=!1,o=1,r=1;const d=a.$.listViewContainer;"list"===a.displayModeView?n=d.contains(t)?d:l="month"!==a.displayMode?a.$.monthsContainer:d:t.value instanceof Date||(t=a._focusedCell?a._focusedCell:a._selectedCells.length>0?a._selectedCells[a._selectedCells.length-1]:a._getCellByDate(new Date)),n||(n=t.parentElement===a.$.dateViewContainer?a.$.dateViewContainer:a.$.monthsContainer),l||(l="month"===a.displayMode?a.$.monthsContainer:"list"===a.displayModeView?d:a.$.dateViewContainer),l.style.transformOrigin=a.$.animationPanel.style.transformOrigin,n===d?(a.$.animationPanel.innerHTML="",a.$.animationPanel.appendChild(n.cloneNode(!0))):a.$.animationPanel.innerHTML=n.innerHTML,a._setDisplayModeContent(i),n.style.order=1,a.$.nextMonthsContainer.style.order=3,a.$.body[a._animationSettings.scrollSize]=0,a.$.animationPanel.style.width=a.$.body.offsetWidth+"px",a.$.animationPanel.style.height=a.$.body.offsetHeight+"px",a.$.animationPanel.style.transform="scale(1)",a.$.animationPanel.style.opacity=1,a.$animationPanel.removeClass("smart-hidden"),l.style.opacity="0",l.style.transform="scale(3.5)",n.$.hasClass("smart-calendar-date-view-container")?a.$animationPanel.addClass("smart-calendar-date-view-container"):a.$animationPanel.removeClass("smart-calendar-date-view-container"),cancelAnimationFrame(a._animationId),a._animationId=requestAnimationFrame((function t(){if((e>0&&o>=3.5||e<0&&o<=0)&&(s=!0),s){if(cancelAnimationFrame(a._animationId),a.$animationPanel.addClass("smart-hidden"),a.$.animationPanel.style.transform="",a.$.animationPanel.style.opacity="",n.style.order=1,a.$.nextMonthsContainer.style.order=3,a.$.body[a._animationSettings.scrollSize]=0,l.style.transform="",l.style.opacity="",a.unfocusable)return;"month"===a.displayMode?a.$.body.focus():"list"===a.displayModeView&&a.focus()}else a.$.animationPanel.style.opacity=r,l.style.opacity=1-r,r-=.05,e>0?(a.$.animationPanel.style.transform="scale("+o+")",l.style.transform="scale("+Math.min((o-1)/2,1)+")",o+=.125):(a.$.animationPanel.style.transform="scale("+Math.max(o,0)+")",l.style.transform="scale("+Math.max(1+o,1)+")",o-=.06),a._animationId=requestAnimationFrame(t)}))}_documentUpHandler(e){const t=this;let a=e.originalEvent.target;if((t.isInShadowDOM||t.shadowRoot&&a===t)&&(a=e.originalEvent.composedPath()[0]),t._newRangeSelectionStarted&&!t.$.container.contains(a)&&delete t._newRangeSelectionStarted,a&&a.classList&&a.classList.contains("smart-calendar-cell")&&(e.originalEvent.stopPropagation(),e.originalEvent.preventDefault(),e.preventDefault()),!Smart.Utilities.Core.isMobile||!t._dragStartDetails||e.originalEvent.target.closest(".smart-calendar-list-view"))return;delete t._previousIteration;const n=Date.now();let l={};(t.isInShadowDOM||t.shadowRoot&&a===t)&&(a=e.originalEvent.composedPath()[0]),"portrait"===t.scrollButtonsNavigationMode?(l.coordinate="y",l.direction="pageY"):(l.coordinate="x",l.direction="pageX");const i=t._dragStartDetails.step*(t.rightToLeft?-1:1);if(Math.abs(t._dragStartDetails[l.coordinate]-e[l.direction])<=10){if(a="list"===t.displayModeView&&"month"!==t.displayMode?a.closest("smart-list-item"):a,!a)return void(t._dragStartDetails=void 0);if("month"!==t.displayMode)return t._displayModeHandler(a),"portrait"===t.scrollButtonsNavigationMode?t.$.body.scrollTop=0:t.$.body.scrollLeft=0,void(t._dragStartDetails=void 0);if(t._weeksDownHandler(e,a),!t.disableAutoNavigation&&a.otherMonth)return}else{const a=Math.abs((e[l.direction]-t._dragStartDetails[l.coordinate])/(n-t._dragStartDetails.startTime));if(a>1){const e=parseInt(a);for(let a=0;a<e;a++)if(!t.navigate(i)){t._cancelAnimation();break}return void(t._dragStartDetails=void 0)}}if(!t.hasAnimation)return t.navigate(t._dragStartDetails.step),void(t._dragStartDetails=void 0);let s=("month"!==t.displayMode?t.$.dateViewContainer[t._animationSettings.scrollMax]:t.$.monthsContainer[t._animationSettings.scrollMax])+t.$.monthsSeparator[t._animationSettings.size];if(t._dragStartDetails.step>0&&t.$.body[t._animationSettings.scrollSize]>s*t._animationSettings.easeThreshold||t._dragStartDetails.step<0&&t.$.body[t._animationSettings.scrollSize]<s*t._animationSettings.easeThreshold)return t._animateNavigation(t._dragStartDetails.navigationDate,i,!0),6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&t._updateWeeksVisibility(i,t._getCellByDate(t._dragStartDetails.navigationDate,t.$.nextMonthsContainer)),t.$.fireEvent("navigationChange",{value:new Date(t._dragStartDetails.navigationDate),type:t.displayMode}),void(t._dragStartDetails=void 0);t._cancelAnimation(),t._dragStartDetails=void 0}_cancelAnimation(){const e=this,t="month"!==e.displayMode?e.$.dateViewContainer:e.$.monthsContainer;let a=e.$.animationPanel.style.transform,n=e.$.animationPanel.style.opacity;a&&(a=parseFloat(a.substring(a.indexOf("(")+1||0,a.indexOf(")")))),t.style.order=1,e.$.nextMonthsContainer.style.order=3,e.$.body[e._animationSettings.scrollSize]=0,e._animationId=requestAnimationFrame((function t(){if(!a||a>=3.5){cancelAnimationFrame(e._animationId),e.$animationPanel.addClass("smart-hidden"),e.$.animationPanel.style.transform="",e.$.animationPanel.style.opacity="";const t="month"===e.displayMode?e.$.monthsContainer:e.$.listViewContainer;return t.style.transform="",t.style.opacity="",e.unfocusable||("month"===e.displayMode?e.$.body.focus():"list"===e.displayModeView&&e.focus()),void(e._animationStarted=!1)}e.$.animationPanel.style.opacity=n-=.25,e.$.animationPanel.style.transform="scale("+(a+=.5)+")",e._animationId=requestAnimationFrame(t)}))}_focusCell(e,t){const a=this;if(a._focusedCell&&a._setCellState(a._focusedCell,"focus",!1),a.disabled||a.readonly)return;if(e){if("month"!==a.displayMode)return a._setCellState(e,"focus",!0),void(a._focusedCell=e);if(e.disabled||e.restricted)return;return t||a._setCellState(e,"focus",!0),void(a._focusedCell=e)}if("month"!==a.displayMode&&0===a.$.monthsContainer.offsetHeight)return;const n=a._selectedCells[a._selectedCells.length-1];if(n&&n.offsetHeight)a._setCellState(n,"focus",!0),a._focusedCell=n;else{const e=a.$.monthsContainer.children;if(!e[0]._date||a.min.getTime<e[0]._date.getTime())return;const t=a._getMonthCells(e[0],a.rightToLeft);for(let e=0;e<t.length;e++){const n=t[e];if(!n.otherMonth){if(n.disabled||n.restricted||!n.offsetHeight)continue;a._focusedCell=n;break}}}a._focusedCell&&a._setCellState(a._focusedCell,"focus",!0)}_getDays(e,t){const a=t.length;let n=[];if(a>0)for(let l=0;l<a;l++)t[l].getFullYear()===e.getFullYear()&&t[l].getMonth()===e.getMonth()&&n.push(t[l].getDate());return n}_getCellByDate(e,t){const a=this;if(!(e instanceof Date))return;if(t||(t=a.$.monthsContainer),"month"!==a.displayMode){if("list"===a.displayModeView)return;let t=arguments[1]?a.$.nextMonthsContainer.children:a.$.dateViewContainer.children;for(let n=0;n<t.length;n++)if("year"!==a.displayMode){if(t[n].value.getFullYear()===e.getFullYear())return t[n]}else if(t[n].value.getMonth()===e.getMonth())return t[n];return}let n,l,i=t.children;for(let t=0;t<i.length;t++)if(e.getFullYear()===i[t]._date.getFullYear()&&e.getMonth()===i[t]._date.getMonth()){n=i[t];break}if(n){l=a._getMonthCells(n);for(let t=0;t<l.length;t++)if((!l[t].otherMonth||l[t].hover)&&l[t].value.getMonth()===e.getMonth()&&l[t].value.getDate()===e.getDate())return l[t]}}_getMonthCells(e,t){const a=e.getElementsByClassName("smart-calendar-week");let n=[];if(t)for(let e=0;e<a.length;e++){let t=a[e].children;for(let e=t.length-1;e>0;e--)t[e].classList.contains("smart-calendar-cell")&&n.push(t[e])}else for(let e=0;e<a.length;e++){let t=a[e].children;for(let e=1;e<t.length;e++)t[e].classList.contains("smart-calendar-cell")&&n.push(t[e])}return n}_getWeekNumber(e){const t=this;let a,n=new Date(e.getFullYear(),0,1),l=Math.round((e.getTime()-n.getTime()-6e4*(e.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)+1,i=n.getDay()-t.firstDayOfWeek;return i=i>=0?i:i+7,i<4?(a=Math.floor((l+i-1)/7)+1,a>52&&(n=new Date(e.getFullYear()+1,0,1),i=n.getDay()-t.firstDayOfWeek,i=i>=0?i:i+7,a=i<4?1:53)):a=Math.round((l+i-1)/7),a}_handleDateSelection(e){const t=this;if(void 0!==e&&!e.disabled&&!e.restricted)switch(t.selectionMode){case"none":t._focusCell(e);break;case"oneExtended":case"one":case"default":if(t._keysPressed.Control)return t.selectedDates.length>1||1===t.selectedDates.length&&!e.selected?void t._selectDate(e.value):void t._focusCell(e);if(t._keysPressed.Shift)return void t._selectMultipleDates(new Date(t.selectedDates[0]),e);t._clearSelection(!0),t._selectDate(e.value,t._selectedCells.indexOf(e.value)>-1);break;case"many":{if(0===t.selectedDates.length)return void t._selectDate(e.value);const a=t.selectedDates[t.selectedDates.length-1];let n=new Date(t.selectedDates[0]);if(e.value.getTime()===n.getTime()||e.value.getTime()===a.getTime())return t._clearSelection(),void t._focusCell(e);t.selectedDates.length>0&&t._selectMultipleDates(n,e);break}case"range":{if(t.selectedDates.length>1&&!t._keysPressed.Control&&!t._newRangeSelectionStarted&&t._clearSelection(!0),0===t.selectedDates.length||t._keysPressed.Control&&t.selectedDates.length>1&&!t._newRangeSelectionStarted){if(e.value&&t.selectedDates.find((t=>t.getTime()===e.value.getTime())))return;return t._newRangeSelectionStarted=!0,void t._selectDate(e.value)}const a=t.selectedDates[t.selectedDates.length-1];let n=t._keysPressed.Control||t._newRangeSelectionStarted?a:new Date(t.selectedDates[0]);t.selectedDates.length>0&&t._selectMultipleDates(n,e),delete t._newRangeSelectionStarted;break}case"zeroOrMany":t._selectDate(e.value);break;case"oneOrMany":if(1===t.selectedDates.length&&e.selected)return void t._focusCell(e);t._selectDate(e.value);break;case"zeroOrOne":if(1===t.selectedDates.length&&e.selected)return void t._selectDate(e.value);t._clearSelection(!0),t._selectDate(e.value);break;case"week":{if(e.selected&&(e.value.getTime()===t.selectedDates[0].getTime()||e.value.getTime()===t.selectedDates[t.selectedDates.length-1].getTime()))return t._clearSelection(),void t._focusCell(e);t._clearSelection(!0);let a=new Date(e.value);t._selectDate(a);for(let e=1;e<7;e++)a.setDate(a.getDate()+1),t._selectDate(a);t._isDateInView(a)||t.navigate(1);break}}}_handleImportantDateTemplate(){const e=this;if(e._importantDatesTemplate=e._validateTemplate("importantDatesTemplate",e.importantDatesTemplate),!e._importantDatesTemplate||!e._importantDatesTemplate.content)return;let t=e._importantDatesTemplate.content;const a=t.childNodes.length,n=/{{\w+}}/g;let l;e._bindingDetails=[];for(let i=0;i<a;i++)if(l=n.exec(t.childNodes[i].innerHTML),l)return void e._bindingDetails.push({childNodeIndex:i,bindingString:l[0]})}_handleLayoutTemplate(e,t){const a=this,n=a._validateTemplate(e.$.hasClass("smart-header")?"headerTemplate":e.$.hasClass("smart-calendar-footer")?"footerTemplate":"titleTemplate",t);if(!n||!n.content)return void("function"==typeof t&&t(e,{}));a._layoutTemplates||(a._layoutTemplates=[]);let l=document.importNode(n.content,!0);e.innerHTML="";const i=l.childNodes.length,s=/{{\w+}}/g;let o,r=[];for(let e=0;e<i;e++)o=s.exec(l.childNodes[e].innerHTML),o&&r.push({childNodeIndex:e,bindingString:o[0]});if(a._layoutTemplates=a._layoutTemplates.filter((t=>t.selector!==e)),a._layoutTemplates.push({selector:e,template:n,bindings:r}),a.shadowRoot)return e.innerHTML="<slot></slot>",void a.appendChild(l);e.appendChild(l)}_handleCalendarCellHover(e,t){const a=this;if(!a._animationStarted){if("month"===a.displayMode)if("mouseover"===e.type&&("many"===a.selectionMode||"range"===a.selectionMode&&a._newRangeSelectionStarted)&&a.selectedDates.length>0){const e=a.$.monthsContainer.children;for(let t=0;t<e.length;t++)a._getMonthCells(e[t]).map((e=>{a._setCellState(e,"hover",!1)}));let n=new Date("range"===a.selectionMode?a.selectedDates[a.selectedDates.length-1]:a.selectedDates[0]),l=new Date(t.value),i=t;const s=n.getTime()>l.getTime()?-1:1,o=function(){i=a._getCellByDate(n),!i||i.selected||i.restricted||a._setCellState(i,"hover",!0)};if(n.getTime()!==l.getTime()){for(n.setDate(n.getDate()+s);n.getTime()!==l.getTime();)o(),n.setDate(n.getDate()+s);o()}}else a._setCellState(t,"hover",!1);"mouseover"!==e.type||t.otherMonth?a._setCellState(t,"hover",!1):a._setCellState(t,"hover",!0)}}_handleMonths(e,t){const a=this;let n;function l(e){let t,n=e.children.length,l=document.createDocumentFragment();for(;n<a.months;n++)t=a.$.month.cloneNode(!1),t.innerHTML=a.$.month.innerHTML,l.appendChild(t);return l}function i(t){let n=t.children;for(let t=0;t<n.length;t++)a._setMonth(e,n[t]),e.setMonth(e.getMonth()+1);a._setWeeksVisibility(t),a._refreshHeaderElements(),a._refreshHeaderTitle(),a.tooltip&&a.$.tooltip&&a.$.tooltip.close(),a.$.body===document.activeElement&&a._focusCell()}if(e||(e=a._viewDates&&a._viewDates.length>0?a._viewDates[0]:new Date),e=new Date(Math.min(Math.max(a.min.getTime(),e.getTime()),a.max.getTime())),t||(t=a.$.monthsContainer),a._selectedCells=[],a.hasAnimation){for(n=a.$.nextMonthsContainer.children,n.length>0&&n[0].value instanceof Date&&(a.$.nextMonthsContainer.innerHTML="");a.$.nextMonthsContainer.childElementCount<a.months;)a.$.nextMonthsContainer.appendChild(l(a.$.nextMonthsContainer));for(;a.$.nextMonthsContainer.childElementCount>a.months;)a.$.nextMonthsContainer.removeChild(n[a.$.nextMonthsContainer.childElementCount-1]);if(arguments[1]===a.$.nextMonthsContainer)return void i(a.$.nextMonthsContainer)}if(n=a.$.monthsContainer.children,n.length>a.months){for(;a.$.monthsContainer.childElementCount>a.months;)a.$.monthsContainer.removeChild(n[a.$.monthsContainer.childElementCount-1]),a._viewDates.pop();i(a.$.monthsContainer)}else a.$.monthsContainer.children.length!==a.months?(a._viewDates=[],a.$.monthsContainer.appendChild(l(a.$.monthsContainer)),i(a.$.monthsContainer)):i(a.$.monthsContainer)}_headerChangeHandler(e){const t=this;if(e.stopPropagation(),t.disabled||t.readonly)return;if(e.target.ownerElement===t.$.monthElement&&0!==t._changeEventFired)return void t._changeEventFired--;const a=t.displayMode;e.target===t.$.yearElement&&(t._viewDates[0].setFullYear(Math.min(Math.max(t.min.getFullYear(),isNaN(parseInt(t.$.yearElement.value))?0:parseInt(t.$.yearElement.value)),t.max.getFullYear())),t._handleMonths(t._viewDates[0])),!t.$.monthElement||e.target!==t.$.monthElement&&e.target.ownerElement!==t.$.monthElement||(t._handleMonths(new Date(t.$.monthsContainer.children[0]._date.getFullYear(),t.$.monthElement.selectedIndex,1)),"month"!==a&&t._setDisplayMode(t.displayMode,t.displayMode="month"))}_headerClickHandler(e){const t=this;if(t.disabled||t.readonly)return;let a=e.target.closest("smart-repeat-button");if(!a||!a.disabled){switch(a){case t.$.previousMonthButton:return t._isInteractiveNavigation=!0,void t.navigate(-1*t.months*(t.rightToLeft?-1:1));case t.$.nextMonthButton:return t._isInteractiveNavigation=!0,void t.navigate(1*t.months*(t.rightToLeft?-1:1));case t.$.previousYearButton:return void t.navigate(-12);case t.$.nextYearButton:return void t.navigate(12)}"classic"!==t.calendarMode&&e.target.closest(".smart-calendar-date-element")&&(t._animationStarted&&t._animateNavigationCompleted(),t._isInteractiveNavigation=!0,t._showDateView())}}_selectMultipleDates(e,t){const a=this;if(t instanceof HTMLElement&&(t=t.value),a._newRangeSelectionStarted?a._selectDate(e,!0):a._clearSelection(!0),"range"!==a.selectionMode||t.getTime()!==e.getTime()){if((e=new Date(e)).getTime()<t.getTime())for(;e.getTime()<=t.getTime();)a.selectedDates.find((t=>t.getTime()===e.getTime()))||a._selectDate(e,!0),e.setDate(e.getDate()+1);else if(e.getTime()>t.getTime())for(;e.getTime()>=t.getTime();)a.selectedDates.find((t=>t.getTime()===e.getTime()))||a._selectDate(e,!0),e.setDate(e.getDate()-1);else a._selectDate(t,!0);a.$.hiddenInput.value=a.selectedDates.toString(),a._refreshFooter(),a.isInitialized&&(a.$.fireEvent("change",{value:a.selectedDates}),a._updateTargetValue()),a._refreshTitle()}}_setDisplayMode(e,t,a){const n=this;if(n.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),0!==arguments.length&&n.hasAnimation)if(n._animationStarted&&(n.displayMode=e,n._animateNavigationCompleted(),n.displayMode=t),"month"===e&&"year"===t||"year"===e&&"decade"===t)n.displayMode=e,n._showDateView(a?void 0:n.displayMode);else if("month"===e&&"decade"===t)n._showDateView(n.displayMode="year");else{let e;"list"===n.displayModeView?(e=n.$.listViewContainer.querySelector("li.active"),n.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop>0?e.offsetTop-e.offsetHeight/2:e.offsetTop+e.offsetHeight/2)+"px"):(n.$.dateViewContainer.style.order=1,n.$.nextMonthsContainer.style.order=3,e=n._focusedCell,n.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px"),n._animateView(1,e)}else{if("classic"===n.calendarMode)return void(n.displayMode="month");if("month"!==n.displayMode&&(n.$monthsContainer.addClass("smart-hidden"),n.$dateViewContainer.hasClass("smart-hidden")&&n.$dateViewContainer.removeClass("smart-hidden")),!n.isCompleted&&"month"===n.displayMode)return;n._setDisplayModeContent()}}_setDisplayModeContent(e,t){const a=this;let n=e&&"Invalid Date"!==e.toString()?e:a.selectedDates.length>0?a.selectedDates[a.selectedDates.length-1]:new Date;n.setTime(Math.min(Math.max(n.getTime(),a.min.getTime()),a.max.getTime())),n.setHours(0,0,0,0);const l=a._prepareView(n);if(!l)return;let i;t?(a.$.nextMonthsContainer.innerHTML=a.$.dateViewContainer.innerHTML,i=a.$.nextMonthsContainer):i=a.$.dateViewContainer;const s=i.children;let o;for(let e=0;e<s.length;e++){const t=s[e];t.innerHTML=l.viewContent[e],t.value=l.dates[e],"year"===a.displayMode?(t.value.getFullYear()<a.min.getFullYear()||t.value.getFullYear()===a.min.getFullYear()&&t.value.getMonth()<a.min.getMonth()||t.value.getFullYear()>a.max.getFullYear()||t.value.getFullYear()===a.max.getFullYear()&&t.value.getMonth()>a.max.getMonth()?a._setCellState(t,"otherMonth",!0):a._setCellState(t,"otherMonth",!1),n.getFullYear()===t.value.getFullYear()&&n.getMonth()===t.value.getMonth()&&(o=t)):"decade"===a.displayMode&&(0===e||e===s.length-1||t.value.getFullYear()<a.min.getFullYear()||t.value.getFullYear()>a.max.getFullYear()?a._setCellState(t,"otherMonth",!0):a._setCellState(t,"otherMonth",!1),n.getFullYear()===t.value.getFullYear()&&(o=t)),a._setCellState(t,"hover",!1),a._setCellState(t,"focus",!1)}if(o.otherMonth)for(let e=0;e<s.length;e++)if(!s[e].otherMonth){o=s[e];break}a._mobileScrolling||(a._focusedCell&&a._setCellState(a._focusedCell,"focus",!1),a._focusedCell=o,a._focusCell(a._focusedCell),a._refreshHeaderTitle(),a._refreshHeaderElements(),a.$.fireEvent("displayModeChange"),a._isInteractiveNavigation?a._isInteractiveNavigation=void 0:(a._setCellState(o,"focus",!0),setTimeout((function(){a.unfocusable||(a.$.body.focus(),a._focusCell(a._focusedCell))}),0)))}_prepareView(e){const t=this,a=t.$.listViewContainer;let n,l,i=[],s=[];function o(e,t,a){let n=new Date(e,t+1,0),l=n.getDate();return a>l?n.setDate(l):n.setDate(a),n}if("month"===t.displayMode)return t.$nextMonthsContainer.hasClass("smart-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-date-view-container"),a&&a.classList.add("smart-hidden"),t.$dateViewContainer.hasClass("smart-visibility-hidden")&&t.$dateViewContainer.removeClass("smart-visibility-hidden"),t._isDateInView(e)||t._handleMonths(e),t.$header.hasClass("smart-hidden")&&t.$header.removeClass("smart-hidden"),t.$body.hasClass("smart-calendar-list-view")&&t.$body.removeClass("smart-calendar-list-view"),t.$dateContainer.addClass("smart-calendar-selected"),t.$yearContainer.removeClass("smart-calendar-selected"),t.$dateViewContainer.addClass("smart-hidden"),t.$monthsContainer.removeClass("smart-hidden"),t._refreshHeaderTitle(),t.$.body.setAttribute("tabindex",t.tabIndex>0?t.tabIndex:0),t._refreshHeaderElements(),t.unfocusable||t.$.body.focus(),t._focusCell(t._getCellByDate(e)),void t.$.fireEvent("displayModeChange");if("list"===t.displayModeView)return t._setDisplayModeListContent(e),void t.$.fireEvent("displayModeChange");if(t.$header.hasClass("smart-hidden")&&t.$header.removeClass("smart-hidden"),t.$dateViewContainer.hasClass("smart-visibility-hidden")&&t.$dateViewContainer.removeClass("smart-visibility-hidden"),a&&a.classList.add("smart-hidden"),t.$.body.setAttribute("tabindex",t.tabIndex>0?t.tabIndex:0),"year"===t.displayMode){let a=new Date;for(let n=0;n<12;n++)a=o(a.getFullYear(),n,a.getDate()),i.push(a.toLocaleDateString(t.locale,{month:"short"})),s.push(o(e.getFullYear(),n,e.getDate()))}else{n=e?e.getFullYear():t._viewDates[0].getFullYear(),l=n%10,0!==l&&(n-=l),n-=1;for(let t=0;t<12;t++)i.push(n+""),s.push(new Date(n,e.getMonth(),e.getDate())),++n}return{viewContent:i,dates:s}}_setDisplayModeListContent(e){const t=this;let a=[];function n(e,t,a){let n=new Date(e,t+1,0),l=n.getDate();return a>l?n.setDate(l):n.setDate(a),n}if(t.$dateViewContainer.addClass("smart-visibility-hidden"),"year"===t.displayMode){let l=new Date;for(let i=0;i<12;i++)l=n(l.getFullYear(),i,l.getDate()),a.push({label:l.toLocaleDateString(t.locale,{month:"short"}),value:n(e.getFullYear(),i,e.getDate()).toDateString()});t.$yearContainer.removeClass("smart-calendar-selected"),t.$dateContainer.addClass("smart-calendar-selected")}else{let n=t.min.getFullYear(),l=t.max.getFullYear();l=Math.min(t.max.getFullYear(),e.getFullYear()+10),n=Math.max(t.min.getFullYear(),l-10);for(let t=n;t<l;t++)a.push({label:t.toString(),value:new Date(t,e.getMonth(),e.getDate()).toDateString()});t.$yearContainer.addClass("smart-calendar-selected"),t.$dateContainer.removeClass("smart-calendar-selected")}t._prepareListViewer(a,e.toDateString()),t._refreshHeaderTitle(),t._refreshHeaderElements(),t.unfocusable||t.focus()}_prepareListViewer(e=[],t){const a=this,n=a.$.body;let l=a.$.listViewContainer;l||(a.$.listViewContainer=l=document.createElement("smart-scroll-viewer"),l.classList.add("smart-input-drop-down-menu","smart-calendar-list-view"),l.ensureVisible=a._listViewerEnsureVisible.bind(a),l._handleKeyStrokes=a._listViewerKeyStrokesHandler.bind(a),l._setActiveDescendant=a._listViewerSetActiveDescendant.bind(a));let i=l.querySelector("ul");i||(i=document.createElement("ul"),i.onclick=a._listViewContainerItemClickHandler.bind(a),l.appendChild(i)),n.contains(l)&&n.removeChild(l),i.innerHTML="";for(let a=0;a<e.length;a++){const n=e[a],s=n.label,o=n.value,r=document.createElement("li"),d=document.createElement("a");t===o?(r.setAttribute("aria-selected",!0),r.classList.add("active"),t=r):r.setAttribute("aria-selected",!1),r.id=l.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),r.setAttribute("value",o),r.setAttribute("role","option"),r.setAttribute("aria-label",s),d.innerHTML=s,d.setAttribute("aria-hidden",!0),r.appendChild(d),i.appendChild(r)}l.classList.remove("smart-hidden"),n.classList.add("smart-calendar-list-view"),n.removeAttribute("tabindex"),n.insertBefore(l,a.$.animationPanel),l.refresh(),l.ensureVisible()}_listViewerEnsureVisible(){const e=this.$.listViewContainer,t=e.querySelector(".active");if(!t)return;const a=Array.from(e.querySelectorAll("li"));t.offsetTop+t.offsetHeight>=e.scrollTop+e.offsetHeight&&(e.scrollTop=t.offsetTop+t.offsetHeight),(t.offsetTop<=e.scrollTop||t.offsetTop>=e.scrollTop+e.offsetHeight)&&(e.scrollTop=t.offsetTop),0===a.indexOf(t)?e.scrollTop=0:a.indexOf(t)===a.length-1&&(e.scrollTop=e.scrollHeight)}_listViewerKeyStrokesHandler(e){if(["ArrowUp","ArrowDown"].indexOf(e)<0)return;event.preventDefault();const t=this.$.listViewContainer,a=t.querySelector(".active");if(!a){const e=t.querySelector("li");return e.classList.add("active"),void t._setActiveDescendant(e)}const n=a["ArrowDown"===e?"nextElementSibling":"previousElementSibling"];n&&(a.classList.remove("active"),n.classList.add("active"),t._setActiveDescendant(n),t.ensureVisible())}_listViewerSetActiveDescendant(e){const t=this.$.listViewContainer;e?t.setAttribute("aria-activedescendant",e.id):t.removeAttribute("aria-activedescendant")}_listViewContainerItemClickHandler(e){const t=this,a=e.target.closest("li");a&&"list"===t.displayModeView&&"month"!==t.displayMode&&t._displayModeHandler(a)}_isDateInView(e){const t=this;if(!e)return!1;for(let a=0;a<t._viewDates.length;a++)if(e.getFullYear()===t._viewDates[a].getFullYear()&&e.getMonth()===t._viewDates[a].getMonth()){let a=t._getCellByDate(e,t._animationStarted?t.$.nextMonthsContainer:void 0);if(!a)return;return!(a.otherMonth||!a.offsetHeight||a.classList.contains("smart-visibility-hidden"))}return!1}_keyDownHandler(e){const t=this;if(t.disabled||t.readonly)return;const a=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;switch(a){case t.$.yearElement:"Escape"===e.key&&t._refreshHeaderElements();break;case t.$.dateElement:if("default"===t.calendarMode&&" "===e.key||"Enter"===e.key)return e.preventDefault(),t._isInteractiveNavigation=!0,void t._showDateView();t._focusedCell||t._focusCell(),e.key.indexOf("Arrow")>-1&&t.$.dateElement===a&&!t.unfocusable&&t.$.body.focus(),t._navigateDays(e);break;case t.$.body:" "===e.key&&e.preventDefault(),t._navigateDays(e);break;case t.$.yearContainer:if(" "!==e.key&&"Enter"!==e.key||"decade"===t.displayMode||(e.preventDefault(),t._isInteractiveNavigation=!0,t._showDateView("year")),e.key.indexOf("Arrow")>-1){if(e.preventDefault(),t._focusedCell||t._focusCell(),"month"!==t.displayMode&&"list"===t.displayModeView)return t.unfocusable||t.focus(),void t.$.listViewContainer._handleKeyStrokes(e.key);t._navigateDays(e)}break;case t.$.dateContainer:if(" "!==e.key&&"Enter"!==e.key||"month"===t.displayMode||(e.preventDefault(),t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell,"month")),e.key.indexOf("Arrow")>-1){if(t._focusedCell||t._focusCell(),"month"!==t.displayMode&&"list"===t.displayModeView)return t.unfocusable||t.focus(),void t.$.listViewContainer._handleKeyStrokes(e.key);t._navigateDays(e)}break;default:if("month"!==t.displayMode&&"list"===t.displayModeView)return["Arrow","End","Home","Page"].indexOf(e.key)&&e.preventDefault()," "===e.key||"Enter"===e.key||e.ctrlKey&&("ArrowUp"===e.key||"ArrowDown"===e.key)?void t._navigateDays(e):void t.$.listViewContainer._handleKeyStrokes(e.key);e.key.indexOf("Arrow")>-1&&(t._focusedCell||t._focusCell(),t._navigateDays(e))}}_showDateView(e){const t=this;switch(e=e||t.displayMode){case"month":e="year";break;case"year":e="decade"}if(t.displayMode===e)return;if(t.$.fireEvent("displayModeChanging",{oldDisplayMode:t.displayMode,newDisplayMode:e}).defaultPrevented)return;let a;if(t.displayMode=e,"list"===t.displayModeView&&"month"!==t.displayMode){t._setDisplayModeListContent(t._focusedCell?t._focusedCell.value:t._viewDates[0]);const e=t.$.listViewContainer;e.classList.remove("smart-hidden"),a=e.querySelector("li.active"),a.offsetHeight?t.$.animationPanel.style.transformOrigin=a.offsetLeft+a.offsetWidth/2+"px "+(a.offsetTop>0?a.offsetTop-a.offsetHeight/2:a.offsetTop+a.offsetHeight/2)+"px":t.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(a.offsetTop>0?a.offsetTop-a.offsetHeight/2:e.offsetTop+e.offsetHeight/2)+"px"}else t._focusedCell||t._focusCell(),a=t._focusedCell,t.$.animationPanel.style.transformOrigin=a.offsetLeft+a.offsetWidth/2+"px "+(a.offsetTop+a.offsetHeight/2)+"px";t.$monthsContainer.addClass("smart-hidden"),t.$dateViewContainer.hasClass("smart-hidden")&&t.$dateViewContainer.removeClass("smart-hidden"),"decade"===t.displayMode&&(t.$yearContainer.addClass("smart-calendar-selected"),t.$dateContainer.removeClass("smart-calendar-selected")),t.hasAnimation?t._animateView(-1,a):t._setDisplayModeContent(t._focusedCell?t._focusedCell.value:t._viewDates[0])}_keyUpHandler(e){const t=this;t.disabled||t.readonly||"default"!==t.selectionMode&&"range"!==t.selectionMode||"Shift"!==e.key&&"Control"!==e.key||(t._keysPressed[e.key]=!1)}_handleTooltip(){const e=this,t=e.tooltip;let a=e.$.tooltip;t?(a||(a=document.createElement("smart-tooltip"),a.tooltipTemplate=e.tooltipTemplate,a.arrow=e.tooltipArrow,a.arrowDirection=e.tooltipArrowDirection,a.offset=e.tooltipOffset,a.position=e.tooltipPosition,a.delay=e.tooltipDelay,a.rightToLeft=e.rightToLeft,a.openMode="manual",e.$.tooltip=a),a.parentElement||e.$.calendarContainer.appendChild(a)):a&&a.remove()}_mouseEventsHandler(e){const t=this;if(t.disabled||t.readonly)return;const a=t.$.tooltip;if("mouseenter"===e.type)return void t.$.setAttributeValue("hover",!0);if("mouseleave"===e.type){if(t.$.setAttributeValue("hover",!1),t._newRangeSelectionStarted&&"range"===t.selectionMode){const e=t.$.monthsContainer.children;for(let a=0;a<e.length;a++)t._getMonthCells(e[a]).map((e=>{t._setCellState(e,"hover",!1)}))}return void(t.tooltip&&a&&a.close())}const n=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(!n.closest(".smart-calendar-week"))return void(t.tooltip&&a&&(clearTimeout(t._tooltipAutoCloseTimeout),a[a.contains(n)?"open":"close"]()));const l=n.closest(".smart-calendar-cell");if(!l)return;if(Smart.Utilities.Core.isMobile||t._handleCalendarCellHover(e,l),!t.tooltip&&a)return void a.close();const i=l.hasAttribute("important");if(clearTimeout(t._tooltipAutoCloseTimeout),i&&a&&"mouseover"===e.type)return a.selector=l,void(a.selector!==l?a.close():(t.tooltipTemplate||(a.innerHTML=0===a.innerHTML.trim().length?"Important day!":a.innerHTML),a.open(),t.$.fireEvent("open",{target:a,value:new Date(l.value)})));t._tooltipAutoCloseTimeout=setTimeout(function(){!a||"mouseout"!==e.type&&l&&i||a.close(),clearTimeout(t._tooltipAutoCloseTimeout)}.bind(t),t.tooltipDelay)}_popupEventHandler(e){const t=this,a=t.$.tooltip;if(e.stopPropagation(),e.target!==t.$.monthElement)if(e.target===a)if("close"!==e.type);else{const e=a.selector;t.$.fireEvent("close",{target:a,value:e?new Date(e.value):null})}else t.$.fireEvent(e.type,{target:e.target})}_moveHandler(e){const t=this;if(!Smart.Utilities.Core.isMobile||!t._dragStartDetails||"list"===t.displayModeView&&"month"!==t.displayMode)return;e.originalEvent.preventDefault(),e.preventDefault(),e.stopPropagation();const a={x:Math.round(e.pageX),y:Math.round(e.pageY)};let n,l,i;if(n="portrait"===t.scrollButtonsNavigationMode?a.y>t._dragStartDetails.y?-1*t.months:1*t.months:a.x<t._dragStartDetails.x?1*t.months:-1*t.months,t._previousIteration&&n===t._previousIteration.step)l=t._previousIteration.date;else if(6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode){let e,a;t._focusedCell||t._focusCell();const i=[].slice.call(t._focusedCell.closest(".smart-calendar-weeks").children).filter((e=>!e.classList.contains("smart-hidden")));if(i.length){let s;!t.rightToLeft&&n<0||t.rightToLeft&&n>0?(s=i[0].querySelectorAll(".smart-calendar-cell"),a=t.rightToLeft?s[s.length-1]:s[0]):(s=i[i.length-1].querySelectorAll(".smart-calendar-cell"),a=t.rightToLeft?s[0]:s[s.length-1]),e=new Date(a.value),e.setDate(e.getDate()+n*(t.rightToLeft?-1:1)),l=e}else l=t._getNextDate(n*(t.rightToLeft?-1:1))}else l=t._getNextDate(n*(t.rightToLeft?-1:1));if(!l)return;if(!t._dragStartDetails.navigationDate&&t.$.fireEvent("navigationChanging",{value:new Date(l),type:t.displayMode}).defaultPrevented)return t._cancelAnimation(),void(t._dragStartDetails=void 0);if(t._dragStartDetails.step=n,t._dragStartDetails.navigationDate=new Date(l),!t.hasAnimation)return;if(t._previousIteration={step:n,date:l},t._mobileScrolling=!0,"month"!==t.displayMode)t.$nextMonthsContainer.addClass("smart-calendar-date-view-container"),i=t.$.dateViewContainer,t.$.nextMonthsContainer.children[0].value instanceof Date&&t.$.nextMonthsContainer.children[1].value.getFullYear()===l.getFullYear()||t._setDisplayModeContent(l,t.$.nextMonthsContainer);else if(t.$nextMonthsContainer.hasClass("smart-calendar-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),i=t.$.monthsContainer,!t.$.nextMonthsContainer.children[0]._date||t.$.nextMonthsContainer.children[0]._date.getTime()!==l.getTime()){let e=t.$.nextMonthsContainer.children;for(let a=0;a<e.length;a++)l.setMonth(t._dragStartDetails.navigationDate.getMonth()+a*(t.rightToLeft?-1:1)),t._setMonth(new Date(l),e[a],!0)}6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&t._updateWeeksVisibility(n*(t.rightToLeft?-1:1),t._getCellByDate(l,t.$.nextMonthsContainer)),delete t._mobileScrolling,n<0?(i.style.order=3,t.$.nextMonthsContainer.style.order=1,t.$.body[t._animationSettings.scrollSize]=t.$.body[t._animationSettings.scrollMax]):(i.style.order=1,t.$.nextMonthsContainer.style.order=3,t.$.body[t._animationSettings.scrollSize]=0);const s="portrait"===t.scrollButtonsNavigationMode?"y":"x";Math.abs(t._dragStartDetails[s]-a[s])>5&&(t.$.body[t._animationSettings.scrollSize]+=2*-(a[s]-t._dragStartDetails[s]))}_getNextDate(e){const t=this;let a;if("month"!==t.displayMode){let n;const l=t._focusedCell&&t._focusedCell.value.getFullYear();if("list"===t.displayModeView)a=new Date(t.$.listViewContainer.querySelector("li").getAttribute("value"));else{let e=t._animationStarted?t.$.nextMonthsContainer:t.$.dateViewContainer;a=new Date("year"===t.displayMode?e.children[0].value:e.children[1].value)}n="year"===t.displayMode?1:0!==e?10:1,a.setFullYear(a.getFullYear()+(e>0?n:-n)),a.getTime()<t.min.getTime()&&(a=t.min),a.getTime()>t.max.getTime()&&(a=t.max);const i="month"!==t.displayMode&&"list"===t.displayModeView;if(a.getFullYear()<t.min.getFullYear()||a.getFullYear()>t.max.getFullYear()||!i&&l===a.getFullYear())return}else{let n=t._viewDates[0];if(a=new Date(n),a.setDate(1),a.setMonth(a.getMonth()+e),a.setTime(Math.min(Math.max(a.getTime(),t.min.getTime()),t.max.getTime())),n.getMonth()===a.getMonth()&&n.getFullYear()===a.getFullYear())return}return a}_navigateDays(e){const t=this;let a="ArrowUp"===e.key||"ArrowDown"===e.key?7:1,n="ArrowUp"===e.key||"ArrowLeft"===e.key||"PageUp"===e.key?-1:1;switch(e.key){case"ArrowUp":case"ArrowLeft":case"ArrowDown":case"ArrowRight":if(!t._handleArrowKeys(e,a,n))return;break;case" ":case"Enter":{if("month"!==t.displayMode)return void t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell);const e=t._focusedCell;if("oneExtended"===t.selectionMode&&e)return t._clearSelection(!0),void t._selectDate(e.value,t._selectedCells.indexOf(e.value)>-1);break}case"Control":case"Shift":return"default"===t.selectionMode&&(t._keysPressed[e.key]=!0),void("range"===t.selectionMode&&(t._keysPressed[e.key]="Control"===e.key));case"Home":case"End":{e.preventDefault();let a,n=function(t){if("Home"===e.key){for(let e=0;e<t.length;e++)if(!t[e].otherMonth&&(!t[e].disabled||!t[e].restricted)&&t[e].offsetHeight)return t[e]}else for(let e=t.length-1;e>=0;e--)if(!t[e].otherMonth&&(!t[e].disabled||!t[e].restricted)&&t[e].offsetHeight)return t[e]};if(a="month"!==t.displayMode?n(t.$.dateViewContainer.children):n(t._getMonthCells(t._focusedCell.closest(".smart-calendar-month"),t.rightToLeft)),!a)return;if(t._focusCell(a),"month"!==t.displayMode)return;break}case"PageUp":case"PageDown":if(!t._handlePageUpDownKeys(e,n))return;break;default:return}"oneExtended"!==t.selectionMode&&t._focusedCell&&t._handleDateSelection(t._focusedCell)}_handleArrowKeys(e,t,a){const n=this;let l;if("month"!==n.displayMode||n._animationStarted||n.unfocusable||n.$.body.focus(),n._focusedCell||n._focusCell(n._getCellByDate(new Date)),e.altKey)return;if(e.ctrlKey){if("ArrowDown"===e.key||"ArrowUp"===e.key){if("classic"===n.calendarMode)return;let t;switch(n.displayMode){case"month":t="ArrowDown"===e.key?"month":"year";break;case"year":t="ArrowDown"===e.key?"month":"decade";break;case"decade":t="ArrowDown"===e.key?"year":"decade"}if(t!==n.displayMode){const e=n.displayMode;n.displayMode=t,n._setDisplayMode(e,t,"month"===e),n._keysPressed&&delete n._keysPressed.Control}}return}if(e.preventDefault(),!n.rightToLeft||"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||(a*=-1),"month"!==n.displayMode&&"list"!==n.displayModeView){const i=n._animationStarted?n.$.nextMonthsContainer.children:n.$.dateViewContainer.children;if(t="ArrowUp"===e.key||"ArrowDown"===e.key?4:1,"year"===n.displayMode){const e=n._focusedCell.value.getMonth()+a*t;let i=new Date(n._focusedCell.value.getFullYear(),e+1,0);n._focusedCell.value.getDate()<=i.getDate()&&(i=n._focusedCell.value),l=new Date(n._focusedCell.value.getFullYear(),e,i.getDate())}else l=new Date(n._focusedCell.value.getFullYear()+a*t,n._focusedCell.value.getMonth(),n._focusedCell.value.getDate());if("year"===n.displayMode){if(l.getFullYear()<n.min.getFullYear()||l.getFullYear()===n.min.getFullYear()&&l.getMonth()<n.min.getMonth()||l.getFullYear()>n.max.getFullYear()||l.getFullYear()===n.max.getFullYear()&&l.getMonth()>n.max.getMonth())return;l.getTime()>i[i.length-1].value.getTime()?n.navigate(1):l.getTime()<i[0].value.getTime()&&n.navigate(-1)}else{if(l.getFullYear()<n.min.getFullYear()||l.getFullYear()>n.max.getFullYear())return;if(l.getFullYear()<i[1].value.getFullYear()||l.getFullYear()>i[10].value.getFullYear()){let t=n._focusedCell;n.navigate(a),"ArrowUp"!==e.key&&"ArrowDown"!==e.key||(t===i[3]||t===i[4]||t===i[7]||t===i[8]?l.setFullYear(l.getFullYear()+2*a):l.setFullYear(l.getFullYear()-2*a))}}return void n._focusCell(n._getCellByDate(l,n._animationStarted?n.$.nextMonthsContainer:void 0))}if(!n._focusedCell)return;const i=n.restrictedDates.map(Number);for(l=new Date(n._focusedCell.value.getFullYear(),n._focusedCell.value.getMonth(),n._focusedCell.value.getDate()+a*t,0,0,0,0);i.indexOf(l.getTime())>-1;)l.setDate(l.getDate()+a);if(l.getTime()<n.min.getTime()||l.getTime()>n.max.getTime())return;n._isDateInView(l)||n.navigate(a*n.months);let s=n._getCellByDate(l,n._animationStarted?n.$.nextMonthsContainer:void 0);return n._focusCell(s),n._updateWeeksVisibility(a),!(["zeroOrMany","oneOrMany","none","many","week","range"].indexOf(n.selectionMode)>-1)||void 0}_handlePageUpDownKeys(e,t){const a=this;let n;if(e.preventDefault(),"month"!==a.displayMode){if(n=a._focusedCell,!a.navigate(t))return;for(;n&&n.classList.contains("smart-visibility-hidden");)n=null===n.previousElementSibling?n.nextElementSibling:n.previousElementSibling;return a._focusCell(n),void(a.hasAnimation&&"decade"===a.displayMode&&a._focusedCell.value.setFullYear(a._focusedCell.value.getFullYear()+10*t))}n=new Date(a._focusedCell.value.getFullYear(),a._focusedCell.value.getMonth()+t,1,0,0,0,0);let l=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return a._focusedCell.value.getDate()>l?n.setDate(l):n.setDate(a._focusedCell.value.getDate()),a._isDateInView(n)||a.navigate(n),a._animationStarted?a._focusCell(a._getCellByDate(n,a.$.nextMonthsContainer)):a._focusCell(a._getCellByDate(n)),!0}_selectDate(e,t,a){const n=this;if(void 0===n._viewDates||"none"===n.selectionMode)return;let l,i=n.selectedDates.slice(0),s=n._getCellByDate(e,n._animationStarted?n.$.nextMonthsContainer:void 0);s&&n._selectCell(s),(e=new Date(e)).setHours(0,0,0,0),l=i.map(Number).indexOf(e.getTime()),n.restrictedDates.map(Number).indexOf(e.getTime())>-1||e.getTime()<n.min.getTime()||e.getTime()>n.max.getTime()||(l>-1?i.splice(l,1):i.push(e),a||(n.selectedDates=i),n._refreshFooter(),n.$.hiddenInput.value=n.selectedDates.toString(),!t&&n.isInitialized&&(n.$.fireEvent("change",{value:[e]}),n._updateTargetValue()),n._refreshTitle())}_selectCell(e){const t=this;if(!e||t.restrictedDates.map(Number).indexOf(e.value.getTime())>-1||t.disableAutoNavigation&&!1===e.otherMonth||e.value.getTime()<t.min.getTime()||e.value.getTime()>t.max.getTime())return;const a=t._selectedCells.indexOf(e);a>-1?(t._setCellState(e,"selected",!1),t._selectedCells.splice(a,1)):(t._setCellState(e,"selected",!0),t._selectedCells.push(e)),t._focusCell(e)}_refreshDayOfWeekTitles(){const e=this;let t,a=[],n=new Date;function l(t){let a;return"firstTwoLetters"===e.dayNameFormat?(a=new Intl.DateTimeFormat(e.locale,{weekday:"long"}).format(t),a=8206===a.charCodeAt(0)?a.substring(1,3):a.substring(0,2)):a=new Intl.DateTimeFormat(e.locale,{weekday:e.dayNameFormat}).format(t),a}for(let e=1;e<8;e++)n.setDate(e),t={number:n.getDay(),name:l(n)},a.push(t);a.sort(((e,t)=>e.number>t.number?1:-1));const i=e.$.monthsContainer.children;let s,o;for(let t=0;t<i.length;t++)if(s=i[t].getElementsByClassName("smart-calendar-week-titles")[0].children,o=e.firstDayOfWeek>6?0:e.firstDayOfWeek,e.rightToLeft)for(let e=s.length-1;e>=1;e--)s[e].textContent=a[o++].name,o=o>6?0:o;else for(let e=1;e<s.length;e++)s[e].textContent=a[o++].name,o=o>6?0:o;if(e.hasAnimation){const t=e.$.monthsContainer.getElementsByClassName("smart-calendar-week-titles")[0].innerHTML,a=e.$.nextMonthsContainer.getElementsByClassName("smart-calendar-week-titles");for(let e=0;e<a.length;e++)a[e].innerHTML=t}}_refreshCalendarMode(){const e=this;if(!e.headerTemplate)if(e._refreshMonthNames(),"default"===e.calendarMode){e.$classicHeaderDate.addClass("smart-hidden"),e.$defaultHeaderDate.removeClass("smart-hidden");const t=e._viewDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime())),a=t[0],n=t[t.length-1];a.setDate(2);let l=e.monthNameFormat;"firstTwoLetters"===l&&(l="long");let i=a.toLocaleDateString(e.locale,{year:e.yearFormat,month:l});e.months>1&&(n.setDate(2),i+=" - "+n.toLocaleDateString(e.locale,{year:e.yearFormat,month:l})),e.$.defaultHeaderDate.innerHTML=i,e.unfocusable||e.$.dateElement.setAttribute("tabindex",e.tabIndex>0?e.tabIndex:0)}else e.$defaultHeaderDate.addClass("smart-hidden"),e.$classicHeaderDate.removeClass("smart-hidden"),e.$.dateElement.removeAttribute("tabindex")}_refreshFooter(){const e=this;if(!(e.viewSections.indexOf("footer")<0||0===e.$.footer.offsetHeight))if(e.footerTemplate){if("function"==typeof e.footerTemplate)return;let a=e._layoutTemplates.filter((t=>t.selector===e.$.footer))[0],n=document.importNode(a.template.content,!0);if(a.bindings.length>0){let e=n.childNodes[a.bindings[0].childNodeIndex];a.selector.childNodes[a.bindings[0].childNodeIndex].innerHTML=e.innerHTML.replace(a.bindings[0].bindingString,t())}}else e.$.selectedDatesRange.innerHTML=t();function t(){if(0===e.selectedDates.length)return"";if(1===e.selectedDates.length)return e.selectedDates[0].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"});{let t=e.selectedDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime()));return t[0].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"})+" - "+t[t.length-1].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"})}}}_refreshImportantDates(){const e=this;if("month"===e.displayMode){e._clearImportantDates();for(let t=0;t<e.importantDates.length;t++)e._setImportantDate(e.importantDates[t])}}_clearImportantDates(){const e=this,t=e.$.monthsContainer.children;for(let a=0;a<t.length;a++)e._getMonthCells(t[a]).map((t=>{e._setCellState(t,"important",!1)}))}_setImportantDate(e,t){const a=this,n=a._getCellByDate(e);t||(t=n),t&&(a._setCellState(t,"important",!0),a._applyImportantDateTemplate(t))}_applyImportantDateTemplate(e){const t=this;if(!t._importantDatesTemplate)return"function"==typeof t.importantDatesTemplate?void t.importantDatesTemplate(e,{value:e.value}):void(e.innerHTML=e.value.getDate()+"");let a=document.importNode(t._importantDatesTemplate.content,!0);if(t._bindingDetails&&t._bindingDetails.length>0){let n=a.childNodes[t._bindingDetails[0].childNodeIndex];n.innerHTML=n.innerHTML.replace(t._bindingDetails[0].bindingString,e.value.getDate())}e.innerHTML="";for(let t=0;t<a.childNodes.length;t++)a.childNodes[t].outerHTML&&(e.innerHTML+=a.childNodes[t].outerHTML)}_setMonth(e,t,a){const n=this,l=n._getDays(e,n.selectedDates),i=n._getDays(e,n.importantDates),s=n._getDays(e,n.restrictedDates);e.setDate(1),t||(t=n.$.month),t._date=new Date(e),a||((!n._viewDates||n._viewDates.length>=n.months)&&(n._viewDates=[]),n._viewDates.push(new Date(e)));let o=((e=new Date(e)).getDay()-n.firstDayOfWeek+7)%7;e.setDate(0);let r=e.getDate();if(e.setDate(32),e.setDate(1),e.setDate(32),n._selectedCells)for(let e=0;e<n._selectedCells.length;e++)n._selectedCells[e].closest(".smart-calendar-month")===t&&n._setCellState(n._selectedCells[e],"selected",!1);n._setMonthContent(e,t,{previusMonthDays:r,firstDayOfWeek:o,selectedDates:l,importantDates:i,restrictedDates:s})}_setMonthContent(e,t,a){const n=this,l=32-e.getDate(),i=n._getMonthCells(t,n.rightToLeft),s=t._date.getMonth(),o=t._date.getFullYear(),r=new Date;let d,c=1,m=1;r.setHours(0,0,0,0),i.map((e=>{n._setCellState(e,"restricted",!1),n._setCellState(e,"selected",!1),n._setCellState(e,"otherMonth",!1),n._setCellState(e,"focus",!1),n._setCellState(e,"important",!1),n._setCellState(e,"today",!1),n._setCellState(e,"disabled",!1),n._setCellState(e,"hover",!1)}));for(let e=0;e<i.length;e++){const h=i[e];e===a.firstDayOfWeek&&m<=l?(h.className="smart-calendar-cell",h.value=new Date(o,s,m),h.innerHTML=h.value.getDate().toString(),a.restrictedDates.indexOf(m)>-1||h.value.getTime()<n.min.getTime()||h.value.getTime()>n.max.getTime()?n._setCellState(h,"restricted",!0):a.selectedDates.indexOf(m)>-1&&(n._setCellState(h,"selected",!0),n._selectedCells.indexOf(h)<0&&n._selectedCells.push(h)),a.importantDates.indexOf(m)>-1&&(n._setImportantDate(h.value,h),a.importantDates.splice(a.importantDates.indexOf(m),1)),h.value.getTime()===r.getTime()&&n._setCellState(h,"today",!0),a.firstDayOfWeek++,m++):(1===m?(h.value=new Date(o,s-1,++a.previusMonthDays-a.firstDayOfWeek),d=!!(h.value.getTime()<n.min.getTime()||t.previousElementSibling)):(h.value=new Date(o,s+1,c++),d=!!(h.value.getTime()>n.max.getTime()||t.nextElementSibling)),h.innerHTML=h.value.getDate().toString(),n._setCellState(h,"otherMonth",!0),d?h.classList.add("smart-visibility-hidden"):h.classList.remove("smart-visibility-hidden"))}n.months>1&&(t.firstElementChild.innerHTML=n.dateFormatFunction?n.dateFormatFunction(t._date):n._monthsNames[s]+" "+t._date.toLocaleDateString(n.locale,{year:n.yearFormat})),n._setMonthWeekNumbers(t)}_refreshMonthNames(){const e=this;let t,a=new Date;function n(t){let a=e.monthNameFormat;"firstTwoLetters"===a&&(a="long");let n=new Intl.DateTimeFormat(e.locale,{month:a}).format(t);return"firstTwoLetters"===e.monthNameFormat&&(n=8206===n.charCodeAt(0)?n.substring(0,2):n.substring(1,3)),n}a.setDate(1),e._monthsNames=[];for(let l=0;l<12;l++)a.setMonth(l),t=n(a),e._monthsNames.push(t);if("classic"===e.calendarMode&&e.$.monthElement){let t=e.$.monthsContainer.children;if(e.$.monthElement.dataSource&&(e._changeEventFired=1),e.shadowRoot?e._setMonthElementPropertyInShadowDOM("dataSource",e._monthsNames):e.$.monthElement.dataSource=e._monthsNames,e._viewDates){for(let a=0;a<t.length;a++)t[a].firstElementChild.textContent=e._monthsNames[t[a]._date.getMonth()]+" "+t[a]._date.getFullYear();e._changeEventFired=1,e.shadowRoot?e._setMonthElementPropertyInShadowDOM("selectedIndex",e._viewDates.map((e=>e.getMonth()))[0]):e.$.monthElement.selectedIndex=e._viewDates.map((e=>e.getMonth()))[0]}}}_setMonthWeekNumbers(e){const t=this,a=function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!0};let n=e.getElementsByClassName("smart-calendar-week");n=[].slice.call(n);for(let l=0;l<n.length;l++){if(!a(n[l])){n[l].children[0].innerHTML="";continue}const i=n[l].children[1],s=i.otherMonth?i.value.getTime()>e._date.getTime()?1:-1:0;n[l].children[0].innerHTML=t._getWeekNumber(new Date(e._date.getFullYear(),e._date.getMonth()+s,i.value.getDate()))}}_setRestrictedDates(e){const t=this,a=t.$.monthsContainer.children;for(let e=0;e<a.length;e++)t._getMonthCells(a[e]).map((e=>{t._setCellState(e,"restricted",!1)}));if(t._viewDates){const a=function(e){for(let a=0;a<t._viewDates.length;a++)if(t._viewDates[a].getFullYear()===e.getFullYear()&&t._viewDates[a].getMonth()===e.getMonth())return!0};for(let n=0;n<e.length;n++)if(a(e[n])){const a=t._getCellByDate(e[n]);t._setCellState(a,"restricted",!0)}}}_setScrollButtonsNavigationMode(){const e=this;"landscape"!==e.scrollButtonsNavigationMode?(e.$.previousMonthButton&&(e.$.previousMonthButton.$.button.firstElementChild.className="smart-arrow-down smart-arrow"),e.$.nextMonthButton&&(e.$.nextMonthButton.$.button.firstElementChild.className="smart-arrow-up smart-arrow")):(e.$.previousMonthButton&&(e.$.previousMonthButton.$.button.firstElementChild.className="smart-arrow-left smart-arrow"),e.$.nextMonthButton&&(e.$.nextMonthButton.$.button.firstElementChild.className="smart-arrow-right smart-arrow")),e._applyAnimationSettings(!0)}_refreshTitle(){const e=this;let t=e.selectedDates.length>0?e.selectedDates[e.selectedDates.length-1]:new Date;if(e.titleTemplate){if("function"==typeof e.titleTemplate)return;let a=e._layoutTemplates.filter((t=>t.selector===e.$.title))[0],n=document.importNode(a.template.content,!0);if(a.bindings.length>0){let l=n.childNodes[a.bindings[0].childNodeIndex];return t=t.toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"}),void(a.selector.childNodes[a.bindings[0].childNodeIndex].innerHTML=l.innerHTML.replace(a.bindings[0].bindingString,t))}}e.$.title.children[0].innerHTML=t.toLocaleDateString(e.locale,{year:e.yearFormat}),e.$.title.children[1].innerHTML="landscape"===e.view?t.toLocaleDateString(e.locale,{weekday:"short"})+",</br>"+t.toLocaleDateString(e.locale,{month:"short",day:"numeric"}):t.toLocaleDateString(e.locale,{weekday:"short"})+", "+t.toLocaleDateString(e.locale,{month:"short",day:"numeric"})}_setWeeksVisibility(e){const t=this,a=e.children;let n;function l(e){(function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!1;return!0})(e)||n>=t.weeks?e.classList.add("smart-hidden"):n<t.weeks&&(e.classList.remove("smart-hidden"),n++)}for(let e=0;e<a.length;e++){let i=a[e].getElementsByClassName("smart-calendar-week");i=[].slice.call(i);let s=t._selectedCells.filter((t=>t.closest(".smart-calendar-month")===a[e]));if(6!==t.weeks)if(n=0,s.length>0){let e=s[s.length-1],t=i.indexOf(e.parentElement);for(let e=t;e<i.length;e++)l(i[e]);for(let e=t-1;e>=0;e--)l(i[e])}else for(let e=0;e<i.length;e++)l(i[e]);else i.map((e=>e.classList.remove("smart-hidden")))}}_refreshHeaderElements(){const e=this,t=document.activeElement.closest("smart-calendar")===e,a=e._animationStarted?e.$.nextMonthsContainer:e.$.dateViewContainer;let n,l,i=e._viewDates[e._viewDates.length-1],s=e._viewDates.map((e=>e.getFullYear()));if("month"===e.displayMode||"list"!==e.displayModeView){if("classic"===e.calendarMode&&e.$.monthElement&&e.$.monthElement instanceof HTMLDivElement){const t=document.createElement("smart-input");t.setAttribute("smart-id","monthElement"),t.classList.add("smart-calendar-month-element"),t.dropDownPosition="bottom",t.selectionMode="one",t.disabled=e.disabled,t.rightToLeft=e.rightToLeft,t.theme=e.theme,t.dropDownWidth=e.dropDownWidth,t.dropDownHeight=e.dropDownHeight,t.readonly=!0,t.dropDownButtonPosition="right";const a=e.$.monthElement;e.$.monthElement.parentNode.insertBefore(t,e.$.monthElement),e.$.monthElement=t,a.remove()}if(e.$.previousMonthButton&&!e.disabled&&("month"!==e.displayMode&&e.$.dateViewContainer.children[0].value?l="year"===e.displayMode?a.children[0].value.getFullYear()-1:a.children[1].value.getFullYear()-1:e._viewDates[0].getMonth()-1<0?(n=11,l=e._viewDates[0].getFullYear()-1):(n=e._viewDates[0].getMonth()-1,l=e._viewDates[0].getFullYear()),e.$.previousMonthButton.disabled=l<e.min.getFullYear()||l===e.min.getFullYear()&&n<e.min.getMonth(),e.$.previousMonthButton.disabled&&t&&e.$.body.focus()),e.$.nextMonthButton&&!e.disabled&&("month"!==e.displayMode&&e.$.dateViewContainer.children[0].value?l="year"===e.displayMode?a.children[0].value.getFullYear()+1:a.children[1].value.getFullYear()+11:i.getMonth()+1>11?(n=0,l=i.getFullYear()+1):(n=i.getMonth()+1,l=i.getFullYear()),e.$.nextMonthButton.disabled=l>e.max.getFullYear()||l===e.max.getFullYear()&&n>e.max.getMonth(),e.$.nextMonthButton.disabled&&t&&e.$.body.focus()),"classic"===e.calendarMode&&e.$.monthElement){let t=[...e._monthsNames];if(s.indexOf(e.min.getFullYear())>-1)for(let a=0;a<e.min.getMonth();a++)t[a]="";if(s.indexOf(e.max.getFullYear())>-1)for(let a=e.max.getMonth()+1;a<t.length;a++)t[a]="";t=t.filter((e=>""!==e));const a=Math.max(0,e.$.monthElement.selectedIndex);e.$.monthElement.dataSource=t,e._changeEventFired=0!==e.$.monthElement.selectedIndex,e.shadowRoot?e._setMonthElementPropertyInShadowDOM("selectedIndex",e._viewDates[0].getMonth()):e.$.monthElement.selectedIndex=a,e._changeEventFired=0}e.$.previousYearButton&&!e.disabled&&(l=e._viewDates[0].getFullYear()-1,e.$.previousYearButton.disabled=l<e.min.getFullYear(),e.$.previousYearButton.disabled&&t&&e.$.body.focus()),e.$.nextYearButton&&!e.disabled&&(l=i.getFullYear()+1,e.$.nextYearButton.disabled=l>e.max.getFullYear(),e.$.nextYearButton.disabled&&t&&e.$.body.focus()),e.$.yearElement&&(e.$.yearElement.value=s[0],e.$.yearElement.disabled=i.getFullYear()+1>e.max.getFullYear()&&e._viewDates[0].getFullYear()-1<e.min.getFullYear())}}_setMonthElementPropertyInShadowDOM(e,t){const a=this.$.monthElement,n=a.context;a.context=document,this.$.monthElement[e]=t,a.context=n}_refreshHeaderTitle(){const e=this;let t;function a(){if("month"!==e.displayMode){if("list"===e.displayModeView){const a=e.$.listViewContainer;if(!a)return;const n=a.querySelectorAll("li");if(!n.length)return"";let l;a.querySelector("li.active")&&(l=a.querySelector("li.active").getAttribute("value")),t="year"===e.displayMode?new Date(l||n[0].getAttribute("value")).getFullYear():new Date(n[0].getAttribute("value")).getFullYear()+" - "+new Date(n[n.length-1].getAttribute("value")).getFullYear()}else if(e.$.dateViewContainer.children[0].value){let a=e._animationStarted?e.$.nextMonthsContainer.children:e.$.dateViewContainer.children;t="year"===e.displayMode?a[0].value.getFullYear():a[1].value.getFullYear()+" - "+a[a.length-2].value.getFullYear()}if(t)return t}const a=e._viewDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime())),n=a[0],l=a[a.length-1];n.setDate(2);let i=e.monthNameFormat;return"firstTwoLetters"===i&&(i="long"),t=n.toLocaleDateString(e.locale,{year:e.yearFormat,month:i}),e.months>1&&(l.setDate(2),t+=" - "+l.toLocaleDateString(e.locale,{year:e.yearFormat,month:i})),t}if("default"===e.calendarMode&&(e.$.defaultHeaderDate.innerHTML=a()),"function"==typeof e.headerTemplate||!e._layoutTemplates)return;let n=e._layoutTemplates.filter((t=>t.selector===e.$.header))[0];if(!n)return;let l=document.importNode(n.template.content,!0);if(n.bindings.length>0){const t=l.childNodes[n.bindings[0].childNodeIndex];(e.shadowRoot?e:n.selector).childNodes[n.bindings[0].childNodeIndex].innerHTML=t.innerHTML.replace(n.bindings[0].bindingString,e.dateFormatFunction?e.dateFormatFunction(e._viewDates):a())}}_updateWeeksVisibility(e,t){const a=this;let n=(t||a._focusedCell).parentElement;function l(){for(let e=o;e<s.length;e++)if(s[e].classList.contains("smart-hidden")&&!r(s[e])&&(s[e].classList.remove("smart-hidden"),d++,d===a.weeks))return!0}function i(){for(let e=o;e>=0;--e)if(s[e].classList.contains("smart-hidden")&&!r(s[e])&&(s[e].classList.remove("smart-hidden"),d++,d===a.weeks))return!0}if(!t&&!n.classList.contains("smart-hidden"))return;const s=[].slice.call(n.parentElement.children),o=s.indexOf(n),r=function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!1;return!0};let d=0;if(s.map((e=>e.classList.add("smart-hidden"))),e>0){if(l())return;i()}else{if(i())return;l()}}_getValidDates(e){let t=[];function a(e){if(e instanceof Date)return e;if(Smart.Utilities.DateTime&&e instanceof Smart.Utilities.DateTime)return e.toDate();if("string"==typeof e){if("new Date()"===e.trim()||"new Smart.Utilities.DateTime()"===e.trim())return new Date;let t=/(\d+[,-.\/]{1}\s*\d+[,-.\/]{1}\s*\d+)/;const a=()=>(e=e.replace(/[,-.\/]/g,",").split(",")).length>2?e=new Date(parseInt(e[0]),parseInt(e[1])-1,parseInt(e[2])):new Date;return t.test(e)&&(e=t.exec(e)[0].replace(/[,-.\/]/g,",").split(","))?new Date(parseInt(e[0]),parseInt(e[1])-1,parseInt(e[2])):a()}}if(void 0===e)return null;if(Array.isArray(e))for(let n=0;n<e.length;n++)t.push(a(e[n]));else t.push(a(e));return t=t.filter((e=>e&&"Invalid Date"!==e.toDateString())),t.map((e=>e.setHours(0,0,0,0))),t}_getValidDate(e){const t=this._getValidDates(e);return t.length>0?t[0]:null}_validateSelectedDates(e){const t=this;let a=[];e||(e=t.selectedDates);let n=e.slice(0),l=function(e){for(let a=0;a<t.restrictedDates.length;a++)if(t.restrictedDates[a].getTime()===e.getTime())return!0};t.selectedDates=n.filter((function(e){if(e.getTime()>=t.min.getTime()&&e.getTime()<=t.max.getTime()&&!l(e))return!0;a.push(e)})),t._viewDates&&(a.map((e=>t._selectDate(e))),t._focusCell())}_validateMinMax(e,t,a){const n=this;switch(e){case"min":t=n._getValidDate(n[e]),n.min=t||a||n.properties.min.defaultValue;break;case"max":t=n._getValidDate(n[e]),n.max=t||a||n.properties.max.defaultValue;break;default:t=n._getValidDate(n.min),n.min=t||a||n.properties.min.defaultValue,t=n._getValidDate(n.max),n.max=t||a||n.properties.max.defaultValue}n.min=n.min.getTime()>n.max.getTime()?n.max:n.min,n.min.setHours(0,0,0,0),n.max.setHours(0,0,0,0);let l,i=n.$.monthsContainer.children;if(n._viewDates){if(n._viewDates[0].getTime()>n.max.getTime()||n._viewDates[0].getTime()<n.min.getTime())return void n._handleMonths();for(let e=0;e<i.length;e++){l=n._getMonthCells(i[e]);for(let t=0;t<l.length;t++){const a=l[t];if(a.value.getTime()>=n.min.getTime()&&a.value.getTime()<=n.max.getTime())n._setCellState(a,"restricted",!1),a.value.getMonth()===i[e]._date.getMonth()?a.classList.remove("smart-visibility-hidden"):n.hideOtherMonthDays||(n._setCellState(a,"otherMonth",!0),a.classList.remove("smart-visibility-hidden")),"month"!==n.displayMode&&n._setCellState(a,"otherMonth",!1);else{if(a.otherMonth){if(a.classList.contains("smart-visibility-hidden")){n._setCellState(a,"restricted",!1);continue}}else n._setCellState(a,"restricted",!0);"month"!==n.displayMode&&(a.classList.remove("smart-visibility-hidden"),n._setCellState(a,"otherMonth",!0))}}}}}_setCellState(e,t,a){e[t]=a;const n=Smart.Utilities.Core.toDash(t);a?(e.setAttribute(n,""),"selected"===t?e.setAttribute("aria-selected",!0):"today"===t?e.setAttribute("aria-current","date"):"restricted"===t?e.removeAttribute("aria-selected"):"disabled"===t&&(e.removeAttribute("aria-selected"),e.setAttribute("aria-disabled",!0))):(e.removeAttribute(n),"selected"===t?"none"===this.selectionMode||e.restricted||e.disabled?e.removeAttribute("aria-selected"):e.setAttribute("aria-selected",!1):"today"===t?e.removeAttribute("aria-current"):"restricted"!==t||e.disabled?"disabled"===t&&(e.removeAttribute("aria-disabled"),e.restricted||e.setAttribute("aria-selected",!1)):e.setAttribute("aria-selected",!1))}_validateTemplate(e,t){if(null===t||!t)return;if("function"==typeof t)return;const a=this;if("content"in document.createElement("template")){if("string"==typeof t&&(t=document.getElementById(t)),null!==t&&"content"in t)return t;a.error(a.localize("invalidTemplate",{elementType:a.nodeName.toLowerCase(),property:e}))}else a.error(a.localize("htmlTemplateNotSuported",{elementType:a.nodeName.toLowerCase()}))}_weeksDownHandler(e,t){const a=this,n=t.value;let l;if(a.$.body.contains(t))if(t.otherMonth&&(l=t.value.getTime()>t.closest(".smart-calendar-month")._date.getTime()?1:-1),n&&a.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t,e.pageX,e.pageY),l){if(a._isDateInView(n))return;a.disableAutoNavigation||a.navigate(l*a.months)}else(t=a._getCellByDate(n))&&(t.disabled||t.restricted)||a._handleDateSelection(t)}_firstDayOfWeekValidator(e,t){return Math.min(Math.max(0,isNaN(t)?6:t),6)}_weeksValidator(e,t){return Math.min(Math.max(1,isNaN(t)?6:t),6)}_monthsValidator(e,t){return Math.min(Math.max(1,isNaN(t)?1:t),12)}});
|
|
1295
|
+
Smart("smart-calendar",class extends Smart.BaseElement{static get properties(){return{animationSettings:{value:null,type:"object"},calendarMode:{value:"default",allowedValues:["default","classic"],type:"string"},dayNameFormat:{value:"firstTwoLetters",allowedValues:["narrow","firstTwoLetters","long","short"],type:"string"},dateFormatFunction:{value:null,type:"function"},disableAutoNavigation:{value:!1,type:"boolean"},displayMode:{value:"month",allowedValues:["month","year","decade"],type:"string"},displayModeView:{value:"table",allowedValues:["table","list"],type:"string"},dropDownHeight:{value:"200",type:"string"},dropDownWidth:{value:"",type:"string"},firstDayOfWeek:{value:0,type:"number",defaultValue:0,validator:"_firstDayOfWeekValidator"},footerTemplate:{value:null,type:"any"},headerTemplate:{value:null,type:"any"},hideDayNames:{value:!1,type:"boolean"},hideOtherMonthDays:{value:!1,type:"boolean"},hideTooltipArrow:{value:!1,type:"boolean"},importantDates:{value:[],type:"array",defaultValue:[]},importantDatesTemplate:{value:null,type:"any"},max:{value:new Date(2100,0,1),type:"any",defaultValue:new Date(2100,0,1)},min:{value:new Date(1900,0,1),type:"any",defaultValue:new Date(1900,0,1)},months:{value:1,type:"number",defaultValue:1,validator:"_monthsValidator"},monthNameFormat:{value:"long",allowedValues:["narrow","firstTwoLetters","long","short","2-digit","numeric"],type:"string"},name:{value:"",type:"string"},restrictedDates:{value:[],type:"array",defaultValue:[]},scrollButtonsNavigationMode:{value:"landscape",allowedValues:["portrait","landscape"],type:"string"},scrollButtonsPosition:{value:"both",allowedValues:["near","far","both"],type:"string"},selectedDates:{value:[],reflectToAttribute:!1,type:"array"},selectionMode:{value:"default",allowedValues:["none","default","one","oneExtended","many","zeroOrMany","oneOrMany","zeroOrOne","week","range"],type:"string"},spinButtonsDelay:{value:80,type:"number"},spinButtonsInitialDelay:{value:0,type:"number"},titleTemplate:{value:null,type:"any"},tooltip:{value:!1,type:"boolean"},tooltipArrow:{value:!0,type:"boolean"},tooltipArrowDirection:{allowedValues:["bottom","top","left","right","none"],value:"bottom",type:"string"},tooltipDelay:{value:100,type:"number"},tooltipOffset:{value:[],type:"array"},tooltipPosition:{value:"auto",allowedValues:["auto","bottom","top","left","right","absolute"],type:"string"},tooltipTemplate:{value:null,type:"any"},view:{value:"portrait",allowedValues:["landscape","portrait"],type:"string"},viewSections:{value:["header"],type:"array"},weekNumbers:{value:!1,type:"boolean"},weeks:{value:6,type:"number",defaultValue:6,validator:"_weeksValidator"},yearFormat:{value:"numeric",allowedValues:["2-digit","numeric"],type:"string"}}}static get listeners(){return{"container.down":"_downHandler","document.up":"_documentUpHandler","body.move":"_moveHandler","container.wheel":"_containerWheelHandler","body.focus":"_bodyFocusStateHandler","body.blur":"_bodyBlurStateHandler","header.click":"_headerClickHandler","header.change":"_headerChangeHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler","container.mouseover":"_mouseEventsHandler","container.mouseout":"_mouseEventsHandler","container.open":"_popupEventHandler","container.close":"_popupEventHandler"}}static get methods(){return{select:"select(date=new Date(): date|string): void",clearSelection:"clearSelection(): void",today:"today(): date",navigate:"navigate(step: date|string|int): bool"}}static get styleUrls(){return["smart.calendar.css"]}template(){return'<div id="container" role="presentation">\n <div id="title" class="smart-calendar-title" role="heading" aria-level="1">\n <div id="yearContainer" class="smart-calendar-year-container" role="button"></div>\n <div id="dateContainer" class="smart-calendar-date-container smart-calendar-selected" role="button"></div>\n </div>\n <div id="calendarContainer" class="smart-calendar-container">\n <div id="header" class="smart-calendar-header">\n <smart-repeat-button prev-month class="smart-calendar-button" id="previousMonthButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Previous month">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n <div id="dateElement" class="smart-calendar-date-element" role="presentation">\n <div id="defaultHeaderDate" role="button"></div>\n <div id="classicHeaderDate">\n <div id="monthElement" class="smart-calendar-month-element" disabled="[[disabled]]" role="presentation">\n </div>\n <input class="smart-calendar-year-element" id="yearElement" disabled="[[disabled]]" readonly="[[readonly]]" aria-label="Year" />\n <span class="smart-calendar-year-elements">\n <smart-repeat-button next-year class="smart-calendar-button" id="nextYearButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Next year">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button prev-year class="smart-calendar-button" id="previousYearButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Previous year">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n </div>\n <smart-repeat-button next-month class="smart-calendar-button" id="nextMonthButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Next month">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n </div>\n <div id="body" class="smart-content smart-calendar-body" role="presentation">\n <div id="monthsContainer" class="smart-calendar-months-container" role="presentation">\n <div id="month" class="smart-calendar-month" role="grid">\n <div id="monthName" class="smart-calendar-month-name"></div>\n <div id="weekTitles" class="smart-calendar-week-titles" role="row">\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n </div>\n <div id="weeks" class="smart-calendar-weeks" role="rowgroup">\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n </div>\n </div>\n </div>\n <div id="dateViewContainer" class="smart-calendar-date-view-container smart-hidden">\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n </div>\n <div id="monthsSeparator" class="smart-calendar-month-separator"></div>\n <div id="nextMonthsContainer" class="smart-calendar-next-months-container" aria-hidden="true"></div>\n <div id="animationPanel" class="smart-calendar-animation-panel smart-hidden"></div>\n </div>\n <div id="footer" class="smart-calendar-footer smart-hidden">\n <div id="selectedDatesRange"></div>\n </div>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>\n </div>'}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const a=e.dataset.property,n=e.selectedDates.toString();a&&void 0!==t[a]&&(t[a]=n)}}}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const n=this;switch(e){case"animationSettings":n._applyAnimationSettings();break;case"disabled":case"unfocusable":n._setFocusable();break;case"calendarMode":case"dropDownWidth":case"dropDownHeight":n.displayMode="month",n._refreshHeaderElements(),n._refreshCalendarMode(),n._setDisplayModeContent();break;case"dayNameFormat":n._refreshDayOfWeekTitles(n.$.month);break;case"dateFormatFunction":{let e=n.$.monthsContainer.children;for(let t=0;t<e.length;t++)e[t].firstElementChild.innerHTML=a?a(e[t]._date):n._monthsNames[e[t]._date.getMonth()]+" "+e[t]._date.toLocaleDateString(n.locale,{year:n.yearFormat});n._refreshHeaderTitle();break}case"displayMode":if("classic"===n.calendarMode&&"month"!==a){n[e]="month";break}n._setDisplayMode(t,a);break;case"displayModeView":n._applyAnimationSettings(!0),"month"!==n.displayMode&&n._setDisplayModeContent();break;case"firstDayOfWeek":n._handleMonths(),n._refreshDayOfWeekTitles();break;case"hideTooltipArrow":n.$.tooltip&&(n.$.tooltip.arrow=!a);break;case"titleTemplate":case"headerTemplate":case"footerTemplate":n._handleLayoutTemplate(n.$[e.split(/[T]/)[0]],a),"titleTemplate"===e?n._refreshTitle():"headerTemplate"===e?n._refreshHeaderTitle():n._refreshFooter();break;case"importantDates":n.importantDates=n._getValidDates(a),n._refreshImportantDates();break;case"importantDatesTemplate":n._handleImportantDateTemplate(),n._refreshImportantDates();break;case"locale":n._refreshMonthNames(),n._refreshDayOfWeekTitles(),n._refreshHeaderTitle(),n._refreshTitle(),n._refreshFooter(),n.displayMode&&"month"!==n.displayMode&&n._setDisplayModeContent();break;case"max":case"min":n._validateMinMax(e,a,t),n._validateSelectedDates(),n._noFocusingRequired=!1,n._refreshHeaderElements();break;case"months":n._handleMonths();break;case"monthNameFormat":n._refreshCalendarMode(),n._refreshHeaderTitle();break;case"restrictedDates":n._setRestrictedDates(n.restrictedDates=n._getValidDates(a));break;case"rightToLeft":n._refreshDayOfWeekTitles(),n._handleMonths();break;case"scrollButtonsNavigationMode":n._setScrollButtonsNavigationMode();break;case"selectedDates":if(n._clearSelection(!0),n._validateSelectedDates(n._getValidDates(a)),n._applySelectionMode(!0),n._viewDates){let e=n.selectedDates[n.selectedDates.length-1];n._isDateInView(e)?n.selectedDates.map((e=>n._selectDate(e,!0,!0))):n._handleMonths(e)}n._refreshFooter(),n._setWeeksVisibility(n.$.monthsContainer),n.$.hiddenInput.value=n.selectedDates.toString(),n.isInitialized&&(n.$.fireEvent("change",{value:n.selectedDates}),n._updateTargetValue()),n._refreshTitle(),"month"!==n.displayMode&&n._setDisplayModeContent();break;case"selectionMode":n._applySelectionMode(!1,t),n._refreshTitle();break;case"tooltip":n._handleTooltip();break;case"tooltipArrow":case"tooltipArrowDirection":case"tooltipDelay":case"tooltipOffset":case"tooltipPosition":case"tooltipTemplate":if(n.$.tooltip){const t=e.replace("tooltip","");n.$.tooltip[t.charAt(0).toLowerCase()+t.slice(1)]=a}break;case"view":n._refreshTitle();break;case"viewSections":a.indexOf("title")>-1?n.$title.removeClass("smart-hidden"):n.$title.addClass("smart-hidden"),n._refreshTitle(),a.indexOf("header")>-1?n.$header.removeClass("smart-hidden"):n.$header.addClass("smart-hidden"),n._refreshHeaderTitle(),a.indexOf("footer")>-1?n.$footer.removeClass("smart-hidden"):n.$footer.addClass("smart-hidden"),n._refreshFooter(),n._setFocusable();break;case"weeks":n._setWeeksVisibility(n.$.monthsContainer);break;case"yearFormat":if(n._refreshCalendarMode(),n._refreshFooter(),n.months>1&&"month"===n.displayMode){let e=n._animationStarted?n.$.nextMonthsContainer.children:n.$.monthsContainer.children;for(let t=0;t<e.length;t++)e[t].firstElementChild.innerHTML=n.dateFormatFunction?n.dateFormatFunction(e[t]._date):n._monthsNames[e[t]._date.getMonth()]+" "+e[t]._date.toLocaleDateString(n.locale,{year:a})}n._refreshTitle(),n._refreshHeaderTitle()}}ready(){super.ready();const e=this;e._keysPressed={},e._applyAnimationSettings(),e.importantDates=e._getValidDates(e.importantDates),e.restrictedDates=e._getValidDates(e.restrictedDates)}render(){const e=this;e.setAttribute("role","dialog"),e._refreshMonthNames(),e._validateMinMax(),e._validateSelectedDates(e._getValidDates(e.selectedDates)),e._handleLayoutTemplate(e.$.title,e.titleTemplate),e._handleLayoutTemplate(e.$.header,e.headerTemplate),e._handleLayoutTemplate(e.$.footer,e.footerTemplate),e._handleImportantDateTemplate(),e._setFocusable(),e._refreshDayOfWeekTitles(),e._applySelectionMode(!0),e._handleMonths(0===e.selectedDates.length?new Date((new Date).setHours(0,0,0,0)):e.selectedDates[e.selectedDates.length-1]),e._handleTooltip(),e._updateViewSectionsVisibility(),e._setScrollButtonsNavigationMode(),e._refreshCalendarMode(),e._setDisplayMode(),e._refreshTitle(),e._refreshFooter(),e._refreshImportantDates(),e.$.monthElement&&e.$.monthElement._setDropDownSize&&e.$.monthElement._setDropDownSize(),e._changeEventFired=0,e.$.hiddenInput.value=e.selectedDates.toString(),e.shadowRoot&&e.appendChild(e.$.hiddenInput),e.isInitialized=!0,super.render()}refresh(){this.isInitialized&&this.render()}_updateViewSectionsVisibility(){const e=this;e.viewSections.indexOf("title")>-1?e.$title.removeClass("smart-hidden"):e.$title.addClass("smart-hidden"),e.viewSections.indexOf("header")>-1?e.$header.removeClass("smart-hidden"):e.$header.addClass("smart-hidden"),e.viewSections.indexOf("footer")>-1?e.$footer.removeClass("smart-hidden"):e.$footer.addClass("smart-hidden")}clearSelection(){this._clearSelection()}_setFocusable(){const e=this;let t=e.tabIndex>0?e.tabIndex:0;function a(e,a){if(a)return e&&e instanceof a?("function"==typeof e._setFocusable&&e.isCompleted?e.unfocusable=t<=-1:e.setAttribute("tabindex",t),e):e||void 0}(e.disabled||e.unfocusable)&&(t=-1),e.$.previousMonthButton=a(e.$.previousMonthButton,Smart.Button),e.$.nextMonthButton=a(e.$.nextMonthButton,Smart.Button),e.$.nextYearButton=a(e.$.nextYearButton,Smart.Button),e.$.previousYearButton=a(e.$.previousYearButton,Smart.Button),e.$.monthElement=a(e.$.monthElement,Smart.Input),e.$.yearElement=a(e.$.yearElement,HTMLInputElement),e.viewSections.indexOf("title")>-1&&(e.$.dateContainer.setAttribute("tabindex",t),e.$.yearContainer.setAttribute("tabindex",t)),e.$.body.setAttribute("tabindex",t),"default"===e.calendarMode?e.$.dateElement.setAttribute("tabindex",t):e.$.dateElement.removeAttribute("tabindex"),e.unfocusable?e.removeAttribute("tabindex"):e.tabIndex=e.readonly&&!e.disabled?e.tabIndex>0?e.tabIndex:0:t}static get requires(){return{"Smart.DropDownList":"smart.dropdownlist.js","Smart.ListBox":"smart.listbox.js","Smart.RepeatButton":"smart.button.js","Smart.Tooltip":"smart.tooltip.js"}}navigate(e){const t=this;let a,n,l;if(e){if("number"==typeof e){if(e=parseInt(e),isNaN(e)||0===e)return!1;if(6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode){let l,i;t._focusedCell||t._focusCell();const s=[].slice.call(t._focusedCell.closest(".smart-calendar-weeks").children).filter((e=>!e.classList.contains("smart-hidden")));e<0?(i=s[0].querySelectorAll(".smart-calendar-cell"),l=t.rightToLeft?i[i.length-1]:i[0]):(i=s[s.length-1].querySelectorAll(".smart-calendar-cell"),l=t.rightToLeft?i[0]:i[i.length-1]),n=new Date(l.value),n.setDate(n.getDate()+e),a=n}else a=t._getNextDate(e)}else{if(a=e=t._getValidDate(e),l=!0,isNaN(a.getTime()))return!1;const i=t._viewDates[0];if(i&&a.getMonth()===i.getMonth()&&a.getFullYear()===i.getFullYear())return!1;6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&(n=a)}return!(!a||t.$.fireEvent("navigationChanging",{value:new Date(a),type:t.displayMode}).defaultPrevented||("month"!==t.displayMode?(!l&&t.hasAnimation?(t.$nextMonthsContainer.addClass("smart-calendar-date-view-container"),"list"===t.displayModeView?t._setDisplayModeContent(a):t._navigationDate&&t._navigationDate.getTime()===a.getTime()||t._animateNavigation(a,e)):t._setDisplayModeContent(a),t.$.fireEvent("navigationChange",{value:new Date(a),type:t.displayMode}),0):(t.hasAnimation?(t._animateNavigation(a,e),t.$nextMonthsContainer.hasClass("smart-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-date-view-container")):(t._handleMonths(a),t._refreshHeaderElements(),t._refreshHeaderTitle()),n&&(t._focusCell(t._getCellByDate(n,t._animationStarted?t.$.nextMonthsContainer:void 0),!0),t._updateWeeksVisibility(e)),t.$.fireEvent("navigationChange",{value:new Date(a),type:t.displayMode}),0)))}}set value(e){this._select(e)}get value(){return this.selectedDates&&this.selectedDates.length>0?this.selectedDates[0]:null}select(e){this._select(e)}_select(e){const t=this;t._viewDates&&void 0!==t._viewDates[0]&&"none"!==t.selectionMode&&e&&(e=t._getValidDate(e))instanceof Date&&("one"===t.selectionMode&&t.selectedDates.map(Number).indexOf(e.getTime())>-1||e.getTime()<t.min.getTime()||e.getTime()>t.max.getTime()||("one"!==t.selectionMode&&"default"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._clearSelection(!0),t._selectDate(e),1!==t.selectedDates.length||t._isDateInView(t.selectedDates[0])||t._handleMonths(t.selectedDates[0])))}today(){const e=this;let t=new Date;return t.setHours(0,0,0,0),t.getTime()<e.min.getTime()||t.getTime()>e.max.getTime()?t=new Date(e.max):e._selectDate(t),e._handleMonths(t),t}_animateNavigation(e,t,a){const n=this;n._navigationDate=e,n._animationSettings||n._applyAnimationSettings(),n.$animationPanel.addClass("smart-hidden"),n.$.dateViewContainer.style.transform="",n.$.dateViewContainer.style.opacity="",n.$.monthsContainer.style.transform="",n.$.monthsContainer.style.opacity="";const l="month"!==n.displayMode?n.$.dateViewContainer:n.$.monthsContainer,i=n.$.body[n._animationSettings.scrollMax]-n.$.body[n._animationSettings.size];n._scrollStep=n.$.body[n._animationSettings.size]*n._animationSettings.startSpeed,n._animationStarted&&n._getMonthCells(n.$.monthsContainer,n.rightToLeft).map((e=>{n._setCellState(e,"restricted",!1),n._setCellState(e,"selected",!1),n._setCellState(e,"otherMonth",!1),n._setCellState(e,"focus",!1),n._setCellState(e,"important",!1),n._setCellState(e,"today",!1),n._setCellState(e,"disabled",!1),n._setCellState(e,"hover",!1)})),n._animationStarted=!0,"month"!==n.displayMode?(n._setCellState(n._focusedCell,"focus",!1),n._setDisplayModeContent(e,n.$.nextMonthsContainer)):n._handleMonths(e,n.$.nextMonthsContainer),n.rightToLeft&&(t*=-1),a||(t>0?(l.style.order=1,n.$.nextMonthsContainer.style.order=3,(!n._animationStarted||n._animationStarted&&n.$.body[n._animationSettings.scrollSize]>n.$.body[n._animationSettings.scrollMax]*n._animationSettings.resetThreshold*2)&&(n.$.body[n._animationSettings.scrollSize]=0)):(l.style.order=3,n.$.nextMonthsContainer.style.order=1,(!n._animationStarted||n._animationStarted&&n.$.body[n._animationSettings.scrollSize]<n.$.body[n._animationSettings.scrollMax]*n._animationSettings.resetThreshold)&&(n.$.body[n._animationSettings.scrollSize]=n.$.body[n._animationSettings.scrollMax]))),cancelAnimationFrame(n._animationId),n._animationId=requestAnimationFrame((function e(){let a=t>0?n.$.body[n._animationSettings.scrollSize]>=i:0===n.$.body[n._animationSettings.scrollSize],l=n._scrollStep/2;a?n._animateNavigationCompleted():(t>0&&n.$.body[n._animationSettings.scrollSize]>i*n._animationSettings.easeThreshold?(l=Math.max(n.$.body[n._animationSettings.scrollSize]/n._animationSettings.stepEaseSize,Math.abs(l-(i-n.$.body[n._animationSettings.scrollSize])*n._animationSettings.step)),n._scrollStep=n._scrollStep*n._animationSettings.step+l):t<0&&n.$.body[n._animationSettings.scrollSize]<i*n._animationSettings.easeThreshold&&(l=Math.max(n.$.body[n._animationSettings.scrollMax]/n._animationSettings.stepEaseSize,Math.abs(l-n.$.body[n._animationSettings.scrollSize]*n._animationSettings.step)),n._scrollStep=n._scrollStep*n._animationSettings.step+l),n.$.body[n._animationSettings.scrollSize]+=t>0?n._scrollStep:-n._scrollStep,n._animationId=requestAnimationFrame(e))}))}_animateNavigationCompleted(){const e=this;let t,a,n,l="month"!==e.displayMode?e.$.dateViewContainer:e.$.monthsContainer;if(cancelAnimationFrame(e._animationId),"month"!==e.displayMode){let i=[].slice.call(l.children).indexOf(e._focusedCell);l.innerHTML=e.$.nextMonthsContainer.innerHTML;let s,o=l.children[i];a=l.children,n=e.$.nextMonthsContainer.children;for(let t=0;t<a.length;t++)a[t].value=n[t].value,a[t].restricted=n[t].restricted,a[t].important=n[t].important,a[t].otherMonth=n[t].otherMonth,a[t].value.getTime()<=e.max.getTime()&&(s=a[t]);t=o&&o.value.getTime()>=e.max.getTime()?s.value:e._focusedCell?e._focusedCell.value:void 0}else{let i=l.children,s=e.$.nextMonthsContainer.children;e._focusedCell&&e.$.nextMonthsContainer.contains(e._focusedCell)&&(t=e._focusedCell.value);for(let t=0;t<i.length&&s[t]._date;t++){i[t]._date=s[t]._date,i[t].innerHTML=s[t].innerHTML,a=e._getMonthCells(i[t]),n=e._getMonthCells(s[t]);for(let e=0;e<a.length;e++)a[e].value=n[e].value,a[e].restricted=n[e].restricted,a[e].important=n[e].important,a[e].otherMonth=n[e].otherMonth,a[e].removeAttribute("focus")}e._selectedCells.length>0&&(e._selectedCells=e._selectedCells.map((t=>e._getCellByDate(t.value))).filter((e=>void 0!==e)))}e._focusCell(e._getCellByDate(t)),l.style.order=1,e.$.nextMonthsContainer.style.order=3,e.$.body[e._animationSettings.scrollSize]=0,e._animationStarted=!1,delete e._navigationDate}_applyAnimationSettings(e){const t=this;t._animationSettings=t.animationSettings?t.animationSettings:t._animationSettings||{},"portrait"===t.scrollButtonsNavigationMode?(t._animationSettings.scrollMax="scrollHeight",t._animationSettings.size="offsetHeight",t._animationSettings.scrollSize="scrollTop"):(t._animationSettings.scrollMax="scrollWidth",t._animationSettings.size="offsetWidth",t._animationSettings.scrollSize="scrollLeft"),e||(t._animationSettings.startSpeed=t._animationSettings.startSpeed?t._animationSettings.startSpeed:.2,t._animationSettings.easeThreshold=t._animationSettings.easeThreshold?t._animationSettings.easeThreshold:.5,t._animationSettings.step=t._animationSettings.step?t._animationSettings.step:.25,t._animationSettings.stepEaseSize=t._animationSettings.stepEaseSize?t._animationSettings.stepEaseSize:200,t._animationSettings.resetThreshold=t._animationSettings.resetThreshold?t._animationSettings.resetThreshold:.2)}_applySelectionMode(e,t){const a=this;let n=[],l=!!e,i=a.selectionMode;function s(e,t){const n=a.$.monthsContainer.children;for(let l=0;l<n.length;l++)a._getMonthCells(n[l]).map((n=>{a._setCellState(n,e,t)}))}switch("many"===i&&"range"===i||s("hover",!1),a._newRangeSelectionStarted=a.selectedDates.length>0&&"range"===i,-1!==["default","many","zeroOrMany","oneOrMany","week","range"].indexOf(i)?Array.from(a.getElementsByClassName("smart-calendar-month")).forEach((e=>e.setAttribute("aria-multiselectable",!0))):Array.from(a.getElementsByClassName("smart-calendar-month")).forEach((e=>e.removeAttribute("aria-multiselectable"))),"none"!==i&&"none"!==t||s("selected",!1),i){case"none":return void a._clearSelection(l);case"range":return void(a.selectedDates.length>1&&a._selectMultipleDates(a.selectedDates[0],a.selectedDates[a.selectedDates.length-1]));case"many":case"default":case"oneOrMany":if(0===a.selectedDates.length){n.push(new Date(Math.min(Math.max(a.min.getTime(),(new Date).setHours(0,0,0,0)),a.max.getTime())));break}return;case"oneExtended":case"one":if(1===a.selectedDates.length)return;a.selectedDates.length>1?(n.push(a.selectedDates[a.selectedDates.length-1]),a._clearSelection(l)):n.push(new Date(Math.min(Math.max(a.min.getTime(),(new Date).setHours(0,0,0,0)),a.max.getTime())));break;case"zeroOrOne":if(a.selectedDates.length>1){n.push(a.selectedDates[a.selectedDates.length-1]),a._clearSelection(l);break}return;case"zeroOrMany":return;case"week":if(a.selectedDates.length>=1){let e=a.selectedDates[a.selectedDates.length-1];for(let t=0;t<7;t++)n.push(new Date(e)),e.setDate(e.getDate()+1);a._clearSelection(l)}}if(a.selectedDates=[],e)return void(a.selectedDates=n);const o=n.length;for(let e=0;e<o;e++)a._selectDate(n[e],e<o-1)}_clearSelection(e){const t=this,a=t.selectedDates.slice(0),n=t.selectionMode;if(t.isRendered){if(t._selectedCells&&t._selectedCells.map((e=>{t._setCellState(e,"selected",!1)})),t.selectedDates=[],t._selectedCells=[],"many"===n||"range"===n){const e=t.$.monthsContainer.children;for(let a=0;a<e.length;a++)t._getMonthCells(e[a]).map((e=>{t._setCellState(e,"hover",!1)}))}t.$.footer&&t._refreshFooter(),t.$.hiddenInput.value=t.selectedDates.toString(),!e&&t.isInitialized&&a.length&&(t.$.fireEvent("change",{value:[]}),t._updateTargetValue()),t.$.title&&t._refreshTitle()}else t.set("selectedDates",[])}_bodyBlurStateHandler(e){this._bodyStateHandler(e),this.$.fireEvent("blur")}_bodyFocusStateHandler(e){this._bodyStateHandler(e),this.$.fireEvent("focus")}_bodyStateHandler(e){const t=this;if(t._focusedCell){if("blur"===e.type||"focus"===e.type&&t._noFocusingRequired)return t._noFocusingRequired=!1,void t._setCellState(t._focusedCell,"focus",!1);if("month"!==t.displayMode)return void("focus"!==e.type||t.$.dateViewContainer.querySelector("smart-calendar-cell[focus]")||t._setCellState(t._focusedCell||t.$.dateViewContainer.querySelector(".smart-calendar-cell"),"focus",!0))}"focus"===e.type&&t._focusCell()}_containerWheelHandler(e){const t=this;if(t.disabled||t.readonly||"month"!==t.displayMode&&"list"===t.displayModeView)return;let a,n;n=document.activeElement,t.shadowRoot?n=t.shadowRoot.activeElement:t.isInShadowDOM&&(n=t.getRootNode().activeElement),t.$.yearElement===n&&(a=12),(n&&t.shadowRoot||n.closest("smart-calendar")===t)&&(a=e.target===t.$.yearElement?12:1),a&&(e.preventDefault(),a=12===a?a:a*t.months,e.deltaY>0?t.navigate(-a):t.navigate(a))}_downHandler(e){const t=this;let a=e.originalEvent.target;if(t._dragStartDetails=void 0,t.disabled||t.readonly)return;if(t.hasRippleAnimation&&(a.value instanceof Date||a.parentElement&&a.parentElement.classList.contains("smart-calendar-title")||a.parentElement===t.$.dateElement)&&Smart.Utilities.Animation.Ripple.animate(a,e.pageX,e.pageY),a=e.originalEvent.target.closest(".smart-calendar-header"),e.originalEvent.target.closest(".smart-calendar-year-container")&&"decade"!==t.displayMode){if("classic"===t.calendarMode)return;return void t._showDateView("year")}if(e.originalEvent.target.closest(".smart-calendar-date-container")&&"month"!==t.displayMode){if("classic"===t.calendarMode)return;return void t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell,"month")}if(t._animationStarted&&t._animateNavigationCompleted(),Smart.Utilities.Core.isMobile&&e.originalEvent.target.closest(".smart-calendar-body")===t.$.body)return void(t._dragStartDetails={x:e.pageX,y:e.pageY,startTime:Date.now(),target:e.originalEvent.target});if(a=e.originalEvent.target,a.closest(".smart-calendar-week")||a.parentElement===t.$.dateViewContainer){for(;a&&!(a.value instanceof Date);)a=a.parentElement;return void(a&&("month"!==t.displayMode?t._displayModeHandler(a):t._weeksDownHandler(e,a)))}if(a.closest(".smart-calendar-month-element"))return;if(e.originalEvent.stopPropagation(),"list"===t.displayModeView&&"month"!==t.displayMode)return a=(t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target).closest("smart-list-item"),void(a&&t._displayModeHandler(a));const n=document.scrollingElement||document.documentElement,l=n.scrollLeft,i=n.scrollTop;t.unfocusable||t.focus(),window.scrollTo(l,i)}_displayModeHandler(e,t){const a=this;if(a._animationStarted&&a._animateNavigationCompleted(),e instanceof HTMLElement&&e.closest(".smart-calendar-week")&&e.otherMonth){if("decade"===a.displayMode&&(e.value.getFullYear()<a.min.getFullYear()||e.value.getFullYear()>a.max.getFullYear()))return;if("year"===a.displayMode&&(e.value.getFullYear()<a.min.getFullYear()||e.value.getFullYear()===a.min.getFullYear()&&e.value.getMonth()<a.min.getMonth()||e.value.getFullYear()>a.max.getFullYear()||e.value.getFullYear()===a.max.getFullYear()&&e.value.getMonth()>a.max.getMonth()))return}switch(t=t||a.displayMode){case"year":t="month";break;case"decade":t="year"}if(a.displayMode===t)return;const n=a.$.listViewContainer,l=n&&n.contains(e);a.$.fireEvent("displayModeChanging",{oldDisplayMode:a.displayMode,newDisplayMode:t}).defaultPrevented||(a.set("displayMode",t),a.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),e.parentElement!==a.$.dateViewContainer||e.disabled||e.restricted||a._focusCell(e),a.hasAnimation?(l&&e instanceof HTMLLIElement?e.offsetHeight?a.$.animationPanel.style.transformOrigin=e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px":a.$.animationPanel.style.transformOrigin=n.offsetLeft+n.offsetWidth/2+"px "+(n.offsetTop+n.offsetHeight/2)+"px":(a.$.dateViewContainer.style.order=1,a.$.nextMonthsContainer.style.order=3,e=a._focusedCell,a.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px"),a._animateView(1,e)):a._setDisplayModeContent(e.value instanceof Date?e.value:new Date(e.getAttribute("value")||e.value)))}_animateView(e,t){const a=this;let n,l,i=t instanceof Date?t:new Date(t.getAttribute("value")||t.value),s=!1,o=1,r=1;const d=a.$.listViewContainer;"list"===a.displayModeView?n=d.contains(t)?d:l="month"!==a.displayMode?a.$.monthsContainer:d:t.value instanceof Date||(t=a._focusedCell?a._focusedCell:a._selectedCells.length>0?a._selectedCells[a._selectedCells.length-1]:a._getCellByDate(new Date)),n||(n=t.parentElement===a.$.dateViewContainer?a.$.dateViewContainer:a.$.monthsContainer),l||(l="month"===a.displayMode?a.$.monthsContainer:"list"===a.displayModeView?d:a.$.dateViewContainer),l.style.transformOrigin=a.$.animationPanel.style.transformOrigin,n===d?(a.$.animationPanel.innerHTML="",a.$.animationPanel.appendChild(n.cloneNode(!0))):a.$.animationPanel.innerHTML=n.innerHTML,a._setDisplayModeContent(i),n.style.order=1,a.$.nextMonthsContainer.style.order=3,a.$.body[a._animationSettings.scrollSize]=0,a.$.animationPanel.style.width=a.$.body.offsetWidth+"px",a.$.animationPanel.style.height=a.$.body.offsetHeight+"px",a.$.animationPanel.style.transform="scale(1)",a.$.animationPanel.style.opacity=1,a.$animationPanel.removeClass("smart-hidden"),l.style.opacity="0",l.style.transform="scale(3.5)",n.$.hasClass("smart-calendar-date-view-container")?a.$animationPanel.addClass("smart-calendar-date-view-container"):a.$animationPanel.removeClass("smart-calendar-date-view-container"),cancelAnimationFrame(a._animationId),a._animationId=requestAnimationFrame((function t(){if((e>0&&o>=3.5||e<0&&o<=0)&&(s=!0),s){if(cancelAnimationFrame(a._animationId),a.$animationPanel.addClass("smart-hidden"),a.$.animationPanel.style.transform="",a.$.animationPanel.style.opacity="",n.style.order=1,a.$.nextMonthsContainer.style.order=3,a.$.body[a._animationSettings.scrollSize]=0,l.style.transform="",l.style.opacity="",a.unfocusable)return;"month"===a.displayMode?a.$.body.focus():"list"===a.displayModeView&&a.focus()}else a.$.animationPanel.style.opacity=r,l.style.opacity=1-r,r-=.05,e>0?(a.$.animationPanel.style.transform="scale("+o+")",l.style.transform="scale("+Math.min((o-1)/2,1)+")",o+=.125):(a.$.animationPanel.style.transform="scale("+Math.max(o,0)+")",l.style.transform="scale("+Math.max(1+o,1)+")",o-=.06),a._animationId=requestAnimationFrame(t)}))}_documentUpHandler(e){const t=this;let a=e.originalEvent.target;if((t.isInShadowDOM||t.shadowRoot&&a===t)&&(a=e.originalEvent.composedPath()[0]),t._newRangeSelectionStarted&&!t.$.container.contains(a)&&delete t._newRangeSelectionStarted,a&&a.classList&&a.classList.contains("smart-calendar-cell")&&(e.originalEvent.stopPropagation(),e.originalEvent.preventDefault(),e.preventDefault()),!Smart.Utilities.Core.isMobile||!t._dragStartDetails||e.originalEvent.target.closest(".smart-calendar-list-view"))return;delete t._previousIteration;const n=Date.now();let l={};(t.isInShadowDOM||t.shadowRoot&&a===t)&&(a=e.originalEvent.composedPath()[0]),"portrait"===t.scrollButtonsNavigationMode?(l.coordinate="y",l.direction="pageY"):(l.coordinate="x",l.direction="pageX");const i=t._dragStartDetails.step*(t.rightToLeft?-1:1);if(Math.abs(t._dragStartDetails[l.coordinate]-e[l.direction])<=10){if(a="list"===t.displayModeView&&"month"!==t.displayMode?a.closest("smart-list-item"):a,!a)return void(t._dragStartDetails=void 0);if("month"!==t.displayMode)return t._displayModeHandler(a),"portrait"===t.scrollButtonsNavigationMode?t.$.body.scrollTop=0:t.$.body.scrollLeft=0,void(t._dragStartDetails=void 0);if(t._weeksDownHandler(e,a),!t.disableAutoNavigation&&a.otherMonth)return}else{const a=Math.abs((e[l.direction]-t._dragStartDetails[l.coordinate])/(n-t._dragStartDetails.startTime));if(a>1){const e=parseInt(a);for(let a=0;a<e;a++)if(!t.navigate(i)){t._cancelAnimation();break}return void(t._dragStartDetails=void 0)}}if(!t.hasAnimation)return t.navigate(t._dragStartDetails.step),void(t._dragStartDetails=void 0);let s=("month"!==t.displayMode?t.$.dateViewContainer[t._animationSettings.scrollMax]:t.$.monthsContainer[t._animationSettings.scrollMax])+t.$.monthsSeparator[t._animationSettings.size];if(t._dragStartDetails.step>0&&t.$.body[t._animationSettings.scrollSize]>s*t._animationSettings.easeThreshold||t._dragStartDetails.step<0&&t.$.body[t._animationSettings.scrollSize]<s*t._animationSettings.easeThreshold)return t._animateNavigation(t._dragStartDetails.navigationDate,i,!0),6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&t._updateWeeksVisibility(i,t._getCellByDate(t._dragStartDetails.navigationDate,t.$.nextMonthsContainer)),t.$.fireEvent("navigationChange",{value:new Date(t._dragStartDetails.navigationDate),type:t.displayMode}),void(t._dragStartDetails=void 0);t._cancelAnimation(),t._dragStartDetails=void 0}_cancelAnimation(){const e=this,t="month"!==e.displayMode?e.$.dateViewContainer:e.$.monthsContainer;let a=e.$.animationPanel.style.transform,n=e.$.animationPanel.style.opacity;a&&(a=parseFloat(a.substring(a.indexOf("(")+1||0,a.indexOf(")")))),t.style.order=1,e.$.nextMonthsContainer.style.order=3,e.$.body[e._animationSettings.scrollSize]=0,e._animationId=requestAnimationFrame((function t(){if(!a||a>=3.5){cancelAnimationFrame(e._animationId),e.$animationPanel.addClass("smart-hidden"),e.$.animationPanel.style.transform="",e.$.animationPanel.style.opacity="";const t="month"===e.displayMode?e.$.monthsContainer:e.$.listViewContainer;return t.style.transform="",t.style.opacity="",e.unfocusable||("month"===e.displayMode?e.$.body.focus():"list"===e.displayModeView&&e.focus()),void(e._animationStarted=!1)}e.$.animationPanel.style.opacity=n-=.25,e.$.animationPanel.style.transform="scale("+(a+=.5)+")",e._animationId=requestAnimationFrame(t)}))}_focusCell(e,t){const a=this;if(a._focusedCell&&a._setCellState(a._focusedCell,"focus",!1),a.disabled||a.readonly)return;if(e){if("month"!==a.displayMode)return a._setCellState(e,"focus",!0),void(a._focusedCell=e);if(e.disabled||e.restricted)return;return t||a._setCellState(e,"focus",!0),void(a._focusedCell=e)}if("month"!==a.displayMode&&0===a.$.monthsContainer.offsetHeight)return;const n=a._selectedCells[a._selectedCells.length-1];if(n&&n.offsetHeight)a._setCellState(n,"focus",!0),a._focusedCell=n;else{const e=a.$.monthsContainer.children;if(!e[0]._date||a.min.getTime<e[0]._date.getTime())return;const t=a._getMonthCells(e[0],a.rightToLeft);for(let e=0;e<t.length;e++){const n=t[e];if(!n.otherMonth){if(n.disabled||n.restricted||!n.offsetHeight)continue;a._focusedCell=n;break}}}a._focusedCell&&a._setCellState(a._focusedCell,"focus",!0)}_getDays(e,t){const a=t.length;let n=[];if(a>0)for(let l=0;l<a;l++)t[l].getFullYear()===e.getFullYear()&&t[l].getMonth()===e.getMonth()&&n.push(t[l].getDate());return n}_getCellByDate(e,t){const a=this;if(!(e instanceof Date))return;if(t||(t=a.$.monthsContainer),"month"!==a.displayMode){if("list"===a.displayModeView)return;let t=arguments[1]?a.$.nextMonthsContainer.children:a.$.dateViewContainer.children;for(let n=0;n<t.length;n++)if("year"!==a.displayMode){if(t[n].value.getFullYear()===e.getFullYear())return t[n]}else if(t[n].value.getMonth()===e.getMonth())return t[n];return}let n,l,i=t.children;for(let t=0;t<i.length;t++)if(e.getFullYear()===i[t]._date.getFullYear()&&e.getMonth()===i[t]._date.getMonth()){n=i[t];break}if(n){l=a._getMonthCells(n);for(let t=0;t<l.length;t++)if((!l[t].otherMonth||l[t].hover)&&l[t].value.getMonth()===e.getMonth()&&l[t].value.getDate()===e.getDate())return l[t]}}_getMonthCells(e,t){const a=e.getElementsByClassName("smart-calendar-week");let n=[];if(t)for(let e=0;e<a.length;e++){let t=a[e].children;for(let e=t.length-1;e>0;e--)t[e].classList.contains("smart-calendar-cell")&&n.push(t[e])}else for(let e=0;e<a.length;e++){let t=a[e].children;for(let e=1;e<t.length;e++)t[e].classList.contains("smart-calendar-cell")&&n.push(t[e])}return n}_getWeekNumber(e){const t=this;let a,n=new Date(e.getFullYear(),0,1),l=Math.round((e.getTime()-n.getTime()-6e4*(e.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)+1,i=n.getDay()-t.firstDayOfWeek;return i=i>=0?i:i+7,i<4?(a=Math.floor((l+i-1)/7)+1,a>52&&(n=new Date(e.getFullYear()+1,0,1),i=n.getDay()-t.firstDayOfWeek,i=i>=0?i:i+7,a=i<4?1:53)):a=Math.round((l+i-1)/7),a}_handleDateSelection(e){const t=this;if(void 0!==e&&!e.disabled&&!e.restricted)switch(t.selectionMode){case"none":t._focusCell(e);break;case"oneExtended":case"one":case"default":if(t._keysPressed.Control)return t.selectedDates.length>1||1===t.selectedDates.length&&!e.selected?void t._selectDate(e.value):void t._focusCell(e);if(t._keysPressed.Shift)return void t._selectMultipleDates(new Date(t.selectedDates[0]),e);t._clearSelection(!0),t._selectDate(e.value,t._selectedCells.indexOf(e.value)>-1);break;case"many":{if(0===t.selectedDates.length)return void t._selectDate(e.value);const a=t.selectedDates[t.selectedDates.length-1];let n=new Date(t.selectedDates[0]);if(e.value.getTime()===n.getTime()||e.value.getTime()===a.getTime())return t._clearSelection(),void t._focusCell(e);t.selectedDates.length>0&&t._selectMultipleDates(n,e);break}case"range":{if(t.selectedDates.length>1&&!t._keysPressed.Control&&!t._newRangeSelectionStarted&&t._clearSelection(!0),0===t.selectedDates.length||t._keysPressed.Control&&t.selectedDates.length>1&&!t._newRangeSelectionStarted){if(e.value&&t.selectedDates.find((t=>t.getTime()===e.value.getTime())))return;return t._newRangeSelectionStarted=!0,void t._selectDate(e.value)}const a=t.selectedDates[t.selectedDates.length-1];let n=t._keysPressed.Control||t._newRangeSelectionStarted?a:new Date(t.selectedDates[0]);t.selectedDates.length>0&&t._selectMultipleDates(n,e),delete t._newRangeSelectionStarted;break}case"zeroOrMany":t._selectDate(e.value);break;case"oneOrMany":if(1===t.selectedDates.length&&e.selected)return void t._focusCell(e);t._selectDate(e.value);break;case"zeroOrOne":if(1===t.selectedDates.length&&e.selected)return void t._selectDate(e.value);t._clearSelection(!0),t._selectDate(e.value);break;case"week":{if(e.selected&&(e.value.getTime()===t.selectedDates[0].getTime()||e.value.getTime()===t.selectedDates[t.selectedDates.length-1].getTime()))return t._clearSelection(),void t._focusCell(e);t._clearSelection(!0);let a=new Date(e.value);t._selectDate(a);for(let e=1;e<7;e++)a.setDate(a.getDate()+1),t._selectDate(a);t._isDateInView(a)||t.navigate(1);break}}}_handleImportantDateTemplate(){const e=this;if(e._importantDatesTemplate=e._validateTemplate("importantDatesTemplate",e.importantDatesTemplate),!e._importantDatesTemplate||!e._importantDatesTemplate.content)return;let t=e._importantDatesTemplate.content;const a=t.childNodes.length,n=/{{\w+}}/g;let l;e._bindingDetails=[];for(let i=0;i<a;i++)if(l=n.exec(t.childNodes[i].innerHTML),l)return void e._bindingDetails.push({childNodeIndex:i,bindingString:l[0]})}_handleLayoutTemplate(e,t){const a=this,n=a._validateTemplate(e.$.hasClass("smart-header")?"headerTemplate":e.$.hasClass("smart-calendar-footer")?"footerTemplate":"titleTemplate",t);if(!n||!n.content)return void("function"==typeof t&&t(e,{}));a._layoutTemplates||(a._layoutTemplates=[]);let l=document.importNode(n.content,!0);e.innerHTML="";const i=l.childNodes.length,s=/{{\w+}}/g;let o,r=[];for(let e=0;e<i;e++)o=s.exec(l.childNodes[e].innerHTML),o&&r.push({childNodeIndex:e,bindingString:o[0]});if(a._layoutTemplates=a._layoutTemplates.filter((t=>t.selector!==e)),a._layoutTemplates.push({selector:e,template:n,bindings:r}),a.shadowRoot)return e.innerHTML="<slot></slot>",void a.appendChild(l);e.appendChild(l)}_handleCalendarCellHover(e,t){const a=this;if(!a._animationStarted){if("month"===a.displayMode)if("mouseover"===e.type&&("many"===a.selectionMode||"range"===a.selectionMode&&a._newRangeSelectionStarted)&&a.selectedDates.length>0){const e=a.$.monthsContainer.children;for(let t=0;t<e.length;t++)a._getMonthCells(e[t]).map((e=>{a._setCellState(e,"hover",!1)}));let n=new Date("range"===a.selectionMode?a.selectedDates[a.selectedDates.length-1]:a.selectedDates[0]),l=new Date(t.value),i=t;const s=n.getTime()>l.getTime()?-1:1,o=function(){i=a._getCellByDate(n),!i||i.selected||i.restricted||a._setCellState(i,"hover",!0)};if(n.getTime()!==l.getTime()){for(n.setDate(n.getDate()+s);n.getTime()!==l.getTime();)o(),n.setDate(n.getDate()+s);o()}}else a._setCellState(t,"hover",!1);"mouseover"!==e.type||t.otherMonth?a._setCellState(t,"hover",!1):a._setCellState(t,"hover",!0)}}_handleMonths(e,t){const a=this;let n;function l(e){let t,n=e.children.length,l=document.createDocumentFragment();for(;n<a.months;n++)t=a.$.month.cloneNode(!1),t.innerHTML=a.$.month.innerHTML,l.appendChild(t);return l}function i(t){let n=t.children;for(let t=0;t<n.length;t++)a._setMonth(e,n[t]),e.setMonth(e.getMonth()+1);a._setWeeksVisibility(t),a._refreshHeaderElements(),a._refreshHeaderTitle(),a.tooltip&&a.$.tooltip&&a.$.tooltip.close(),a.$.body===document.activeElement&&a._focusCell()}if(e||(e=a._viewDates&&a._viewDates.length>0?a._viewDates[0]:new Date),e=new Date(Math.min(Math.max(a.min.getTime(),e.getTime()),a.max.getTime())),t||(t=a.$.monthsContainer),a._selectedCells=[],a.hasAnimation){for(n=a.$.nextMonthsContainer.children,n.length>0&&n[0].value instanceof Date&&(a.$.nextMonthsContainer.innerHTML="");a.$.nextMonthsContainer.childElementCount<a.months;)a.$.nextMonthsContainer.appendChild(l(a.$.nextMonthsContainer));for(;a.$.nextMonthsContainer.childElementCount>a.months;)a.$.nextMonthsContainer.removeChild(n[a.$.nextMonthsContainer.childElementCount-1]);if(arguments[1]===a.$.nextMonthsContainer)return void i(a.$.nextMonthsContainer)}if(n=a.$.monthsContainer.children,n.length>a.months){for(;a.$.monthsContainer.childElementCount>a.months;)a.$.monthsContainer.removeChild(n[a.$.monthsContainer.childElementCount-1]),a._viewDates.pop();i(a.$.monthsContainer)}else a.$.monthsContainer.children.length!==a.months?(a._viewDates=[],a.$.monthsContainer.appendChild(l(a.$.monthsContainer)),i(a.$.monthsContainer)):i(a.$.monthsContainer)}_headerChangeHandler(e){const t=this;if(e.stopPropagation(),t.disabled||t.readonly)return;if(e.target.ownerElement===t.$.monthElement&&0!==t._changeEventFired)return void t._changeEventFired--;const a=t.displayMode;e.target===t.$.yearElement&&(t._viewDates[0].setFullYear(Math.min(Math.max(t.min.getFullYear(),isNaN(parseInt(t.$.yearElement.value))?0:parseInt(t.$.yearElement.value)),t.max.getFullYear())),t._handleMonths(t._viewDates[0])),!t.$.monthElement||e.target!==t.$.monthElement&&e.target.ownerElement!==t.$.monthElement||(t._handleMonths(new Date(t.$.monthsContainer.children[0]._date.getFullYear(),t.$.monthElement.selectedIndex,1)),"month"!==a&&t._setDisplayMode(t.displayMode,t.displayMode="month"))}_headerClickHandler(e){const t=this;if(t.disabled||t.readonly)return;let a=e.target.closest("smart-repeat-button");if(!a||!a.disabled){switch(a){case t.$.previousMonthButton:return t._isInteractiveNavigation=!0,void t.navigate(-1*t.months*(t.rightToLeft?-1:1));case t.$.nextMonthButton:return t._isInteractiveNavigation=!0,void t.navigate(1*t.months*(t.rightToLeft?-1:1));case t.$.previousYearButton:return void t.navigate(-12);case t.$.nextYearButton:return void t.navigate(12)}"classic"!==t.calendarMode&&e.target.closest(".smart-calendar-date-element")&&(t._animationStarted&&t._animateNavigationCompleted(),t._isInteractiveNavigation=!0,t._showDateView())}}_selectMultipleDates(e,t){const a=this;if(t instanceof HTMLElement&&(t=t.value),a._newRangeSelectionStarted?a._selectDate(e,!0):a._clearSelection(!0),"range"!==a.selectionMode||t.getTime()!==e.getTime()){if((e=new Date(e)).getTime()<t.getTime())for(;e.getTime()<=t.getTime();)a.selectedDates.find((t=>t.getTime()===e.getTime()))||a._selectDate(e,!0),e.setDate(e.getDate()+1);else if(e.getTime()>t.getTime())for(;e.getTime()>=t.getTime();)a.selectedDates.find((t=>t.getTime()===e.getTime()))||a._selectDate(e,!0),e.setDate(e.getDate()-1);else a._selectDate(t,!0);a.$.hiddenInput.value=a.selectedDates.toString(),a._refreshFooter(),a.isInitialized&&(a.$.fireEvent("change",{value:a.selectedDates}),a._updateTargetValue()),a._refreshTitle()}}_setDisplayMode(e,t,a){const n=this;if(n.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),0!==arguments.length&&n.hasAnimation)if(n._animationStarted&&(n.displayMode=e,n._animateNavigationCompleted(),n.displayMode=t),"month"===e&&"year"===t||"year"===e&&"decade"===t)n.displayMode=e,n._showDateView(a?void 0:n.displayMode);else if("month"===e&&"decade"===t)n._showDateView(n.displayMode="year");else{let e;"list"===n.displayModeView?(e=n.$.listViewContainer.querySelector("li.active"),n.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop>0?e.offsetTop-e.offsetHeight/2:e.offsetTop+e.offsetHeight/2)+"px"):(n.$.dateViewContainer.style.order=1,n.$.nextMonthsContainer.style.order=3,e=n._focusedCell,n.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px"),n._animateView(1,e)}else{if("classic"===n.calendarMode)return void(n.displayMode="month");if("month"!==n.displayMode&&(n.$monthsContainer.addClass("smart-hidden"),n.$dateViewContainer.hasClass("smart-hidden")&&n.$dateViewContainer.removeClass("smart-hidden")),!n.isCompleted&&"month"===n.displayMode)return;n._setDisplayModeContent()}}_setDisplayModeContent(e,t){const a=this;let n=e&&"Invalid Date"!==e.toString()?e:a.selectedDates.length>0?a.selectedDates[a.selectedDates.length-1]:new Date;n.setTime(Math.min(Math.max(n.getTime(),a.min.getTime()),a.max.getTime())),n.setHours(0,0,0,0);const l=a._prepareView(n);if(!l)return;let i;t?(a.$.nextMonthsContainer.innerHTML=a.$.dateViewContainer.innerHTML,i=a.$.nextMonthsContainer):i=a.$.dateViewContainer;const s=i.children;let o;for(let e=0;e<s.length;e++){const t=s[e];t.innerHTML=l.viewContent[e],t.value=l.dates[e],"year"===a.displayMode?(t.value.getFullYear()<a.min.getFullYear()||t.value.getFullYear()===a.min.getFullYear()&&t.value.getMonth()<a.min.getMonth()||t.value.getFullYear()>a.max.getFullYear()||t.value.getFullYear()===a.max.getFullYear()&&t.value.getMonth()>a.max.getMonth()?a._setCellState(t,"otherMonth",!0):a._setCellState(t,"otherMonth",!1),n.getFullYear()===t.value.getFullYear()&&n.getMonth()===t.value.getMonth()&&(o=t)):"decade"===a.displayMode&&(0===e||e===s.length-1||t.value.getFullYear()<a.min.getFullYear()||t.value.getFullYear()>a.max.getFullYear()?a._setCellState(t,"otherMonth",!0):a._setCellState(t,"otherMonth",!1),n.getFullYear()===t.value.getFullYear()&&(o=t)),a._setCellState(t,"hover",!1),a._setCellState(t,"focus",!1)}if(o.otherMonth)for(let e=0;e<s.length;e++)if(!s[e].otherMonth){o=s[e];break}a._mobileScrolling||(a._focusedCell&&a._setCellState(a._focusedCell,"focus",!1),a._focusedCell=o,a._focusCell(a._focusedCell),a._refreshHeaderTitle(),a._refreshHeaderElements(),a.$.fireEvent("displayModeChange"),a._isInteractiveNavigation?a._isInteractiveNavigation=void 0:(a._setCellState(o,"focus",!0),setTimeout((function(){a.unfocusable||(a.$.body.focus(),a._focusCell(a._focusedCell))}),0)))}_prepareView(e){const t=this,a=t.$.listViewContainer;let n,l,i=[],s=[];function o(e,t,a){let n=new Date(e,t+1,0),l=n.getDate();return a>l?n.setDate(l):n.setDate(a),n}if("month"===t.displayMode)return t.$nextMonthsContainer.hasClass("smart-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-date-view-container"),a&&a.classList.add("smart-hidden"),t.$dateViewContainer.hasClass("smart-visibility-hidden")&&t.$dateViewContainer.removeClass("smart-visibility-hidden"),t._isDateInView(e)||t._handleMonths(e),t.$header.hasClass("smart-hidden")&&t.$header.removeClass("smart-hidden"),t.$body.hasClass("smart-calendar-list-view")&&t.$body.removeClass("smart-calendar-list-view"),t.$dateContainer.addClass("smart-calendar-selected"),t.$yearContainer.removeClass("smart-calendar-selected"),t.$dateViewContainer.addClass("smart-hidden"),t.$monthsContainer.removeClass("smart-hidden"),t._refreshHeaderTitle(),t.$.body.setAttribute("tabindex",t.tabIndex>0?t.tabIndex:0),t._refreshHeaderElements(),t.unfocusable||t.$.body.focus(),t._focusCell(t._getCellByDate(e)),void t.$.fireEvent("displayModeChange");if("list"===t.displayModeView)return t._setDisplayModeListContent(e),void t.$.fireEvent("displayModeChange");if(t.$header.hasClass("smart-hidden")&&t.$header.removeClass("smart-hidden"),t.$dateViewContainer.hasClass("smart-visibility-hidden")&&t.$dateViewContainer.removeClass("smart-visibility-hidden"),a&&a.classList.add("smart-hidden"),t.$.body.setAttribute("tabindex",t.tabIndex>0?t.tabIndex:0),"year"===t.displayMode){let a=new Date;for(let n=0;n<12;n++)a=o(a.getFullYear(),n,a.getDate()),i.push(a.toLocaleDateString(t.locale,{month:"short"})),s.push(o(e.getFullYear(),n,e.getDate()))}else{n=e?e.getFullYear():t._viewDates[0].getFullYear(),l=n%10,0!==l&&(n-=l),n-=1;for(let t=0;t<12;t++)i.push(n+""),s.push(new Date(n,e.getMonth(),e.getDate())),++n}return{viewContent:i,dates:s}}_setDisplayModeListContent(e){const t=this;let a=[];function n(e,t,a){let n=new Date(e,t+1,0),l=n.getDate();return a>l?n.setDate(l):n.setDate(a),n}if(t.$dateViewContainer.addClass("smart-visibility-hidden"),"year"===t.displayMode){let l=new Date;for(let i=0;i<12;i++)l=n(l.getFullYear(),i,l.getDate()),a.push({label:l.toLocaleDateString(t.locale,{month:"short"}),value:n(e.getFullYear(),i,e.getDate()).toDateString()});t.$yearContainer.removeClass("smart-calendar-selected"),t.$dateContainer.addClass("smart-calendar-selected")}else{let n=t.min.getFullYear(),l=t.max.getFullYear();l=Math.min(t.max.getFullYear(),e.getFullYear()+10),n=Math.max(t.min.getFullYear(),l-10);for(let t=n;t<l;t++)a.push({label:t.toString(),value:new Date(t,e.getMonth(),e.getDate()).toDateString()});t.$yearContainer.addClass("smart-calendar-selected"),t.$dateContainer.removeClass("smart-calendar-selected")}t._prepareListViewer(a,e.toDateString()),t._refreshHeaderTitle(),t._refreshHeaderElements(),t.unfocusable||t.focus()}_prepareListViewer(e=[],t){const a=this,n=a.$.body;let l=a.$.listViewContainer;l||(a.$.listViewContainer=l=document.createElement("smart-scroll-viewer"),l.classList.add("smart-input-drop-down-menu","smart-calendar-list-view"),l.ensureVisible=a._listViewerEnsureVisible.bind(a),l._handleKeyStrokes=a._listViewerKeyStrokesHandler.bind(a),l._setActiveDescendant=a._listViewerSetActiveDescendant.bind(a));let i=l.querySelector("ul");i||(i=document.createElement("ul"),i.onclick=a._listViewContainerItemClickHandler.bind(a),l.appendChild(i)),n.contains(l)&&n.removeChild(l),i.innerHTML="";for(let a=0;a<e.length;a++){const n=e[a],s=n.label,o=n.value,r=document.createElement("li"),d=document.createElement("a");t===o?(r.setAttribute("aria-selected",!0),r.classList.add("active"),t=r):r.setAttribute("aria-selected",!1),r.id=l.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),r.setAttribute("value",o),r.setAttribute("role","option"),r.setAttribute("aria-label",s),d.innerHTML=s,d.setAttribute("aria-hidden",!0),r.appendChild(d),i.appendChild(r)}l.classList.remove("smart-hidden"),n.classList.add("smart-calendar-list-view"),n.removeAttribute("tabindex"),n.insertBefore(l,a.$.animationPanel),l.refresh(),l.ensureVisible()}_listViewerEnsureVisible(){const e=this.$.listViewContainer,t=e.querySelector(".active");if(!t)return;const a=Array.from(e.querySelectorAll("li"));t.offsetTop+t.offsetHeight>=e.scrollTop+e.offsetHeight&&(e.scrollTop=t.offsetTop+t.offsetHeight),(t.offsetTop<=e.scrollTop||t.offsetTop>=e.scrollTop+e.offsetHeight)&&(e.scrollTop=t.offsetTop),0===a.indexOf(t)?e.scrollTop=0:a.indexOf(t)===a.length-1&&(e.scrollTop=e.scrollHeight)}_listViewerKeyStrokesHandler(e){if(["ArrowUp","ArrowDown"].indexOf(e)<0)return;event.preventDefault();const t=this.$.listViewContainer,a=t.querySelector(".active");if(!a){const e=t.querySelector("li");return e.classList.add("active"),void t._setActiveDescendant(e)}const n=a["ArrowDown"===e?"nextElementSibling":"previousElementSibling"];n&&(a.classList.remove("active"),n.classList.add("active"),t._setActiveDescendant(n),t.ensureVisible())}_listViewerSetActiveDescendant(e){const t=this.$.listViewContainer;e?t.setAttribute("aria-activedescendant",e.id):t.removeAttribute("aria-activedescendant")}_listViewContainerItemClickHandler(e){const t=this,a=e.target.closest("li");a&&"list"===t.displayModeView&&"month"!==t.displayMode&&t._displayModeHandler(a)}_isDateInView(e){const t=this;if(!e)return!1;for(let a=0;a<t._viewDates.length;a++)if(e.getFullYear()===t._viewDates[a].getFullYear()&&e.getMonth()===t._viewDates[a].getMonth()){let a=t._getCellByDate(e,t._animationStarted?t.$.nextMonthsContainer:void 0);if(!a)return;return!(a.otherMonth||!a.offsetHeight||a.classList.contains("smart-visibility-hidden"))}return!1}_keyDownHandler(e){const t=this;if(t.disabled||t.readonly)return;const a=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;switch(a){case t.$.yearElement:"Escape"===e.key&&t._refreshHeaderElements();break;case t.$.dateElement:if("default"===t.calendarMode&&" "===e.key||"Enter"===e.key)return e.preventDefault(),t._isInteractiveNavigation=!0,void t._showDateView();t._focusedCell||t._focusCell(),e.key.indexOf("Arrow")>-1&&t.$.dateElement===a&&!t.unfocusable&&t.$.body.focus(),t._navigateDays(e);break;case t.$.body:" "===e.key&&e.preventDefault(),t._navigateDays(e);break;case t.$.yearContainer:if(" "!==e.key&&"Enter"!==e.key||"decade"===t.displayMode||(e.preventDefault(),t._isInteractiveNavigation=!0,t._showDateView("year")),e.key.indexOf("Arrow")>-1){if(e.preventDefault(),t._focusedCell||t._focusCell(),"month"!==t.displayMode&&"list"===t.displayModeView)return t.unfocusable||t.focus(),void t.$.listViewContainer._handleKeyStrokes(e.key);t._navigateDays(e)}break;case t.$.dateContainer:if(" "!==e.key&&"Enter"!==e.key||"month"===t.displayMode||(e.preventDefault(),t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell,"month")),e.key.indexOf("Arrow")>-1){if(t._focusedCell||t._focusCell(),"month"!==t.displayMode&&"list"===t.displayModeView)return t.unfocusable||t.focus(),void t.$.listViewContainer._handleKeyStrokes(e.key);t._navigateDays(e)}break;default:if("month"!==t.displayMode&&"list"===t.displayModeView)return["Arrow","End","Home","Page"].indexOf(e.key)&&e.preventDefault()," "===e.key||"Enter"===e.key||e.ctrlKey&&("ArrowUp"===e.key||"ArrowDown"===e.key)?void t._navigateDays(e):void t.$.listViewContainer._handleKeyStrokes(e.key);e.key.indexOf("Arrow")>-1&&(t._focusedCell||t._focusCell(),t._navigateDays(e))}}_showDateView(e){const t=this;switch(e=e||t.displayMode){case"month":e="year";break;case"year":e="decade"}if(t.displayMode===e)return;if(t.$.fireEvent("displayModeChanging",{oldDisplayMode:t.displayMode,newDisplayMode:e}).defaultPrevented)return;let a;if(t.displayMode=e,"list"===t.displayModeView&&"month"!==t.displayMode){t._setDisplayModeListContent(t._focusedCell?t._focusedCell.value:t._viewDates[0]);const e=t.$.listViewContainer;e.classList.remove("smart-hidden"),a=e.querySelector("li.active"),a.offsetHeight?t.$.animationPanel.style.transformOrigin=a.offsetLeft+a.offsetWidth/2+"px "+(a.offsetTop>0?a.offsetTop-a.offsetHeight/2:a.offsetTop+a.offsetHeight/2)+"px":t.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(a.offsetTop>0?a.offsetTop-a.offsetHeight/2:e.offsetTop+e.offsetHeight/2)+"px"}else t._focusedCell||t._focusCell(),a=t._focusedCell,t.$.animationPanel.style.transformOrigin=a.offsetLeft+a.offsetWidth/2+"px "+(a.offsetTop+a.offsetHeight/2)+"px";t.$monthsContainer.addClass("smart-hidden"),t.$dateViewContainer.hasClass("smart-hidden")&&t.$dateViewContainer.removeClass("smart-hidden"),"decade"===t.displayMode&&(t.$yearContainer.addClass("smart-calendar-selected"),t.$dateContainer.removeClass("smart-calendar-selected")),t.hasAnimation?t._animateView(-1,a):t._setDisplayModeContent(t._focusedCell?t._focusedCell.value:t._viewDates[0])}_keyUpHandler(e){const t=this;t.disabled||t.readonly||"default"!==t.selectionMode&&"range"!==t.selectionMode||"Shift"!==e.key&&"Control"!==e.key||(t._keysPressed[e.key]=!1)}_handleTooltip(){const e=this,t=e.tooltip;let a=e.$.tooltip;t?(a||(a=document.createElement("smart-tooltip"),a.tooltipTemplate=e.tooltipTemplate,a.arrow=e.tooltipArrow,a.arrowDirection=e.tooltipArrowDirection,a.offset=e.tooltipOffset,a.position=e.tooltipPosition,a.delay=e.tooltipDelay,a.rightToLeft=e.rightToLeft,a.openMode="manual",e.$.tooltip=a),a.parentElement||e.$.calendarContainer.appendChild(a)):a&&a.remove()}_mouseEventsHandler(e){const t=this;if(t.disabled||t.readonly)return;const a=t.$.tooltip;if("mouseenter"===e.type)return void t.$.setAttributeValue("hover",!0);if("mouseleave"===e.type){if(t.$.setAttributeValue("hover",!1),t._newRangeSelectionStarted&&"range"===t.selectionMode){const e=t.$.monthsContainer.children;for(let a=0;a<e.length;a++)t._getMonthCells(e[a]).map((e=>{t._setCellState(e,"hover",!1)}))}return void(t.tooltip&&a&&a.close())}const n=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(!n.closest(".smart-calendar-week"))return void(t.tooltip&&a&&(clearTimeout(t._tooltipAutoCloseTimeout),a[a.contains(n)?"open":"close"]()));const l=n.closest(".smart-calendar-cell");if(!l)return;if(Smart.Utilities.Core.isMobile||t._handleCalendarCellHover(e,l),!t.tooltip&&a)return void a.close();const i=l.hasAttribute("important");if(clearTimeout(t._tooltipAutoCloseTimeout),i&&a&&"mouseover"===e.type)return a.selector=l,void(a.selector!==l?a.close():(t.tooltipTemplate||(a.innerHTML=0===a.innerHTML.trim().length?"Important day!":a.innerHTML),a.open(),t.$.fireEvent("open",{target:a,value:new Date(l.value)})));t._tooltipAutoCloseTimeout=setTimeout(function(){!a||"mouseout"!==e.type&&l&&i||a.close(),clearTimeout(t._tooltipAutoCloseTimeout)}.bind(t),t.tooltipDelay)}_popupEventHandler(e){const t=this,a=t.$.tooltip;if(e.stopPropagation(),e.target!==t.$.monthElement)if(e.target===a)if("close"!==e.type);else{const e=a.selector;t.$.fireEvent("close",{target:a,value:e?new Date(e.value):null})}else t.$.fireEvent(e.type,{target:e.target})}_moveHandler(e){const t=this;if(!Smart.Utilities.Core.isMobile||!t._dragStartDetails||"list"===t.displayModeView&&"month"!==t.displayMode)return;e.originalEvent.preventDefault(),e.preventDefault(),e.stopPropagation();const a={x:Math.round(e.pageX),y:Math.round(e.pageY)};let n,l,i;if(n="portrait"===t.scrollButtonsNavigationMode?a.y>t._dragStartDetails.y?-1*t.months:1*t.months:a.x<t._dragStartDetails.x?1*t.months:-1*t.months,t._previousIteration&&n===t._previousIteration.step)l=t._previousIteration.date;else if(6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode){let e,a;t._focusedCell||t._focusCell();const i=[].slice.call(t._focusedCell.closest(".smart-calendar-weeks").children).filter((e=>!e.classList.contains("smart-hidden")));if(i.length){let s;!t.rightToLeft&&n<0||t.rightToLeft&&n>0?(s=i[0].querySelectorAll(".smart-calendar-cell"),a=t.rightToLeft?s[s.length-1]:s[0]):(s=i[i.length-1].querySelectorAll(".smart-calendar-cell"),a=t.rightToLeft?s[0]:s[s.length-1]),e=new Date(a.value),e.setDate(e.getDate()+n*(t.rightToLeft?-1:1)),l=e}else l=t._getNextDate(n*(t.rightToLeft?-1:1))}else l=t._getNextDate(n*(t.rightToLeft?-1:1));if(!l)return;if(!t._dragStartDetails.navigationDate&&t.$.fireEvent("navigationChanging",{value:new Date(l),type:t.displayMode}).defaultPrevented)return t._cancelAnimation(),void(t._dragStartDetails=void 0);if(t._dragStartDetails.step=n,t._dragStartDetails.navigationDate=new Date(l),!t.hasAnimation)return;if(t._previousIteration={step:n,date:l},t._mobileScrolling=!0,"month"!==t.displayMode)t.$nextMonthsContainer.addClass("smart-calendar-date-view-container"),i=t.$.dateViewContainer,t.$.nextMonthsContainer.children[0].value instanceof Date&&t.$.nextMonthsContainer.children[1].value.getFullYear()===l.getFullYear()||t._setDisplayModeContent(l,t.$.nextMonthsContainer);else if(t.$nextMonthsContainer.hasClass("smart-calendar-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),i=t.$.monthsContainer,!t.$.nextMonthsContainer.children[0]._date||t.$.nextMonthsContainer.children[0]._date.getTime()!==l.getTime()){let e=t.$.nextMonthsContainer.children;for(let a=0;a<e.length;a++)l.setMonth(t._dragStartDetails.navigationDate.getMonth()+a*(t.rightToLeft?-1:1)),t._setMonth(new Date(l),e[a],!0)}6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&t._updateWeeksVisibility(n*(t.rightToLeft?-1:1),t._getCellByDate(l,t.$.nextMonthsContainer)),delete t._mobileScrolling,n<0?(i.style.order=3,t.$.nextMonthsContainer.style.order=1,t.$.body[t._animationSettings.scrollSize]=t.$.body[t._animationSettings.scrollMax]):(i.style.order=1,t.$.nextMonthsContainer.style.order=3,t.$.body[t._animationSettings.scrollSize]=0);const s="portrait"===t.scrollButtonsNavigationMode?"y":"x";Math.abs(t._dragStartDetails[s]-a[s])>5&&(t.$.body[t._animationSettings.scrollSize]+=2*-(a[s]-t._dragStartDetails[s]))}_getNextDate(e){const t=this;let a;if("month"!==t.displayMode){let n;const l=t._focusedCell&&t._focusedCell.value.getFullYear();if("list"===t.displayModeView)a=new Date(t.$.listViewContainer.querySelector("li").getAttribute("value"));else{let e=t._animationStarted?t.$.nextMonthsContainer:t.$.dateViewContainer;a=new Date("year"===t.displayMode?e.children[0].value:e.children[1].value)}n="year"===t.displayMode?1:0!==e?10:1,a.setFullYear(a.getFullYear()+(e>0?n:-n)),a.getTime()<t.min.getTime()&&(a=t.min),a.getTime()>t.max.getTime()&&(a=t.max);const i="month"!==t.displayMode&&"list"===t.displayModeView;if(a.getFullYear()<t.min.getFullYear()||a.getFullYear()>t.max.getFullYear()||!i&&l===a.getFullYear())return}else{let n=t._viewDates[0];if(a=new Date(n),a.setDate(1),a.setMonth(a.getMonth()+e),a.setTime(Math.min(Math.max(a.getTime(),t.min.getTime()),t.max.getTime())),n.getMonth()===a.getMonth()&&n.getFullYear()===a.getFullYear())return}return a}_navigateDays(e){const t=this;let a="ArrowUp"===e.key||"ArrowDown"===e.key?7:1,n="ArrowUp"===e.key||"ArrowLeft"===e.key||"PageUp"===e.key?-1:1;switch(e.key){case"ArrowUp":case"ArrowLeft":case"ArrowDown":case"ArrowRight":if(!t._handleArrowKeys(e,a,n))return;break;case" ":case"Enter":{if("month"!==t.displayMode)return void t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell);const e=t._focusedCell;if("oneExtended"===t.selectionMode&&e)return t._clearSelection(!0),void t._selectDate(e.value,t._selectedCells.indexOf(e.value)>-1);break}case"Control":case"Shift":return"default"===t.selectionMode&&(t._keysPressed[e.key]=!0),void("range"===t.selectionMode&&(t._keysPressed[e.key]="Control"===e.key));case"Home":case"End":{e.preventDefault();let a,n=function(t){if("Home"===e.key){for(let e=0;e<t.length;e++)if(!t[e].otherMonth&&(!t[e].disabled||!t[e].restricted)&&t[e].offsetHeight)return t[e]}else for(let e=t.length-1;e>=0;e--)if(!t[e].otherMonth&&(!t[e].disabled||!t[e].restricted)&&t[e].offsetHeight)return t[e]};if(a="month"!==t.displayMode?n(t.$.dateViewContainer.children):n(t._getMonthCells(t._focusedCell.closest(".smart-calendar-month"),t.rightToLeft)),!a)return;if(t._focusCell(a),"month"!==t.displayMode)return;break}case"PageUp":case"PageDown":if(!t._handlePageUpDownKeys(e,n))return;break;default:return}"oneExtended"!==t.selectionMode&&t._focusedCell&&t._handleDateSelection(t._focusedCell)}_handleArrowKeys(e,t,a){const n=this;let l;if("month"!==n.displayMode||n._animationStarted||n.unfocusable||n.$.body.focus(),n._focusedCell||n._focusCell(n._getCellByDate(new Date)),e.altKey)return;if(e.ctrlKey){if("ArrowDown"===e.key||"ArrowUp"===e.key){if("classic"===n.calendarMode)return;let t;switch(n.displayMode){case"month":t="ArrowDown"===e.key?"month":"year";break;case"year":t="ArrowDown"===e.key?"month":"decade";break;case"decade":t="ArrowDown"===e.key?"year":"decade"}if(t!==n.displayMode){const e=n.displayMode;n.displayMode=t,n._setDisplayMode(e,t,"month"===e),n._keysPressed&&delete n._keysPressed.Control}}return}if(e.preventDefault(),!n.rightToLeft||"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||(a*=-1),"month"!==n.displayMode&&"list"!==n.displayModeView){const i=n._animationStarted?n.$.nextMonthsContainer.children:n.$.dateViewContainer.children;if(t="ArrowUp"===e.key||"ArrowDown"===e.key?4:1,"year"===n.displayMode){const e=n._focusedCell.value.getMonth()+a*t;let i=new Date(n._focusedCell.value.getFullYear(),e+1,0);n._focusedCell.value.getDate()<=i.getDate()&&(i=n._focusedCell.value),l=new Date(n._focusedCell.value.getFullYear(),e,i.getDate())}else l=new Date(n._focusedCell.value.getFullYear()+a*t,n._focusedCell.value.getMonth(),n._focusedCell.value.getDate());if("year"===n.displayMode){if(l.getFullYear()<n.min.getFullYear()||l.getFullYear()===n.min.getFullYear()&&l.getMonth()<n.min.getMonth()||l.getFullYear()>n.max.getFullYear()||l.getFullYear()===n.max.getFullYear()&&l.getMonth()>n.max.getMonth())return;l.getTime()>i[i.length-1].value.getTime()?n.navigate(1):l.getTime()<i[0].value.getTime()&&n.navigate(-1)}else{if(l.getFullYear()<n.min.getFullYear()||l.getFullYear()>n.max.getFullYear())return;if(l.getFullYear()<i[1].value.getFullYear()||l.getFullYear()>i[10].value.getFullYear()){let t=n._focusedCell;n.navigate(a),"ArrowUp"!==e.key&&"ArrowDown"!==e.key||(t===i[3]||t===i[4]||t===i[7]||t===i[8]?l.setFullYear(l.getFullYear()+2*a):l.setFullYear(l.getFullYear()-2*a))}}return void n._focusCell(n._getCellByDate(l,n._animationStarted?n.$.nextMonthsContainer:void 0))}if(!n._focusedCell)return;const i=n.restrictedDates.map(Number);for(l=new Date(n._focusedCell.value.getFullYear(),n._focusedCell.value.getMonth(),n._focusedCell.value.getDate()+a*t,0,0,0,0);i.indexOf(l.getTime())>-1;)l.setDate(l.getDate()+a);if(l.getTime()<n.min.getTime()||l.getTime()>n.max.getTime())return;n._isDateInView(l)||n.navigate(a*n.months);let s=n._getCellByDate(l,n._animationStarted?n.$.nextMonthsContainer:void 0);return n._focusCell(s),n._updateWeeksVisibility(a),!(["zeroOrMany","oneOrMany","none","many","week","range"].indexOf(n.selectionMode)>-1)||void 0}_handlePageUpDownKeys(e,t){const a=this;let n;if(e.preventDefault(),"month"!==a.displayMode){if(n=a._focusedCell,!a.navigate(t))return;for(;n&&n.classList.contains("smart-visibility-hidden");)n=null===n.previousElementSibling?n.nextElementSibling:n.previousElementSibling;return a._focusCell(n),void(a.hasAnimation&&"decade"===a.displayMode&&a._focusedCell.value.setFullYear(a._focusedCell.value.getFullYear()+10*t))}n=new Date(a._focusedCell.value.getFullYear(),a._focusedCell.value.getMonth()+t,1,0,0,0,0);let l=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return a._focusedCell.value.getDate()>l?n.setDate(l):n.setDate(a._focusedCell.value.getDate()),a._isDateInView(n)||a.navigate(n),a._animationStarted?a._focusCell(a._getCellByDate(n,a.$.nextMonthsContainer)):a._focusCell(a._getCellByDate(n)),!0}_selectDate(e,t,a){const n=this;if(void 0===n._viewDates||"none"===n.selectionMode)return;let l,i=n.selectedDates.slice(0),s=n._getCellByDate(e,n._animationStarted?n.$.nextMonthsContainer:void 0);s&&n._selectCell(s),(e=new Date(e)).setHours(0,0,0,0),l=i.map(Number).indexOf(e.getTime()),n.restrictedDates.map(Number).indexOf(e.getTime())>-1||e.getTime()<n.min.getTime()||e.getTime()>n.max.getTime()||(l>-1?i.splice(l,1):i.push(e),a||(n.selectedDates=i),n._refreshFooter(),n.$.hiddenInput.value=n.selectedDates.toString(),!t&&n.isInitialized&&(n.$.fireEvent("change",{value:[e]}),n._updateTargetValue()),n._refreshTitle())}_selectCell(e){const t=this;if(!e||t.restrictedDates.map(Number).indexOf(e.value.getTime())>-1||t.disableAutoNavigation&&!1===e.otherMonth||e.value.getTime()<t.min.getTime()||e.value.getTime()>t.max.getTime())return;const a=t._selectedCells.indexOf(e);a>-1?(t._setCellState(e,"selected",!1),t._selectedCells.splice(a,1)):(t._setCellState(e,"selected",!0),t._selectedCells.push(e)),t._focusCell(e)}_refreshDayOfWeekTitles(){const e=this;let t,a=[],n=new Date;function l(t){let a;return"firstTwoLetters"===e.dayNameFormat?(a=new Intl.DateTimeFormat(e.locale,{weekday:"long"}).format(t),a=8206===a.charCodeAt(0)?a.substring(1,3):a.substring(0,2)):a=new Intl.DateTimeFormat(e.locale,{weekday:e.dayNameFormat}).format(t),a}for(let e=1;e<8;e++)n.setDate(e),t={number:n.getDay(),name:l(n)},a.push(t);a.sort(((e,t)=>e.number>t.number?1:-1));const i=e.$.monthsContainer.children;let s,o;for(let t=0;t<i.length;t++)if(s=i[t].getElementsByClassName("smart-calendar-week-titles")[0].children,o=e.firstDayOfWeek>6?0:e.firstDayOfWeek,e.rightToLeft)for(let e=s.length-1;e>=1;e--)s[e].textContent=a[o++].name,o=o>6?0:o;else for(let e=1;e<s.length;e++)s[e].textContent=a[o++].name,o=o>6?0:o;if(e.hasAnimation){const t=e.$.monthsContainer.getElementsByClassName("smart-calendar-week-titles")[0].innerHTML,a=e.$.nextMonthsContainer.getElementsByClassName("smart-calendar-week-titles");for(let e=0;e<a.length;e++)a[e].innerHTML=t}}_refreshCalendarMode(){const e=this;if(!e.headerTemplate)if(e._refreshMonthNames(),"default"===e.calendarMode){e.$classicHeaderDate.addClass("smart-hidden"),e.$defaultHeaderDate.removeClass("smart-hidden");const t=e._viewDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime())),a=t[0],n=t[t.length-1];a.setDate(2);let l=e.monthNameFormat;"firstTwoLetters"===l&&(l="long");let i=a.toLocaleDateString(e.locale,{year:e.yearFormat,month:l});e.months>1&&(n.setDate(2),i+=" - "+n.toLocaleDateString(e.locale,{year:e.yearFormat,month:l})),e.$.defaultHeaderDate.innerHTML=i,e.unfocusable||e.$.dateElement.setAttribute("tabindex",e.tabIndex>0?e.tabIndex:0)}else e.$defaultHeaderDate.addClass("smart-hidden"),e.$classicHeaderDate.removeClass("smart-hidden"),e.$.dateElement.removeAttribute("tabindex")}_refreshFooter(){const e=this;if(!(e.viewSections.indexOf("footer")<0||0===e.$.footer.offsetHeight))if(e.footerTemplate){if("function"==typeof e.footerTemplate)return;let a=e._layoutTemplates.filter((t=>t.selector===e.$.footer))[0],n=document.importNode(a.template.content,!0);if(a.bindings.length>0){let e=n.childNodes[a.bindings[0].childNodeIndex];a.selector.childNodes[a.bindings[0].childNodeIndex].innerHTML=e.innerHTML.replace(a.bindings[0].bindingString,t())}}else e.$.selectedDatesRange.innerHTML=t();function t(){if(0===e.selectedDates.length)return"";if(1===e.selectedDates.length)return e.selectedDates[0].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"});{let t=e.selectedDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime()));return t[0].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"})+" - "+t[t.length-1].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"})}}}_refreshImportantDates(){const e=this;if("month"===e.displayMode){e._clearImportantDates();for(let t=0;t<e.importantDates.length;t++)e._setImportantDate(e.importantDates[t])}}_clearImportantDates(){const e=this,t=e.$.monthsContainer.children;for(let a=0;a<t.length;a++)e._getMonthCells(t[a]).map((t=>{e._setCellState(t,"important",!1)}))}_setImportantDate(e,t){const a=this,n=a._getCellByDate(e);t||(t=n),t&&(a._setCellState(t,"important",!0),a._applyImportantDateTemplate(t))}_applyImportantDateTemplate(e){const t=this;if(!t._importantDatesTemplate)return"function"==typeof t.importantDatesTemplate?void t.importantDatesTemplate(e,{value:e.value}):void(e.innerHTML=e.value.getDate()+"");let a=document.importNode(t._importantDatesTemplate.content,!0);if(t._bindingDetails&&t._bindingDetails.length>0){let n=a.childNodes[t._bindingDetails[0].childNodeIndex];n.innerHTML=n.innerHTML.replace(t._bindingDetails[0].bindingString,e.value.getDate())}e.innerHTML="";for(let t=0;t<a.childNodes.length;t++)a.childNodes[t].outerHTML&&(e.innerHTML+=a.childNodes[t].outerHTML)}_setMonth(e,t,a){const n=this,l=n._getDays(e,n.selectedDates),i=n._getDays(e,n.importantDates),s=n._getDays(e,n.restrictedDates);e.setDate(1),t||(t=n.$.month),t._date=new Date(e),a||((!n._viewDates||n._viewDates.length>=n.months)&&(n._viewDates=[]),n._viewDates.push(new Date(e)));let o=((e=new Date(e)).getDay()-n.firstDayOfWeek+7)%7;e.setDate(0);let r=e.getDate();if(e.setDate(32),e.setDate(1),e.setDate(32),n._selectedCells)for(let e=0;e<n._selectedCells.length;e++)n._selectedCells[e].closest(".smart-calendar-month")===t&&n._setCellState(n._selectedCells[e],"selected",!1);n._setMonthContent(e,t,{previusMonthDays:r,firstDayOfWeek:o,selectedDates:l,importantDates:i,restrictedDates:s})}_setMonthContent(e,t,a){const n=this,l=32-e.getDate(),i=n._getMonthCells(t,n.rightToLeft),s=t._date.getMonth(),o=t._date.getFullYear(),r=new Date;let d,c=1,m=1;r.setHours(0,0,0,0),i.map((e=>{n._setCellState(e,"restricted",!1),n._setCellState(e,"selected",!1),n._setCellState(e,"otherMonth",!1),n._setCellState(e,"focus",!1),n._setCellState(e,"important",!1),n._setCellState(e,"today",!1),n._setCellState(e,"disabled",!1),n._setCellState(e,"hover",!1)}));for(let e=0;e<i.length;e++){const h=i[e];e===a.firstDayOfWeek&&m<=l?(h.className="smart-calendar-cell",h.value=new Date(o,s,m),h.innerHTML=h.value.getDate().toString(),a.restrictedDates.indexOf(m)>-1||h.value.getTime()<n.min.getTime()||h.value.getTime()>n.max.getTime()?n._setCellState(h,"restricted",!0):a.selectedDates.indexOf(m)>-1&&(n._setCellState(h,"selected",!0),n._selectedCells.indexOf(h)<0&&n._selectedCells.push(h)),a.importantDates.indexOf(m)>-1&&(n._setImportantDate(h.value,h),a.importantDates.splice(a.importantDates.indexOf(m),1)),h.value.getTime()===r.getTime()&&n._setCellState(h,"today",!0),a.firstDayOfWeek++,m++):(1===m?(h.value=new Date(o,s-1,++a.previusMonthDays-a.firstDayOfWeek),d=!!(h.value.getTime()<n.min.getTime()||t.previousElementSibling)):(h.value=new Date(o,s+1,c++),d=!!(h.value.getTime()>n.max.getTime()||t.nextElementSibling)),h.innerHTML=h.value.getDate().toString(),n._setCellState(h,"otherMonth",!0),d?h.classList.add("smart-visibility-hidden"):h.classList.remove("smart-visibility-hidden"))}n.months>1&&(t.firstElementChild.innerHTML=n.dateFormatFunction?n.dateFormatFunction(t._date):n._monthsNames[s]+" "+t._date.toLocaleDateString(n.locale,{year:n.yearFormat})),n._setMonthWeekNumbers(t)}_refreshMonthNames(){const e=this;let t,a=new Date;function n(t){let a=e.monthNameFormat;"firstTwoLetters"===a&&(a="long");let n=new Intl.DateTimeFormat(e.locale,{month:a}).format(t);return"firstTwoLetters"===e.monthNameFormat&&(n=8206===n.charCodeAt(0)?n.substring(0,2):n.substring(1,3)),n}a.setDate(1),e._monthsNames=[];for(let l=0;l<12;l++)a.setMonth(l),t=n(a),e._monthsNames.push(t);if("classic"===e.calendarMode&&e.$.monthElement){let t=e.$.monthsContainer.children;if(e.$.monthElement.dataSource&&(e._changeEventFired=1),e.shadowRoot?e._setMonthElementPropertyInShadowDOM("dataSource",e._monthsNames):e.$.monthElement.dataSource=e._monthsNames,e._viewDates){for(let a=0;a<t.length;a++)t[a].firstElementChild.textContent=e._monthsNames[t[a]._date.getMonth()]+" "+t[a]._date.getFullYear();e._changeEventFired=1,e.shadowRoot?e._setMonthElementPropertyInShadowDOM("selectedIndex",e._viewDates.map((e=>e.getMonth()))[0]):e.$.monthElement.selectedIndex=e._viewDates.map((e=>e.getMonth()))[0]}}}_setMonthWeekNumbers(e){const t=this,a=function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!0};let n=e.getElementsByClassName("smart-calendar-week");n=[].slice.call(n);for(let l=0;l<n.length;l++){if(!a(n[l])){n[l].children[0].innerHTML="";continue}const i=n[l].children[1],s=i.otherMonth?i.value.getTime()>e._date.getTime()?1:-1:0;n[l].children[0].innerHTML=t._getWeekNumber(new Date(e._date.getFullYear(),e._date.getMonth()+s,i.value.getDate()))}}_setRestrictedDates(e){const t=this,a=t.$.monthsContainer.children;for(let e=0;e<a.length;e++)t._getMonthCells(a[e]).map((e=>{t._setCellState(e,"restricted",!1)}));if(t._viewDates){const a=function(e){for(let a=0;a<t._viewDates.length;a++)if(t._viewDates[a].getFullYear()===e.getFullYear()&&t._viewDates[a].getMonth()===e.getMonth())return!0};for(let n=0;n<e.length;n++)if(a(e[n])){const a=t._getCellByDate(e[n]);t._setCellState(a,"restricted",!0)}}}_setScrollButtonsNavigationMode(){const e=this;"landscape"!==e.scrollButtonsNavigationMode?(e.$.previousMonthButton&&(e.$.previousMonthButton.$.button.firstElementChild.className="smart-arrow-down smart-arrow"),e.$.nextMonthButton&&(e.$.nextMonthButton.$.button.firstElementChild.className="smart-arrow-up smart-arrow")):(e.$.previousMonthButton&&(e.$.previousMonthButton.$.button.firstElementChild.className="smart-arrow-left smart-arrow"),e.$.nextMonthButton&&(e.$.nextMonthButton.$.button.firstElementChild.className="smart-arrow-right smart-arrow")),e._applyAnimationSettings(!0)}_refreshTitle(){const e=this;let t=e.selectedDates.length>0?e.selectedDates[e.selectedDates.length-1]:new Date;if(e.titleTemplate){if("function"==typeof e.titleTemplate)return;let a=e._layoutTemplates.filter((t=>t.selector===e.$.title))[0],n=document.importNode(a.template.content,!0);if(a.bindings.length>0){let l=n.childNodes[a.bindings[0].childNodeIndex];return t=t.toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"}),void(a.selector.childNodes[a.bindings[0].childNodeIndex].innerHTML=l.innerHTML.replace(a.bindings[0].bindingString,t))}}e.$.title.children[0].innerHTML=t.toLocaleDateString(e.locale,{year:e.yearFormat}),e.$.title.children[1].innerHTML="landscape"===e.view?t.toLocaleDateString(e.locale,{weekday:"short"})+",</br>"+t.toLocaleDateString(e.locale,{month:"short",day:"numeric"}):t.toLocaleDateString(e.locale,{weekday:"short"})+", "+t.toLocaleDateString(e.locale,{month:"short",day:"numeric"})}_setWeeksVisibility(e){const t=this,a=e.children;let n;function l(e){(function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!1;return!0})(e)||n>=t.weeks?e.classList.add("smart-hidden"):n<t.weeks&&(e.classList.remove("smart-hidden"),n++)}for(let e=0;e<a.length;e++){let i=a[e].getElementsByClassName("smart-calendar-week");i=[].slice.call(i);let s=t._selectedCells.filter((t=>t.closest(".smart-calendar-month")===a[e]));if(6!==t.weeks)if(n=0,s.length>0){let e=s[s.length-1],t=i.indexOf(e.parentElement);for(let e=t;e<i.length;e++)l(i[e]);for(let e=t-1;e>=0;e--)l(i[e])}else for(let e=0;e<i.length;e++)l(i[e]);else i.map((e=>e.classList.remove("smart-hidden")))}}_refreshHeaderElements(){const e=this,t=document.activeElement.closest("smart-calendar")===e,a=e._animationStarted?e.$.nextMonthsContainer:e.$.dateViewContainer;let n,l,i=e._viewDates[e._viewDates.length-1],s=e._viewDates.map((e=>e.getFullYear()));if("month"===e.displayMode||"list"!==e.displayModeView){if("classic"===e.calendarMode&&e.$.monthElement&&e.$.monthElement instanceof HTMLDivElement){const t=document.createElement("smart-input");t.setAttribute("smart-id","monthElement"),t.classList.add("smart-calendar-month-element"),t.dropDownPosition="bottom",t.selectionMode="one",t.disabled=e.disabled,t.rightToLeft=e.rightToLeft,t.theme=e.theme,t.dropDownWidth=e.dropDownWidth,t.dropDownHeight=e.dropDownHeight,t.readonly=!0,t.dropDownButtonPosition="right";const a=e.$.monthElement;e.$.monthElement.parentNode.insertBefore(t,e.$.monthElement),e.$.monthElement=t,a.remove()}if(e.$.previousMonthButton&&!e.disabled&&("month"!==e.displayMode&&e.$.dateViewContainer.children[0].value?l="year"===e.displayMode?a.children[0].value.getFullYear()-1:a.children[1].value.getFullYear()-1:e._viewDates[0].getMonth()-1<0?(n=11,l=e._viewDates[0].getFullYear()-1):(n=e._viewDates[0].getMonth()-1,l=e._viewDates[0].getFullYear()),e.$.previousMonthButton.disabled=l<e.min.getFullYear()||l===e.min.getFullYear()&&n<e.min.getMonth(),e.$.previousMonthButton.disabled&&t&&e.$.body.focus()),e.$.nextMonthButton&&!e.disabled&&("month"!==e.displayMode&&e.$.dateViewContainer.children[0].value?l="year"===e.displayMode?a.children[0].value.getFullYear()+1:a.children[1].value.getFullYear()+11:i.getMonth()+1>11?(n=0,l=i.getFullYear()+1):(n=i.getMonth()+1,l=i.getFullYear()),e.$.nextMonthButton.disabled=l>e.max.getFullYear()||l===e.max.getFullYear()&&n>e.max.getMonth(),e.$.nextMonthButton.disabled&&t&&e.$.body.focus()),"classic"===e.calendarMode&&e.$.monthElement){let t=[...e._monthsNames];if(s.indexOf(e.min.getFullYear())>-1)for(let a=0;a<e.min.getMonth();a++)t[a]="";if(s.indexOf(e.max.getFullYear())>-1)for(let a=e.max.getMonth()+1;a<t.length;a++)t[a]="";t=t.filter((e=>""!==e));const a=Math.max(0,e.$.monthElement.selectedIndex);e.$.monthElement.dataSource=t,e._changeEventFired=0!==e.$.monthElement.selectedIndex,e.shadowRoot?e._setMonthElementPropertyInShadowDOM("selectedIndex",e._viewDates[0].getMonth()):e.$.monthElement.selectedIndex=a,e._changeEventFired=0}e.$.previousYearButton&&!e.disabled&&(l=e._viewDates[0].getFullYear()-1,e.$.previousYearButton.disabled=l<e.min.getFullYear(),e.$.previousYearButton.disabled&&t&&e.$.body.focus()),e.$.nextYearButton&&!e.disabled&&(l=i.getFullYear()+1,e.$.nextYearButton.disabled=l>e.max.getFullYear(),e.$.nextYearButton.disabled&&t&&e.$.body.focus()),e.$.yearElement&&(e.$.yearElement.value=s[0],e.$.yearElement.disabled=i.getFullYear()+1>e.max.getFullYear()&&e._viewDates[0].getFullYear()-1<e.min.getFullYear())}}_setMonthElementPropertyInShadowDOM(e,t){const a=this.$.monthElement,n=a.context;a.context=document,this.$.monthElement[e]=t,a.context=n}_refreshHeaderTitle(){const e=this;let t;function a(){if("month"!==e.displayMode){if("list"===e.displayModeView){const a=e.$.listViewContainer;if(!a)return;const n=a.querySelectorAll("li");if(!n.length)return"";let l;a.querySelector("li.active")&&(l=a.querySelector("li.active").getAttribute("value")),t="year"===e.displayMode?new Date(l||n[0].getAttribute("value")).getFullYear():new Date(n[0].getAttribute("value")).getFullYear()+" - "+new Date(n[n.length-1].getAttribute("value")).getFullYear()}else if(e.$.dateViewContainer.children[0].value){let a=e._animationStarted?e.$.nextMonthsContainer.children:e.$.dateViewContainer.children;t="year"===e.displayMode?a[0].value.getFullYear():a[1].value.getFullYear()+" - "+a[a.length-2].value.getFullYear()}if(t)return t}const a=e._viewDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime())),n=a[0],l=a[a.length-1];n.setDate(2);let i=e.monthNameFormat;return"firstTwoLetters"===i&&(i="long"),t=n.toLocaleDateString(e.locale,{year:e.yearFormat,month:i}),e.months>1&&(l.setDate(2),t+=" - "+l.toLocaleDateString(e.locale,{year:e.yearFormat,month:i})),t}if("default"===e.calendarMode&&(e.$.defaultHeaderDate.innerHTML=a()),"function"==typeof e.headerTemplate||!e._layoutTemplates)return;let n=e._layoutTemplates.filter((t=>t.selector===e.$.header))[0];if(!n)return;let l=document.importNode(n.template.content,!0);if(n.bindings.length>0){const t=l.childNodes[n.bindings[0].childNodeIndex];(e.shadowRoot?e:n.selector).childNodes[n.bindings[0].childNodeIndex].innerHTML=t.innerHTML.replace(n.bindings[0].bindingString,e.dateFormatFunction?e.dateFormatFunction(e._viewDates):a())}}_updateWeeksVisibility(e,t){const a=this;let n=(t||a._focusedCell).parentElement;function l(){for(let e=o;e<s.length;e++)if(s[e].classList.contains("smart-hidden")&&!r(s[e])&&(s[e].classList.remove("smart-hidden"),d++,d===a.weeks))return!0}function i(){for(let e=o;e>=0;--e)if(s[e].classList.contains("smart-hidden")&&!r(s[e])&&(s[e].classList.remove("smart-hidden"),d++,d===a.weeks))return!0}if(!t&&!n.classList.contains("smart-hidden"))return;const s=[].slice.call(n.parentElement.children),o=s.indexOf(n),r=function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!1;return!0};let d=0;if(s.map((e=>e.classList.add("smart-hidden"))),e>0){if(l())return;i()}else{if(i())return;l()}}_getValidDates(e){let t=[];function a(e){if(e instanceof Date)return e;if(Smart.Utilities.DateTime&&e instanceof Smart.Utilities.DateTime)return e.toDate();if("string"==typeof e){if("new Date()"===e.trim()||"new Smart.Utilities.DateTime()"===e.trim())return new Date;let t=/(\d+[,-.\/]{1}\s*\d+[,-.\/]{1}\s*\d+)/;const a=()=>(e=e.replace(/[,-.\/]/g,",").split(",")).length>2?e=new Date(parseInt(e[0]),parseInt(e[1])-1,parseInt(e[2])):new Date;return t.test(e)&&(e=t.exec(e)[0].replace(/[,-.\/]/g,",").split(","))?new Date(parseInt(e[0]),parseInt(e[1])-1,parseInt(e[2])):a()}}if(void 0===e)return null;if(Array.isArray(e))for(let n=0;n<e.length;n++)t.push(a(e[n]));else t.push(a(e));return t=t.filter((e=>e&&"Invalid Date"!==e.toDateString())),t.map((e=>e.setHours(0,0,0,0))),t}_getValidDate(e){const t=this._getValidDates(e);return t.length>0?t[0]:null}_validateSelectedDates(e){const t=this;let a=[];e||(e=t.selectedDates);let n=e.slice(0),l=function(e){for(let a=0;a<t.restrictedDates.length;a++)if(t.restrictedDates[a].getTime()===e.getTime())return!0};t.selectedDates=n.filter((function(e){if(e.getTime()>=t.min.getTime()&&e.getTime()<=t.max.getTime()&&!l(e))return!0;a.push(e)})),t._viewDates&&(a.map((e=>t._selectDate(e))),t._focusCell())}_validateMinMax(e,t,a){const n=this;switch(e){case"min":t=n._getValidDate(n[e]),n.min=t||a||n.properties.min.defaultValue;break;case"max":t=n._getValidDate(n[e]),n.max=t||a||n.properties.max.defaultValue;break;default:t=n._getValidDate(n.min),n.min=t||a||n.properties.min.defaultValue,t=n._getValidDate(n.max),n.max=t||a||n.properties.max.defaultValue}n.min=n.min.getTime()>n.max.getTime()?n.max:n.min,n.min.setHours(0,0,0,0),n.max.setHours(0,0,0,0);let l,i=n.$.monthsContainer.children;if(n._viewDates){if(n._viewDates[0].getTime()>n.max.getTime()||n._viewDates[0].getTime()<n.min.getTime())return void n._handleMonths();for(let e=0;e<i.length;e++){l=n._getMonthCells(i[e]);for(let t=0;t<l.length;t++){const a=l[t];if(a.value.getTime()>=n.min.getTime()&&a.value.getTime()<=n.max.getTime())n._setCellState(a,"restricted",!1),a.value.getMonth()===i[e]._date.getMonth()?a.classList.remove("smart-visibility-hidden"):n.hideOtherMonthDays||(n._setCellState(a,"otherMonth",!0),a.classList.remove("smart-visibility-hidden")),"month"!==n.displayMode&&n._setCellState(a,"otherMonth",!1);else{if(a.otherMonth){if(a.classList.contains("smart-visibility-hidden")){n._setCellState(a,"restricted",!1);continue}}else n._setCellState(a,"restricted",!0);"month"!==n.displayMode&&(a.classList.remove("smart-visibility-hidden"),n._setCellState(a,"otherMonth",!0))}}}}}_setCellState(e,t,a){e[t]=a;const n=Smart.Utilities.Core.toDash(t);a?(e.setAttribute(n,""),"selected"===t?e.setAttribute("aria-selected",!0):"today"===t?e.setAttribute("aria-current","date"):"restricted"===t?e.removeAttribute("aria-selected"):"disabled"===t&&(e.removeAttribute("aria-selected"),e.setAttribute("aria-disabled",!0))):(e.removeAttribute(n),"selected"===t?"none"===this.selectionMode||e.restricted||e.disabled?e.removeAttribute("aria-selected"):e.setAttribute("aria-selected",!1):"today"===t?e.removeAttribute("aria-current"):"restricted"!==t||e.disabled?"disabled"===t&&(e.removeAttribute("aria-disabled"),e.restricted||e.setAttribute("aria-selected",!1)):e.setAttribute("aria-selected",!1))}_validateTemplate(e,t){if(null===t||!t)return;if("function"==typeof t)return;const a=this;if("content"in document.createElement("template")){if("string"==typeof t&&(t=document.getElementById(t)),null!==t&&"content"in t)return t;a.error(a.localize("invalidTemplate",{elementType:a.nodeName.toLowerCase(),property:e}))}else a.error(a.localize("htmlTemplateNotSuported",{elementType:a.nodeName.toLowerCase()}))}_weeksDownHandler(e,t){const a=this,n=t.value;let l;if(a.$.body.contains(t))if(t.otherMonth&&(l=t.value.getTime()>t.closest(".smart-calendar-month")._date.getTime()?1:-1),n&&a.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t,e.pageX,e.pageY),l){if(a._isDateInView(n))return;a.disableAutoNavigation||a.navigate(l*a.months)}else(t=a._getCellByDate(n))&&(t.disabled||t.restricted)||a._handleDateSelection(t)}_firstDayOfWeekValidator(e,t){return Math.min(Math.max(0,isNaN(t)?6:t),6)}_weeksValidator(e,t){return Math.min(Math.max(1,isNaN(t)?6:t),6)}_monthsValidator(e,t){return Math.min(Math.max(1,isNaN(t)?1:t),12)}});
|
|
1296
1296
|
|
|
1297
1297
|
/***/ }),
|
|
1298
1298
|
|
|
@@ -1341,7 +1341,7 @@ Smart("smart-country-input",class extends Smart.Input{static get properties(){re
|
|
|
1341
1341
|
/***/ 501:
|
|
1342
1342
|
/***/ (() => {
|
|
1343
1343
|
|
|
1344
|
-
Smart("smart-date-input",class extends Smart.Input{static get properties(){return{autoClose:{value:!1,type:"boolean"},autoCloseDelay:{value:0,type:"number"},dropDownButtonPosition:{allowedValues:["none","left","right"],value:"right",defaultReflectToAttribute:!0,type:"string"},dropDownHeight:{type:"any",value:"auto"},min:{type:"any",value:new Date(1900,0,1)},max:{type:"any",value:new Date(2100,0,1)},messages:{value:{en:{hours:"Hours",minutes:"Minutes",am:"am",pm:"pm"}},type:"object",extend:!0},placeholder:{value:"MM/dd/yyyy",type:"string"},formatString:{value:"",type:"string"},dateTimeFormat:{type:"any",value:{year:"numeric",month:"numeric",day:"numeric"}},value:{type:"any",value:""}}}template(){return'<div id="inputContainer" role="presentation"><input class="smart-input" id=\'input\' readonly=\'[[readonly]]\' placeholder=\'[[placeholder]]\' type=\'[[type]]\' name=\'[[name]]\' disabled=\'[[disabled]]\' aria-label="[[placeholder]]" /><span class="smart-hidden smart-hint" id="span">[[hint]]</span><div id="dropDownButton" tabindex=-1 class="smart-drop-down-button" role="button" aria-label="Toggle popup"><div id="arrow" class="arrow" aria-hidden="true"></div></div></div>'}static get listeners(){return{"input.change":"_changeHandler","input.focus":"_focusHandler","input.blur":"_blurHandler","input.keydown":"_keyDownHandler","input.keyup":"_keyUpHandler","input.keypress":"_keyPressHandler","dropDownButton.down":"_dropDownButtonDownHandler","inputContainer.down":"_downHandler","document.up":"_documentUpHandler"}}_calendarDropDownClickHandler(e){const t=this;t.autoClose&&e.target.closest(".smart-calendar-cell")&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay))}render(){super.render(),this.formatString&&this.formatString.length>1&&"MM/dd/yyyy"===this.placeholder&&(this.placeholder=this.formatString),this.value&&this.value instanceof Date&&this._setInputValue(this.value)}focus(){this.$.input.focus()}select(){const e=this;e.readonly?e.$.input.focus():e.$.input.select()}_documentUpHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;t.contains(a)?requestAnimationFrame((()=>{})):t.$.scrollView.contains(a.shadowParent||a)?t._isPointerDown&&(t._isPointerDown=!1,t.opened&&(t._preventLookup=!0),t.$.input.focus()):(t.opened&&(t._preventLookup=!0),t._isPointerDown=!1,t.close())}_changeHandler(e){const t=this;e.stopPropagation(),t._performSelect();const a=t._getInputValue();t._oldValue||(t._oldValue=null),t.$.fireEvent("change",{value:a,oldValue:t._oldValue}),t._updateTargetValue(),t._oldValue=a}_focusHandler(){const e=this;if(e.setAttribute("focus",""),e.readonly||0!==e.minLength||0!==e.$.input.value.length||e._preventLookup){if(e.$.fireEvent("focus"),e.value){const t=e._getInputValue();e._setInputValue(t)}delete e._preventLookup}}_blurHandler(){const e=this;if(e.opened||e.removeAttribute("focus"),e._popup&&e._popup.isCompleted&&e.opened)e._setInputValue(e._popup.value);else{const t=e._getInputValue();e._setInputValue(t)}e.$.fireEvent("blur"),delete e._preventLookup}_getInputValue(){const e=this,t=e.$.input.value;let a=null;const o=t=>{let a=new Date(Date.parse(t));if("Invalid Date"===a.toString()&&(a=null),!a||e.locale&&"en"!==e.locale){let e=(new Smart.Utilities.DateTime).tryparseDate(t,null);if(e)return e}return a};return e.dateTimeFormat.day&&e.dateTimeFormat.month&&e.dateTimeFormat.year?a=o(t):e.dateTimeFormat.day&&e.dateTimeFormat.month&&!e.dateTimeFormat.year?(a=o(t),e._popup.value||(e._popup.value=new Date),e._popup.isCompleted?a.setFullYear(e._popup.value.getFullYear(),a.getMonth(),a.getDate()):a.setFullYear((new Date).getFullYear(),a.getMonth(),a.getDate())):!e.dateTimeFormat.day&&e.dateTimeFormat.month&&e.dateTimeFormat.year&&(e._popup.value||(e._popup.value=new Date),a=o(t),e._popup.isCompleted?a.setFullYear(a.getFullYear(),a.getMonth(),e._popup.value.getDate()):a.setFullYear(a.getFullYear(),a.getMonth(),(new Date).getDate())),""!==e.min&&a<e.min&&(a=e.min),""!==e.max&&a>e.max&&(a=e.max),a}getDate(){return this._getInputValue()}getValue(){return this._getInputValue()}setValue(e){this._setInputValue(e)}_setInputValue(e){const t=this;if(!e)return t.$.input.value="",t.removeAttribute("data-value"),void(t.value=null);""!==t.min&&e<t.min&&(e=t.min),""!==t.max&&e>t.max&&(e=t.max);const a=t.dateTimeFormat;a&&a.timeZone&&delete a.timeZone;let o=new Intl.DateTimeFormat(t.locale,a).format(e);if(t.hasAttribute("focus")&&(o=new Intl.DateTimeFormat(t.locale,{year:"numeric",day:"numeric",month:"numeric"}).format(e)),t.formatString&&t.formatString.length>1){let a=new Smart.Utilities.DateTime(e).toString(t.formatString);t.locale&&"en"!==t.locale&&(o.indexOf(".")>=0?a=a.replaceAll("/","."):o.indexOf("-")>=0&&(a=a.replaceAll("/","-"))),o=a}t.$.input.value=t.value=o,t.setAttribute("data-value",e)}_performSelect(){}getFormattedValue(e,t){const a=this;if(null===t)return parseFloat(e);e||(e=new Date),t||(t=a.dateTimeFormat).timeZone&&delete t.timeZone;const o=new Intl.DateTimeFormat(a.locale,t).format(e);return a.formatString&&a.formatString.length>1?new Smart.Utilities.DateTime(e).toString(a.formatString):o}_open(){const e=this,t=e.getBoundingClientRect(),a=window.scrollX,o=window.scrollY;let n=0,r=0;if(this.opened)return;if(e.timer&&clearTimeout(e.timer),document.body.appendChild(e.$.scrollView),e.setAttribute("aria-owns",e.$.scrollView.id),e.readonly||e.$.input.setAttribute("aria-controls",e.$.scrollView.id),e.$.scrollView.enableShadowDOM&&!e._importedStyle&&(e.$.scrollView.importStyle(e._getStyleUrl("smart.textbox.css")),e._importedStyle=!0),"static"!==getComputedStyle(document.body).position){const e=document.body.getBoundingClientRect();n=e.left,r=e.top}const l=document.body.getBoundingClientRect(),i=-3+t.left+a-n;e.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",""),i+e.$.scrollView.offsetWidth<l.right?e.$.scrollView.style.left=i+"px":e.$.scrollView.style.left=i+e.offsetWidth-e.$.scrollView.offsetWidth+"px",e.$.scrollView.style.top=t.bottom+o-r+1+"px",e.$.scrollView.classList.remove("open"),e.$.scrollView.onpointerdown=function(){e._isPointerDown=!0},e._refreshPopup(),requestAnimationFrame((function(){e.$.scrollView.setAttribute("open",""),e.setAttribute("open",""),e.$.dropDownButton.setAttribute("open",""),e.$.input.setAttribute("open","")})),this.opened=!0}_refreshPopup(){const e=this,t=e._getInputValue();e._popup.isAttached&&e._popup.select(t)}close(){const e=this;return!!e.opened&&(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((function(){e.$.scrollView.parentNode&&!e.opened&&(document.body.removeChild(e.$.scrollView),e.removeAttribute("aria-owns"),e.readonly||e.$.input.removeAttribute("aria-controls"))}),1e3),e.$.scrollView.removeAttribute("open"),e.$.dropDownButton.removeAttribute("open"),e.$.input.removeAttribute("open"),e.removeAttribute("open"),e.opened=!1,!0)}_lookup(){}_downHandler(e){const t=this;t.readonly&&t._dropDownButtonDownHandler(e)}_dropDownButtonDownHandler(e){return this._toggle(),e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}_toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this;e._process(),e.$.input.focus(),setTimeout((function(){e.$.input.focus()}),25)}_process(){this._performSelect(void 0,!0),this._open()}_matcher(){}_sorter(){}_highlighter(){}_render(){}ensureVisible(){}_next(){}_prev(){}_move(e){e.stopPropagation()}_keyPressHandler(e){this._suppressKeyPressRepeat||e.shiftKey||e.altKey||e.ctrlKey}_insertKey(e,t=1){const a=this,o=a.$.input.selectionStart,n=a.$.input.value,r=n.substring(0,o),l=n.substring(o+t);a.$.input.value=r+e.key+l,a.$.input.selectionStart=a.$.input.selectionEnd=o+1}_keyDownHandler(e){const t=this;t._suppressKeyPressRepeat=![40,38,9,13,27,16,17,18].includes(e.keyCode);let a=!1;switch(e.keyCode>=48&&e.keyCode<=57&&(a=!0),e.keyCode>=96&&e.keyCode<=105&&(a=!0),e.key){case"/":case"-":case":":case"ArrowLeft":case"ArrowUp":case"ArrowDown":case"ArrowRight":case"Home":case"End":case"Delete":case"Backspace":case"Tab":a=!0}e.ctrlKey&&(a=!0),a||e.preventDefault(),"Tab"===e.key&&t.close(),e.shiftKey||e.altKey||e.ctrlKey}_getMask(){const e=this,t=e.getFormattedValue(new Date(2020,10,10),{year:"numeric",month:"numeric",day:"numeric"});let a="/";t.indexOf(".")>=0?a=".":t.indexOf("-")>=0&&(a="-");const o=t.split(a);e._mask=[];let n=0;for(let t=0;t<o.length-1;t++)n+=o[t].length,e._mask[n]=a,n++}_appendPreOrPostMatch(e,t){for(var a=0,o=!1,n=0,r=e.length;n<r;n++){var l=e.charAt(n);switch(l){case"'":o?t.push("'"):a++,o=!1;break;case"\\":o&&t.push("\\"),o=!o;break;default:t.push(l),o=!1}}return a}_keyUpHandler(e){const t=this;let a=t.$.input.value.trim();const o=new Date(a);if(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105){if(void 0!==t._mask[a.length]){let e=[...a],o=t._mask.flat().length,n=0;for(let o=0;o<e.length;o++)e[o]===t._mask[a.length]&&n++;n<o&&(a+=t._mask[a.length],t.$.input.value=a)}}else if(" "===e.key||"Enter"===e.key){const a=t._getInputValue();t._setInputValue(a),"Enter"===e.key&&t.opened&&t.close()}else if("/"===e.key||":"===e.key||"-"===e.key){const e=t.$.input.selectionStart,a=t._getInputValue();t._setInputValue(a),t.$.input.selectionStart=e,"/"===t.$.input.value[e]&&t.$.input.selectionStart++}if("Invalid Date"!==o.toString()?t.value=o:t.value=null,t._refreshPopup(),!e.shiftKey)switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:40===e.keyCode&&e.altKey&&(t.open(),setTimeout((()=>{t._popup.focus()}),50)),38===e.keyCode&&e.altKey&&(t.close(),t.focus());break;case 27:if(!t.opened)return;t.close(),e.stopPropagation(),e.preventDefault()}}propertyChangedHandler(e,t,a){const o=this;switch(e){case"dateTimeFormat":case"formatString":o._setInputValue(o.value);break;case"value":"string"==typeof a?o.$.input.value=a:o._setInputValue(a);break;case"month":case"min":case"max":o.$.calendar[e]=a;break;case"theme":case"rightToLeft":case"animation":case"inverted":o.$.calendar&&(o.$.calendar[e]=a),o.$.scrollView&&(a?o.$.scrollView.setAttribute(Smart.Utilities.Core.toDash(e),"boolean"==typeof a?"":a):o.$.scrollView.removeAttribute(Smart.Utilities.Core.toDash(e)));break;case"locale":o._getMask(),o._performSelect(),o.$.calendar&&(o.$.calendar.locale=a);break;default:super.propertyChangedHandler(e,t,a)}}_createElement(){const e=this,t=document.createElement("div");if(t.classList.add("smart-input-drop-down-menu","smart-date-input-drop-down-menu"),t.setAttribute("animation",e.animation),t.setAttribute("role","presentation"),e.rightToLeft?t.setAttribute("right-to-left",""):t.removeAttribute("right-to-left"),e.inverted?t.setAttribute("inverted",""):t.removeAttribute("inverted"),t.onclick=function(t){t.stopPropagation(),t.preventDefault();const a=t.target;t.altKey?e.$.input.focus():e._popup.focus(),a.closest("smart-done-button")&&e.close()},!t.id){const e=t.tagName.toLowerCase();t.id=e.slice(0,1).toLowerCase()+e.slice(1)+Math.floor(65536*(1+Math.random())).toString(16).substring(1)}e.$.scrollView=t,e.classList.add("smart-input");const a=document.createElement("smart-calendar");if(e._popup=a,e.$.calendar=a,a.locale=e.locale,a.$.listen("keyup",(t=>{if("Enter"===t.key){e._oldValue||(e._oldValue=null);const t=a.selectedDates[0];a.value=t,e._setInputValue(t),e.$.fireEvent("change",{value:t,oldValue:e._oldValue}),e.set("value",t),e._updateTargetValue(),e._oldValue=t,e.close(),e.focus()}"Escape"===t.key&&(e.close(),e.focus()),"Tab"===t.key&&(e.close(),e.focus())})),a.onclick=t=>{e._oldValue||(e._oldValue=null);const o=a.selectedDates[0];e._setInputValue(o),e._calendarDropDownClickHandler(t),e.$.fireEvent("change",{value:o,oldValue:e._oldValue}),e.set("value",o),e._updateTargetValue(),e._oldValue=o},t.appendChild(a),e.$.input.value=e.value,e.value&&(""+e.value).length>0){const t=e._getInputValue();e._oldValue=t,e._setInputValue(t)}e._getMask()}_refreshMenu(){}_setAriaRelations(){const e=this,t=e.getAttribute("aria-label");e.readonly?(e.setAttribute("role","button"),!t&&e.placeholder&&e.setAttribute("aria-label",e.placeholder),e.removeAttribute("aria-readonly"),e.$.input.setAttribute("aria-hidden",!0),e.$.input.removeAttribute("aria-controls"),e.$.dropDownButton.setAttribute("aria-hidden",!0)):(e.setAttribute("role","presentation"),t&&t===e.placeholder&&e.removeAttribute("aria-label"),e.$.input.removeAttribute("aria-hidden"),e.$.dropDownButton.removeAttribute("aria-hidden")),e.setAttribute("aria-haspopup","dialog"),e.$.scrollView.setAttribute("role","dialog")}_setActiveDescendant(){}_setInputPurpose(){}});
|
|
1344
|
+
Smart("smart-date-input",class extends Smart.Input{static get properties(){return{autoClose:{value:!1,type:"boolean"},autoCloseDelay:{value:0,type:"number"},dropDownButtonPosition:{allowedValues:["none","left","right"],value:"right",defaultReflectToAttribute:!0,type:"string"},dropDownHeight:{type:"any",value:"auto"},min:{type:"any",value:new Date(1900,0,1)},max:{type:"any",value:new Date(2100,0,1)},messages:{value:{en:{hours:"Hours",minutes:"Minutes",am:"am",pm:"pm"}},type:"object",extend:!0},placeholder:{value:"MM/dd/yyyy",type:"string"},formatString:{value:"",type:"string"},dateTimeFormat:{type:"any",value:{year:"numeric",month:"numeric",day:"numeric"}},value:{type:"any",value:""}}}template(){return'<div id="inputContainer" role="presentation"><input class="smart-input" id=\'input\' readonly=\'[[readonly]]\' placeholder=\'[[placeholder]]\' type=\'[[type]]\' name=\'[[name]]\' disabled=\'[[disabled]]\' aria-label="[[placeholder]]" /><span class="smart-hidden smart-hint" id="span">[[hint]]</span><div id="dropDownButton" tabindex=-1 class="smart-drop-down-button" role="button" aria-label="Toggle popup"><div id="arrow" class="arrow" aria-hidden="true"></div></div></div>'}static get listeners(){return{"input.change":"_changeHandler","input.focus":"_focusHandler","input.blur":"_blurHandler","input.keydown":"_keyDownHandler","input.keyup":"_keyUpHandler","input.keypress":"_keyPressHandler","dropDownButton.down":"_dropDownButtonDownHandler","inputContainer.down":"_downHandler","document.up":"_documentUpHandler"}}_calendarDropDownClickHandler(e){const t=this;t.autoClose&&e.target.closest(".smart-calendar-cell")&&"month"===t.$.calendar.displayMode&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay))}render(){super.render(),this.formatString&&this.formatString.length>1&&"MM/dd/yyyy"===this.placeholder&&(this.placeholder=this.formatString),this.value&&this.value instanceof Date&&this._setInputValue(this.value)}focus(){this.$.input.focus()}select(){const e=this;e.readonly?e.$.input.focus():e.$.input.select()}_documentUpHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;t.contains(a)?requestAnimationFrame((()=>{})):t.$.scrollView.contains(a.shadowParent||a)?t._isPointerDown&&(t._isPointerDown=!1,t.opened&&(t._preventLookup=!0),t.$.input.focus()):(t.opened&&(t._preventLookup=!0),t._isPointerDown=!1,t.close())}_changeHandler(e){const t=this;e.stopPropagation(),t._performSelect();const a=t._getInputValue();t._oldValue||(t._oldValue=null),t.$.fireEvent("change",{value:a,oldValue:t._oldValue}),t._updateTargetValue(),t._oldValue=a}_focusHandler(){const e=this;if(e.setAttribute("focus",""),e.readonly||0!==e.minLength||0!==e.$.input.value.length||e._preventLookup){if(e.$.fireEvent("focus"),e.value){const t=e._getInputValue();e._setInputValue(t)}delete e._preventLookup}}_blurHandler(){const e=this;if(e.opened||e.removeAttribute("focus"),e._popup&&e._popup.isCompleted&&e.opened)e._setInputValue(e._popup.value);else{const t=e._getInputValue();e._setInputValue(t)}e.$.fireEvent("blur"),delete e._preventLookup}_getInputValue(){const e=this,t=e.$.input.value;let a=null;const o=t=>{let a=new Date(Date.parse(t));if("Invalid Date"===a.toString()&&(a=null),!a||e.locale&&"en"!==e.locale){let e=(new Smart.Utilities.DateTime).tryparseDate(t,null);if(e)return e}return a};return e.dateTimeFormat.day&&e.dateTimeFormat.month&&e.dateTimeFormat.year?a=o(t):e.dateTimeFormat.day&&e.dateTimeFormat.month&&!e.dateTimeFormat.year?(a=o(t),e._popup.value||(e._popup.value=new Date),e._popup.isCompleted?a.setFullYear(e._popup.value.getFullYear(),a.getMonth(),a.getDate()):a.setFullYear((new Date).getFullYear(),a.getMonth(),a.getDate())):!e.dateTimeFormat.day&&e.dateTimeFormat.month&&e.dateTimeFormat.year&&(e._popup.value||(e._popup.value=new Date),a=o(t),e._popup.isCompleted?a.setFullYear(a.getFullYear(),a.getMonth(),e._popup.value.getDate()):a.setFullYear(a.getFullYear(),a.getMonth(),(new Date).getDate())),""!==e.min&&a<e.min&&(a=e.min),""!==e.max&&a>e.max&&(a=e.max),a}getDate(){return this._getInputValue()}getValue(){return this._getInputValue()}setValue(e){this._setInputValue(e)}_setInputValue(e){const t=this;if(!e)return t.$.input.value="",t.removeAttribute("data-value"),void(t.value=null);""!==t.min&&e<t.min&&(e=t.min),""!==t.max&&e>t.max&&(e=t.max);const a=t.dateTimeFormat;a&&a.timeZone&&delete a.timeZone;let o=new Intl.DateTimeFormat(t.locale,a).format(e);if(t.hasAttribute("focus")&&(o=new Intl.DateTimeFormat(t.locale,{year:"numeric",day:"numeric",month:"numeric"}).format(e)),t.formatString&&t.formatString.length>1){let a=new Smart.Utilities.DateTime(e).toString(t.formatString);t.locale&&"en"!==t.locale&&(o.indexOf(".")>=0?a=a.replaceAll("/","."):o.indexOf("-")>=0&&(a=a.replaceAll("/","-"))),o=a}t.$.input.value=t.value=o,t.setAttribute("data-value",e)}_performSelect(){}getFormattedValue(e,t){const a=this;if(null===t)return parseFloat(e);e||(e=new Date),t||(t=a.dateTimeFormat).timeZone&&delete t.timeZone;const o=new Intl.DateTimeFormat(a.locale,t).format(e);return a.formatString&&a.formatString.length>1?new Smart.Utilities.DateTime(e).toString(a.formatString):o}_open(){const e=this,t=e.getBoundingClientRect(),a=window.scrollX,o=window.scrollY;let n=0,r=0;if(this.opened)return;if(e.timer&&clearTimeout(e.timer),document.body.appendChild(e.$.scrollView),e.setAttribute("aria-owns",e.$.scrollView.id),e.readonly||e.$.input.setAttribute("aria-controls",e.$.scrollView.id),e.$.scrollView.enableShadowDOM&&!e._importedStyle&&(e.$.scrollView.importStyle(e._getStyleUrl("smart.textbox.css")),e._importedStyle=!0),"static"!==getComputedStyle(document.body).position){const e=document.body.getBoundingClientRect();n=e.left,r=e.top}const l=document.body.getBoundingClientRect(),i=-3+t.left+a-n;e.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",""),i+e.$.scrollView.offsetWidth<l.right?e.$.scrollView.style.left=i+"px":e.$.scrollView.style.left=i+e.offsetWidth-e.$.scrollView.offsetWidth+"px",e.$.scrollView.style.top=t.bottom+o-r+1+"px",e.$.scrollView.classList.remove("open"),e.$.scrollView.onpointerdown=function(){e._isPointerDown=!0},e._refreshPopup(),requestAnimationFrame((function(){e.$.scrollView.setAttribute("open",""),e.setAttribute("open",""),e.$.dropDownButton.setAttribute("open",""),e.$.input.setAttribute("open","")})),this.opened=!0}_refreshPopup(){const e=this,t=e._getInputValue();e._popup.isAttached&&e._popup.select(t)}close(){const e=this;return!!e.opened&&(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((function(){e.$.scrollView.parentNode&&!e.opened&&(document.body.removeChild(e.$.scrollView),e.removeAttribute("aria-owns"),e.readonly||e.$.input.removeAttribute("aria-controls"))}),1e3),e.$.scrollView.removeAttribute("open"),e.$.dropDownButton.removeAttribute("open"),e.$.input.removeAttribute("open"),e.removeAttribute("open"),e.opened=!1,!0)}_lookup(){}_downHandler(e){const t=this;t.readonly&&t._dropDownButtonDownHandler(e)}_dropDownButtonDownHandler(e){return this._toggle(),e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}_toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this;e._process(),e.$.input.focus(),setTimeout((function(){e.$.input.focus()}),25)}_process(){this._performSelect(void 0,!0),this._open()}_matcher(){}_sorter(){}_highlighter(){}_render(){}ensureVisible(){}_next(){}_prev(){}_move(e){e.stopPropagation()}_keyPressHandler(e){this._suppressKeyPressRepeat||e.shiftKey||e.altKey||e.ctrlKey}_insertKey(e,t=1){const a=this,o=a.$.input.selectionStart,n=a.$.input.value,r=n.substring(0,o),l=n.substring(o+t);a.$.input.value=r+e.key+l,a.$.input.selectionStart=a.$.input.selectionEnd=o+1}_keyDownHandler(e){const t=this;t._suppressKeyPressRepeat=![40,38,9,13,27,16,17,18].includes(e.keyCode);let a=!1;switch(e.keyCode>=48&&e.keyCode<=57&&(a=!0),e.keyCode>=96&&e.keyCode<=105&&(a=!0),e.key){case"/":case"-":case":":case"ArrowLeft":case"ArrowUp":case"ArrowDown":case"ArrowRight":case"Home":case"End":case"Delete":case"Backspace":case"Tab":a=!0}e.ctrlKey&&(a=!0),a||e.preventDefault(),"Tab"===e.key&&t.close(),e.shiftKey||e.altKey||e.ctrlKey}_getMask(){const e=this,t=e.getFormattedValue(new Date(2020,10,10),{year:"numeric",month:"numeric",day:"numeric"});let a="/";t.indexOf(".")>=0?a=".":t.indexOf("-")>=0&&(a="-");const o=t.split(a);e._mask=[];let n=0;for(let t=0;t<o.length-1;t++)n+=o[t].length,e._mask[n]=a,n++}_appendPreOrPostMatch(e,t){for(var a=0,o=!1,n=0,r=e.length;n<r;n++){var l=e.charAt(n);switch(l){case"'":o?t.push("'"):a++,o=!1;break;case"\\":o&&t.push("\\"),o=!o;break;default:t.push(l),o=!1}}return a}_keyUpHandler(e){const t=this;let a=t.$.input.value.trim();const o=new Date(a);if(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105){if(void 0!==t._mask[a.length]){let e=[...a],o=t._mask.flat().length,n=0;for(let o=0;o<e.length;o++)e[o]===t._mask[a.length]&&n++;n<o&&(a+=t._mask[a.length],t.$.input.value=a)}}else if(" "===e.key||"Enter"===e.key){const a=t._getInputValue();t._setInputValue(a),"Enter"===e.key&&t.opened&&t.close()}else if("/"===e.key||":"===e.key||"-"===e.key){const e=t.$.input.selectionStart,a=t._getInputValue();t._setInputValue(a),t.$.input.selectionStart=e,"/"===t.$.input.value[e]&&t.$.input.selectionStart++}if("Invalid Date"!==o.toString()?t.value=o:t.value=null,t._refreshPopup(),!e.shiftKey)switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:40===e.keyCode&&e.altKey&&(t.open(),setTimeout((()=>{t._popup.focus()}),50)),38===e.keyCode&&e.altKey&&(t.close(),t.focus());break;case 27:if(!t.opened)return;t.close(),e.stopPropagation(),e.preventDefault()}}propertyChangedHandler(e,t,a){const o=this;switch(e){case"dateTimeFormat":case"formatString":o._setInputValue(o.value);break;case"value":"string"==typeof a?o.$.input.value=a:o._setInputValue(a);break;case"month":case"min":case"max":o.$.calendar[e]=a;break;case"theme":case"rightToLeft":case"animation":case"inverted":o.$.calendar&&(o.$.calendar[e]=a),o.$.scrollView&&(a?o.$.scrollView.setAttribute(Smart.Utilities.Core.toDash(e),"boolean"==typeof a?"":a):o.$.scrollView.removeAttribute(Smart.Utilities.Core.toDash(e)));break;case"locale":o._getMask(),o._performSelect(),o.$.calendar&&(o.$.calendar.locale=a);break;default:super.propertyChangedHandler(e,t,a)}}_createElement(){const e=this,t=document.createElement("div");if(t.classList.add("smart-input-drop-down-menu","smart-date-input-drop-down-menu"),t.setAttribute("animation",e.animation),t.setAttribute("role","presentation"),e.rightToLeft?t.setAttribute("right-to-left",""):t.removeAttribute("right-to-left"),e.inverted?t.setAttribute("inverted",""):t.removeAttribute("inverted"),t.onclick=function(t){t.stopPropagation(),t.preventDefault();const a=t.target;t.altKey?e.$.input.focus():e._popup.focus(),a.closest("smart-done-button")&&e.close()},!t.id){const e=t.tagName.toLowerCase();t.id=e.slice(0,1).toLowerCase()+e.slice(1)+Math.floor(65536*(1+Math.random())).toString(16).substring(1)}e.$.scrollView=t,e.classList.add("smart-input");const a=document.createElement("smart-calendar");if(e._popup=a,e.$.calendar=a,e.$.calendar.locale=e.locale,e.$.calendar.min=e.min,e.$.calendar.max=e.max,e.$.calendar.value=e.value,a.$.listen("keyup",(t=>{if("Enter"===t.key){e._oldValue||(e._oldValue=null);const t=a.selectedDates[0];a.value=t,e._setInputValue(t),e.$.fireEvent("change",{value:t,oldValue:e._oldValue}),e.set("value",t),e._updateTargetValue(),e._oldValue=t,e.close(),e.focus()}"Escape"===t.key&&(e.close(),e.focus()),"Tab"===t.key&&(e.close(),e.focus())})),a.onclick=t=>{e._oldValue||(e._oldValue=null);const o=a.selectedDates[0];e._setInputValue(o),e._calendarDropDownClickHandler(t),e.$.fireEvent("change",{value:o,oldValue:e._oldValue}),e.set("value",o),e._updateTargetValue(),e._oldValue=o},t.appendChild(a),e.$.input.value=e.value,e.value&&(""+e.value).length>0){const t=e._getInputValue();e._oldValue=t,e._setInputValue(t)}e._getMask()}_refreshMenu(){}_setAriaRelations(){const e=this,t=e.getAttribute("aria-label");e.readonly?(e.setAttribute("role","button"),!t&&e.placeholder&&e.setAttribute("aria-label",e.placeholder),e.removeAttribute("aria-readonly"),e.$.input.setAttribute("aria-hidden",!0),e.$.input.removeAttribute("aria-controls"),e.$.dropDownButton.setAttribute("aria-hidden",!0)):(e.setAttribute("role","presentation"),t&&t===e.placeholder&&e.removeAttribute("aria-label"),e.$.input.removeAttribute("aria-hidden"),e.$.dropDownButton.removeAttribute("aria-hidden")),e.setAttribute("aria-haspopup","dialog"),e.$.scrollView.setAttribute("role","dialog")}_setActiveDescendant(){}_setInputPurpose(){}});
|
|
1345
1345
|
|
|
1346
1346
|
/***/ }),
|
|
1347
1347
|
|
|
@@ -1397,14 +1397,14 @@ Smart.Utilities.Assign("FilterGroup",class t{constructor(){const t=this;t.string
|
|
|
1397
1397
|
/***/ 3131:
|
|
1398
1398
|
/***/ (() => {
|
|
1399
1399
|
|
|
1400
|
-
Smart("smart-query-builder",class extends Smart.BaseElement{static get properties(){return{allowDrag:{value:!1,type:"boolean"},autoPrompt:{value:!1,type:"boolean"},applyMode:{allowValues:["immediately","change"],value:"change",type:"string"},customOperations:{value:[],type:"array",reflectToAttribute:!1},customOperators:{value:{},type:"object",reflectToAttribute:!1},dropDownWidth:{type:"any",value:"auto"},fields:{value:null,type:"array?",reflectToAttribute:!1},fieldsMode:{value:"dynamic",allowedValues:["dynamic","static"],type:"string"},formatStringDate:{value:"dd-MMM-yy",type:"string"},formatStringDateTime:{value:"dd-MMM-yy HH:mm:ss",type:"string"},getDynamicField:{value:null,type:"function?"},icons:{value:{"=":"equals","<>":"notequals",">":"greaterthan",">=":"greaterthanorequal","<":"lessthan","<=":"lessthanorequal",startswith:"startswith",endswith:"endswith",contains:"contains",notcontains:"notcontains",isblank:"isblank",isnotblank:"isnotblank"},type:"object",reflectToAttribute:!1},messages:{value:{en:{add:"Add",addCondition:"Add Condition",addGroup:"Add Group",and:"And",notand:"Not And",or:"Or",notor:"Not Or","=":"Equals","<>":"Does not equal",">":"Greater than",">=":"Greater than or equal to","<":"Less than","<=":"Less than or equal to",startswith:"Starts with",endswith:"Ends with",contains:"Contains",notcontains:"Does not contain",isblank:"Is blank",isnotblank:"Is not blank",wrongParentGroupIndex:'{{elementType}}: Wrong parent group index in "{{method}}" method.',wrongElementNode:'{{elementType}}: Incorect node / node Id in "{{method}}" method.',invalidDataStructure:"{{elementType}}: Used invalid data structure in updateCondition/updateGroup method.",dateTabLabel:"DATE",timeTabLabel:"TIME",queryLabel:"Query"}},type:"object",extend:!0},operatorPlaceholder:{value:"Operator",type:"string"},propertyPlaceholder:{value:"Property",type:"string"},showIcons:{value:!1,type:"boolean"},showFieldNameArrow:{value:!1,type:"boolean"},validateOnInput:{value:!1,type:"boolean"},validationTimeout:{value:100,type:"number"},value:{value:[],type:"any",reflectToAttribute:!1},valueFormatFunction:{value:null,type:"function?",reflectToAttribute:!1},valuePlaceholder:{value:"Value",type:"string"}}}static get requires(){const e={"Smart.Button":"smart.button.js","Smart.Calendar":"smart.calendar.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.DropDownList":"smart.dropdownlist.js","Smart.Input":"smart.input.js","Smart.ListBox":"smart.listbox.js","Smart.Menu":"smart.menu.js","Smart.NumericTextBox":"smart.numerictextbox.js","Smart.ScrollBar":"smart.scrollbar.js","Smart.TimePicker":"smart.timepicker.js","Smart.Tooltip":"smart.tooltip.js","Smart.Utilities.BigNumber":"smart.math.js","Smart.Utilities.DateTime":"smart.date.js","Smart.Utilities.Draw":"smart.draw.js","Smart.Utilities.NumericProcessor":"smart.numeric.js"};return window.NIComplex||(e["Smart.Utilities.Complex"]="smart.complex.js"),e}static get listeners(){return{down:"_downHandler",resize:"_resizeHandler","editorsContainer.keydown":"_editorsContainerKeydownHandler","editorsContainer.keyup":"_editorsContainerKeyUpHandler","conditionsMenu.close":"_menuCloseHandler","conditionsMenu.closing":"_menuClosingHandler","conditionsMenu.itemClick":"_menuItemClickHandler","contentContainer.change":"_contentContainerChangeHandler","contentContainer.itemClick":"_contentContainerChangeHandler","scrollableContainer.touchmove":"_scrollableContainerTouchmoveHandler","document.down":"_documentDownHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler"}}static get styleUrls(){return["smart.querybuilder.css"]}template(){return'<div id="container" role="presentation">\n <smart-scroll-viewer id="scrollableContainer" class="smart-scrollable-container" animation="[[animation]]" right-to-left="[[rightToLeft]]">\n <div id="queryLabel" class="smart-query-builder-label smart-unselectable"></div>\n <div id="contentContainer" class="smart-content-container"></div>\n </smart-scroll-viewer>\n <div id="editorsContainer" class="smart-editors-container" role="presentation">\n <div id="customEditor" class="smart-custom-editor smart-hidden"></div>\n </div>\n <smart-menu id="conditionsMenu" mode="dropDown" class="smart-conditions-menu" theme="[[theme]]" animation="[[animation]]" right-to-left="[[rightToLeft]]"></smart-menu>\n </div>'}propertyChangedHandler(e,t,i){super.propertyChangedHandler(e,t,i);const a=this;switch(e){case"animation":case"theme":["textBoxEditor","numericTextBoxEditor","comboBoxEditor","dateTimePickerEditor","checkBoxEditor"].forEach((t=>a.$[t]&&(a.$[t][e]=i)));break;case"formatStringDate":case"formatStringDateTime":case"valueFormatFunction":a._refresh();break;case"operatorPlaceholder":Array.from((a.shadowRoot||a).querySelectorAll(".smart-filter-operation[placeholder]")).forEach((e=>e.firstElementChild.innerHTML=i));break;case"propertyPlaceholder":Array.from((a.shadowRoot||a).querySelectorAll(".smart-filter-field-name[placeholder]")).forEach((e=>e.firstElementChild.innerHTML=i));break;case"showIcons":a._closeEditor(),i?a._filterOperationDescriptions.map((e=>e.icon=a.icons[e.value])):a._filterOperationDescriptions.map((e=>delete e.icon));break;case"customOperations":case"fields":case"value":{const t=JSON.stringify(a._validValue),o=a._queryParser;"customOperations"===e?a._handleCustomOperations():""===e&&a._mapFieldsToMenu(),a._applyValue(),"customOperations"!==e&&"fields"!==e||(o[e]=i),a._oldValueAsString!==t&&(a._oldValueAsString=JSON.stringify(a._validValue),a.$.fireEvent("change",{value:JSON.parse(a._oldValueAsString),linq:o.toLinq(a._validValue)}));break}case"valuePlaceholder":Array.from((a.shadowRoot||a).querySelectorAll(".smart-filter-value[placeholder]")).forEach((e=>e.firstElementChild.innerHTML=i));break;case"locale":case"messages":a._localizeInitialValues(),a._refresh(),a._handleCustomOperations(),a.$.dateTimePickerEditor&&(a.$.dateTimePickerEditor.messages[a.locale]||(a.$.dateTimePickerEditor.messages[a.locale]={}),a.$.dateTimePickerEditor.messages[a.locale].dateTabLabel=a.localize("dateTabLabel"),a.$.dateTimePickerEditor.messages[a.locale].timeTabLabel=a.localize("timeTabLabel"),"locale"===e?a.$.dateTimePickerEditor.locale=a.locale:"messages"===e&&(a.$.dateTimePickerEditor.$.selectDate.innerHTML=a.$.dateTimePickerEditor.messages[a.locale].dateTabLabel,a.$.dateTimePickerEditor.$.selectTime.innerHTML=a.$.dateTimePickerEditor.messages[a.locale].timeTabLabel));break;case"icons":a._closeEditor()}}ready(){super.ready();const e=this;e.$.queryLabel.id||(e.$.queryLabel.id=e.id+"Label"),e.setAttribute("role","dialog"),e.setAttribute("aria-labelledby",e.$.queryLabel.id),-1!==navigator.platform.toLowerCase().lastIndexOf("mac")&&e.$.contentContainer.classList.add("mac"),e._queryParser=new Smart.Utilities.QueryParser,e._setInitialValues(),e._handleCustomOperations(),e._applyValue(),Object.defineProperty(e,"value",{get:function(){return e.context===e?e.properties.value.value:e._validValue},set(t){e.updateProperty(e,e._properties.value,t)}})}getLinq(){const e=this;if(e._validValue)return e._queryParser.customOperations=e.customOperations,e._queryParser.fields=e.fields,e._queryParser.dynamicField="dynamic"===e.fieldsMode?e.getDynamicField:void 0,e._queryParser.toLinq(e._validValue)}get validationStatus(){const e=this;return!e.isReady||void 0===e._validationStatus||e._validationStatus}_setInitialValues(){const e=this;e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._isMobile=Smart.Utilities.Core.isMobile,e._manuallyAddedFields=[],e._localizeInitialValues(),e.$.conditionsMenu.dropDownAppendTo=e.$.container,e.$.conditionsMenu.dataSource=e._groupOperationDescriptions,e._valueFlat=[],e._lastProcessedItemInCurrentGroup={parentId:null,id:null,position:null}}_applyValue(){const e=this;e._emptyElementsStructure(!0),e._validateValue(),e._convertValueToFlat(e.value),e._getFieldsFromValue(),e._mapFieldsToMenu(),e._validateValueByType(),e._generateHTMLStructureFromFlatValue(!0),e._restrictNesting(),e._validValue=e._getValidValue(),e._oldValueAsString=JSON.stringify(e._validValue)}_validateValueByType(){const e=this;if(!e._valueFlat||!e._valueFlat.length)return;const t=e._valueFlat;for(let i=0;i<t.length;i++){const a=t[i];if("condition"!==a.type)continue;const o=a.data[0];!o||a.data.length<3||(a.data[2]=e._validateStoredValue(a.data[2],o))}e._generateValue(!0)}_applyValidationOnInput(){const e=this,t=e._editor;if(!t||!e._editorIsOpen)return;const i=t.closest(".filter-builder-item"),a=t.closest(".smart-filter-group-condition");i&&i.classList.contains("smart-filter-value")&&(clearTimeout(e._valueValidationTimeout),e._valueValidationTimeout=setTimeout((()=>{const i=a.getAttribute("node-id"),o=e.value.toString();clearTimeout(e._valueValidationTimeout),e._closeEditor(),o===e.value.toString()&&e._generateValue();const r=e._getItemById(i);r&&(t.setAttribute("focus",""),e._openEditor(r.htmlNode.querySelector(".smart-filter-value"))),delete e._valueValidationTimeout}),e.validationTimeout))}_contentContainerChangeHandler(e){const t=this,i=e.type,a=e.target,o=t._editor,r=t._editorIsOpen,l=t.applyMode;if(e.stopPropagation(),"change"===i&&t.validateOnInput&&r&&a===o&&t._applyValidationOnInput(),"itemClick"===i&&a.value!==e.detail.label||"immediately"!==l||!r||!o||"immediately"===l&&a!==o)return;const n=t._editor.closest(".filter-builder-item");n.classList.contains("smart-filter-value")||(t._closeEditor(),t._handleAutoPrompt(n))}_handleAutoPrompt(e){const t=this;if(e&&t.autoPrompt&&"immediately"===t.applyMode&&!e.classList.contains("smart-filter-value")){const i=e.closest(".smart-filter-group-condition")||e.closest(".smart-filter-nested-operator")||e.closest(".smart-filter-group");if(!i)return;const a=t._getItemById(i.getAttribute("node-id")),o=i.querySelector(".smart-filter-value");if(!a||!o)return;t._clickHandlerFilterButton(e.classList,a.nodeId,o)}}_mapFieldsToMenu(){const e=this;(e.fields||e._valueFields)&&(e._fields=(e.fields||e._valueFields).concat(e._manuallyAddedFields).map((e=>({label:e.label,value:e.dataField,dataType:e.dataType,filterOperations:e.filterOperations,lookup:e.lookup}))))}_localizeInitialValues(){const e=this;e.$.queryLabel.innerHTML=e.localize("queryLabel"),e._addOptions=[{label:e.localize("addCondition"),value:"addCondition"},{label:e.localize("addGroup"),value:"addGroup"}],e._groupOperationDescriptions=[{label:e.localize("and"),value:"and"},{label:e.localize("or"),value:"or"}],e._defaultFilterOperationDescriptions=e._filterOperationDescriptions=[{label:e.localize("="),value:"=",custom:!1},{label:e.localize("<>"),value:"<>",custom:!1},{label:e.localize(">"),value:">",custom:!1},{label:e.localize(">="),value:">=",custom:!1},{label:e.localize("<"),value:"<",custom:!1},{label:e.localize("<="),value:"<=",custom:!1},{label:e.localize("startswith"),value:"startswith",custom:!1},{label:e.localize("endswith"),value:"endswith",custom:!1},{label:e.localize("contains"),value:"contains",custom:!1},{label:e.localize("notcontains"),value:"notcontains",custom:!1},{label:e.localize("isblank"),value:"isblank",custom:!1},{label:e.localize("isnotblank"),value:"isnotblank",custom:!1}];const t=Smart.Utilities.DateTime.getLocalizedNames(e.locale);e._localizedDays=t.days,e._localizedMonths=t.months}_handleCustomOperations(){const e=this;e._filterOperationDescriptions=e._defaultFilterOperationDescriptions.slice(0);for(let t=0;t<e.customOperations.length;t++){let i=e.customOperations[t],a=e._filterOperationDescriptions.findIndex((e=>e.value===i.name)),o={label:i.label,value:i.name,custom:!0,index:t,editorTemplate:i.editorTemplate,valueTemplate:i.valueTemplate,handleValue:i.handleValue,hideValue:i.hideValue,validateValue:i.validateValue};a>-1?e._filterOperationDescriptions[a]=o:e._filterOperationDescriptions.push(o)}}_editorsContainerKeydownHandler(e){const t=this;if(t._editorIsOpen&&("Escape"===e.key||"Enter"===e.key)){t._closeEditor();const e=t._editor.closest(".filter-builder-item");e&&!e.classList.contains("smart-filter-value")&&t._handleAutoPrompt(e)}}_editorsContainerKeyUpHandler(e){const t=this,i=t._editor;i&&i.contains(e.target)&&t._editorIsOpen&&t.validateOnInput&&t._applyValidationOnInput()}_documentDownHandler(e){const t=this,i=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(i.shadowParent&&i.shadowParent.closest(".smart-input-drop-down-menu")||i.closest(".smart-input-drop-down-menu")||t.$.conditionsMenu.contains(i))return;const a=i.closest(".smart-drop-down");if(i.getRootNode().host===t||i.closest("smart-query-builder")===t||a&&t.contains(a.ownerElement))if(t._isMobile){const i=t.$.scrollableContainer.scrollTop,a=t.getBoundingClientRect().top;setTimeout((function(){if(t.$.scrollableContainer.scrollTop===i&&t.getBoundingClientRect().top===a){const i=t.context;t.context=t,t._clickHandler(e.originalEvent),t.context=i}}),250)}else t._clickHandler(e.originalEvent);else t._editorIsOpen&&!t._scrollBarDown&&t._closeEditor(),delete t._scrollBarDown}_emptyElementsStructure(e){const t=this,i=t.$.contentContainer;for(;i.firstChild;)i.removeChild(i.firstChild);t._valueFlat=e?[]:t._valueFlat,t._lastProcessedItemInCurrentGroup={parentId:null,id:null,position:null}}_resizeHandler(){this.$.scrollableContainer.refresh()}_getTotalConditions(){return this.getElementsByClassName("smart-filter-group-condition").length}_parseLinqToValue(){const e=this,t=e._queryParser;t&&(t.customOperations=e.customOperations,t.fields=e.fields,t.dynamicField="dynamic"===e.fieldsMode?e.getDynamicField:void 0,e.set("value",t.toValue(e.value)))}_validateValue(){const e=this;"string"==typeof e.value&&e._parseLinqToValue();const t=e.properties.value.value;if(Array.isArray(t)&&""!==JSON.stringify(t).replace(/[\[\]]/g,"")){for(3===t.length&&"string"==typeof t[0]&&(e.value=[[t]]),Array.isArray(t[0])&&3===t[0].length&&"string"==typeof t[0][0]&&(e.value=[t]);"string"==typeof t[0];)t.shift();for(;"string"==typeof t[t.length-1];)t.pop();e.value.forEach((e=>{Array.isArray(e)&&0===e.length&&e.push([])}))}else e.value=[[[]]]}_convertValueToFlat(e){const t=this,i=["and","or","notAnd","notOr"];if(!e)return;let a=0,o=0;t._valueFlat=[],function e(r,l){let n;for(let s=0;s<r.length;s++){const d=r[s];let c={htmlNode:null};if("string"==typeof d&&(i.indexOf(d)>-1||t.customOperators[d]))n=(t.customOperators[d]||d).trim();else if(n=n||"and",Array.isArray(d)){let i=t._valueFlat.filter((e=>e.parentId+""==l+"")).length;if(d.find((e=>Array.isArray(e))))c.nodeId=(o+=1)+"",c.type="group",c.data=n,t._valueFlat.push(c),e(d,c.nodeId),n="";else{if(t.maxConditions&&a>=t.maxConditions||t.maxConditionsPerGroup&&i>=t.maxConditionsPerGroup)continue;0!==s&&(t._valueFlat.push({nodeId:l+"."+i,type:"operator",data:n,parentId:l+""}),n="",i++),c.nodeId=l+"."+i,c.parentId=l+"",c.type="condition",c.data=d,a++,t._valueFlat.push(c)}}}}(e,0),delete t._totalGroups}_getFieldsFromValue(){const e=this._valueFlat,t=[],i=[];for(let o=0;o<e.length;o++){const r=e[o];if("condition"===r.type){const e=r.data[0];if(e&&-1===t.indexOf(e)){const o={label:e,dataField:e,dataType:(a=r.data[2],"boolean"==typeof a?"boolean":a instanceof Date?a.getHours()>0||a.getMinutes()>0||a.getSeconds()>0?"dateTime":"date":isNaN(a)?"string":"number"),format:null};t.push(e),i.push(o)}}}var a;this._valueFields=i}_addElement(e,t,i,a){const o=this,r=o._valueFlat.filter((e=>e.parentId===t));let l=0,n="";if(i=i||("group"===e?"or":[]),r.length){let e=r.map((e=>{const t=e.nodeId.split(".");return parseInt(t[t.length-1])}));e=0===e.length?[0]:e,l=e.reduce(((e,t)=>Math.max(e,t)))+1}t&&t.length>0&&(n=".");let s=(t||"")+n+("group"===e?o._valueFlat.filter((e=>"group"===e.type)).length+1:l),d=r[0];if(r.length)for(let e=0;e<r.length;e++){const t=r[e],i=t.nodeId.split(".").pop();parseInt(i)>parseInt(d.nodeId.split(".").pop())&&(d=t)}else d=o._valueFlat.find((e=>e.nodeId===t));let c=d?o._valueFlat.indexOf(d)+1:o._valueFlat.length;"condition"===e&&r.length>0&&(o._valueFlat.splice(c,0,{nodeId:s,parentId:t,type:"operator",data:["and"],htmlNode:null}),s=(t||"")+n+(l+1),c++);const u={nodeId:s,parentId:t,type:e,data:i,htmlNode:null},p=o.autoPrompt;if("condition"===e&&p&&o._fields.length){const e=o._fields[0];if(e){const t=o._getFilterOperations(e);i[0]=e.value||e.label||"",t.length&&(i[1]=t[0].value)}}if(o._valueFlat.splice(c,0,u),"group"===e&&o._addElement("condition",s,[],!0),!a&&(o._refresh(),p&&u.htmlNode)){const e=u.htmlNode,t=e.querySelector(".smart-filter-value");t&&o._clickHandlerFilterButton(e.classList,u.nodeId,t)}}_deleteElement(e,t){const i=this,a="string"==typeof e?e:e.getAttribute("node-id");if(a&&1!==a.length&&("group"===t?l(a):r(a),!t||"condition"===t)){let e=a.split(".");if(e.pop(),e=e.join("."),!i._valueFlat.filter((t=>t.parentId===e)).length&&(i._valueFlat.filter((e=>"group"===e.type)).length>1&&l(e),"0"===e)){const e=i._valueFlat.find((e=>"group"===e.type)),t=e.nodeId;e.nodeId="0",e.htmlNode.setAttribute("node-id","0");const a=i._valueFlat.filter((e=>e.parentId===t));for(let e=0;e<a.length;e++){const t=a[e];t.parentId="0",t.nodeId="0."+e,t.htmlNode.setAttribute("node-id",t.nodeId)}}i._generateValue()}function o(e){const t=i._valueFlat[e];if(t&&"operator"===t.type)return i._valueFlat.splice(e,1),t.htmlNode.parentElement.removeChild(t.htmlNode),!0}function r(e){let t,a=0,r=e.split(".");r.pop(),r=r.join(".");for(let o=0;o<i._valueFlat.length;o++){const l=i._valueFlat[o];if("condition"===l.type){if(l.nodeId===e){t=l;break}l.parentId===r&&a++}}const l=i._valueFlat.indexOf(t);i._valueFlat.splice(l,1),t.htmlNode.parentElement.removeChild(t.htmlNode);const n=o(l-1);a||o(l-(n?1:0));const s=i._valueFlat.filter((e=>e.nodeId===r))[0].htmlNode;s.children[1].childElementCount>0&&s.children[2].hasAttribute("limit-selection")&&!s.children[1].lastElementChild.hasAttribute("limit-selection")&&s.children[2].removeAttribute("limit-selection")}function l(e){const t=i._valueFlat.filter((t=>e===t.nodeId&&"group"===t.type))[0];for(let t=0;t<i._valueFlat.length;t++){const a=i._valueFlat[t],o=a.nodeId;a.parentId===e&&("group"===a.type?l(o):r(o))}i._valueFlat.indexOf(t)>-1&&i._valueFlat.splice(i._valueFlat.indexOf(t),1),t.htmlNode.parentElement.removeChild(t.htmlNode)}}_generateHTMLStructureFromFlatValue(e){const t=this,i=document.createDocumentFragment();if(t._valueFlat&&0!==t._valueFlat.length){for(let e=0;e<t._valueFlat.length;e++){const a=t._valueFlat[e],o=!!t.customOperations&&t.customOperations.find((e=>e.name===a.data[1])),r=a.parentId?(t.shadowRoot||t).querySelector('[node-id="'+a.parentId+'"]').querySelector(".smart-filter-group-condition-container"):t.$.contentContainer;if("group"===a.type){const o=document.createElement("div"),r=t.localize(a.data)||"";o.className="smart-filter-group",o.innerHTML='<div class="smart-filter-group-operator" role="button" aria-expanded="false" aria-haspopup="menu">'+r+'</div><div class="smart-filter-group-condition-container" role="group"></div><div class="smart-filter-add-condition-btn" role="button" aria-label="Add condition"><div>'+t.localize("add")+'</div></div><div class="smart-filter-add-btn" role="button" aria-expanded="false" aria-haspopup="menu" aria-label="Add group"></div>',o.firstElementChild.data=r,i.appendChild(o),o.setAttribute("node-id",a.nodeId),t._valueFlat[e].htmlNode=o}else if("condition"===a.type){const r=t._newFilterConditionRow(a.data);if(r.setAttribute("node-id",a.nodeId),i.appendChild(r),t._valueFlat[e].htmlNode=r,void 0!==a.data[0]&&void 0===a.data[1]){const e=t._getFilterOperations(t._fields.find((e=>e.value===a.data[0])));t._handleOnlyOperation(e,a.data,r)}else(-1!==["isblank","isnotblank"].indexOf(a.data[1])||o&&o.hideValue)&&(a.data.splice(2,1),r.children[2].classList.add("smart-visibility-hidden"))}else{const o=document.createElement("div");o.className="smart-filter-nested-operator",o.setAttribute("node-id",a.nodeId),o.setAttribute("role","button"),o.setAttribute("aria-expanded",!1),o.setAttribute("aria-haspopup","menu"),o.innerHTML=t.localize(a.data),i.appendChild(o),t._valueFlat[e].htmlNode=o}r.appendChild(i)}e&&t._validateValueAdvanced(),t.$.scrollableContainer.refresh()}}_validateValueAdvanced(){const e=this,t=e.value;let i=!1,a=!1,o=0;for(let e=0;e<t.length;e++){const r=t[e];if("string"!=typeof r)for(let e=r.length-1;e>=0;e--){let t=r[e];if(Array.isArray(t)&&0===t.length&&e!==r.length-1)r.splice(e,1),0===e&&r.splice(0,1),i=!0;else if("string"==typeof t){t=t.toLowerCase(),o++,(o>1||"and"!==t&&"or"!==t)&&(a=!0);continue}o=0}}i&&(e._emptyElementsStructure(!0),e._convertValueToFlat(e.value),e._generateHTMLStructureFromFlatValue()),a&&e._generateValue(!0)}_restrictNesting(){Array.from(this.getElementsByClassName("smart-filter-add-condition-btn")).forEach((e=>{const t=e.previousElementSibling.lastElementChild;t&&t.hasAttribute("limit-selection")&&e.setAttribute("limit-selection","")}))}_clickHandler(e){const t=this,i=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(t.disabled||!i||!i.closest||!t._isMobile&&0!==e.button)return;if(t._scrollBarDown)return void delete t._scrollBarDown;const a=i.closest(".smart-drop-down"),o=t._editor&&t._editor.contains(i)||a&&(t._editor.contains(a.ownerElement)||t._editor===a.ownerElement)||i.closest(".smart-custom-editor");t._editor&&t._editorIsOpen&&!o&&t._closeEditor();const r=i.closest(".smart-filter-group-condition")||i.closest(".smart-filter-nested-operator")||i.closest(".smart-filter-group");if(!r)return;const l=t._getItemById(r.getAttribute("node-id"));if(!l)return;if(t.$.fireEvent("itemClick",{id:l.nodeId,type:l.type,data:l.data}),i.closest(".smart-filter-delete-btn"))return void t._clickHandlerDeleteButton(l.htmlNode);const n=i.closest(".smart-filter-add-btn")||i.closest(".smart-filter-add-condition-btn");if(n){const e=n.closest(".smart-filter-group").getAttribute("node-id");return void(n.classList.contains("smart-filter-add-condition-btn")&&(t.maxConditions&&t._getTotalConditions()<t.maxConditions||!t.maxConditions)?t._addElement("condition",e,[]):t._clickHandlerFilterButton(n.classList,l.nodeId,i))}const s=i.closest(".filter-builder-item")||i.closest(".smart-filter-group-operator")||i.closest(".smart-filter-nested-operator");if(s){const e=s.classList;t._clickHandlerFilterButton(e,l.nodeId,i)}}_downHandler(e){const t=this;if(!e.originalEvent||!t._isMobile&&0!==e.button)return;const i=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target,a=t.rightToLeft?e.pageX>i.getBoundingClientRect().right:e.pageX<i.getBoundingClientRect().left;if(t.allowDrag&&i.classList.contains("smart-filter-group-condition")&&a){const a=t._valueFlat.filter((e=>"condition"===e.type));if(1===a.length||2===a.length&&a[0].parentId===a[1].parentId&&a[1].htmlNode.hasAttribute("limit-selection"))return;return t._dragDetails={coords:{x:e.pageX,y:e.pageY},item:i,originalEvent:e},t.$.scrollableContainer._scrollView.disableSwipeScroll=!0,t._hoveredCondition=i,void window.getSelection().removeAllRanges()}this._scrollBarDown=i.closest("smart-scroll-bar"),e.stopPropagation(),e.preventDefault()}_scrollableContainerTouchmoveHandler(e){this._dragDetails&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_documentMoveHandler(e){const t=this,i=t._dragDetails;if(!i)return;const a=i.item;if(!i.feedbackShown){if(!(Math.abs(i.coords.x-e.pageX)>5||Math.abs(i.coords.y-e.pageY)>5))return;{const o=t._valueFlat.filter((e=>e.htmlNode===a))[0];if(t.$.fireEvent("dragStart",{data:o.data,item:a,originalEvent:e}).defaultPrevented)return delete t._dragDetails,delete t._hoveredCondition,void(t.$.scrollableContainer._scrollView.disableSwipeScroll=!1);i.allConditions=Array.from((t.shadowRoot||t).querySelectorAll(".smart-filter-group-condition")),i.data=o,i.feedback=t._addDragFeedback(),i.feedbackShown=!0,a.classList.add("dragged")}}const o=e.clientY;let r,l=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(t.$.fireEvent("dragging",{data:i.data,item:a,originalEvent:e}),t.setAttribute("dragging",""),i.feedback.style.left=e.pageX+10+"px",i.feedback.style.top=e.pageY+10+"px",t._isMobile){const i=t._hoveredCondition;i&&(i.classList.remove("drop-target","top","bottom"),delete t._hoveredCondition);const a=document.elementFromPoint(e.clientX,o);a&&(l=a)}let n,s=l.closest(".smart-filter-group-condition");if(s){r=s;const e=r.getBoundingClientRect(),t=Math.abs(o-e.top),i=Math.abs(o-e.bottom);n=t<i?"top":"bottom"}else{let e,t;i.allConditions.forEach((i=>{const a=i.getBoundingClientRect(),r=Math.abs(o-a.top),l=Math.abs(o-a.bottom),s=Math.min(r,l);(void 0===t||s<t)&&(e=i,t=s,n=r<l?"top":"bottom")})),s=e}if(s===a||s.hasAttribute("limit-selection")&&"bottom"===n)s=void 0;else{const e=Array.from(s.parentElement.getElementsByClassName("smart-filter-group-condition")),t=e.indexOf(a);-1!==t&&("top"===n&&s===e[t+1]||"bottom"===n&&s===e[t-1])&&(s=void 0)}if(r=s,i.side=n,clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const i=t.getBoundingClientRect();t.$.scrollableContainer.scrollHeight>0&&i.left<=e.clientX&&i.left+i.width>=e.clientX?o>=i.top&&o<=i.top+36?t.$.scrollableContainer.scrollTop-=t._autoScrollCoefficient:o>=i.top+i.height-36&&o<=i.top+i.height?t.$.scrollableContainer.scrollTop+=t._autoScrollCoefficient:clearInterval(t._dragInterval):clearInterval(t._dragInterval)}),1),r){t._hoveredCondition&&r!==t._hoveredCondition&&t._hoveredCondition.classList.remove("drop-target","top","bottom");const e=r.closest(".smart-filter-group");if(e&&e.hasAttribute("restricted"))return void(t._hoveredCondition=void 0);t._hoveredCondition=r,r.classList.remove("top","bottom"),r.classList.add(n,"drop-target")}else t._hoveredCondition&&(t._hoveredCondition.classList.remove("drop-target","top","bottom"),delete t._hoveredCondition)}_addDragFeedback(){const e=this,t=document.createElement("div");return e.rightToLeft?t.setAttribute("right-to-left",""):t.removeAttribute("right-to-left"),t.className="smart-query-builder-drag-feedback",e.theme&&t.setAttribute("theme",e.theme),document.body.appendChild(t),t}_documentUpHandler(e){const t=this,i=t._dragDetails;if(!i)return void(t.$.conditionsMenu.opened&&t._selectedElement&&!t._selectedElement.classList.contains("smart-filter-add-btn")&&t.$.conditionsMenu._hoverViaKeyboard(t.$.conditionsMenu.querySelector('smart-menu-item[value="'+t._editedItem.data+'"]')));const a=i.item,o=i.data,r=t._hoveredCondition;if(delete t._dragDetails,delete t._hoveredCondition,t.$.scrollableContainer._scrollView.disableSwipeScroll=!1,!t.hasAttribute("dragging"))return;if(clearInterval(t._dragInterval),window.getSelection().removeAllRanges(),t.removeAttribute("dragging"),a.classList.remove("dragged"),i.feedback.remove(),!r)return void t.$.fireEvent("dragEnd",{data:o.data,item:a,originalEvent:e,target:null,targetData:null,targetSide:null});const l=t._valueFlat.filter((e=>e.htmlNode===r))[0],n=t.$.fireEvent("dragEnd",{data:o.data,item:a,originalEvent:e,target:r,targetData:l.data,targetSide:i.side});if(r.classList.remove("drop-target","top","bottom"),n.defaultPrevented)return;const s=t.value,d=o.nodeId.split(".").map((e=>parseFloat(e))),c=s[2*(d[0]-1)],u=l.nodeId.split(".").map((e=>parseFloat(e))),p=s[2*(u[0]-1)];let m="and";c.length>1&&(0===d[1]?(m=c[1],c[1]="!remove!"):(m=c[d[1]-1],c[d[1]-1]="!remove!")),c[d[1]]="!remove!","top"===i.side?p.splice(u[1],0,o.data,m):p.splice(u[1]+1,0,m,o.data);for(let e=0;e<s.length;e++)Array.isArray(s[e])&&(s[e]=s[e].filter((e=>"!remove!"!==e)));for(let e=s.length-1;e>=0;e--)Array.isArray(s[e])&&0===s[e].length&&(0===e?s.splice(0,2):(s.splice(e-1,2),e--));t._emptyElementsStructure(!0),t._convertValueToFlat(s),t._generateHTMLStructureFromFlatValue(),t._validValue=t._getValidValue();const f=JSON.stringify(t._validValue);t._oldValueAsString!==f&&(t._oldValueAsString=f,t.$.fireEvent("change",{value:JSON.parse(f),linq:t._queryParser.toLinq(t._validValue)}))}_clickHandlerDeleteButton(e,t){const i=this;if(e&&e.classList){if(i._closeEditor(),1===i.getElementsByClassName("smart-filter-group-condition").length){const e=i._valueFlat[1].htmlNode.children;i.value=[[[]]],i._validValue=i._getValidValue(),i._valueFlat[1].data=[],i._valueFlat[1].htmlNode.setAttribute("limit-selection",""),e[0].setAttribute("placeholder",""),e[1].setAttribute("placeholder",""),e[2].setAttribute("placeholder",""),e[2].removeAttribute("invalid-value"),e[0].firstElementChild.innerHTML=i.propertyPlaceholder,e[1].firstElementChild.innerHTML=i.operatorPlaceholder,e[2].firstElementChild.innerHTML=i.valuePlaceholder;const t=JSON.stringify(i._validValue);return i._oldValueAsString!==t&&(i._oldValueAsString=t,i.$.fireEvent("change",{value:JSON.parse(t),linq:i._queryParser.toLinq(i._validValue)})),void i._restrictNesting()}if(e.classList.contains("smart-filter-group")){if(t&&i._valueFlat.filter((t=>t.parentId===e.getAttribute("node-id"))).length>0)return;i._deleteElement(e,"group")}else i._deleteElement(e);i._generateValue(),i.$.scrollableContainer.refresh(),Array.from(i.$.contentContainer.children).forEach(((e,t)=>{const a=(t+1).toString();e.setAttribute("node-id",a),i._valueFlat.filter((t=>t.htmlNode===e))[0].nodeId=a,Array.from(e.children[1].children).forEach(((e,t)=>{const o=i._valueFlat.filter((t=>t.htmlNode===e))[0],r=a+"."+t;e.setAttribute("node-id",r),o.parentId=a,o.nodeId=r}))}))}}_menuCloseHandler(){const e=this.$.conditionsMenu.controlledBy;e.setAttribute("aria-expanded",!1),e.removeAttribute("aria-controls"),delete this.$.conditionsMenu.controlledBy}_menuClosingHandler(e){const t=e.detail;"interaction"===t.trigger&&this._selectedElement===t.target&&e.preventDefault()}_menuItemClickHandler(e){const t=this,i=t._selectedElement.closest(".smart-filter-group-operator, .smart-filter-nested-operator"),a=e.detail,o=a.value;let r;if(i){i.innerHTML=t.localize(o)||a.label,i.value=o,r=i.classList.contains("smart-filter-nested-operator")?i.getAttribute("node-id"):i.parentElement.getAttribute("node-id");for(let e=0;e<t._valueFlat.length;e++)if(t._valueFlat[e].nodeId===r){t._valueFlat[e].data=i.value;break}t._generateValue()}else r=t._selectedElement.parentElement.getAttribute("node-id"),t._addElement("group",null,o);t.$.scrollableContainer.refresh()}_newFilterConditionRow(e=[]){const t=this,i=e[0];let a,o=t._fields.find((e=>e.value===i)),r=o?o.label:void 0;void 0===i||!r&&"static"===t.fieldsMode?e.length=0:(r||(o=t._getDynamicFieldInfo(i),r=o.label,e[0]=o.dataField),a=t._getFilterOperations(o).find((t=>t.value===e[1])),a&&(a=a.label));const l=t._formatValueStringRepresentation(e[2],e),n=t._validateValueField(void 0,e[1],e[2]);let s=document.createElement("div"),d="condition"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),c='<div class="filter-builder-item smart-filter-field-name" id="'+d+'Field" '+(r?'><div class="smart-value-container" role="presentation">'+r:'placeholder><div class="smart-value-container" role="presentation">'+t.propertyPlaceholder)+'</div></div><div class="filter-builder-item smart-filter-operation" id="'+d+'Operation" '+(a?'><div class="smart-value-container" role="presentation">'+a:'placeholder><div class="smart-value-container" role="presentation">'+t.operatorPlaceholder)+'</div></div><div class="filter-builder-item smart-filter-value" id="'+d+'Value" '+(n?"":"invalid-value")+(void 0!==e[2]?'><div class="smart-value-container" role="presentation">'+l:'placeholder><div class="smart-value-container" role="presentation">'+t.valuePlaceholder)+'</div></div><div class="smart-filter-delete-btn" role="button" aria-label="Close"></div>';return s.className="smart-filter-group-condition",s.setAttribute("role","group"),s.innerHTML=c,t._setAriaLabel(s),e.length||s.setAttribute("limit-selection",""),s}_setAriaLabel(e){const t=[];for(let i=0;i<e.children.length-1;i++){const a=e.children[i];a.classList.contains("smart-visibility-hidden")||a.hasAttribute("placeholder")||t.push(e.children[i].innerText)}0!==t.length?e.setAttribute("aria-label",t.join(" ")):e.setAttribute("aria-label","Empty condition row")}_formatValueStringRepresentation(e,t){const i=this,a=t[2],o=t[0],r=i._getFieldByFieldName(o);let l,n=t[1];if(!r||!r.dataType)return e;if(null==e)return i.valuePlaceholder;if(void 0!==n&&i.customOperations&&i.customOperations.length>0&&(n=i.customOperations.find((e=>e.name===n)),n&&n.valueTemplate))return"<span>"+n.valueTemplate(i._editor,e)+"</span>";switch(r.dataType.toLowerCase()){case"date":case"datetime":(e=e instanceof Date||"string"==typeof e||"number"==typeof e&&!isNaN(e)?new Smart.Utilities.DateTime(e):e).calendar.days=i._localizedDays,e.calendar.months=i._localizedMonths,e.calendar.locale=i.locale,l=e.toString("date"===r.dataType?i.formatStringDate:i.formatStringDateTime);break;case"array":l="string"==typeof e?e.split(","):e;break;case"object":l="string"==typeof e?e:JSON.stringify(e);break;case"number":l=e;break;case"boolean":l=!!e;break;default:l=e+""}if(!i.valueFormatFunction)return"<span>"+l+"</span>";const s={label:l,value:a,dataField:o,dataType:r.dataType||"string"};return"<span>"+i.valueFormatFunction(s)+"</span>"}_getFieldByFieldName(e){return Object.assign({},this._fields.find((t=>t.value===e)))}_refresh(){const e=this;e._generateValue(),e._emptyElementsStructure(),e._generateHTMLStructureFromFlatValue(),e._restrictNesting()}_generateValue(e){const t=this;let i=[],a=t._valueFlat.slice(0),o=[];for(let e=0;e<a.length;e++){const t=a[e];let o={};"group"===t.type&&(o.nodeId=t.nodeId,o.parentId=t.parentId,o.data=t.data,o.structure=[],i.push(o))}for(let e=0;e<i.length;e++){const t=i[e];for(let e=0;e<a.length;e++){const i=a[e];if(i.parentId===t.nodeId&&"condition"===i.type){const o=a[e-1];o&&o.parentId===t.nodeId&&"operator"===o.type&&t.structure.push(o.data.toString()),t.structure.push(i.data)}}}i=i.filter((e=>e.structure.length>0)),i.sort((function(e,t){return t.nodeId.split(".").length-e.nodeId.split(".").length}));for(let e=0;e<i.length;e++){const t=i[e],a=i.filter((e=>e.nodeId===t.parentId))[0];a&&a.structure?a.structure.push(t.structure):"0"!==t.nodeId?t.data&&(e>0&&o.push(t.data),o.push(t.structure)):o=o.concat(t.structure)}if(t.set("value",o),t._validateValue(),t._validValue=t._getValidValue(),t._updateValidationStatus(),!e){const e=JSON.stringify(t._validValue);t._oldValueAsString!==e&&(t._oldValueAsString=e,t.$.fireEvent("change",{value:JSON.parse(e),linq:t._queryParser.toLinq(t._validValue)}))}}_updateValidationStatus(){const e=this,t=e.customOperations.filter((e=>"function"==typeof e.validateValue)),i=e._valueFlat,a=!!e._validationStatus;let o=!0;for(let e=0,a=i.length;e<a;e+=1){const a=i[e];if("condition"!==a.type)continue;const r=a.data[1],l=t.find((e=>e.name===r));if(l&&0==!!l.validateValue(a.data[2])){o=!1;break}}if(e._validationStatus!==o){const t=void 0!==e._validationStatus;e._validationStatus=o,t&&e.$.fireEvent("validationChange",{oldValue:a,newValue:o})}}_getItemById(e,t){const i=this._valueFlat.filter((i=>t?i.parentId===e:i.nodeId===e));return i.length>0?i[0]:null}_validateStoredValue(e,t){const i=this;if(!t&&!i._editedItem)return e;if(!t&&!(t=i._editedItem.data[0]))return e;const a=i._getFieldByFieldName(t).dataType;if(void 0===a)return e+"";switch(a.toLowerCase()){case"date":case"datetime":e=new Smart.Utilities.DateTime(e).toDate();break;case"number":"number"!=typeof e&&(e=parseFloat(e));break;case"boolean":"boolean"!=typeof e&&(e=!!e);break;case"object":"object"!=typeof e&&(e={});break;case"array":Array.isArray(e)||(e=[e]);break;default:"string"!=typeof e&&(e+="")}return e}_closeEditor(e){const t=this;let i;if(!t._editedItem||!t._editorIsOpen)return;const a=t._editedItem,o=t._editor.closest(".filter-builder-item"),r=o.querySelector(".smart-value-container"),l=o.parentElement,n=l.children[2];if(t._editor===t.$.dateTimePickerEditor)t._editor._inputChangeHandler(),i=t._editor.value,i&&(i=i.toDate());else if(t._editor===t.$.checkBoxEditor)i=t._editor.checked;else if(t._editor===t.$.customEditor)t._editor&&Array.from(t._editor.getElementsByTagName("smart-numeric-text-box")).forEach((e=>e._inputBlurHandler())),i=t._validateStoredValue(t._selectedCustomCondition.handleValue(t._editor));else if(t._editor===t.$.numericTextBoxEditor)t._editor._inputBlurHandler(),i=t._editor.value;else if(o.classList.contains("smart-filter-value")){const e=t._getFieldByFieldName(t._editedItem.data[0]);if("array"===e.dataType)i=t._editor.value.split(",");else if("object"===e.dataType)i=JSON.parse(t._editor.value);else{const a=t._editor.value;i=e.lookup&&e.lookup.dataSource?{label:a,value:t._editor.dataset.value||a}:a}}else i=t._editor.value;if(o.classList.contains("smart-filter-field-name")){if(""===i.trim())return void t._hideEditor(o,void 0===a.data[0]);l.hasAttribute("limit-selection")&&(l.removeAttribute("limit-selection"),l.parentElement.nextElementSibling.removeAttribute("limit-selection"));const e=t._fields.find((e=>e.label===i)),s=a.data[0];if(e)a.data[0]=e.value;else{if("dynamic"!==t.fieldsMode){const e=t._fields.find((e=>e.value===s));return e&&(r.innerHTML=e.label),void t._hideEditor(o)}{const e=t._getDynamicFieldInfo(i);i=e.label,a.data[0]=e.dataField}}r.innerHTML=i,t._handleFieldChange([s,a.data[0]],[n,a,l])}else if(o.classList.contains("smart-filter-operation"))t._handleOperationChange([a,i,t._editor.$.input.dataValue],[r,n]);else{let e,o;"object"==typeof i&&void 0!==i.value?(e=i.label,o=i.value,void 0===e&&(e=o)):e=o=i,a.data[2]=o,r.innerHTML=t._formatValueStringRepresentation(e,a.data)}t._validateValueField(n,a.data[1],a.data[2]),t._generateValue(e),t._hideEditor(o)}_validateValueField(e,t,i){const a=this.customOperations;let o=!0;if(e&&e.removeAttribute("invalid-value"),a&&a.length>0){const r=a.find((e=>e.name===t));r&&"function"==typeof r.validateValue&&(o=!!r.validateValue(i),!o&&e&&e.setAttribute("invalid-value",""))}return o}_getDynamicFieldInfo(e){const t=this,i={label:e,dataField:e,dataType:"string"};if(t.getDynamicField){const a=t.getDynamicField(e);a.label&&(i.label=a.label),a.dataField&&(i.dataField=a.dataField),a.dataType&&(i.dataType=a.dataType),a.filterOperations&&Array.isArray(a.filterOperations)&&a.filterOperations.length>0&&(i.filterOperations=a.filterOperations),a.lookup&&(i.lookup=a.lookup)}return t._manuallyAddedFields.push(i),t._mapFieldsToMenu(),i}_handleFieldChange(e,t){const i=this,a=e[0],o=t[1],r=t[2],l=t[0],n=i._fields.find((t=>t.value===e[1])),s=i._getFilterOperations(n),d=function(){n.value!==a&&i.$.fireEvent("propertySelected",{label:n.label,value:n.value})};if(!a||void 0===o.data[1])return i._handleOnlyOperation(s,o.data,r),void d();const c=i._fields.find((e=>e.value===a)),u=c.dataType,p=n.dataType;if(n!==c&&(p!==u||"enum"===p||n.filterOperations||c.filterOperations)){if(s.find((e=>e.value===o.data[1]))){if(p===u&&"enum"!==p)return;return"date"===p&&"dateTime"===u||"dateTime"===p&&"date"===u?(l.firstElementChild.innerHTML=i._formatValueStringRepresentation(o.data),void d()):(o.data.splice(2,1),l.setAttribute("placeholder",""),l.firstElementChild.innerHTML=i.valuePlaceholder,void d())}o.data.splice(1,2),r.children[1].setAttribute("placeholder",""),r.children[1].firstElementChild.innerHTML=i.operatorPlaceholder,l.setAttribute("placeholder",""),l.firstElementChild.innerHTML=i.valuePlaceholder,l.classList.remove("smart-visibility-hidden"),i._handleOnlyOperation(s,o.data,r),d()}}_handleOnlyOperation(e,t,i){const a=this.autoPrompt;if(1===e.length||a&&"immediately"===this.applyMode&&e.length>1){const a=e[0];t[1]=a.value,i.children[1].removeAttribute("placeholder",""),i.children[1].firstElementChild.innerHTML=e[0].label,("isblank"===a.value||"isnotblank"===a.value||a.custom&&a.hideValue)&&(t.splice(2,1),i.children[2].classList.add("smart-visibility-hidden"))}}_handleOperationChange(e,t){const i=this,a=e[0],o=e[1],r=e[2],l=t[0],n=t[1],s=void 0!==a.data[1]?i._filterOperationDescriptions.find((e=>e.value===a.data[1])):void 0,d=i._filterOperationDescriptions.find((e=>e.value===r));if(!d||d===s)return;const c=d.value;a.data[1]=c;const u=a.data[0],p=a.data[1],m=a.data[2];if(l.innerHTML=o,"isblank"===c||"isnotblank"===c||d.custom&&d.hideValue)a.data.splice(2,1),n.classList.add("smart-visibility-hidden");else if(n.classList.contains("smart-visibility-hidden"))n.setAttribute("placeholder",""),n.classList.remove("smart-visibility-hidden"),n.firstElementChild.innerHTML=i.valuePlaceholder;else if(d.custom){const e=i._getFieldByFieldName(u);if(d.editorTemplate){const t=d.editorTemplate(e.dataType,p,e);t&&(i.$.customEditor.innerHTML="",i.$.customEditor.appendChild(t))}d.valueTemplate?n.firstElementChild.innerHTML=d.valueTemplate(i.$.customEditor,m):void 0===m?(n.setAttribute("placeholder",""),n.firstElementChild.innerHTML=i.valuePlaceholder):n.firstElementChild.innerHTML=m}else void 0===m?(a.data.splice(2,1),n.setAttribute("placeholder",""),n.firstElementChild.innerHTML=i.valuePlaceholder):d.custom||(n.firstElementChild.innerHTML=i._formatValueStringRepresentation(m,a.data))}_hideEditor(e,t){const i=this;t&&e.setAttribute("placeholder",""),e.removeAttribute("edited"),i.$.editorsContainer.removeAttribute("open"),i._editor.close&&i._editor.close(),i._editor.classList.add("smart-hidden"),i._editorIsOpen=i._enterIsPressedInEditor=!1,i.$.scrollableContainer.refresh(),i._setAriaLabel(e.parentElement)}_clickHandlerFilterButton(e,t,i){const a=this;function o(e,t,i){a._contextMenuOptions=0===t.length?a._defaultFilterOperationDescriptions:t,a._handleContextMenu(e),a.$.conditionsMenu.opened&&(a.$.conditionsMenu._discardKeyboardHover(),a.$.conditionsMenu._hoverViaKeyboard(a.$.conditionsMenu.querySelector('smart-menu-item[value="'+i+'"]')))}i.closest(".smart-editors-container")||(a._closeEditor(),a._editedItem=a._getItemById(t),e.contains("smart-filter-add-btn")?o(i,a._groupOperationDescriptions):(e.contains("smart-filter-field-name")||a._editedItem.data&&a._editedItem.data.length)&&(e.contains("smart-filter-group-operator")||e.contains("smart-filter-nested-operator")?o(i,a._groupOperationDescriptions,a._editedItem.data):(i.closest(".filter-builder-item").removeAttribute("placeholder"),a._openEditor(i))))}_handleContextMenu(e){const t=this;if(t._selectedElement===e&&t.$.conditionsMenu.opened)return void t.$.conditionsMenu.close();if(t._closeEditor(),t.disableContextMenu)return void(t._selectedElement=e);const i=e.getBoundingClientRect(),a=t.getBoundingClientRect(),o=i.left+t.$.contentContainer.scrollLeft-a.left,r=i.top+t.$.contentContainer.scrollTop-a.top+i.height;e.hasAttribute("aria-haspopup")&&(t.$.conditionsMenu.controlledBy&&(t.$.conditionsMenu.controlledBy.setAttribute("aria-expanded",!1),t.$.conditionsMenu.controlledBy.removeAttribute("aria-controls")),e.setAttribute("aria-controls",t.$.conditionsMenu.id),e.setAttribute("aria-expanded",!0),t.$.conditionsMenu.controlledBy=e),t.$.conditionsMenu.dataSource=t._contextMenuOptions,t.$.conditionsMenu.open(o,r+3),t._selectedElement=e,t.$.scrollableContainer.refresh()}_openEditor(e){const t=this,i=e&&e.closest(".smart-filter-group-condition")?e.closest(".smart-filter-group-condition").getAttribute("node-id"):null,a=e.closest(".filter-builder-item"),o=t._getItemById(i);let r="";void 0!==o.data[0]?r=o.data[0]:t._fields.length&&(r=t._fields[0].value);let l,n,s=t._getFieldByFieldName(r),d="";if(a.classList.contains("smart-filter-field-name"))n=0,t._fields||t._mapFieldsToMenu(),s.lookup={dataSource:t._fields.slice(),readonly:!1},d=s.label||"",l=s.value;else if(a.classList.contains("smart-filter-operation")){n=1;let e=t._getFilterOperations(s);s.lookup={dataSource:e,readonly:!0};let i=e.find((e=>e.value===o.data[n]))||e[0];d=i.label,l=i.value}else n=2,d=o.data[n],void 0===d&&(d="");t._editorIsOpen&&t._closeEditor(),a.setAttribute("edited",""),t._editedItem=o;const c=t._fields.filter((e=>e.value===r)),u=t._filterOperationDescriptions.filter((e=>e.value===o.data[1]&&e.custom)),p=c.length>0?c[0]:null,m=s.lookup&&s.lookup.dataSource?"lookup":p?p.dataType:void 0;if(2===n&&0!==u.length&&u[0].editorTemplate?(t._selectedCustomCondition=u[0],t._openCustomEditor(m,d,s)):t._openEditorByFieldType(m,d,s,l),a.appendChild(t.$.editorsContainer),t._editor.classList.remove("smart-hidden"),t._editorIsOpen=!0,t.$.editorsContainer.setAttribute("open",""),t.$.scrollableContainer.refresh(),t._editor.classList.contains("smart-custom-editor")){const e=t.customOperations[t._selectedCustomCondition.index].onEditorOpen;e&&e(t._editor)}else requestAnimationFrame((()=>t._editor.focus()));s.lookup&&!t._valueValidationTimeout&&t._editor.open()}_getFilterOperations(e){const t=this;let i=t._filterOperationDescriptions.slice();if(e.filterOperations)i=t._filterOperationDescriptions.filter((t=>e.filterOperations.indexOf(t.value)>-1));else{let a;switch(e.dataType){case"date":case"dateTime":case"number":a=["=","<>","<",">","<=",">=","isblank","isnotblank"];break;case"boolean":a=["=","<>","isblank","isnotblank"];break;case"object":a=["isblank","isnotblank"];break;case"string":a=["contains","notcontains","startswith","endswith","=","<>","isblank","isnotblank"];break;default:a=["contains","notcontains","startswith","endswith","=","<>","<",">","<=",">=","isblank","isnotblank"]}i=t._filterOperationDescriptions.filter((e=>a.indexOf(e.value)>-1))}return t.showIcons&&i.map((e=>e.icon=t.icons[e.value])),i}_openCustomEditor(e,t,i){const a=this,o=a.customOperations[a._selectedCustomCondition.index].editorTemplate(e,t,i);a.$.customEditor.innerHTML="",o&&a.$.customEditor.appendChild(o),a._editor=a.$.customEditor}_openEditorByFieldType(e,t,i,a){const o=this;if(e)switch(e.toLowerCase()){case"boolean":return o._initializeEditor("checkBox"),void(o._editor.checked=!!t);case"date":case"datetime":return o._initializeEditor("dateTimePicker"),o._editor.formatString="date"===e?o.formatStringDate:o.formatStringDateTime,void(o._editor.value=t);case"number":return o._initializeEditor("numericTextBox"),void(o._editor.value=t||0)}if(o._initializeEditor("input"),o._editor.dropDownWidth=o.dropDownWidth,"lookup"===e){const a=i.lookup.minLength,r=i.lookup.dataSource;if(o._editor.autoCompleteDelay=i.lookup.autoCompleteDelay||100,o._editor.dropDownAppendTo=o.$.container,o._editor.dropDownButtonPosition=o.rightToLeft?"left":"right",o._editor.minLength=isNaN(a)||null===a?1:a,o._editor.readonly=!!i.lookup.readonly,"function"==typeof r?o._editor.dataSource=r:r instanceof Promise?r.then((e=>{if(!(o._editor instanceof Smart.Input))return;const i=o._editor.opened;o._editor.dataSource=e,e.length<12?o._editor.dropDownHeight="auto":o._editor.dropDownHeight=200,i&&(o._editor.open(),""===t&&o._editor.readonly&&e.length&&(o._editor.value=e[0].label||e[0]))})):(o._editor.dataSource=r,r.length<12?o._editor.dropDownHeight="auto":o._editor.dropDownHeight=200),"object"===e)t=JSON.stringify(t||{});else if(""===t&&o._editor.readonly){const e=o._editor.dataSource;if(Array.isArray(e)){const i=e[0];t=i&&(i.value||i.label)||""}else t=""}if(o._editor.isRendered){const e=o._editor.$.input.dataValue;null!=e&&e===t||(o._editor.value=void 0!==t?t+"":"")}else o._editor.value=void 0!==t?t+"":""}else o._editor.dataSource=[],o._editor.dropDownButtonPosition="none",o._editor.readonly=!1,o._editor.value=void 0!==t?t+"":"";a&&"object"!==e&&o._editor.isRendered&&(o._editor.$.input.dataValue=a)}_initializeEditor(e){const t=this;if(t.$[e+"Editor"])return void(t._editor=t.$[e+"Editor"]);const i=document.createElement("smart-"+Smart.Utilities.Core.toDash(e));"numericTextBox"===e?(i.spinButtons=!0,i.inputFormat="floatingPoint"):"dateTimePicker"===e&&(i.dropDownAppendTo=t.$.container,i.calendarButton=!0,i.dropDownDisplayMode="auto",i.enableMouseWheelAction=!0,i.locale=t.locale,i.autoClose=!0,i.messages[t.locale]||(i.messages[t.locale]={}),i.messages[t.locale].dateTabLabel=t.localize("dateTabLabel"),i.messages[t.locale].timeTabLabel=t.localize("timeTabLabel")),i.rightToLeft=t.rightToLeft,i.theme=t.theme,i.animation=t.animation,i.$.addClass("smart-hidden underlined"),t.$.editorsContainer.appendChild(i),t._editor=t.$[e+"Editor"]=i}_getValidValue(){const e=this,t=e.properties.value.value,i=[];let a=!1;return t.forEach((t=>{if(Array.isArray(t)){let o=!1,r=!1;const l=[];t.forEach((t=>{if(Array.isArray(t)){const i=t[0],a=t[1],n=t[2];if(void 0===i||void 0===a)return void(r=!0);if(void 0!==n||"isblank"===a||"isnotblank"===a)return o=!0,void l.push(t);const s=e._filterOperationDescriptions.find((e=>e.value===a));s.custom&&s.hideValue?(o=!0,l.push(t)):r=!0}else r?r=!1:l.push(t)})),o?("string"==typeof l[l.length-1]&&l.pop(),i.push(l)):a=!0}else a?a=!1:i.push(t)})),"string"==typeof i[i.length-1]&&i.pop(),i}}),Smart.Utilities.Assign("QueryParser",class{constructor(e,t,i){const a=this;a.customOperations=t||[],a.fields=e||[],a.dynamicField=i}toLinq(e){return Array.isArray(e)&&this._arePropertiesValid()?this._parseQueryToLinq(e):""}toValue(e){return"string"==typeof e&&this._arePropertiesValid()?this._parseLinqToValue(e):[]}_arePropertiesValid(){return Array.isArray(this.customOperations)?!!Array.isArray(this.fields)||(console.log('Invalid "fields" property.'),!1):(console.log('Invalid "customOperations" property.'),!1)}_parseQueryToLinq(e){const t=this,i={and:"&&",or:"||"};let a="";for(let o=0;o<e.length;o++){const r=e[o];if(Array.isArray(r))if(r.indexOf("and")>-1||r.indexOf("or")>-1||1===r.length&&Array.isArray(r[0])){const e=t._parseQueryToLinq(r);e?a+=r.length>1?"("+e+")":e:/\s(&|\|){2}\s$/gm.test(a)&&(a=a.replace(/\s(&|\|){2}\s$/gm,""))}else a+=t._getExpressionFromQuery(r)||"";else a&&(a+=" "+i[r]+" ")}return a}_getExpressionFromQuery(e){const t=e[0],i=e[1];let a=e[2];const o=this.customOperations.find((e=>e.name===i));return o&&o.expressionTemplate?("string"==typeof a&&a.includes('"')&&o.expressionTemplate.includes('"')&&(a=JSON.stringify(a).slice(1,-1)),o.expressionBuilderCallback?o.expressionBuilderCallback(t,i,a):o.expressionTemplate.replace("{0}",t).replace("{1}",a)):""}_parseLinqToValue(e){const t=this;let i,a=0,o=[];for(let t=0;t<e.length;t++)if("("===e[t])a++,void 0===i&&(i=t);else if(")"===e[t]&&a>0&&(a--,0===a)){let a=e.substring(i,t+1).trim();a.length&&(a.includes("&&")||a.includes("||"))&&o.push({expr:a}),i=void 0}let r,l=[];if(o.length)for(let i=0;i<o.length;i++){let a;o[i].query=t._getQueryFromExpression(o[i].expr),a=r?e.substring(e.indexOf(r)+r.length,e.indexOf(o[i].expr)).trim():e.substring(0,e.indexOf(o[i].expr)).trim(),a&&l.push(a),r=o[i].expr}r?l.push(e.substring(e.indexOf(r)+r.length).trim()):l.push(e.trim());for(let e=0;e<l.length;e++){const i=l[e].replace(/^&{2}|^\|{2}|&{2}$|\|{2}$/gm,"").trim();i.length&&o.push({expr:i,query:t._getQueryFromExpression(i),outher:!0})}return t._constructValueFromQueries(e,o)}_getQueryFromExpression(e){const t=this,i=t.fields,a=t.dynamicField;let o=[],r=e;const l=function(e){let r=[];const l=t.customOperations.filter((e=>e.expressionTemplate));l.sort(((e,t)=>t.expressionTemplate.length-e.expressionTemplate.length));for(let t=0;t<l.length;t++){const i=l[t],a=new RegExp(i.expressionTemplate.replace(/\(/gm,"\\(").replace(/\)/gm,"\\)").replace(/\[/gm,"\\[").replace(/\]/gm,"\\]").replace(/"{\d+}"/gm,'\\W*"([^"]*)[^a-zA-Z0-9-\\s\\)]+').replace(/{\d+}/gm,"([@|$]*\\w+[.]*\\w+(?!\\s)*)\\s{0}").replace(/ /gm,"\\s"),"gm");if(a.test(e)){a.lastIndex=0;let t,o,l=a.exec(e);if(l=l.filter(((e,t)=>l.indexOf(e)===t)),i.expressionReaderCallback){let e=i.expressionReaderCallback(l[0],l.slice(1));e&&(t=e.fieldName,o=e.value)}void 0===t&&(t=l[1]||""),void 0===o&&(o=l[2]||""),r.push({operator:i.name,field:t,value:o,query:l[0]})}}let n=r.find((e=>i.find((t=>t.filterOperations.indexOf(e.operator)>-1&&t.dataField===e.field))));if(!n&&a)for(let e=0;e<r.length;e++){const t=r[e],i=a(t.field);if(i&&Array.isArray(i.filterOperations)&&i.filterOperations.indexOf(t.operator)>-1){n=t;break}}if(n)return o.push({expr:n.query,query:[n.field,n.operator,n.value]}),n.query};if(r){for(;r.length;){r&&(r=r.trim(),"("===r[0]&&")"===r[r.length-1]&&(r=r.trim().replace(/^\(|\)$/gm,"")),r=r.replace(/^&{2}|^\|{2}|&{2}$|\|{2}$/gm,"").trim());const e=l(r);if(!e)break;r=r.replace(e,"").trim()}return t._constructValueFromQueries(e,o)}}_constructValueFromQueries(e,t){let i=[];t.sort(((t,i)=>e.indexOf(t.expr)-e.indexOf(i.expr)));for(let a=0;a<t.length;a++){let o=t[a-1];if(o){const r=e.substring(e.indexOf(o.expr)+o.expr.length,e.indexOf(t[a].expr)).trim();i.push("||"===r?"or":"and")}t[a].outher?t[a].query.forEach((e=>i.push(Array.isArray(e)?[e]:e))):i.push(t[a].query)}return i}});
|
|
1400
|
+
Smart("smart-query-builder",class extends Smart.BaseElement{static get properties(){return{allowDrag:{value:!1,type:"boolean"},autoPrompt:{value:!1,type:"boolean"},applyMode:{allowValues:["immediately","change"],value:"change",type:"string"},customOperations:{value:[],type:"array",reflectToAttribute:!1},customOperators:{value:{},type:"object",reflectToAttribute:!1},dropDownWidth:{type:"any",value:"auto"},fields:{value:null,type:"array?",reflectToAttribute:!1},fieldsMode:{value:"dynamic",allowedValues:["dynamic","static"],type:"string"},formatStringDate:{value:"dd-MMM-yy",type:"string"},formatStringDateTime:{value:"dd-MMM-yy HH:mm:ss",type:"string"},getDynamicField:{value:null,type:"function?"},icons:{value:{"=":"equals","<>":"notequals",">":"greaterthan",">=":"greaterthanorequal","<":"lessthan","<=":"lessthanorequal",startswith:"startswith",endswith:"endswith",contains:"contains",notcontains:"notcontains",isblank:"isblank",isnotblank:"isnotblank"},type:"object",reflectToAttribute:!1},messages:{value:{en:{add:"Add",addCondition:"Add Condition",addGroup:"Add Group",and:"And",notand:"Not And",or:"Or",notor:"Not Or","=":"Equals","<>":"Does not equal",">":"Greater than",">=":"Greater than or equal to","<":"Less than","<=":"Less than or equal to",startswith:"Starts with",endswith:"Ends with",contains:"Contains",notcontains:"Does not contain",isblank:"Is blank",isnotblank:"Is not blank",wrongParentGroupIndex:'{{elementType}}: Wrong parent group index in "{{method}}" method.',wrongElementNode:'{{elementType}}: Incorect node / node Id in "{{method}}" method.',invalidDataStructure:"{{elementType}}: Used invalid data structure in updateCondition/updateGroup method.",dateTabLabel:"DATE",timeTabLabel:"TIME",queryLabel:"Query"}},type:"object",extend:!0},operatorPlaceholder:{value:"Operator",type:"string"},propertyPlaceholder:{value:"Property",type:"string"},showIcons:{value:!1,type:"boolean"},showFieldNameArrow:{value:!1,type:"boolean"},validateOnInput:{value:!1,type:"boolean"},validationTimeout:{value:100,type:"number"},value:{value:[],type:"any",reflectToAttribute:!1},valueFormatFunction:{value:null,type:"function?",reflectToAttribute:!1},valuePlaceholder:{value:"Value",type:"string"}}}static get requires(){const e={"Smart.Button":"smart.button.js","Smart.Calendar":"smart.calendar.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.DropDownList":"smart.dropdownlist.js","Smart.Input":"smart.input.js","Smart.ListBox":"smart.listbox.js","Smart.Menu":"smart.menu.js","Smart.NumericTextBox":"smart.numerictextbox.js","Smart.ScrollBar":"smart.scrollbar.js","Smart.TimePicker":"smart.timepicker.js","Smart.Tooltip":"smart.tooltip.js","Smart.Utilities.BigNumber":"smart.math.js","Smart.Utilities.DateTime":"smart.date.js","Smart.Utilities.Draw":"smart.draw.js","Smart.Utilities.NumericProcessor":"smart.numeric.js"};return window.NIComplex||(e["Smart.Utilities.Complex"]="smart.complex.js"),e}static get listeners(){return{down:"_downHandler",resize:"_resizeHandler","editorsContainer.keydown":"_editorsContainerKeydownHandler","editorsContainer.keyup":"_editorsContainerKeyUpHandler","conditionsMenu.close":"_menuCloseHandler","conditionsMenu.closing":"_menuClosingHandler","conditionsMenu.itemClick":"_menuItemClickHandler","contentContainer.change":"_contentContainerChangeHandler","contentContainer.itemClick":"_contentContainerChangeHandler","scrollableContainer.touchmove":"_scrollableContainerTouchmoveHandler","document.down":"_documentDownHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler"}}static get styleUrls(){return["smart.querybuilder.css"]}template(){return'<div id="container" role="presentation">\n <smart-scroll-viewer id="scrollableContainer" class="smart-scrollable-container" animation="[[animation]]" right-to-left="[[rightToLeft]]">\n <div id="queryLabel" class="smart-query-builder-label smart-unselectable"></div>\n <div id="contentContainer" class="smart-content-container"></div>\n </smart-scroll-viewer>\n <div id="editorsContainer" class="smart-editors-container" role="presentation">\n <div id="customEditor" class="smart-custom-editor smart-hidden"></div>\n </div>\n <smart-menu id="conditionsMenu" mode="dropDown" class="smart-conditions-menu" theme="[[theme]]" animation="[[animation]]" right-to-left="[[rightToLeft]]"></smart-menu>\n </div>'}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const i=this;switch(e){case"animation":case"theme":["textBoxEditor","numericTextBoxEditor","comboBoxEditor","dateTimePickerEditor","checkBoxEditor"].forEach((t=>i.$[t]&&(i.$[t][e]=a)));break;case"formatStringDate":case"formatStringDateTime":case"valueFormatFunction":i._refresh();break;case"operatorPlaceholder":Array.from((i.shadowRoot||i).querySelectorAll(".smart-filter-operation[placeholder]")).forEach((e=>e.firstElementChild.innerHTML=a));break;case"propertyPlaceholder":Array.from((i.shadowRoot||i).querySelectorAll(".smart-filter-field-name[placeholder]")).forEach((e=>e.firstElementChild.innerHTML=a));break;case"showIcons":i._closeEditor(),a?i._filterOperationDescriptions.map((e=>e.icon=i.icons[e.value])):i._filterOperationDescriptions.map((e=>delete e.icon));break;case"customOperations":case"fields":case"value":{const t=JSON.stringify(i._validValue),o=i._queryParser;"customOperations"===e?i._handleCustomOperations():""===e&&i._mapFieldsToMenu(),i._applyValue(),"customOperations"!==e&&"fields"!==e||(o[e]=a),i._oldValueAsString!==t&&(i._oldValueAsString=JSON.stringify(i._validValue),i.$.fireEvent("change",{value:JSON.parse(i._oldValueAsString),linq:o.toLinq(i._validValue)}));break}case"valuePlaceholder":Array.from((i.shadowRoot||i).querySelectorAll(".smart-filter-value[placeholder]")).forEach((e=>e.firstElementChild.innerHTML=a));break;case"locale":case"messages":i._localizeInitialValues(),i._refresh(),i._handleCustomOperations(),i.$.dateTimePickerEditor&&(i.$.dateTimePickerEditor.messages[i.locale]||(i.$.dateTimePickerEditor.messages[i.locale]={}),i.$.dateTimePickerEditor.messages[i.locale].dateTabLabel=i.localize("dateTabLabel"),i.$.dateTimePickerEditor.messages[i.locale].timeTabLabel=i.localize("timeTabLabel"),"locale"===e?i.$.dateTimePickerEditor.locale=i.locale:"messages"===e&&(i.$.dateTimePickerEditor.$.selectDate.innerHTML=i.$.dateTimePickerEditor.messages[i.locale].dateTabLabel,i.$.dateTimePickerEditor.$.selectTime.innerHTML=i.$.dateTimePickerEditor.messages[i.locale].timeTabLabel));break;case"icons":i._closeEditor()}}ready(){super.ready();const e=this;e.$.queryLabel.id||(e.$.queryLabel.id=e.id+"Label"),e.setAttribute("role","dialog"),e.setAttribute("aria-labelledby",e.$.queryLabel.id),-1!==navigator.platform.toLowerCase().lastIndexOf("mac")&&e.$.contentContainer.classList.add("mac"),e._queryParser=new Smart.Utilities.QueryParser,e._setInitialValues(),e._handleCustomOperations(),e._applyValue(),Object.defineProperty(e,"value",{get:function(){return e.context===e?e.properties.value.value:e._validValue},set(t){e.updateProperty(e,e._properties.value,t)}})}getLinq(){const e=this;if(e._validValue)return e._queryParser.customOperations=e.customOperations,e._queryParser.fields=e.fields,e._queryParser.dynamicField="dynamic"===e.fieldsMode?e.getDynamicField:void 0,e._queryParser.toLinq(e._validValue)}get validationStatus(){const e=this;return!e.isReady||void 0===e._validationStatus||e._validationStatus}_setInitialValues(){const e=this;e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._isMobile=Smart.Utilities.Core.isMobile,e._manuallyAddedFields=[],e._localizeInitialValues(),e.$.conditionsMenu.dropDownAppendTo=e.$.container,e.$.conditionsMenu.dataSource=e._groupOperationDescriptions,e._valueFlat=[],e._lastProcessedItemInCurrentGroup={parentId:null,id:null,position:null}}_applyValue(){const e=this;e._emptyElementsStructure(!0),e._validateValue(),e._convertValueToFlat(e.value),e._getFieldsFromValue(),e._mapFieldsToMenu(),e._validateValueByType(),e._generateHTMLStructureFromFlatValue(!0),e._restrictNesting(),e._validValue=e._getValidValue(),e._oldValueAsString=JSON.stringify(e._validValue)}_validateValueByType(){const e=this;if(!e._valueFlat||!e._valueFlat.length)return;const t=e._valueFlat;for(let a=0;a<t.length;a++){const i=t[a];if("condition"!==i.type)continue;const o=i.data[0];!o||i.data.length<3||(i.data[2]=e._validateStoredValue(i.data[2],o))}e._generateValue(!0)}_applyValidationOnInput(){const e=this,t=e._editor;if(!t||!e._editorIsOpen)return;const a=t.closest(".filter-builder-item"),i=t.closest(".smart-filter-group-condition");a&&a.classList.contains("smart-filter-value")&&(clearTimeout(e._valueValidationTimeout),e._valueValidationTimeout=setTimeout((()=>{const a=i.getAttribute("node-id"),o=e.value.toString();clearTimeout(e._valueValidationTimeout),e._closeEditor(),o===e.value.toString()&&e._generateValue();const l=e._getItemById(a);l&&(t.setAttribute("focus",""),e._openEditor(l.htmlNode.querySelector(".smart-filter-value"))),delete e._valueValidationTimeout}),e.validationTimeout))}_contentContainerChangeHandler(e){const t=this,a=e.type,i=e.target,o=t._editor,l=t._editorIsOpen,r=t.applyMode;if(e.stopPropagation(),"change"===a&&t.validateOnInput&&l&&i===o&&t._applyValidationOnInput(),"itemClick"===a&&i.value!==e.detail.label||"immediately"!==r||!l||!o||"immediately"===r&&i!==o)return;const n=t._editor.closest(".filter-builder-item");n.classList.contains("smart-filter-value")||(t._closeEditor(),t._handleAutoPrompt(n))}_handleAutoPrompt(e){const t=this;if(e&&t.autoPrompt&&"immediately"===t.applyMode&&!e.classList.contains("smart-filter-value")){const a=e.closest(".smart-filter-group-condition")||e.closest(".smart-filter-nested-operator")||e.closest(".smart-filter-group");if(!a)return;const i=t._getItemById(a.getAttribute("node-id")),o=a.querySelector(".smart-filter-value");if(!i||!o)return;t._clickHandlerFilterButton(e.classList,i.nodeId,o)}}_mapFieldsToMenu(){const e=this;(e.fields||e._valueFields)&&(e._fields=(e.fields||e._valueFields).concat(e._manuallyAddedFields).map((e=>({label:e.label,value:e.dataField,dataType:e.dataType,filterOperations:e.filterOperations,lookup:e.lookup}))))}_localizeInitialValues(){const e=this;e.$.queryLabel.innerHTML=e.localize("queryLabel"),e._addOptions=[{label:e.localize("addCondition"),value:"addCondition"},{label:e.localize("addGroup"),value:"addGroup"}],e._groupOperationDescriptions=[{label:e.localize("and"),value:"and"},{label:e.localize("or"),value:"or"}],e._defaultFilterOperationDescriptions=e._filterOperationDescriptions=[{label:e.localize("="),value:"=",custom:!1},{label:e.localize("<>"),value:"<>",custom:!1},{label:e.localize(">"),value:">",custom:!1},{label:e.localize(">="),value:">=",custom:!1},{label:e.localize("<"),value:"<",custom:!1},{label:e.localize("<="),value:"<=",custom:!1},{label:e.localize("startswith"),value:"startswith",custom:!1},{label:e.localize("endswith"),value:"endswith",custom:!1},{label:e.localize("contains"),value:"contains",custom:!1},{label:e.localize("notcontains"),value:"notcontains",custom:!1},{label:e.localize("isblank"),value:"isblank",custom:!1},{label:e.localize("isnotblank"),value:"isnotblank",custom:!1}];const t=Smart.Utilities.DateTime.getLocalizedNames(e.locale);e._localizedDays=t.days,e._localizedMonths=t.months}_handleCustomOperations(){const e=this;e._filterOperationDescriptions=e._defaultFilterOperationDescriptions.slice(0);for(let t=0;t<e.customOperations.length;t++){let a=e.customOperations[t],i=e._filterOperationDescriptions.findIndex((e=>e.value===a.name)),o={label:a.label,value:a.name,custom:!0,index:t,editorTemplate:a.editorTemplate,valueTemplate:a.valueTemplate,handleValue:a.handleValue,hideValue:a.hideValue,validateValue:a.validateValue};i>-1?e._filterOperationDescriptions[i]=o:e._filterOperationDescriptions.push(o)}}_editorsContainerKeydownHandler(e){const t=this;if(t._editorIsOpen&&("Escape"===e.key||"Enter"===e.key)){t._closeEditor();const e=t._editor.closest(".filter-builder-item");e&&!e.classList.contains("smart-filter-value")&&t._handleAutoPrompt(e)}}_editorsContainerKeyUpHandler(e){const t=this,a=t._editor;a&&a.contains(e.target)&&t._editorIsOpen&&t.validateOnInput&&t._applyValidationOnInput()}_documentDownHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(a.shadowParent&&a.shadowParent.closest(".smart-input-drop-down-menu")||a.closest(".smart-input-drop-down-menu")||t.$.conditionsMenu.contains(a))return;const i=a.closest(".smart-drop-down");if(a.getRootNode().host===t||a.closest("smart-query-builder")===t||i&&t.contains(i.ownerElement))if(t._isMobile){const a=t.$.scrollableContainer.scrollTop,i=t.getBoundingClientRect().top;setTimeout((function(){if(t.$.scrollableContainer.scrollTop===a&&t.getBoundingClientRect().top===i){const a=t.context;t.context=t,t._clickHandler(e.originalEvent),t.context=a}}),250)}else t._clickHandler(e.originalEvent);else t._editorIsOpen&&!t._scrollBarDown&&t._closeEditor(),delete t._scrollBarDown}_emptyElementsStructure(e){const t=this,a=t.$.contentContainer;for(;a.firstChild;)a.removeChild(a.firstChild);t._valueFlat=e?[]:t._valueFlat,t._lastProcessedItemInCurrentGroup={parentId:null,id:null,position:null}}_resizeHandler(){this.$.scrollableContainer.refresh()}_getTotalConditions(){return this.getElementsByClassName("smart-filter-group-condition").length}_parseLinqToValue(){const e=this,t=e._queryParser;t&&(t.customOperations=e.customOperations,t.fields=e.fields,t.dynamicField="dynamic"===e.fieldsMode?e.getDynamicField:void 0,e.set("value",t.toValue(e.value)))}_validateValue(){const e=this;"string"==typeof e.value&&e._parseLinqToValue();const t=e.properties.value.value;if(Array.isArray(t)&&""!==JSON.stringify(t).replace(/[\[\]]/g,"")){for(3===t.length&&"string"==typeof t[0]&&(e.value=[[t]]),Array.isArray(t[0])&&3===t[0].length&&"string"==typeof t[0][0]&&(e.value=[t]);"string"==typeof t[0];)t.shift();for(;"string"==typeof t[t.length-1];)t.pop();e.value.forEach((e=>{Array.isArray(e)&&0===e.length&&e.push([])}))}else e.value=[[[]]]}_convertValueToFlat(e){const t=this,a=["and","or","notAnd","notOr"];if(!e)return;let i=0,o=0;t._valueFlat=[],function e(l,r){let n;for(let s=0;s<l.length;s++){const d=l[s];let c={htmlNode:null};if("string"==typeof d&&(a.indexOf(d)>-1||t.customOperators[d]))n=(t.customOperators[d]||d).trim();else if(n=n||"and",Array.isArray(d)){let a=t._valueFlat.filter((e=>e.parentId+""==r+"")).length;if(d.find((e=>Array.isArray(e))))c.nodeId=(o+=1)+"",c.type="group",c.data=n,t._valueFlat.push(c),e(d,c.nodeId),n="";else{if(t.maxConditions&&i>=t.maxConditions||t.maxConditionsPerGroup&&a>=t.maxConditionsPerGroup)continue;0!==s&&(t._valueFlat.push({nodeId:r+"."+a,type:"operator",data:n,parentId:r+""}),n="",a++),c.nodeId=r+"."+a,c.parentId=r+"",c.type="condition",c.data=d,i++,t._valueFlat.push(c)}}}}(e,0),delete t._totalGroups}_getFieldsFromValue(){const e=this._valueFlat,t=[],a=[];for(let o=0;o<e.length;o++){const l=e[o];if("condition"===l.type){const e=l.data[0];if(e&&-1===t.indexOf(e)){const o={label:e,dataField:e,dataType:(i=l.data[2],"boolean"==typeof i?"boolean":i instanceof Date?i.getHours()>0||i.getMinutes()>0||i.getSeconds()>0?"dateTime":"date":isNaN(i)?"string":"number"),format:null};t.push(e),a.push(o)}}}var i;this._valueFields=a}_addElement(e,t,a,i){const o=this,l=o._valueFlat.filter((e=>e.parentId===t));let r=0,n="";if(a=a||("group"===e?"or":[]),l.length){let e=l.map((e=>{const t=e.nodeId.split(".");return parseInt(t[t.length-1])}));e=0===e.length?[0]:e,r=e.reduce(((e,t)=>Math.max(e,t)))+1}t&&t.length>0&&(n=".");let s=(t||"")+n+("group"===e?o._valueFlat.filter((e=>"group"===e.type)).length+1:r),d=l[0];if(l.length)for(let e=0;e<l.length;e++){const t=l[e],a=t.nodeId.split(".").pop();parseInt(a)>parseInt(d.nodeId.split(".").pop())&&(d=t)}else d=o._valueFlat.find((e=>e.nodeId===t));let c=d?o._valueFlat.indexOf(d)+1:o._valueFlat.length;"condition"===e&&l.length>0&&(o._valueFlat.splice(c,0,{nodeId:s,parentId:t,type:"operator",data:["and"],htmlNode:null}),s=(t||"")+n+(r+1),c++);const u={nodeId:s,parentId:t,type:e,data:a,htmlNode:null},p=o.autoPrompt;if("condition"===e&&p&&o._fields.length){const e=o._fields[0];if(e){const t=o._getFilterOperations(e);a[0]=e.value||e.label||"",t.length&&(a[1]=t[0].value)}}if(o._valueFlat.splice(c,0,u),"group"===e&&o._addElement("condition",s,[],!0),!i&&(o._refresh(),p&&u.htmlNode)){const e=u.htmlNode,t=e.querySelector(".smart-filter-value");t&&o._clickHandlerFilterButton(e.classList,u.nodeId,t)}}_deleteElement(e,t){const a=this,i="string"==typeof e?e:e.getAttribute("node-id");if(i&&1!==i.length&&("group"===t?r(i):l(i),!t||"condition"===t)){let e=i.split(".");if(e.pop(),e=e.join("."),!a._valueFlat.filter((t=>t.parentId===e)).length&&(a._valueFlat.filter((e=>"group"===e.type)).length>1&&r(e),"0"===e)){const e=a._valueFlat.find((e=>"group"===e.type)),t=e.nodeId;e.nodeId="0",e.htmlNode.setAttribute("node-id","0");const i=a._valueFlat.filter((e=>e.parentId===t));for(let e=0;e<i.length;e++){const t=i[e];t.parentId="0",t.nodeId="0."+e,t.htmlNode.setAttribute("node-id",t.nodeId)}}a._generateValue()}function o(e){const t=a._valueFlat[e];if(t&&"operator"===t.type)return a._valueFlat.splice(e,1),t.htmlNode.parentElement.removeChild(t.htmlNode),!0}function l(e){let t,i=0,l=e.split(".");l.pop(),l=l.join(".");for(let o=0;o<a._valueFlat.length;o++){const r=a._valueFlat[o];if("condition"===r.type){if(r.nodeId===e){t=r;break}r.parentId===l&&i++}}const r=a._valueFlat.indexOf(t);a._valueFlat.splice(r,1),t.htmlNode.parentElement.removeChild(t.htmlNode);const n=o(r-1);i||o(r-(n?1:0));const s=a._valueFlat.filter((e=>e.nodeId===l))[0].htmlNode;s.children[1].childElementCount>0&&s.children[2].hasAttribute("limit-selection")&&!s.children[1].lastElementChild.hasAttribute("limit-selection")&&s.children[2].removeAttribute("limit-selection")}function r(e){const t=a._valueFlat.filter((t=>e===t.nodeId&&"group"===t.type))[0];for(let t=0;t<a._valueFlat.length;t++){const i=a._valueFlat[t],o=i.nodeId;i.parentId===e&&("group"===i.type?r(o):l(o))}a._valueFlat.indexOf(t)>-1&&a._valueFlat.splice(a._valueFlat.indexOf(t),1),t.htmlNode.parentElement.removeChild(t.htmlNode)}}_generateHTMLStructureFromFlatValue(e){const t=this,a=document.createDocumentFragment();if(t._valueFlat&&0!==t._valueFlat.length){for(let e=0;e<t._valueFlat.length;e++){const i=t._valueFlat[e],o=!!t.customOperations&&t.customOperations.find((e=>e.name===i.data[1])),l=i.parentId?(t.shadowRoot||t).querySelector('[node-id="'+i.parentId+'"]').querySelector(".smart-filter-group-condition-container"):t.$.contentContainer;if("group"===i.type){const o=document.createElement("div"),l=t.localize(i.data)||"";o.className="smart-filter-group",o.innerHTML='<div class="smart-filter-group-operator" role="button" aria-expanded="false" aria-haspopup="menu">'+l+'</div><div class="smart-filter-group-condition-container" role="group"></div><div class="smart-filter-add-condition-btn" role="button" aria-label="Add condition"><div>'+t.localize("add")+'</div></div><div class="smart-filter-add-btn" role="button" aria-expanded="false" aria-haspopup="menu" aria-label="Add group"></div>',o.firstElementChild.data=l,a.appendChild(o),o.setAttribute("node-id",i.nodeId),t._valueFlat[e].htmlNode=o}else if("condition"===i.type){const l=t._newFilterConditionRow(i.data);if(l.setAttribute("node-id",i.nodeId),a.appendChild(l),t._valueFlat[e].htmlNode=l,void 0!==i.data[0]&&void 0===i.data[1]){const e=t._getFilterOperations(t._fields.find((e=>e.value===i.data[0])));t._handleOnlyOperation(e,i.data,l)}else(-1!==["isblank","isnotblank"].indexOf(i.data[1])||o&&o.hideValue)&&(i.data.splice(2,1),l.children[2].classList.add("smart-visibility-hidden"))}else{const o=document.createElement("div");o.className="smart-filter-nested-operator",o.setAttribute("node-id",i.nodeId),o.setAttribute("role","button"),o.setAttribute("aria-expanded",!1),o.setAttribute("aria-haspopup","menu"),o.innerHTML=t.localize(i.data),a.appendChild(o),t._valueFlat[e].htmlNode=o}l.appendChild(a)}e&&t._validateValueAdvanced(),t.$.scrollableContainer.refresh()}}_validateValueAdvanced(){const e=this,t=e.value;let a=!1,i=!1,o=0;for(let e=0;e<t.length;e++){const l=t[e];if("string"!=typeof l)for(let e=l.length-1;e>=0;e--){let t=l[e];if(Array.isArray(t)&&0===t.length&&e!==l.length-1)l.splice(e,1),0===e&&l.splice(0,1),a=!0;else if("string"==typeof t){t=t.toLowerCase(),o++,(o>1||"and"!==t&&"or"!==t)&&(i=!0);continue}o=0}}a&&(e._emptyElementsStructure(!0),e._convertValueToFlat(e.value),e._generateHTMLStructureFromFlatValue()),i&&e._generateValue(!0)}_restrictNesting(){Array.from(this.getElementsByClassName("smart-filter-add-condition-btn")).forEach((e=>{const t=e.previousElementSibling.lastElementChild;t&&t.hasAttribute("limit-selection")&&e.setAttribute("limit-selection","")}))}_clickHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(t.disabled||!a||!a.closest||!t._isMobile&&0!==e.button)return;if(t._scrollBarDown)return void delete t._scrollBarDown;const i=a.closest(".smart-drop-down"),o=t._editor&&t._editor.contains(a)||i&&(t._editor.contains(i.ownerElement)||t._editor===i.ownerElement)||a.closest(".smart-custom-editor");t._editor&&t._editorIsOpen&&!o&&t._closeEditor();const l=a.closest(".smart-filter-group-condition")||a.closest(".smart-filter-nested-operator")||a.closest(".smart-filter-group");if(!l)return;const r=t._getItemById(l.getAttribute("node-id"));if(!r)return;if(t.$.fireEvent("itemClick",{id:r.nodeId,type:r.type,data:r.data}),a.closest(".smart-filter-delete-btn"))return void t._clickHandlerDeleteButton(r.htmlNode);const n=a.closest(".smart-filter-add-btn")||a.closest(".smart-filter-add-condition-btn");if(n){const e=n.closest(".smart-filter-group").getAttribute("node-id");return void(n.classList.contains("smart-filter-add-condition-btn")&&(t.maxConditions&&t._getTotalConditions()<t.maxConditions||!t.maxConditions)?t._addElement("condition",e,[]):t._clickHandlerFilterButton(n.classList,r.nodeId,a))}const s=a.closest(".filter-builder-item")||a.closest(".smart-filter-group-operator")||a.closest(".smart-filter-nested-operator");if(s){const e=s.classList;t._clickHandlerFilterButton(e,r.nodeId,a)}}_downHandler(e){const t=this;if(!e.originalEvent||!t._isMobile&&0!==e.button)return;const a=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target,i=t.rightToLeft?e.pageX>a.getBoundingClientRect().right:e.pageX<a.getBoundingClientRect().left;if(t.allowDrag&&a.classList.contains("smart-filter-group-condition")&&i){const i=t._valueFlat.filter((e=>"condition"===e.type));if(1===i.length||2===i.length&&i[0].parentId===i[1].parentId&&i[1].htmlNode.hasAttribute("limit-selection"))return;return t._dragDetails={coords:{x:e.pageX,y:e.pageY},item:a,originalEvent:e},t.$.scrollableContainer._scrollView.disableSwipeScroll=!0,t._hoveredCondition=a,void window.getSelection().removeAllRanges()}this._scrollBarDown=a.closest("smart-scroll-bar"),e.stopPropagation(),e.preventDefault()}_scrollableContainerTouchmoveHandler(e){this._dragDetails&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_documentMoveHandler(e){const t=this,a=t._dragDetails;if(!a)return;const i=a.item;if(!a.feedbackShown){if(!(Math.abs(a.coords.x-e.pageX)>5||Math.abs(a.coords.y-e.pageY)>5))return;{const o=t._valueFlat.filter((e=>e.htmlNode===i))[0];if(t.$.fireEvent("dragStart",{data:o.data,item:i,originalEvent:e}).defaultPrevented)return delete t._dragDetails,delete t._hoveredCondition,void(t.$.scrollableContainer._scrollView.disableSwipeScroll=!1);a.allConditions=Array.from((t.shadowRoot||t).querySelectorAll(".smart-filter-group-condition")),a.data=o,a.feedback=t._addDragFeedback(),a.feedbackShown=!0,i.classList.add("dragged")}}const o=e.clientY;let l,r=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(t.$.fireEvent("dragging",{data:a.data,item:i,originalEvent:e}),t.setAttribute("dragging",""),a.feedback.style.left=e.pageX+10+"px",a.feedback.style.top=e.pageY+10+"px",t._isMobile){const a=t._hoveredCondition;a&&(a.classList.remove("drop-target","top","bottom"),delete t._hoveredCondition);const i=document.elementFromPoint(e.clientX,o);i&&(r=i)}let n,s=r.closest(".smart-filter-group-condition");if(s){l=s;const e=l.getBoundingClientRect(),t=Math.abs(o-e.top),a=Math.abs(o-e.bottom);n=t<a?"top":"bottom"}else{let e,t;a.allConditions.forEach((a=>{const i=a.getBoundingClientRect(),l=Math.abs(o-i.top),r=Math.abs(o-i.bottom),s=Math.min(l,r);(void 0===t||s<t)&&(e=a,t=s,n=l<r?"top":"bottom")})),s=e}if(s===i||s.hasAttribute("limit-selection")&&"bottom"===n)s=void 0;else{const e=Array.from(s.parentElement.getElementsByClassName("smart-filter-group-condition")),t=e.indexOf(i);-1!==t&&("top"===n&&s===e[t+1]||"bottom"===n&&s===e[t-1])&&(s=void 0)}if(l=s,a.side=n,clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const a=t.getBoundingClientRect();t.$.scrollableContainer.scrollHeight>0&&a.left<=e.clientX&&a.left+a.width>=e.clientX?o>=a.top&&o<=a.top+36?t.$.scrollableContainer.scrollTop-=t._autoScrollCoefficient:o>=a.top+a.height-36&&o<=a.top+a.height?t.$.scrollableContainer.scrollTop+=t._autoScrollCoefficient:clearInterval(t._dragInterval):clearInterval(t._dragInterval)}),1),l){t._hoveredCondition&&l!==t._hoveredCondition&&t._hoveredCondition.classList.remove("drop-target","top","bottom");const e=l.closest(".smart-filter-group");if(e&&e.hasAttribute("restricted"))return void(t._hoveredCondition=void 0);t._hoveredCondition=l,l.classList.remove("top","bottom"),l.classList.add(n,"drop-target")}else t._hoveredCondition&&(t._hoveredCondition.classList.remove("drop-target","top","bottom"),delete t._hoveredCondition)}_addDragFeedback(){const e=this,t=document.createElement("div");return e.rightToLeft?t.setAttribute("right-to-left",""):t.removeAttribute("right-to-left"),t.className="smart-query-builder-drag-feedback",e.theme&&t.setAttribute("theme",e.theme),document.body.appendChild(t),t}_documentUpHandler(e){const t=this,a=t._dragDetails;if(!a)return void(t.$.conditionsMenu.opened&&t._selectedElement&&!t._selectedElement.classList.contains("smart-filter-add-btn")&&t.$.conditionsMenu._hoverViaKeyboard(t.$.conditionsMenu.querySelector('smart-menu-item[value="'+t._editedItem.data+'"]')));const i=a.item,o=a.data,l=t._hoveredCondition;if(delete t._dragDetails,delete t._hoveredCondition,t.$.scrollableContainer._scrollView.disableSwipeScroll=!1,!t.hasAttribute("dragging"))return;if(clearInterval(t._dragInterval),window.getSelection().removeAllRanges(),t.removeAttribute("dragging"),i.classList.remove("dragged"),a.feedback.remove(),!l)return void t.$.fireEvent("dragEnd",{data:o.data,item:i,originalEvent:e,target:null,targetData:null,targetSide:null});const r=t._valueFlat.filter((e=>e.htmlNode===l))[0],n=t.$.fireEvent("dragEnd",{data:o.data,item:i,originalEvent:e,target:l,targetData:r.data,targetSide:a.side});if(l.classList.remove("drop-target","top","bottom"),n.defaultPrevented)return;const s=t.value,d=o.nodeId.split(".").map((e=>parseFloat(e))),c=s[2*(d[0]-1)],u=r.nodeId.split(".").map((e=>parseFloat(e))),p=s[2*(u[0]-1)];let m="and";c.length>1&&(0===d[1]?(m=c[1],c[1]="!remove!"):(m=c[d[1]-1],c[d[1]-1]="!remove!")),c[d[1]]="!remove!","top"===a.side?p.splice(u[1],0,o.data,m):p.splice(u[1]+1,0,m,o.data);for(let e=0;e<s.length;e++)Array.isArray(s[e])&&(s[e]=s[e].filter((e=>"!remove!"!==e)));for(let e=s.length-1;e>=0;e--)Array.isArray(s[e])&&0===s[e].length&&(0===e?s.splice(0,2):(s.splice(e-1,2),e--));t._emptyElementsStructure(!0),t._convertValueToFlat(s),t._generateHTMLStructureFromFlatValue(),t._validValue=t._getValidValue();const f=JSON.stringify(t._validValue);t._oldValueAsString!==f&&(t._oldValueAsString=f,t.$.fireEvent("change",{value:JSON.parse(f),linq:t._queryParser.toLinq(t._validValue)}))}_clickHandlerDeleteButton(e,t){const a=this;if(e&&e.classList){if(a._closeEditor(),1===a.getElementsByClassName("smart-filter-group-condition").length){const e=a._valueFlat[1].htmlNode.children;a.value=[[[]]],a._validValue=a._getValidValue(),a._valueFlat[1].data=[],a._valueFlat[1].htmlNode.setAttribute("limit-selection",""),e[0].setAttribute("placeholder",""),e[1].setAttribute("placeholder",""),e[2].setAttribute("placeholder",""),e[2].removeAttribute("invalid-value"),e[0].firstElementChild.innerHTML=a.propertyPlaceholder,e[1].firstElementChild.innerHTML=a.operatorPlaceholder,e[2].firstElementChild.innerHTML=a.valuePlaceholder;const t=JSON.stringify(a._validValue);return a._oldValueAsString!==t&&(a._oldValueAsString=t,a.$.fireEvent("change",{value:JSON.parse(t),linq:a._queryParser.toLinq(a._validValue)})),void a._restrictNesting()}if(e.classList.contains("smart-filter-group")){if(t&&a._valueFlat.filter((t=>t.parentId===e.getAttribute("node-id"))).length>0)return;a._deleteElement(e,"group")}else a._deleteElement(e);a._generateValue(),a.$.scrollableContainer.refresh(),Array.from(a.$.contentContainer.children).forEach(((e,t)=>{const i=(t+1).toString();e.setAttribute("node-id",i),a._valueFlat.filter((t=>t.htmlNode===e))[0].nodeId=i,Array.from(e.children[1].children).forEach(((e,t)=>{const o=a._valueFlat.filter((t=>t.htmlNode===e))[0],l=i+"."+t;e.setAttribute("node-id",l),o.parentId=i,o.nodeId=l}))}))}}_menuCloseHandler(){const e=this.$.conditionsMenu.controlledBy;e.setAttribute("aria-expanded",!1),e.removeAttribute("aria-controls"),delete this.$.conditionsMenu.controlledBy}_menuClosingHandler(e){const t=e.detail;"interaction"===t.trigger&&this._selectedElement===t.target&&e.preventDefault()}_menuItemClickHandler(e){const t=this,a=t._selectedElement.closest(".smart-filter-group-operator, .smart-filter-nested-operator"),i=e.detail,o=i.value;let l;if(a){a.innerHTML=t.localize(o)||i.label,a.value=o,l=a.classList.contains("smart-filter-nested-operator")?a.getAttribute("node-id"):a.parentElement.getAttribute("node-id");for(let e=0;e<t._valueFlat.length;e++)if(t._valueFlat[e].nodeId===l){t._valueFlat[e].data=a.value;break}t._generateValue()}else l=t._selectedElement.parentElement.getAttribute("node-id"),t._addElement("group",null,o);t.$.scrollableContainer.refresh()}_newFilterConditionRow(e=[]){const t=this,a=e[0];let i,o=t._fields.find((e=>e.value===a)),l=o?o.label:void 0;void 0===a||!l&&"static"===t.fieldsMode?e.length=0:(l||(o=t._getDynamicFieldInfo(a),l=o.label,e[0]=o.dataField),i=t._getFilterOperations(o).find((t=>t.value===e[1])),i&&(i=i.label));const r=t._formatValueStringRepresentation(e[2],e),n=t._validateValueField(void 0,e[1],e[2]);let s=document.createElement("div"),d="condition"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),c='<div class="filter-builder-item smart-filter-field-name" id="'+d+'Field" '+(l?'><div class="smart-value-container" role="presentation">'+l:'placeholder><div class="smart-value-container" role="presentation">'+t.propertyPlaceholder)+'</div></div><div class="filter-builder-item smart-filter-operation" id="'+d+'Operation" '+(i?'><div class="smart-value-container" role="presentation">'+i:'placeholder><div class="smart-value-container" role="presentation">'+t.operatorPlaceholder)+'</div></div><div class="filter-builder-item smart-filter-value" id="'+d+'Value" '+(n?"":"invalid-value")+(void 0!==e[2]?'><div class="smart-value-container" role="presentation">'+r:'placeholder><div class="smart-value-container" role="presentation">'+t.valuePlaceholder)+'</div></div><div class="smart-filter-delete-btn" role="button" aria-label="Close"></div>';return s.className="smart-filter-group-condition",s.setAttribute("role","group"),s.innerHTML=c,t._setAriaLabel(s),e.length||s.setAttribute("limit-selection",""),s}_setAriaLabel(e){const t=[];for(let a=0;a<e.children.length-1;a++){const i=e.children[a];i.classList.contains("smart-visibility-hidden")||i.hasAttribute("placeholder")||t.push(e.children[a].innerText)}0!==t.length?e.setAttribute("aria-label",t.join(" ")):e.setAttribute("aria-label","Empty condition row")}_formatValueStringRepresentation(e,t){const a=this,i=t[2],o=t[0],l=a._getFieldByFieldName(o);let r,n=t[1];if(!l||!l.dataType)return e;if(null==e)return a.valuePlaceholder;if(void 0!==n&&a.customOperations&&a.customOperations.length>0&&(n=a.customOperations.find((e=>e.name===n)),n&&n.valueTemplate))return"<span>"+n.valueTemplate(a._editor,e)+"</span>";switch(l.dataType.toLowerCase()){case"date":case"datetime":(e=e instanceof Date||"string"==typeof e||"number"==typeof e&&!isNaN(e)?new Smart.Utilities.DateTime(e):e).calendar.days=a._localizedDays,e.calendar.months=a._localizedMonths,e.calendar.locale=a.locale,r=e.toString("date"===l.dataType?a.formatStringDate:a.formatStringDateTime);break;case"array":r="string"==typeof e?e.split(","):e;break;case"object":r="string"==typeof e?e:JSON.stringify(e);break;case"number":r=e;break;case"boolean":r=!!e;break;default:r=e+"",r=r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")}if(!a.valueFormatFunction)return"<span>"+r+"</span>";const s={label:r,value:i,dataField:o,dataType:l.dataType||"string"};return"<span>"+a.valueFormatFunction(s)+"</span>"}_getFieldByFieldName(e){return Object.assign({},this._fields.find((t=>t.value===e)))}_refresh(){const e=this;e._generateValue(),e._emptyElementsStructure(),e._generateHTMLStructureFromFlatValue(),e._restrictNesting()}_generateValue(e){const t=this;let a=[],i=t._valueFlat.slice(0),o=[];for(let e=0;e<i.length;e++){const t=i[e];let o={};"group"===t.type&&(o.nodeId=t.nodeId,o.parentId=t.parentId,o.data=t.data,o.structure=[],a.push(o))}for(let e=0;e<a.length;e++){const t=a[e];for(let e=0;e<i.length;e++){const a=i[e];if(a.parentId===t.nodeId&&"condition"===a.type){const o=i[e-1];o&&o.parentId===t.nodeId&&"operator"===o.type&&t.structure.push(o.data.toString()),t.structure.push(a.data)}}}a=a.filter((e=>e.structure.length>0)),a.sort((function(e,t){return t.nodeId.split(".").length-e.nodeId.split(".").length}));for(let e=0;e<a.length;e++){const t=a[e],i=a.filter((e=>e.nodeId===t.parentId))[0];i&&i.structure?i.structure.push(t.structure):"0"!==t.nodeId?t.data&&(e>0&&o.push(t.data),o.push(t.structure)):o=o.concat(t.structure)}if(t.set("value",o),t._validateValue(),t._validValue=t._getValidValue(),t._updateValidationStatus(),!e){const e=JSON.stringify(t._validValue);t._oldValueAsString!==e&&(t._oldValueAsString=e,t.$.fireEvent("change",{value:JSON.parse(e),linq:t._queryParser.toLinq(t._validValue)}))}}_updateValidationStatus(){const e=this,t=e.customOperations.filter((e=>"function"==typeof e.validateValue)),a=e._valueFlat,i=!!e._validationStatus;let o=!0;for(let e=0,i=a.length;e<i;e+=1){const i=a[e];if("condition"!==i.type)continue;const l=i.data[1],r=t.find((e=>e.name===l));if(r&&0==!!r.validateValue(i.data[2])){o=!1;break}}if(e._validationStatus!==o){const t=void 0!==e._validationStatus;e._validationStatus=o,t&&e.$.fireEvent("validationChange",{oldValue:i,newValue:o})}}_getItemById(e,t){const a=this._valueFlat.filter((a=>t?a.parentId===e:a.nodeId===e));return a.length>0?a[0]:null}_validateStoredValue(e,t){const a=this;if(!t&&!a._editedItem)return e;if(!t&&!(t=a._editedItem.data[0]))return e;const i=a._getFieldByFieldName(t).dataType;if(void 0===i)return e+"";switch(i.toLowerCase()){case"date":case"datetime":e=new Smart.Utilities.DateTime(e).toDate();break;case"number":"number"!=typeof e&&(e=parseFloat(e));break;case"boolean":"boolean"!=typeof e&&(e=!!e);break;case"object":"object"!=typeof e&&(e={});break;case"array":Array.isArray(e)||(e=[e]);break;default:"string"!=typeof e&&(e+="")}return e}_closeEditor(e){const t=this;let a;if(!t._editedItem||!t._editorIsOpen)return;const i=t._editedItem,o=t._editor.closest(".filter-builder-item"),l=o.querySelector(".smart-value-container"),r=o.parentElement,n=r.children[2];if(t._editor===t.$.dateTimePickerEditor)t._editor._inputChangeHandler(),a=t._editor.value,a&&(a=a.toDate());else if(t._editor===t.$.checkBoxEditor)a=t._editor.checked;else if(t._editor===t.$.customEditor)t._editor&&Array.from(t._editor.getElementsByTagName("smart-numeric-text-box")).forEach((e=>e._inputBlurHandler())),a=t._validateStoredValue(t._selectedCustomCondition.handleValue(t._editor));else if(t._editor===t.$.numericTextBoxEditor)t._editor._inputBlurHandler(),a=t._editor.value;else if(o.classList.contains("smart-filter-value")){const e=t._getFieldByFieldName(t._editedItem.data[0]);if("array"===e.dataType)a=t._editor.value.split(",");else if("object"===e.dataType)a=JSON.parse(t._editor.value);else{const i=t._editor.value;a=e.lookup&&e.lookup.dataSource?{label:i,value:t._editor.dataset.value||i}:i}}else a=t._editor.value;if(o.classList.contains("smart-filter-field-name")){if(""===a.trim())return void t._hideEditor(o,void 0===i.data[0]);r.hasAttribute("limit-selection")&&(r.removeAttribute("limit-selection"),r.parentElement.nextElementSibling.removeAttribute("limit-selection"));const e=t._fields.find((e=>e.label===a)),s=i.data[0];if(e)i.data[0]=e.value;else{if("dynamic"!==t.fieldsMode){const e=t._fields.find((e=>e.value===s));return e&&(l.innerHTML=e.label),void t._hideEditor(o)}{const e=t._getDynamicFieldInfo(a);a=e.label,i.data[0]=e.dataField}}l.innerHTML=a,t._handleFieldChange([s,i.data[0]],[n,i,r])}else if(o.classList.contains("smart-filter-operation"))t._handleOperationChange([i,a,t._editor.$.input.dataValue],[l,n]);else{let e,o;"object"==typeof a&&void 0!==a.value?(e=a.label,o=a.value,void 0===e&&(e=o)):e=o=a,i.data[2]=o,l.innerHTML=t._formatValueStringRepresentation(e,i.data)}t._validateValueField(n,i.data[1],i.data[2]),t._generateValue(e),t._hideEditor(o)}_validateValueField(e,t,a){const i=this.customOperations;let o=!0;if(e&&e.removeAttribute("invalid-value"),i&&i.length>0){const l=i.find((e=>e.name===t));l&&"function"==typeof l.validateValue&&(o=!!l.validateValue(a),!o&&e&&e.setAttribute("invalid-value",""))}return o}_getDynamicFieldInfo(e){const t=this,a={label:e,dataField:e,dataType:"string"};if(t.getDynamicField){const i=t.getDynamicField(e);i.label&&(a.label=i.label),i.dataField&&(a.dataField=i.dataField),i.dataType&&(a.dataType=i.dataType),i.filterOperations&&Array.isArray(i.filterOperations)&&i.filterOperations.length>0&&(a.filterOperations=i.filterOperations),i.lookup&&(a.lookup=i.lookup)}return t._manuallyAddedFields.push(a),t._mapFieldsToMenu(),a}_handleFieldChange(e,t){const a=this,i=e[0],o=t[1],l=t[2],r=t[0],n=a._fields.find((t=>t.value===e[1])),s=a._getFilterOperations(n),d=function(){n.value!==i&&a.$.fireEvent("propertySelected",{label:n.label,value:n.value})};if(!i||void 0===o.data[1])return a._handleOnlyOperation(s,o.data,l),void d();const c=a._fields.find((e=>e.value===i)),u=c.dataType,p=n.dataType;if(n!==c&&(p!==u||"enum"===p||n.filterOperations||c.filterOperations)){if(s.find((e=>e.value===o.data[1]))){if(p===u&&"enum"!==p)return;return"date"===p&&"dateTime"===u||"dateTime"===p&&"date"===u?(r.firstElementChild.innerHTML=a._formatValueStringRepresentation(o.data),void d()):(o.data.splice(2,1),r.setAttribute("placeholder",""),r.firstElementChild.innerHTML=a.valuePlaceholder,void d())}o.data.splice(1,2),l.children[1].setAttribute("placeholder",""),l.children[1].firstElementChild.innerHTML=a.operatorPlaceholder,r.setAttribute("placeholder",""),r.firstElementChild.innerHTML=a.valuePlaceholder,r.classList.remove("smart-visibility-hidden"),a._handleOnlyOperation(s,o.data,l),d()}}_handleOnlyOperation(e,t,a){const i=this.autoPrompt;if(1===e.length||i&&"immediately"===this.applyMode&&e.length>1){const i=e[0];t[1]=i.value,a.children[1].removeAttribute("placeholder",""),a.children[1].firstElementChild.innerHTML=e[0].label,("isblank"===i.value||"isnotblank"===i.value||i.custom&&i.hideValue)&&(t.splice(2,1),a.children[2].classList.add("smart-visibility-hidden"))}}_handleOperationChange(e,t){const a=this,i=e[0],o=e[1],l=e[2],r=t[0],n=t[1],s=void 0!==i.data[1]?a._filterOperationDescriptions.find((e=>e.value===i.data[1])):void 0,d=a._filterOperationDescriptions.find((e=>e.value===l));if(!d||d===s)return;const c=d.value;i.data[1]=c;const u=i.data[0],p=i.data[1],m=i.data[2];if(r.innerHTML=o,"isblank"===c||"isnotblank"===c||d.custom&&d.hideValue)i.data.splice(2,1),n.classList.add("smart-visibility-hidden");else if(n.classList.contains("smart-visibility-hidden"))n.setAttribute("placeholder",""),n.classList.remove("smart-visibility-hidden"),n.firstElementChild.innerHTML=a.valuePlaceholder;else if(d.custom){const e=a._getFieldByFieldName(u);if(d.editorTemplate){const t=d.editorTemplate(e.dataType,p,e);t&&(a.$.customEditor.innerHTML="",a.$.customEditor.appendChild(t))}d.valueTemplate?n.firstElementChild.innerHTML=d.valueTemplate(a.$.customEditor,m):void 0===m?(n.setAttribute("placeholder",""),n.firstElementChild.innerHTML=a.valuePlaceholder):n.firstElementChild.innerHTML=m}else void 0===m?(i.data.splice(2,1),n.setAttribute("placeholder",""),n.firstElementChild.innerHTML=a.valuePlaceholder):d.custom||(n.firstElementChild.innerHTML=a._formatValueStringRepresentation(m,i.data))}_hideEditor(e,t){const a=this;t&&e.setAttribute("placeholder",""),e.removeAttribute("edited"),a.$.editorsContainer.removeAttribute("open"),a._editor.close&&a._editor.close(),a._editor.classList.add("smart-hidden"),a._editorIsOpen=a._enterIsPressedInEditor=!1,a.$.scrollableContainer.refresh(),a._setAriaLabel(e.parentElement)}_clickHandlerFilterButton(e,t,a){const i=this;function o(e,t,a){i._contextMenuOptions=0===t.length?i._defaultFilterOperationDescriptions:t,i._handleContextMenu(e),i.$.conditionsMenu.opened&&(i.$.conditionsMenu._discardKeyboardHover(),i.$.conditionsMenu._hoverViaKeyboard(i.$.conditionsMenu.querySelector('smart-menu-item[value="'+a+'"]')))}a.closest(".smart-editors-container")||(i._closeEditor(),i._editedItem=i._getItemById(t),e.contains("smart-filter-add-btn")?o(a,i._groupOperationDescriptions):(e.contains("smart-filter-field-name")||i._editedItem.data&&i._editedItem.data.length)&&(e.contains("smart-filter-group-operator")||e.contains("smart-filter-nested-operator")?o(a,i._groupOperationDescriptions,i._editedItem.data):(a.closest(".filter-builder-item").removeAttribute("placeholder"),i._openEditor(a))))}_handleContextMenu(e){const t=this;if(t._selectedElement===e&&t.$.conditionsMenu.opened)return void t.$.conditionsMenu.close();if(t._closeEditor(),t.disableContextMenu)return void(t._selectedElement=e);const a=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o=a.left+t.$.contentContainer.scrollLeft-i.left,l=a.top+t.$.contentContainer.scrollTop-i.top+a.height;e.hasAttribute("aria-haspopup")&&(t.$.conditionsMenu.controlledBy&&(t.$.conditionsMenu.controlledBy.setAttribute("aria-expanded",!1),t.$.conditionsMenu.controlledBy.removeAttribute("aria-controls")),e.setAttribute("aria-controls",t.$.conditionsMenu.id),e.setAttribute("aria-expanded",!0),t.$.conditionsMenu.controlledBy=e),t.$.conditionsMenu.dataSource=t._contextMenuOptions,t.$.conditionsMenu.open(o,l+3),t._selectedElement=e,t.$.scrollableContainer.refresh()}_openEditor(e){const t=this,a=e&&e.closest(".smart-filter-group-condition")?e.closest(".smart-filter-group-condition").getAttribute("node-id"):null,i=e.closest(".filter-builder-item"),o=t._getItemById(a);let l="";void 0!==o.data[0]?l=o.data[0]:t._fields.length&&(l=t._fields[0].value);let r,n,s=t._getFieldByFieldName(l),d="";if(i.classList.contains("smart-filter-field-name"))n=0,t._fields||t._mapFieldsToMenu(),s.lookup={dataSource:t._fields.slice(),readonly:!1},d=s.label||"",r=s.value;else if(i.classList.contains("smart-filter-operation")){n=1;let e=t._getFilterOperations(s);s.lookup={dataSource:e,readonly:!0};let a=e.find((e=>e.value===o.data[n]))||e[0];d=a.label,r=a.value}else n=2,d=o.data[n],void 0===d&&(d="");t._editorIsOpen&&t._closeEditor(),i.setAttribute("edited",""),t._editedItem=o;const c=t._fields.filter((e=>e.value===l)),u=t._filterOperationDescriptions.filter((e=>e.value===o.data[1]&&e.custom)),p=c.length>0?c[0]:null,m=s.lookup&&s.lookup.dataSource?"lookup":p?p.dataType:void 0;if(2===n&&0!==u.length&&u[0].editorTemplate?(t._selectedCustomCondition=u[0],t._openCustomEditor(m,d,s)):t._openEditorByFieldType(m,d,s,r),i.appendChild(t.$.editorsContainer),t._editor.classList.remove("smart-hidden"),t._editorIsOpen=!0,t.$.editorsContainer.setAttribute("open",""),t.$.scrollableContainer.refresh(),t._editor.classList.contains("smart-custom-editor")){const e=t.customOperations[t._selectedCustomCondition.index].onEditorOpen;e&&e(t._editor)}else requestAnimationFrame((()=>t._editor.focus()));s.lookup&&!t._valueValidationTimeout&&t._editor.open()}_getFilterOperations(e){const t=this;let a=t._filterOperationDescriptions.slice();if(e.filterOperations)a=t._filterOperationDescriptions.filter((t=>e.filterOperations.indexOf(t.value)>-1));else{let i;switch(e.dataType){case"date":case"dateTime":case"number":i=["=","<>","<",">","<=",">=","isblank","isnotblank"];break;case"boolean":i=["=","<>","isblank","isnotblank"];break;case"object":i=["isblank","isnotblank"];break;case"string":i=["contains","notcontains","startswith","endswith","=","<>","isblank","isnotblank"];break;default:i=["contains","notcontains","startswith","endswith","=","<>","<",">","<=",">=","isblank","isnotblank"]}a=t._filterOperationDescriptions.filter((e=>i.indexOf(e.value)>-1))}return t.showIcons&&a.map((e=>e.icon=t.icons[e.value])),a}_openCustomEditor(e,t,a){const i=this,o=i.customOperations[i._selectedCustomCondition.index].editorTemplate(e,t,a);i.$.customEditor.innerHTML="",o&&i.$.customEditor.appendChild(o),i._editor=i.$.customEditor}_openEditorByFieldType(e,t,a,i){const o=this;if(e)switch(e.toLowerCase()){case"boolean":return o._initializeEditor("checkBox"),void(o._editor.checked=!!t);case"date":case"datetime":return o._initializeEditor("dateTimePicker"),o._editor.formatString="date"===e?o.formatStringDate:o.formatStringDateTime,void(o._editor.value=t);case"number":return o._initializeEditor("numericTextBox"),void(o._editor.value=t||0)}if(o._initializeEditor("input"),o._editor.dropDownWidth=o.dropDownWidth,"lookup"===e){const i=a.lookup.minLength,l=a.lookup.dataSource;if(o._editor.autoCompleteDelay=a.lookup.autoCompleteDelay||100,o._editor.dropDownAppendTo=o.$.container,o._editor.dropDownButtonPosition=o.rightToLeft?"left":"right",o._editor.minLength=isNaN(i)||null===i?1:i,o._editor.readonly=!!a.lookup.readonly,"function"==typeof l?o._editor.dataSource=l:l instanceof Promise?l.then((e=>{if(!(o._editor instanceof Smart.Input))return;const a=o._editor.opened;o._editor.dataSource=e,e.length<12?o._editor.dropDownHeight="auto":o._editor.dropDownHeight=200,a&&(o._editor.open(),""===t&&o._editor.readonly&&e.length&&(o._editor.value=e[0].label||e[0]))})):(o._editor.dataSource=l,l.length<12?o._editor.dropDownHeight="auto":o._editor.dropDownHeight=200),"object"===e)t=JSON.stringify(t||{});else if(""===t&&o._editor.readonly){const e=o._editor.dataSource;if(Array.isArray(e)){const a=e[0];t=a&&(a.value||a.label)||""}else t=""}if(o._editor.isRendered){const e=o._editor.$.input.dataValue;null!=e&&e===t||(o._editor.value=void 0!==t?t+"":"")}else o._editor.value=void 0!==t?t+"":""}else o._editor.dataSource=[],o._editor.dropDownButtonPosition="none",o._editor.readonly=!1,o._editor.value=void 0!==t?t+"":"";i&&"object"!==e&&o._editor.isRendered&&(o._editor.$.input.dataValue=i)}_initializeEditor(e){const t=this;if(t.$[e+"Editor"])return void(t._editor=t.$[e+"Editor"]);const a=document.createElement("smart-"+Smart.Utilities.Core.toDash(e));"numericTextBox"===e?(a.spinButtons=!0,a.inputFormat="floatingPoint"):"dateTimePicker"===e&&(a.dropDownAppendTo=t.$.container,a.calendarButton=!0,a.dropDownDisplayMode="auto",a.enableMouseWheelAction=!0,a.locale=t.locale,a.autoClose=!0,a.messages[t.locale]||(a.messages[t.locale]={}),a.messages[t.locale].dateTabLabel=t.localize("dateTabLabel"),a.messages[t.locale].timeTabLabel=t.localize("timeTabLabel")),a.rightToLeft=t.rightToLeft,a.theme=t.theme,a.animation=t.animation,a.$.addClass("smart-hidden underlined"),t.$.editorsContainer.appendChild(a),t._editor=t.$[e+"Editor"]=a}_getValidValue(){const e=this,t=e.properties.value.value,a=[];let i=!1;return t.forEach((t=>{if(Array.isArray(t)){let o=!1,l=!1;const r=[];t.forEach((t=>{if(Array.isArray(t)){const a=t[0],i=t[1],n=t[2];if(void 0===a||void 0===i)return void(l=!0);if(void 0!==n||"isblank"===i||"isnotblank"===i)return o=!0,void r.push(t);const s=e._filterOperationDescriptions.find((e=>e.value===i));s.custom&&s.hideValue?(o=!0,r.push(t)):l=!0}else l?l=!1:r.push(t)})),o?("string"==typeof r[r.length-1]&&r.pop(),a.push(r)):i=!0}else i?i=!1:a.push(t)})),"string"==typeof a[a.length-1]&&a.pop(),a}}),Smart.Utilities.Assign("QueryParser",class{constructor(e,t,a){const i=this;i.customOperations=t||[],i.fields=e||[],i.dynamicField=a}toLinq(e){return Array.isArray(e)&&this._arePropertiesValid()?this._parseQueryToLinq(e):""}toValue(e){return"string"==typeof e&&this._arePropertiesValid()?this._parseLinqToValue(e):[]}_arePropertiesValid(){return Array.isArray(this.customOperations)?!!Array.isArray(this.fields)||(console.log('Invalid "fields" property.'),!1):(console.log('Invalid "customOperations" property.'),!1)}_parseQueryToLinq(e){const t=this,a={and:"&&",or:"||"};let i="";for(let o=0;o<e.length;o++){const l=e[o];if(Array.isArray(l))if(l.indexOf("and")>-1||l.indexOf("or")>-1||1===l.length&&Array.isArray(l[0])){const e=t._parseQueryToLinq(l);e?i+=l.length>1?"("+e+")":e:/\s(&|\|){2}\s$/gm.test(i)&&(i=i.replace(/\s(&|\|){2}\s$/gm,""))}else i+=t._getExpressionFromQuery(l)||"";else i&&(i+=" "+a[l]+" ")}return i}_getExpressionFromQuery(e){const t=e[0],a=e[1];let i=e[2];const o=this.customOperations.find((e=>e.name===a));return o&&o.expressionTemplate?("string"==typeof i&&i.includes('"')&&o.expressionTemplate.includes('"')&&(i=JSON.stringify(i).slice(1,-1)),o.expressionBuilderCallback?o.expressionBuilderCallback(t,a,i):o.expressionTemplate.replace("{0}",t).replace("{1}",i)):""}_parseLinqToValue(e){const t=this;let a,i=0,o=[];for(let t=0;t<e.length;t++)if("("===e[t])i++,void 0===a&&(a=t);else if(")"===e[t]&&i>0&&(i--,0===i)){let i=e.substring(a,t+1).trim();i.length&&(i.includes("&&")||i.includes("||"))&&o.push({expr:i}),a=void 0}let l,r=[];if(o.length)for(let a=0;a<o.length;a++){let i;o[a].query=t._getQueryFromExpression(o[a].expr),i=l?e.substring(e.indexOf(l)+l.length,e.indexOf(o[a].expr)).trim():e.substring(0,e.indexOf(o[a].expr)).trim(),i&&r.push(i),l=o[a].expr}l?r.push(e.substring(e.indexOf(l)+l.length).trim()):r.push(e.trim());for(let e=0;e<r.length;e++){const a=r[e].replace(/^&{2}|^\|{2}|&{2}$|\|{2}$/gm,"").trim();a.length&&o.push({expr:a,query:t._getQueryFromExpression(a),outher:!0})}return t._constructValueFromQueries(e,o)}_getQueryFromExpression(e){const t=this,a=t.fields,i=t.dynamicField;let o=[],l=e;const r=function(e){let l=[];const r=t.customOperations.filter((e=>e.expressionTemplate));r.sort(((e,t)=>t.expressionTemplate.length-e.expressionTemplate.length));for(let t=0;t<r.length;t++){const a=r[t],i=new RegExp(a.expressionTemplate.replace(/\(/gm,"\\(").replace(/\)/gm,"\\)").replace(/\[/gm,"\\[").replace(/\]/gm,"\\]").replace(/"{\d+}"/gm,'\\W*"([^"]*)[^a-zA-Z0-9-\\s\\)]+').replace(/{\d+}/gm,"([@|$]*\\w+[.]*\\w+(?!\\s)*)\\s{0}").replace(/ /gm,"\\s"),"gm");if(i.test(e)){i.lastIndex=0;let t,o,r=i.exec(e);if(r=r.filter(((e,t)=>r.indexOf(e)===t)),a.expressionReaderCallback){let e=a.expressionReaderCallback(r[0],r.slice(1));e&&(t=e.fieldName,o=e.value)}void 0===t&&(t=r[1]||""),void 0===o&&(o=r[2]||""),l.push({operator:a.name,field:t,value:o,query:r[0]})}}let n=l.find((e=>a.find((t=>t.filterOperations.indexOf(e.operator)>-1&&t.dataField===e.field))));if(!n&&i)for(let e=0;e<l.length;e++){const t=l[e],a=i(t.field);if(a&&Array.isArray(a.filterOperations)&&a.filterOperations.indexOf(t.operator)>-1){n=t;break}}if(n)return o.push({expr:n.query,query:[n.field,n.operator,n.value]}),n.query};if(l){for(;l.length;){l&&(l=l.trim(),"("===l[0]&&")"===l[l.length-1]&&(l=l.trim().replace(/^\(|\)$/gm,"")),l=l.replace(/^&{2}|^\|{2}|&{2}$|\|{2}$/gm,"").trim());const e=r(l);if(!e)break;l=l.replace(e,"").trim()}return t._constructValueFromQueries(e,o)}}_constructValueFromQueries(e,t){let a=[];t.sort(((t,a)=>e.indexOf(t.expr)-e.indexOf(a.expr)));for(let i=0;i<t.length;i++){let o=t[i-1];if(o){const l=e.substring(e.indexOf(o.expr)+o.expr.length,e.indexOf(t[i].expr)).trim();a.push("||"===l?"or":"and")}t[i].outher?t[i].query.forEach((e=>a.push(Array.isArray(e)?[e]:e))):a.push(t[i].query)}return a}});
|
|
1401
1401
|
|
|
1402
1402
|
/***/ }),
|
|
1403
1403
|
|
|
1404
1404
|
/***/ 5766:
|
|
1405
1405
|
/***/ (() => {
|
|
1406
1406
|
|
|
1407
|
-
Smart("smart-filter-panel",class extends Smart.BaseElement{static get properties(){return{buttons:{value:["clear","filter"],type:"array"},data:{value:null,type:"array?",reflectToAttribute:!1},dataField:{value:null,type:"string?"},dataSource:{value:null,type:"any",reflectToAttribute:!1},evaluateFilterExpression:{value:null,type:"function?",reflectToAttribute:!1},filterType:{value:"string",allowedValues:["numeric","string","date","boolean"],type:"string"},formatString:{value:"d",type:"string"},messages:{value:{en:{addCondition:"Add Condition",addGroup:"Add Group",and:"and",blanks:"(Blanks)",cancel:"Cancel",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equal:"equal",equalCaseSensitive:"equal (case sensitive)",filter:"Filter",greaterThan:"greater than",greaterThanOrEqual:"greater than or equal",lessThan:"less than",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notEqual:"not equal",notNull:"not null",null:"null ",or:"or",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME"}},type:"object",extend:!0},mode:{value:"default",allowedValues:["basic","default","excel"],type:"string"}}}static get listeners(){return{"cancelButton.click":"cancel","clearButton.click":"clear","filterButton.click":"filter"}}template(){return'<div id="container" class="smart-container" role="presentation">\n <div id="label" class="smart-filter-panel-label"></div>\n <div id="mainContainer" role="presentation"></div>\n <div id="buttonContainer" class="smart-filter-panel-button-container" role="presentation">\n <smart-button id="filterButton" class="primary" animation="[[animation]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n <smart-button id="clearButton" animation="[[animation]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n <smart-button id="cancelButton" animation="[[animation]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n </div>\n </div>'}static get styleUrls(){return["smart.grid.css","smart.dropdownlist.css","smart.menu.css","smart.filterpanel.css","smart.textbox.css"]}ready(){super.ready()}render(){const e=this,t=e.filterType;e.$.label.id||(e.$.label.id=e.id+"Label"),e.setAttribute("role","dialog"),e.setAttribute("aria-labelledby",e.$.label.id),e._localize(),e._setButtonsVisibility(),e._filterType=t+"Filter",e._filterHandler=new(Smart.Utilities[t.slice(0,1).toUpperCase()+t.slice(1)+"FilterHandler"])(e),super.render()}cancel(){const e=this;e._filterHandler[e.mode+"Cancel"](),e.$.fireEvent("cancel")}clear(){const e=this;e._filterHandler[e.mode+"Clear"](),e.$.fireEvent("clear")}reset(){const e=this;e.$.clearButton.removeAttribute("hover"),e.$.filterButton.removeAttribute("hover"),e.$.cancelButton.removeAttribute("hover"),e._filterHandler.firstInputMatchCase&&e._filterHandler.firstInputMatchCase.classList.remove("active"),e._filterHandler.secondInputMatchCase&&e._filterHandler.secondInputMatchCase.classList.remove("active"),e._filterHandler[e.mode+"Clear"](),e._filterHandler.filterObject=new Smart.Utilities.FilterGroup}getFilter(){if(this._filterHandler){const e=new Smart.Utilities.FilterGroup;for(let t in this._filterHandler.filterObject)e[t]=this._filterHandler.filterObject[t];return e}return null}evaluate(e){try{return this._filterHandler.evaluate(e)}catch(e){return!1}}filter(){const e=this;e._filterHandler[e.mode+"Filter"](),e.$.fireEvent("filter")}getState(){return this._filterHandler.cachedFilter}loadState(e){try{const t=this;t._filterHandler.cachedFilter=e,t._filterHandler[t.mode+"Cancel"]()}catch(e){}}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this,i=l._filterHandler;function s(){l.$.mainContainer.innerHTML="",function(){const e=["cachedFilter","caseSensitive","customExcelFilterObjects","customItems","dataSource","defaultListSelection","defaultListSource","displayMode","filterBuilder","filterBuilderObject","filterBuilderOperations","filterObject","firstInput","firstList","operationsMapping","operatorList","secondInput","secondList","timeOnly","tree"];e.forEach((function(t){delete i[e[t]]})),delete l._filterHandler}(),l._filterHandler=new(Smart.Utilities[l.filterType.slice(0,1).toUpperCase()+l.filterType.slice(1)+"FilterHandler"])(l)}switch(e){case"animation":case"disabled":case"rightToLeft":case"unfocusable":switch(l.mode){case"default":case"basic":[i.firstList,i.firstInput,i.logicalOperatorList,i.secondList,i.secondInput].forEach((function(t){t[e]=a}));break;case"excel":i.tree[e]=a;break;case"filterBuilder":i.filterBuilder[e]=a,i.caseSensitive&&(i.caseSensitive[e]=a)}break;case"buttons":l._setButtonsVisibility();break;case"data":case"dataField":"excel"!==l.mode||Array.isArray(l.dataSource)||s();break;case"dataSource":"excel"===l.mode&&s();break;case"filterType":l._filterType=a+"Filter",s();break;case"mode":s();break;case"formatString":if("date"!==l.filterType)return;switch(l.mode){case"default":case"basic":i.firstInput.formatString=a,i.secondInput.formatString=a;break;case"excel":s();break;case"filterBuilder":i.filterBuilder.formatStringDate=a,i.filterBuilder.formatStringDateTime=a}break;case"locale":case"messages":switch(l._localize(),l.mode){case"default":case"basic":{const t=i.firstList.selectedIndex,a=i.logicalOperatorList.selectedIndex,s=i.secondList.selectedIndex,r=[i.firstInput,i.secondInput];switch(i.setDefaults(),i.firstList.dataSource=JSON.parse(JSON.stringify(i.defaultListSource)),i.logicalOperatorList.dataSource=[{value:0,label:l.localize("and")},{value:1,label:l.localize("or")}],i.secondList.dataSource=JSON.parse(JSON.stringify(i.defaultListSource)),l.filterType){case"date":r.forEach((function(t){t.messages[l.locale]||(t.messages[l.locale]={});const a=l.localize("dateTabLabel");a&&(t.messages[l.locale].dateTabLabel=a);const i=l.localize("timeTabLabel");if(i&&(t.messages[l.locale].timeTabLabel=i),"locale"===e&&(t.locale=l.locale),"timePicker"===t._dropDownDisplayMode){const e=l.localize("placeholderTime");e&&(t.placeholder=e,t.placeholder=e)}else{const e=l.localize("placeholderDate");e&&(t.placeholder=e,t.placeholder=e)}}));break;case"numeric":r[0].placeholder=l.localize("placeholderNumber"),r[1].placeholder=l.localize("placeholderNumber");break;case"string":r[0].placeholder=l.localize("placeholderValue"),r[1].placeholder=l.localize("placeholderValue");break;case"boolean":r[0].placeholder=l.localize("placeholderBoolean"),r[1].placeholder=l.localize("placeholderBoolean")}i.firstList.selectedIndex=t,i.logicalOperatorList.selectedIndex=a,i.secondList.selectedIndex=s;break}case"excel":i.tree.selectAll.label=l.localize("selectAll"),i.tree.blanks&&(i.tree.blanks.label=l.localize("blanks"));break;case"filterBuilder":i.localizeFilterBuilder(),"messages"===e&&(i.filterBuilder._localizeInitialValues(),i.filterBuilder._refresh()),i.filterBuilder.$.scrollableContainer.refresh()}}}_localize(){const e=this;e.localize("showRows")&&(e.$.label.innerHTML=e.localize("showRows")),e.localize("filter")&&(e.$.filterButton.innerHTML=e.localize("filter")),e.localize("clear")&&(e.$.clearButton.innerHTML=e.localize("clear")),e.localize("cancel")&&(e.$.cancelButton.innerHTML=e.localize("cancel"))}_setButtonsVisibility(){const e=this,t=e.buttons;["cancel","clear","filter"].forEach((function(a){-1!==t.indexOf(a)?e["$"+a+"Button"].removeClass("smart-hidden"):e["$"+a+"Button"].addClass("smart-hidden")}))}}),Smart.Utilities.Assign("BaseFilterHandler",class{constructor(e){const t=this;if(t.basicFilter=t.defaultFilter,t.basicClear=t.defaultClear,t.basicCancel=t.defaultCancel,t.context=e,t.filterObject=new Smart.Utilities.FilterGroup,t.setDefaults(),"date"===e.filterType){const a=new Smart.Utilities.DateTime,l=e.formatString,i=a.getParseRegExp(a.calendar,l.replace(/y+/g,"yyyyy"));t.displayMode=Smart.Utilities.DateTime.detectDisplayMode(a,l,i),t.timeOnly="timePicker"===t.displayMode}"default"!==e.mode&&"basic"!==e.mode?(t.operationsMapping={"=":"EQUAL","<>":"NOT_EQUAL","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",isblank:"EMPTY",isnotblank:"NOT_EMPTY",contains:"CONTAINS",notcontains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"},"excel"===e.mode?t.createExcelHTMLStructure():"filterBuilder"===e.mode&&t.createBuilderHTMLStructure()):t.createDefaultHTMLStructure()}setDefaults(){const e=this,t=e.context;e.defaultListSource=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("equal")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("notEqual")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("lessThan")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("lessThanOrEqual")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("greaterThan")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("greaterThanOrEqual")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("null")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("notNull")}],e.filterBuilderOperations=["<","=","<>","<=",">",">=","NULL","NOT_NULL"],e.defaultListSelection=2}createDefaultHTMLStructure(){const e=this,t=e.context,a=document.createElement("smart-input"),l=document.createElement("smart-input"),i=document.createElement("smart-input"),s=document.createDocumentFragment(),r=e=>{e.readonly=!0,e.dropDownButtonPosition="right"};a.classList.add("smart-filter-panel-list"),a.dataSource=JSON.parse(JSON.stringify(this.defaultListSource)),a.selectedIndex=e.defaultListSelection,r(a),l.classList.add("smart-filter-panel-operator-list"),l.dataSource=[{value:0,label:t.localize("and")},{value:1,label:t.localize("or")}],r(l),i.classList.add("smart-filter-panel-list"),i.dataSource=JSON.parse(JSON.stringify(this.defaultListSource)),i.selectedIndex=e.defaultListSelection,r(i),e.firstList=a,e.logicalOperatorList=l,e.secondList=i;const n=document.createElement("span");n.classList.add("smart-icon","smart-icon-font-size"),n.title=t.localize("matchCase");const c=document.createElement("span");c.classList.add("smart-icon","smart-icon-font-size"),c.title=t.localize("matchCase"),e.firstInputMatchCase=n,e.secondInputMatchCase=c,e.appendInputs(),e.firstInput.classList.add("smart-filter-panel-input"),e.secondInput.classList.add("smart-filter-panel-input"),"basic"===t.mode&&(e.secondList.classList.add("smart-hidden"),e.secondInput.classList.add("smart-hidden"),e.logicalOperatorList.classList.add("smart-hidden"),e.secondInputMatchCase.classList.add("smart-hidden")),l.dropDownHeight="auto",l.selectedIndex=0,[a,e.firstInput,e.firstInputMatchCase,l,i,e.secondInput,e.secondInputMatchCase].forEach((function(e){e.animation=t.animation,e.disabled=t.disabled,e.unfocusable=t.unfocusable,e.dropDownPosition="bottom",e.dropDownAppendTo="body",e.dropDownMaxHeight=200,e.rightToLeft=t.rightToLeft,s.appendChild(e)})),e.context.$.mainContainer.appendChild(s),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}cacheFilter(e,t,a){const l=this;l.cachedFilter={firstFilterComparison:e,firstFilterValue:l.firstInput.value,firstFilterCaseSensitive:l.firstInputMatchCase.classList.contains("active"),logicalOperator:t,secondFilterComparison:a,secondFilterValue:l.secondInput.value,secondFilterCaseSensitive:l.secondInputMatchCase.classList.contains("active")}}defaultFilter(){const e=this,t=e.context,a=e.getFilterInputValue(e.firstInput),l=parseFloat(e.logicalOperatorList.selectedValues[0]),i=e.getFilterInputValue(e.secondInput),s=e.filterObject;let r=e.firstList.selectedValues[0],n=e.secondList.selectedValues[0];s.clear();const c=e=>"CONTAINS"===e?"CONTAINS_CASE_SENSITIVE":"DOES_NOT_CONTAIN"===e?"DOES_NOT_CONTAIN_CASE_SENSITIVE":"STARTS_WITH"===e?"STARTS_WITH_CASE_SENSITIVE":"ENDS_WITH"===e?"ENDS_WITH_CASE_SENSITIVE":"EQUAL"===e?"EQUAL_CASE_SENSITIVE":"NOT_EQUAL"===e?"NOT_EQUAL_CASE_SENSITIVE":void 0;if(e.firstInputMatchCase.classList.contains("active")&&(r=c(r)),e.secondInputMatchCase.classList.contains("active")&&(n=c(n)),""!==a||-1!==["NULL","NOT_NULL","EMPTY","NOT_EMPTY"].indexOf(r)){const i=s.createFilter(t._filterType,a,r,void 0,t.formatString,t.locale,"timePicker"===e.firstInput._dropDownDisplayMode);s.addFilter(l,i)}if(""!==i||-1!==["NULL","NOT_NULL","EMPTY","NOT_EMPTY"].indexOf(n)){const a=s.createFilter(t._filterType,i,n,void 0,t.formatString,t.locale,"timePicker"===e.secondInput._dropDownDisplayMode);s.addFilter(l,a)}let o=e.firstList.selectedIndexes[0],d=e.secondList.selectedIndexes[0];const u=s.stringConditions;a&&"string"==typeof a&&(o=u.findIndex((e=>e===r))),i&&"string"==typeof i&&(d=u.findIndex((e=>e===n))),e.cacheFilter(o,e.logicalOperatorList.selectedIndexes[0],d)}getFilterInputValue(e){return e.value}excelFilter(){const e=this,t=e.context;if(Array.isArray(t.dataSource))return void e.customExcelFilter();const a=e.tree,l=e.filterObject;if(l.clear(),e.customItems=[],a._menuItems[0].selected)return void e.excelClear();const i=a.selectedIndexes;if(i.forEach((function(i){const s=a._menuItems[i];if(s instanceof Smart.TreeItem){const a=s.value;if(s.hasAttribute("default-item"))if(a instanceof Date){const i=new Smart.FilterGroup,s=new Date(a.getFullYear(),a.getMonth(),1),r=new Date(a.getFullYear(),a.getMonth()+1,0),n=i.createFilter(t._filterType,s,"GREATER_THAN_OR_EQUAL",void 0,t.formatString,t.locale,e.timeOnly),c=i.createFilter(t._filterType,r,"LESS_THAN_OR_EQUAL",void 0,t.formatString,t.locale,e.timeOnly);i.addFilter("and",n),i.addFilter("and",c),l.addFilter("or",i)}else{const i=e.getExcelComparison(a),s=l.createFilter(t._filterType,a,i,void 0,t.formatString,t.locale,e.timeOnly);l.addFilter("or",s)}else e.customItems.push(s)}})),0===i.length){const a=e.getExcelComparison("Empty Filter"),i=l.createFilter(t._filterType,"Empty Filter",a,void 0,t.formatString,t.locale,e.timeOnly);l.addFilter("or",i)}e.cachedFilter=i.slice(0)}customExcelFilter(){const e=this,t=e.tree;if(delete e.customExcelFilterObjects,t._menuItems[0].selected)return;const a=e.context,l=[],i=t.selectedIndexes;i.forEach((function(i){const s=t._menuItems[i];if(s instanceof Smart.TreeItem){let t=s.value;if(!Array.isArray(t))return;Array.isArray(t[0])||(t=[t]);const i=new Smart.Utilities.FilterGroup;for(let l=0;l<t.length;l++){const s=t[l],r=e.operationsMapping[s[1]],n=i.createFilter(a._filterType,s[2],r,void 0,a.formatString,a.locale,e.timeOnly);i.addFilter("and",n)}l.push(i)}})),e.customExcelFilterObjects=l,e.cachedFilter=i.slice(0)}getExcelComparison(e){return""===e?"NULL":"EQUAL"}filterBuilderFilter(){const e=this,t=e.filterBuilder.value,a="string"===e.context.filterType&&e.caseSensitive.checked,l={filters:[]};!function t(l,i){const s=new Smart.Utilities.FilterGroup,r=l[1];i.logicalOperator=r;for(let n=0;n<l.length;n++){if(1===n)continue;const c=l[n];if(Array.isArray(c))if(Array.isArray(c[0])){const e={filters:[]};i.filters.push(e),t(c,e)}else s.addFilter(r,e.createFilterBuilderFilter(s,c,a))}s.filters.length>0&&i.filters.push(s)}(t,l),e.filterBuilderObject=l,e.cachedFilter={filterBuilder:JSON.parse(JSON.stringify(e.filterBuilder.value),(function(e,t){return/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d{3})Z$/.test(t)?new Date(t):t})),caseSensitive:a}}createFilterBuilderFilter(e,t,a){const l=this.context;let i=this.operationsMapping[t[1]];return a&&-1!==["CONTAINS","DOES_NOT_CONTAIN","STARTS_WITH","ENDS_WITH","EQUAL"].indexOf(i)&&(i+="_CASE_SENSITIVE"),e.createFilter(l._filterType,t[2],i,void 0,l.formatString,l.locale,!1)}defaultClear(){const e=this;e.firstList.selectedIndexes=[e.defaultListSelection],e.firstInput.value="",e.logicalOperatorList.selectedIndexes=[0],e.secondList.selectedIndexes=[e.defaultListSelection],e.secondInput.value="",e.filterObject.clear(),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}excelClear(){const e=this;0!==e.tree.offsetHeight&&e.tree.select("0"),e.filterObject.clear(),e.cachedFilter=e.tree.selectedIndexes.slice(0)}filterBuilderClear(){const e=this;e.filterBuilder.value=["and"],"string"===e.context.filterType&&(e.caseSensitive.checked=!1),e.cachedFilter={filterBuilder:["and"],caseSensitive:!1}}defaultCancel(){const e=this;let t=null,a=null;if(e.filterObject){const l=e.filterObject.stringConditions,i=e.filterObject.numericConditions,s=e.filterObject.booleanConditions,r=e.filterObject.dateConditions;t=l[e.cachedFilter.firstFilterComparison],a=l[e.cachedFilter.secondFilterComparison],e.cachedFilter.firstFilterValue&&"string"!=typeof e.cachedFilter.firstFilterValue&&(!0===e.cachedFilter.firstFilterValue||!1===e.cachedFilter.firstFilterValue?(t=s[e.cachedFilter.firstFilterComparison],a=s[e.cachedFilter.secondFilterComparison]):e.cachedFilter.firstFilterValue&&e.cachedFilter.firstFilterValue instanceof Date?(t=r[e.cachedFilter.firstFilterComparison],a=r[e.cachedFilter.secondFilterComparison]):(t=i[e.cachedFilter.firstFilterComparison],a=i[e.cachedFilter.secondFilterComparison]))}let l=-1;e.firstList.dataSource.find(((e,a)=>{if(e.value===t)return l=a,e}));let i=-1;e.secondList.dataSource.find(((e,t)=>{if(e.value===a)return i=t,e})),e.firstList.selectedIndexes=[l],e.firstInput.value=e.cachedFilter.firstFilterValue,e.cachedFilter.firstFilterCaseSensitive&&e.firstInputMatchCase.classList.add("active"),e.logicalOperatorList.selectedIndexes=[e.cachedFilter.logicalOperator],e.secondList.selectedIndexes=[i],e.secondInput.value=e.cachedFilter.secondFilterValue,e.cachedFilter.firstFilterCaseSensitive&&e.firstInputMatchCase.classList.add("active"),e.cachedFilter.secondFilterCaseSensitive&&e.secondInputMatchCase.classList.add("active")}excelCancel(){const e=this;if(e.cachedFilter&&e.cachedFilter.firstFilterValue){const t=e.cachedFilter.firstFilterValue,a=e.cachedFilter.secondFilterValue,l=e.cachedFilter.firstFilterComparison,i=e.cachedFilter.secondFilterComparison;let s=e.filterObject.stringConditions;if(isNaN(parseFloat(t))||(s=e.filterObject.numericConditions),e.dataSource){let r=[];return e.dataSource.forEach(((e,n)=>{r.push("0."+n),e.label===t||e.label===a?("NOT_EQUAL"!==s[l]&&"DOES_NOT_CONTAIN"!==s[l]||r.pop(),"NOT_EQUAL"!==s[i]&&"DOES_NOT_CONTAIN"!==s[i]||r.pop()):e.label===t&&e.label===a||("EQUAL"!==s[l]&&"EQUAL_CASE_SENSITIVE"!==s[l]&&"CONTAINS"!==s[l]&&"ENDS_WITH"!==s[l]&&"STARTS_WITH"!==s[l]||r.pop(),"EQUAL"!==s[i]&&"EQUAL_CASE_SENSITIVE"!==s[i]&&"CONTAINS"!==s[i]&&"ENDS_WITH"!==s[i]&&"STARTS_WITH"!==s[i]||r.pop())})),void setTimeout((()=>{e.tree.selectedIndexes=r}))}}else if(e.cachedFilter&&e.cachedFilter.filters&&e.dataSource){let t=[];return e.dataSource.forEach(((a,l)=>{t.push("0."+l);let i=!1;e.cachedFilter.filters.forEach((e=>{e.value===a.label&&(i=!0)})),i||t.pop()})),void setTimeout((()=>{e.tree.selectedIndexes=t}))}e.tree.selectedIndexes=e.cachedFilter.slice(0)}filterBuilderCancel(){const e=this;e.filterBuilder.value=e.cachedFilter.filterBuilder,"string"===e.context.filterType&&(e.caseSensitive.checked=e.cachedFilter.caseSensitive)}createExcelHTMLStructure(){const e=this,t=e.context,a=document.createElement("smart-tree"),l={data:t.data,dataField:t.dataField,filterType:t._filterType};if(t.dataSource&&Array.isArray(t.dataSource))e.processCustomDataSource(a);else{if(t.data&&t.dataField||t.error(t.localize("missingProperty")),"date"===t.filterType){l.formatString=t.formatString,l.displayMode=e.displayMode,e.dataSource=e.filterObject.getUniqueValues(l,t);try{e.getHierarchicalDataSource(e.displayMode)}catch(e){t.error(t.localize("mismatchedProperties"))}e.timeOnly?a.classList.add("standard-excel"):a.classList.add("date-excel")}else e.dataSource=e.filterObject.getUniqueValues(l,t),a.classList.add("standard-excel");"function"==typeof t.dataSource&&(e.dataSource=t.dataSource(e.dataSource)||e.dataSource)}a.animation=t.animation,a.disabled=t.disabled,a.unfocusable=t.unfocusable,a.dataSource=[{label:t.localize("selectAll"),value:"",items:e.dataSource,expanded:!0,selected:!0}],a.selectionMode="checkBox",a.hasThreeStates=!0,a.theme=t.theme,a.animation="none",a.toggleMode="arrow",a.rightToLeft=t.rightToLeft,a.addEventListener("collapsing",(function(e){1===e.detail.item.level&&e.preventDefault()})),a._onCompleted=function(){if(e.cachedFilter=a.selectedIndexes.slice(0),a.classList.contains("date-excel"))for(let e in a._menuItems){if("0"===e)continue;const t=a._menuItems[e];t.firstElementChild.style.paddingLeft=20*(t.level-1)-10+"px"}else a._menuItems[0].firstElementChild.style.paddingLeft=0;a.selectAll=a._menuItems[0],a.blanks=a.querySelector('[label="'+t.localize("blanks")+'"]')},e.tree=a,t.$.mainContainer.appendChild(a)}processCustomDataSource(e){const t=this.context.dataSource;e.classList.add("standard-excel"),this.dataSource=t}createBuilderHTMLStructure(){const e=this,t=e.context,a=document.createElement("smart-filter-builder"),l=t.dataField,i="numeric"===t.filterType?"number":t.filterType;if(e.filterBuilder=a,a.animation=t.animation,a.disabled=t.disabled,a.unfocusable=t.unfocusable,a.value=["and"],a.fields=[{label:l,dataField:l,dataType:i,filterOperations:e.filterBuilderOperations}],e.localizeFilterBuilder(),t.$.mainContainer.appendChild(a),"string"===i){const a=document.createElement("smart-check-box");a.classList.add("case-sensitive"),a.innerHTML="Case sensitive",a.animation=t.animation,a.disabled=t.disabled,a.unfocusable=t.unfocusable,a.checked=!1,e.caseSensitive=a,t.$.mainContainer.appendChild(a)}e.filterBuilderObject={filters:[]},e.cachedFilter={filterBuilder:["and"],caseSensitive:!1}}localizeFilterBuilder(){const e=this.context,t=this.filterBuilder;let a=t.messages[e.locale];a||(a={},t.messages[e.locale]=a),t.customOperations=[{name:"NULL",label:e.localize("null"),hideValue:!0},{name:"NOT_NULL",label:e.localize("notNull"),hideValue:!0}],a.addCondition=e.localize("addCondition"),a.addGroup=e.localize("addGroup"),a["<"]=e.localize("lessThan"),a["<="]=e.localize("lessThanOrEqual"),a["<>"]=e.localize("notEqual"),a["="]=e.localize("equal"),a[">"]=e.localize("greaterThan"),a[">="]=e.localize("greaterThanOrEqual"),a.and=e.localize("and"),a.contains=e.localize("contains"),a.endswith=e.localize("endsWith"),a.isblank=e.localize("empty"),a.isnotblank=e.localize("notEmpty"),a.notcontains=e.localize("doesNotContain"),a.or=e.localize("or"),a.startswith=e.localize("startsWith"),a.dateTabLabel=e.localize("dateTabLabel"),a.timeTabLabel=e.localize("timeTabLabel"),t.formatStringDate=e.formatString,t.formatStringDateTime=e.formatString,t.locale=e.locale,t.valuePlaceholder=e.localize("filterBuilderPlaceholder")}evaluate(e){const t=this,a=t.context;if("default"===a.mode||"basic"===a.mode)return t.filterObject.evaluate(e);if("excel"===a.mode){let l=!1;if(Array.isArray(a.dataSource)){if(!t.customExcelFilterObjects||0===t.customExcelFilterObjects.length)return!0;for(let a=0;a<t.customExcelFilterObjects.length;a++)l=l||t.customExcelFilterObjects[a].evaluate(e);return l}if(t.customItems&&t.customItems.length>0){if(t.filterObject.filters.length>0&&(l=t.filterObject.evaluate(e)),t.customItems&&a.evaluateFilterExpression)for(let i=0;i<t.customItems.length;i++){const s=a.evaluateFilterExpression(e,t.customItems[i].value);void 0!==s&&(l=l||s)}}else l=t.filterObject.evaluate(e);return l}return!t.filterBuilderObject.logicalOperator||function t(a){let l="and"===a.logicalOperator;for(let i=0;i<a.filters.length;i++){let s;s=a.filters[i]instanceof Smart.Utilities.FilterGroup?a.filters[i].evaluate(e):t(a.filters[i]),l="and"===a.logicalOperator?l&&s:l||s}return l}(t.filterBuilderObject)}}),Smart.Utilities.Assign("NumericFilterHandler",class extends Smart.Utilities.BaseFilterHandler{appendInputs(){let e=this,t=document.createElement("smart-number-input"),a=document.createElement("smart-number-input");t.placeholder=e.context.localize("placeholderNumber"),a.placeholder=e.context.localize("placeholderNumber"),t.nullable=!0,t.spinButtons=!0,t.value=null,a.nullable=!0,a.spinButtons=!0,a.value=null,e.firstInput=t,e.secondInput=a}getFilterInputValue(e){return null===e.value||""===e.value?"":parseFloat(e.value)}}),Smart.Utilities.Assign("StringFilterHandler",class extends Smart.Utilities.BaseFilterHandler{setDefaults(){const e=this,t=e.context;e.defaultListSource=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("empty")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("notEmpty")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("contains")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("doesNotContain")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("startsWith")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("endsWith")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("equal")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("notEqual")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("null")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("notNull")}],e.filterBuilderOperations=["contains","isblank","isnotblank","notcontains","startswith","endswith","=","NULL","NOT_NULL"],e.defaultListSelection=2}appendInputs(){const e=this,t=document.createElement("input"),a=document.createElement("input");t.placeholder=e.context.localize("placeholderValue"),t.setAttribute("aria-label",t.placeholder),a.placeholder=e.context.localize("placeholderValue"),a.setAttribute("aria-label",a.placeholder),t.classList.add("smart-input"),a.classList.add("smart-input"),e.firstInput=t,e.secondInput=a,e.firstInputMatchCase.onclick=()=>{e.firstInputMatchCase.classList.toggle("active")},e.secondInputMatchCase.onclick=()=>{e.secondInputMatchCase.classList.toggle("active")};const l=(e,t,a)=>{if(0===e.selectedValues.length)return t.classList.remove("case-sensitive"),void a.classList.remove("case-sensitive");const l=e.selectedValues[0];t.classList.remove("case-sensitive"),a.classList.remove("case-sensitive"),["EQUAL","NOT_EQUAL","CONTAINS","DOES_NOT_CONTAIN","STARTS_WITH","ENDS_WITH"].indexOf(l)>=0&&(t.classList.add("case-sensitive"),a.classList.add("case-sensitive"))};e.firstList.onchange=()=>{l(e.firstList,e.firstInput,e.firstInputMatchCase)},e.secondList.onchange=()=>{l(e.secondList,e.secondInput,e.secondInputMatchCase)},setTimeout((()=>{l(e.firstList,e.firstInput,e.firstInputMatchCase),l(e.secondList,e.secondInput,e.secondInputMatchCase)}),50)}getExcelComparison(e){return""===e?"EMPTY":"EQUAL_CASE_SENSITIVE"}}),Smart.Utilities.Assign("DateFilterHandler",class extends Smart.Utilities.BaseFilterHandler{appendInputs(){let e=this,t=e.context,a=document.createElement("smart-date-input"),l=document.createElement("smart-date-input");t.formatString&&!(t.formatString.indexOf("d")>=0||t.formatString.indexOf("M")>=0||t.formatString.indexOf("y")>=0)&&(a=document.createElement("smart-time-input"),l=document.createElement("smart-time-input")),a.calendarButton=!0,a.editMode="partial",a.formatString=t.formatString,a.dropDownDisplayMode="auto",a.locale=t.locale,a.autoClose=!0,a.messages[t.locale]||(a.messages[t.locale]={}),a.messages[t.locale].dateTabLabel=t.localize("dateTabLabel"),a.messages[t.locale].timeTabLabel=t.localize("timeTabLabel"),a.nullable=!0,a.value=null,l.autoClose=!0,l.calendarButton=!0,l.formatString=t.formatString,l.dropDownDisplayMode="auto",l.locale=t.locale,l.messages[t.locale]||(l.messages[t.locale]={}),l.messages[t.locale].dateTabLabel=t.localize("dateTabLabel"),l.messages[t.locale].timeTabLabel=t.localize("timeTabLabel"),l.nullable=!0,l.value=null,e.firstInput=a,e.secondInput=l}getFilterInputValue(e){if(null===e.value)return"";const t=e.getDate();return"calendar"===this.displayMode&&t.setHours(0,0,0),t}defaultClear(){const e=this;e.firstList.selectedIndexes=[e.defaultListSelection],e.firstInput.value=null,e.logicalOperatorList.selectedIndexes=[0],e.secondList.selectedIndexes=[e.defaultListSelection],e.secondInput.value=null,e.filterObject.clear(),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}getHierarchicalDataSource(e){const t=this,a=t.dataSource,l={},i=[];let s;if("timePicker"!==e){""===a[a.length-1].value&&(s=a[a.length-1],a.pop()),a.forEach((function(e){const a=e.value,i=a.getFullYear(),s=new Intl.DateTimeFormat(t.context.locale,{month:"long"}).format(a);l[i]||(l[i]={}),l[i][s]||(l[i][s]=e.value)}));for(let e in l){const t={expanded:!0,label:e,items:[],customAttribute:"default-item"};i.push(t);for(let a in l[e]){const i={value:l[e][a],expanded:!0,label:a,items:[],customAttribute:"default-item"};t.items.push(i)}}s&&i.push(s),t.dataSource=i}}}),Smart.Utilities.Assign("BooleanFilterHandler",class extends Smart.Utilities.BaseFilterHandler{cacheFilter(e,t,a){const l=this;l.cachedFilter={firstFilterComparison:e,firstFilterValue:l.firstInput.selectedIndexes.slice(0),logicalOperator:t,secondFilterComparison:a,secondFilterValue:l.secondInput.selectedIndexes.slice(0)}}setDefaults(){const e=this,t=e.context;e.defaultListSource=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("equal")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("notEqual")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("null")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("notNull")}],e.filterBuilderOperations=["=","<>","NULL","NOT_NULL"],e.defaultListSelection=0}appendInputs(){const e=this,t=document.createElement("smart-input"),a=document.createElement("smart-input");t.dataSource=[{value:!0,label:"true"},{value:!1,label:"false"}],t.placeholder=e.context.localize("placeholderBoolean"),t.selectedIndexes=[],t.selectionMode="zeroOrOne",t.readonly=!0,t.dropDownButtonPosition="right",a.dataSource=[{value:!0,label:"true"},{value:!1,label:"false"}],a.placeholder=e.context.localize("placeholderBoolean"),a.selectedIndexes=[],a.selectionMode="zeroOrOne",a.readonly=!0,a.dropDownButtonPosition="right",e.firstInput=t,e.secondInput=a}getFilterInputValue(e){return 0===e.selectedValues.length?"":!0===e.selectedValues[0]}defaultClear(){const e=this;e.firstList.selectedIndexes=[e.defaultListSelection],e.firstInput.selectedIndexes=[],e.logicalOperatorList.selectedIndexes=[0],e.secondList.selectedIndexes=[e.defaultListSelection],e.secondInput.selectedIndexes=[],e.filterObject.clear(),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}defaultCancel(){const e=this;e.firstList.selectedIndexes=[e.cachedFilter.firstFilterComparison],e.firstInput.selectedIndexes=e.cachedFilter.firstFilterValue,e.logicalOperatorList.selectedIndexes=[e.cachedFilter.logicalOperator],e.secondList.selectedIndexes=[e.cachedFilter.secondFilterComparison],e.secondInput.selectedIndexes=e.cachedFilter.secondFilterValue}});
|
|
1407
|
+
Smart("smart-filter-panel",class extends Smart.BaseElement{static get properties(){return{buttons:{value:["clear","filter"],type:"array"},data:{value:null,type:"array?",reflectToAttribute:!1},dataField:{value:null,type:"string?"},dataSource:{value:null,type:"any",reflectToAttribute:!1},evaluateFilterExpression:{value:null,type:"function?",reflectToAttribute:!1},filterType:{value:"string",allowedValues:["numeric","string","date","boolean"],type:"string"},formatString:{value:"d",type:"string"},messages:{value:{en:{addCondition:"Add Condition",addGroup:"Add Group",and:"and",blanks:"(Blanks)",cancel:"Cancel",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equal:"equal",equalCaseSensitive:"equal (case sensitive)",filter:"Filter",greaterThan:"greater than",greaterThanOrEqual:"greater than or equal",lessThan:"less than",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notEqual:"not equal",notNull:"not null",null:"null ",or:"or",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME"}},type:"object",extend:!0},mode:{value:"default",allowedValues:["basic","default","excel"],type:"string"}}}static get listeners(){return{"cancelButton.click":"cancel","clearButton.click":"clear","filterButton.click":"filter"}}template(){return'<div id="container" class="smart-container" role="presentation">\n <div id="label" class="smart-filter-panel-label"></div>\n <div id="mainContainer" role="presentation"></div>\n <div id="buttonContainer" class="smart-filter-panel-button-container" role="presentation">\n <smart-button id="filterButton" class="primary" animation="[[animation]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n <smart-button id="clearButton" animation="[[animation]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n <smart-button id="cancelButton" animation="[[animation]]" disabled="[[disabled]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n </div>\n </div>'}static get styleUrls(){return["smart.grid.css","smart.dropdownlist.css","smart.menu.css","smart.filterpanel.css","smart.textbox.css"]}ready(){super.ready()}render(){const e=this,t=e.filterType;e.$.label.id||(e.$.label.id=e.id+"Label"),e.setAttribute("role","dialog"),e.setAttribute("aria-labelledby",e.$.label.id),e._localize(),e._setButtonsVisibility(),e._filterType=t+"Filter",e._filterHandler=new(Smart.Utilities[t.slice(0,1).toUpperCase()+t.slice(1)+"FilterHandler"])(e),super.render()}cancel(){const e=this;e._filterHandler[e.mode+"Cancel"](),e.$.fireEvent("cancel")}clear(){const e=this;e._filterHandler[e.mode+"Clear"](),e.$.fireEvent("clear")}reset(){const e=this;e.$.clearButton.removeAttribute("hover"),e.$.filterButton.removeAttribute("hover"),e.$.cancelButton.removeAttribute("hover"),e._filterHandler.firstInputMatchCase&&e._filterHandler.firstInputMatchCase.classList.remove("active"),e._filterHandler.secondInputMatchCase&&e._filterHandler.secondInputMatchCase.classList.remove("active"),e._filterHandler[e.mode+"Clear"](),e._filterHandler.filterObject=new Smart.Utilities.FilterGroup}getFilter(){if(this._filterHandler){const e=new Smart.Utilities.FilterGroup;for(let t in this._filterHandler.filterObject)e[t]=this._filterHandler.filterObject[t];return e}return null}evaluate(e){try{return this._filterHandler.evaluate(e)}catch(e){return!1}}filter(){const e=this;e._filterHandler[e.mode+"Filter"](),e.$.fireEvent("filter")}getState(){return this._filterHandler.cachedFilter}loadState(e){try{const t=this;t._filterHandler.cachedFilter=e,t._filterHandler[t.mode+"Cancel"]()}catch(e){}}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this,i=l._filterHandler;function s(){l.$.mainContainer.innerHTML="",function(){const e=["cachedFilter","caseSensitive","customExcelFilterObjects","customItems","dataSource","defaultListSelection","defaultListSource","displayMode","filterBuilder","filterBuilderObject","filterBuilderOperations","filterObject","firstInput","firstList","operationsMapping","operatorList","secondInput","secondList","timeOnly","tree"];e.forEach((function(t){delete i[e[t]]})),delete l._filterHandler}(),l._filterHandler=new(Smart.Utilities[l.filterType.slice(0,1).toUpperCase()+l.filterType.slice(1)+"FilterHandler"])(l)}switch(e){case"animation":case"disabled":case"rightToLeft":case"unfocusable":switch(l.mode){case"default":case"basic":[i.firstList,i.firstInput,i.logicalOperatorList,i.secondList,i.secondInput].forEach((function(t){t[e]=a}));break;case"excel":i.tree[e]=a;break;case"filterBuilder":i.filterBuilder[e]=a,i.caseSensitive&&(i.caseSensitive[e]=a)}break;case"buttons":l._setButtonsVisibility();break;case"data":case"dataField":"excel"!==l.mode||Array.isArray(l.dataSource)||s();break;case"dataSource":"excel"===l.mode&&s();break;case"filterType":l._filterType=a+"Filter",s();break;case"mode":s();break;case"formatString":if("date"!==l.filterType)return;switch(l.mode){case"default":case"basic":i.firstInput.formatString=a,i.secondInput.formatString=a;break;case"excel":s();break;case"filterBuilder":i.filterBuilder.formatStringDate=a,i.filterBuilder.formatStringDateTime=a}break;case"locale":case"messages":switch(l._localize(),l.mode){case"default":case"basic":{const t=i.firstList.selectedIndex,a=i.logicalOperatorList.selectedIndex,s=i.secondList.selectedIndex,r=[i.firstInput,i.secondInput];switch(i.setDefaults(),i.firstList.dataSource=JSON.parse(JSON.stringify(i.defaultListSource)),i.logicalOperatorList.dataSource=[{value:0,label:l.localize("and")},{value:1,label:l.localize("or")}],i.secondList.dataSource=JSON.parse(JSON.stringify(i.defaultListSource)),l.filterType){case"date":r.forEach((function(t){t.messages[l.locale]||(t.messages[l.locale]={});const a=l.localize("dateTabLabel");a&&(t.messages[l.locale].dateTabLabel=a);const i=l.localize("timeTabLabel");if(i&&(t.messages[l.locale].timeTabLabel=i),"locale"===e&&(t.locale=l.locale),"timePicker"===t._dropDownDisplayMode){const e=l.localize("placeholderTime");e&&(t.placeholder=e,t.placeholder=e)}else{const e=l.localize("placeholderDate");e&&(t.placeholder=e,t.placeholder=e)}}));break;case"numeric":r[0].placeholder=l.localize("placeholderNumber"),r[1].placeholder=l.localize("placeholderNumber");break;case"string":r[0].placeholder=l.localize("placeholderValue"),r[1].placeholder=l.localize("placeholderValue");break;case"boolean":r[0].placeholder=l.localize("placeholderBoolean"),r[1].placeholder=l.localize("placeholderBoolean")}i.firstList.selectedIndex=t,i.logicalOperatorList.selectedIndex=a,i.secondList.selectedIndex=s;break}case"excel":i.tree.selectAll&&(i.tree.selectAll.label=l.localize("selectAll")),i.tree.blanks&&(i.tree.blanks.label=l.localize("blanks"));break;case"filterBuilder":i.localizeFilterBuilder(),"messages"===e&&(i.filterBuilder._localizeInitialValues(),i.filterBuilder._refresh()),i.filterBuilder.$.scrollableContainer.refresh()}}}_localize(){const e=this;e.localize("showRows")&&(e.$.label.innerHTML=e.localize("showRows")),e.localize("filter")&&(e.$.filterButton.innerHTML=e.localize("filter")),e.localize("clear")&&(e.$.clearButton.innerHTML=e.localize("clear")),e.localize("cancel")&&(e.$.cancelButton.innerHTML=e.localize("cancel"))}_setButtonsVisibility(){const e=this,t=e.buttons;["cancel","clear","filter"].forEach((function(a){-1!==t.indexOf(a)?e["$"+a+"Button"].removeClass("smart-hidden"):e["$"+a+"Button"].addClass("smart-hidden")}))}}),Smart.Utilities.Assign("BaseFilterHandler",class{constructor(e){const t=this;if(t.basicFilter=t.defaultFilter,t.basicClear=t.defaultClear,t.basicCancel=t.defaultCancel,t.context=e,t.filterObject=new Smart.Utilities.FilterGroup,t.setDefaults(),"date"===e.filterType){const a=new Smart.Utilities.DateTime,l=e.formatString,i=a.getParseRegExp(a.calendar,l.replace(/y+/g,"yyyyy"));t.displayMode=Smart.Utilities.DateTime.detectDisplayMode(a,l,i),t.timeOnly="timePicker"===t.displayMode}"default"!==e.mode&&"basic"!==e.mode?(t.operationsMapping={"=":"EQUAL","<>":"NOT_EQUAL","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",isblank:"EMPTY",isnotblank:"NOT_EMPTY",contains:"CONTAINS",notcontains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"},"excel"===e.mode?t.createExcelHTMLStructure():"filterBuilder"===e.mode&&t.createBuilderHTMLStructure()):t.createDefaultHTMLStructure()}setDefaults(){const e=this,t=e.context;e.defaultListSource=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("equal")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("notEqual")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("lessThan")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("lessThanOrEqual")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("greaterThan")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("greaterThanOrEqual")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("null")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("notNull")}],e.filterBuilderOperations=["<","=","<>","<=",">",">=","NULL","NOT_NULL"],e.defaultListSelection=2}createDefaultHTMLStructure(){const e=this,t=e.context,a=document.createElement("smart-input"),l=document.createElement("smart-input"),i=document.createElement("smart-input"),s=document.createDocumentFragment(),r=e=>{e.readonly=!0,e.dropDownButtonPosition="right"};a.classList.add("smart-filter-panel-list"),a.dataSource=JSON.parse(JSON.stringify(this.defaultListSource)),a.selectedIndex=e.defaultListSelection,r(a),l.classList.add("smart-filter-panel-operator-list"),l.dataSource=[{value:0,label:t.localize("and")},{value:1,label:t.localize("or")}],r(l),i.classList.add("smart-filter-panel-list"),i.dataSource=JSON.parse(JSON.stringify(this.defaultListSource)),i.selectedIndex=e.defaultListSelection,r(i),e.firstList=a,e.logicalOperatorList=l,e.secondList=i;const n=document.createElement("span");n.classList.add("smart-icon","smart-icon-font-size"),n.title=t.localize("matchCase");const c=document.createElement("span");c.classList.add("smart-icon","smart-icon-font-size"),c.title=t.localize("matchCase"),e.firstInputMatchCase=n,e.secondInputMatchCase=c,e.appendInputs(),e.firstInput.classList.add("smart-filter-panel-input"),e.secondInput.classList.add("smart-filter-panel-input"),"basic"===t.mode&&(e.secondList.classList.add("smart-hidden"),e.secondInput.classList.add("smart-hidden"),e.logicalOperatorList.classList.add("smart-hidden"),e.secondInputMatchCase.classList.add("smart-hidden")),l.dropDownHeight="auto",l.selectedIndex=0,[a,e.firstInput,e.firstInputMatchCase,l,i,e.secondInput,e.secondInputMatchCase].forEach((function(e){e.animation=t.animation,e.disabled=t.disabled,e.unfocusable=t.unfocusable,e.dropDownPosition="bottom",e.dropDownAppendTo="body",e.dropDownMaxHeight=200,e.rightToLeft=t.rightToLeft,s.appendChild(e)})),e.context.$.mainContainer.appendChild(s),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}cacheFilter(e,t,a){const l=this;l.cachedFilter={firstFilterComparison:e,firstFilterValue:l.firstInput.value,firstFilterCaseSensitive:l.firstInputMatchCase.classList.contains("active"),logicalOperator:t,secondFilterComparison:a,secondFilterValue:l.secondInput.value,secondFilterCaseSensitive:l.secondInputMatchCase.classList.contains("active")}}defaultFilter(){const e=this,t=e.context,a=e.getFilterInputValue(e.firstInput),l=parseFloat(e.logicalOperatorList.selectedValues[0]),i=e.getFilterInputValue(e.secondInput),s=e.filterObject;let r=e.firstList.selectedValues[0],n=e.secondList.selectedValues[0];s.clear();const c=e=>"CONTAINS"===e?"CONTAINS_CASE_SENSITIVE":"DOES_NOT_CONTAIN"===e?"DOES_NOT_CONTAIN_CASE_SENSITIVE":"STARTS_WITH"===e?"STARTS_WITH_CASE_SENSITIVE":"ENDS_WITH"===e?"ENDS_WITH_CASE_SENSITIVE":"EQUAL"===e?"EQUAL_CASE_SENSITIVE":"NOT_EQUAL"===e?"NOT_EQUAL_CASE_SENSITIVE":void 0;if(e.firstInputMatchCase.classList.contains("active")&&(r=c(r)),e.secondInputMatchCase.classList.contains("active")&&(n=c(n)),""!==a||-1!==["NULL","NOT_NULL","EMPTY","NOT_EMPTY"].indexOf(r)){const i=s.createFilter(t._filterType,a,r,void 0,t.formatString,t.locale,"timePicker"===e.firstInput._dropDownDisplayMode);s.addFilter(l,i)}if(""!==i||-1!==["NULL","NOT_NULL","EMPTY","NOT_EMPTY"].indexOf(n)){const a=s.createFilter(t._filterType,i,n,void 0,t.formatString,t.locale,"timePicker"===e.secondInput._dropDownDisplayMode);s.addFilter(l,a)}let o=e.firstList.selectedIndexes[0],d=e.secondList.selectedIndexes[0];const u=s.stringConditions;a&&"string"==typeof a&&(o=u.findIndex((e=>e===r))),i&&"string"==typeof i&&(d=u.findIndex((e=>e===n))),e.cacheFilter(o,e.logicalOperatorList.selectedIndexes[0],d)}getFilterInputValue(e){return e.value}excelFilter(){const e=this,t=e.context;if(Array.isArray(t.dataSource))return void e.customExcelFilter();const a=e.tree,l=e.filterObject;if(l.clear(),e.customItems=[],a._menuItems[0].selected)return void e.excelClear();const i=a.selectedIndexes;if(i.forEach((function(i){const s=a._menuItems[i];if(s instanceof Smart.TreeItem){const a=s.value;if(s.hasAttribute("default-item"))if(a instanceof Date){const i=new Smart.FilterGroup,s=new Date(a.getFullYear(),a.getMonth(),1),r=new Date(a.getFullYear(),a.getMonth()+1,0),n=i.createFilter(t._filterType,s,"GREATER_THAN_OR_EQUAL",void 0,t.formatString,t.locale,e.timeOnly),c=i.createFilter(t._filterType,r,"LESS_THAN_OR_EQUAL",void 0,t.formatString,t.locale,e.timeOnly);i.addFilter("and",n),i.addFilter("and",c),l.addFilter("or",i)}else{const i=e.getExcelComparison(a),s=l.createFilter(t._filterType,a,i,void 0,t.formatString,t.locale,e.timeOnly);l.addFilter("or",s)}else e.customItems.push(s)}})),0===i.length){const a=e.getExcelComparison("Empty Filter"),i=l.createFilter(t._filterType,"Empty Filter",a,void 0,t.formatString,t.locale,e.timeOnly);l.addFilter("or",i)}e.cachedFilter=i.slice(0)}customExcelFilter(){const e=this,t=e.tree;if(delete e.customExcelFilterObjects,t._menuItems[0].selected)return;const a=e.context,l=[],i=t.selectedIndexes;i.forEach((function(i){const s=t._menuItems[i];if(s instanceof Smart.TreeItem){let t=s.value;if(!Array.isArray(t))return;Array.isArray(t[0])||(t=[t]);const i=new Smart.Utilities.FilterGroup;for(let l=0;l<t.length;l++){const s=t[l],r=e.operationsMapping[s[1]],n=i.createFilter(a._filterType,s[2],r,void 0,a.formatString,a.locale,e.timeOnly);i.addFilter("and",n)}l.push(i)}})),e.customExcelFilterObjects=l,e.cachedFilter=i.slice(0)}getExcelComparison(e){return""===e?"NULL":"EQUAL"}filterBuilderFilter(){const e=this,t=e.filterBuilder.value,a="string"===e.context.filterType&&e.caseSensitive.checked,l={filters:[]};!function t(l,i){const s=new Smart.Utilities.FilterGroup,r=l[1];i.logicalOperator=r;for(let n=0;n<l.length;n++){if(1===n)continue;const c=l[n];if(Array.isArray(c))if(Array.isArray(c[0])){const e={filters:[]};i.filters.push(e),t(c,e)}else s.addFilter(r,e.createFilterBuilderFilter(s,c,a))}s.filters.length>0&&i.filters.push(s)}(t,l),e.filterBuilderObject=l,e.cachedFilter={filterBuilder:JSON.parse(JSON.stringify(e.filterBuilder.value),(function(e,t){return/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d{3})Z$/.test(t)?new Date(t):t})),caseSensitive:a}}createFilterBuilderFilter(e,t,a){const l=this.context;let i=this.operationsMapping[t[1]];return a&&-1!==["CONTAINS","DOES_NOT_CONTAIN","STARTS_WITH","ENDS_WITH","EQUAL"].indexOf(i)&&(i+="_CASE_SENSITIVE"),e.createFilter(l._filterType,t[2],i,void 0,l.formatString,l.locale,!1)}defaultClear(){const e=this;e.firstList.selectedIndexes=[e.defaultListSelection],e.firstInput.value="",e.logicalOperatorList.selectedIndexes=[0],e.secondList.selectedIndexes=[e.defaultListSelection],e.secondInput.value="",e.filterObject.clear(),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}excelClear(){const e=this;0!==e.tree.offsetHeight&&e.tree.select("0"),e.filterObject.clear(),e.cachedFilter=e.tree.selectedIndexes.slice(0)}filterBuilderClear(){const e=this;e.filterBuilder.value=["and"],"string"===e.context.filterType&&(e.caseSensitive.checked=!1),e.cachedFilter={filterBuilder:["and"],caseSensitive:!1}}defaultCancel(){const e=this;let t=null,a=null;if(e.filterObject){const l=e.filterObject.stringConditions,i=e.filterObject.numericConditions,s=e.filterObject.booleanConditions,r=e.filterObject.dateConditions;t=l[e.cachedFilter.firstFilterComparison],a=l[e.cachedFilter.secondFilterComparison],e.cachedFilter.firstFilterValue&&"string"!=typeof e.cachedFilter.firstFilterValue&&(!0===e.cachedFilter.firstFilterValue||!1===e.cachedFilter.firstFilterValue?(t=s[e.cachedFilter.firstFilterComparison],a=s[e.cachedFilter.secondFilterComparison]):e.cachedFilter.firstFilterValue&&e.cachedFilter.firstFilterValue instanceof Date?(t=r[e.cachedFilter.firstFilterComparison],a=r[e.cachedFilter.secondFilterComparison]):(t=i[e.cachedFilter.firstFilterComparison],a=i[e.cachedFilter.secondFilterComparison]))}let l=-1;e.firstList.dataSource.find(((e,a)=>{if(e.value===t)return l=a,e}));let i=-1;e.secondList.dataSource.find(((e,t)=>{if(e.value===a)return i=t,e})),e.firstList.selectedIndexes=[l],e.firstInput.value=e.cachedFilter.firstFilterValue,e.cachedFilter.firstFilterCaseSensitive&&e.firstInputMatchCase.classList.add("active"),e.logicalOperatorList.selectedIndexes=[e.cachedFilter.logicalOperator],e.secondList.selectedIndexes=[i],e.secondInput.value=e.cachedFilter.secondFilterValue,e.cachedFilter.firstFilterCaseSensitive&&e.firstInputMatchCase.classList.add("active"),e.cachedFilter.secondFilterCaseSensitive&&e.secondInputMatchCase.classList.add("active")}excelCancel(){const e=this;if(e.cachedFilter&&e.cachedFilter.firstFilterValue){const t=e.cachedFilter.firstFilterValue,a=e.cachedFilter.secondFilterValue,l=e.cachedFilter.firstFilterComparison,i=e.cachedFilter.secondFilterComparison;let s=e.filterObject.stringConditions;if(isNaN(parseFloat(t))||(s=e.filterObject.numericConditions),e.dataSource){let r=[];return e.dataSource.forEach(((e,n)=>{r.push("0."+n),e.label===t||e.label===a?("NOT_EQUAL"!==s[l]&&"DOES_NOT_CONTAIN"!==s[l]||r.pop(),"NOT_EQUAL"!==s[i]&&"DOES_NOT_CONTAIN"!==s[i]||r.pop()):e.label===t&&e.label===a||("EQUAL"!==s[l]&&"EQUAL_CASE_SENSITIVE"!==s[l]&&"CONTAINS"!==s[l]&&"ENDS_WITH"!==s[l]&&"STARTS_WITH"!==s[l]||r.pop(),"EQUAL"!==s[i]&&"EQUAL_CASE_SENSITIVE"!==s[i]&&"CONTAINS"!==s[i]&&"ENDS_WITH"!==s[i]&&"STARTS_WITH"!==s[i]||r.pop())})),void setTimeout((()=>{e.tree.selectedIndexes=r}))}}else if(e.cachedFilter&&e.cachedFilter.filters&&e.dataSource){let t=[];return e.dataSource.forEach(((a,l)=>{t.push("0."+l);let i=!1;e.cachedFilter.filters.forEach((e=>{e.value===a.label&&(i=!0)})),i||t.pop()})),void setTimeout((()=>{e.tree.selectedIndexes=t}))}e.tree.selectedIndexes=e.cachedFilter.slice(0)}filterBuilderCancel(){const e=this;e.filterBuilder.value=e.cachedFilter.filterBuilder,"string"===e.context.filterType&&(e.caseSensitive.checked=e.cachedFilter.caseSensitive)}createExcelHTMLStructure(){const e=this,t=e.context,a=document.createElement("smart-tree"),l={data:t.data,dataField:t.dataField,filterType:t._filterType};if(t.dataSource&&Array.isArray(t.dataSource))e.processCustomDataSource(a);else{if(t.data&&t.dataField||t.error(t.localize("missingProperty")),"date"===t.filterType){l.formatString=t.formatString,l.displayMode=e.displayMode,e.dataSource=e.filterObject.getUniqueValues(l,t);try{e.getHierarchicalDataSource(e.displayMode)}catch(e){t.error(t.localize("mismatchedProperties"))}e.timeOnly?a.classList.add("standard-excel"):a.classList.add("date-excel")}else e.dataSource=e.filterObject.getUniqueValues(l,t),a.classList.add("standard-excel");"function"==typeof t.dataSource&&(e.dataSource=t.dataSource(e.dataSource)||e.dataSource)}a.animation=t.animation,a.disabled=t.disabled,a.unfocusable=t.unfocusable,a.dataSource=[{label:t.localize("selectAll"),value:"",items:e.dataSource,expanded:!0,selected:!0}],a.selectionMode="checkBox",a.hasThreeStates=!0,a.theme=t.theme,a.animation="none",a.toggleMode="arrow",a.rightToLeft=t.rightToLeft,a.addEventListener("collapsing",(function(e){1===e.detail.item.level&&e.preventDefault()})),a._onCompleted=function(){if(e.cachedFilter=a.selectedIndexes.slice(0),a.classList.contains("date-excel"))for(let e in a._menuItems){if("0"===e)continue;const t=a._menuItems[e];t.firstElementChild.style.paddingLeft=20*(t.level-1)-10+"px"}else a._menuItems[0].firstElementChild.style.paddingLeft=0;a.selectAll=a._menuItems[0],a.blanks=a.querySelector('[label="'+t.localize("blanks")+'"]')},e.tree=a,t.$.mainContainer.appendChild(a)}processCustomDataSource(e){const t=this.context.dataSource;e.classList.add("standard-excel"),this.dataSource=t}createBuilderHTMLStructure(){const e=this,t=e.context,a=document.createElement("smart-filter-builder"),l=t.dataField,i="numeric"===t.filterType?"number":t.filterType;if(e.filterBuilder=a,a.animation=t.animation,a.disabled=t.disabled,a.unfocusable=t.unfocusable,a.value=["and"],a.fields=[{label:l,dataField:l,dataType:i,filterOperations:e.filterBuilderOperations}],e.localizeFilterBuilder(),t.$.mainContainer.appendChild(a),"string"===i){const a=document.createElement("smart-check-box");a.classList.add("case-sensitive"),a.innerHTML="Case sensitive",a.animation=t.animation,a.disabled=t.disabled,a.unfocusable=t.unfocusable,a.checked=!1,e.caseSensitive=a,t.$.mainContainer.appendChild(a)}e.filterBuilderObject={filters:[]},e.cachedFilter={filterBuilder:["and"],caseSensitive:!1}}localizeFilterBuilder(){const e=this.context,t=this.filterBuilder;let a=t.messages[e.locale];a||(a={},t.messages[e.locale]=a),t.customOperations=[{name:"NULL",label:e.localize("null"),hideValue:!0},{name:"NOT_NULL",label:e.localize("notNull"),hideValue:!0}],a.addCondition=e.localize("addCondition"),a.addGroup=e.localize("addGroup"),a["<"]=e.localize("lessThan"),a["<="]=e.localize("lessThanOrEqual"),a["<>"]=e.localize("notEqual"),a["="]=e.localize("equal"),a[">"]=e.localize("greaterThan"),a[">="]=e.localize("greaterThanOrEqual"),a.and=e.localize("and"),a.contains=e.localize("contains"),a.endswith=e.localize("endsWith"),a.isblank=e.localize("empty"),a.isnotblank=e.localize("notEmpty"),a.notcontains=e.localize("doesNotContain"),a.or=e.localize("or"),a.startswith=e.localize("startsWith"),a.dateTabLabel=e.localize("dateTabLabel"),a.timeTabLabel=e.localize("timeTabLabel"),t.formatStringDate=e.formatString,t.formatStringDateTime=e.formatString,t.locale=e.locale,t.valuePlaceholder=e.localize("filterBuilderPlaceholder")}evaluate(e){const t=this,a=t.context;if("default"===a.mode||"basic"===a.mode)return t.filterObject.evaluate(e);if("excel"===a.mode){let l=!1;if(Array.isArray(a.dataSource)){if(!t.customExcelFilterObjects||0===t.customExcelFilterObjects.length)return!0;for(let a=0;a<t.customExcelFilterObjects.length;a++)l=l||t.customExcelFilterObjects[a].evaluate(e);return l}if(t.customItems&&t.customItems.length>0){if(t.filterObject.filters.length>0&&(l=t.filterObject.evaluate(e)),t.customItems&&a.evaluateFilterExpression)for(let i=0;i<t.customItems.length;i++){const s=a.evaluateFilterExpression(e,t.customItems[i].value);void 0!==s&&(l=l||s)}}else l=t.filterObject.evaluate(e);return l}return!t.filterBuilderObject.logicalOperator||function t(a){let l="and"===a.logicalOperator;for(let i=0;i<a.filters.length;i++){let s;s=a.filters[i]instanceof Smart.Utilities.FilterGroup?a.filters[i].evaluate(e):t(a.filters[i]),l="and"===a.logicalOperator?l&&s:l||s}return l}(t.filterBuilderObject)}}),Smart.Utilities.Assign("NumericFilterHandler",class extends Smart.Utilities.BaseFilterHandler{appendInputs(){let e=this,t=document.createElement("smart-number-input"),a=document.createElement("smart-number-input");t.placeholder=e.context.localize("placeholderNumber"),a.placeholder=e.context.localize("placeholderNumber"),t.nullable=!0,t.spinButtons=!0,t.value=null,a.nullable=!0,a.spinButtons=!0,a.value=null,e.firstInput=t,e.secondInput=a}getFilterInputValue(e){return null===e.value||""===e.value?"":parseFloat(e.value)}}),Smart.Utilities.Assign("StringFilterHandler",class extends Smart.Utilities.BaseFilterHandler{setDefaults(){const e=this,t=e.context;e.defaultListSource=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("empty")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("notEmpty")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("contains")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("doesNotContain")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("startsWith")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("endsWith")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("equal")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("notEqual")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("null")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("notNull")}],e.filterBuilderOperations=["contains","isblank","isnotblank","notcontains","startswith","endswith","=","NULL","NOT_NULL"],e.defaultListSelection=2}appendInputs(){const e=this,t=document.createElement("input"),a=document.createElement("input");t.placeholder=e.context.localize("placeholderValue"),t.setAttribute("aria-label",t.placeholder),a.placeholder=e.context.localize("placeholderValue"),a.setAttribute("aria-label",a.placeholder),t.classList.add("smart-input"),a.classList.add("smart-input"),e.firstInput=t,e.secondInput=a,e.firstInputMatchCase.onclick=()=>{e.firstInputMatchCase.classList.toggle("active")},e.secondInputMatchCase.onclick=()=>{e.secondInputMatchCase.classList.toggle("active")};const l=(e,t,a)=>{if(0===e.selectedValues.length)return t.classList.remove("case-sensitive"),void a.classList.remove("case-sensitive");const l=e.selectedValues[0];t.classList.remove("case-sensitive"),a.classList.remove("case-sensitive"),["EQUAL","NOT_EQUAL","CONTAINS","DOES_NOT_CONTAIN","STARTS_WITH","ENDS_WITH"].indexOf(l)>=0&&(t.classList.add("case-sensitive"),a.classList.add("case-sensitive"))};e.firstList.onchange=()=>{l(e.firstList,e.firstInput,e.firstInputMatchCase)},e.secondList.onchange=()=>{l(e.secondList,e.secondInput,e.secondInputMatchCase)},setTimeout((()=>{l(e.firstList,e.firstInput,e.firstInputMatchCase),l(e.secondList,e.secondInput,e.secondInputMatchCase)}),50)}getExcelComparison(e){return""===e?"EMPTY":"EQUAL_CASE_SENSITIVE"}}),Smart.Utilities.Assign("DateFilterHandler",class extends Smart.Utilities.BaseFilterHandler{cacheFilter(e,t,a){const l=this;l.cachedFilter={firstFilterComparison:e,firstFilterValue:l.firstInput.getValue(),logicalOperator:t,secondFilterComparison:a,secondFilterValue:l.secondInput.getValue()}}appendInputs(){let e=this,t=e.context,a=document.createElement("smart-date-input"),l=document.createElement("smart-date-input");t.formatString&&!(t.formatString.indexOf("d")>=0||t.formatString.indexOf("M")>=0||t.formatString.indexOf("y")>=0)&&(a=document.createElement("smart-time-input"),l=document.createElement("smart-time-input")),a.calendarButton=!0,a.editMode="partial",a.formatString=t.formatString,a.dropDownDisplayMode="auto",a.locale=t.locale,a.autoClose=!0,a.messages[t.locale]||(a.messages[t.locale]={}),a.messages[t.locale].dateTabLabel=t.localize("dateTabLabel"),a.messages[t.locale].timeTabLabel=t.localize("timeTabLabel"),a.nullable=!0,a.value=null,l.autoClose=!0,l.calendarButton=!0,l.formatString=t.formatString,l.dropDownDisplayMode="auto",l.locale=t.locale,l.messages[t.locale]||(l.messages[t.locale]={}),l.messages[t.locale].dateTabLabel=t.localize("dateTabLabel"),l.messages[t.locale].timeTabLabel=t.localize("timeTabLabel"),l.nullable=!0,l.value=null,e.firstInput=a,e.secondInput=l}getFilterInputValue(e){if(null===e.value)return"";const t=e.getDate();return"calendar"===this.displayMode&&t&&t.setHours(0,0,0),t}defaultClear(){const e=this;e.firstList.selectedIndexes=[e.defaultListSelection],e.firstInput.value=null,e.logicalOperatorList.selectedIndexes=[0],e.secondList.selectedIndexes=[e.defaultListSelection],e.secondInput.value=null,e.filterObject.clear(),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}getHierarchicalDataSource(e){const t=this,a=t.dataSource,l={},i=[];let s;if("timePicker"!==e){""===a[a.length-1].value&&(s=a[a.length-1],a.pop()),a.forEach((function(e){const a=e.value,i=a.getFullYear(),s=new Intl.DateTimeFormat(t.context.locale,{month:"long"}).format(a);l[i]||(l[i]={}),l[i][s]||(l[i][s]=e.value)}));for(let e in l){const t={expanded:!0,label:e,items:[],customAttribute:"default-item"};i.push(t);for(let a in l[e]){const i={value:l[e][a],expanded:!0,label:a,items:[],customAttribute:"default-item"};t.items.push(i)}}s&&i.push(s),t.dataSource=i}}}),Smart.Utilities.Assign("BooleanFilterHandler",class extends Smart.Utilities.BaseFilterHandler{cacheFilter(e,t,a){const l=this;l.cachedFilter={firstFilterComparison:e,firstFilterValue:l.firstInput.selectedIndexes.slice(0),logicalOperator:t,secondFilterComparison:a,secondFilterValue:l.secondInput.selectedIndexes.slice(0)}}setDefaults(){const e=this,t=e.context;e.defaultListSource=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("equal")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("notEqual")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("null")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("notNull")}],e.filterBuilderOperations=["=","<>","NULL","NOT_NULL"],e.defaultListSelection=0}appendInputs(){const e=this,t=document.createElement("smart-input"),a=document.createElement("smart-input");t.dataSource=[{value:!0,label:"true"},{value:!1,label:"false"}],t.placeholder=e.context.localize("placeholderBoolean"),t.selectedIndexes=[],t.selectionMode="zeroOrOne",t.readonly=!0,t.dropDownButtonPosition="right",a.dataSource=[{value:!0,label:"true"},{value:!1,label:"false"}],a.placeholder=e.context.localize("placeholderBoolean"),a.selectedIndexes=[],a.selectionMode="zeroOrOne",a.readonly=!0,a.dropDownButtonPosition="right",e.firstInput=t,e.secondInput=a}getFilterInputValue(e){return 0===e.selectedValues.length?"":!0===e.selectedValues[0]}defaultClear(){const e=this;e.firstList.selectedIndexes=[e.defaultListSelection],e.firstInput.selectedIndexes=[],e.logicalOperatorList.selectedIndexes=[0],e.secondList.selectedIndexes=[e.defaultListSelection],e.secondInput.selectedIndexes=[],e.filterObject.clear(),e.cacheFilter(e.defaultListSelection,0,e.defaultListSelection)}defaultCancel(){const e=this;e.firstList.selectedIndexes=[e.cachedFilter.firstFilterComparison],e.firstInput.selectedIndexes=e.cachedFilter.firstFilterValue,e.logicalOperatorList.selectedIndexes=[e.cachedFilter.logicalOperator],e.secondList.selectedIndexes=[e.cachedFilter.secondFilterComparison],e.secondInput.selectedIndexes=e.cachedFilter.secondFilterValue}});
|
|
1408
1408
|
|
|
1409
1409
|
/***/ }),
|
|
1410
1410
|
|
|
@@ -1418,7 +1418,7 @@ Smart.Utilities.Assign("ConditionalFormatter",class{constructor(e){const t=this;
|
|
|
1418
1418
|
/***/ 9719:
|
|
1419
1419
|
/***/ (() => {
|
|
1420
1420
|
|
|
1421
|
-
Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,e._style){const t=e._style;l.color=t.color,l.background=t.background,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize,l.fontStyle=t.fontStyle,l.textDecoration=t.textDecoration,l.fontWeight=t.fontWeight}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(e,t){if("value"===t)return l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if("editor"===t||"template"===t)return e[t]||l.column[t];if("focused"===t){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!0;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!0;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===t)return!0===l.row.getProperty("selected")||!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField];if("modifiedValue"===t){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const t=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==t?t:e.value}return e[t]},set:function(e,a,i){const n=this.get(e,a);return n===i||(e[a]=i,!("element"!==a&&"isEditing"!==a&&"oldValue"!==a&&"_updating"!==a&&"notifyFn"!==a&&!a.startsWith("_")&&"canNotify"!==a)||("error"===a||("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a&&(void 0===l.oldValue&&(l.oldValue=n),(()=>{l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),null!==i&&i.label&&i.value?(l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value):(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i);const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;l.grid.dataSource&&i!==l.grid.dataSource.boundSource[t][l.column.dataField]&&(l.grid._sortedColumns&&l.grid._sortedColumns.length>0?e[l.column.dataField]=i:l.grid.dataSource.boundSource[t][l.column.dataField]=i)}l.grid.dataSource.boundSource.canNotify=!0})()),"selected"===a&&(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0)),!(!l._updating&&l.canNotify&&(l.grid._recycle(),l.row.canNotify&&(l.propertyChanged&&l.propertyChanged(name.substring(1),n),0)))))))}})}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a=e=>{const a=t[e];""!==a&&null!==a&&(l+=`${e}: ${a};`)},i=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<i.length;e++)a(i[e]);e.getAttribute("style")!==l&&e.setAttribute("style",l),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t)+" - "+l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){const a=l.formatNumber(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat)return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e);!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits?l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits:2,a=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:t,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+a.replace("-","")+")":a}return l.column.formatSettings.Intl.NumberFormat.locale?new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,l.column.formatSettings.Intl.NumberFormat).format(e):new Intl.NumberFormat(this.grid.locale,l.column.formatSettings.Intl.NumberFormat).format(e)}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const n=i.formatNumber(e,t);return void 0===n?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+n+")":n}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let n=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(n=n.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let r=0;r<i._cellsMerge.length;r++){const o=i._cellsMerge[r];let s=[],d=[];if(s.push(o.row),o.rowspan>1){const e=n.indexOf(o.row);if(e>=0)for(let t=e;t<e+o.rowSpan;t++)n[t]&&-1===s.indexOf(n[t])&&s.push(n[t])}if(d.push(o.column.dataField),o.colspan>1){const e=i.columns.indexOf(i.columnByDataField[o.column.dataField]);for(let t=e;t<e+o.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(s.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:o.row.getCell(o.column.dataField),rows:s,columns:d,row:o.row,column:o.column,endRow:s[s.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const n=o.row.getCell(o.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=n,n}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),n=document.createElement("div"),r=document.createElement("div"),o=document.createElement("div"),s=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=o,e.appendChild(a),e.appendChild(r),r.setAttribute("content",""),a.setAttribute("indent",""),n.setAttribute("label",""),i.setAttribute("toggle-button",""),o.setAttribute("checkbox",""),o.setAttribute("role","checkbox"),l.setAttribute("has-toggle-button",""),r.appendChild(i),r.appendChild(o),s.classList.add("smart-input"),o.appendChild(s),d.checkBoxes.visible?s.classList.remove("smart-hidden"):s.classList.add("smart-hidden"),r.appendChild(n),l.content=n}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let n=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(n=!0,e.row.filterRow&&(n=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(n=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(n=!1)),n)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group","");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let n=a.label;const r=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&r(e,i.children,l))}return l};if(void 0!==a.label){let o="",s=[];if(t.grouping.summaryRow.visible){const n=r(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[]),d={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;d[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([d],n):null;if(m)for(let a=0;a<c.length;a++){const i=c[a];a>0&&(o+=", ");let n=m[l.dataField][i];const r=l.cellsFormat;r&&(n=e.cell.getFormattedValue(n,r)),o+=t.localize(i,{value:n}),s.push(m[l.dataField][i])}}if(t.dataSource.virtualDataSourceOnExpand&&(o=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)n="<div header group-advanced><span group></span><span value></span>",o&&(n+="<div summary>",n+=o,n+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let r="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e));t&&t.color?(r=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}n=`<div style="${r}" header group-advanced><span group>${i}: </span><span value>${e}</span>`,o&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=""+o,n+="</span>")}n+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)n="<div header><span group></span><span value></span>",o&&(n+="<div summary>",n+=o,n+="</div>");else{let e=a.label;"object"==typeof e&&l.cellsFormat&&(e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)),n="<div header><span group>"+i+": </span><span value>"+e+"</span>",o&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=" ("+s+")",n+="</span>")}n+="</div>",e.classList.add("smart-grid-column-border-collapse")}else("basic"===t.grouping.renderMode||"multipleColumns"===t.grouping.renderMode)&&(n=a.label,"object"==typeof n&&l.cellsFormat&&(n=a.getCell(l.dataField).getFormattedValue(n,l.cellsFormat)),a.summaryRow?o&&(n+="<div summary>",n+=o,n+="</div>"):o&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=" ("+s+")",n+="</span>"),e.classList.add("smart-grid-column-border-collapse"));e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),n=o}let o=e.firstChild;if(t.dataSource.boundHierarchy&&i){o.children.length<=1&&(e.innerHTML="<div></div>",o=e.firstChild,e._createToggleButton(o,e.cell),o=e.firstChild);const r=o.children[0],s=o.children[1].children[0],d=o.children[1].children[1].firstChild,c=o.children[1].children[2];r.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?s.classList.add("smart-visibility-hidden"):(s.classList.remove("smart-visibility-hidden"),a.expanded?s.setAttribute("toggled",""):s.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",r.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';r.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?s.classList.add("smart-hidden"):(s.classList.remove("smart-hidden"),s.style.marginLeft=""),r.innerHTML=m,c.innerHTML=n,i&&t.grouping.formatFunction){const i={row:a,column:l,cell:e.cell,value:n,template:null};t.grouping.formatFunction(i),i.value!==n?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:n):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(o.innerHTML=n);let s="smart-label";e.style.zIndex="";const d=t.editing.addNewColumn.visible?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l.cellsAlign&&(s+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(s+=" align-"+l.cellsVerticalAlign),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)");if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(s+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(s+=" align-"+l.cellsVerticalAlign)),o.className!==s&&(o.className=s),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,group:{value:n,template:null}};l.formatFunction(t),t.group.value!==n&&(l._treeColumn?o.children[1].children[2].innerHTML=t.group.value:o.innerHTML=t.group.value),null!==t.group.template&&(o.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const n=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:n,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:n,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:n,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:n,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:n,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:n,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:n,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:n,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:n,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:n,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:n,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:n,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:n,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:n,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]),i="string"===a.dataType?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let r="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition)a._filterInfo.condition="",r="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":r="smart-icon-equals";break;case"starts_with":r="smart-icon-starts-with";break;case"ends_with":r="smart-icon-ends-with";break;case"not_equal":r="smart-icon-not-equal";break;case"less_than":r="smart-icon-less-than";break;case"less_than_or_equal":r="smart-icon-less-than-or-equal";break;case"greater_than":r="smart-icon-greater-than";break;case"greater_than_or_equal":r="smart-icon-greater-than-or-equal";break;case"contains":r="smart-icon-contains";break;case"does_not_contain":r="smart-icon-does-not-contain";break;case"range":r="smart-icon-between";break;default:r="smart-icon-search"}let o=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${r} show"></i></div> `;if("string"===a.dataType)o+=`<input class="smart-filter-input-value" data-type="${a.dataType}" /> `,e.innerHTML=o;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;o+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=o,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)o+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=o,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const a=document.createElement("div");a.classList.add("smart-input"),a.classList.add("smart-grid-check-box-cell-editor"),a.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),a.setAttribute("checked","indeterminate"),o=a.outerHTML,e.innerHTML=o,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const s=e.querySelector("input");if(s&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),s.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),s.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),s.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),s.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=s,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&(s.value=a._filterInfo.value,"date"===a.dataType&&(s.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),a.allowFilter||(s.disabled=!0),a.filterEditor)if(a.filterEditor.template){const t=a.filterEditor.template,l=document.createElement("div");a.filterTemplate instanceof HTMLTemplateElement?l.appendChild(t.content.cloneNode(!0)):t instanceof HTMLElement?l.appendChild(t):l.innerHTML=t,e.innerHTML="",e.appendChild(l),l.style.height="100%",l.style.width="100%";const i=e.querySelector("input");i&&(i.onfocus=()=>{e.setAttribute("focus","")},i.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,l)}else void 0!==a.filterEditor.min&&(s.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(s.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(s.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(s.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(s.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(s.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(s.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(s.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(e,t,l){const a=this,i=a.cell.grid,n=a.cell.column;let r=null;switch((!i.editing.enabled||!n.allowEdit||a.cell.readonly||i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.editRow!==a.cell.row)&&a.setAttribute("readonly",""),t){case"checkBox":case"radioButton":case"switchButton":r=document.createElement("span"),r.className="smart-input",e?r.setAttribute("checked",""):null===e?r.setAttribute("checked","indeterminate"):r.removeAttribute("checked"),a.setAttribute("template",a.cell.template);break;case"createdBy":case"updatedBy":{const e=a.cell.row;let o=null,s=null;if(o="createdBy"===t?e.createdBy:e.updatedBy,l.firstElementChild&&l.firstElementChild.hasAttribute("user-id")&&o===parseInt(l.firstElementChild.getAttribute("user-id")))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",a.cell.row.id);let c="";if(null!=o&&-1!==o){s=i.users.find((e=>e.id===o));const e=s,t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,n=document.createElement("span");a&&(n.style.backgroundImage=`url('${e.image}')`,n.className="smart-drop-down-list-selection-image"),c+=l?'<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+';" class="smart-truncate smart-token">'+n.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>":'<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+n.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}d.innerHTML=c;const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),r=m,r.setAttribute("user-id",o),a.setAttribute("template",a.cell.template);break}case"tags":{let t=[];if("number"==typeof e&&(e=""+e),null!==e&&(t=e.indexOf("{")>=0||"[]"===e?JSON.parse(e):e.split(",").map((e=>e.trim()))),l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&n.editor._items&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const o=document.createElement("div");o.classList.add("smart-multi-combo-input"),o.setAttribute("data-field",n.dataField),o.setAttribute("row-id",a.cell.row.id);let s="";if(e)for(let e=0;e<t.length;e++){const l=t[e];let a=null;if(n.editor.dataSource)if("string"==typeof l&&n.editor._items&&n.editor._items[l])a=n.editor._items[l];else for(let e=0;e<n.editor.dataSource.length;e++){const t=n.editor.dataSource[e];if(void 0!==t.value&&void 0!==l&&void 0!==l.value&&t.value===l.value){a=t,n.editor._items||(n.editor._items=[]),n.editor._items[l]=t;break}if(void 0===t.value&&t===l||void 0!==t.value&&""+t.value===l){a=t,n.editor._items||(n.editor._items=[]),n.editor._items[l]=t;break}}else a=l;if(!a)continue;const i="string"==typeof a?a:a.label,r="string"==typeof a?null:a.color,o="string"==typeof a?null:a.image;if(""===i)continue;const d=document.createElement("span");if(o&&(d.style.backgroundImage=`url('${a.image}')`,d.className="smart-drop-down-list-selection-image"),r&&n.editor.colorItems?s+='<span title="'+i+'" data-item="'+i+'" style="background: '+r+"; color: "+new Smart.Color(r).getInvertedColor()+';" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>":s+='<span title="'+i+'" data-item="'+i+'" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>",n.editor.dataSource){if(n.editor.singleSelect){s+="</span>";break}s+='<span class=\'smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else s+="</span>"}if(o.innerHTML=s,o.onpointerdown=e=>{if(e.target&&"#text"!==e.target.nodeName&&e.target.classList.contains("smart-drop-down-list-unselect-button")){const l=e.target.parentNode.getAttribute("data-item");if(t[0]&&t[0].label){const r=t.map((e=>e.value)).indexOf(l);r>=0&&(t.splice(r,1),i.setCellValue(a.cell.row.id,n.dataField,JSON.stringify(t)),e.preventDefault(),e.stopPropagation())}else t.indexOf(l)>=0&&(t.splice(t.indexOf(l),1),i.setCellValue(a.cell.row.id,n.dataField,t.join(", ")),e.preventDefault(),e.stopPropagation())}else if(e.target.classList.contains("smart-drop-down-list-selection-label")){if(i.editing.enabled){const t=e.target.parentElement.parentElement,l=t.getAttribute("data-field"),a=t.getAttribute("row-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}},!n.cellsWrap&&n.allowEdit){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const t=document.createElement("div");t.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),o.classList.add("smart-flex-auto"),i.rightToLeft&&(o.style.direction="rtl"),t.appendChild(o),"input"!==n.editor.template&&t.appendChild(e),r=t,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.previousElementSibling,l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}}else n.cellsWrap||n.allowEdit||o.classList.add("smart-flex-auto"),r=o;a.setAttribute("template",a.cell.template),r.setAttribute("value",e);break}case"dropDownList":case"dropdownlist":case"list":{const t=document.createElement("div");if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(t.innerHTML='<span class="smart-truncate">'+e+"</span>",n.allowEdit){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),t.classList.add("smart-flex-auto"),l.appendChild(t),l.appendChild(e),l.classList.add(a.cell.template.toLowerCase()),r=l,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),n=t.getAttribute("data-field"),r=l.getAttribute("data-id");if(i.beginEdit(r,n),a.cell.column.editor&&a.cell.column.editor.instance){const e=a.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}else r=t;a.setAttribute("template",a.cell.template.toLowerCase()),r.setAttribute("value",e);break}case"password":l.innerHTML=e?'<span class="smart-truncate">'+e.replace(/./g,"*")+"</span>":"",a.setAttribute("template",a.cell.template);break;case"color":l.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${e};"></span>`,a.setAttribute("template",a.cell.template);break;case"autoNumber":r=document.createElement("span"),r.innerHTML=1+a.cell.row.visibleIndex,a.setAttribute("template",a.cell.template);break;case"createdDate":case"createdTime":l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.createdDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.createdDate,"t")+"</span>",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"updatedDate":case"updatedTime":a.cell.row.updatedDate?l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.updatedDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.updatedDate,"t")+"</span>":l.innerHTML="",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"progress":{const t=e?parseInt(100*e)+"%":"0%";if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&t===l.firstElementChild.getAttribute("value"))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const i="white",n=["#D50000","#F4511E","#F6BF26","#33B679"];let r=n[0];r=e<.25?n[0]:e<.5?n[1]:e<.75?n[2]:n[3],l.innerHTML='<div value="'+t+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+t+';"><div title="'+t+'" style="width: 100%; height: 4px; background: '+r+"; color: "+i+';" class="smart-truncate smart-token"></div></div><span>'+t+"</span></div>",a.setAttribute("template",a.cell.template);break}case"images":{if(""===e)return l.innerHTML="",a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")){const t=l.firstElementChild.getAttribute("value");if(e&&e.indexOf(t)>=0)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild.evaluateScroll&&l.firstElementChild.evaluateScroll());if(t&&e&&Array.isArray(e)&&e[0]&&e[0].value&&t.length===e[0].value.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template)}const t=document.createElement("div"),n=document.createElement("div");t.classList.add("container"),n.classList.add("images");let o=e;if("string"==typeof o&&(o.indexOf("http")>=0||o.indexOf("base64")>=0)){let e="";if(o)try{e=JSON.parse(o)}catch(e){console.log(e)}o=e}Array.isArray(o)&&o.forEach((e=>{const l=document.createElement("img");l.src=e.value,l.title=e.label,t.appendChild(l)}));const s=document.createElement("div");s.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");if(d.classList.add("smart-arrow-right","arrowbtn"),n.onpointerdown=e=>{if("IMG"===e.target.nodeName)i._openImagePreviewDialog(e.target),e.stopPropagation(),e.preventDefault();else if("DIV"===e.target.nodeName&&e.target.classList.contains("arrowbtn")){let l=parseInt(t.style.marginLeft);isNaN(l)&&(l=0);const i=s===e.target,n=t.scrollWidth-a.offsetWidth+30;t.style.marginLeft=i?Math.min(0,l+25)+"px":Math.max(-n,l-25)+"px",l=parseInt(t.style.marginLeft),0===l?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),e.stopPropagation(),e.preventDefault()}},t.children.length){n.appendChild(t);const e=25*o.length;e-a.offsetWidth+30>30&&(n.appendChild(s),n.appendChild(d)),n.evaluateScroll=()=>{const l=e-a.offsetWidth+30;t.style.marginLeft="0px",s.classList.add("smart-hidden"),l<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),l>30&&(n.appendChild(s),n.appendChild(d))},r=n}else r=document.createElement("div");a.setAttribute("template",a.cell.template),e&&e[0]&&e[0].value?r.setAttribute("value",e[0].value):o&&o[0]&&o[0].label?r.setAttribute("value",o[0].label):r.setAttribute("value",e);break}case"email":Smart.Validator&&(r=document.createElement("span"),Smart.Validator.email(e)?r.innerHTML=e:(r.className="url",r.innerHTML='<a href="mailto:'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()})),a.setAttribute("template",a.cell.template);break;case"url":Smart.Validator&&(r=document.createElement("span"),r.className="url",Smart.Validator.url(e)?r.innerHTML='<a href="https://'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>":r.innerHTML='<a href="'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()}),a.setAttribute("template",a.cell.template);break;default:{let t=null;a.setAttribute("template","");const r=a.cell.row,o=l;let s=a.cell.getFormattedValue(e,n.cellsFormat);if(o.style.lineHeight="","function"==typeof a.cell.template){const t={row:r,column:n,cell:a.cell,oldValue:a.cell.oldValue,value:e,template:null};let l=o.querySelector(".smart-grid-cell-template");l&&l.getAttribute("column")===n.dataField?t.template=l.firstElementChild:l=null,a.formattedValue!==s&&(l=null),a.cell.canNotify=!1,r.canNotify=!1;const i=Object.assign({},{background:a.cell.background,color:a.cell.color,fontSize:a.cell.fontSize,fontFamily:a.cell.fontFamily,fontWeight:a.cell.fontWeight,textDecoration:a.cell.textDecoration,fontStyle:a.cell.fontStyle});if(a.cell.template(t),!l&&t.template)if(t.template instanceof HTMLElement){const e=document.createElement("div");e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),o.innerHTML="",o.appendChild(e),e.appendChild(t.template)}else o.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+t.template+"</div>";else l||null!==t.template||(o.innerHTML=e);o.style.background===i.background&&o.style.color===i.color&&o.style.fontSize===i.fontSize&&o.style.fontWeight===i.fontWeight&&o.style.fontStyle===i.fontStyle||(a.cell._styleChanged=!0,a.cell._setStyle(o)),a.cell.background!==i.background||a.cell.color!==i.color||a.cell.fontSize!==i.fontSize||a.cell.fontWeight!==i.fontWeight||a.cell.fontStyle!==i.fontStyle?(a.cell._styleChanged=!0,a.cell._setStyle(o)):a.cell._styleChanged&&a.cell._setStyle(o),void 0===a.cell.oldValue&&(a.cell.oldValue=e),a.formattedValue=s,a.cell.canNotify=!0,r.canNotify=!0}else{if(""!==o.textContent&&(o.textContent=""),a.cell.template instanceof HTMLTemplateElement)t=a.cell.template;else if(a.cell.template instanceof HTMLElement){const t=a.cell.template.innerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);o.innerHTML!==t&&(o.innerHTML=t)}if(a.cell.template.startsWith&&a.cell.template.startsWith("#")&&(t=document.querySelector(a.cell.template)),t){let l=t.content.cloneNode(!0).firstElementChild;const d=e;if(e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),l.querySelector("[smart-if]")){const t=l.querySelector("[smart-else]"),a=l.querySelectorAll("[smart-if]");let i=!1;for(let t=0;t<a.length;t++){const r=a[t],o=r.getAttribute("smart-if").split(" "),s=o[1].trim();let c=o[2].trim(),m=e;switch("Today"===c&&(c=new Date),"date"===n.dataType&&(e=new Date(d).getTime(),c=new Date(c).getTime()),s){case">":e>parseFloat(c)&&(l=r,i=!0);break;case">=":e>=parseFloat(c)&&(l=r,i=!0);break;case"=":case"==":case"===":e===c&&(l=r,i=!0);break;case"<":e<parseFloat(c)&&(l=r,i=!0);break;case"<=":e<=parseFloat(c)&&(l=r,i=!0)}if(e=m,i)break}!i&&t&&(l=t)}let c=l.outerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);for(c.indexOf("{{value=")>=0&&(e?(c=c.substring(0,c.indexOf("{{value="))+e+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const t=c.indexOf("{{value::"),l=c.substring(t+9,c.indexOf("}}")),i=a.cell.getFormattedValue(e,l);c=c.replace(`{{value::${l}}}`,i)}if(n._treeColumn){const e=o.firstChild;if(e&&e.classList&&a.toggleButton&&n._treeColumn&&o.children[1]){const e=o.children[0],t=o.children[1].children[0],l=o.children[1].children[1].firstChild,a=o.children[1].children[2];let n="";if(i.grouping.enabled){let e=r.level-1;"multipleColumns"!==i.grouping.renderMode&&(n+='<div style="width: '+(1+e)*i.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<r.level;e++)n+="<div class='smart-indent'></div>";r.checked?l.setAttribute("checked",""):!1===r.checked?l.removeAttribute("checked"):null===r.checked&&l.setAttribute("checked","indeterminate"),r.leaf?r.allowCheck?l.classList.remove("smart-visibility-hidden"):l.classList.add("smart-visibility-hidden"):r.allowCheck?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),r.allowCheck?i.checkBoxes.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"):i.checkBoxes.visible||l.classList.add("smart-hidden"),e.innerHTML=n,t.classList.add("smart-visibility-hidden"),r.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),r.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),r.data.isEmpty&&t.classList.add("smart-visibility-hidden"),a.innerHTML=c,i.appearance.showTooltips?a.setAttribute("title",s):a.hasAttribute("title")&&a.removeAttribute("title")}}else o.innerHTML!==c&&(o.innerHTML=c)}else if("string"==typeof a.cell.template){""===e&&(e=" ");const t=a.cell.template.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);o.innerHTML!==t&&(o.innerHTML=t)}}if("auto"===a.cell.row.height||i.layout.allowCellsWrap||"auto"===i.layout.rowHeight){const e=o.querySelector(".smart-grid-cell-template");if(e){r._templatesHeight||(r._templatesHeight=[]);const t=(e,t)=>{if(e){const l=i.rowById[e.getAttribute("data-id")];l._templatesHeight[n.dataField]=t,l._isDirty=!0,l.autoSize(),delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),i.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(r)return l.innerHTML="",l.appendChild(r),a.cell._setStyle(l),r}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,n=a._isMeasureRow?null:l.cellsFormat;if(t.grouping.enabled&&t.dataSource.groupBy.length>0){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button");let r=l.displayField?i[l.displayField]:i[l.dataField];null!==r||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(r=0),"string"===l.dataType&&(r=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(r=!1),"date"===l.dataType&&(r=new Date)),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(r="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row");const o=t=>t?t.startsWith("off_")?(e.classList.remove(t.substring(4)),!1):(e.classList.add(t),e.setAttribute("customCSS",t),!0):(e.setAttribute("highlight",""),!0);if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS"),e.classList.remove(t)}if(l.highlight&&!a.summaryRow&&(o(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]&&o(t.highlightedCells[a.id][l.dataField]),t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]&&o(t.highlightedRows[a.id]),t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),r=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,r=e.cell.value),void 0===r&&(r="");let s=r;n?s=e.cell.getFormattedValue(r,n):l.formatSettings&&l.formatSettings.Intl&&(s=e.cell.getFormattedValue(r,l.formatSettings.Intl));const d=e.firstChild;if(e.content=d,l._isDirty&&(d.innerHTML=""),d.hasAttribute("data-field")&&d.getAttribute("data-field")!==l.dataField&&(d.innerHTML=""),d.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];d.firstChild&&d.removeChild(d.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?d.appendChild(t):d.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return d.firstChild&&d.removeChild(d.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void d.appendChild(t)}e.cell.value!==r&&(s=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,r,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,r,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);for(let n=0;n<i.length;n++){let o=i[n];const s={index:a.visibleIndex,value:r,dataField:l.dataField,row:a,api:t};l.cellsCSSRules[o](s)&&(e.classList.add(o),e.__classNames=[o])}}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const c=e._getCellAlignment(a,l),m=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let u="";if(c.align&&(u+=c.align+" "),c.verticalAlign&&(u+=c.verticalAlign+" "),l.cellsWrap&&(u+="wrap "),u+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let p=l.left;if(t.rightToLeft?e.style.right!==p+"px"&&(e.style.right=p+"px"):e.style.left!==p+"px"&&(e.style.left=p+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),u+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command",""),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze","")),l.cellsRotationAngle){if(!e._rotateCellContent(d,l,r))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(d));d.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)d.innerHTML="";else if(l.autoGenerated&&(d.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let n in a){const r=l.cellsFormat;let o=a[n];r&&r.indexOf("p")>=0&&"count"===n?o=a[n]:r&&"date"!==l.dataType&&(o=e.cell.getFormattedValue(o,r)),i.push(t.localize(n,{value:o}))}const n=i.join(", "),r=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let o=`<div title = "${n}" class="smart-truncate summary-value" > <span class="label">${n}</span>${r}</div> `;if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;o=`<div title = "${n}" class="smart-truncate summary-value" > <span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> <span class="label">${n}</span>${r}</div> `}d.innerHTML!==o&&(d.innerHTML=o)}else if(t.summaryRow.editing&&l.allowSummary)if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value" ><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;d.innerHTML!==l&&(d.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value" ><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;d.innerHTML!==e&&(d.innerHTML=e)}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?d.firstElementChild.setAttribute("has-summary",""):d.firstElementChild.removeAttribute("has-summary"),d.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),d._clickTarget=e.target},d.onpointerup=l=>{d._clickTarget===l.target&&(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="";if(l=a.showDetail?'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggled toggle-button></button>':'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggle-button></button>',t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,d.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):d.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(d.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else d.innerHTML!==l&&(d.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)d.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let n="";for(let e=0;e<t;e++)n+="A";return n+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?d.textContent="":d.textContent=l(a)}else if(m)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)d.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)d.innerHTML=r;else switch(e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(r,e.cell.template,d);break;case"tags":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(r,e.cell.template,d);break;case"image":e._setTemplate(r,"images",d);break;case"email":e._setTemplate(r,"email",d);break;case"url":e._setTemplate(r,"url",d);break;default:e._setTemplate(r,e.cell.template,d)}else{const i=d.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&d.children[1]){const e=d.children[0],i=d.children[1].children[0],n=d.children[1].children[1].firstChild,r=d.children[1].children[2];let o="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?o="":"multipleColumns"!==t.grouping.renderMode&&(o+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)o+="<div class='smart-indent'></div>";if(a.checked?n.setAttribute("checked",""):!1===a.checked?n.removeAttribute("checked"):null===a.checked&&n.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?n.classList.remove("smart-visibility-hidden"):n.classList.add("smart-visibility-hidden"):a.allowCheck?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(d)}}a.allowCheck?t.checkBoxes.visible?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden"):t.checkBoxes.visible||n.classList.add("smart-hidden"),e.innerHTML=o,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),r.innerHTML=s,t.appearance.showTooltips?r.setAttribute("title",s):r.hasAttribute("title")&&r.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let n=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(n+=l.computedWidth)}e.style.width=n+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let n=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let n=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(n+=l.cellHeight)}e.style.height=n+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const o="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(r,a.visibleIndex,a.data),s=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(s>l[0]&&s<l[1]){d=!0;break}}if(a._rowSpan=o,o&&!d){let r=0;t._cellRowSpan.push([s,s+o,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(o,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=s;e<=s+o-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(r+=l.cellHeight)}e.style.height=r+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",o),i._styleChanged=!0,n=o}}1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width="",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===n&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),d.textContent===s||l.formatFunction||(d.textContent=s),i.column.autoGenerated||i._setStyle(d),t.appearance.showTooltips?d.setAttribute("title",i.tooltip||s):d.hasAttribute("title")&&d.removeAttribute("title")}else d.textContent=s}}if(d.className!==u&&(d.className=u),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&d.firstChild&&d.firstChild.classList&&d.firstChild.classList.contains("smart-grid-cell-loading")&&(d.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),d.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const t={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:r,formattedValue:s,template:null};e.cell.canNotify=!1,a.canNotify=!1;const i=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});await l.formatFunction(t),d.style.background===i.background&&d.style.color===i.color&&d.style.fontSize===i.fontSize&&d.style.fontFamily===i.fontFamily&&d.style.textDecoration===i.textDecoration&&d.style.fontWeight===i.fontWeight&&d.style.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(d)),e.cell.background===i.background&&e.cell.color===i.color&&e.cell.fontSize===i.fontSize&&e.cell.fontWeight===i.fontWeight&&e.cell.textDecoration===i.textDecoration&&e.cell.fontFamily===i.fontFamily&&e.cell.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(d));let n=!0;if(t.value!==r&&(e.toggleButton?d.children[1].children[2].innerHTML=t.value:d.innerHTML=t.value,n=!1),null!==t.template){if(e.toggleButton){const e=d.children[1].children[2];e.innerHTML!==t.template&&(e.innerHTML=t.template)}else if(d.innerHTML!==t.template){const e=document.createElement("div");e.innerHTML=t.template,e.innerHTML!==d.innerHTML&&(d.innerHTML=t.template)}n=!1}n&&(l.cellsFormat?d.textContent=s:d.textContent=r),e.cell.canNotify=!0,a.canNotify=!0}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,d),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&d.querySelector("[toggle-button]")){const e=d.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),n=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),n.appendChild(l),n.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(n),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const n=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-n.top+"px",i.style.left=a._offsetLeft(l)-n.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,n=e.row,r=e.row.index,o=n._style;if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][r];a.cell.canNotify=!1,n.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,n.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,n.canNotify=!1,o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,n.canNotify=!0)}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const n={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":n.align="align-left";break;case"center":case"middle":n.align="align-center";break;case"right":n.align="align-right"}switch(a){case"top":n.verticalAlign="align-top";break;case"center":case"middle":n.verticalAlign="align-middle";break;case"bottom":n.verticalAlign="align-bottom"}return n}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});
|
|
1421
|
+
Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,e._style){const t=e._style;l.color=t.color,l.background=t.background,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize,l.fontStyle=t.fontStyle,l.textDecoration=t.textDecoration,l.fontWeight=t.fontWeight}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(e,t){if("value"===t)return l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if("editor"===t||"template"===t)return e[t]||l.column[t];if("focused"===t){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!0;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!0;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===t)return!0===l.row.getProperty("selected")||!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField];if("modifiedValue"===t){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const t=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==t?t:e.value}return e[t]},set:function(e,a,i){const n=this.get(e,a);return n===i||(e[a]=i,!("element"!==a&&"isEditing"!==a&&"oldValue"!==a&&"_updating"!==a&&"notifyFn"!==a&&!a.startsWith("_")&&"canNotify"!==a)||("error"===a||("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a&&(void 0===l.oldValue&&(l.oldValue=n),(()=>{l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),null!==i&&i.label&&i.value?(l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value):(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i);const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;l.grid.dataSource&&i!==l.grid.dataSource.boundSource[t][l.column.dataField]&&(l.grid._sortedColumns&&l.grid._sortedColumns.length>0?e[l.column.dataField]=i:l.grid.dataSource.boundSource[t][l.column.dataField]=i)}l.grid.dataSource.boundSource.canNotify=!0})()),"selected"===a&&(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0)),!(!l._updating&&l.canNotify&&(l.grid._recycle(),l.row.canNotify&&(l.propertyChanged&&l.propertyChanged(name.substring(1),n),0)))))))}})}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},i=e=>{const i=t[e];if(""===i||null===i)return;const n=a[e];l+=`${n}: ${i};`},n=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<n.length;e++)i(n[e]);e.getAttribute("style")!==l&&e.setAttribute("style",l),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t)+" - "+l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){const a=l.formatNumber(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat)return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e);!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits?l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits:2,a=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:t,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+a.replace("-","")+")":a}return l.column.formatSettings.Intl.NumberFormat.locale?new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,l.column.formatSettings.Intl.NumberFormat).format(e):new Intl.NumberFormat(this.grid.locale,l.column.formatSettings.Intl.NumberFormat).format(e)}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const n=i.formatNumber(e,t);return void 0===n?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+n+")":n}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let n=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(n=n.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let r=0;r<i._cellsMerge.length;r++){const o=i._cellsMerge[r];let s=[],d=[];if(s.push(o.row),o.rowspan>1){const e=n.indexOf(o.row);if(e>=0)for(let t=e;t<e+o.rowSpan;t++)n[t]&&-1===s.indexOf(n[t])&&s.push(n[t])}if(d.push(o.column.dataField),o.colspan>1){const e=i.columns.indexOf(i.columnByDataField[o.column.dataField]);for(let t=e;t<e+o.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(s.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:o.row.getCell(o.column.dataField),rows:s,columns:d,row:o.row,column:o.column,endRow:s[s.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const n=o.row.getCell(o.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=n,n}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),n=document.createElement("div"),r=document.createElement("div"),o=document.createElement("div"),s=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=o,e.appendChild(a),e.appendChild(r),r.setAttribute("content",""),a.setAttribute("indent",""),n.setAttribute("label",""),i.setAttribute("toggle-button",""),o.setAttribute("checkbox",""),o.setAttribute("role","checkbox"),l.setAttribute("has-toggle-button",""),r.appendChild(i),r.appendChild(o),s.classList.add("smart-input"),o.appendChild(s),d.checkBoxes.visible?s.classList.remove("smart-hidden"):s.classList.add("smart-hidden"),r.appendChild(n),l.content=n}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let n=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(n=!0,e.row.filterRow&&(n=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(n=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(n=!1)),n)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group","");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let n=a.label;const r=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&r(e,i.children,l))}return l};if(void 0!==a.label){let o="",s=[];if(t.grouping.summaryRow.visible){const n=r(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[]),d={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;d[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([d],n):null;if(m)for(let a=0;a<c.length;a++){const i=c[a];a>0&&(o+=", ");let n=m[l.dataField][i];const r=l.cellsFormat;r&&(n=e.cell.getFormattedValue(n,r)),o+=t.localize(i,{value:n}),s.push(m[l.dataField][i])}}if(t.dataSource.virtualDataSourceOnExpand&&(o=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)n="<div header group-advanced><span group></span><span value></span>",o&&(n+="<div summary>",n+=o,n+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let r="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e));t&&t.color?(r=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}n=`<div style="${r}" header group-advanced><span group>${i}: </span><span value>${e}</span>`,o&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=""+o,n+="</span>")}n+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)n="<div header><span group></span><span value></span>",o&&(n+="<div summary>",n+=o,n+="</div>");else{let e=a.label;"object"==typeof e&&l.cellsFormat&&(e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)),n="<div header><span group>"+i+": </span><span value>"+e+"</span>",o&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=" ("+s+")",n+="</span>")}n+="</div>",e.classList.add("smart-grid-column-border-collapse")}else("basic"===t.grouping.renderMode||"multipleColumns"===t.grouping.renderMode)&&(n=a.label,"object"==typeof n&&l.cellsFormat&&(n=a.getCell(l.dataField).getFormattedValue(n,l.cellsFormat)),a.summaryRow?o&&(n+="<div summary>",n+=o,n+="</div>"):o&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=" ("+s+")",n+="</span>"),e.classList.add("smart-grid-column-border-collapse"));e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),n=o}let o=e.firstChild;if(t.dataSource.boundHierarchy&&i){o.children.length<=1&&(e.innerHTML="<div></div>",o=e.firstChild,e._createToggleButton(o,e.cell),o=e.firstChild);const r=o.children[0],s=o.children[1].children[0],d=o.children[1].children[1].firstChild,c=o.children[1].children[2];r.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?s.classList.add("smart-visibility-hidden"):(s.classList.remove("smart-visibility-hidden"),a.expanded?s.setAttribute("toggled",""):s.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",r.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';r.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?s.classList.add("smart-hidden"):(s.classList.remove("smart-hidden"),s.style.marginLeft=""),r.innerHTML=m,c.innerHTML=n,i&&t.grouping.formatFunction){const i={row:a,column:l,cell:e.cell,value:n,template:null};t.grouping.formatFunction(i),i.value!==n?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:n):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(o.innerHTML=n);let s="smart-label";e.style.zIndex="";const d=t.editing.addNewColumn.visible?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l.cellsAlign&&(s+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(s+=" align-"+l.cellsVerticalAlign),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)");if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(s+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(s+=" align-"+l.cellsVerticalAlign)),o.className!==s&&(o.className=s),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,group:{value:n,template:null}};l.formatFunction(t),t.group.value!==n&&(l._treeColumn?o.children[1].children[2].innerHTML=t.group.value:o.innerHTML=t.group.value),null!==t.group.template&&(o.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const n=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:n,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:n,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:n,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:n,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:n,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:n,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:n,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:n,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:n,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:n,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:n,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:n,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:n,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:n,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]),i="string"===a.dataType?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let r="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition)a._filterInfo.condition="",r="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":r="smart-icon-equals";break;case"starts_with":r="smart-icon-starts-with";break;case"ends_with":r="smart-icon-ends-with";break;case"not_equal":r="smart-icon-not-equal";break;case"less_than":r="smart-icon-less-than";break;case"less_than_or_equal":r="smart-icon-less-than-or-equal";break;case"greater_than":r="smart-icon-greater-than";break;case"greater_than_or_equal":r="smart-icon-greater-than-or-equal";break;case"contains":r="smart-icon-contains";break;case"does_not_contain":r="smart-icon-does-not-contain";break;case"range":r="smart-icon-between";break;default:r="smart-icon-search"}let o=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${r} show"></i></div> `;if("string"===a.dataType)o+=`<input class="smart-filter-input-value" data-type="${a.dataType}" /> `,e.innerHTML=o;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;o+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=o,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)o+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=o,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const a=document.createElement("div");a.classList.add("smart-input"),a.classList.add("smart-grid-check-box-cell-editor"),a.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),a.setAttribute("checked","indeterminate"),o=a.outerHTML,e.innerHTML=o,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const s=e.querySelector("input");if(s&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),s.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),s.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),s.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),s.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=s,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&(s.value=a._filterInfo.value,"date"===a.dataType&&(s.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),a.allowFilter||(s.disabled=!0),a.filterEditor)if(a.filterEditor.template){const t=a.filterEditor.template,l=document.createElement("div");a.filterTemplate instanceof HTMLTemplateElement?l.appendChild(t.content.cloneNode(!0)):t instanceof HTMLElement?l.appendChild(t):l.innerHTML=t,e.innerHTML="",e.appendChild(l),l.style.height="100%",l.style.width="100%";const i=e.querySelector("input");i&&(i.onfocus=()=>{e.setAttribute("focus","")},i.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,l)}else void 0!==a.filterEditor.min&&(s.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(s.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(s.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(s.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(s.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(s.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(s.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(s.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(e,t,l){const a=this,i=a.cell.grid,n=a.cell.column;let r=null;switch((!i.editing.enabled||!n.allowEdit||a.cell.readonly||"none"===i.editing.action||i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.editRow!==a.cell.row)&&a.setAttribute("readonly",""),t){case"checkBox":case"radioButton":case"switchButton":r=document.createElement("span"),r.className="smart-input",e?r.setAttribute("checked",""):null===e?r.setAttribute("checked","indeterminate"):r.removeAttribute("checked"),a.setAttribute("template",a.cell.template);break;case"checklist":if(e&&e.indexOf("[")>=0&&(e=JSON.parse(e)),l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&l.firstElementChild.getAttribute("value")===e.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(e&&Array.isArray(e)&&e.length>0){const t=e.filter((e=>e.completed)).length;e=i.localize("completed",{value:t})+"/"+e.length}else e="";r=document.createElement("span"),r.innerHTML=e,a.setAttribute("template",a.cell.template),r.setAttribute("value",e.length);break;case"createdBy":case"updatedBy":{const e=a.cell.row;let o=null,s=null;if(o="createdBy"===t?e.createdBy:e.updatedBy,l.firstElementChild&&l.firstElementChild.hasAttribute("user-id")&&o===parseInt(l.firstElementChild.getAttribute("user-id")))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",a.cell.row.id);let c="";if(null!=o&&-1!==o){s=i.users.find((e=>e.id===o));const e=s,t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,n=document.createElement("span");a&&(n.style.backgroundImage=`url('${e.image}')`,n.className="smart-drop-down-list-selection-image"),c+=l?'<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+';" class="smart-truncate smart-token">'+n.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>":'<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+n.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}d.innerHTML=c;const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),r=m,r.setAttribute("user-id",o),a.setAttribute("template",a.cell.template);break}case"tags":{let t=[];if("number"==typeof e&&(e=""+e),null!==e&&(t=e.indexOf("{")>=0||"[]"===e?JSON.parse(e):e.split(",").map((e=>e.trim()))),l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&n.editor._items&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const o=document.createElement("div");o.classList.add("smart-multi-combo-input"),o.setAttribute("data-field",n.dataField),o.setAttribute("row-id",a.cell.row.id);let s="";if(e)for(let e=0;e<t.length;e++){const l=t[e];let a=null;if(n.editor.dataSource)if("string"==typeof l&&n.editor._items&&n.editor._items[l])a=n.editor._items[l];else for(let e=0;e<n.editor.dataSource.length;e++){const t=n.editor.dataSource[e];if(void 0!==t.value&&void 0!==l&&void 0!==l.value&&t.value===l.value){a=t,n.editor._items||(n.editor._items=[]),n.editor._items[l]=t;break}if(void 0===t.value&&t===l||void 0!==t.value&&""+t.value===l){a=t,n.editor._items||(n.editor._items=[]),n.editor._items[l]=t;break}}else a=l;if(!a)continue;const i="string"==typeof a?a:a.label,r="string"==typeof a?null:a.color,o="string"==typeof a?null:a.image;if(""===i)continue;const d=document.createElement("span");if(o&&(d.style.backgroundImage=`url('${a.image}')`,d.className="smart-drop-down-list-selection-image"),r&&n.editor.colorItems?s+='<span title="'+i+'" data-item="'+i+'" style="background: '+r+"; color: "+new Smart.Color(r).getInvertedColor()+';" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>":s+='<span title="'+i+'" data-item="'+i+'" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>",n.editor.dataSource){if(n.editor.singleSelect){s+="</span>";break}s+='<span class=\'smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else s+="</span>"}if(o.innerHTML=s,o.onpointerdown=e=>{if(e.target&&"#text"!==e.target.nodeName&&e.target.classList.contains("smart-drop-down-list-unselect-button")){const l=e.target.parentNode.getAttribute("data-item");if(t[0]&&t[0].label){const r=t.map((e=>e.value)).indexOf(l);r>=0&&(t.splice(r,1),i.setCellValue(a.cell.row.id,n.dataField,JSON.stringify(t)),e.preventDefault(),e.stopPropagation())}else t.indexOf(l)>=0&&(t.splice(t.indexOf(l),1),i.setCellValue(a.cell.row.id,n.dataField,t.join(", ")),e.preventDefault(),e.stopPropagation())}else if(e.target.classList.contains("smart-drop-down-list-selection-label")){if(i.editing.enabled){const t=e.target.parentElement.parentElement,l=t.getAttribute("data-field"),a=t.getAttribute("row-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}},!n.cellsWrap&&n.allowEdit&&i.editing.enabled){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const t=document.createElement("div");t.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),o.classList.add("smart-flex-auto"),i.rightToLeft&&(o.style.direction="rtl"),t.appendChild(o),"input"!==n.editor.template&&t.appendChild(e),r=t,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.previousElementSibling,l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}}else n.cellsWrap||n.allowEdit||o.classList.add("smart-flex-auto"),r=o;a.setAttribute("template",a.cell.template),r.setAttribute("value",e);break}case"dropDownList":case"dropdownlist":case"list":{const t=document.createElement("div");if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(t.innerHTML='<span class="smart-truncate">'+e+"</span>",n.allowEdit&&i.editing.enabled){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),t.classList.add("smart-flex-auto"),l.appendChild(t),l.appendChild(e),l.classList.add(a.cell.template.toLowerCase()),r=l,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),n=t.getAttribute("data-field"),r=l.getAttribute("data-id");if(i.beginEdit(r,n),a.cell.column.editor&&a.cell.column.editor.instance){const e=a.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}else r=t;a.setAttribute("template",a.cell.template.toLowerCase()),r.setAttribute("value",e);break}case"password":l.innerHTML=e?'<span class="smart-truncate">'+e.replace(/./g,"*")+"</span>":"",a.setAttribute("template",a.cell.template);break;case"color":l.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${e};"></span>`,a.setAttribute("template",a.cell.template);break;case"autoNumber":r=document.createElement("span"),r.innerHTML=1+a.cell.row.visibleIndex,a.setAttribute("template",a.cell.template);break;case"createdDate":case"createdTime":l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.createdDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.createdDate,"t")+"</span>",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"updatedDate":case"updatedTime":a.cell.row.updatedDate?l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.updatedDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.updatedDate,"t")+"</span>":l.innerHTML="",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"progress":{const t=e?parseInt(100*e)+"%":"0%";if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&t===l.firstElementChild.getAttribute("value"))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const i="white",n=["#D50000","#F4511E","#F6BF26","#33B679"];let r=n[0];r=e<.25?n[0]:e<.5?n[1]:e<.75?n[2]:n[3],l.innerHTML='<div value="'+t+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+t+';"><div title="'+t+'" style="width: 100%; height: 4px; background: '+r+"; color: "+i+';" class="smart-truncate smart-token"></div></div><span>'+t+"</span></div>",a.setAttribute("template",a.cell.template);break}case"images":{if(""===e)return l.innerHTML="",a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")){const t=l.firstElementChild.getAttribute("value");if(e&&e.indexOf(t)>=0)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild.evaluateScroll&&l.firstElementChild.evaluateScroll());if(t&&e&&Array.isArray(e)&&e[0]&&e[0].value&&t.length===e[0].value.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template)}const t=document.createElement("div"),n=document.createElement("div");t.classList.add("container"),n.classList.add("images");let o=e;if("string"==typeof o&&(o.indexOf("http")>=0||o.indexOf("base64")>=0)){let e="";if(o)try{e=JSON.parse(o)}catch(e){console.log(e)}o=e}Array.isArray(o)&&o.forEach((e=>{const l=document.createElement("img");l.src=e.value,l.title=e.label,t.appendChild(l)}));const s=document.createElement("div");s.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");if(d.classList.add("smart-arrow-right","arrowbtn"),n.onpointerdown=e=>{if("IMG"===e.target.nodeName)i._openImagePreviewDialog(e.target),e.stopPropagation(),e.preventDefault();else if("DIV"===e.target.nodeName&&e.target.classList.contains("arrowbtn")){let l=parseInt(t.style.marginLeft);isNaN(l)&&(l=0);const i=s===e.target,n=t.scrollWidth-a.offsetWidth+30;t.style.marginLeft=i?Math.min(0,l+25)+"px":Math.max(-n,l-25)+"px",l=parseInt(t.style.marginLeft),0===l?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),e.stopPropagation(),e.preventDefault()}},t.children.length){n.appendChild(t);const e=25*o.length;e-a.offsetWidth+30>30&&(n.appendChild(s),n.appendChild(d)),n.evaluateScroll=()=>{const l=e-a.offsetWidth+30;t.style.marginLeft="0px",s.classList.add("smart-hidden"),l<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),l>30&&(n.appendChild(s),n.appendChild(d))},r=n}else r=document.createElement("div");a.setAttribute("template",a.cell.template),e&&e[0]&&e[0].value?r.setAttribute("value",e[0].value):o&&o[0]&&o[0].label?r.setAttribute("value",o[0].label):r.setAttribute("value",e);break}case"email":Smart.Validator&&(r=document.createElement("span"),Smart.Validator.email(e)?r.innerHTML=e:(r.className="url",r.innerHTML='<a href="mailto:'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()})),a.setAttribute("template",a.cell.template);break;case"url":Smart.Validator&&(r=document.createElement("span"),r.className="url",Smart.Validator.url(e)?r.innerHTML='<a href="https://'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>":r.innerHTML='<a href="'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()}),a.setAttribute("template",a.cell.template);break;default:{let t=null;a.setAttribute("template","");const r=a.cell.row,o=l;let s=a.cell.getFormattedValue(e,n.cellsFormat);if(o.style.lineHeight="","function"==typeof a.cell.template){const t={row:r,column:n,cell:a.cell,oldValue:a.cell.oldValue,value:e,template:null};let l=o.querySelector(".smart-grid-cell-template");l&&l.getAttribute("column")===n.dataField?t.template=l.firstElementChild:l=null,a.formattedValue!==s&&(l=null),a.cell.canNotify=!1,r.canNotify=!1;const i=Object.assign({},{background:a.cell.background,color:a.cell.color,fontSize:a.cell.fontSize,fontFamily:a.cell.fontFamily,fontWeight:a.cell.fontWeight,textDecoration:a.cell.textDecoration,fontStyle:a.cell.fontStyle});if(a.cell.template(t),!l&&t.template)if(t.template instanceof HTMLElement){const e=document.createElement("div");e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),o.innerHTML="",o.appendChild(e),e.appendChild(t.template)}else o.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+t.template+"</div>";else l||null!==t.template||(o.innerHTML=e);o.style.background===i.background&&o.style.color===i.color&&o.style.fontSize===i.fontSize&&o.style.fontWeight===i.fontWeight&&o.style.fontStyle===i.fontStyle||(a.cell._styleChanged=!0,a.cell._setStyle(o)),a.cell.background!==i.background||a.cell.color!==i.color||a.cell.fontSize!==i.fontSize||a.cell.fontWeight!==i.fontWeight||a.cell.fontStyle!==i.fontStyle?(a.cell._styleChanged=!0,a.cell._setStyle(o)):a.cell._styleChanged&&a.cell._setStyle(o),void 0===a.cell.oldValue&&(a.cell.oldValue=e),a.formattedValue=s,a.cell.canNotify=!0,r.canNotify=!0}else{if(""!==o.textContent&&(o.textContent=""),a.cell.template instanceof HTMLTemplateElement)t=a.cell.template;else if(a.cell.template instanceof HTMLElement){const t=a.cell.template.innerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);o.innerHTML!==t&&(o.innerHTML=t)}if(a.cell.template.startsWith&&a.cell.template.startsWith("#")&&(t=document.querySelector(a.cell.template)),t){let l=t.content.cloneNode(!0).firstElementChild;const d=e;if(e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),l.querySelector("[smart-if]")){const t=l.querySelector("[smart-else]"),a=l.querySelectorAll("[smart-if]");let i=!1;for(let t=0;t<a.length;t++){const r=a[t],o=r.getAttribute("smart-if").split(" "),s=o[1].trim();let c=o[2].trim(),m=e;switch("Today"===c&&(c=new Date),"date"===n.dataType&&(e=new Date(d).getTime(),c=new Date(c).getTime()),s){case">":e>parseFloat(c)&&(l=r,i=!0);break;case">=":e>=parseFloat(c)&&(l=r,i=!0);break;case"=":case"==":case"===":e===c&&(l=r,i=!0);break;case"<":e<parseFloat(c)&&(l=r,i=!0);break;case"<=":e<=parseFloat(c)&&(l=r,i=!0)}if(e=m,i)break}!i&&t&&(l=t)}let c=l.outerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);for(c.indexOf("{{value=")>=0&&(e?(c=c.substring(0,c.indexOf("{{value="))+e+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const t=c.indexOf("{{value::"),l=c.substring(t+9,c.indexOf("}}")),i=a.cell.getFormattedValue(e,l);c=c.replace(`{{value::${l}}}`,i)}if(n._treeColumn){const e=o.firstChild;if(e&&e.classList&&a.toggleButton&&n._treeColumn&&o.children[1]){const e=o.children[0],t=o.children[1].children[0],l=o.children[1].children[1].firstChild,a=o.children[1].children[2];let n="";if(i.grouping.enabled){let e=r.level-1;"multipleColumns"!==i.grouping.renderMode&&(n+='<div style="width: '+(1+e)*i.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<r.level;e++)n+="<div class='smart-indent'></div>";r.checked?l.setAttribute("checked",""):!1===r.checked?l.removeAttribute("checked"):null===r.checked&&l.setAttribute("checked","indeterminate"),r.leaf?r.allowCheck?l.classList.remove("smart-visibility-hidden"):l.classList.add("smart-visibility-hidden"):r.allowCheck?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),r.allowCheck?i.checkBoxes.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"):i.checkBoxes.visible||l.classList.add("smart-hidden"),e.innerHTML=n,t.classList.add("smart-visibility-hidden"),r.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),r.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),r.data.isEmpty&&t.classList.add("smart-visibility-hidden"),a.innerHTML=c,i.appearance.showTooltips?a.setAttribute("title",s):a.hasAttribute("title")&&a.removeAttribute("title")}}else o.innerHTML!==c&&(o.innerHTML=c)}else if("string"==typeof a.cell.template){""===e&&(e=" ");const t=a.cell.template.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);o.innerHTML!==t&&(o.innerHTML=t)}}if("auto"===a.cell.row.height||i.layout.allowCellsWrap||"auto"===i.layout.rowHeight){const e=o.querySelector(".smart-grid-cell-template");if(e){r._templatesHeight||(r._templatesHeight=[]);const t=(e,t)=>{if(e){const l=i.rowById[e.getAttribute("data-id")];l._templatesHeight[n.dataField]=t,l._isDirty=!0,l.autoSize(),delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),i.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(r)return l.innerHTML="",l.appendChild(r),a.cell._setStyle(l),r}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,n=a._isMeasureRow?null:l.cellsFormat,r=t.grouping.enabled&&t.dataSource.groupBy.length>0;if(!1===t._recycleValues&&!r)return e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),void(e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.setAttribute("aria-activedescendant",e.id)):(e.removeAttribute("focus"),a.element.star&&t._selection.focusedCell&&t._selection.focusedCell.id!==a.id&&a.element.star.classList.remove("smart-hidden")));if(t.grouping.enabled&&t.dataSource.groupBy.length>0){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button");let o=l.displayField?i[l.displayField]:i[l.dataField];null!==o||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(o=0),"string"===l.dataType&&(o=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(o=!1),"date"===l.dataType&&(o=new Date)),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(o="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row");const s=t=>t?t.startsWith("off_")?(e.classList.remove(t.substring(4)),!1):(e.classList.add(t),e.setAttribute("customCSS",t),!0):(e.setAttribute("highlight",""),!0);if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS"),e.classList.remove(t)}if(l.highlight&&!a.summaryRow&&(s(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]&&s(t.highlightedCells[a.id][l.dataField]),t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]&&s(t.highlightedRows[a.id]),t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),o=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,o=e.cell.value),void 0===o&&(o="");let d=o;n?d=e.cell.getFormattedValue(o,n):l.formatSettings&&l.formatSettings.Intl&&(d=e.cell.getFormattedValue(o,l.formatSettings.Intl));const c=e.firstChild;if(e.content=c,l._isDirty&&(c.innerHTML=""),c.hasAttribute("data-field")&&c.getAttribute("data-field")!==l.dataField&&(c.innerHTML=""),c.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?c.appendChild(t):c.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void c.appendChild(t)}e.cell.value!==o&&(d=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,o,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,o,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);for(let n=0;n<i.length;n++){let r=i[n];const s={index:a.visibleIndex,value:o,dataField:l.dataField,row:a,api:t};l.cellsCSSRules[r](s)&&(e.classList.add(r),e.__classNames=[r])}}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const m=e._getCellAlignment(a,l),u=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let g="";if(m.align&&(g+=m.align+" "),m.verticalAlign&&(g+=m.verticalAlign+" "),l.cellsWrap&&(g+="wrap "),g+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let p=l.left;if(t.rightToLeft?e.style.right!==p+"px"&&(e.style.right=p+"px"):e.style.left!==p+"px"&&(e.style.left=p+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),g+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command",""),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze","")),l.cellsRotationAngle){if(!e._rotateCellContent(c,l,o))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(c));c.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)c.innerHTML="";else if(l.autoGenerated&&(c.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let n in a){const r=l.cellsFormat;let o=a[n];r&&r.indexOf("p")>=0&&"count"===n?o=a[n]:r&&"date"!==l.dataType&&(o=e.cell.getFormattedValue(o,r)),i.push(t.localize(n,{value:o}))}const n=i.join(", "),r=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let o=`<div title = "${n}" class="smart-truncate summary-value" > <span class="label">${n}</span>${r}</div> `;if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;o=`<div title = "${n}" class="smart-truncate summary-value" > <span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> <span class="label">${n}</span>${r}</div> `}c.innerHTML!==o&&(c.innerHTML=o)}else if(t.summaryRow.editing&&l.allowSummary)if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value" ><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;c.innerHTML!==l&&(c.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value" ><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;c.innerHTML!==e&&(c.innerHTML=e)}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?c.firstElementChild.setAttribute("has-summary",""):c.firstElementChild.removeAttribute("has-summary"),c.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),c._clickTarget=e.target},c.onpointerup=l=>{c._clickTarget===l.target&&(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="";if(l=a.showDetail?'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggled toggle-button></button>':'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggle-button></button>',t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,c.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):c.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(c.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else c.innerHTML!==l&&(c.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)c.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let n="";for(let e=0;e<t;e++)n+="A";return n+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?c.textContent="":c.textContent=l(a)}else if(u)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)c.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)c.innerHTML=o;else switch(e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(o,e.cell.template,c);break;case"tags":case"checklist":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(o,e.cell.template,c);break;case"image":e._setTemplate(o,"images",c);break;case"email":e._setTemplate(o,"email",c);break;case"url":e._setTemplate(o,"url",c);break;default:e._setTemplate(o,e.cell.template,c)}else{const i=c.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&c.children[1]){const e=c.children[0],i=c.children[1].children[0],n=c.children[1].children[1].firstChild,r=c.children[1].children[2];let o="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?o="":"multipleColumns"!==t.grouping.renderMode&&(o+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)o+="<div class='smart-indent'></div>";if(a.checked?n.setAttribute("checked",""):!1===a.checked?n.removeAttribute("checked"):null===a.checked&&n.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?n.classList.remove("smart-visibility-hidden"):n.classList.add("smart-visibility-hidden"):a.allowCheck?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(c)}}a.allowCheck?t.checkBoxes.visible?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden"):t.checkBoxes.visible||n.classList.add("smart-hidden"),e.innerHTML=o,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),r.innerHTML=d,t.appearance.showTooltips?r.setAttribute("title",d):r.hasAttribute("title")&&r.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let n=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(n+=l.computedWidth)}e.style.width=n+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let n=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let n=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(n+=l.cellHeight)}e.style.height=n+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const r="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(o,a.visibleIndex,a.data),s=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(s>l[0]&&s<l[1]){d=!0;break}}if(a._rowSpan=r,r&&!d){let o=0;t._cellRowSpan.push([s,s+r,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(r,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=s;e<=s+r-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(o+=l.cellHeight)}e.style.height=o+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",r),i._styleChanged=!0,n=r}}1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width="",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===n&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),c.textContent===d||l.formatFunction||(c.textContent=d),i.column.autoGenerated||i._setStyle(c),t.appearance.showTooltips?c.setAttribute("title",i.tooltip||d):c.hasAttribute("title")&&c.removeAttribute("title")}else c.textContent=d}}if(c.className!==g&&(c.className=g),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&c.firstChild&&c.firstChild.classList&&c.firstChild.classList.contains("smart-grid-cell-loading")&&(c.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),c.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const t={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:o,formattedValue:d,template:null};e.cell.canNotify=!1,a.canNotify=!1;const i=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});await l.formatFunction(t),c.style.background===i.background&&c.style.color===i.color&&c.style.fontSize===i.fontSize&&c.style.fontFamily===i.fontFamily&&c.style.textDecoration===i.textDecoration&&c.style.fontWeight===i.fontWeight&&c.style.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c)),e.cell.background===i.background&&e.cell.color===i.color&&e.cell.fontSize===i.fontSize&&e.cell.fontWeight===i.fontWeight&&e.cell.textDecoration===i.textDecoration&&e.cell.fontFamily===i.fontFamily&&e.cell.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c));let n=!0;if(t.value!==o&&(e.toggleButton?c.children[1].children[2].innerHTML=t.value:c.innerHTML=t.value,n=!1),null!==t.template){if(e.toggleButton){const e=c.children[1].children[2];e.innerHTML!==t.template&&(e.innerHTML=t.template)}else if(c.innerHTML!==t.template){const e=document.createElement("div");e.innerHTML=t.template,e.innerHTML!==c.innerHTML&&(c.innerHTML=t.template)}n=!1}n&&(l.cellsFormat?c.textContent=d:c.textContent=o),e.cell.canNotify=!0,a.canNotify=!0}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,c),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&c.querySelector("[toggle-button]")){const e=c.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),n=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),n.appendChild(l),n.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(n),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const n=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-n.top+"px",i.style.left=a._offsetLeft(l)-n.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,n=e.row,r=e.row.index,o=n._style;if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][r];a.cell.canNotify=!1,n.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,n.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,n.canNotify=!1,o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,n.canNotify=!0)}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const n={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":n.align="align-left";break;case"center":case"middle":n.align="align-center";break;case"right":n.align="align-right"}switch(a){case"top":n.verticalAlign="align-top";break;case"center":case"middle":n.verticalAlign="align-middle";break;case"bottom":n.verticalAlign="align-bottom"}return n}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});
|
|
1422
1422
|
|
|
1423
1423
|
/***/ }),
|
|
1424
1424
|
|
|
@@ -1439,21 +1439,21 @@ Smart.Utilities.Assign("Grid.Column",class{constructor(t){const e=this;"string"!
|
|
|
1439
1439
|
/***/ 5306:
|
|
1440
1440
|
/***/ (() => {
|
|
1441
1441
|
|
|
1442
|
-
Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"}},type:"object"},behavior:{value:{allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"object"},fileName:{value:"smartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:150,type:"number"},height:{value:null,type:"number?"},dataSource:{value:{contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertLeft:{value:{command:{value:"insertLeftCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-left",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertRight:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-right",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},description:{value:"",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:400,type:"any"},width:{value:400,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban"],type:"string"},currentUser:{value:null,type:"any"},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the smartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",kanbanNone:"None",kanbanNoneDescription:"Start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Basic kanban",kanbanBasicDescription:'Start from Basic kanban-style board with columns for "To do", "in progress" and "Done".',uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsertLeft:"Insert left",columnMenuItemInsertRight:"Insert right",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Shift</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeader:"Edit Record with Id: {{value}}",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonCancel:"CANCEL",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnStatus:"Create a group column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your data will be grouped in columns based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogImageHeader:"Image",dialogImageDrop:"or drag and drop image(s) to upload",dialogImageUpload:"Select Image(s) to Upload",dialogImageURL:"You can also provide the URL to an image",dialogImageURLUpload:"Upload",dialogImageLink:"Link (URL)",dialogImageDevice:"My Device",dialogImageSize:'No image currently added. The "{{value}}" image cannot be uploaded. Maximum image size is {{fileSize}}.',dialogImageCount:'The following images cannot be added "{{files}}". Maximum images allowed is {{fileCount}}.',dialogImageFileUpload:"No images currently selected for upload",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple Select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"Collaborator",dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeAutoNumber:"Auto Number",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnListItems:"List items",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnCheckItems:"Show Checkbox",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",noComments:"No comments to this record yet",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Details",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'Changed {{column}} from "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed {{column}} to "{{newValue}}"',rowCreated:"Row Created",propertyUpdated:'"{{value}}" updated',propertyRemoved:'"{{value}}" removed',dropImages:"Drop images here",addImages:"Add images",unassigned:"Unassigned",historyDate:"Date",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less Than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",formatColumn:"Format Column",formating:"Conditional Formatting",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:500,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},onInit:{value:null,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["smart.menu.css","smart.filterpanel.css","smart.pager.css","smart.grid.css","smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' role='grid'>\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler"}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);super._upHandler(),t._tapTimer&&clearTimeout(t._tapTimer);const l=()=>{t.editing.isEditing&&!t.editing.dialog.enabled&&setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.endEdit()}}),50)};if(!e.originalEvent||(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),!e.originalEvent.target.closest(".smart-grid-dialog"))){if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;)if(a=a.parentNode,a===t){o=!0;break}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const e=n.querySelectorAll("smart-drop-down-list"),l=n.querySelectorAll("smart-date-time-picker"),a=n.querySelectorAll("smart-date-input"),i=n.querySelectorAll("smart-input");for(let t=0;t<e.length;t++)if(e[t].$.dropDownContainer.contains(o))return;for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.scrollView.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;return void t.closeMenu()}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX)if(n.top<=e.pageY&&n.top+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&t.sortBy(l),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l)}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField}),i("doubleClick"),t._onColumnDoubleClick(o,e)),t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,s=null;t._lastPointerDownTime=new Date;for(let e=0;e<a.length;e++){const t=a[e];if(t.hasAttribute("toggle-button")&&(i=t),t.hasAttribute("checkbox")&&(r=t),s||"smart-grid-cell"!==t.nodeName.toLowerCase()||(s=t),!n&&"smart-grid-row"===t.nodeName.toLowerCase()){n=t;break}}if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn){const e=n.row;e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else{const o=n.row,l=s?s.cell:null;l.column._treeColumn&&r&&(o.checked=!o.checked),l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(o.header&&"row-resize"===o.header.style.cursor){const l=t.offset(o.header);if(t._rowToResize&&l.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=l.left+o.header.offsetWidth)return;o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,u=e.originalEvent?e.originalEvent:e,c=3===u.which;if(c||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),c&&t.contextMenu.enabled)return t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField,t._focusCell(o.id,l.column.dataField),t.openContextMenu(u.pageX+10,u.pageY+10),void(t.contextMenu.selector&&(u.stopPropagation(),u.preventDefault()));if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),a("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0}_blurHandler(){this._focused=!1}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){switch(l._notify(e,t,o),e){case"onRowInserted":return;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o));case"users":case"currentUser":l._refreshCurrentUser();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":l.header.visible&&""===l.header.template&&(l.$.header.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=l.$.header.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar));break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index}}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":if(l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[],l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}if(l._renderColumns(),l._refreshHeaderBar(),l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return;case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":if(delete l._isFirstVirtualDataSourceRequest,"dataSource"===e&&t&&o&&t instanceof Smart.DataAdapter&&t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{l.beginUpdate();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e].$.id;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const e=l._filters,t=l._sortedColumns;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;t&&l._refreshSort(t),e&&e.length>0&&(l._filters=null,l.refreshFilters()),l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}return l.dataBind(),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.removeAttribute("aria-readonly"):l.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){super.ready();const e=this,t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];e.filtering.enabled&&0===e._filterPanels.length&&requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this;let t=e._recyclingRows,o=0,l=e._autoRowHeight,a=0,n=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===t.length||0===e.columns.length||!e.hasVisibleColumn())return 0;e.rows.canNotify=!1;const i=e._measureRowElement(t[0].data),r=t.length;for(let s=0;s<r;s++){let r=t[s];if(!r.visible||!1===r.filtered){r.height=0,r.cellHeight=0,r.top=o;continue}const d=e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled;if((!r.height||!r.cellHeight||d||"auto"===r.height||"auto"===r._height||"auto"===e.layout.rowHeight||e.layout.isDirty)&&!r.expandHeight){if(r.detailHeight||(r.detailHeight=200),e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.height=e.layout.rowHeight,r.computedHeight&&(r.height=r.computedHeight),r.minHeight>r.height&&(r.height=r.minHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.element=i,r.grid=e,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l,o=r.canNotify;r.canNotify=!1,r.height=t,r.computedHeight&&(r.height=r.computedHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight),r.canNotify=o}else e.layout.rowHeight(s,r),r.height||(r.height=l),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}else{if("auto"===r.height||"auto"===r._height){r.element=i,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l;r.height=t,r._height="auto"}else r.height=l;void 0===r.label||r.summaryRow||"advanced"!==e.grouping.renderMode||(r.height=e.grouping.groupRowHeight),r.computedHeight&&(r.height=r.computedHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}e._rowGap&&s<e.rows.length-1&&(r.height+=e._rowGap)}!0===r.freeze||"near"===r.freeze?r.visible&&(a+=r.height):"far"===r.freeze&&r.visible&&(n+=r.height),r.freeze&&r.visible?r.top=o:(r.top!==o&&(r.top=o),r.expandHeight?o+=r.cellHeight:o+=r.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(o+=1*l),e.editing.addNewRow&&"button"===e.editing.addNewRow.displayMode&&(o+=1*l),e.filtering&&e.filtering.filterRow.visible&&(a+=l),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(o=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return e.__scrollHeight=o,e.__frozenNearHeight=a,e.__frozenFarHeight=n,e._scrollView.scrollHeight=o-e.$.scrollView.offsetHeight+a+n,o=e.__scrollHeight+a+n-1,e.grouping.enabled&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(o+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=o,i.remove(),t[0]&&delete t[0]._isMeasureRow,e.rows.canNotify=!0,o}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?l.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o}_refreshColumnHeights(){const e=this;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],s=0,d=0,u=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,u+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=u,u+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;t.summaryRow.visible&&(t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{!0!==t.editing.isEditing&&(t._calculateSummary(),!1!==e&&t._recycle(!1))}),100))}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[];let o=new Date;const l=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=l;const a=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],n=function(l,n,i){let r=null;if(e.isInitialized&&(o=new Date),r=l?l.grid?l:new Smart.Grid.Row({data:l,index:n,grid:e,createdBy:e.currentUser,createdDate:o}):new Smart.Grid.Row({data:{},index:n,grid:e,createdBy:e.currentUser,createdDate:o}),a)for(let e=0;e<a.length;e++){const t=a[e],o=t.getCellValue(r.id,t.dataField,l);void 0!==o&&(r.data[t.dataField]=o)}if(e.rowById[r.id]&&(r.id=e.rows.length,e.rowById[r.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};r.id=e()}if(e.onRowInit){e.onRowInit(n,r,e),30!==r.height&&(r.cellHeight=r.height);for(let t in r)-1!==r.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}))}if(r.selected&&(e._selection.rows[r.id]=!0,e._selection.indexes[r.index]=r.index),r.freeze&&r.visible){if(!0===r.freeze||"near"===r.freeze){e.rows.splice(t++,0,r);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}else if("far"===r.freeze){e.rows.push(r);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&e._frozenFarRows.push(t)}}else e.rows[n]?e.rows.splice(n,0,r):e.rows.push(r),r.data&&r.data.$&&(r.data.$.history=r.history,r.data.$.starred=r.starred,r.data.$.comments=r.comments,r.data.$.style=r.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&e._recycle(!1,!0),e._onRowInserted&&e._onRowInserted(l),i&&i(l)};if(void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:n});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([n],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;void 0!==n&&(a.id=a.data.id=n,e._getId()&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a),e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),i&&i(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([n],[t],o,e)}else{const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n];void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),i&&i(t)}},i=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},r=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=n,e._removeLastRow=i,e._removeAt=r,e._rowHeight=e._autoRowHeight;const s=e.dataSource.length;if(e.setAttribute("aria-rowcount",s),e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];n(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];n(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(l(),e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let a=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)n(o[t],e.dataSource.length-o.length+t);else n(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],l=[],i=[];for(let r=0;r<i.length;r++){const s=t.index[r];e.rows[s]?(e.rows[s].data=i[r],o.push(s),l.push(e.rows[s]),i.push(e.rows[s].data)):(n(i[r],i[r].$.index),a=!0)}e.onRowUpdated&&e.onRowUpdated(o,l,i,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:n(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":n(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":r(t.index);break;case"removeLast":i();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==s){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize)),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize))}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),e.onLoad())}}l(),("update"!==t.action||a)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?e._frozenNearRows.push(o):"far"===o.freeze&&e._frozenFarRows.push(o),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]&&(l.data=e.dataSource[o],void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)),-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l))})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l.data=o,l.id=o.$.id,e.rowById[l.id]=l}return e.rows.canNotify=!0,void e.refresh()}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||e._render()})),e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),void super.render();const o=e.context;e.context=e,e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&e.header.buttons.indexOf("views")),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale,e.$.header.appendChild(t),e.$.headerBar=e.$.header.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}a&&e.addFilter(t,a,!1)}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t&&e.addFilter(o.dataField,t,!1)}}e.refreshFilters()}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t){if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view&&e._initKanbanView()}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(){const e=this,t=e.conditionalFormatting;if(!t||0===t.length)return;if(!e._defaults){const t=getComputedStyle(e);e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)}}e._formatter||(e._formatter=new Smart.Utilities.ConditionalFormatter(e.dataSource));const o=e._defaults,l=e._formatter,a=[],n=function(t){if("all"===t){if(e.columns&&e.columns.map){const t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||t.push(l.dataField)}return t}return[]}return[t]};for(let e=0;e<t.length;e++){t[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:o.fontFamily,fontSize:o.fontSize,text:o.text,highlight:o.highlight},t[e]);const i=t[e],r=n(i.column),s=i.condition;l.color=i.highlight,l.comparator=i.firstValue,l.min=i.firstValue,l.max=i.secondValue;const d=l.format(s,r);for(let e in d){const t=d[e];for(let e in t){const o=t[e];o.color=i.text,o.fontFamily=i.fontFamily,o.fontSize=i.fontSize}}a.push(d)}if(e._formattingPanel&&(e._formattingPanel.items=t),0===a.length)return a[0];const i={};for(let e=0;e<a.length;e++){const t=a[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){i[e]||(i[e]={});for(let t in o)i[e][t]=Object.assign({},i[e][t],o[t])}}}e._conditionalFormatting=i}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));n.grid=e,e.columns.push(n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);"near"===e.rowDetail.position?(o.freeze="near",a.freeze="near",e.viewColumns.splice(l,0,a),e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30}),n=new Smart.Observable(a,a.observables);n.canNotify=!1,e.viewColumns.push(n),e._frozenFarColumns.splice(0,0,n);const i=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),r=new Smart.Observable(i,i.observables);r.canNotify=!1,"near"===e.editing.commandColumn.position?(i.freeze="near",r.freeze="near",e.viewColumns.splice(l,0,r),e._frozenNearColumns.splice(l,0,r)):(e.viewColumns.push(r),e._frozenFarColumns.splice(0,0,r)),e._commandColumn=r;const s=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),d=new Smart.Observable(s,s.observables);if("near"===s.freeze?(e.viewColumns.splice(l,0,d),e._frozenNearColumns.splice(l,0,d)):(e.viewColumns.push(d),e._frozenFarColumns.splice(0,0,d)),e._selectionColumn=d,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}t._renderColumns(),t.__columnHeaderHeight=null,t.refresh()}onAttached(){const e=this;e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.isRendered&&e.isCompleted&&e._render()}onDetached(){const e=this;if(!e.isRendered)return;["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.querySelector("smart-grid-toolbar");if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}_observeColumns(){const e=this,t=function(t,o,l,a){l===a&&"selected"!==o||(t.propertyChanged(o,l,a),e.onColumnChange&&t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a))};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l&&(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),delete e.columnByDataField[l.dataField]),e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,requestAnimationFrame((()=>{if(e.filtering.enabled&&e.filtering.filterRow.visible)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(t._isUpdating)return;if(t.editing.isEditing)return;const o=t.querySelector("smart-grid-toolbar");if(!o||!o.$.headerDropDown.classList.contains("open"))if(t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&!t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&e.deltaX){const o=t.scrollLeft;if(0===o&&e.deltaX<0||o===t.scrollWidth&&e.deltaX>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaX<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaX)>=100?t._scrollView.scrollLeft+=l:t._scrollView.scrollLeft+=e.deltaX}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaY<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100?t._scrollView.scrollTop+=l:t._scrollView.scrollTop+=e.deltaY}}_refresh(){const e=this;if(e._isUpdating)return;const t=e.$.verticalScrollBar.offsetWidth;e.removeAttribute("grouped"),e.removeAttribute("tree");let o=!0;e.__autoHeightRows&&(e.__autoHeightRows=null,e._refreshColumnsResponsiveVisibility(),e._recycle(),o=!1),e._groups||(e._groups=[]),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>=0&&("advanced"===e.grouping.renderMode?e.setAttribute("grouped",""):e.setAttribute("tree",""),e._groups||(e._groups=[].concat(e.dataSource.groupBy.toArray())||[]),e._renderGroupBar()),e.grouping.enabled&&e.dataSource.groupBy&&0===e.dataSource.groupBy.length?e.$.breadcrumb&&(e.$.breadcrumb.dataSource=[]):e.dataSource.boundHierarchy&&(e.setAttribute("tree",""),e.setAttribute("role","treegrid")),(e.isInitialized||o)&&e._refreshColumnsResponsiveVisibility(),e._refreshLayout(),t!==e.$.verticalScrollBar.offsetWidth&&(e.__scrollWidth=null,e._refreshColumnsResponsiveVisibility(),e._refreshScrollBars(),0===e.$.verticalScrollBar.offsetWidth&&e.isRendered&&requestAnimationFrame((()=>{e._refreshScrollBars()}))),e._refreshSelection(),e._recycle(),e._refreshHeaderBar(),e._recyclingRows&&0===e._recyclingRows.length&&(e.$.placeholder.classList.remove("smart-hidden"),e.scrollHeight=0,e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${e.localize("filteredRecords")}`)),requestAnimationFrame((()=>{e._width=e.offsetWidth,e._height=e.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return;t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,u=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(u+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===u&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=u,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1);e._refreshRowHierarchy()}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let s=0;const d=function(t,l){for(let u=0;u<t.length;u++){const c=t[u];let m=o.rowById[c.$.id];if(n&&(m=o.rows[s],m||(m=r(c),o.rows.push(m)),c[i.leaf]?m.id=c.$.id:m.id="Group_"+c.$.id,o.rowById[m.id]=m),m||(m=r(c),o.rowById[m.id]=m),m.data=c,m.leaf=c[i.leaf]||!1,m.level=c[i.level],m.groupDataField=c.groupDataField,!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=c.label,m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),c.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),c.parent?(m.parent=o.rowById[c.parent.$.id],m.parentId=c.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(c);e&&(m.expanded=c[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==c[i.expanded]&&(m.expanded=c[i.expanded]);let g=!!e||m.expanded;a&&(g=!0);const p=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(p&&!m.data[p]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];c.parent&&c.parent.expanded&&(""===m.data[e]||m.leaf&&!m.data[p])&&(s++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(s++,g||c[i.leaf])if(l.push(m),c.children&&c.children.length>0){const e=d(c.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),c.children&&c.children.length>0){const e=d(c.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let u=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<u.length;o++){let l=u[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;if((a||null===a)&&0===l.level&&!l.parent){if(0===t(l.children).length)continue;e.push(l)}}u=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}o.rowHierarchy=d(u,new Array);let c=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&c.push(t),t.canNotify=!1,t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=c),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow&&o._initializeRowElements(),o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e.editing.addNewRow.visible&&1===e._recyclingRows.length&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.header.visible?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));e.header.visible&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshElementsVisibility(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),u=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=u,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden")),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||u>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-u+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",u+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",u+e.__scrollBarSize+"px"))),t.refresh(),o.refresh()}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getColumns(){const e=this,t=[];if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}getState(){const e=this,t=e.getSortedColumns(),o=e.getFilteredColumns(),l=e.getGroups(),a=e.getSelectedCells(),n=e.getSelectedRows(),i=e.$.headerPager.querySelector("smart-pager");let r=0;return i&&(r=i.pagesCount),{sort:t,filter:o,groups:l,paging:{count:r,index:e.paging.pageIndex,size:e._pageSize},selectedCells:a,selectedRows:n}}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,t,e._farRowsAdded,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),0===o.columns.length&&o.column.element.classList.add("smart-hidden"),0===t&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_recycle(e,t){const o=this;if(o._layoutSuspended||!1===o.isAttached)return;if(o._isUpdating)return;if(o.editing.isEditing&&(o.endEdit(),o._isUpdating))return;o._removeCellContentPopup(),o._inputOverlay&&(o._inputOverlay.parentNode&&o._inputOverlay.parentNode.removeChild(o._inputOverlay),o._inputOverlay=null),o._selection.selectionRect&&o._refreshCellSelectionRect();const l=o._scrollView.scrollTop;let a,n=o._getRowIndexByPosition(l),i=o._recyclingRows,r=i[n],s=r?r.top:0,d=0,u=0,c=0,m=0;if(o._cellRowSpan&&o._cellRowSpan.maxSpan>0){let e=0;if(n>=5?e=5:n>=4?e=4:n>=3?e=3:n>=2?e=2:n>=1&&(e=1),e>0){const t=i[n-e];t&&(r=t,s=r?r.top:0,c=e*r.height,n-=e)}}o._cellRowSpan=[];for(let e=0;e<o._cellsMerge.length;e++){const t=o._cellsMerge[e],a=i.indexOf(t.row);if(n>a&&n<=a+t.rowSpan&&(n=a,r=t.row,c=Math.max(c,s-r.top),s=r.top,o.$.rowContainer.style.top=o.__frozenNearHeight-l+s+"px"),t.colSpan>1)for(let e=0;e<o.viewColumns.length;e++){const l=o.viewColumns[e];let a=l.autoGenerated?l:o.columnByDataField[l.dataField];if(a.visible&&a.left+a.computedWidth-o._scrollView.scrollLeft>=d&&a.left-a.computedWidth-o._scrollView.scrollLeft<o._clientSize.width){let e=o.columnByDataField[t.column.dataField];m=Math.max(m,a.left-e.left+a.computedWidth);break}}}let g=null;if(!1!==e||o._cellsMerge.length>0){for(let e=0;e<o._columnElements.length;e++){const t=o._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<o._columnGroups.length;e++){const t=o._columnGroups[e],l=t.element;o.rightToLeft?l.style.right=t.right+"px":l.style.left=t.left+"px",l.style.width=t.computedWidth+"px"}o._firstVisibleColumn=null,o._lastVisibleColumn=null;for(let e=0;e<o.viewColumns.length;e++){let t=o.viewColumns[e];if(t.visible&&(o._firstVisibleColumn||(o._firstVisibleColumn=t),o._lastVisibleColumn=t),t.element&&(t===o._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(d+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-o._scrollView.scrollLeft>=d-m&&t.left-t.computedWidth-o._scrollView.scrollLeft<o._clientSize.width){const l=o._columnElements[u++];l&&(l.set("column",t,!1),l.parentNode||o.$.columnContainer.appendChild(l),g||(g=t,o._firstRenderedColumn=t),t.element=l,t.render(),l.setAttribute("aria-colindex",e+1),void 0===a&&(a=t.left))}}}if(void 0===a&&(a=0),o.rightToLeft){const e=o._scrollView.scrollWidth-o._scrollView.scrollLeft-o._scrollView.vScrollBar.offsetWidth;o.$.columnContainer.style.right=e+"px",e<=0&&!o._scrollView.scrollWidth&&(o.$.columnContainer.style.right=-o.offsetWidth+o._computedColumnsWidth+"px")}else o.$.columnContainer.style.left=-o._scrollView.scrollLeft+"px";if(o.$.rowContainer.style.top=o.__frozenNearHeight-l+s+"px",o.isScrolling&&!o.isHScrolling&&(o._scrollUpdate&&clearTimeout(o._scrollUpdate),o._scrollUpdate=setTimeout((function(){o.isScrolling||(o.$.rowContainer.style.top=parseInt(o.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!o._rowElements)return;const p=o.dataSource&&o.dataSource.virtualDataSource&&!o.dataSource.virtualDataSourceOnExpand&&o.dataSource.length>o.virtualModeCachedRowsCount&&"infinite"!==o.scrolling;if(n>=0){u=0;let e=Math.max(o._clientSize.height,o._overflowOffset),t=0;p&&(o.rowById=[],o.rows&&o.rows.length>0&&void 0===o.rows[o.rows.length-1].top&&(o.rows[o.rows.length-1].top=(o.rows.length-1)*o.rows[0].height),o.rows&&o.rows.length>0&&(t=o._getVirtualRowIndexByPosition(l),s=t*o.rows[0].height,o.$.rowContainer.style.top=o.__frozenNearHeight-l+s+"px",o.paging.enabled||(n=0)),o.paging.enabled&&(t=o.paging.pageIndex*o._pageSize));for(let a=n;a<i.length;a++){const r=i[a];if(0===r.height||!r.visible||!1===r.filtered||r.freeze&&r.visible)continue;const d=r.height;if(r.expandHeight&&(e+=o.offsetHeight+r.expandHeight),!(s+d>=l-c&&s<=l+e||o._autoHeight))break;{const e=o._rowElements[u++];if(!e)break;e.setAttribute("aria-rowindex",t+a+1),r.element=e,r.grid=o,p&&(r.index=a+t,r.visibleIndex=a+t,o.paging.enabled?(r.data=o.dataSource[n+u-1],r.data&&(r.id=r.data.$.id,o.rowById[r.id]=r)):(r.data=o.dataSource[u-1],r.data&&(r.id=r.data.$.id,o.rowById[r.id]=r))),r.render()}s+=d}}o._renderFrozenRows();let h=u;if(u<o._rowElements.length)for(let e=u;e<o._rowElements.length;e++){const e=o._rowElements[u++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}o.editing.addNewRow&&"button"===o.editing.addNewRow.displayMode&&o._rowElements[h]&&(o._newRow||(o._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:o,addNewRow:!0,inline:!0,autoGenerated:!0})),o._newRow.element=o._rowElements[h],o._newRow.element.classList.remove("smart-hidden"),o._newRow.render()),p&&o._selection.selectionRect&&o._refreshCellSelectionRect()}_renderFrozenRows(){const e=this;let t=!1,o=!1;0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(s=4),"center"!==l&&"middle"!==l||(s+=i.height/2-n.height/2),"bottom"===l&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo,sorting:o.getSortedColumns(),filtering:o.getFilteredColumns(),grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action)return void(t&&t(e.result));if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling)o._recycle(!1,!1);else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){if(o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize)),o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1)}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&(t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max,e.closeMenu(),e._addingNewRow=!1}),100)},t}addNewColumn(e){e&&this.columns.push(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.remove(),void delete t.editing.addNewRow._addButton;if("float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)?t.editing.addNewRow._addButton.classList.remove("float"):t.computedVerticalScrollBarVisibility?t.computedVerticalScrollBarVisibility&&"float"===e&&t.editing.addNewRow._addButton.classList.add("float"):t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.editing.addNewRow._addButton.style.bottom="20px":t.editing.addNewRow._addButton.style.bottom="")};t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&(t.editing.addNewRow._addButton||(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.appendChild(t.editing.addNewRow._addButton)),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o())})))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if(t._recycle(!1),t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")})))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e){const t=this;t.isInitialized&&(e&&(t._initializeRows(),t._initializeRowElements()),t._refresh(),t._refreshSummary())}refreshView(){this._recycle()}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t){const o=this;o._isUpdating--,o._isUpdating<0&&(o._isUpdating=0),!1!==e?o.refresh():!1!==t&&o.refreshView()}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
|
|
1442
|
+
Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"}},type:"object"},behavior:{value:{allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"object"},fileName:{value:"smartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:150,type:"number"},height:{value:null,type:"number?"},dataSource:{value:{contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertLeft:{value:{command:{value:"insertLeftCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-left",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertRight:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-right",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},description:{value:"",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:400,type:"any"},width:{value:400,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban"],type:"string"},currentUser:{value:null,type:"any"},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the smartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",kanbanNone:"None",kanbanNoneDescription:"Start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Basic kanban",kanbanBasicDescription:'Start from Basic kanban-style board with columns for "To do", "in progress" and "Done".',uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsertLeft:"Insert left",columnMenuItemInsertRight:"Insert right",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Shift</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Record with Id: {{value}}",dialogEditHeader:"Edit Record with Id: {{value}}",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonCancel:"CANCEL",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnStatus:"Create a group column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your data will be grouped in columns based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogImageHeader:"Image",dialogImageDrop:"or drag and drop image(s) to upload",dialogImageUpload:"Select Image(s) to Upload",dialogImageURL:"You can also provide the URL to an image",dialogImageURLUpload:"Upload",dialogImageLink:"Link (URL)",dialogImageDevice:"My Device",dialogImageSize:'No image currently added. The "{{value}}" image cannot be uploaded. Maximum image size is {{fileSize}}.',dialogImageCount:'The following images cannot be added "{{files}}". Maximum images allowed is {{fileCount}}.',dialogImageFileUpload:"No images currently selected for upload",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple Select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"Collaborator",dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeAutoNumber:"Auto Number",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnListItems:"List items",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnCheckItems:"Show Checkbox",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",noComments:"No comments to this record yet",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Details",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'Changed {{column}} from "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed {{column}} to "{{newValue}}"',rowCreated:"Row Created",propertyUpdated:'"{{value}}" updated',propertyRemoved:'"{{value}}" removed',dropImages:"Drop images here",addImages:"Add images",unassigned:"Unassigned",historyDate:"Date",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less Than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",formatColumn:"Format Column",formating:"Conditional Formatting",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:500,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["smart.menu.css","smart.filterpanel.css","smart.pager.css","smart.grid.css","smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' role='grid'>\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler"}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);super._upHandler(),t._tapTimer&&clearTimeout(t._tapTimer);const l=()=>{t.editing.isEditing&&!t.editing.dialog.enabled&&setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.endEdit()}}),50)};if(!e.originalEvent||(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),!e.originalEvent.target.closest(".smart-grid-dialog"))){if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;)if(a=a.parentNode,a===t){o=!0;break}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const e=n.querySelectorAll("smart-drop-down-list"),l=n.querySelectorAll("smart-date-time-picker"),a=n.querySelectorAll("smart-date-input"),i=n.querySelectorAll("smart-input");for(let t=0;t<e.length;t++)if(e[t].$.dropDownContainer.contains(o))return;for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.scrollView.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;return void t.closeMenu()}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX)if(n.top<=e.pageY&&n.top+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&t.sortBy(l),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l)}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField}),i("doubleClick"),t._onColumnDoubleClick(o,e)),t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,d=null;t._lastPointerDownTime=new Date;for(let e=0;e<a.length;e++){const t=a[e];if(t.hasAttribute("toggle-button")&&(i=t),t.hasAttribute("checkbox")&&(r=t),d||"smart-grid-cell"!==t.nodeName.toLowerCase()||(d=t),!n&&"smart-grid-row"===t.nodeName.toLowerCase()){n=t;break}}if(n&&d){const o=d?d.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn){const e=n.row;e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else{const o=n.row,l=d?d.cell:null;l.column._treeColumn&&r&&(o.checked=!o.checked),l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===d&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(o.header&&"row-resize"===o.header.style.cursor){const l=t.offset(o.header);if(t._rowToResize&&l.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=l.left+o.header.offsetWidth)return;o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const s=t._clickedCell===d&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,u=e.originalEvent?e.originalEvent:e,c=3===u.which;if(c||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),c&&t.contextMenu.enabled)return t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField,t._focusCell(o.id,l.column.dataField),t.openContextMenu(u.pageX+10,u.pageY+10),void(t.contextMenu.selector&&(u.stopPropagation(),u.preventDefault()));if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else s||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else s||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),a("doubleClick")),t._clickedCell===d&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}))),t._clickedRow=n,t._clickedCell=d,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0}_blurHandler(){this._focused=!1}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){switch(l._notify(e,t,o),e){case"onRowInserted":return;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o));case"users":case"currentUser":l._refreshCurrentUser();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":l.header.visible&&""===l.header.template&&(l.$.header.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=l.$.header.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar));break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index}}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":if(l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[],l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}if(l._renderColumns(),l._refreshHeaderBar(),l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return;case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":if(delete l._isFirstVirtualDataSourceRequest,"dataSource"===e&&t&&o&&t instanceof Smart.DataAdapter&&t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{l.beginUpdate();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e].$.id;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const e=l._filters,t=l._sortedColumns;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;t&&l._refreshSort(t),e&&e.length>0&&(l._filters=null,l.refreshFilters()),l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}return l.dataBind(),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"button"===l.editing.addNewRow.displayMode&&(l.editing.addNewRow._addButton&&l.editing.addNewRow._addButton.remove(),l._newRow&&l._newRow.element.classList.add("smart-hidden")),l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.removeAttribute("aria-readonly"):l.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){super.ready();const e=this,t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];e.filtering.enabled&&0===e._filterPanels.length&&requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this;let t=e._recyclingRows,o=0,l=e._autoRowHeight,a=0,n=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===t.length||0===e.columns.length||!e.hasVisibleColumn())return 0;e.rows.canNotify=!1;const i=e._measureRowElement(t[0].data),r=t.length;for(let d=0;d<r;d++){let r=t[d];if(!r.visible||!1===r.filtered){r.height=0,r.cellHeight=0,r.top=o;continue}const s=e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled;if((!r.height||!r.cellHeight||s||"auto"===r.height||"auto"===r._height||"auto"===e.layout.rowHeight||e.layout.isDirty)&&!r.expandHeight){if(r.detailHeight||(r.detailHeight=200),e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.height=e.layout.rowHeight,r.computedHeight&&(r.height=r.computedHeight),r.minHeight>r.height&&(r.height=r.minHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.element=i,r.grid=e,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l,o=r.canNotify;r.canNotify=!1,r.height=t,r.computedHeight&&(r.height=r.computedHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight),r.canNotify=o}else e.layout.rowHeight(d,r),r.height||(r.height=l),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}else{if("auto"===r.height||"auto"===r._height){r.element=i,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l;r.height=t,r._height="auto"}else r.height=l;void 0===r.label||r.summaryRow||"advanced"!==e.grouping.renderMode||(r.height=e.grouping.groupRowHeight),r.computedHeight&&(r.height=r.computedHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}e._rowGap&&d<e.rows.length-1&&(r.height+=e._rowGap)}!0===r.freeze||"near"===r.freeze?r.visible&&(a+=r.height):"far"===r.freeze&&r.visible&&(n+=r.height),r.freeze&&r.visible?r.top=o:(r.top!==o&&(r.top=o),r.expandHeight?o+=r.cellHeight:o+=r.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(o+=1*l),e.editing.addNewRow&&"button"===e.editing.addNewRow.displayMode&&(o+=1*l),e.filtering&&e.filtering.filterRow.visible&&(a+=l),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(o=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return e.__scrollHeight=o,e.__frozenNearHeight=a,e.__frozenFarHeight=n,e._scrollView.scrollHeight=o-e.$.scrollView.offsetHeight+a+n,o=e.__scrollHeight+a+n-1,e.grouping.enabled&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(o+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=o,i.remove(),t[0]&&delete t[0]._isMeasureRow,e.rows.canNotify=!0,o}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,d="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(d="far"),r++);r===n.length?l.freeze=d:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o}_refreshColumnHeights(){const e=this;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],d=0,s=0,u=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=d,u+=o.computedWidth,d+=o.computedWidth):"far"===o.freeze&&(o.left=s,s+=o.computedWidth):(o.left=u,u+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;t.summaryRow.visible&&(t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{!0!==t.editing.isEditing&&(t._calculateSummary(),!1!==e&&t._recycle(!1,!0,!1))}),100))}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[];let o=new Date;const l=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=l;const a=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],n=function(l,n,i){let r=null;if(e.isInitialized&&(o=new Date),r=l?l.grid?l:new Smart.Grid.Row({data:l,index:n,grid:e,createdBy:e.currentUser,createdDate:o}):new Smart.Grid.Row({data:{},index:n,grid:e,createdBy:e.currentUser,createdDate:o}),a)for(let e=0;e<a.length;e++){const t=a[e],o=t.getCellValue(r.id,t.dataField,l);void 0!==o&&(r.data[t.dataField]=o)}if(e.rowById[r.id]&&(r.id=e.rows.length,e.rowById[r.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};r.id=e()}if(e.onRowInit){e.onRowInit(n,r,e),30!==r.height&&(r.cellHeight=r.height);for(let t in r)-1!==r.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}))}if(r.selected&&(e._selection.rows[r.id]=!0,e._selection.indexes[r.index]=r.index),r.freeze&&r.visible){if(!0===r.freeze||"near"===r.freeze){e.rows.splice(t++,0,r);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}else if("far"===r.freeze){e.rows.push(r);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&e._frozenFarRows.push(t)}}else e.rows[n]?e.rows.splice(n,0,r):e.rows.push(r),r.data&&r.data.$&&(r.data.$.history=r.history,r.data.$.starred=r.starred,r.data.$.comments=r.comments,r.data.$.style=r.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&e._recycle(!1,!0),e._onRowInserted&&e._onRowInserted(l),i&&i(l)};if(void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:n});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([n],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[a.id];a.id=a.data.id=n;const o=e._getId();o&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a,t&&(t[o]=n,e.dataSource.dataItemById[a.id]=t,a.data=t)}e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),i&&i(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([n],[t],o,e)}else{const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n];void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),i&&i(t)}},i=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},r=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=n,e._removeLastRow=i,e._removeAt=r,e._rowHeight=e._autoRowHeight;const d=e.dataSource.length;if(e.setAttribute("aria-rowcount",d),e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];n(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];n(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(l(),e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let a=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)n(o[t],e.dataSource.length-o.length+t);else n(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],l=[],i=[];for(let r=0;r<i.length;r++){const d=t.index[r];e.rows[d]?(e.rows[d].data=i[r],o.push(d),l.push(e.rows[d]),i.push(e.rows[d].data)):(n(i[r],i[r].$.index),a=!0)}e.onRowUpdated&&e.onRowUpdated(o,l,i,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:n(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":n(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":r(t.index);break;case"removeLast":i();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==d){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize)),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize))}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),e.onLoad())}}l(),("update"!==t.action||a)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?e._frozenNearRows.push(o):"far"===o.freeze&&e._frozenFarRows.push(o),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]&&(l.data=e.dataSource[o],void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)),-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l))})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l.data=o,l.id=o.$.id,e.rowById[l.id]=l}return e.rows.canNotify=!0,void e.refresh()}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||e._render()})),e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),void super.render();const o=e.context;e.context=e,e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&e.header.buttons.indexOf("views")>=0&&e._updateKanbanTaskFields()),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale,e.$.header.appendChild(t),e.$.headerBar=e.$.header.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}a&&e.addFilter(t,a,!1)}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t&&e.addFilter(o.dataField,t,!1)}}e.refreshFilters()}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t){if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view&&e._initKanbanView()}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(){const e=this,t=e.conditionalFormatting;if(!t||0===t.length)return;if(!e._defaults){const t=getComputedStyle(e);e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)}}e._formatter||(e._formatter=new Smart.Utilities.ConditionalFormatter(e.dataSource));const o=e._defaults,l=e._formatter,a=[],n=function(t){if("all"===t){if(e.columns&&e.columns.map){const t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||t.push(l.dataField)}return t}return[]}return[t]};for(let e=0;e<t.length;e++){t[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:o.fontFamily,fontSize:o.fontSize,text:o.text,highlight:o.highlight},t[e]);const i=t[e],r=n(i.column),d=i.condition;l.color=i.highlight,l.comparator=i.firstValue,l.min=i.firstValue,l.max=i.secondValue;const s=l.format(d,r);for(let e in s){const t=s[e];for(let e in t){const o=t[e];o.color=i.text,o.fontFamily=i.fontFamily,o.fontSize=i.fontSize}}a.push(s)}if(e._formattingPanel&&(e._formattingPanel.items=t),0===a.length)return a[0];const i={};for(let e=0;e<a.length;e++){const t=a[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){i[e]||(i[e]={});for(let t in o)i[e][t]=Object.assign({},i[e][t],o[t])}}}e._conditionalFormatting=i}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const d=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:d,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));n.grid=e,e.columns.push(n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);"near"===e.rowDetail.position?(o.freeze="near",a.freeze="near",e.viewColumns.splice(l,0,a),e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30}),n=new Smart.Observable(a,a.observables);n.canNotify=!1,e.viewColumns.push(n),e._frozenFarColumns.splice(0,0,n);const i=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),r=new Smart.Observable(i,i.observables);r.canNotify=!1,"near"===e.editing.commandColumn.position?(i.freeze="near",r.freeze="near",e.viewColumns.splice(l,0,r),e._frozenNearColumns.splice(l,0,r)):(e.viewColumns.push(r),e._frozenFarColumns.splice(0,0,r)),e._commandColumn=r;const d=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(d,d.observables);if("near"===d.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s)),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}t._renderColumns(),t.__columnHeaderHeight=null,t.refresh()}onAttached(){const e=this;e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.isRendered&&e.isCompleted&&e._render()}onDetached(){const e=this;if(!e.isRendered)return;["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.querySelector("smart-grid-toolbar");if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}_observeColumns(){const e=this,t=function(t,o,l,a){l===a&&"selected"!==o||(t.propertyChanged(o,l,a),e.onColumnChange&&t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a))};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l&&(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),delete e.columnByDataField[l.dataField]),e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,requestAnimationFrame((()=>{if(e.filtering.enabled&&e.filtering.filterRow.visible)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(t._isUpdating)return;if(t.editing.isEditing)return;const o=t.querySelector("smart-grid-toolbar");if(!o||!o.$.headerDropDown.classList.contains("open"))if(t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&!t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&e.deltaX){const o=t.scrollLeft;if(0===o&&e.deltaX<0||o===t.scrollWidth&&e.deltaX>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaX<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaX)>=100?t._scrollView.scrollLeft+=l:t._scrollView.scrollLeft+=e.deltaX}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaY<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100?t._scrollView.scrollTop+=l:t._scrollView.scrollTop+=e.deltaY}}_refresh(){const e=this;if(e._isUpdating)return;const t=e.$.verticalScrollBar.offsetWidth;e.removeAttribute("grouped"),e.removeAttribute("tree");let o=!0;e.__autoHeightRows&&(e.__autoHeightRows=null,e._refreshColumnsResponsiveVisibility(),e._recycle(),o=!1),e._groups||(e._groups=[]),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>=0&&("advanced"===e.grouping.renderMode?e.setAttribute("grouped",""):e.setAttribute("tree",""),e._groups||(e._groups=[].concat(e.dataSource.groupBy.toArray())||[]),e._renderGroupBar()),e.grouping.enabled&&e.dataSource.groupBy&&0===e.dataSource.groupBy.length?e.$.breadcrumb&&(e.$.breadcrumb.dataSource=[]):e.dataSource.boundHierarchy&&(e.setAttribute("tree",""),e.setAttribute("role","treegrid")),(e.isInitialized||o)&&e._refreshColumnsResponsiveVisibility(),e._refreshLayout(),t!==e.$.verticalScrollBar.offsetWidth&&(e.__scrollWidth=null,e._refreshColumnsResponsiveVisibility(),e._refreshScrollBars(),0===e.$.verticalScrollBar.offsetWidth&&e.isRendered&&requestAnimationFrame((()=>{e._refreshScrollBars()}))),e._refreshSelection(),e._recycle(),e._refreshHeaderBar(),e._recyclingRows&&0===e._recyclingRows.length&&(e.$.placeholder.classList.remove("smart-hidden"),e.scrollHeight=0,e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${e.localize("filteredRecords")}`)),requestAnimationFrame((()=>{e._width=e.offsetWidth,e._height=e.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return;t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const d=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=d;let s=0,u=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(s+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(u+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===u&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=s,e._autoGeneratedColumnsFarWidth=u,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1);e._refreshRowHierarchy()}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let d=0;const s=function(t,l){for(let u=0;u<t.length;u++){const c=t[u];let m=o.rowById[c.$.id];if(n&&(m=o.rows[d],m||(m=r(c),o.rows.push(m)),c[i.leaf]?m.id=c.$.id:m.id="Group_"+c.$.id,o.rowById[m.id]=m),m||(m=r(c),o.rowById[m.id]=m),m.data=c,m.leaf=c[i.leaf]||!1,m.level=c[i.level],m.groupDataField=c.groupDataField,!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=c.label,m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),c.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),c.parent?(m.parent=o.rowById[c.parent.$.id],m.parentId=c.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(c);e&&(m.expanded=c[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==c[i.expanded]&&(m.expanded=c[i.expanded]);let g=!!e||m.expanded;a&&(g=!0);const p=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(p&&!m.data[p]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];c.parent&&c.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[p])&&(d++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(d++,g||c[i.leaf])if(l.push(m),c.children&&c.children.length>0){const e=s(c.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),c.children&&c.children.length>0){const e=s(c.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let u=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<u.length;o++){let l=u[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;if((a||null===a)&&0===l.level&&!l.parent){if(0===t(l.children).length)continue;e.push(l)}}u=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}o.rowHierarchy=s(u,new Array);let c=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&c.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=l++:t.visibleIndex=-1:t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=c),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow&&o._initializeRowElements(),o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e.editing.addNewRow.visible&&1===e._recyclingRows.length&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.header.visible?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));e.header.visible&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshElementsVisibility(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),d=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),s=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),u=parseInt(e.$.columnFarContainer.style.width)+parseInt(d.borderLeftWidth);if(e.__frozenNearWidth=s,e.__frozenFarWidth=u,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=d,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden")),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(s>0||u>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-s-u+"px",e.rightToLeft?o.style.right=s+"px":o.style.left=s+"px",o.style.setProperty("--smart-scroll-bar-near-size",s+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",u+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",u+e.__scrollBarSize+"px"))),t.refresh(),o.refresh()}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getColumns(){const e=this,t=[];if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}getState(){const e=this,t=e.getSortedColumns(),o=e.getFilteredColumns(),l=e.getGroups(),a=e.getSelectedCells(),n=e.getSelectedRows(),i=e.$.headerPager.querySelector("smart-pager");let r=0;return i&&(r=i.pagesCount),{sort:t,filter:o,groups:l,paging:{count:r,index:e.paging.pageIndex,size:e._pageSize},selectedCells:a,selectedRows:n}}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,t,e._farRowsAdded,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),0===o.columns.length&&o.column.element.classList.add("smart-hidden"),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_recycle(e,t,o){const l=this;if(l._layoutSuspended||!1===l.isAttached)return;if(l._isUpdating)return;if(l.editing.isEditing&&(l.endEdit(),l._isUpdating))return;l._recycleValues=void 0===o||o,l._removeCellContentPopup(),l._inputOverlay&&(l._inputOverlay.parentNode&&l._inputOverlay.parentNode.removeChild(l._inputOverlay),l._inputOverlay=null),l._selection.selectionRect&&l._refreshCellSelectionRect();const a=l._scrollView.scrollTop;let n,i=l._getRowIndexByPosition(a),r=l._recyclingRows,d=r[i],s=d?d.top:0,u=0,c=0,m=0,g=0;if(l._cellRowSpan&&l._cellRowSpan.maxSpan>0){let e=0;if(i>=5?e=5:i>=4?e=4:i>=3?e=3:i>=2?e=2:i>=1&&(e=1),e>0){const t=r[i-e];t&&(d=t,s=d?d.top:0,m=e*d.height,i-=e)}}l._cellRowSpan=[];for(let e=0;e<l._cellsMerge.length;e++){const t=l._cellsMerge[e],o=r.indexOf(t.row);if(i>o&&i<=o+t.rowSpan&&(i=o,d=t.row,m=Math.max(m,s-d.top),s=d.top,l.$.rowContainer.style.top=l.__frozenNearHeight-a+s+"px"),t.colSpan>1)for(let e=0;e<l.viewColumns.length;e++){const o=l.viewColumns[e];let a=o.autoGenerated?o:l.columnByDataField[o.dataField];if(a.visible&&a.left+a.computedWidth-l._scrollView.scrollLeft>=u&&a.left-a.computedWidth-l._scrollView.scrollLeft<l._clientSize.width){let e=l.columnByDataField[t.column.dataField];g=Math.max(g,a.left-e.left+a.computedWidth);break}}}let p=null;if(!1!==e||l._cellsMerge.length>0){for(let e=0;e<l._columnElements.length;e++){const t=l._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<l._columnGroups.length;e++){const t=l._columnGroups[e],o=t.element;l.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px"}l._firstVisibleColumn=null,l._lastVisibleColumn=null;for(let e=0;e<l.viewColumns.length;e++){let t=l.viewColumns[e];if(t.visible&&(l._firstVisibleColumn||(l._firstVisibleColumn=t),l._lastVisibleColumn=t),t.element&&(t===l._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(u+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-l._scrollView.scrollLeft>=u-g&&t.left-t.computedWidth-l._scrollView.scrollLeft<l._clientSize.width){const o=l._columnElements[c++];o&&(o.set("column",t,!1),o.parentNode||l.$.columnContainer.appendChild(o),p||(p=t,l._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===n&&(n=t.left))}}}if(void 0===n&&(n=0),l.rightToLeft){const e=l._scrollView.scrollWidth-l._scrollView.scrollLeft-l._scrollView.vScrollBar.offsetWidth;l.$.columnContainer.style.right=e+"px",e<=0&&!l._scrollView.scrollWidth&&(l.$.columnContainer.style.right=-l.offsetWidth+l._computedColumnsWidth+"px")}else l.$.columnContainer.style.left=-l._scrollView.scrollLeft+"px";if(l.$.rowContainer.style.top=l.__frozenNearHeight-a+s+"px",l.isScrolling&&!l.isHScrolling&&(l._scrollUpdate&&clearTimeout(l._scrollUpdate),l._scrollUpdate=setTimeout((function(){l.isScrolling||(l.$.rowContainer.style.top=parseInt(l.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!l._rowElements)return;const h=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&l.dataSource.length>l.virtualModeCachedRowsCount&&"infinite"!==l.scrolling;if(i>=0){c=0;let e=Math.max(l._clientSize.height,l._overflowOffset),t=0;h&&(l.rowById=[],l.rows&&l.rows.length>0&&void 0===l.rows[l.rows.length-1].top&&(l.rows[l.rows.length-1].top=(l.rows.length-1)*l.rows[0].height),l.rows&&l.rows.length>0&&(t=l._getVirtualRowIndexByPosition(a),s=t*l.rows[0].height,l.$.rowContainer.style.top=l.__frozenNearHeight-a+s+"px",l.paging.enabled||(i=0)),l.paging.enabled&&(t=l.paging.pageIndex*l._pageSize));for(let o=i;o<r.length;o++){const n=r[o];if(0===n.height||!n.visible||!1===n.filtered||n.freeze&&n.visible)continue;const d=n.height;if(n.expandHeight&&(e+=l.offsetHeight+n.expandHeight),!(s+d>=a-m&&s<=a+e||l._autoHeight))break;{const e=l._rowElements[c++];if(!e)break;e.setAttribute("aria-rowindex",t+o+1),n.element=e,n.grid=l,h&&(n.index=o+t,n.visibleIndex=o+t,l.paging.enabled?(n.data=l.dataSource[i+c-1],n.data&&(n.id=n.data.$.id,l.rowById[n.id]=n)):(n.data=l.dataSource[c-1],n.data&&(n.id=n.data.$.id,l.rowById[n.id]=n))),n.render()}s+=d}}l._renderFrozenRows();let f=c;if(c<l._rowElements.length)for(let e=c;e<l._rowElements.length;e++){const e=l._rowElements[c++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}l.editing.addNewRow&&l.editing.addNewRow.visible&&"button"===l.editing.addNewRow.displayMode&&l._rowElements[f]&&(l._newRow||(l._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:l,addNewRow:!0,inline:!0,autoGenerated:!0})),l._newRow.element=l._rowElements[f],l._newRow.element.classList.remove("smart-hidden"),l._newRow.render()),h&&l._selection.selectionRect&&l._refreshCellSelectionRect()}_renderFrozenRows(){const e=this;let t=!1,o=!1;0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,d=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(d=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(d=4),"center"!==l&&"middle"!==l||(d+=i.height/2-n.height/2),"bottom"===l&&(d+=i.height-n.height-4),t.style.left=r+"px",t.style.top=d+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo,sorting:o.getSortedColumns(),filtering:o.getFilteredColumns(),grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action)return void(t&&t(e.result));if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling)o._recycle(!1,!1);else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){if(o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize)),o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1)}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&(t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max,e.closeMenu(),e._addingNewRow=!1}),0)},t}addNewColumn(e){e&&this.columns.push(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.remove(),void delete t.editing.addNewRow._addButton;if("float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)?t.editing.addNewRow._addButton.classList.remove("float"):t.computedVerticalScrollBarVisibility?t.computedVerticalScrollBarVisibility&&"float"===e&&t.editing.addNewRow._addButton.classList.add("float"):t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="")};t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&(t.editing.addNewRow._addButton||(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.appendChild(t.editing.addNewRow._addButton)),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o())})))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if(t._recycle(!1),t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")})))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e){const t=this;t.isInitialized&&(e&&(t._initializeRows(),t._initializeRowElements()),t._refresh(),t._refreshSummary())}refreshView(){this._recycle()}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t){const o=this;o._isUpdating--,o._isUpdating<0&&(o._isUpdating=0),!1!==e?o.refresh():!1!==t&&o.refreshView()}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
|
|
1443
1443
|
|
|
1444
1444
|
/***/ }),
|
|
1445
1445
|
|
|
1446
1446
|
/***/ 5110:
|
|
1447
1447
|
/***/ (() => {
|
|
1448
1448
|
|
|
1449
|
-
Smart.Utilities.Assign("Grid.Dialog",class{_openImagePreviewDialog(e){const t=this,a=e?[...e.parentNode.parentNode.querySelectorAll("img")]:[];if(e=e.cloneNode(),!t._dialogImagePreview){t._dialogImagePreview=t._createDialog({modal:!0,screenModal:!0,left:"screenMiddle",top:"screenCenter",width:"80%",height:"80%"}),t._dialogImagePreview.content.innerHTML='<div style="width: 100%; height: 100%;"><div class="images-container"></div><div class="image-preview"></div></div>';const e=t._dialogImagePreview.content.firstElementChild;e.style.display="grid",e.style.gridTemplateColumns="50px 1fr"}const i=t._dialogImagePreview.querySelector(".images-container");i.innerHTML="";const l=(e,a)=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const i=150+Math.min(850,e.width),l=150+Math.min(650,e.height);t._dialogImagePreview.style.width=i+"px",t._dialogImagePreview.style.height=l+"px",!1!==a&&(t._dialogImagePreview.style.left="calc(50% - "+Math.min(850,t._dialogImagePreview.offsetWidth/2)+"px)",t._dialogImagePreview.style.top="calc(50% - "+Math.min(650,t._dialogImagePreview.offsetHeight/2)+"px)");const n=getComputedStyle(t._dialogImagePreview),o=parseInt(n.top),r=parseInt(n.left);(window.offsetWidth<i||window.offsetHeight<l||o<0||r<0)&&(t._dialogImagePreview.style.left="0px",t._dialogImagePreview.style.top="0px",t._dialogImagePreview.style.width="100%",t._dialogImagePreview.style.height="100%"),e.style.maxWidth="100%"},n=()=>{const e=t._dialogImagePreview.querySelector(".images-container");let a=-1;return e.querySelectorAll("img").forEach(((e,t)=>{if(e.hasAttribute("active"))return a=t,!0})),a},o=e=>{const a=t._dialogImagePreview.querySelector(".images-container");e&&a.querySelectorAll("img").forEach((t=>{if(t.style.borderColor="transparent",t.removeAttribute("active"),t.src===e.src){t.style.borderColor="var(--smart-primary)",t.setAttribute("active",""),r.innerHTML=`<img src="${t.src}"/>`;const e=r.querySelector("img");e.onload=()=>{l(e,!1)}}}))};if(a.length>1)for(let t=0;t<a.length;t++){const l=a[t].cloneNode();l.style.width="40px",l.style.height="40px",l.style.cursor="pointer",l.style.borderStyle="solid",l.style.borderWidth="1px",l.style.borderColor="transparent",l.style.borderRadius="var(--smart-border)",l.style.marginTop="10px",l.title=a[t].title||a[t].parentNode.title,a[t].src===e.src&&(l.style.borderColor="var(--smart-primary)",l.setAttribute("active","")),i.appendChild(l),l.onmouseenter=()=>{l.style.borderColor="var(--smart-primary)"},l.onmouseleave=()=>{l.hasAttribute("active")||(l.style.borderColor="transparent")},l.onclick=()=>{o(l)}}const r=t._dialogImagePreview.content.querySelector(".image-preview");r.innerHTML="",r.appendChild(e),t._dialogImagePreview.btnClose.onclick=e=>{t._dialogImagePreview.close(),e.preventDefault(),e.stopPropagation()},e.style.marginLeft="auto",e.style.marginRight="auto",e.style.maxWidth="",e.onload=()=>{l(e)},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){if("Escape"===e.key&&t._dialogImagePreview.close(),"ArrowUp"===e.key||"ArrowLeft"===e.key){const t=n();o(a[t-1]),e.stopPropagation(),e.preventDefault()}else if("ArrowDown"===e.key||"ArrowRight"===e.key){const t=n();o(a[t+1]),e.stopPropagation(),e.preventDefault()}},t._dialogImagePreview.btnClose.tabIndex=0,t._dialogImagePreview.onOpen=()=>{setTimeout((()=>{t._dialogImagePreview.btnClose.focus()}),100)},t._dialogImagePreview.footer.remove(),t._dialogImagePreview.header.parentNode.style.backgroundColor="var(--smart-background)",t._dialogImagePreview.open()}_openImageDialog(e,t){const a=this,i=a._dialogImage||a._createDialog(),l='<span class="smart-grid-icon smart-icon-image show"></span>'+a.localize("dialogImageHeader");if(i.cell||(i.cell=e),i.header.innerHTML=l,i.column=e.column,i.command=t,i.classList.add("smart-grid-image-dialog"),!a._dialogImage){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){i.fileUpload.value="",i.input.value="";let e=i.cell.editor.instance.getValue();if("[]"!==e)if(e&&"string"==typeof e&&e.indexOf("http")>=0)i.input.value=JSON.parse(e)[0].value,i.tabs[1].click(),n("input");else{i.tabs[0].click();const t=(e,t)=>{let a=e.split(","),i=a[0].match(/:(.*?);/)[1],l=atob(a[1]),n=l.length,o=new Uint8Array(n);for(;n--;)o[n]=l.charCodeAt(n);return new File([o],t,{type:i})},a=new DataTransfer;"string"==typeof e&&e.indexOf("base64")>=0&&(e=JSON.parse(e)),Array.isArray(e)&&(e.forEach((e=>{a.items.add(t(e.value,e.label))})),i.fileUpload.files=a.files,n())}else i.tabs[0].click()},i.onClose=function(){},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){if(i.tabs[1].classList.contains("active"))i.input.value?e.editor.instance.setValue([{label:i.input.value,value:i.input.value}]):e.editor.instance.setValue([]),a._endCellEdit(i.cell);else{const t=(e,t)=>{var a=new FileReader;a.readAsDataURL(e),a.onload=function(){t(a.result)},a.onerror=function(){t("error")}},l=[];if(i.fileUpload.files.length)for(let n=0;n<i.fileUpload.files.length;n++){const o=i.fileUpload.files[n];t(o,(t=>{"error"===t&&console.log("Image load error"),l.push({value:t,label:o.name}),l.length===i.fileUpload.files.length&&(e.editor.instance.setValue(l),a._endCellEdit(i.cell))}))}else e.editor.instance.setValue([]),a._endCellEdit(i.cell)}i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogImage=i,i.content.innerHTML=`\n <div>\n <div>\n <div class="tabs">\n <div class="active tab">\n <span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogImageDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${a.localize("dialogImageLink")}</label>\n </div>\n </div>\n </div>\n <div class="smart-grid-drop-zone">\n <div>\n <div class="title"><span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogImageUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${a.localize("dialogImageDrop")}</label></div>\n </div> \n <input accept=".jpg, .jpeg, .png" type="file" multiple="multiple" style="display: none;">\n </div>\n <div class="smart-hidden url-zone">\n <div class="url-title">\n ${a.localize("dialogImageURL")}\n </div>\n <div class="upload">\n <smart-input placeholder="https://example.com/image.png" class="underlined"></smart-input>\n <br/>\n <smart-button disabled class="success">${a.localize("dialogImageURLUpload")}</smart-button>\n </div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,i.input=i.querySelector("smart-input"),i.dropZone=i.querySelector(".smart-grid-drop-zone"),i.upload=i.querySelector(".title"),i.fileUpload=i.querySelector("input"),i.preview=i.querySelector(".preview"),i.tabs=i.querySelectorAll(".tab"),i.urlZone=i.querySelector(".url-zone"),i.uploadButton=i.querySelector("smart-button");const t=["image/apng","image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon"],l=e=>t.includes(e.type);i.dropZone.ondrop=i.dropZone.dropHere=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;const a=i.column.editor.maxImages||5;for(let a=0;a<e.dataTransfer.items.length;a++)if("file"===e.dataTransfer.items[a].kind){const i=e.dataTransfer.items[a].getAsFile();l(i)&&t++}if(t===e.dataTransfer.files.length||t===a){const t=new DataTransfer;let l=[...e.dataTransfer.files],o=[...i.fileUpload.files];l.length>a&&(l=l.slice(0,5)),o.length>a&&(o=o.slice(0,5)),o.forEach(((e,i)=>{i<a&&t.items.add(e)})),l.forEach(((e,i)=>{i<a&&t.items.add(e)})),i.fileUpload.files=t.files,n()}}else i.fileUpload.files=e.dataTransfer.files,n()},i.dropZone.ondragover=e=>{e.preventDefault()},i.tabs[0].onclick=()=>{i.tabs[0].classList.add("active"),i.tabs[1].classList.remove("active"),i.dropZone.classList.remove("smart-hidden"),i.urlZone.classList.add("smart-hidden"),i.updatePreview()},i.tabs[1].onclick=()=>{i.tabs[0].classList.remove("active"),i.tabs[1].classList.add("active"),i.dropZone.classList.add("smart-hidden"),i.urlZone.classList.remove("smart-hidden"),i.updatePreview("input")},i.uploadButton.onclick=()=>{i.updatePreview("input")};const n=e=>{const t=i.preview,o=i.fileUpload;function r(e){return e<1024?e+"bytes":e>=1024&&e<1048576?((e/1024).toFixed(1)+"KB").replace(".0",""):e>=1048576?(e/1048576).toFixed(1)+"MB":void 0}for(;t.firstChild;)t.removeChild(t.firstChild);const s=()=>{const e=document.createElement("div");return e.classList.add("item"),e.onpointerdown=t=>{const l=e.getBoundingClientRect();if(i.input.value="",t.clientY>=l.bottom-12){if(t.clientX>l.left+l.width/2-13&&t.clientX<l.left+l.width/2+13){e.remove();const t=i.preview.querySelectorAll(".item"),a=new DataTransfer;t.forEach((e=>{a.items.add(e.file)})),o.files=a.files,i.clearButton&&0===t.length&&i.clearButton.classList.remove("show")}}else a._openImagePreviewDialog(e.querySelector("img"))},e},d=()=>{const e=document.createElement("div");e.classList.add("list");const l=document.createElement("div");l.classList.add("smart-grid-icon","show","smart-icon-delete"),l.title=a.localize("clear"),t.appendChild(l),l.onclick=()=>{o.value="",i.input.value="",n()},i.clearButton=l,t.appendChild(e)};if("input"===e){const e=i.input.value;if(e){const t=s();if(d(),e.endsWith("png")||e.endsWith("jpeg")||e.endsWith("jpg")){const a=document.createElement("img");a.src=e,t.appendChild(a)}i.preview.lastChild.appendChild(t)}else{const e=document.createElement("p");e.textContent=a.localize("dialogImageFileUpload"),t.appendChild(e)}}else{const e=o.files;if(0===e.length){const e=document.createElement("p");e.textContent=a.localize("dialogImageFileUpload"),t.appendChild(e)}else{d();const n=new DataTransfer,c=i.column.editor.maxImages||5,m=i.column.editor.maxImageSize||524288;let u=0,b=[];for(const o of e){const e=s();if(u>=c){b.push(o.name);continue}const d=document.createElement("div");if(l(o)){d.textContent=`${o.name}, ${r(o.size)}.`,d.textContent.length>20&&(d.textContent=`${o.name.substring(0,5)}...${o.name.substring(o.name.length-4)}, ${r(o.size)}.`);const i=document.createElement("img");if(i.src=URL.createObjectURL(o),o.size>m){const e=document.createElement("p");e.textContent=a.localize("dialogImageSize",{value:o.name,fileSize:r(m)}),t.appendChild(e);continue}n.items.add(o),e.file=o,e.title=d.textContent,e.appendChild(i),e.appendChild(d)}i.preview.querySelector(".list").appendChild(e),u++}if(b.length>0){const e=document.createElement("p");e.textContent=a.localize("dialogImageCount",{files:b.toString(),fileCount:c}),t.appendChild(e)}o.files=n.files}}};i.updatePreview=n,i.fileUpload.onchange=()=>{if(0===i.fileUpload.files.length&&i._tempFiles)i.fileUpload.files=i._tempFiles;else if(i._tempFiles){const e=new DataTransfer,t=[...i.fileUpload.files];[...i._tempFiles].forEach((t=>{e.items.add(t)})),t.forEach((t=>{e.items.add(t)})),i.fileUpload.files=e.files}n()},i.input.onchange=i.input.onblur=i.input.onkeyup=()=>{i.uploadButton.disabled=!i.input.value||!i.input.value.startsWith("https://")},i.upload.onclick=()=>{i._tempFiles=[];const e=new DataTransfer;[...i.fileUpload.files].forEach((t=>{e.items.add(t)})),i._tempFiles=e.files,i.fileUpload.click()}}i.open(),setTimeout((function(){i.btnConfirm.focus()}),100)}_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}_createDialog(e){const t=this;let a=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(a.modal=e.modal),void 0!==e.screenModal&&(a.screenModal=e.screenModal),a.setAttribute("animation","none"),a.classList.add("smart-window","smart-grid-dialog"),a.style.width="auto"===e.width?e.width:e.width+"px",a.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(a.style.width=e.width),e.height&&"string"==typeof e.height&&(a.style.height=e.height),a.style.left="",a.style.top="",a.innerHTML='<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div id="headerSection" class="smart-header-section">\n <div class="smart-header"></div>\n <div class="smart-buttons-container">\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-prev-button" aria-label="Previous Record" smart-id="prevButton"></button>\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-next-button" aria-label="Next Record" smart-id="nextButton"></button>\n <button class ="smart-button smart-element smart-close-button" aria-label="Close" smart-id="closeButton"></button>\n </div>\n </div>\n <div class="smart-content"><div class="smart-content-container"></div></div>\n <div class ="smart-footer">\n <div class ="smart-stack-layout right spacing">\n <smart-button class ="smart-confirm-button item primary">Ok</smart-button>\n <smart-button class ="smart-cancel-button item">Cancel</smart-button>\n </div>\n </div>\n </div>\n </div>\n ',a.querySelector&&a.querySelector(".smart-content")&&(a.content=a.querySelector(".smart-content").firstChild),a.footer=a.querySelector(".smart-footer"),a.header=a.querySelector(".smart-header"),a.btnConfirm=a.querySelector(".smart-confirm-button"),a.btnCancel=a.querySelector(".smart-cancel-button"),a.btnClose=a.querySelector(".smart-close-button"),a.btnNext=a.querySelector(".smart-next-button"),a.btnPrev=a.querySelector(".smart-prev-button");const i=document.createElement("div");return i.classList.add("smart-grid-dialog-overlay"),i.onclick=function(){},a.overlay=i,a.remove=function(){a.parentNode&&a.parentNode.removeChild(a)},a.close=function(){a.classList.remove("open"),delete t._resizeHandling,a.addEventListener("transitionend",a.remove),a.addEventListener("transitioncancel",a.remove),a.modal&&a.overlay.parentNode&&a.overlay.parentNode.removeChild(a.overlay),a.onClose&&a.onClose()},a.open=function(i,l){a.removeEventListener("transitionend",a.remove),a.removeEventListener("transitioncancel",a.remove),document.body.appendChild(a),t._resizeHandling=!1,void 0===i&&(i=e.left),void 0===l&&(l=e.top),requestAnimationFrame((function(){a.classList.add("open");const e=a.querySelector('[bind="name"]');if(e){const t=e.querySelector("smart-input");t&&t.focus()}const n=function(e,i){const l=t.offset(t);switch("center"===e&&"horizontal"===i&&(e="middle"),e){case"top":return l.top;case"bottom":return Math.max(l.top,l.top+t.offsetHeight-a.offsetHeight);case"center":return Math.max(l.top,l.top+t.offsetHeight/2-a.offsetHeight/2);case"left":return l.left;case"middle":return l.left+t.offsetWidth/2-a.offsetWidth/2;case"right":return l.left+t.offsetWidth-a.offsetWidth}return"horizontal"===i?parseInt(e)+l.left:"vertical"===i?parseInt(e)+l.top:"number"==typeof e?e:parseInt(e)};a.style.left=n(i,"horizontal")+"px",a.style.top=n(l,"vertical")+"px",a.setPosition=(e,t)=>{t?a.style.left=n(e,"horizontal")+"px":a.style.top=n(e,"vertical")+"px"},"screenMiddle"===i&&(a.style.left="calc(50% - "+a.offsetWidth/2+"px)"),"screenCenter"===l&&(a.style.top="calc(50% - "+a.offsetHeight/2+"px)")})),a.modal&&(a.screenModal?document.body.appendChild(a.overlay):t.appendChild(a.overlay)),a.onOpen&&a.onOpen()},a}_openAddRowDialog(e,t){const a=this;if(!a.editing.addDialog.enabled)return!1;const i=a._dialogAddRow||a._createDialog(),l="{{message}}"===a.editing.dialog.header?a.localize("dialogAddHeader"):a.editing.dialog.header,n=i.content;i.header.innerHTML=l,e.grid=a,void 0===e.index&&(e.index=a.rows.length,a._rowsAdded&&(e.index+=a._rowsAdded.length));const o=e.cells;let r=null,s=0;if(a._cellEditors||(a._cellEditors=[]),!a._dialogAddRow){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogAddButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogAddButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0},i.onClose=function(){a.editing.dialog.visible=!1},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){const e={};for(let t=0;t<o.length;t++){const i=o[t],l=a._getEditorValue(i),n=a._getEditorId(i),r=a._cellEditors[n];r&&(l&&l.error?(e[i.column.dataField]=l.value,r.detach()):(e[i.column.dataField]=l,r.detach()))}const l=a._rowsAdded?a._rowsAdded.length:0,n=new Smart.Grid.Row({index:a.rows.length+l,id:Smart.Utilities.Core.createGUID(),grid:a,data:e});i.close(),t(n,0===i.index)},i.onkeydown=function(e){const t=e.key;"Enter"===t?i.btnConfirm.onclick():"Escape"===t&&i.close()},n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;s%2==0&&(r=document.createElement("div"),r.classList.add("smart-grid-edit-dialog-row"),n.appendChild(r));const i=document.createElement("div");i.classList.add("col-sm-6");const l=document.createElement("div");l.classList.add("column");const o=document.createElement("label");o.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),i.appendChild(l),r.appendChild(i),l.appendChild(o),l.appendChild(d),s++}}i.open(),i.index=e.index;let d=0;for(let e=0;e<o.length;e++){const t=o[e],l=t.column,n=l.dataField,r=i.querySelector("[editor="+n+"]");if(!r)continue;r.innerHTML="";let s="";void 0!==t.value&&(s=t.value),"int64"!==l.dataType&&"number"!==l.dataType&&"int"!==l.dataType&&"float"!==l.dataType||(s=0),"date"===l.dataType&&(s=new Date),"bool"!==l.dataType&&"boolean"!==l.dataType||(s=!1);let c=null;switch(t.editor.template){default:case"custom":c=a._getCustomCellEditor(t);break;case"image":c=a._getImageCellEditor(t);break;case"checkBox":c=a._getCheckBoxCellEditor(t);break;case"autoComplete":c=a._getAutoCompleteCellEditor(t);break;case"dropDownList":c=a._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=a._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=a._getMaskCellEditor(t);break;case"checkInput":c=a._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=a._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=a._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=a._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=a._getDateInputCellEditor(t);break;case"dateRangeInput":c=a._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=a._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=a._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?a._getNumberInputCellEditor(t):a._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(s),0===d&&setTimeout((()=>{c.focus()}),100),!t.editor.isInitialized&&(t.editor.isInitialized=!0,t.editor.onInit)){const e=t.editor.onInit(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,i="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)i[e]=a[e]}}if(t.editor.onRender){const e=t.editor.onRender(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,i="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)i[e]=a[e]}}r.appendChild(c.element),c.element.onfocus=()=>{r.setAttribute("focus","")},c.element.onblur=()=>{r.removeAttribute("focus")},d++}a._dialogAddRow=i}_openEditDialog(e,t){const a=this;if(!a.editing.dialog.enabled)return!1;const i=a._dialogEdit||a._createDialog(),l="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeader",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header,n=i.content;i.header.innerHTML=l,i.row=a.editing.editRow,a.editing.recordNavigation&&i.classList.add("disable-animation");let o=null,r=0;if(void 0!==a._settingsDialogRowId){i.btnPrev.classList.remove("smart-hidden"),i.btnNext.classList.remove("smart-hidden");const e=e=>{const t=a.editing.editRow,l=a._recyclingRows.indexOf(t);let n=e?a._recyclingRows[l+1]:a._recyclingRows[l-1];if(a.grouping.enabled&&a.dataSource.groupBy&&a.dataSource.groupBy.length>0){let t=1;for(;n&&!n.leaf;)n=e?a._recyclingRows[l+t]:a._recyclingRows[l-t],t++}if(n){i.classList.add("disable-animation"),a.editing.recordNavigation=!0;const e=i.querySelector("[focus]");if(e){const t=e.closest(".smart-grid-edit-dialog-row"),i=t.closest(".smart-grid-edit-dialog-editors-container");let l=-1;if(i&&(l=[...i.children].indexOf(t)),a.cancelEdit(),a._openRowSettingsDialog(n.id),a._dialogEdit&&l>=0){const e=a._dialogEdit.querySelectorAll(".smart-grid-edit-dialog-row")[l];if(e){const t=e.querySelector(".smart-grid-dialog-editor");t.setAttribute("focus",""),t.querySelector(".smart-grid-cell-editor").focus()}}}else a.cancelEdit(),a._openRowSettingsDialog(n.id)}};i.btnNext.onmousedown=t=>{e(!0),t.preventDefault(),t.stopPropagation()},i.btnPrev.onmousedown=t=>{e(!1),t.preventDefault(),t.stopPropagation()}}if(!a._dialogEdit)if(i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0,a._settingsDialogRowId&&i.editorsContent&&i.editorsContent.offsetHeight&&(i.editorsContent.style.maxHeight=i.editorsContent.offsetHeight+40+"px")},i.onClose=function(){a.editing.dialog.visible=!1,i.row&&(i.row.showDetail=!1)},i.btnCancel.onclick=function(){a.cancelEdit()},i.btnClose.onclick=function(){a.cancelEdit()},i.btnConfirm.onclick=function(){if(void 0!==a._settingsDialogRowId){if(a.rowById[a._settingsDialogRowId]){const e=a.editing.editRow;if(!e)return!1;const t=e.cells;let l={};e.element.removeAttribute("error");for(let e=0;e<t.length;e++){const i=t[e],n=a._getEditorValue(i);l[i.column.dataField]=n}const n=a.validateRow(e.id,l);if(Object.keys(n).length>0){let e=!0;for(let l=0;l<t.length;l++){const o=t[l],r=n[o.column.dataField],s=i.querySelector(`[label-for="${o.column.dataField}"]`);if(s&&(s.innerHTML=""),r)for(let t in r){const i=r[t];let l="";if(!i)continue;let n=i[t];"minLength"!==t&&"maxLength"!==t||(n=i[t.toLowerCase()]),l=i.message?i.message:"required"===t||"valueMissing"===t?a.localize("requiredValue",{value:o.column.label}):"min"===t?a.localize("invalidMinValue",{value:o.column.label,min:n.min}):"max"===t?a.localize("invalidMaxValue",{value:o.column.label,max:n.max}):"minLength"===t?a.localize("invalidMinLengthValue",{value:o.column.label,min:n.requiredLength}):"maxLength"===t?a.localize("invalidMaxLengthValue",{value:o.column.label,max:n.requiredLength}):a.localize("invalidValue"),e=!1,s&&(s.innerHTML=l)}}if(!e)return}const o=e.style;e.updatedDate=new Date,e.updatedBy=a.currentUser,e.style=i._rowStyle,e.comments=i._rowComments;const r=a.dataSource.dataItemById[e.id];if(r){const t=r.$.index;a.dataSource&&e.comments!==a.dataSource.boundSource[t].comments&&(a._sortedColumns&&a._sortedColumns.length>0?r.comments=e.comments:a.dataSource.boundSource[t].comments=e.comments)}e.style=i._rowStyle,a.onRowStyle&&o!==e.style&&(null===o?a.onRowStyle(e.index,e,e.style):o.background===e.style.background&&o.color===e.style.color&&o.fontSize===e.style.fontSize&&o.fontStyle===e.style.fontStyle&&o.fontFamily===e.style.fontFamily&&o.fontWeight===e.style.fontWeight&&o.status===e.style.status&&o.textDecoration===e.style.textDecoration||a.onRowStyle(e.index,e,e.style))}if(i.columnVisibility){let e=!1;const t=a.columns.canNotify;a.columns.canNotify=!1;for(let t in i.columnVisibility){const l=a.columnByDataField[t];l.visible!==i.columnVisibility[t]&&(l.visible=i.columnVisibility[t],e=!0)}if(a.columns.canNotify=t,e)return a.endEdit(),a.refresh(!1),void(a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh()))}}a.endEdit(),a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh())},i.onkeydown=function(e){const t=e.key,i=a.editing.commandKeys;for(let e in i){const l=i[e];if(t===l.key){a._applyCommand(l.command);break}}},a.editing.editRow)if(void 0!==a._settingsDialogRowId)a._applySettingsDialogLayout(i,n,a.editing.editRow);else{n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;r%2==0&&(o=document.createElement("div"),o.classList.add("smart-grid-edit-dialog-row"),n.appendChild(o));const i=document.createElement("div");i.classList.add("col-sm-6");const l=document.createElement("div");l.classList.add("column");const s=a._settingsDialogRowId?document.createElement("div"):document.createElement("label");s.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),i.appendChild(l),o.appendChild(i),l.appendChild(s),l.appendChild(d),r++}}else{const t=e.column,a=document.createElement("div");a.classList.add("smart-grid-dialog-editor"),a.setAttribute("editor",""),a.setAttribute("template",t.editor.template),n.appendChild(a)}if(i.open(),a.editing.editRow){const a=i.querySelector("[editor="+e.column.dataField+"]");a&&(a.innerHTML="",a.appendChild(t.element),t.element.onfocus=()=>{a.setAttribute("focus","")},t.element.onblur=()=>{a.removeAttribute("focus")})}else{const a=e.column,l=i.querySelector("[editor]");l.innerHTML="",l.setAttribute("template",a.editor.template),l.appendChild(t.element),t.element.onfocus=()=>{l.setAttribute("focus","")},t.element.onblur=()=>{l.removeAttribute("focus")}}a._dialogEdit=i}_refreshCurrentUser(){const e=this,t=e.users;let a=e.currentUser,i=!0,l=!0,n=e.editing.enabled,o=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(i=!1!==a.allowAdd,l=!1!==a.allowComment,n=n&&!1!==a.allowEdit,o=!1!==a.allowRemove)),e._currentUser={allowAdd:i,allowComment:l,allowEdit:n,allowRemove:o,info:a}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-grid-color-input")},e}_applySettingsDialogLayout(e,t,a){const i=this;e.classList.add("smart-grid-dialog-expand-row");const l=e._rowStyle=JSON.parse(JSON.stringify(a._style)),n=e._rowComments=JSON.parse(JSON.stringify(a.comments)),o=[];e.columnVisibility=o;const r=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div");d.appendChild(r),d.appendChild(s),t.appendChild(d),d.classList.add("smart-grid-edit-dialog-layout"),r.classList.add("smart-grid-edit-dialog-editors-container"),s.classList.add("smart-grid-edit-dialog-activity-container");let c=0;for(let e=0;e<i.columns.length;e++){const t=i.columns[e];t.allowEdit&&!1!==t._visible&&c++}c>=8?r.classList.add("many"):r.classList.remove("many"),e.editorsContent=r,e.activityContent=s;const m=document.createElement("div"),u=document.createElement("div");s.appendChild(m),s.appendChild(u);let b=n&&n.length?" ("+n.length+")":"";m.innerHTML=`\n <div class="tabs">\n <div view="details" class="active tab"><div class="tab-label">${i.localize("detailsTab")}</div></div>\n <div view="comments" class="tab"><div class="tab-label">${i.localize("commentsTab")}${b}</div></div>\n <div view="history" class="tab smart-hidden"><div class="tab-label">${i.localize("historyTab")}</div></div>\n </div>\n <div class="details-tab">\n <div class="smart-grid-edit-dialog-row"><div class="column"><div class="header smart-grid-edit-dialog-column-info">${i.localize("format").replace(":","")}\n <span title="${i.localize("resetFormat")}" class="reset-format smart-grid-icon smart-icon-reload show"></span>\n </div>\n </div>\n <div class="format-layout">\n <div title="${i.localize("background")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-color-background show"></span><div class="background"></div>\n </div>\n <div title="${i.localize("color")}" class="format smart-grid-edit-dialog-column-info">\n <span style="border-bottom: 2px solid #46CA78;" color="#46CA78" class="format smart-grid-icon smart-icon-font show"></span><div class="color"></div>\n </div>\n <div class="format-layout button-group">\n <span title="${i.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${i.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${i.localize("underline")}" class="formatbtn underline smart-grid-icon smart-icon-underline show"></span>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("fontFamily").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-font show"></span><div class="font-family"></div>\n </div>\n <div title="${i.localize("fontSize").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-fontsize show"></span><div class="font-size"></div>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("status").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span color="#F1C58B" class="smart-grid-icon smart-icon-star show"></span><div class="status"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="comments-tab smart-hidden">\n <div class="column"><div class="comments-header smart-grid-edit-dialog-column-info">${i.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments">${i.localize("noComments")}</span></div>\n <div class="footer">\n <smart-text-area hint="${i.localize("comment")}" placeholder="${i.localize("comment")}" class="success underlined"></smart-text-area>\n <smart-button class="success">${i.localize("send")}</smart-button>\n </div>\n </div>\n </div>\n <div class="history-tab smart-hidden">\n <div class="history-layout">\n </div>\n </div>\n `;const g=m.querySelectorAll(".tab");i.storeHistory&&(!i._currentUser||i._currentUser&&!i._currentUser.info?g[g.length-1].classList.add("smart-hidden"):g[g.length-1].classList.remove("smart-hidden")),!i.users||i.users&&0===i.users.length||!i._currentUser||i._currentUser&&!i._currentUser.info?g[g.length-2].classList.add("smart-hidden"):g[g.length-2].classList.remove("smart-hidden"),m.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),a=m.querySelector(".details-tab"),l=m.querySelector(".comments-tab"),n=m.querySelector(".history-tab");a.classList.add("smart-hidden"),l.classList.add("smart-hidden"),n.classList.add("smart-hidden");for(let e=0;e<g.length;e++)g[e].classList.remove("active");switch(t.classList.add("active"),e){case"details":a.classList.remove("smart-hidden");break;case"comments":l.classList.remove("smart-hidden");break;case"history":n.classList.remove("smart-hidden"),i._refreshHistory()}}};const p=i._getColorInput();m.querySelector(".background").appendChild(p),p.onchange=()=>{l.background=p.value},l.background&&(p.value=l.background);const y=i._getColorInput();m.querySelector(".color").appendChild(y),y.onchange=()=>{l.color=y.value},l.color&&(y.value=l.color);const v=i._getColorInput();m.querySelector(".status").appendChild(v),v.onchange=()=>{l.status=v.value},l.status&&(v.value=l.status);const f=document.createElement("smart-input");f.style.width="auto",f.classList.add("underlined"),f.dropDownButtonPosition="right",f.readonly=!0,f.dropDownHeight="auto",f.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],f.onchange=()=>{l.fontFamily=f.value},l.fontFamily?f.value=l.fontFamily:f.selectedIndex=0,m.querySelector(".font-family").appendChild(f);const h=document.createElement("smart-input");h.style.width="auto",h.classList.add("underlined"),h.dropDownButtonPosition="right",h.readonly=!0,h.dropDownHeight="auto",h.dataSource=["-","8px","10px","12px","14px","18px","24px","36px"],h.onchange=()=>{l.fontSize=h.value},l.fontSize?h.value=l.fontSize:h.selectedIndex=0,m.querySelector(".font-size").appendChild(h);const C=m.querySelector(".button-group");C.onclick=e=>{const t=e.target.closest(".formatbtn");let a;t.classList.contains("checked")?(t.classList.remove("checked"),a=!1):(t.classList.add("checked"),a=!0),t.classList.contains("bold")?l.fontWeight=a?"bold":null:t.classList.contains("italic")?l.fontStyle=a?"italic":null:t.classList.contains("underline")&&(l.textDecoration=a?"underline":null)},l.fontWeight?C.children[0].classList.add("checked"):C.children[0].classList.remove("checked"),l.fontStyle?C.children[1].classList.add("checked"):C.children[1].classList.remove("checked"),l.textDecoration?C.children[2].classList.add("checked"):C.children[2].classList.remove("checked"),m.querySelector(".reset-format").onclick=()=>{for(let e=0;e<C.children.length;e++)C.children[e].classList.remove("checked");f.selectedIndex=0,h.selectedIndex=0,y.value="",p.value="",v.value="",l.fontWeight=null,l.fontStyle=null,l.textDecoration=null,l.fontSize=null,l.fontFamily=null};const w=m.querySelector(".comments-header"),S=m.querySelector('[view="comments"]'),A=m.querySelector(".comments-layout smart-text-area"),D=m.querySelector(".comments-layout smart-button"),L=m.querySelector(".comments-layout .footer"),_=m.querySelector(".comments-layout .comments");D.disabled=!0,_.innerHTML=`<span class="no-comments">${i.localize("noComments")}</span>`;const k=()=>{const e=_.querySelector(".no-comments");0===n.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},x=e=>{e.querySelector(".remove-button").onclick=e=>{const t=e.target,l=n.indexOf(t.comment);if(l>-1){const e=n[l];n.splice(l,1),i.$.fireEvent("commentRemove",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,n),t.element.remove();const o=n.length?"("+n.length+")":"";w.innerHTML=S.innerHTML=`${i.localize("comments").replace(":","")} ${o}`}}};for(let e=0;e<n.length;e++){const t=n[e],a=i._createComment(t);x(a),_.appendChild(a)}w.innerHTML=`${i.localize("comments").replace(":","")} ${b}`,k(),A.onfocus=()=>{L.classList.add("focus")},A.onblur=()=>{L.classList.remove("focus")},A.onkeyup=()=>{D.disabled=""===A.value},D.onclick=()=>{if(""===A.value)return;i._refreshCurrentUser();const e={text:A.value,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:i._currentUser.info?i._currentUser.info.id:-1,time:new Date},t=i._createComment(e);x(t),n.push(e),i.$.fireEvent("commentAdd",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,n),A.value="",D.disabled=!0,k(),_.appendChild(t);const l=n.length?"("+n.length+")":"";w.innerHTML=S.innerHTML=`${i.localize("comments").replace(":","")} ${l}`};for(let e=0;e<i.columns.length;e++){const t=i.columns[e];if(!t.allowEdit||!1===t._visible)continue;const a=document.createElement("div");a.classList.add("smart-grid-edit-dialog-row"),r.appendChild(a);const l=document.createElement("div"),n=i._settingsDialogRowId?document.createElement("div"):document.createElement("label"),s=t.validationRules&&t.validationRules.length>0?"*":"";n.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${i.columns[e].icon} show"></span><label>`+i.columns[e].label+s+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template);const c=n.querySelector("[toggle]");c.column=t,o[t.dataField]=t.visible,c.title=i.localize("columnMenuItemHide"),c.onclick=()=>{o[c.column.dataField]=!c.column.visible,c.classList.contains("smart-icon-visibility-on")?(c.classList.remove("smart-icon-visibility-on"),c.classList.add("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemShow")):(c.classList.add("smart-icon-visibility-on"),c.classList.remove("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemHide"))},t.visible||(c.classList.remove("smart-icon-visibility-on"),c.title=i.localize("columnMenuItemShow")),t.visible?c.classList.add("smart-icon-visibility-on"):c.classList.add("smart-icon-visibility-off"),l.appendChild(n),l.appendChild(d);const m=document.createElement("label");m.classList.add("smart-field-editor-error-label"),m.setAttribute("label-for",t.dataField),l.appendChild(m),a.appendChild(l)}}_refreshHistory(){const e=this,t=e._dialogEdit;if(!t)return;const a=t.querySelector(".history-layout");if(!e.storeHistory)return void a.classList.add("smart-hidden");if(!e._currentUser||e._currentUser&&!e._currentUser.info)return void a.classList.add("smart-hidden");a.classList.remove("smart-hidden");const i=t.row.history;if(!i)return;let l="\n ";for(let t=i.length-1;t>=0;t--){const a=i[t];let n="";if(e._kanban)n=e._kanban._getHistoryItemLabel(a);else if("created"===a.action)n=e.localize("rowCreated",{value:a.action});else{const t=e.columnByDataField[a.action];n=e.localize("propertyUpdated",{value:t?t.label:a.action})}if(l+='<div class="history-row">',void 0!==a.user){const t=(t=>{const a=t?t.image:null;return{image:a?`background-image: url('${a}');`:"",label:t?t.name||t.id:e.localize("guestUser"),cssClass:a?"image":""}})(e.users.find((e=>e.id===a.user)));l+=`<div class="history-user"><div class="user-icon smart-user ${t.cssClass}" style="${t.image}"></div><div class="user-name">${t.label}</div><div class="time">${new Smart.Utilities.DateTime(a.date).toString("dd/MM/yyyy hh:mm")}</div></div>`}else l+="<div></div>";if(l+='<div class="history-action">',l+=`<div>${n}</div>`,"created"!==a.action){let t=a.details.oldValue,i=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t||e.id===parseFloat(t))),l=e.users.find((e=>e.id===i||e.id===parseFloat(i)));a?t=a.name:(t="",t||(t=e.localize("unassigned"))),l?i=l.name:(i="",i||(i=e.localize("unassigned")))}if("subtasks"===a.action){const t=a.details.value.filter((e=>e.completed));e._kanban?l+=`<span class="detail smart-truncate">${e._kanban.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span>`:l+=`<span class="detail smart-truncate">${e.localize("nullRange",{value:t.length})}</span>`}else{t&&"object"==typeof t&&t instanceof Date&&(t=t.toLocaleString()),i&&"object"==typeof i&&i instanceof Date&&(i=i.toLocaleString());let n=e.columnByDataField[a.action];n||(n=e.columnByDataField["task"+a.action.substring(0,1).toUpperCase()+a.action.substring(1)]),"user"===a.action&&(n=e.columnByDataField.taskUserId);let o="";n&&n.label&&(o='"'+n.label+'"'),n&&"date"===n.dataType&&(t&&"string"==typeof t&&(t=new Date(t).toLocaleString()),i&&"string"==typeof i&&(i=new Date(i).toLocaleString())),l+=t?`<span class="detail smart-truncate">${e.localize("range",{column:o,oldValue:t,newValue:i})}</span>`:`<span class="detail smart-truncate">${e.localize("nullRange",{column:o,oldValue:t,newValue:i})}</span>`}}else l+=`<div>${a.details.value}</div>`;l+="</div>\n </div>"}l+="",a.innerHTML=l}_createComment(e){const t=this,a=t.users.find((t=>t.id===e.userId)),i=document.createElement("div"),l=a?a.name||a.id:t.localize("guestUser"),n=a?a.name:t.localize("guestUser"),o=a.image?a.image:"";if(i.className="comment",i.setAttribute("role","listitem"),i.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${l}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${n}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n</div>\n<div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,o){const e=i.querySelector(".user-icon");e.style.backgroundImage=`url('${o}')`,e.classList.add("image")}i.comment=e;const r=i.querySelector(".remove-button");return r.comment=e,r.element=i,e.userId!==t._currentUser.info.id&&r.classList.add("smart-visibility-hidden"),i}_openSummaryRowDialog(e){const t=this,a=t._summaryRowDialog||t._createDialog(),i="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(a.header.innerHTML=i,!a.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",a.content.innerHTML="",a.listBox=e}const l=a.listBox;a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser");const n=e.element.querySelector(".summary-value");if(!n)return;n.classList.add("summary-chooser"),a.summaryValueElement=n;let o=[];a.dataField=e.column.dataField,o="string"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:"boolean"===e.column.dataType||"any"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"}]:"date"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:[{label:t.localize("countSummary"),value:"count"},{label:t.localize("minSummary"),value:"min"},{label:t.localize("maxSummary"),value:"max"},{label:t.localize("sumSummary"),value:"sum"},{label:t.localize("avgSummary"),value:"avg"}],l.dataSource=o,l.style.position="absolute",l.style.visibility="hidden",l.style.height="auto",document.body.appendChild(l);const r=e.column;r.summary&&r.summary.forEach((e=>{l.select(e)}));const s=l.offsetHeight;a.column=r,a.content.appendChild(l),a.classList.add("smart-grid-dialog-summary"),a.header.parentElement.classList.add("smart-hidden"),a.footer.classList.add("smart-hidden"),l.style.visibility="",l.style.position="",l.style.width="100%",t._summaryRowDialog||(a.btnConfirm.innerHTML=t.localize("apply"),a.btnCancel.innerHTML=t.localize("cancel"),a.style.width=a.style.minWidth="120px",a.onOpen=function(){t.editing.dialog.visible=!0},a.onClose=function(){t.editing.dialog.visible=!1,a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser")},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e=a.column.summary;a.column.summary=l.selectedValues,t.$.fireEvent("columnSummaryChange",{column:a.column,dataField:r.dataField,oldSummary:[...e],summary:[...a.column.summary]}),a.close(),t._calculateSummary(),t._recycle(!1)},a.confirm=function(){a.btnConfirm.click()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},t._summaryRowDialog=a);const d=e.element,c=t.offset(d),m=t.offset(t);let u=d.offsetWidth+c.left-m.left-120;u<0&&(u=c.left-m.left),a.open(u,c.top-m.top-s-0),setTimeout((function(){a.btnConfirm.focus()}),100)}_openDescriptionDialog(e,t){const a=this,i=a._dialogDescription||a._createDialog(),l=a.localize("dialogDescriptionHeader",{value:e.label});if(i.header.innerHTML=l,i.column=e,i.command=t,i.classList.add("smart-grid-dialog-add-column"),!a._dialogDescription){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){const e=i.querySelector("smart-input");"duplicate"!==t&&setTimeout((()=>{e.select()}),250)},i.onClose=function(){},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){const e=i.querySelector("smart-input");switch(i.command){case"duplicate":0===e.selectedIndex?a.duplicateCommand(i.column,null,!0):a.duplicateCommand(i.column,null,!1);break;case"rename":i.column.label=e.value;break;case"editDescription":i.column.description=e.value}i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogDescription=i;const e=document.createElement("smart-input");e.classList.add("underlined"),e.dataSource="duplicate"!==t?[]:[{label:a.localize("duplicateCells"),value:"cells"},{label:a.localize("duplicateSettings"),value:"settings"}],i.content.appendChild(e)}const n=e.element,o=a.offset(n),r=a.offset(a);i.open(o.left-r.left,o.top+n.offsetHeight-r.top);const s=i.querySelector("smart-input");switch(s.selectedIndex=0,s.readonly=!0,s.dropDownButtonPosition="right",t){case"rename":s.value=e.label;break;case"editDescription":s.value=e.description}setTimeout((function(){i.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const a=this;if(!a.editing.deleteDialog.enabled)return!1;const i=a._dialogDelete||a._createDialog(),l="{{message}}"===a.editing.dialog.header?a.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):a.editing.dialog.header;i.header.innerHTML=l,i.content.innerHTML=a.localize("dialogDeleteContent"),i.row=e,a._dialogDelete||(i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogDeleteButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogDeleteButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0},i.onClose=function(){a.editing.dialog.visible=!1},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){t(i.row),i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogDelete=i),i.open(),setTimeout((function(){i.btnConfirm.focus()}),100)}_getTypesList(){const e=this,t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"image",prefix:'<span class="smart-grid-icon visible smart-icon-image"></span>',label:e.localize("dialogAddColumnTypeImage")},{value:"number",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeNumber")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")},{value:"boolean",prefix:'<span class="smart-grid-icon visible smart-icon-check-squared"></span>',label:e.localize("dialogAddColumnTypeCheckBox")},{value:"date",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDate")},{value:"createdTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeCreatedTime")},{value:"updatedTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedTime")},{value:"createdBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCreatedBy")},{value:"updatedBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedBy")},{value:"collaborator",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCollaborator")},{value:"slider",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeSlider")},{value:"autoNumber",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeAutoNumber")},{value:"url",prefix:'<span class="smart-grid-icon visible smart-icon-link"></span>',label:e.localize("dialogAddColumnTypeURL")},{value:"email",prefix:'<span class="smart-grid-icon visible smart-icon-mail"></span>',label:e.localize("dialogAddColumnTypeEmail")},{value:"phone",prefix:'<span class="smart-grid-icon visible smart-icon-phone"></span>',label:e.localize("dialogAddColumnTypePhone")},{value:"password",prefix:'<span class="smart-grid-icon visible smart-icon-lock"></span>',label:e.localize("dialogAddColumnTypePassword")}];if(e.header.visible&&e.header.buttons.indexOf("views")>=0){const a={value:"startDate",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeStartDate")},i={value:"dueDate",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDueDate")},l={value:"progress",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeProgress")},n={value:"priority",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypePriority")},o={value:"status",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("status")},r={value:"name",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeName")},s={value:"description",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeDescription")},d={value:"tags",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeTags")},c={value:"checklist",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeChecklist")},m={value:"color",prefix:'<span class="smart-grid-icon visible smart-icon-color-background"></span>',label:e.localize("dialogAddColumnTypeColor")};t.push(a),t.push(i),t.push(l),t.push(n),t.push(r),t.push(s),t.push(d),t.push(c),t.push(m),t.push(o)}return t}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),a=new Date(t,6,30);return[{bind:"kanban",name:"kanban",type:"radio",label:e.localize("kanbanNoneDescription"),filter:"kanban",options:[{value:"blank",checked:!0,label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"description",type:"input",label:e.localize("dialogAddColumnDescription"),filter:"any",placeholder:e.localize("dialogAddColumnDescriptionPlaceholder"),info:e.localize("dialogAddColumnDescriptionInfo")},{bind:"type",name:"typeslist",type:"dropDownList",filter:"any",label:e.localize("dialogAddColumnType"),icon:"smart-icon-font",options:e._getTypesList(),info:e.localize("dialogAddColumnTypeInfo")},{bind:"dateFormat",name:"dateformat",type:"dropDownList",label:e.localize("dialogAddColumnDateFormat"),options:[{value:"M/d/yyyy",label:e.localize("dialogAddColumnDateFormatShort")+" ("+new Smart.Utilities.DateTime(a).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(a).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(a).toString("ISO8601")+")"},{value:"d/M/yyyy",label:e.localize("dialogAddColumnDateFormatEU")+" (30/7/"+t+")"},{value:"yyyy-MM-dd",label:e.localize("dialogAddColumnDateFormatAS")+" ("+t+"-30-07)"},{value:"MMMM, dd, yyyy",label:e.localize("dialogAddColumnDateFormatFull")+" (July, 30, "+t+")"}],filter:"date",info:e.localize("dialogAddColumnDateFormatInfo")},{bind:"timeFormat",name:"timeformat",type:"dropDownList",label:e.localize("dialogAddColumnTimeFormat"),filter:"time",width:"50%",options:[{value:"hh:mm",label:"12 "+e.localize("dialogAddColumnTimeFormatHour")},{value:"HH:mm",label:"24 "+e.localize("dialogAddColumnTimeFormatHour")}],info:e.localize("dialogAddColumnTimeFormatInfo")},{bind:"allowTimeFormat",type:"boolean",label:e.localize("dialogAddColumnAllowTimeFormat"),filter:"date",value:!1,info:""},{bind:"allowCustomDateSeparator",type:"boolean",label:e.localize("dialogAddColumnCustomDateSeparator"),filter:"date",value:!1,info:""},{bind:"dateFormatSeparator",name:"dateFormatSeparator",type:"radio",label:"",filter:"date",columns:3,options:[{value:"/",label:e.localize("dialogAddColumnDateFormatSlash")+" (/)"},{value:"-",label:e.localize("dialogAddColumnDateFormatHyphen")+" (-)"},{value:".",label:e.localize("dialogAddColumnDateFormatDot")+" (.)"}]},{bind:"numberFormat",name:"numberFormat",type:"dropDownList",label:e.localize("dialogAddColumnNumberFormat"),filter:"number",options:[{value:{style:"decimal",maximumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatInteger")+" 1,000"},{value:{style:"decimal",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatNumber")+" 1,000.12"},{value:{style:"percent",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatPercent")+" 10.12%"},{value:{style:"percent",maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatPercentRounded")+" 10%"},{value:{style:"decimal",notation:"scientific"},label:e.localize("dialogAddColumnNumberFormatScientific")+" 1.01E+03"},{value:{style:"decimal",notation:"engineering"},label:e.localize("dialogAddColumnNumberFormatEngineering")+" 34.284 x 10^9"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,currencySign:"accounting"},label:e.localize("dialogAddColumnNumberFormatAccounting")+" $(1,000.12)"},{value:{style:"unit",unit:"kilogram"},label:e.localize("dialogAddColumnNumberFormatUnit")+" 10.12 kg"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency},label:e.localize("dialogAddColumnNumberFormatCurrency")+" $1,000.12"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatCurrencyRounded")+" $1,000"}],required:!1,info:e.localize("dialogAddColumnNumberFormatInfo")},{bind:"currency",name:"currency",type:"dropDownList",filter:"number",required:!1,options:e._getCurrencies(),label:e.localize("dialogAddColumnNumberFormatCurrency"),info:e.localize("dialogAddColumnNumberFormatCurrencyInfo")},{bind:"unit",name:"unit",type:"dropDownList",filter:"number",required:!1,options:[{value:"acre",label:e.localize("dialogAddColumnNumberFormatUnitAcre")},{value:"percent",label:e.localize("dialogAddColumnNumberFormatUnitPercent")},{value:"degree",label:e.localize("dialogAddColumnNumberFormatUnitDegree")},{value:"megabyte",label:e.localize("dialogAddColumnNumberFormatUnitMegaByte")},{value:"centimeter",label:e.localize("dialogAddColumnNumberFormatUnitCentimeter")},{value:"meter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")},{value:"kilometer",label:e.localize("dialogAddColumnNumberFormatUnitKilometer")},{value:"mile",label:e.localize("dialogAddColumnNumberFormatUnitMile")},{value:"celsius",label:e.localize("dialogAddColumnNumberFormatUnitCelsius")},{value:"fahrenheit",label:e.localize("dialogAddColumnNumberFormatUnitFahrenheit")},{value:"kilogram",label:e.localize("dialogAddColumnNumberFormatUnitKilogram")},{value:"pound",label:e.localize("dialogAddColumnNumberFormatUnitPound")},{value:"liter",label:e.localize("dialogAddColumnNumberFormatUnitLiter")},{value:"gallon",label:e.localize("dialogAddColumnNumberFormatUnitGallon")},{value:"second",label:e.localize("dialogAddColumnNumberFormatUnitSecond")},{value:"minute",label:e.localize("dialogAddColumnNumberFormatUnitMinute")},{value:"hour",label:e.localize("dialogAddColumnNumberFormatUnitHour")},{value:"day",label:e.localize("dialogAddColumnNumberFormatUnitDay")},{value:"week",label:e.localize("dialogAddColumnNumberFormatUnitWeek")},{value:"month",label:e.localize("dialogAddColumnNumberFormatUnitMonth")},{value:"year",label:e.localize("dialogAddColumnNumberFormatUnitYear")}],label:e.localize("dialogAddColumnNumberFormatUnit"),info:e.localize("dialogAddColumnNumberFormatUnitInfo")},{bind:"minLength",name:"minlength",width:"50%",type:"number",filter:"text",required:!1,label:e.localize("dialogAddColumnMinLength"),info:e.localize("dialogAddColumnMinLengthInfo")},{bind:"maxLength",name:"maxlength",width:"50%",filter:"text",type:"number",required:!1,label:e.localize("dialogAddColumnMaxLength"),info:e.localize("dialogAddColumnMaxLengthInfo")},{bind:"minValue",name:"minvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMinValue"),info:e.localize("dialogAddColumnMinValueInfo")},{bind:"maxValue",name:"maxvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMaxValue"),info:e.localize("dialogAddColumnMaxValueInfo")},{bind:"minDateTime",name:"mindatetime",type:"datetime",filter:"date",width:"50%",label:e.localize("dialogAddColumnMinDate"),info:e.localize("dialogAddColumnMinDateInfo")},{bind:"maxDateTime",name:"maxdatetime",type:"datetime",width:"50%",filter:"date",label:e.localize("dialogAddColumnMaxDate"),info:e.localize("dialogAddColumnMaxDateInfo")},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"allowCheckItems",type:"boolean",filter:"hidden",value:!1,label:e.localize("dialogAddColumnCheckItems"),info:""},{bind:"allowMultipleCollaborators",type:"boolean",filter:"collaborator",value:!1,label:e.localize("dialogAddColumnMultipleCollaborators"),info:e.localize("dialogAddColumnMultipleCollaboratorsInfo")},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""},{bind:"users",name:"users",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"collaborator",info:""},{name:"align",bind:"cellsAlign",type:"dropDownList",label:e.localize("dialogAddColumnAlign"),required:!1,options:[{value:"left",label:e.localize("dialogAddColumnAlignLeft")},{value:"right",label:e.localize("dialogAddColumnAlignRight")},{value:"center",label:e.localize("dialogAddColumnAlignCenter")}],filter:"any",info:e.localize("dialogAddColumnAlignInfo")},{bind:"allowResize",type:"boolean",filter:"any",width:"50%",label:e.localize("dialogAddColumnResizable"),info:e.localize("dialogAddColumnResizableInfo")},{bind:"required",type:"boolean",width:"50%",filter:"text",value:!1,label:e.localize("dialogAddColumnRequired"),info:e.localize("dialogAddColumnRequiredInfo")},{bind:"allowSort",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnSortable"),info:e.localize("dialogAddColumnSortableInfo")},{bind:"allowFilter",type:"boolean",align:"left",width:"50%",filter:"any",label:e.localize("dialogAddColumnFilterable"),info:e.localize("dialogAddColumnFilterableInfo")},{bind:"allowEdit",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnEditable"),info:e.localize("dialogAddColumnEditableInfo")}]}_getKanbanFields(){return["startDate","dueDate","progress","checklist","priority","tags","name","color","description","status"]}_addColumnDialogShowHideEditors(e){const t=this,a=t._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input").getSelectedItem().value,i=t._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),l=t._getKanbanFields(),n=t._dialogAddColumn.querySelector('[field-name="kanbanNotes"]');n&&("kanban"!==t.view?n.classList.add("smart-hidden"):n.classList.remove("smart-hidden"));let o=!!e;for(let n=0;n<i.length;n++){const r=i[n],s=r.getAttribute("filter"),d=r.getAttribute("bind"),c=r.parentNode;if(c.classList.add("smart-hidden"),"cellsAlign"===d&&("boolean"===a||"image"===a||"email"===a||"url"===a||"collaborator"===a||"createdBy"===a||"password"===a||"phone"===a||"createdTime"===a||"updatedBy"===a||"updatedTime"===a||l.indexOf(a)>=0))c.classList.add("smart-hidden");else if("type"===d&&o)c.classList.add("smart-hidden");else if("allowEdit"===d&&(!1===t.editing.enabled||"autoNumber"===a||"createdBy"===a||"updatedBy"===a||"createdTime"===a||"updatedTime"===a||l.indexOf(a)>=0))c.classList.add("smart-hidden");else if("allowResize"!==d||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==d||!1!==t.filtering.enabled)if("allowSort"!==d||!1!==t.sorting.enabled)if("required"!==d||!1!==t.editing.enabled&&("string"===a||"multiText"===a))if(e&&e.disabledDialogOptions&&e.disabledDialogOptions.length>0&&e.disabledDialogOptions.indexOf(d)>=0)c.classList.add("smart-hidden");else{if(e&&"kanban"===t.view){switch(d){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":c.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===s&&c.classList.remove("smart-hidden")}if("any"!==s)switch(a){default:case"text":"text"===s&&c.classList.remove("smart-hidden"),e&&"any"===e.dataType&&c.classList.add("smart-hidden");break;case"slider":case"number":if("number"===s&&c.classList.remove("smart-hidden"),"unit"===d||"currency"===d){c.classList.add("smart-hidden");const e=t._dialogAddColumn.querySelector('[field-name="numberFormat"]'),a=t._dialogAddColumn.querySelector('[field-name="unit"]'),i=t._dialogAddColumn.querySelector('[field-name="currency"]'),l=e.querySelector("smart-input"),n=()=>{const e=l.getSelectedItem();i.classList.add("smart-hidden"),e&&"unit"===e.value.style?a.classList.remove("smart-hidden"):e&&"currency"===e.value.style?i.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};e.onchange=()=>{n()},n()}break;case"select":case"multiSelect":s.indexOf("list")>=0&&c.classList.remove("smart-hidden");break;case"collaborator":s.indexOf("collaborator")>=0&&c.classList.remove("smart-hidden");break;case"createdBy":case"updatedBy":case"autoNumber":case"createdTime":case"updatedTime":case"url":case"email":case"image":case"phone":case"password":case"startDate":case"dueDate":case"progress":case"checklist":case"priority":case"tags":case"name":case"description":case"assigned":case"status":case"boolean":break;case"date":{const e=t._dialogAddColumn.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;"date"===s&&c.classList.remove("smart-hidden");const a=e=>{const a=t._dialogAddColumn.querySelector('[field-filter="time"]'),i=t._dialogAddColumn.querySelector('[field-name="dateFormat"]');e?(a.classList.remove("smart-hidden"),i.style.width="50%",i.style.float="left"):(a.classList.add("smart-hidden"),i.style.width="",i.style.float="")},i=e=>{const a=t._dialogAddColumn.querySelector('[field-name="allowTimeFormat"]'),i=a.querySelector(".smart-grid-dialog-editor");e.indexOf("T")>=0?(a.classList.add("smart-hidden"),i.uncheck()):a.classList.remove("smart-hidden")},l=e=>{const a=t._dialogAddColumn.querySelector('[field-name="dateFormatSeparator"]');e?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};if("allowTimeFormat"===d){const e=r.querySelector(".smart-input").value;r.onchange=e=>{a(e)},a(e)}if("dateFormat"===d){const e=r.querySelector(".smart-input").value;r.onchange=e=>{i(e.detail.value)},i(e)}if("dateFormatSeparator"===d){const e=t._dialogAddColumn.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;l(e)}if("allowCustomDateSeparator"===d){e.indexOf("T")>=0&&e.indexOf("-")>0&&r.uncheck();const t=r.querySelector(".smart-input").value;r.onchange=e=>{l(e)},l(t)}i(e);break}}else c.classList.remove("smart-hidden")}else c.classList.add("smart-hidden");else c.classList.add("smart-hidden");else c.classList.add("smart-hidden");else c.classList.add("smart-hidden")}}_addColumnDialogInitEditors(){const e=this,t=e._dialogAddColumn.editColumn,a=e._getAddColumnDialogTemplate();for(let i in e._addColumnDialogEditors){const l=e._addColumnDialogEditors[i],n=l.querySelector("input"),o=l.querySelector("smart-input");switch(i){case"allowTimeFormat":{const e=l.querySelector(".smart-input");t&&t.editor?"dateInput"===t.editor.template?(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowCustomDateSeparator":{const a=l.querySelector(".smart-input");a.value=!1,a.removeAttribute("checked");let i=0;t&&t.cellsFormat&&(t.cellsFormat.indexOf(".")>=0?(a.value=!0,a.setAttribute("checked",""),i=2):(t.cellsFormat.indexOf("M-d-yyyy")>=0||t.cellsFormat.indexOf("d-M-yyyy")>=0||t.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(a.value=!0,a.setAttribute("checked",""),i=1));const n=e._addColumnDialogEditors.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");n.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n[i].setAttribute("checked",""),n[i].value=!0;break}case"kanban":{const t=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let a=0;a<t.length;a++)t[a].onchange=t=>{const a=[...t.parentElement.children].indexOf(t),i=t.parentElement.parentElement.previousElementSibling,l=e._dialogAddColumn.querySelector('[field-name="options"]'),n=e._dialogAddColumn.querySelector('[field-name="allowColorItems"]'),o=e._addColumnDialogEditors.name,r=()=>{const t=l.querySelector("smart-sortable");t&&(t._validate(),e._dialogAddColumn&&e._dialogAddColumn.offsetHeight&&e._dialogAddColumn.setPosition("center"))};switch(a){case 0:i.innerHTML=e.localize("kanbanNoneDescription"),n.classList.add("smart-hidden"),l.classList.add("smart-hidden"),o.querySelector("input").value=e.localize("dialogNewColumn"),r();break;case 1:i.innerHTML=e.localize("kanbanBasicDescription"),n.classList.remove("smart-hidden"),l.classList.remove("smart-hidden"),o.querySelector("input").value=e.localize("status"),r()}};break}case"dateFormat":t&&t.cellsFormat?t.cellsFormat.indexOf("M/d/yyyy")>=0?o.selectedIndex=0:t.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?o.selectedIndex=1:t.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?o.selectedIndex=2:t.cellsFormat.indexOf("d/M/yyyy")>=0?o.selectedIndex=3:t.cellsFormat.indexOf("yyyy-MM-dd")>=0?o.selectedIndex=4:t.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(o.selectedIndex=5):o.selectedIndex=0;break;case"timeFormat":t&&t.cellsFormat&&t.cellsFormat.indexOf("HH")>=0&&-1===t.cellsFormat.indexOf("T")?o.selectedIndex=1:o.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!0;t&&t.editor&&t.editor.singleSelect&&(e=!1);const a=l.querySelector(".smart-input");t?e?(a.value=!0,a.setAttribute("checked","")):(a.value=!1,a.removeAttribute("checked")):(a.value=!0,a.setAttribute("checked",""));break}case"numberFormat":if(t&&"numberInput"===t.editor.template&&t.editor.numberFormat)if("decimal"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=0;else if("decimal"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=1;else if("percent"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=2;else if("percent"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=3;else if("decimal"===t.editor.numberFormat.style&&"scientific"===t.editor.numberFormat.notation)o.selectedIndex=4;else if("decimal"===t.editor.numberFormat.style&&"engineering"===t.editor.numberFormat.notation)o.selectedIndex=5;else if("currency"===t.editor.numberFormat.style&&"accounting"===t.editor.numberFormat.currencySign)o.selectedIndex=6;else if("unit"===t.editor.numberFormat.style){o.selectedIndex=7;const a=t.editor.numberFormat.unit,i=e._addColumnDialogEditors.unit.querySelector("smart-input");i.dataSource.forEach(((e,t)=>{if(e.value===a)return i.selectedIndex=t,!0}))}else"currency"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits&&0===t.editor.numberFormat.minimumFractionDigits?o.selectedIndex=9:"currency"===t.editor.numberFormat.style&&(o.selectedIndex=8);else o.selectedIndex=0;break;case"currency":if(t&&"numberInput"===t.editor.template&&t.editor.numberFormat){if("currency"===t.editor.numberFormat.style){const a=e._getCurrencies().findIndex((e=>e.value===t.editor.numberFormat.currency));a>=0&&(o.selectedIndex=a)}}else o.selectedIndex=0;break;case"allowCheckItems":{const e=l.querySelector(".smart-input");t?t.editor&&!t.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowColorItems":{const e=l.querySelector(".smart-input");t?t.editor&&t.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowResize":case"allowSort":case"allowEdit":case"allowFilter":case"required":{const e=l.querySelector(".smart-input"),n=a.find((e=>{if(e.bind===i)return e}));t?t[i]?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,n&&void 0!==n.value&&(e.value=n.value),e.value&&e.setAttribute("checked",""));break}}if(!t||"options"!==i&&"users"!==i){const t=l.querySelector("smart-sortable");if(t&&t._init)if("users"===i){let a=[];for(let t=0;t<e.users.length;t++)a.push({color:e.users[t].color,label:e.users[t].name,id:e.users[t].id,image:e.users[t].image});t._init(a)}else t._init()}else{const e=l.querySelector("smart-sortable");if(e&&e._init)if(t.editor.singleSelect){const a=t.editor.dataSource.filter((e=>""!==e));e._init(a)}else"multiComboInput"===t.editor.template&&e._init(JSON.parse(JSON.stringify(t.editor.dataSource)))}if(t&&"type"===i?("number"===t.dataType||"int"===t.dataType?o.selectedIndex=3:"date"===t.dataType?o.selectedIndex=7:"bool"!==t.dataType&&"boolean"!==t.dataType||(o.selectedIndex=6),t.editor&&t.editor.template&&o.dataSource.forEach(((e,a)=>{switch(e.value){case"string":"input"===t.editor.template&&(o.selectedIndex=a);break;case"number":"numberInput"===t.editor.template&&(o.selectedIndex=a);break;case"select":"multiComboInput"===t.editor.template&&t.editor.singleSelect&&"tags"===t.template&&(o.selectedIndex=a);break;case"multiSelect":"multiComboInput"!==t.editor.template||t.editor.singleSelect||"tags"!==t.template||(o.selectedIndex=a);break;case"multiText":"textarea"===t.editor.template&&(o.selectedIndex=a);break;case"date":"dateInput"!==t.editor.template&&"dateTimePicker"!==t.editor.template||(o.selectedIndex=a);break;case"checkBox":"checkBox"===t.editor.template&&(o.selectedIndex=a);break;case"slider":"slider"===t.editor.template&&(o.selectedIndex=a);break;case"image":"image"===t.editor.template&&(o.selectedIndex=a);break;case"updatedTime":"updatedTime"===t.template&&(o.selectedIndex=a);break;case"createdTime":"createdTime"===t.template&&(o.selectedIndex=a);break;case"createdBy":"createdBy"===t.template&&(o.selectedIndex=a);break;case"updatedBy":"updatedBy"===t.template&&(o.selectedIndex=a);break;case"collaborator":"collaborator"===t.template&&t.editor&&t.editor.collaborator&&(o.selectedIndex=a);break;case"autoNumber":"autoNumber"===t.template&&(o.selectedIndex=a);break;case"phone":"phone"===t.template&&(o.selectedIndex=a);break;case"password":"password"===t.template&&(o.selectedIndex=a);break;case"url":"url"===t.template&&(o.selectedIndex=a);break;case"email":"email"===t.template&&(o.selectedIndex=a)}}))):"type"===i&&(o.selectedIndex=0,o.dataSource=e._getTypesList()),"cellsAlign"===i&&t&&("center"===t.cellsAlign||"middle"===t.cellsAlign?o.selectedIndex=2:"right"===t.cellsAlign&&(o.selectedIndex=1)),!n)continue;"dataField"!==i&&"type"!==i&&"timeFormat"!==i&&"dateFormat"!==i&&"numberFormat"!==i&&"currency"!==i&&"unit"!==i&&"cellsAlign"!==i&&o&&(o.selectedIndex=0),"name"===i&&(o.value=t?t.label:"",o.placeholder=a.find((e=>{if(e.bind===i)return e})).placeholder),"description"===i&&(o.value=t?t.description:"",o.placeholder=a.find((e=>{if(e.bind===i)return e})).placeholder);const r=(e,a)=>{t&&t.validationRules.forEach((t=>"minDate"===t.type&&"minDateTime"===e||"maxDate"===t.type&&"maxDateTime"===e||"min"===t.type&&"minValue"===e||"max"===t.type&&"maxValue"===e||t.type===e?(a.value=t.value,!0):void 0))};if("minValue"===i?(n.value=0,r(i,n)):"maxValue"===i?(n.value=100,r(i,n)):"minLength"===i?(n.value=0,r(i,n)):"maxLength"===i&&(n.value=500,r(i,n)),"minDateTime"===i){const e=l.querySelector("smart-date-input");e.value=new Date(1900,0,1),r(i,e)}else if("maxDateTime"===i){const e=l.querySelector("smart-date-input");e.value=new Date(2100,0,1),r(i,e)}}}_createColumnBooleanEditor(e,t,a,i,l){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const n=document.createElement("div");return n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),n.setAttribute("checked",""),n.value=!0,t.width&&(a.style.width=t.width,a.style.float="left"),!1===t.value&&(n.value=!1,n.removeAttribute("checked")),e.appendChild(n),e.getValue=function(){return n.value},e.check=function(){n.setAttribute("checked",""),n.value=!0,e.onchange&&e.onchange(n.value)},e.uncheck=function(){n.removeAttribute("checked"),n.value=!1,e.onchange&&e.onchange(n.value)},e.toggle=function(){!0!==n.value&&!1!==n.value&&null!==n.value&&(n.value=!1),null===n.value?n.value=!1:n.value=!n.value,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),e.onchange&&e.onchange(n.value)},e.onclick=l.onclick=()=>{e.toggle()},i.appendChild(a),a.classList.add("smart-grid-dialog-boolean-field"),a.appendChild(e),a.appendChild(l),e}_getColumnTemplateByType(e){switch(e){case"boolean":case"bool":return"checkBox";case"image":return"image";case"createdBy":case"updatedBy":return e;case"collaborator":case"select":case"multiSelect":return"tags";case"url":return"url";case"email":return"email";case"autoNumber":return"autoNumber";case"password":return"password";case"createdTime":return"createdTime";case"updatedTime":return"updatedTime";default:return""}}_confirmAddColumnDialog(){const e=this,t=e._dialogAddColumn,a=e._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),i=[];let l,n,o={};for(let t=0;t<a.length;t++){const i=a[t],l=i.querySelector(".smart-input"),n=i.getAttribute("bind"),r=i.parentElement;if("kanban"!==n)if("minLength"!==n&&"maxLength"!==n&&"minValue"!==n&&"maxValue"!==n&&"minDateTime"!==n&&"maxDateTime"!==n)if("options"!==n&&"users"!==n){if("allowEdit"===n&&r.classList.contains("smart-hidden"))l.value=!1;else if("required"===n&&r.classList.contains("smart-hidden"))l.value=!1;else if("dateFormatSeparator"===n){const e=i.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.dateFormatSeparatorType="/";break;case 1:o.dateFormatSeparatorType="-";break;case 2:o.dateFormatSeparatorType="."}break}}l&&(l.getSelectedItem?o[n]=l.getSelectedItem().value:o[n]=l.value)}else{const t=[],a=i.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),l=i.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<a.length;e++){const i=a[e],n={label:i.value,value:i.getAttribute("data-item-value"),id:parseInt(i.getAttribute("data-id")),color:l[e].value};n.color=l[e].value,t.push(n)}if("users"===n&&"collaborator"===o.type){e.users||(e.users=[]);for(let a=0;a<t.length;a++){const i=t[a],l=e.users.find((e=>e.id===i.id));l&&(l.name=i.label,l.color=i.color)}}o[n]=t}else o[n]=l.getValue();else{const e=i.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.kanban="blank";break;case 1:o.kanban="basic"}break}}}t.data=o;let r={},s={},d="";if(l=o.minDateTime,n=o.maxDateTime,"date"===o.type){r={template:"dateInput",min:l,max:n};let e=!1;"-"!==o.dateFormat&&(d=o.dateFormat,o.allowCustomDateSeparator&&(d.indexOf("/")>=0?d=d.replaceAll("/",o.dateFormatSeparatorType):d.indexOf("-")>=0?d=d.replaceAll("-",o.dateFormatSeparatorType):d.indexOf(".")>=0&&(d=d.replaceAll(".",o.dateFormatSeparatorType))),o.dateFormat.indexOf("T")>=0&&(r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),e=!0),r.autoOpen=!0,o.allowTimeFormat&&"-"!==o.timeFormat&&(e&&(d+=" "),d+=o.timeFormat,r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),i.push({type:"minDate",value:l}),i.push({type:"maxDate",value:n})}else if("number"===o.type||"slider"===o.type){l=parseInt(o.minValue),n=parseInt(o.maxValue),o.numberFormat=JSON.parse(JSON.stringify(o.numberFormat)),"unit"===o.numberFormat.style&&(o.numberFormat.unit=o.unit);let t=null,a=null;"currency"===o.numberFormat.style&&(o.numberFormat.currency=o.currency,o.numberFormat.locale=e._getLocaleByCurrency(o.currency)),r={template:"number"===o.type?"numberInput":"slider",min:l,max:n,numberFormat:o.numberFormat},s={Intl:{NumberFormat:o.numberFormat}},a&&(s=a),d="d",t&&(d=t),i.push({type:"min",value:l}),i.push({type:"max",value:n})}else if("boolean"===o.type)r={template:"checkBox"};else if("image"===o.type)r={template:"image"};else if("select"===o.type||"multiSelect"===o.type){let e=o.options;if("select"===o.type)if(t.editColumn&&!t.editColumn.editor.allowEmptyItem)e=o.options;else{let t=!1;for(let e=0;e<o.options.length;e++)if(""===o.options[e].label){t=!0,o.options[e].value="";break}e=t?o.options:[""].concat(o.options)}r={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:o.allowColorItems,autoOpen:!0,pills:!0,singleSelect:"select"===o.type,dataSource:e}}else if("collaborator"===o.type){let t=o.users;o.allowMultipleCollaborators||(t=[""].concat(o.users));for(let a=0;a<e.users.length;a++)t.forEach((t=>{t.value===e.users[a].id&&(t.image=e.users[a].image,t.id=e.users[a].id)}));r={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:o.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!o.allowMultipleCollaborators,dataSource:t}}else"multiText"===o.type?(l=o.minLength,n=o.maxLength,r={template:"textarea",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n})):"password"===o.type?(l=o.minLength,n=o.maxLength,r={template:"password",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n})):"phone"===o.type?r={template:"phone",required:o.required}:(l=o.minLength,n=o.maxLength,r={template:"input",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n}));let c="string";switch(o.type){case"boolean":case"bool":c="boolean";break;case"createdTime":case"updatedTime":case"date":c="date";break;case"autoNumber":case"slider":case"number":c="number"}if(e._dialogAddColumn.editColumn){const t=e._dialogAddColumn.editColumn;t.canNotify=!1,t.label=o.name,t.description=o.description,t.showDescriptionButton=!0,t.allowResize=o.allowResize,t.allowSort=o.allowSort,t.allowFilter=o.allowFilter,t.allowEdit=o.allowEdit,t.align=t.cellsAlign=o.cellsAlign,t.cellsFormat=d;const a=t._editorId?t._editorId:"",l=r.template+"_"+t.dataField+a;e._cellEditors[l]&&delete e._cellEditors[l];let n=!0;"list"!==t.template&&"dropDownList"!==t.template||(n=!1),"autoNumber"!==t.template&&"createdBy"!==t.template&&"updatedBy"!==t.template&&"createdTime"!==t.template&&"updatedTime"!==t.template||(n=!1),t.editor&&t.editor.template.indexOf("custom")>=0&&(n=!1),t.editor&&t.editor.disabledDialogOptions&&(n=!1),n&&(t.editor=JSON.parse(JSON.stringify(r)),t.template=e._getColumnTemplateByType(o.type),t._cellsCachedValues=[]),t.formatSettings=s,t._isDirty=!0,o.required&&i.push({type:"required"}),t.validationRules=i,t._state&&["label","description","showDescriptionButton","dataType","editor","formatSettings","template","summary","validationRules","allowResize","allowSort","allowFilter","allowEdit","align","cellsAlign","cellsFormat"].forEach((e=>{t._state[e]=t[e]})),t.canNotify=!0,e.$.fireEvent("closeColumnDialog",{dataField:t.dataField}),e.onColumnUpdated&&e.onColumnUpdated(e.columns.indexOf(t),t),e._onColumnUpdated&&e._onColumnUpdated(t,o),e._recycle(!0),t.refresh(),t._isDirty=!1}else{let t=[];"number"===c&&(t=["sum"]);const a=e._getColumnLabel(o),l=new Smart.Grid.Column({label:a,description:o.description,dataField:o.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:o.allowResize,allowSort:o.allowSort,allowFilter:o.allowFilter,allowEdit:o.allowEdit,showDescriptionButton:!0,dataType:c,editor:r,summary:t,template:e._getColumnTemplateByType(o.type),formatSettings:s,cellsAlign:o.cellsAlign,align:o.cellsAlign,cellsFormat:d,visibleIndex:e.columns.length-1,grid:e});if("autoNumber"===l.template&&(l.autoGenerated=!0,t=[]),o.required&&(i.push({type:"required"}),l.validationRules=i),e._getKanbanFields().indexOf(o.type)>=0){const t=e._getKanbanTaskField(o.type);o.description&&(t.description=o.description),o.name&&(t.label=o.name),t.allowFilter=o.allowFilter,t.allowResize=o.allowResize,t.allowSort=o.allowSort,e.columnByDataField[t.dataField]&&(t.dataField=t.displayField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),"object"==typeof t.editor&&t.editor.dataSource&&(t.editor.dataSource=JSON.parse(JSON.stringify(t.editor.dataSource))),t.label=t.label+" "+e.localize("copy")),e.columns.push(t)}else e.columns.push(l);e._refreshHeaderBar(),e.$.fireEvent("closeColumnDialog",{dataField:l.dataField})}}_getColumnLabel(e){const t=this;let a=e.name;if(!a){let a="";switch(e.type){case"string":a=t.localize("dialogAddColumnTypeText");break;case"multiText":a=t.localize("dialogAddColumnTypeMultilineText");break;case"image":a=t.localize("dialogAddColumnTypeImage");break;case"number":a=t.localize("dialogAddColumnTypeNumber");break;case"select":a=t.localize("dialogAddColumnTypeSelect");break;case"multiSelect":a=t.localize("dialogAddColumnTypeMultipleSelect");break;case"boolean":a=t.localize("dialogAddColumnTypeCheckBox");break;case"date":a=t.localize("dialogAddColumnTypeDate");break;case"createdTime":a=t.localize("dialogAddColumnTypeCreatedTime");break;case"updatedTime":a=t.localize("dialogAddColumnTypeLastUpdatedTime");break;case"createdBy":a=t.localize("dialogAddColumnTypeCreatedBy");break;case"updatedBy":a=t.localize("dialogAddColumnTypeLastUpdatedBy");break;case"collaborator":a=t.localize("dialogAddColumnTypeCollaborator");break;case"slider":a=t.localize("dialogAddColumnTypeSlider");break;case"autoNumber":a=t.localize("dialogAddColumnTypeAutoNumber");break;case"url":a=t.localize("dialogAddColumnTypeURL");break;case"email":a=t.localize("dialogAddColumnTypeEmail");break;case"phone":a=t.localize("dialogAddColumnTypePhone");break;case"password":a=t.localize("dialogAddColumnTypePassword")}let i=1;for(let e=0;e<t.columns.length;e++)t.columns[e].label.indexOf(a)>=0&&i++;return 1===i?a:a+" "+i}return a}_openAddColumnDialog(e,t,a){const i=this,l=i._dialogAddColumn||i._createDialog(i.editing.addColumnDialog),n=e?i.localize("dialogEditColumn",{value:e.label}):i.localize("dialogAddColumn"),o=l.querySelector(".smart-footer").querySelector(".smart-stack-layout");l.classList.add("smart-grid-dialog-add-column"),l.type=e?"customize":"add",l.editColumn=e||null,e&&e.element&&e.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),i._cellEditors||(i._cellEditors=[]);const r=i._getAddColumnDialogTemplate();if(l.header.innerHTML=n,l.header.parentElement.classList.add("smart-hidden"),l.callback=a,!0===t&&(l.header.parentElement.classList.remove("smart-hidden"),"kanban"===i.view?(l.header.innerHTML=i.localize("dialogAddColumnStatus"),l.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),l.classList.add("view")):l.classList.remove("kanban")),l.stackLabel&&l.stackLabel.classList.add("smart-hidden"),"kanban"===i.view?l.btnCancel.classList.add("smart-hidden"):l.btnCancel.classList.remove("smart-hidden"),i.cancelEdit(),!i._dialogAddColumn){l.modal=!0,l.btnConfirm.innerHTML=i.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=i.localize("dialogEditButtonCancel"),l.onOpen=function(){i._addColumnDialogInitEditors(),i._addColumnDialogShowHideEditors(l.editColumn),i.$.fireEvent("openColumnDialog",{dataField:l.editColumn?l.editColumn.dataField:null});const e=i.offset(l),t=i.offset(i);if(e.top+l.offsetHeight>window.innerHeight-t.top){const a=e.top+l.offsetHeight-window.innerHeight+t.top;l.style.maxHeight=Math.max(250,l.offsetHeight-a)+"px",l.style.minHeight="250px"}else l.style.maxHeight="",l.style.minHeight=""},l.onClose=function(){l.editColumn&&l.editColumn.element&&l.editColumn.element.removeAttribute("focus"),l.classList.remove("view"),l.callback&&l.callback(l.result)},l.btnCancel.onclick=function(){l.result=!1,l.close()},l.btnClose.onclick=function(){l.result=!1,l.close()},l.btnConfirm.onclick=function(){i._confirmAddColumnDialog(),l.result=!0,l.close()},l.onkeydown=function(e){"Escape"===e.key&&"kanban"!==i.view&&(l.result=!1,l.close())},i._dialogAddColumn=l;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),l.content.appendChild(e),i._addColumnDialogEditors=[];for(let t=0;t<r.length;t++){const a=r[t],n=document.createElement("div"),o=document.createElement("label");o.innerHTML=a.label;const s=document.createElement("div");if(s.classList.add("smart-grid-dialog-editor","add-column"),s.innerHTML="",s.setAttribute("filter",a.filter),s.setAttribute("bind",a.bind),n.setAttribute("field-name",a.bind),n.setAttribute("field-filter",a.filter),i._addColumnDialogEditors[a.bind]=s,"type"===a.bind&&s.addEventListener("change",(()=>{i._addColumnDialogShowHideEditors(l.editColumn);const e=i._dialogAddColumn.querySelector('[bind="type"]'),t=e.querySelector("smart-input"),a=t.getSelectedItem().value;let n="smart-icon-font";switch(a){case"multiText":n="smart-icon-fontsize";break;case"image":n="smart-icon-image";break;case"number":case"progress":n="smart-icon-number";break;case"priority":case"status":case"select":n="smart-icon-sort-down";break;case"multiSelect":n="smart-icon-list-unordered";break;case"boolean":n="smart-icon-check-squared";break;case"date":case"startDate":case"dueDate":n="smart-icon-calendar";break;case"createdTime":case"updatedTime":n="smart-icon-clock";break;case"createdBy":case"updatedBy":case"collaborator":n="smart-icon-user";break;case"slider":n="smart-icon-number";break;case"autoNumber":case"checklist":n="smart-icon-list-ordered";break;case"url":n="smart-icon-link";break;case"email":n="smart-icon-mail";break;case"password":n="smart-icon-lock";break;case"phone":n="smart-icon-phone";break;case"name":n="smart-icon-font";break;case"description":n="smart-icon-fontsize";break;case"tags":n="smart-icon-font";break;case"color":n="smart-icon-color-background";break;case"assigned":n="smart-icon-user"}if(i._addColumnDialogEditors.type.icon=n,i._addColumnDialogEditors.name.querySelector("input").setAttribute("data-label",t.value),e.firstElementChild.className="smart-grid-icon show smart-description-button "+n,"select"===a||"multiSelect"===a){const e=i._addColumnDialogEditors.options.querySelector("smart-sortable");e&&e._validate&&e._validate()}else l.btnConfirm.disabled=!1})),"boolean"===a.type)i._createColumnBooleanEditor(s,a,n,e,o);else{if("label"===a.type){e.appendChild(n),n.classList.add("smart-grid-dialog-field"),n.appendChild(o);const t=document.createElement("div");t.style.height="10px",n.appendChild(t);continue}{let d=document.createElement("smart-input");if(d.classList.add("underlined","edit-column-input"),d.style.width="100%",d.style.height="30px",a.width&&(n.style.width=a.width,n.style.float="left"),"items"===a.type){const e=document.createElement("smart-button");e.classList.add("primary"),e.innerHTML='<div style="align-items: center; white-space: nowrap; display: flex;"><span class="smart-grid-icon show smart-icon-plus"></span><span>'+i.localize("commandBarAddRow")+"</span></div>";const t=document.createElement("div");t.classList.add("smart-grid-add-column-dialog-color-panel");const n=document.createElement("smart-sortable");n.disableMode="manual",n.dragMode="handle",n.handleVisibility="visible",n.handlePosition="left";const o=()=>{if(l.btnConfirm.disabled=!1,0===t.offsetHeight)return;let e=0;t.querySelectorAll(".edit-column-input").forEach((t=>{""===t.value&&e++,e>1&&(l.btnConfirm.disabled=!0)}))},r=(t,l,r,s)=>{const d=document.createElement("div"),c=i._getColorInput(),m=document.createElement("div"),u=document.createElement("smart-input"),b=i._addColumnDialogEditors.allowColorItems;if(void 0!==r)u.setAttribute("data-id",r),u.setAttribute("data-item-value",r);else{const e=n.querySelectorAll(".smart-sortable-item").length;u.setAttribute("data-id",e),u.setAttribute("data-item-value",e)}return void 0!==s&&u.setAttribute("data-item-value",s),c.disabled=!b.querySelector(".smart-input").value,m.className="smart-grid-icon smart-icon-close show",m.setAttribute("role","button"),m.setAttribute("aria-label","button"),u.classList.add("underlined","edit-column-input"),u.style.width="100%",u.style.height="30px",u.required=!0,t&&(u.value=t),l&&(c.value=l),u.onkeyup=u.onchange=u.onblur=t=>{o(),"Enter"===t.key&&(u.parentElement.nextElementSibling||(e.click(),o()))},d.appendChild(c),d.appendChild(u),"users"!==a.bind&&d.appendChild(m),m.onclick=()=>{d.remove(),n.updateItems(),o()},d.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),d};n._init=e=>{n.clearContent(),e&&(e.forEach(((e,t)=>{const a=void 0!==e.id?e.id:t,i=r(e.label,e.color,a,e.value);n.$.container.appendChild(i)})),n.updateItems())},n._validate=o,i._addColumnDialogEditors.allowColorItems.onchange=e=>{let t=i._addColumnDialogEditors.allowColorItems.parentElement.nextElementSibling,a=null;for(;t;){if("options"===t.getAttribute("field-name")){a=t;break}t=t.nextElementSibling}a&&a.querySelectorAll("smart-color-input").forEach((t=>{t.disabled=!e}))},t.appendChild(n),"users"!==a.bind&&(t.appendChild(e),e.onclick=()=>{const e=r();n.$.container.appendChild(e),n.updateItems(),e.querySelector(".edit-column-input").focus(),l.btnConfirm.disabled=!0}),d=t,s.style.height="auto"}else if("number"===a.type)d=document.createElement("smart-number-input"),d.classList.add("underlined"),d.style.width="100%",d.style.height="30px","minValue"===a.bind?(d.value=0,d.min=-9999999,d.max=9999999):"maxValue"===a.bind?(d.value=1e6,d.min=-9999999,d.max=9999999):"minLength"===a.bind?d.value=0:"maxLength"===a.bind&&(d.value=500);else if("datetime"===a.type)d=document.createElement("smart-date-input"),d.classList.add("underlined"),d.style.width="100%",d.style.height="30px","minDateTime"===a.bind?d.value=new Date(1900,0,1):"maxDateTime"===a.bind&&(d.value=new Date(2100,0,1));else if("radio"===a.type){const e=(e,t,a)=>{const i=document.createElement("div"),l=document.createElement("label"),n=document.createElement("div");return l.innerHTML=e,n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),t&&n.setAttribute("checked",""),n.value=void 0!==t&&t,s.appendChild(n),i.onclick=function(){if(n.value=!0,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),i.onchange&&i.onchange(i),n.value){const e=n.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n.value=!0,n.setAttribute("checked",n.value?"":"indeterminate"),e.value=a}},i.appendChild(n),i.appendChild(l),i.classList.add("smart-grid-dialog-boolean-field"),i.setAttribute("template","checkBox"),i.setAttribute("editor",""),i},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),s.classList.add("radio-group");for(let i=0;i<a.options.length;i++){const l=a.options[i],n=e(l.label,l.checked);if(a.columns){const e=100/a.columns;n.style.width=e+"%",n.style.float="left"}t.appendChild(n),l.checked&&(s.value=l.value)}const i=document.createElement("div");i.style.clear="both",t.appendChild(i),d=t}if(a.options){d.readonly=!0;let e=a.options;"type"===a.bind&&(void 0!==i.currentUser&&null!==i.currentUser||(e=e.filter((e=>"updatedBy"!==e.value&&"createdBy"!==e.value))),(void 0===i.users||null===i.users||i.users&&0===i.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),d.dataSource=e,d.dropDownButtonPosition="right","dataField"!==a.bind&&(d.selectedIndex=0),a.options.length<15?d.dropDownHeight="auto":d.dropDownHeight=300}if(a.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",a.icon,"show","smart-description-button"),s.appendChild(e),d.style.width="calc(100% - 25px)"}if(s.appendChild(d),a.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=a.info,s.appendChild(e),d.style.width="calc(100% - 25px)"}if(e.appendChild(n),n.classList.add("smart-grid-dialog-field"),n.appendChild(o),n.appendChild(s),a.width&&!r[t+1].width){const t=document.createElement("div");t.style.clear="both",e.appendChild(t)}}}}}const s=()=>{const t=parseInt(l.style.width),a=i.offset(i);if(window.screen.availWidth<400)return l.open("left","top"),l.style.width=i.offsetWidth+"px",void(l.style.height=i.offsetHeight+"px");{const e=i.editing.addColumnDialog;l.style.width="auto"===e.width?e.width:e.width+"px",l.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const n=e.element;if(n){const e=i.offset(n),o=e.left-a.left,r=a.left,s=Math.max(r,o);if(s+t+n.offsetWidth>a.left+i.offsetWidth){const i=s-t+n.offsetWidth;i<0?l.open("center",e.top+n.offsetHeight-a.top):l.open(Math.max(r,i),e.top+n.offsetHeight-a.top)}else l.open(s,e.top+n.offsetHeight-a.top)}else l.classList.add("center"),l.open("center","center")}else if(i._addNewColumn){let e=i._addNewColumn.element,n=i.offset(e),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o);i.editing.addNewColumn._addButton&&i.editing.addNewColumn._addButton.classList.contains("show")&&(e=i.editing.addNewColumn._addButton,n=i.offset(i.editing.addNewColumn._addButton),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o)),l.open(s,n.top+e.offsetHeight-a.top)}else l.open("center","center"),l.classList.add("center")};s(),l.refresh=()=>{s()}}_getLocaleByCurrency(e){const t={AED:"ar_AE",AFN:"fa_AF",ALL:"sq",AMD:"hy",ANG:"nl",AOA:"pt_AO",ARS:"es_AR",AUD:"en",AWG:"nl_AW",AZN:"az",BAM:"bs",BBD:"en_BB",BDT:"bn_BD",BGN:"bg",BHD:"ar_BH",BIF:"fr_BI",BMD:"en_BM",BND:"ms_BN",BOB:"es_BO",BRL:"pt_BR",BSD:"en_BS",BTN:"dz",BWP:"en_BW",BYN:"be",BYR:"be",BZD:"en_BZ",CAD:"en_CA",CDF:"fr_CD",CHF:"de_CH",CLP:"es_CL",CNY:"zh_Hans_CN",COP:"es_CO",CRC:"es_CR",CUP:"es_CU",CVE:"pt_CV",CZK:"cs",DJF:"fr_DJ",DKK:"da_DK",DOP:"es_DO",DZD:"ar_DZ",EGP:"ar_EG",ERN:"ti_ER",ETB:"am",EUR:"de",FJD:"en_FJ",FKP:"en_FK",GBP:"en",GEL:"ka",GHS:"en_GH",GIP:"en_GI",GMD:"en_GM",GNF:"fr_GN",GTQ:"es_GT",GYD:"en_GY",HKD:"zh_Hans_HK",HNL:"es_HN",HRK:"hr_HR",HTG:"en",HUF:"hu_HU",IDR:"id",ILS:"he",INR:"en_IN",IQD:"ar_IQ",IRR:"fa_IR",ISK:"is",JMD:"en_JM",JOD:"ar_JO",JPY:"ja",KES:"en_KE",KGS:"ky",KHR:"km",KMF:"ar",KPW:"ko_KP",KRW:"ko_KR",KWD:"ar_KW",KYD:"en_KY",KZT:"kk",LAK:"lo",LBP:"ar_LB",LKR:"si",LRD:"en_LR",LSL:"en_LS",LYD:"ar_LY",MAD:"ar",MDL:"ro",MGA:"fr_MG",MKD:"mk",MMK:"my",MNT:"mn",MOP:"zh",MRO:"ar_MR",MRU:"ar_MR",MUR:"en_MU",MVR:"en",MWK:"en",MXN:"es_MX",MYR:"ms_MY",MZN:"pt_MZ",NAD:"en_NA",NGN:"en_NG",NIO:"es_NI",NOK:"nb_NO",NPR:"ne",NZD:"en_NZ",OMR:"ar_OM",PAB:"es_PA",PEN:"es_PE",PGK:"en_PG",PHP:"fil",PKR:"ur_PK",PLN:"pl",PYG:"es_PY",QAR:"ar_QA",RON:"ro",RSD:"sr",RUB:"ru",RWF:"rw",SAR:"ar_SA",SBD:"en_SB",SCR:"en_SC",SDG:"ar_SD",SEK:"sv_SE",SGD:"en_SG",SHP:"en_SH",SLL:"en_SL",SOS:"so_SO",SRD:"nl_SR",SSP:"en",STD:"pt_ST",STN:"pt_ST",SYP:"ar_SY",SZL:"en_SZ",THB:"th",TJS:"en",TMT:"tk",TND:"ar_TN",TOP:"to",TRY:"tr_TR",TTD:"en_TT",TWD:"zh_Hant_TW",TZS:"sw_TZ",UAH:"uk",UGX:"en_UG",USD:"en_US",UYU:"es_UY",UZS:"uz",VEF:"es_VE",VND:"vi",VUV:"en_BI",WST:"en_AS",XAF:"fr",XCD:"en",XOF:"fr",XPF:"fr_PF",YER:"ar_YE",ZAR:"zu",ZMW:"en_ZM",ZWL:"en_ZW"};return t[e]?t[e].replace("_","-"):"en-US"}_getCurrencies(){return[{currency:"US Dollar",sign:"$",abbreviation:"USD"},{currency:"Afghan Afghani",sign:"Af.",abbreviation:"AFN"},{currency:"Albanian Lek",sign:"Lek",abbreviation:"ALL"},{currency:"Algerian Dinar",sign:"din",abbreviation:"DZD"},{currency:"Angolan Kwanza",sign:"Kz",abbreviation:"AOA"},{currency:"Argentine Peso",sign:"$",abbreviation:"ARS"},{currency:"Armenian Dram",sign:"Dram",abbreviation:"AMD"},{currency:"Aruban Florin",sign:"Afl.",abbreviation:"AWG"},{currency:"Australian Dollar",sign:"$",abbreviation:"AUD"},{currency:"Azerbaijani Manat",sign:"₼",abbreviation:"AZN"},{currency:"Bahamian Dollar",sign:"$",abbreviation:"BSD"},{currency:"Bahraini Dinar",sign:"din",abbreviation:"BHD"},{currency:"Bangladeshi Taka",sign:"৳",abbreviation:"BDT"},{currency:"Barbadian Dollar",sign:"$",abbreviation:"BBD"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYN"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYR"},{currency:"Belize Dollar",sign:"$",abbreviation:"BZD"},{currency:"Bermudan Dollar",sign:"$",abbreviation:"BMD"},{currency:"Bhutanese Ngultrum",sign:"Nu.",abbreviation:"BTN"},{currency:"Bolivian Boliviano",sign:"Bs",abbreviation:"BOB"},{currency:"Bosnia-Herzegovina Convertible Mark",sign:"KM",abbreviation:"BAM"},{currency:"Botswanan Pula",sign:"P",abbreviation:"BWP"},{currency:"Brazilian Real",sign:"R$",abbreviation:"BRL"},{currency:"British Pound Sterling",sign:"£",abbreviation:"GBP"},{currency:"Brunei Dollar",sign:"$",abbreviation:"BND"},{currency:"Bulgarian Lev",sign:"лв.",abbreviation:"BGN"},{currency:"Burundian Franc",sign:"FBu",abbreviation:"BIF"},{currency:"Cambodian Riel",sign:"Riel",abbreviation:"KHR"},{currency:"Canadian Dollar",sign:"$",abbreviation:"CAD"},{currency:"Cape Verdean Escudo",sign:"CVE",abbreviation:"CVE"},{currency:"Cayman Islands Dollar",sign:"$",abbreviation:"KYD"},{currency:"CFA Franc BCEAO",sign:"CFA",abbreviation:"XOF"},{currency:"CFA Franc BEAC",sign:"FCFA",abbreviation:"XAF"},{currency:"CFP Franc",sign:"FCFP",abbreviation:"XPF"},{currency:"Chilean Peso",sign:"$",abbreviation:"CLP"},{currency:"Chinese Yuan",sign:"¥",abbreviation:"CNY"},{currency:"Chinese Yuan (offshore)",sign:"¥",abbreviation:"RMB"},{currency:"Colombian Peso",sign:"$",abbreviation:"COP"},{currency:"Comorian Franc",sign:"CF",abbreviation:"KMF"},{currency:"Congolese Franc",sign:"FrCD",abbreviation:"CDF"},{currency:"Costa Rican Colon",sign:"₡",abbreviation:"CRC"},{currency:"Croatian Kuna",sign:"kn",abbreviation:"HRK"},{currency:"Cuban Convertible Peso",sign:"$",abbreviation:"CUC"},{currency:"Cuban Peso",sign:"$",abbreviation:"CUP"},{currency:"Czech Republic Koruna",sign:"Kč",abbreviation:"CZK"},{currency:"Danish Krone",sign:"kr.",abbreviation:"DKK"},{currency:"Djiboutian Franc",sign:"Fdj",abbreviation:"DJF"},{currency:"Dominican Peso",sign:"RD$",abbreviation:"DOP"},{currency:"East Caribbean Dollar",sign:"$",abbreviation:"XCD"},{currency:"Egyptian Pound",sign:"£",abbreviation:"EGP"},{currency:"Eritrean Nakfa",sign:"Nfk",abbreviation:"ERN"},{currency:"Ethiopian Birr",sign:"Birr",abbreviation:"ETB"},{currency:"Euro",sign:"€",abbreviation:"EUR"},{currency:"Falkland Islands Pound",sign:"£",abbreviation:"FKP"},{currency:"Fijian Dollar",sign:"$",abbreviation:"FJD"},{currency:"Gambian Dalasi",sign:"GMD",abbreviation:"GMD"},{currency:"Georgian Lari",sign:"GEL",abbreviation:"GEL"},{currency:"Ghanaian Cedi",sign:"GHS",abbreviation:"GHS"},{currency:"Gibraltar Pound",sign:"£",abbreviation:"GIP"},{currency:"Guatemalan Quetzal",sign:"Q",abbreviation:"GTQ"},{currency:"Guinean Franc",sign:"FG",abbreviation:"GNF"},{currency:"Guyanaese Dollar",sign:"$",abbreviation:"GYD"},{currency:"Haitian Gourde",sign:"HTG",abbreviation:"HTG"},{currency:"Honduran Lempira",sign:"L",abbreviation:"HNL"},{currency:"Hong Kong Dollar",sign:"$",abbreviation:"HKD"},{currency:"Hungarian Forint",sign:"Ft",abbreviation:"HUF"},{currency:"Icelandic Krona",sign:"kr",abbreviation:"ISK"},{currency:"Indian Rupee",sign:"₹",abbreviation:"INR"},{currency:"Indonesian Rupiah",sign:"Rp",abbreviation:"IDR"},{currency:"Iranian Rial",sign:"Rial",abbreviation:"IRR"},{currency:"Iraqi Dinar",sign:"din",abbreviation:""},{currency:"Israeli New Sheqel",sign:" ₪",abbreviation:"ILS"},{currency:"Jamaican Dollar",sign:"$",abbreviation:"JMD"},{currency:"Japanese Yen",sign:"¥",abbreviation:"JPY"},{currency:"Jordanian Dinar",sign:"din",abbreviation:"JOD"},{currency:"Kazakhstani Tenge",sign:"₸",abbreviation:"KZT"},{currency:"Kenyan Shilling",sign:"Ksh",abbreviation:"KES"},{currency:"Kuwaiti Dinar",sign:"din",abbreviation:"KWD"},{currency:"Kyrgystani Som",sign:"KGS",abbreviation:"KGS"},{currency:"Laotian Kip",sign:"₭",abbreviation:"LAK"},{currency:"Lebanese Pound",sign:"L£",abbreviation:"LBP"},{currency:"Lesotho Loti",sign:"LSL",abbreviation:"LSL"},{currency:"Liberian Dollar",sign:"$",abbreviation:"LRD"},{currency:"Libyan Dinar",sign:"din",abbreviation:"LYD"},{currency:"Lithuanian Litas",sign:"Lt",abbreviation:"LTL"},{currency:"Macanese Pataca",sign:"MOP",abbreviation:"MOP"},{currency:"Macedonian Denar",sign:"din",abbreviation:"MKD"},{currency:"Malagasy Ariary",sign:"Ar",abbreviation:"MGA"},{currency:"Malawian Kwacha",sign:"MWK",abbreviation:"MWK"},{currency:"Malaysian Ringgit",sign:"RM",abbreviation:"MYR"},{currency:"Maldivian Rufiyaa",sign:"Rf",abbreviation:"MVR"},{currency:"Mauritanian Ouguiya",sign:"MRO",abbreviation:"MRO"},{currency:"Mauritian Rupee",sign:"MURs",abbreviation:"MUR"},{currency:"Mexican Peso",sign:"$",abbreviation:"MXN"},{currency:"Moldovan Leu",sign:"MDL",abbreviation:"MDL"},{currency:"Mongolian Tugrik",sign:"₮",abbreviation:"MNT"},{currency:"Moroccan Dirham",sign:"dh",abbreviation:"MAD"},{currency:"Mozambican Metical",sign:"MTn",abbreviation:"MZN"},{currency:"Myanma Kyat",sign:"K",abbreviation:"MMK"},{currency:"Namibian Dollar",sign:"$",abbreviation:"NAD"},{currency:"Nepalese Rupee",sign:"Rs",abbreviation:"NPR"},{currency:"Netherlands Antillean Guilder",sign:"NAf.",abbreviation:"ANG"},{currency:"New Taiwan Dollar",sign:"NT$",abbreviation:"TWD"},{currency:"New Zealand Dollar",sign:"$",abbreviation:"NZD"},{currency:"Nicaraguan Cordoba",sign:"C$",abbreviation:"NIO"},{currency:"Nigerian Naira",sign:"₦",abbreviation:"NGN"},{currency:"North Korean Won",sign:"₩KP",abbreviation:"KPW"},{currency:"Norwegian Krone",sign:"kr",abbreviation:"NOK"},{currency:"Omani Rial",sign:"Rial",abbreviation:"OMR"},{currency:"Pakistani Rupee",sign:"Rs",abbreviation:"PKR"},{currency:"Panamanian Balboa",sign:"B/.",abbreviation:"PAB"},{currency:"Papua New Guinean Kina",sign:"PGK",abbreviation:"PGK"},{currency:"Paraguayan Guarani",sign:"Gs.",abbreviation:"PYG"},{currency:"Peruvian Nuevo Sol",sign:"S/.",abbreviation:"PEN"},{currency:"Philippine Peso",sign:"₱",abbreviation:"PHP"},{currency:"Polish Zloty",sign:"zł",abbreviation:"PLN"},{currency:"Qatari Rial",sign:"Rial",abbreviation:"QAR"},{currency:"Romanian Leu",sign:"RON",abbreviation:"RON"},{currency:"Russian Ruble",sign:"₽",abbreviation:"RUB"},{currency:"Rwandan Franc",sign:"RF",abbreviation:"RWF"},{currency:"Saint Helena Pound",sign:"£",abbreviation:"SHP"},{currency:"Samoan Tala",sign:"WST",abbreviation:"WST"},{currency:"Sao Tomean Dobra",sign:"Db",abbreviation:"STD"},{currency:"Saudi Riyal",sign:"Rial",abbreviation:"SAR"},{currency:"Serbian Dinar",sign:"din",abbreviation:"RSD"},{currency:"Seychellois Rupee",sign:"SCR",abbreviation:"SCR"},{currency:"Sierra Leonean Leone",sign:"SLL",abbreviation:"SLL"},{currency:"Singapore Dollar",sign:"$",abbreviation:"SGD"},{currency:"Solomon Islands Dollar",sign:"$",abbreviation:"SBD"},{currency:"Somali Shilling",sign:"SOS",abbreviation:"SOS"},{currency:"South African Rand",sign:"R",abbreviation:"ZAR"},{currency:"South Korean Won",sign:"₩",abbreviation:"KRW"},{currency:"South Sudanese Pound",sign:"£",abbreviation:"SSP"},{currency:"Sri Lankan Rupee",sign:"Rs",abbreviation:"LKR"},{currency:"Sudanese Pound",sign:"SDG",abbreviation:"SDG"},{currency:"Surinamese Dollar",sign:"$",abbreviation:"SRD"},{currency:"Swazi Lilangeni",sign:"SZL",abbreviation:"SZL"},{currency:"Swedish Krona",sign:"kr",abbreviation:"SEK"},{currency:"Swiss Franc",sign:"CHF",abbreviation:"CHF"},{currency:"Syrian Pound",sign:"£",abbreviation:"SYP"},{currency:"Tajikistani Somoni",sign:"Som",abbreviation:"TJS"},{currency:"Tanzanian Shilling",sign:"TSh",abbreviation:"TZS"},{currency:"Thai Baht",sign:"฿",abbreviation:"THB"},{currency:"Tongan Pa'anga",sign:"T$",abbreviation:"TOP"},{currency:"Trinidad and Tobago Dollar",sign:"$",abbreviation:"TTD"},{currency:"Tunisian Dinar",sign:"din",abbreviation:"TND"},{currency:"Turkish Lira",sign:"₺",abbreviation:"TRY"},{currency:"Turkmenistani Manat",sign:"m",abbreviation:"TMT"},{currency:"Ugandan Shilling",sign:"UGX",abbreviation:"UGX"},{currency:"Ukrainian Hryvnia",sign:"грн.",abbreviation:"UAH"},{currency:"United Arab Emirates Dirham",sign:"dh",abbreviation:"AED"},{currency:"Uruguayan Peso",sign:"$",abbreviation:"UYU"},{currency:"Uzbekistan Som",sign:"soʼm",abbreviation:"UZS"},{currency:"Vanuatu Vatu",sign:"VUV",abbreviation:"VUV"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VEF"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VES"},{currency:"Vietnamese Dong",sign:"₫",abbreviation:"VND"},{currency:"Yemeni Rial",sign:"Rial",abbreviation:"YER"},{currency:"Zambian Kwacha",sign:"ZMW",abbreviation:"ZMW"},{currency:"Zimbabwean Dollar",sign:"$",abbreviation:"ZWD"}].map((e=>(e.label=e.currency,e.menuLabel='<div style="display: flex; justify-content: space-between;"><span>'+e.currency+'</span><span style="opacity: 0.7;">'+e.sign+" 1,000.00</span></div>",e.value=e.abbreviation,e)))}});
|
|
1449
|
+
Smart.Utilities.Assign("Grid.Dialog",class{_openImagePreviewDialog(e){const t=this,a=e?[...e.parentNode.parentNode.querySelectorAll("img")]:[];if(e=e.cloneNode(),!t._dialogImagePreview){t._dialogImagePreview=t._createDialog({modal:!0,screenModal:!0,left:"screenMiddle",top:"screenCenter",width:"80%",height:"80%"}),t._dialogImagePreview.content.innerHTML='<div style="width: 100%; height: 100%;"><div class="images-container"></div><div class="image-preview"></div></div>';const e=t._dialogImagePreview.content.firstElementChild;e.style.display="grid",e.style.gridTemplateColumns="50px 1fr"}const i=t._dialogImagePreview.querySelector(".images-container");i.innerHTML="";const l=(e,a)=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const i=150+Math.min(850,e.width),l=150+Math.min(650,e.height);t._dialogImagePreview.style.width=i+"px",t._dialogImagePreview.style.height=l+"px",!1!==a&&(t._dialogImagePreview.style.left="calc(50% - "+Math.min(850,t._dialogImagePreview.offsetWidth/2)+"px)",t._dialogImagePreview.style.top="calc(50% - "+Math.min(650,t._dialogImagePreview.offsetHeight/2)+"px)");const n=getComputedStyle(t._dialogImagePreview),o=parseInt(n.top),r=parseInt(n.left);(window.offsetWidth<i||window.offsetHeight<l||o<0||r<0)&&(t._dialogImagePreview.style.left="0px",t._dialogImagePreview.style.top="0px",t._dialogImagePreview.style.width="100%",t._dialogImagePreview.style.height="100%"),e.style.maxWidth="100%"},n=()=>{const e=t._dialogImagePreview.querySelector(".images-container");let a=-1;return e.querySelectorAll("img").forEach(((e,t)=>{if(e.hasAttribute("active"))return a=t,!0})),a},o=e=>{const a=t._dialogImagePreview.querySelector(".images-container");e&&a.querySelectorAll("img").forEach((t=>{if(t.style.borderColor="transparent",t.removeAttribute("active"),t.src===e.src){t.style.borderColor="var(--smart-primary)",t.setAttribute("active",""),r.innerHTML=`<img src="${t.src}"/>`;const e=r.querySelector("img");e.onload=()=>{l(e,!1)}}}))};if(a.length>1)for(let t=0;t<a.length;t++){const l=a[t].cloneNode();l.style.width="40px",l.style.height="40px",l.style.cursor="pointer",l.style.borderStyle="solid",l.style.borderWidth="1px",l.style.borderColor="transparent",l.style.borderRadius="var(--smart-border)",l.style.marginTop="10px",l.title=a[t].title||a[t].parentNode.title,a[t].src===e.src&&(l.style.borderColor="var(--smart-primary)",l.setAttribute("active","")),i.appendChild(l),l.onmouseenter=()=>{l.style.borderColor="var(--smart-primary)"},l.onmouseleave=()=>{l.hasAttribute("active")||(l.style.borderColor="transparent")},l.onclick=()=>{o(l)}}const r=t._dialogImagePreview.content.querySelector(".image-preview");r.innerHTML="",r.appendChild(e),t._dialogImagePreview.btnClose.onclick=e=>{t._dialogImagePreview.close(),e.preventDefault(),e.stopPropagation()},e.style.marginLeft="auto",e.style.marginRight="auto",e.style.maxWidth="",e.onload=()=>{l(e)},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){if("Escape"===e.key&&t._dialogImagePreview.close(),"ArrowUp"===e.key||"ArrowLeft"===e.key){const t=n();o(a[t-1]),e.stopPropagation(),e.preventDefault()}else if("ArrowDown"===e.key||"ArrowRight"===e.key){const t=n();o(a[t+1]),e.stopPropagation(),e.preventDefault()}},t._dialogImagePreview.btnClose.tabIndex=0,t._dialogImagePreview.onOpen=()=>{setTimeout((()=>{t._dialogImagePreview.btnClose.focus()}),100)},t._dialogImagePreview.footer.remove(),t._dialogImagePreview.header.parentNode.style.backgroundColor="var(--smart-background)",t._dialogImagePreview.open()}_openImageDialog(e,t){const a=this,i=a._dialogImage||a._createDialog(),l='<span class="smart-grid-icon smart-icon-image show"></span>'+a.localize("dialogImageHeader");if(i.cell||(i.cell=e),i.header.innerHTML=l,i.column=e.column,i.command=t,i.classList.add("smart-grid-image-dialog"),!a._dialogImage){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){i.fileUpload.value="",i.input.value="";let e=i.cell.editor.instance.getValue();if("[]"!==e)if(e&&"string"==typeof e&&e.indexOf("http")>=0)i.input.value=JSON.parse(e)[0].value,i.tabs[1].click(),n("input");else{i.tabs[0].click();const t=(e,t)=>{let a=e.split(","),i=a[0].match(/:(.*?);/)[1],l=atob(a[1]),n=l.length,o=new Uint8Array(n);for(;n--;)o[n]=l.charCodeAt(n);return new File([o],t,{type:i})},a=new DataTransfer;"string"==typeof e&&e.indexOf("base64")>=0&&(e=JSON.parse(e)),Array.isArray(e)&&(e.forEach((e=>{a.items.add(t(e.value,e.label))})),i.fileUpload.files=a.files,n())}else i.tabs[0].click()},i.onClose=function(){},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){if(i.tabs[1].classList.contains("active"))i.input.value?e.editor.instance.setValue([{label:i.input.value,value:i.input.value}]):e.editor.instance.setValue([]),a._endCellEdit(i.cell);else{const t=(e,t)=>{var a=new FileReader;a.readAsDataURL(e),a.onload=function(){t(a.result)},a.onerror=function(){t("error")}},l=[];if(i.fileUpload.files.length)for(let n=0;n<i.fileUpload.files.length;n++){const o=i.fileUpload.files[n];t(o,(t=>{"error"===t&&console.log("Image load error"),l.push({value:t,label:o.name}),l.length===i.fileUpload.files.length&&(e.editor.instance.setValue(l),a._endCellEdit(i.cell))}))}else e.editor.instance.setValue([]),a._endCellEdit(i.cell)}i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogImage=i,i.content.innerHTML=`\n <div>\n <div>\n <div class="tabs">\n <div class="active tab">\n <span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogImageDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${a.localize("dialogImageLink")}</label>\n </div>\n </div>\n </div>\n <div class="smart-grid-drop-zone">\n <div>\n <div class="title"><span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogImageUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${a.localize("dialogImageDrop")}</label></div>\n </div> \n <input accept=".jpg, .jpeg, .png" type="file" multiple="multiple" style="display: none;">\n </div>\n <div class="smart-hidden url-zone">\n <div class="url-title">\n ${a.localize("dialogImageURL")}\n </div>\n <div class="upload">\n <smart-input placeholder="https://example.com/image.png" class="underlined"></smart-input>\n <br/>\n <smart-button disabled class="success">${a.localize("dialogImageURLUpload")}</smart-button>\n </div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,i.input=i.querySelector("smart-input"),i.dropZone=i.querySelector(".smart-grid-drop-zone"),i.upload=i.querySelector(".title"),i.fileUpload=i.querySelector("input"),i.preview=i.querySelector(".preview"),i.tabs=i.querySelectorAll(".tab"),i.urlZone=i.querySelector(".url-zone"),i.uploadButton=i.querySelector("smart-button");const t=["image/apng","image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon"],l=e=>t.includes(e.type);i.dropZone.ondrop=i.dropZone.dropHere=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;const a=i.column.editor.maxImages||5;for(let a=0;a<e.dataTransfer.items.length;a++)if("file"===e.dataTransfer.items[a].kind){const i=e.dataTransfer.items[a].getAsFile();l(i)&&t++}if(t===e.dataTransfer.files.length||t===a){const t=new DataTransfer;let l=[...e.dataTransfer.files],o=[...i.fileUpload.files];l.length>a&&(l=l.slice(0,5)),o.length>a&&(o=o.slice(0,5)),o.forEach(((e,i)=>{i<a&&t.items.add(e)})),l.forEach(((e,i)=>{i<a&&t.items.add(e)})),i.fileUpload.files=t.files,n()}}else i.fileUpload.files=e.dataTransfer.files,n()},i.dropZone.ondragover=e=>{e.preventDefault()},i.tabs[0].onclick=()=>{i.tabs[0].classList.add("active"),i.tabs[1].classList.remove("active"),i.dropZone.classList.remove("smart-hidden"),i.urlZone.classList.add("smart-hidden"),i.updatePreview()},i.tabs[1].onclick=()=>{i.tabs[0].classList.remove("active"),i.tabs[1].classList.add("active"),i.dropZone.classList.add("smart-hidden"),i.urlZone.classList.remove("smart-hidden"),i.updatePreview("input")},i.uploadButton.onclick=()=>{i.updatePreview("input")};const n=e=>{const t=i.preview,o=i.fileUpload;function r(e){return e<1024?e+"bytes":e>=1024&&e<1048576?((e/1024).toFixed(1)+"KB").replace(".0",""):e>=1048576?(e/1048576).toFixed(1)+"MB":void 0}for(;t.firstChild;)t.removeChild(t.firstChild);const s=()=>{const e=document.createElement("div");return e.classList.add("item"),e.onpointerdown=t=>{const l=e.getBoundingClientRect();if(i.input.value="",t.clientY>=l.bottom-12){if(t.clientX>l.left+l.width/2-13&&t.clientX<l.left+l.width/2+13){e.remove();const t=i.preview.querySelectorAll(".item"),a=new DataTransfer;t.forEach((e=>{a.items.add(e.file)})),o.files=a.files,i.clearButton&&0===t.length&&i.clearButton.classList.remove("show")}}else a._openImagePreviewDialog(e.querySelector("img"))},e},d=()=>{const e=document.createElement("div");e.classList.add("list");const l=document.createElement("div");l.classList.add("smart-grid-icon","show","smart-icon-delete"),l.title=a.localize("clear"),t.appendChild(l),l.onclick=()=>{o.value="",i.input.value="",n()},i.clearButton=l,t.appendChild(e)};if("input"===e){const e=i.input.value;if(e){const t=s();if(d(),e.endsWith("png")||e.endsWith("jpeg")||e.endsWith("jpg")){const a=document.createElement("img");a.src=e,t.appendChild(a)}i.preview.lastChild.appendChild(t)}else{const e=document.createElement("p");e.textContent=a.localize("dialogImageFileUpload"),t.appendChild(e)}}else{const e=o.files;if(0===e.length){const e=document.createElement("p");e.textContent=a.localize("dialogImageFileUpload"),t.appendChild(e)}else{d();const n=new DataTransfer,c=i.column.editor.maxImages||5,m=i.column.editor.maxImageSize||524288;let u=0,b=[];for(const o of e){const e=s();if(u>=c){b.push(o.name);continue}const d=document.createElement("div");if(l(o)){d.textContent=`${o.name}, ${r(o.size)}.`,d.textContent.length>20&&(d.textContent=`${o.name.substring(0,5)}...${o.name.substring(o.name.length-4)}, ${r(o.size)}.`);const i=document.createElement("img");if(i.src=URL.createObjectURL(o),o.size>m){const e=document.createElement("p");e.textContent=a.localize("dialogImageSize",{value:o.name,fileSize:r(m)}),t.appendChild(e);continue}n.items.add(o),e.file=o,e.title=d.textContent,e.appendChild(i),e.appendChild(d)}i.preview.querySelector(".list").appendChild(e),u++}if(b.length>0){const e=document.createElement("p");e.textContent=a.localize("dialogImageCount",{files:b.toString(),fileCount:c}),t.appendChild(e)}o.files=n.files}}};i.updatePreview=n,i.fileUpload.onchange=()=>{if(0===i.fileUpload.files.length&&i._tempFiles)i.fileUpload.files=i._tempFiles;else if(i._tempFiles){const e=new DataTransfer,t=[...i.fileUpload.files];[...i._tempFiles].forEach((t=>{e.items.add(t)})),t.forEach((t=>{e.items.add(t)})),i.fileUpload.files=e.files}n()},i.input.onchange=i.input.onblur=i.input.onkeyup=()=>{i.uploadButton.disabled=!i.input.value||!i.input.value.startsWith("https://")},i.upload.onclick=()=>{i._tempFiles=[];const e=new DataTransfer;[...i.fileUpload.files].forEach((t=>{e.items.add(t)})),i._tempFiles=e.files,i.fileUpload.click()}}i.open(),setTimeout((function(){i.btnConfirm.focus()}),100)}_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}_createDialog(e){const t=this;let a=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(a.modal=e.modal),void 0!==e.screenModal&&(a.screenModal=e.screenModal),a.setAttribute("animation","none"),a.classList.add("smart-window","smart-grid-dialog"),a.style.width="auto"===e.width?e.width:e.width+"px",a.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(a.style.width=e.width),e.height&&"string"==typeof e.height&&(a.style.height=e.height),a.style.left="",a.style.top="",a.innerHTML='<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div id="headerSection" class="smart-header-section">\n <div class="smart-header"></div>\n <div class="smart-buttons-container">\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-prev-button" aria-label="Previous Record" smart-id="prevButton"></button>\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-next-button" aria-label="Next Record" smart-id="nextButton"></button>\n <button class ="smart-button smart-element smart-close-button" aria-label="Close" smart-id="closeButton"></button>\n </div>\n </div>\n <div class="smart-content"><div class="smart-content-container"></div></div>\n <div class ="smart-footer">\n <div class ="smart-stack-layout right spacing">\n <smart-button class ="smart-confirm-button item primary">Ok</smart-button>\n <smart-button class ="smart-cancel-button item">Cancel</smart-button>\n </div>\n </div>\n </div>\n </div>\n ',a.querySelector&&a.querySelector(".smart-content")&&(a.content=a.querySelector(".smart-content").firstChild),a.footer=a.querySelector(".smart-footer"),a.header=a.querySelector(".smart-header"),a.btnConfirm=a.querySelector(".smart-confirm-button"),a.btnCancel=a.querySelector(".smart-cancel-button"),a.btnClose=a.querySelector(".smart-close-button"),a.btnNext=a.querySelector(".smart-next-button"),a.btnPrev=a.querySelector(".smart-prev-button");const i=document.createElement("div");return i.classList.add("smart-grid-dialog-overlay"),i.onclick=function(){},a.overlay=i,a.remove=function(){a.parentNode&&a.parentNode.removeChild(a)},a.close=function(){a.classList.remove("open"),delete t._resizeHandling,a.addEventListener("transitionend",a.remove),a.addEventListener("transitioncancel",a.remove),a.modal&&a.overlay.parentNode&&a.overlay.parentNode.removeChild(a.overlay),a.onClose&&a.onClose()},a.open=function(i,l){a.removeEventListener("transitionend",a.remove),a.removeEventListener("transitioncancel",a.remove),t.isInShadowDOM?t.getRootNode().appendChild(a):document.body.appendChild(a),t._resizeHandling=!1,void 0===i&&(i=e.left),void 0===l&&(l=e.top),requestAnimationFrame((function(){a.classList.add("open");const e=a.querySelector('[bind="name"]');if(e){const t=e.querySelector("smart-input");t&&t.focus()}const n=function(e,i){const l=t.offset(t);switch("center"===e&&"horizontal"===i&&(e="middle"),e){case"top":return l.top;case"bottom":return Math.max(l.top,l.top+t.offsetHeight-a.offsetHeight);case"center":return Math.max(l.top,l.top+t.offsetHeight/2-a.offsetHeight/2);case"left":return l.left;case"middle":return l.left+t.offsetWidth/2-a.offsetWidth/2;case"right":return l.left+t.offsetWidth-a.offsetWidth}return"horizontal"===i?parseInt(e)+l.left:"vertical"===i?parseInt(e)+l.top:"number"==typeof e?e:parseInt(e)};a.style.left=n(i,"horizontal")+"px",a.style.top=n(l,"vertical")+"px",a.setPosition=(e,t)=>{t?a.style.left=n(e,"horizontal")+"px":a.style.top=n(e,"vertical")+"px"},"screenMiddle"===i&&(a.style.left="calc(50% - "+a.offsetWidth/2+"px)"),"screenCenter"===l&&(a.style.top="calc(50% - "+a.offsetHeight/2+"px)")})),a.modal&&(a.screenModal?t.isInShadowDOM?t.getRootNode().appendChild(a.overlay):document.body.appendChild(a.overlay):t.appendChild(a.overlay)),a.onOpen&&a.onOpen()},a}_openAddRowDialog(e,t){const a=this;if(!a.editing.addDialog.enabled)return!1;const i=a._dialogAddRow||a._createDialog(),l="{{message}}"===a.editing.dialog.header?a.localize("dialogAddHeader"):a.editing.dialog.header,n=i.content;i.header.innerHTML=l,e.grid=a,void 0===e.index&&(e.index=a.rows.length,a._rowsAdded&&(e.index+=a._rowsAdded.length));const o=e.cells;let r=null,s=0;if(a._cellEditors||(a._cellEditors=[]),!a._dialogAddRow){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogAddButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogAddButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0},i.onClose=function(){a.editing.dialog.visible=!1},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){const e={};for(let t=0;t<o.length;t++){const i=o[t],l=a._getEditorValue(i),n=a._getEditorId(i),r=a._cellEditors[n];r&&(l&&l.error?(e[i.column.dataField]=l.value,r.detach()):(e[i.column.dataField]=l,r.detach()))}const l=a._rowsAdded?a._rowsAdded.length:0,n=new Smart.Grid.Row({index:a.rows.length+l,id:Smart.Utilities.Core.createGUID(),grid:a,data:e});i.close(),t(n,0===i.index)},i.onkeydown=function(e){const t=e.key;"Enter"===t?i.btnConfirm.onclick():"Escape"===t&&i.close()},n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;s%2==0&&(r=document.createElement("div"),r.classList.add("smart-grid-edit-dialog-row"),n.appendChild(r));const i=document.createElement("div");i.classList.add("col-sm-6");const l=document.createElement("div");l.classList.add("column");const o=document.createElement("label");o.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),i.appendChild(l),r.appendChild(i),l.appendChild(o),l.appendChild(d),s++}}i.open(),i.index=e.index;let d=0;for(let e=0;e<o.length;e++){const t=o[e],l=t.column,n=l.dataField,r=i.querySelector("[editor="+n+"]");if(!r)continue;r.innerHTML="";let s="";void 0!==t.value&&(s=t.value),"int64"!==l.dataType&&"number"!==l.dataType&&"int"!==l.dataType&&"float"!==l.dataType||(s=0),"date"===l.dataType&&(s=new Date),"bool"!==l.dataType&&"boolean"!==l.dataType||(s=!1);let c=null;switch(t.editor.template){default:case"custom":c=a._getCustomCellEditor(t);break;case"image":c=a._getImageCellEditor(t);break;case"checkBox":c=a._getCheckBoxCellEditor(t);break;case"autoComplete":c=a._getAutoCompleteCellEditor(t);break;case"dropDownList":c=a._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=a._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=a._getMaskCellEditor(t);break;case"checkInput":c=a._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=a._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=a._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=a._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=a._getDateInputCellEditor(t);break;case"dateRangeInput":c=a._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=a._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=a._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?a._getNumberInputCellEditor(t):a._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(s),0===d&&setTimeout((()=>{c.focus()}),100),!t.editor.isInitialized&&(t.editor.isInitialized=!0,t.editor.onInit)){const e=t.editor.onInit(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,i="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)i[e]=a[e]}}if(t.editor.onRender){const e=t.editor.onRender(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,i="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)i[e]=a[e]}}r.appendChild(c.element),c.element.onfocus=()=>{r.setAttribute("focus","")},c.element.onblur=()=>{r.removeAttribute("focus")},d++}a._dialogAddRow=i}_openEditDialog(e,t){const a=this;if(!a.editing.dialog.enabled)return!1;const i=a._dialogEdit||a._createDialog();let l="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeader",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header;const n=i.content;!1===a.editing.enabled?(i.classList.add("disable-edit"),l="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeaderDisabled",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header):i.classList.remove("disable-edit"),i.header.innerHTML=l,i.row=a.editing.editRow,a.editing.recordNavigation&&i.classList.add("disable-animation");let o=null,r=0;if(void 0!==a._settingsDialogRowId){i.btnPrev.classList.remove("smart-hidden"),i.btnNext.classList.remove("smart-hidden");const e=e=>{const t=a.editing.editRow,l=a._recyclingRows.indexOf(t);let n=e?a._recyclingRows[l+1]:a._recyclingRows[l-1];if(a.grouping.enabled&&a.dataSource.groupBy&&a.dataSource.groupBy.length>0){let t=1;for(;n&&!n.leaf;)n=e?a._recyclingRows[l+t]:a._recyclingRows[l-t],t++}if(n){i.classList.add("disable-animation"),a.editing.recordNavigation=!0;const e=i.querySelector("[focus]");if(e){const t=e.closest(".smart-grid-edit-dialog-row"),i=t.closest(".smart-grid-edit-dialog-editors-container");let l=-1;if(i&&(l=[...i.children].indexOf(t)),a.cancelEdit(),a._openRowSettingsDialog(n.id),a._dialogEdit&&l>=0){const e=a._dialogEdit.querySelectorAll(".smart-grid-edit-dialog-row")[l];if(e&&a.editing.enabled){const t=e.querySelector(".smart-grid-dialog-editor");t.setAttribute("focus",""),t.querySelector(".smart-grid-cell-editor").focus()}}}else a.cancelEdit(),a._openRowSettingsDialog(n.id)}};i.btnNext.onmousedown=t=>{e(!0),t.preventDefault(),t.stopPropagation()},i.btnPrev.onmousedown=t=>{e(!1),t.preventDefault(),t.stopPropagation()}}if(!a._dialogEdit)if(i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0,a._settingsDialogRowId&&i.editorsContent&&i.editorsContent.offsetHeight&&(i.editorsContent.style.maxHeight=i.editorsContent.offsetHeight+40+"px")},i.onClose=function(){a.editing.dialog.visible=!1,i.row&&(i.row.showDetail=!1)},i.btnCancel.onclick=function(){a.cancelEdit()},i.btnClose.onclick=function(){a.cancelEdit()},i.btnConfirm.onclick=function(){if(void 0!==a._settingsDialogRowId){if(a.rowById[a._settingsDialogRowId]){const e=a.editing.editRow;if(!e)return!1;const t=e.cells;let l={};e.element.removeAttribute("error");for(let e=0;e<t.length;e++){const i=t[e],n=a._getEditorValue(i);l[i.column.dataField]=n}const n=a.validateRow(e.id,l);if(Object.keys(n).length>0){let e=!0;for(let l=0;l<t.length;l++){const o=t[l],r=n[o.column.dataField],s=i.querySelector(`[label-for="${o.column.dataField}"]`);if(s&&(s.innerHTML=""),r)for(let t in r){const i=r[t];let l="";if(!i)continue;let n=i[t];"minLength"!==t&&"maxLength"!==t||(n=i[t.toLowerCase()]),l=i.message?i.message:"required"===t||"valueMissing"===t?a.localize("requiredValue",{value:o.column.label}):"min"===t?a.localize("invalidMinValue",{value:o.column.label,min:n.min}):"max"===t?a.localize("invalidMaxValue",{value:o.column.label,max:n.max}):"minLength"===t?a.localize("invalidMinLengthValue",{value:o.column.label,min:n.requiredLength}):"maxLength"===t?a.localize("invalidMaxLengthValue",{value:o.column.label,max:n.requiredLength}):a.localize("invalidValue"),e=!1,s&&(s.innerHTML=l)}}if(!e)return}const o=e.style;e.updatedDate=new Date,e.updatedBy=a.currentUser,e.style=i._rowStyle,e.comments=i._rowComments;const r=a.dataSource.dataItemById[e.id];if(r){const t=r.$.index;a.dataSource&&e.comments!==a.dataSource.boundSource[t].comments&&(a._sortedColumns&&a._sortedColumns.length>0?r.comments=e.comments:a.dataSource.boundSource[t].comments=e.comments)}e.style=i._rowStyle,a.onRowStyle&&o!==e.style&&(null===o?a.onRowStyle(e.index,e,e.style):o.background===e.style.background&&o.color===e.style.color&&o.fontSize===e.style.fontSize&&o.fontStyle===e.style.fontStyle&&o.fontFamily===e.style.fontFamily&&o.fontWeight===e.style.fontWeight&&o.status===e.style.status&&o.textDecoration===e.style.textDecoration||a.onRowStyle(e.index,e,e.style))}if(i.columnVisibility){let e=!1;const t=a.columns.canNotify;a.columns.canNotify=!1;for(let t in i.columnVisibility){const l=a.columnByDataField[t];l.visible!==i.columnVisibility[t]&&(l.visible=i.columnVisibility[t],e=!0)}if(a.columns.canNotify=t,e)return a.endEdit(),a.refresh(!1),void(a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh()))}}a.endEdit(),a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh())},i.onkeydown=function(e){const t=e.key,i=a.editing.commandKeys;for(let e in i){const l=i[e];if(t===l.key){a._applyCommand(l.command);break}}},a.editing.editRow)if(void 0!==a._settingsDialogRowId)a._applySettingsDialogLayout(i,n,a.editing.editRow);else{n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;r%2==0&&(o=document.createElement("div"),o.classList.add("smart-grid-edit-dialog-row"),n.appendChild(o));const i=document.createElement("div");i.classList.add("col-sm-6");const l=document.createElement("div");l.classList.add("column");const s=a._settingsDialogRowId?document.createElement("div"):document.createElement("label");s.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),i.appendChild(l),o.appendChild(i),l.appendChild(s),l.appendChild(d),r++}}else{const t=e.column,a=document.createElement("div");a.classList.add("smart-grid-dialog-editor"),a.setAttribute("editor",""),a.setAttribute("template",t.editor.template),n.appendChild(a)}if(i.open(),a.editing.editRow){const a=i.querySelector("[editor="+e.column.dataField+"]");a&&(a.innerHTML="",a.appendChild(t.element),t.element.onfocus=()=>{a.setAttribute("focus","")},t.element.onblur=()=>{a.removeAttribute("focus")})}else{const a=e.column,l=i.querySelector("[editor]");l.innerHTML="",l.setAttribute("template",a.editor.template),l.appendChild(t.element),t.element.onfocus=()=>{l.setAttribute("focus","")},t.element.onblur=()=>{l.removeAttribute("focus")}}a._dialogEdit=i}_refreshCurrentUser(){const e=this,t=e.users;let a=e.currentUser,i=!0,l=!0,n=e.editing.enabled,o=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(i=!1!==a.allowAdd,l=!1!==a.allowComment,n=n&&!1!==a.allowEdit,o=!1!==a.allowRemove)),e._currentUser={allowAdd:i,allowComment:l,allowEdit:n,allowRemove:o,info:a}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-grid-color-input")},e}_applySettingsDialogLayout(e,t,a){const i=this;e.classList.add("smart-grid-dialog-expand-row");const l=e._rowStyle=JSON.parse(JSON.stringify(a._style)),n=e._rowComments=JSON.parse(JSON.stringify(a.comments)),o=[];e.columnVisibility=o;const r=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div");d.appendChild(r),d.appendChild(s),t.appendChild(d),d.classList.add("smart-grid-edit-dialog-layout"),r.classList.add("smart-grid-edit-dialog-editors-container"),s.classList.add("smart-grid-edit-dialog-activity-container");let c=0;for(let e=0;e<i.columns.length;e++){const t=i.columns[e];t.allowEdit&&!1!==t._visible&&c++}c>=8?r.classList.add("many"):r.classList.remove("many"),e.editorsContent=r,e.activityContent=s;const m=document.createElement("div"),u=document.createElement("div");s.appendChild(m),s.appendChild(u);let b=n&&n.length?" ("+n.length+")":"";m.innerHTML=`\n <div class="tabs">\n <div view="details" class="active tab"><div class="tab-label">${i.localize("detailsTab")}</div></div>\n <div view="comments" class="tab"><div class="tab-label">${i.localize("commentsTab")}${b}</div></div>\n <div view="history" class="tab smart-hidden"><div class="tab-label">${i.localize("historyTab")}</div></div>\n </div>\n <div class="details-tab">\n <div class="smart-grid-edit-dialog-row"><div class="column"><div class="header smart-grid-edit-dialog-column-info">${i.localize("format").replace(":","")}\n <span title="${i.localize("resetFormat")}" class="reset-format smart-grid-icon smart-icon-reload show"></span>\n </div>\n </div>\n <div class="format-layout">\n <div title="${i.localize("background")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-color-background show"></span><div class="background"></div>\n </div>\n <div title="${i.localize("color")}" class="format smart-grid-edit-dialog-column-info">\n <span style="border-bottom: 2px solid #46CA78;" color="#46CA78" class="format smart-grid-icon smart-icon-font show"></span><div class="color"></div>\n </div>\n <div class="format-layout button-group">\n <span title="${i.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${i.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${i.localize("underline")}" class="formatbtn underline smart-grid-icon smart-icon-underline show"></span>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("fontFamily").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-font show"></span><div class="font-family"></div>\n </div>\n <div title="${i.localize("fontSize").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-fontsize show"></span><div class="font-size"></div>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("status").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span color="#F1C58B" class="smart-grid-icon smart-icon-star show"></span><div class="status"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="comments-tab smart-hidden">\n <div class="column"><div class="comments-header smart-grid-edit-dialog-column-info">${i.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments">${i.localize("noComments")}</span></div>\n <div class="footer">\n <smart-text-area hint="${i.localize("comment")}" placeholder="${i.localize("comment")}" class="success underlined"></smart-text-area>\n <smart-button class="success">${i.localize("send")}</smart-button>\n </div>\n </div>\n </div>\n <div class="history-tab smart-hidden">\n <div class="history-layout">\n </div>\n </div>\n `;const g=m.querySelectorAll(".tab");i.storeHistory&&(!i._currentUser||i._currentUser&&!i._currentUser.info?g[g.length-1].classList.add("smart-hidden"):g[g.length-1].classList.remove("smart-hidden")),!i.users||i.users&&0===i.users.length||!i._currentUser||i._currentUser&&!i._currentUser.info?g[g.length-2].classList.add("smart-hidden"):g[g.length-2].classList.remove("smart-hidden"),m.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),a=m.querySelector(".details-tab"),l=m.querySelector(".comments-tab"),n=m.querySelector(".history-tab");a.classList.add("smart-hidden"),l.classList.add("smart-hidden"),n.classList.add("smart-hidden");for(let e=0;e<g.length;e++)g[e].classList.remove("active");switch(t.classList.add("active"),e){case"details":a.classList.remove("smart-hidden");break;case"comments":l.classList.remove("smart-hidden");break;case"history":n.classList.remove("smart-hidden"),i._refreshHistory()}}};const p=i._getColorInput();m.querySelector(".background").appendChild(p),p.onchange=()=>{l.background=p.value},l.background&&(p.value=l.background);const y=i._getColorInput();m.querySelector(".color").appendChild(y),y.onchange=()=>{l.color=y.value},l.color&&(y.value=l.color);const v=i._getColorInput();m.querySelector(".status").appendChild(v),v.onchange=()=>{l.status=v.value},l.status&&(v.value=l.status);const f=document.createElement("smart-input");f.style.width="auto",f.classList.add("underlined"),f.dropDownButtonPosition="right",f.readonly=!0,f.dropDownHeight="auto",f.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],f.onchange=()=>{l.fontFamily=f.value},l.fontFamily?f.value=l.fontFamily:f.selectedIndex=0,m.querySelector(".font-family").appendChild(f);const h=document.createElement("smart-input");h.style.width="auto",h.classList.add("underlined"),h.dropDownButtonPosition="right",h.readonly=!0,h.dropDownHeight="auto",h.dataSource=["-","8px","10px","12px","14px","18px","24px","36px"],h.onchange=()=>{l.fontSize=h.value},l.fontSize?h.value=l.fontSize:h.selectedIndex=0,m.querySelector(".font-size").appendChild(h);const C=m.querySelector(".button-group");C.onclick=e=>{const t=e.target.closest(".formatbtn");let a;t.classList.contains("checked")?(t.classList.remove("checked"),a=!1):(t.classList.add("checked"),a=!0),t.classList.contains("bold")?l.fontWeight=a?"bold":null:t.classList.contains("italic")?l.fontStyle=a?"italic":null:t.classList.contains("underline")&&(l.textDecoration=a?"underline":null)},l.fontWeight?C.children[0].classList.add("checked"):C.children[0].classList.remove("checked"),l.fontStyle?C.children[1].classList.add("checked"):C.children[1].classList.remove("checked"),l.textDecoration?C.children[2].classList.add("checked"):C.children[2].classList.remove("checked"),m.querySelector(".reset-format").onclick=()=>{for(let e=0;e<C.children.length;e++)C.children[e].classList.remove("checked");f.selectedIndex=0,h.selectedIndex=0,y.value="",p.value="",v.value="",l.fontWeight=null,l.fontStyle=null,l.textDecoration=null,l.fontSize=null,l.fontFamily=null};const w=m.querySelector(".comments-header"),S=m.querySelector('[view="comments"]'),A=m.querySelector(".comments-layout smart-text-area"),D=m.querySelector(".comments-layout smart-button"),L=m.querySelector(".comments-layout .footer"),_=m.querySelector(".comments-layout .comments");D.disabled=!0,_.innerHTML=`<span class="no-comments">${i.localize("noComments")}</span>`;const k=()=>{const e=_.querySelector(".no-comments");0===n.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},x=e=>{e.querySelector(".remove-button").onclick=e=>{const t=e.target,l=n.indexOf(t.comment);if(l>-1){const e=n[l];n.splice(l,1),i.$.fireEvent("commentRemove",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,n),t.element.remove();const o=n.length?"("+n.length+")":"";w.innerHTML=S.innerHTML=`${i.localize("comments").replace(":","")} ${o}`}}};for(let e=0;e<n.length;e++){const t=n[e],a=i._createComment(t);x(a),_.appendChild(a)}w.innerHTML=`${i.localize("comments").replace(":","")} ${b}`,k(),A.onfocus=()=>{L.classList.add("focus")},A.onblur=()=>{L.classList.remove("focus")},A.onkeyup=()=>{D.disabled=""===A.value},D.onclick=()=>{if(""===A.value)return;i._refreshCurrentUser();const e={text:A.value,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:i._currentUser.info?i._currentUser.info.id:-1,time:new Date},t=i._createComment(e);x(t),n.push(e),i.$.fireEvent("commentAdd",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,n),A.value="",D.disabled=!0,k(),_.appendChild(t);const l=n.length?"("+n.length+")":"";w.innerHTML=S.innerHTML=`${i.localize("comments").replace(":","")} ${l}`};for(let e=0;e<i.columns.length;e++){const t=i.columns[e];if(!t.allowEdit||!1===t._visible)continue;const a=document.createElement("div");a.classList.add("smart-grid-edit-dialog-row"),r.appendChild(a);const l=document.createElement("div"),n=i._settingsDialogRowId?document.createElement("div"):document.createElement("label"),s=t.validationRules&&t.validationRules.length>0?"*":"";n.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${i.columns[e].icon} show"></span><label>`+i.columns[e].label+s+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template);const c=n.querySelector("[toggle]");c.column=t,o[t.dataField]=t.visible,c.title=i.localize("columnMenuItemHide"),!1===i.editing.enabled&&c.classList.add("smart-visibility-hidden"),c.onclick=()=>{o[c.column.dataField]=!c.column.visible,c.classList.contains("smart-icon-visibility-on")?(c.classList.remove("smart-icon-visibility-on"),c.classList.add("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemShow")):(c.classList.add("smart-icon-visibility-on"),c.classList.remove("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemHide"))},t.visible||(c.classList.remove("smart-icon-visibility-on"),c.title=i.localize("columnMenuItemShow")),t.visible?c.classList.add("smart-icon-visibility-on"):c.classList.add("smart-icon-visibility-off"),l.appendChild(n),l.appendChild(d);const m=document.createElement("label");m.classList.add("smart-field-editor-error-label"),m.setAttribute("label-for",t.dataField),l.appendChild(m),a.appendChild(l)}}_refreshHistory(){const e=this,t=e._dialogEdit;if(!t)return;const a=t.querySelector(".history-layout");if(!e.storeHistory)return void a.classList.add("smart-hidden");if(!e._currentUser||e._currentUser&&!e._currentUser.info)return void a.classList.add("smart-hidden");a.classList.remove("smart-hidden");const i=t.row.history;if(!i)return;let l="\n ";for(let t=i.length-1;t>=0;t--){const a=i[t];let n="";if(e._kanban)n=e._kanban._getHistoryItemLabel(a);else if("created"===a.action)n=e.localize("rowCreated",{value:a.action});else{const t=e.columnByDataField[a.action];n=e.localize("propertyUpdated",{value:t?t.label:a.action})}if(l+='<div class="history-row">',void 0!==a.user){const t=(t=>{const a=t?t.image:null;return{image:a?`background-image: url('${a}');`:"",label:t?t.name||t.id:e.localize("guestUser"),cssClass:a?"image":""}})(e.users.find((e=>e.id===a.user)));l+=`<div class="history-user"><div class="user-icon smart-user ${t.cssClass}" style="${t.image}"></div><div class="user-name">${t.label}</div><div class="time">${new Smart.Utilities.DateTime(a.date).toString("dd/MM/yyyy hh:mm")}</div></div>`}else l+="<div></div>";if(l+='<div class="history-action">',l+=`<div>${n}</div>`,"created"!==a.action){let t=a.details.oldValue,i=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t||e.id===parseFloat(t))),l=e.users.find((e=>e.id===i||e.id===parseFloat(i)));a?t=a.name:(t="",t||(t=e.localize("unassigned"))),l?i=l.name:(i="",i||(i=e.localize("unassigned")))}if("subtasks"===a.action){const t=a.details.value.filter((e=>e.completed));e._kanban?l+=`<span class="detail smart-truncate">${e._kanban.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span>`:l+=`<span class="detail smart-truncate">${e.localize("nullRange",{value:t.length})}</span>`}else{t&&"object"==typeof t&&t instanceof Date&&(t=t.toLocaleString()),i&&"object"==typeof i&&i instanceof Date&&(i=i.toLocaleString());let n=e.columnByDataField[a.action];n||(n=e.columnByDataField["task"+a.action.substring(0,1).toUpperCase()+a.action.substring(1)]),"user"===a.action&&(n=e.columnByDataField.taskUserId);let o="";n&&n.label&&(o='"'+n.label+'"'),n&&"date"===n.dataType&&(t&&"string"==typeof t&&(t=new Date(t).toLocaleString()),i&&"string"==typeof i&&(i=new Date(i).toLocaleString())),l+=t?`<span class="detail smart-truncate">${e.localize("range",{column:o,oldValue:t,newValue:i})}</span>`:`<span class="detail smart-truncate">${e.localize("nullRange",{column:o,oldValue:t,newValue:i})}</span>`}}else l+=`<div>${a.details.value}</div>`;l+="</div>\n </div>"}l+="",a.innerHTML=l}_createComment(e){const t=this,a=t.users.find((t=>t.id===e.userId)),i=document.createElement("div"),l=a?a.name||a.id:t.localize("guestUser"),n=a?a.name:t.localize("guestUser"),o=a.image?a.image:"";if(i.className="comment",i.setAttribute("role","listitem"),i.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${l}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${n}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n</div>\n<div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,o){const e=i.querySelector(".user-icon");e.style.backgroundImage=`url('${o}')`,e.classList.add("image")}i.comment=e;const r=i.querySelector(".remove-button");return r.comment=e,r.element=i,e.userId!==t._currentUser.info.id&&r.classList.add("smart-visibility-hidden"),i}_openSummaryRowDialog(e){const t=this,a=t._summaryRowDialog||t._createDialog(),i="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(a.header.innerHTML=i,!a.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",a.content.innerHTML="",a.listBox=e}const l=a.listBox;a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser");const n=e.element.querySelector(".summary-value");if(!n)return;n.classList.add("summary-chooser"),a.summaryValueElement=n;let o=[];a.dataField=e.column.dataField,o="string"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:"boolean"===e.column.dataType||"any"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"}]:"date"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:[{label:t.localize("countSummary"),value:"count"},{label:t.localize("minSummary"),value:"min"},{label:t.localize("maxSummary"),value:"max"},{label:t.localize("sumSummary"),value:"sum"},{label:t.localize("avgSummary"),value:"avg"}],l.dataSource=o,l.style.position="absolute",l.style.visibility="hidden",l.style.height="auto",t.isInShadowDOM?t.getRootNode().appendChild(l):document.body.appendChild(l);const r=e.column;r.summary&&r.summary.forEach((e=>{l.select(e)}));const s=l.offsetHeight;a.column=r,a.content.appendChild(l),a.classList.add("smart-grid-dialog-summary"),a.header.parentElement.classList.add("smart-hidden"),a.footer.classList.add("smart-hidden"),l.style.visibility="",l.style.position="",l.style.width="100%",t._summaryRowDialog||(a.btnConfirm.innerHTML=t.localize("apply"),a.btnCancel.innerHTML=t.localize("cancel"),a.style.width=a.style.minWidth="120px",a.onOpen=function(){t.editing.dialog.visible=!0},a.onClose=function(){t.editing.dialog.visible=!1,a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser")},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e=a.column.summary;a.column.summary=l.selectedValues,t.$.fireEvent("columnSummaryChange",{column:a.column,dataField:r.dataField,oldSummary:[...e],summary:[...a.column.summary]}),a.close(),t._calculateSummary(),t._recycle(!1)},a.confirm=function(){a.btnConfirm.click()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},t._summaryRowDialog=a);const d=e.element,c=t.offset(d),m=t.offset(t);let u=d.offsetWidth+c.left-m.left-120;u<0&&(u=c.left-m.left),a.open(u,c.top-m.top-s-0),setTimeout((function(){a.btnConfirm.focus()}),100)}_openDescriptionDialog(e,t){const a=this,i=a._dialogDescription||a._createDialog(),l=a.localize("dialogDescriptionHeader",{value:e.label});if(i.header.innerHTML=l,i.column=e,i.command=t,i.classList.add("smart-grid-dialog-add-column"),!a._dialogDescription){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){const e=i.querySelector("smart-input");"duplicate"!==t&&setTimeout((()=>{e.select()}),250)},i.onClose=function(){},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){const e=i.querySelector("smart-input");switch(i.command){case"duplicate":0===e.selectedIndex?a.duplicateCommand(i.column,null,!0):a.duplicateCommand(i.column,null,!1);break;case"rename":i.column.label=e.value;break;case"editDescription":i.column.description=e.value}i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogDescription=i;const e=document.createElement("smart-input");e.classList.add("underlined"),e.dataSource="duplicate"!==t?[]:[{label:a.localize("duplicateCells"),value:"cells"},{label:a.localize("duplicateSettings"),value:"settings"}],i.content.appendChild(e)}const n=e.element,o=a.offset(n),r=a.offset(a);i.open(o.left-r.left,o.top+n.offsetHeight-r.top);const s=i.querySelector("smart-input");switch(s.selectedIndex=0,s.readonly=!0,s.dropDownButtonPosition="right",t){case"rename":s.value=e.label;break;case"editDescription":s.value=e.description}setTimeout((function(){i.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const a=this;if(!a.editing.deleteDialog.enabled)return!1;const i=a._dialogDelete||a._createDialog(),l="{{message}}"===a.editing.dialog.header?a.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):a.editing.dialog.header;i.header.innerHTML=l,i.content.innerHTML=a.localize("dialogDeleteContent"),i.row=e,a._dialogDelete||(i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogDeleteButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogDeleteButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0},i.onClose=function(){a.editing.dialog.visible=!1},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){t(i.row),i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogDelete=i),i.open(),setTimeout((function(){i.btnConfirm.focus()}),100)}_getTypesList(){const e=this,t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"image",prefix:'<span class="smart-grid-icon visible smart-icon-image"></span>',label:e.localize("dialogAddColumnTypeImage")},{value:"number",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeNumber")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")},{value:"boolean",prefix:'<span class="smart-grid-icon visible smart-icon-check-squared"></span>',label:e.localize("dialogAddColumnTypeCheckBox")},{value:"date",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDate")},{value:"createdTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeCreatedTime")},{value:"updatedTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedTime")},{value:"createdBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCreatedBy")},{value:"updatedBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedBy")},{value:"collaborator",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCollaborator")},{value:"slider",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeSlider")},{value:"autoNumber",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeAutoNumber")},{value:"url",prefix:'<span class="smart-grid-icon visible smart-icon-link"></span>',label:e.localize("dialogAddColumnTypeURL")},{value:"email",prefix:'<span class="smart-grid-icon visible smart-icon-mail"></span>',label:e.localize("dialogAddColumnTypeEmail")},{value:"phone",prefix:'<span class="smart-grid-icon visible smart-icon-phone"></span>',label:e.localize("dialogAddColumnTypePhone")},{value:"password",prefix:'<span class="smart-grid-icon visible smart-icon-lock"></span>',label:e.localize("dialogAddColumnTypePassword")}];if(e.header.visible&&e.header.buttons.indexOf("views")>=0){const a={value:"startDate",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeStartDate")},i={value:"dueDate",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDueDate")},l={value:"progress",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeProgress")},n={value:"priority",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypePriority")},o={value:"status",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("status")},r={value:"name",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeName")},s={value:"description",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeDescription")},d={value:"tags",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeTags")},c={value:"checklist",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeChecklist")},m={value:"color",prefix:'<span class="smart-grid-icon visible smart-icon-color-background"></span>',label:e.localize("dialogAddColumnTypeColor")};t.push(a),t.push(i),t.push(l),t.push(n),t.push(r),t.push(s),t.push(d),t.push(c),t.push(m),t.push(o)}return t}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),a=new Date(t,6,30);return[{bind:"kanban",name:"kanban",type:"radio",label:e.localize("kanbanNoneDescription"),filter:"kanban",options:[{value:"blank",checked:!0,label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"description",type:"input",label:e.localize("dialogAddColumnDescription"),filter:"any",placeholder:e.localize("dialogAddColumnDescriptionPlaceholder"),info:e.localize("dialogAddColumnDescriptionInfo")},{bind:"type",name:"typeslist",type:"dropDownList",filter:"any",label:e.localize("dialogAddColumnType"),icon:"smart-icon-font",options:e._getTypesList(),info:e.localize("dialogAddColumnTypeInfo")},{bind:"dateFormat",name:"dateformat",type:"dropDownList",label:e.localize("dialogAddColumnDateFormat"),options:[{value:"M/d/yyyy",label:e.localize("dialogAddColumnDateFormatShort")+" ("+new Smart.Utilities.DateTime(a).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(a).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(a).toString("ISO8601")+")"},{value:"d/M/yyyy",label:e.localize("dialogAddColumnDateFormatEU")+" (30/7/"+t+")"},{value:"yyyy-MM-dd",label:e.localize("dialogAddColumnDateFormatAS")+" ("+t+"-30-07)"},{value:"MMMM, dd, yyyy",label:e.localize("dialogAddColumnDateFormatFull")+" (July, 30, "+t+")"}],filter:"date",info:e.localize("dialogAddColumnDateFormatInfo")},{bind:"timeFormat",name:"timeformat",type:"dropDownList",label:e.localize("dialogAddColumnTimeFormat"),filter:"time",width:"50%",options:[{value:"hh:mm",label:"12 "+e.localize("dialogAddColumnTimeFormatHour")},{value:"HH:mm",label:"24 "+e.localize("dialogAddColumnTimeFormatHour")}],info:e.localize("dialogAddColumnTimeFormatInfo")},{bind:"allowTimeFormat",type:"boolean",label:e.localize("dialogAddColumnAllowTimeFormat"),filter:"date",value:!1,info:""},{bind:"allowCustomDateSeparator",type:"boolean",label:e.localize("dialogAddColumnCustomDateSeparator"),filter:"date",value:!1,info:""},{bind:"dateFormatSeparator",name:"dateFormatSeparator",type:"radio",label:"",filter:"date",columns:3,options:[{value:"/",label:e.localize("dialogAddColumnDateFormatSlash")+" (/)"},{value:"-",label:e.localize("dialogAddColumnDateFormatHyphen")+" (-)"},{value:".",label:e.localize("dialogAddColumnDateFormatDot")+" (.)"}]},{bind:"numberFormat",name:"numberFormat",type:"dropDownList",label:e.localize("dialogAddColumnNumberFormat"),filter:"number",options:[{value:{style:"decimal",maximumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatInteger")+" 1,000"},{value:{style:"decimal",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatNumber")+" 1,000.12"},{value:{style:"percent",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatPercent")+" 10.12%"},{value:{style:"percent",maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatPercentRounded")+" 10%"},{value:{style:"decimal",notation:"scientific"},label:e.localize("dialogAddColumnNumberFormatScientific")+" 1.01E+03"},{value:{style:"decimal",notation:"engineering"},label:e.localize("dialogAddColumnNumberFormatEngineering")+" 34.284 x 10^9"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,currencySign:"accounting"},label:e.localize("dialogAddColumnNumberFormatAccounting")+" $(1,000.12)"},{value:{style:"unit",unit:"kilogram"},label:e.localize("dialogAddColumnNumberFormatUnit")+" 10.12 kg"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency},label:e.localize("dialogAddColumnNumberFormatCurrency")+" $1,000.12"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatCurrencyRounded")+" $1,000"}],required:!1,info:e.localize("dialogAddColumnNumberFormatInfo")},{bind:"currency",name:"currency",type:"dropDownList",filter:"number",required:!1,options:e._getCurrencies(),label:e.localize("dialogAddColumnNumberFormatCurrency"),info:e.localize("dialogAddColumnNumberFormatCurrencyInfo")},{bind:"unit",name:"unit",type:"dropDownList",filter:"number",required:!1,options:[{value:"acre",label:e.localize("dialogAddColumnNumberFormatUnitAcre")},{value:"percent",label:e.localize("dialogAddColumnNumberFormatUnitPercent")},{value:"degree",label:e.localize("dialogAddColumnNumberFormatUnitDegree")},{value:"megabyte",label:e.localize("dialogAddColumnNumberFormatUnitMegaByte")},{value:"centimeter",label:e.localize("dialogAddColumnNumberFormatUnitCentimeter")},{value:"meter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")},{value:"kilometer",label:e.localize("dialogAddColumnNumberFormatUnitKilometer")},{value:"mile",label:e.localize("dialogAddColumnNumberFormatUnitMile")},{value:"celsius",label:e.localize("dialogAddColumnNumberFormatUnitCelsius")},{value:"fahrenheit",label:e.localize("dialogAddColumnNumberFormatUnitFahrenheit")},{value:"kilogram",label:e.localize("dialogAddColumnNumberFormatUnitKilogram")},{value:"pound",label:e.localize("dialogAddColumnNumberFormatUnitPound")},{value:"liter",label:e.localize("dialogAddColumnNumberFormatUnitLiter")},{value:"gallon",label:e.localize("dialogAddColumnNumberFormatUnitGallon")},{value:"second",label:e.localize("dialogAddColumnNumberFormatUnitSecond")},{value:"minute",label:e.localize("dialogAddColumnNumberFormatUnitMinute")},{value:"hour",label:e.localize("dialogAddColumnNumberFormatUnitHour")},{value:"day",label:e.localize("dialogAddColumnNumberFormatUnitDay")},{value:"week",label:e.localize("dialogAddColumnNumberFormatUnitWeek")},{value:"month",label:e.localize("dialogAddColumnNumberFormatUnitMonth")},{value:"year",label:e.localize("dialogAddColumnNumberFormatUnitYear")}],label:e.localize("dialogAddColumnNumberFormatUnit"),info:e.localize("dialogAddColumnNumberFormatUnitInfo")},{bind:"minLength",name:"minlength",width:"50%",type:"number",filter:"text",required:!1,label:e.localize("dialogAddColumnMinLength"),info:e.localize("dialogAddColumnMinLengthInfo")},{bind:"maxLength",name:"maxlength",width:"50%",filter:"text",type:"number",required:!1,label:e.localize("dialogAddColumnMaxLength"),info:e.localize("dialogAddColumnMaxLengthInfo")},{bind:"minValue",name:"minvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMinValue"),info:e.localize("dialogAddColumnMinValueInfo")},{bind:"maxValue",name:"maxvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMaxValue"),info:e.localize("dialogAddColumnMaxValueInfo")},{bind:"minDateTime",name:"mindatetime",type:"datetime",filter:"date",width:"50%",label:e.localize("dialogAddColumnMinDate"),info:e.localize("dialogAddColumnMinDateInfo")},{bind:"maxDateTime",name:"maxdatetime",type:"datetime",width:"50%",filter:"date",label:e.localize("dialogAddColumnMaxDate"),info:e.localize("dialogAddColumnMaxDateInfo")},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"allowCheckItems",type:"boolean",filter:"hidden",value:!1,label:e.localize("dialogAddColumnCheckItems"),info:""},{bind:"allowMultipleCollaborators",type:"boolean",filter:"collaborator",value:!1,label:e.localize("dialogAddColumnMultipleCollaborators"),info:e.localize("dialogAddColumnMultipleCollaboratorsInfo")},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""},{bind:"users",name:"users",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"collaborator",info:""},{name:"align",bind:"cellsAlign",type:"dropDownList",label:e.localize("dialogAddColumnAlign"),required:!1,options:[{value:"left",label:e.localize("dialogAddColumnAlignLeft")},{value:"right",label:e.localize("dialogAddColumnAlignRight")},{value:"center",label:e.localize("dialogAddColumnAlignCenter")}],filter:"any",info:e.localize("dialogAddColumnAlignInfo")},{bind:"allowResize",type:"boolean",filter:"any",width:"50%",label:e.localize("dialogAddColumnResizable"),info:e.localize("dialogAddColumnResizableInfo")},{bind:"required",type:"boolean",width:"50%",filter:"text",value:!1,label:e.localize("dialogAddColumnRequired"),info:e.localize("dialogAddColumnRequiredInfo")},{bind:"allowSort",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnSortable"),info:e.localize("dialogAddColumnSortableInfo")},{bind:"allowFilter",type:"boolean",align:"left",width:"50%",filter:"any",label:e.localize("dialogAddColumnFilterable"),info:e.localize("dialogAddColumnFilterableInfo")},{bind:"allowEdit",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnEditable"),info:e.localize("dialogAddColumnEditableInfo")}]}_getKanbanFields(){return["startDate","dueDate","progress","checklist","priority","tags","name","color","description","status"]}_addColumnDialogShowHideEditors(e){const t=this,a=t._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input").getSelectedItem().value,i=t._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),l=t._getKanbanFields(),n=t._dialogAddColumn.querySelector('[field-name="kanbanNotes"]');n&&("kanban"!==t.view?n.classList.add("smart-hidden"):n.classList.remove("smart-hidden"));let o=!!e;for(let n=0;n<i.length;n++){const r=i[n],s=r.getAttribute("filter"),d=r.getAttribute("bind"),c=r.parentNode;if(c.classList.add("smart-hidden"),"cellsAlign"===d&&("boolean"===a||"image"===a||"email"===a||"url"===a||"collaborator"===a||"createdBy"===a||"password"===a||"phone"===a||"createdTime"===a||"updatedBy"===a||"updatedTime"===a||l.indexOf(a)>=0))c.classList.add("smart-hidden");else if("type"===d&&o)c.classList.add("smart-hidden");else if("allowEdit"===d&&(!1===t.editing.enabled||"autoNumber"===a||"createdBy"===a||"updatedBy"===a||"createdTime"===a||"updatedTime"===a||l.indexOf(a)>=0))c.classList.add("smart-hidden");else if("allowResize"!==d||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==d||!1!==t.filtering.enabled)if("allowSort"!==d||!1!==t.sorting.enabled)if("required"!==d||!1!==t.editing.enabled&&("string"===a||"multiText"===a))if(e&&e.disabledDialogOptions&&e.disabledDialogOptions.length>0&&e.disabledDialogOptions.indexOf(d)>=0)c.classList.add("smart-hidden");else{if(e&&"kanban"===t.view){switch(d){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":c.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===s&&c.classList.remove("smart-hidden")}if("any"!==s)switch(a){default:case"text":"text"===s&&c.classList.remove("smart-hidden"),e&&"any"===e.dataType&&c.classList.add("smart-hidden");break;case"slider":case"number":if("number"===s&&c.classList.remove("smart-hidden"),"unit"===d||"currency"===d){c.classList.add("smart-hidden");const e=t._dialogAddColumn.querySelector('[field-name="numberFormat"]'),a=t._dialogAddColumn.querySelector('[field-name="unit"]'),i=t._dialogAddColumn.querySelector('[field-name="currency"]'),l=e.querySelector("smart-input"),n=()=>{const e=l.getSelectedItem();i.classList.add("smart-hidden"),e&&"unit"===e.value.style?a.classList.remove("smart-hidden"):e&&"currency"===e.value.style?i.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};e.onchange=()=>{n()},n()}break;case"select":case"multiSelect":s.indexOf("list")>=0&&c.classList.remove("smart-hidden");break;case"collaborator":s.indexOf("collaborator")>=0&&c.classList.remove("smart-hidden");break;case"createdBy":case"updatedBy":case"autoNumber":case"createdTime":case"updatedTime":case"url":case"email":case"image":case"phone":case"password":case"startDate":case"dueDate":case"progress":case"checklist":case"priority":case"tags":case"name":case"description":case"assigned":case"status":case"boolean":break;case"date":{const e=t._dialogAddColumn.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;"date"===s&&c.classList.remove("smart-hidden");const a=e=>{const a=t._dialogAddColumn.querySelector('[field-filter="time"]'),i=t._dialogAddColumn.querySelector('[field-name="dateFormat"]');e?(a.classList.remove("smart-hidden"),i.style.width="50%",i.style.float="left"):(a.classList.add("smart-hidden"),i.style.width="",i.style.float="")},i=e=>{const a=t._dialogAddColumn.querySelector('[field-name="allowTimeFormat"]'),i=a.querySelector(".smart-grid-dialog-editor");e.indexOf("T")>=0?(a.classList.add("smart-hidden"),i.uncheck()):a.classList.remove("smart-hidden")},l=e=>{const a=t._dialogAddColumn.querySelector('[field-name="dateFormatSeparator"]');e?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};if("allowTimeFormat"===d){const e=r.querySelector(".smart-input").value;r.onchange=e=>{a(e)},a(e)}if("dateFormat"===d){const e=r.querySelector(".smart-input").value;r.onchange=e=>{i(e.detail.value)},i(e)}if("dateFormatSeparator"===d){const e=t._dialogAddColumn.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;l(e)}if("allowCustomDateSeparator"===d){e.indexOf("T")>=0&&e.indexOf("-")>0&&r.uncheck();const t=r.querySelector(".smart-input").value;r.onchange=e=>{l(e)},l(t)}i(e);break}}else c.classList.remove("smart-hidden")}else c.classList.add("smart-hidden");else c.classList.add("smart-hidden");else c.classList.add("smart-hidden");else c.classList.add("smart-hidden")}}_addColumnDialogInitEditors(){const e=this,t=e._dialogAddColumn.editColumn,a=e._getAddColumnDialogTemplate();for(let i in e._addColumnDialogEditors){const l=e._addColumnDialogEditors[i],n=l.querySelector("input"),o=l.querySelector("smart-input");switch(i){case"allowTimeFormat":{const e=l.querySelector(".smart-input");t&&t.editor?"dateInput"===t.editor.template?(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowCustomDateSeparator":{const a=l.querySelector(".smart-input");a.value=!1,a.removeAttribute("checked");let i=0;t&&t.cellsFormat&&(t.cellsFormat.indexOf(".")>=0?(a.value=!0,a.setAttribute("checked",""),i=2):(t.cellsFormat.indexOf("M-d-yyyy")>=0||t.cellsFormat.indexOf("d-M-yyyy")>=0||t.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(a.value=!0,a.setAttribute("checked",""),i=1));const n=e._addColumnDialogEditors.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");n.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n[i].setAttribute("checked",""),n[i].value=!0;break}case"kanban":{const t=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let a=0;a<t.length;a++)t[a].onchange=t=>{const a=[...t.parentElement.children].indexOf(t),i=t.parentElement.parentElement.previousElementSibling,l=e._dialogAddColumn.querySelector('[field-name="options"]'),n=e._dialogAddColumn.querySelector('[field-name="allowColorItems"]'),o=e._addColumnDialogEditors.name,r=()=>{const t=l.querySelector("smart-sortable");t&&(t._validate(),e._dialogAddColumn&&e._dialogAddColumn.offsetHeight&&e._dialogAddColumn.setPosition("center"))};switch(a){case 0:i.innerHTML=e.localize("kanbanNoneDescription"),n.classList.add("smart-hidden"),l.classList.add("smart-hidden"),o.querySelector("input").value=e.localize("dialogNewColumn"),r();break;case 1:i.innerHTML=e.localize("kanbanBasicDescription"),n.classList.remove("smart-hidden"),l.classList.remove("smart-hidden"),o.querySelector("input").value=e.localize("status"),r()}};break}case"dateFormat":t&&t.cellsFormat?t.cellsFormat.indexOf("M/d/yyyy")>=0?o.selectedIndex=0:t.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?o.selectedIndex=1:t.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?o.selectedIndex=2:t.cellsFormat.indexOf("d/M/yyyy")>=0?o.selectedIndex=3:t.cellsFormat.indexOf("yyyy-MM-dd")>=0?o.selectedIndex=4:t.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(o.selectedIndex=5):o.selectedIndex=0;break;case"timeFormat":t&&t.cellsFormat&&t.cellsFormat.indexOf("HH")>=0&&-1===t.cellsFormat.indexOf("T")?o.selectedIndex=1:o.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!0;t&&t.editor&&t.editor.singleSelect&&(e=!1);const a=l.querySelector(".smart-input");t?e?(a.value=!0,a.setAttribute("checked","")):(a.value=!1,a.removeAttribute("checked")):(a.value=!0,a.setAttribute("checked",""));break}case"numberFormat":if(t&&"numberInput"===t.editor.template&&t.editor.numberFormat)if("decimal"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=0;else if("decimal"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=1;else if("percent"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=2;else if("percent"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=3;else if("decimal"===t.editor.numberFormat.style&&"scientific"===t.editor.numberFormat.notation)o.selectedIndex=4;else if("decimal"===t.editor.numberFormat.style&&"engineering"===t.editor.numberFormat.notation)o.selectedIndex=5;else if("currency"===t.editor.numberFormat.style&&"accounting"===t.editor.numberFormat.currencySign)o.selectedIndex=6;else if("unit"===t.editor.numberFormat.style){o.selectedIndex=7;const a=t.editor.numberFormat.unit,i=e._addColumnDialogEditors.unit.querySelector("smart-input");i.dataSource.forEach(((e,t)=>{if(e.value===a)return i.selectedIndex=t,!0}))}else"currency"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits&&0===t.editor.numberFormat.minimumFractionDigits?o.selectedIndex=9:"currency"===t.editor.numberFormat.style&&(o.selectedIndex=8);else o.selectedIndex=0;break;case"currency":if(t&&"numberInput"===t.editor.template&&t.editor.numberFormat){if("currency"===t.editor.numberFormat.style){const a=e._getCurrencies().findIndex((e=>e.value===t.editor.numberFormat.currency));a>=0&&(o.selectedIndex=a)}}else o.selectedIndex=0;break;case"allowCheckItems":{const e=l.querySelector(".smart-input");t?t.editor&&!t.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowColorItems":{const e=l.querySelector(".smart-input");t?t.editor&&t.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowResize":case"allowSort":case"allowEdit":case"allowFilter":case"required":{const e=l.querySelector(".smart-input"),n=a.find((e=>{if(e.bind===i)return e}));t?t[i]?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,n&&void 0!==n.value&&(e.value=n.value),e.value&&e.setAttribute("checked",""));break}}if(!t||"options"!==i&&"users"!==i){const t=l.querySelector("smart-sortable");if(t&&t._init)if("users"===i){let a=[];for(let t=0;t<e.users.length;t++)a.push({color:e.users[t].color,label:e.users[t].name,id:e.users[t].id,image:e.users[t].image});t._init(a)}else t._init()}else{const e=l.querySelector("smart-sortable");if(e&&e._init)if(t.editor.singleSelect){const a=t.editor.dataSource.filter((e=>""!==e));e._init(a)}else"multiComboInput"===t.editor.template&&e._init(JSON.parse(JSON.stringify(t.editor.dataSource)))}if(t&&"type"===i?("number"===t.dataType||"int"===t.dataType?o.selectedIndex=3:"date"===t.dataType?o.selectedIndex=7:"bool"!==t.dataType&&"boolean"!==t.dataType||(o.selectedIndex=6),t.editor&&t.editor.template&&o.dataSource.forEach(((e,a)=>{switch(e.value){case"string":"input"===t.editor.template&&(o.selectedIndex=a);break;case"number":"numberInput"===t.editor.template&&(o.selectedIndex=a);break;case"select":"multiComboInput"===t.editor.template&&t.editor.singleSelect&&"tags"===t.template&&(o.selectedIndex=a);break;case"multiSelect":"multiComboInput"!==t.editor.template||t.editor.singleSelect||"tags"!==t.template||(o.selectedIndex=a);break;case"multiText":"textarea"===t.editor.template&&(o.selectedIndex=a);break;case"date":"dateInput"!==t.editor.template&&"dateTimePicker"!==t.editor.template||(o.selectedIndex=a);break;case"checkBox":"checkBox"===t.editor.template&&(o.selectedIndex=a);break;case"slider":"slider"===t.editor.template&&(o.selectedIndex=a);break;case"image":"image"===t.editor.template&&(o.selectedIndex=a);break;case"updatedTime":"updatedTime"===t.template&&(o.selectedIndex=a);break;case"createdTime":"createdTime"===t.template&&(o.selectedIndex=a);break;case"createdBy":"createdBy"===t.template&&(o.selectedIndex=a);break;case"updatedBy":"updatedBy"===t.template&&(o.selectedIndex=a);break;case"collaborator":"collaborator"===t.template&&t.editor&&t.editor.collaborator&&(o.selectedIndex=a);break;case"autoNumber":"autoNumber"===t.template&&(o.selectedIndex=a);break;case"phone":"phone"===t.template&&(o.selectedIndex=a);break;case"password":"password"===t.template&&(o.selectedIndex=a);break;case"url":"url"===t.template&&(o.selectedIndex=a);break;case"email":"email"===t.template&&(o.selectedIndex=a)}}))):"type"===i&&(o.selectedIndex=0,o.dataSource=e._getTypesList()),"cellsAlign"===i&&t&&("center"===t.cellsAlign||"middle"===t.cellsAlign?o.selectedIndex=2:"right"===t.cellsAlign&&(o.selectedIndex=1)),!n)continue;"dataField"!==i&&"type"!==i&&"timeFormat"!==i&&"dateFormat"!==i&&"numberFormat"!==i&&"currency"!==i&&"unit"!==i&&"cellsAlign"!==i&&o&&(o.selectedIndex=0),"name"===i&&(o.value=t?t.label:"",o.placeholder=a.find((e=>{if(e.bind===i)return e})).placeholder),"description"===i&&(o.value=t?t.description:"",o.placeholder=a.find((e=>{if(e.bind===i)return e})).placeholder);const r=(e,a)=>{t&&t.validationRules.forEach((t=>"minDate"===t.type&&"minDateTime"===e||"maxDate"===t.type&&"maxDateTime"===e||"min"===t.type&&"minValue"===e||"max"===t.type&&"maxValue"===e||t.type===e?(a.value=t.value,!0):void 0))};if("minValue"===i?(n.value=0,r(i,n)):"maxValue"===i?(n.value=100,r(i,n)):"minLength"===i?(n.value=0,r(i,n)):"maxLength"===i&&(n.value=500,r(i,n)),"minDateTime"===i){const e=l.querySelector("smart-date-input");e.value=new Date(1900,0,1),r(i,e)}else if("maxDateTime"===i){const e=l.querySelector("smart-date-input");e.value=new Date(2100,0,1),r(i,e)}}}_createColumnBooleanEditor(e,t,a,i,l){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const n=document.createElement("div");return n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),n.setAttribute("checked",""),n.value=!0,t.width&&(a.style.width=t.width,a.style.float="left"),!1===t.value&&(n.value=!1,n.removeAttribute("checked")),e.appendChild(n),e.getValue=function(){return n.value},e.check=function(){n.setAttribute("checked",""),n.value=!0,e.onchange&&e.onchange(n.value)},e.uncheck=function(){n.removeAttribute("checked"),n.value=!1,e.onchange&&e.onchange(n.value)},e.toggle=function(){!0!==n.value&&!1!==n.value&&null!==n.value&&(n.value=!1),null===n.value?n.value=!1:n.value=!n.value,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),e.onchange&&e.onchange(n.value)},e.onclick=l.onclick=()=>{e.toggle()},i.appendChild(a),a.classList.add("smart-grid-dialog-boolean-field"),a.appendChild(e),a.appendChild(l),e}_getColumnTemplateByType(e){switch(e){case"boolean":case"bool":return"checkBox";case"image":return"image";case"createdBy":case"updatedBy":return e;case"collaborator":case"select":case"multiSelect":return"tags";case"url":return"url";case"email":return"email";case"autoNumber":return"autoNumber";case"password":return"password";case"createdTime":return"createdTime";case"updatedTime":return"updatedTime";default:return""}}_confirmAddColumnDialog(){const e=this,t=e._dialogAddColumn,a=e._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),i=[];let l,n,o={};for(let t=0;t<a.length;t++){const i=a[t],l=i.querySelector(".smart-input"),n=i.getAttribute("bind"),r=i.parentElement;if("kanban"!==n)if("minLength"!==n&&"maxLength"!==n&&"minValue"!==n&&"maxValue"!==n&&"minDateTime"!==n&&"maxDateTime"!==n)if("options"!==n&&"users"!==n){if("allowEdit"===n&&r.classList.contains("smart-hidden"))l.value=!1;else if("required"===n&&r.classList.contains("smart-hidden"))l.value=!1;else if("dateFormatSeparator"===n){const e=i.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.dateFormatSeparatorType="/";break;case 1:o.dateFormatSeparatorType="-";break;case 2:o.dateFormatSeparatorType="."}break}}l&&(l.getSelectedItem?o[n]=l.getSelectedItem().value:o[n]=l.value)}else{const t=[],a=i.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),l=i.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<a.length;e++){const i=a[e],n={label:i.value,value:i.getAttribute("data-item-value"),id:parseInt(i.getAttribute("data-id")),color:l[e].value};n.color=l[e].value,t.push(n)}if("users"===n&&"collaborator"===o.type){e.users||(e.users=[]);for(let a=0;a<t.length;a++){const i=t[a],l=e.users.find((e=>e.id===i.id));l&&(l.name=i.label,l.color=i.color)}}o[n]=t}else o[n]=l.getValue();else{const e=i.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.kanban="blank";break;case 1:o.kanban="basic"}break}}}t.data=o;let r={},s={},d="";if(l=o.minDateTime,n=o.maxDateTime,"date"===o.type){r={template:"dateInput",min:l,max:n};let e=!1;"-"!==o.dateFormat&&(d=o.dateFormat,o.allowCustomDateSeparator&&(d.indexOf("/")>=0?d=d.replaceAll("/",o.dateFormatSeparatorType):d.indexOf("-")>=0?d=d.replaceAll("-",o.dateFormatSeparatorType):d.indexOf(".")>=0&&(d=d.replaceAll(".",o.dateFormatSeparatorType))),o.dateFormat.indexOf("T")>=0&&(r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),e=!0),r.autoOpen=!0,o.allowTimeFormat&&"-"!==o.timeFormat&&(e&&(d+=" "),d+=o.timeFormat,r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),i.push({type:"minDate",value:l}),i.push({type:"maxDate",value:n})}else if("number"===o.type||"slider"===o.type){l=parseInt(o.minValue),n=parseInt(o.maxValue),o.numberFormat=JSON.parse(JSON.stringify(o.numberFormat)),"unit"===o.numberFormat.style&&(o.numberFormat.unit=o.unit);let t=null,a=null;"currency"===o.numberFormat.style&&(o.numberFormat.currency=o.currency,o.numberFormat.locale=e._getLocaleByCurrency(o.currency)),r={template:"number"===o.type?"numberInput":"slider",min:l,max:n,numberFormat:o.numberFormat},s={Intl:{NumberFormat:o.numberFormat}},a&&(s=a),d="d",t&&(d=t),i.push({type:"min",value:l}),i.push({type:"max",value:n})}else if("boolean"===o.type)r={template:"checkBox"};else if("image"===o.type)r={template:"image"};else if("select"===o.type||"multiSelect"===o.type){let e=o.options;if("select"===o.type)if(t.editColumn&&!t.editColumn.editor.allowEmptyItem)e=o.options;else{let t=!1;for(let e=0;e<o.options.length;e++)if(""===o.options[e].label){t=!0,o.options[e].value="";break}e=t?o.options:[""].concat(o.options)}r={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:o.allowColorItems,autoOpen:!0,pills:!0,singleSelect:"select"===o.type,dataSource:e}}else if("collaborator"===o.type){let t=o.users;o.allowMultipleCollaborators||(t=[""].concat(o.users));for(let a=0;a<e.users.length;a++)t.forEach((t=>{t.value===e.users[a].id&&(t.image=e.users[a].image,t.id=e.users[a].id)}));r={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:o.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!o.allowMultipleCollaborators,dataSource:t}}else"multiText"===o.type?(l=o.minLength,n=o.maxLength,r={template:"textarea",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n})):"password"===o.type?(l=o.minLength,n=o.maxLength,r={template:"password",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n})):"phone"===o.type?r={template:"phone",required:o.required}:(l=o.minLength,n=o.maxLength,r={template:"input",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n}));let c="string";switch(o.type){case"boolean":case"bool":c="boolean";break;case"createdTime":case"updatedTime":case"date":c="date";break;case"autoNumber":case"slider":case"number":c="number"}if(e._dialogAddColumn.editColumn){const t=e._dialogAddColumn.editColumn;t.canNotify=!1,t.label=o.name,t.description=o.description,t.showDescriptionButton=!0,t.allowResize=o.allowResize,t.allowSort=o.allowSort,t.allowFilter=o.allowFilter,t.allowEdit=o.allowEdit,t.align=t.cellsAlign=o.cellsAlign,t.cellsFormat=d;const a=t._editorId?t._editorId:"",l=r.template+"_"+t.dataField+a;e._cellEditors[l]&&delete e._cellEditors[l];let n=!0;"list"!==t.template&&"dropDownList"!==t.template||(n=!1),"autoNumber"!==t.template&&"createdBy"!==t.template&&"updatedBy"!==t.template&&"createdTime"!==t.template&&"updatedTime"!==t.template||(n=!1),t.editor&&t.editor.template.indexOf("custom")>=0&&(n=!1),t.editor&&t.editor.disabledDialogOptions&&(n=!1),n&&(t.editor=JSON.parse(JSON.stringify(r)),t.template=e._getColumnTemplateByType(o.type),t._cellsCachedValues=[]),t.formatSettings=s,t._isDirty=!0,o.required&&i.push({type:"required"}),t.validationRules=i,t._state&&["label","description","showDescriptionButton","dataType","editor","formatSettings","template","summary","validationRules","allowResize","allowSort","allowFilter","allowEdit","align","cellsAlign","cellsFormat"].forEach((e=>{t._state[e]=t[e]})),t.canNotify=!0,e.$.fireEvent("closeColumnDialog",{dataField:t.dataField}),e.onColumnUpdated&&e.onColumnUpdated(e.columns.indexOf(t),t),e._onColumnUpdated&&e._onColumnUpdated(t,o),e._recycle(!0),t.refresh(),t._isDirty=!1}else{let t=[];"number"===c&&(t=["sum"]);const a=e._getColumnLabel(o),l=new Smart.Grid.Column({label:a,description:o.description,dataField:o.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:o.allowResize,allowSort:o.allowSort,allowFilter:o.allowFilter,allowEdit:o.allowEdit,showDescriptionButton:!0,dataType:c,editor:r,summary:t,template:e._getColumnTemplateByType(o.type),formatSettings:s,cellsAlign:o.cellsAlign,align:o.cellsAlign,cellsFormat:d,visibleIndex:e.columns.length-1,grid:e});if("autoNumber"===l.template&&(l.autoGenerated=!0,t=[]),o.required&&(i.push({type:"required"}),l.validationRules=i),e._getKanbanFields().indexOf(o.type)>=0){const t=e._getKanbanTaskField(o.type);o.description&&(t.description=o.description),o.name&&(t.label=o.name),t.allowFilter=o.allowFilter,t.allowResize=o.allowResize,t.allowSort=o.allowSort;const a=e.columnByDataField[t.dataField];a&&!1===a._visible?(a.visible=!0,delete a._visible):(a&&(t.dataField=t.displayField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),"object"==typeof t.editor&&t.editor.dataSource&&(t.editor.dataSource=JSON.parse(JSON.stringify(t.editor.dataSource))),t.label=t.label+" "+e.localize("copy")),e.columns.push(t))}else e.columns.push(l);e._refreshHeaderBar(),e.$.fireEvent("closeColumnDialog",{dataField:l.dataField})}}_getColumnLabel(e){const t=this;let a=e.name;if(!a){let a="";switch(e.type){case"string":a=t.localize("dialogAddColumnTypeText");break;case"multiText":a=t.localize("dialogAddColumnTypeMultilineText");break;case"image":a=t.localize("dialogAddColumnTypeImage");break;case"number":a=t.localize("dialogAddColumnTypeNumber");break;case"select":a=t.localize("dialogAddColumnTypeSelect");break;case"multiSelect":a=t.localize("dialogAddColumnTypeMultipleSelect");break;case"boolean":a=t.localize("dialogAddColumnTypeCheckBox");break;case"date":a=t.localize("dialogAddColumnTypeDate");break;case"createdTime":a=t.localize("dialogAddColumnTypeCreatedTime");break;case"updatedTime":a=t.localize("dialogAddColumnTypeLastUpdatedTime");break;case"createdBy":a=t.localize("dialogAddColumnTypeCreatedBy");break;case"updatedBy":a=t.localize("dialogAddColumnTypeLastUpdatedBy");break;case"collaborator":a=t.localize("dialogAddColumnTypeCollaborator");break;case"slider":a=t.localize("dialogAddColumnTypeSlider");break;case"autoNumber":a=t.localize("dialogAddColumnTypeAutoNumber");break;case"url":a=t.localize("dialogAddColumnTypeURL");break;case"email":a=t.localize("dialogAddColumnTypeEmail");break;case"phone":a=t.localize("dialogAddColumnTypePhone");break;case"password":a=t.localize("dialogAddColumnTypePassword")}let i=1;for(let e=0;e<t.columns.length;e++)t.columns[e].label.indexOf(a)>=0&&i++;return 1===i?a:a+" "+i}return a}_openAddColumnDialog(e,t,a){const i=this,l=i._dialogAddColumn||i._createDialog(i.editing.addColumnDialog),n=e?i.localize("dialogEditColumn",{value:e.label}):i.localize("dialogAddColumn"),o=l.querySelector(".smart-footer").querySelector(".smart-stack-layout");l.classList.add("smart-grid-dialog-add-column"),l.type=e?"customize":"add",l.editColumn=e||null,e&&e.element&&e.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),i._cellEditors||(i._cellEditors=[]);const r=i._getAddColumnDialogTemplate();if(l.header.innerHTML=n,l.header.parentElement.classList.add("smart-hidden"),l.callback=a,!0===t&&(l.header.parentElement.classList.remove("smart-hidden"),"kanban"===i.view?(l.header.innerHTML=i.localize("dialogAddColumnStatus"),l.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),l.classList.add("view")):l.classList.remove("kanban")),l.stackLabel&&l.stackLabel.classList.add("smart-hidden"),"kanban"===i.view?l.btnCancel.classList.add("smart-hidden"):l.btnCancel.classList.remove("smart-hidden"),i.cancelEdit(),!i._dialogAddColumn){l.modal=!0,l.btnConfirm.innerHTML=i.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=i.localize("dialogEditButtonCancel"),l.onOpen=function(){i._addColumnDialogInitEditors(),i._addColumnDialogShowHideEditors(l.editColumn),i.$.fireEvent("openColumnDialog",{dataField:l.editColumn?l.editColumn.dataField:null});const e=i.offset(l),t=i.offset(i);if(e.top+l.offsetHeight>window.innerHeight-t.top){const a=e.top+l.offsetHeight-window.innerHeight+t.top;l.style.maxHeight=Math.max(250,l.offsetHeight-a)+"px",l.style.minHeight="250px"}else l.style.maxHeight="",l.style.minHeight=""},l.onClose=function(){l.editColumn&&l.editColumn.element&&l.editColumn.element.removeAttribute("focus"),l.classList.remove("view"),l.callback&&l.callback(l.result)},l.btnCancel.onclick=function(){l.result=!1,l.close()},l.btnClose.onclick=function(){l.result=!1,l.close()},l.btnConfirm.onclick=function(){i._confirmAddColumnDialog(),l.result=!0,l.close()},l.onkeydown=function(e){"Escape"===e.key&&"kanban"!==i.view&&(l.result=!1,l.close())},i._dialogAddColumn=l;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),l.content.appendChild(e),i._addColumnDialogEditors=[];for(let t=0;t<r.length;t++){const a=r[t],n=document.createElement("div"),o=document.createElement("label");o.innerHTML=a.label;const s=document.createElement("div");if(s.classList.add("smart-grid-dialog-editor","add-column"),s.innerHTML="",s.setAttribute("filter",a.filter),s.setAttribute("bind",a.bind),n.setAttribute("field-name",a.bind),n.setAttribute("field-filter",a.filter),i._addColumnDialogEditors[a.bind]=s,"type"===a.bind&&s.addEventListener("change",(()=>{i._addColumnDialogShowHideEditors(l.editColumn);const e=i._dialogAddColumn.querySelector('[bind="type"]'),t=e.querySelector("smart-input"),a=t.getSelectedItem().value;let n="smart-icon-font";switch(a){case"multiText":n="smart-icon-fontsize";break;case"image":n="smart-icon-image";break;case"number":case"progress":n="smart-icon-number";break;case"priority":case"status":case"select":n="smart-icon-sort-down";break;case"multiSelect":n="smart-icon-list-unordered";break;case"boolean":n="smart-icon-check-squared";break;case"date":case"startDate":case"dueDate":n="smart-icon-calendar";break;case"createdTime":case"updatedTime":n="smart-icon-clock";break;case"createdBy":case"updatedBy":case"collaborator":n="smart-icon-user";break;case"slider":n="smart-icon-number";break;case"autoNumber":case"checklist":n="smart-icon-list-ordered";break;case"url":n="smart-icon-link";break;case"email":n="smart-icon-mail";break;case"password":n="smart-icon-lock";break;case"phone":n="smart-icon-phone";break;case"name":n="smart-icon-font";break;case"description":n="smart-icon-fontsize";break;case"tags":n="smart-icon-font";break;case"color":n="smart-icon-color-background";break;case"assigned":n="smart-icon-user"}if(i._addColumnDialogEditors.type.icon=n,i._addColumnDialogEditors.name.querySelector("input").setAttribute("data-label",t.value),e.firstElementChild.className="smart-grid-icon show smart-description-button "+n,"select"===a||"multiSelect"===a){const e=i._addColumnDialogEditors.options.querySelector("smart-sortable");e&&e._validate&&e._validate()}else l.btnConfirm.disabled=!1})),"boolean"===a.type)i._createColumnBooleanEditor(s,a,n,e,o);else{if("label"===a.type){e.appendChild(n),n.classList.add("smart-grid-dialog-field"),n.appendChild(o);const t=document.createElement("div");t.style.height="10px",n.appendChild(t);continue}{let d=document.createElement("smart-input");if(d.classList.add("underlined","edit-column-input"),d.style.width="100%",d.style.height="30px",a.width&&(n.style.width=a.width,n.style.float="left"),"items"===a.type){const e=document.createElement("smart-button");e.classList.add("primary"),e.innerHTML='<div style="align-items: center; white-space: nowrap; display: flex;"><span class="smart-grid-icon show smart-icon-plus"></span><span>'+i.localize("commandBarAddRow")+"</span></div>";const t=document.createElement("div");t.classList.add("smart-grid-add-column-dialog-color-panel");const n=document.createElement("smart-sortable");n.disableMode="manual",n.dragMode="handle",n.handleVisibility="visible",n.handlePosition="left";const o=()=>{if(l.btnConfirm.disabled=!1,0===t.offsetHeight)return;let e=0;t.querySelectorAll(".edit-column-input").forEach((t=>{""===t.value&&e++,e>1&&(l.btnConfirm.disabled=!0)}))},r=(t,l,r,s)=>{const d=document.createElement("div"),c=i._getColorInput(),m=document.createElement("div"),u=document.createElement("smart-input"),b=i._addColumnDialogEditors.allowColorItems;if(void 0!==r)u.setAttribute("data-id",r),u.setAttribute("data-item-value",r);else{const e=n.querySelectorAll(".smart-sortable-item").length;u.setAttribute("data-id",e),u.setAttribute("data-item-value",e)}return void 0!==s&&u.setAttribute("data-item-value",s),c.disabled=!b.querySelector(".smart-input").value,m.className="smart-grid-icon smart-icon-close show",m.setAttribute("role","button"),m.setAttribute("aria-label","button"),u.classList.add("underlined","edit-column-input"),u.style.width="100%",u.style.height="30px",u.required=!0,t&&(u.value=t),l&&(c.value=l),u.onkeyup=u.onchange=u.onblur=t=>{o(),"Enter"===t.key&&(u.parentElement.nextElementSibling||(e.click(),o()))},d.appendChild(c),d.appendChild(u),"users"!==a.bind&&d.appendChild(m),m.onclick=()=>{d.remove(),n.updateItems(),o()},d.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),d};n._init=e=>{n.clearContent(),e&&(e.forEach(((e,t)=>{const a=void 0!==e.id?e.id:t,i=r(e.label,e.color,a,e.value);n.$.container.appendChild(i)})),n.updateItems())},n._validate=o,i._addColumnDialogEditors.allowColorItems.onchange=e=>{let t=i._addColumnDialogEditors.allowColorItems.parentElement.nextElementSibling,a=null;for(;t;){if("options"===t.getAttribute("field-name")){a=t;break}t=t.nextElementSibling}a&&a.querySelectorAll("smart-color-input").forEach((t=>{t.disabled=!e}))},t.appendChild(n),"users"!==a.bind&&(t.appendChild(e),e.onclick=()=>{const e=r();n.$.container.appendChild(e),n.updateItems(),e.querySelector(".edit-column-input").focus(),l.btnConfirm.disabled=!0}),d=t,s.style.height="auto"}else if("number"===a.type)d=document.createElement("smart-number-input"),d.classList.add("underlined"),d.style.width="100%",d.style.height="30px","minValue"===a.bind?(d.value=0,d.min=-9999999,d.max=9999999):"maxValue"===a.bind?(d.value=1e6,d.min=-9999999,d.max=9999999):"minLength"===a.bind?d.value=0:"maxLength"===a.bind&&(d.value=500);else if("datetime"===a.type)d=document.createElement("smart-date-input"),d.classList.add("underlined"),d.style.width="100%",d.style.height="30px","minDateTime"===a.bind?d.value=new Date(1900,0,1):"maxDateTime"===a.bind&&(d.value=new Date(2100,0,1));else if("radio"===a.type){const e=(e,t,a)=>{const i=document.createElement("div"),l=document.createElement("label"),n=document.createElement("div");return l.innerHTML=e,n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),t&&n.setAttribute("checked",""),n.value=void 0!==t&&t,s.appendChild(n),i.onclick=function(){if(n.value=!0,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),i.onchange&&i.onchange(i),n.value){const e=n.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n.value=!0,n.setAttribute("checked",n.value?"":"indeterminate"),e.value=a}},i.appendChild(n),i.appendChild(l),i.classList.add("smart-grid-dialog-boolean-field"),i.setAttribute("template","checkBox"),i.setAttribute("editor",""),i},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),s.classList.add("radio-group");for(let i=0;i<a.options.length;i++){const l=a.options[i],n=e(l.label,l.checked);if(a.columns){const e=100/a.columns;n.style.width=e+"%",n.style.float="left"}t.appendChild(n),l.checked&&(s.value=l.value)}const i=document.createElement("div");i.style.clear="both",t.appendChild(i),d=t}if(a.options){d.readonly=!0;let e=a.options;"type"===a.bind&&(void 0!==i.currentUser&&null!==i.currentUser||(e=e.filter((e=>"updatedBy"!==e.value&&"createdBy"!==e.value))),(void 0===i.users||null===i.users||i.users&&0===i.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),d.dataSource=e,d.dropDownButtonPosition="right","dataField"!==a.bind&&(d.selectedIndex=0),a.options.length<15?d.dropDownHeight="auto":d.dropDownHeight=300}if(a.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",a.icon,"show","smart-description-button"),s.appendChild(e),d.style.width="calc(100% - 25px)"}if(s.appendChild(d),a.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=a.info,s.appendChild(e),d.style.width="calc(100% - 25px)"}if(e.appendChild(n),n.classList.add("smart-grid-dialog-field"),n.appendChild(o),n.appendChild(s),a.width&&!r[t+1].width){const t=document.createElement("div");t.style.clear="both",e.appendChild(t)}}}}}const s=()=>{const t=parseInt(l.style.width),a=i.offset(i);if(window.screen.availWidth<400)return l.open("left","top"),l.style.width=i.offsetWidth+"px",void(l.style.height=i.offsetHeight+"px");{const e=i.editing.addColumnDialog;l.style.width="auto"===e.width?e.width:e.width+"px",l.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const n=e.element;if(n){const e=i.offset(n),o=e.left-a.left,r=a.left,s=Math.max(r,o);if(s+t+n.offsetWidth>a.left+i.offsetWidth){const i=s-t+n.offsetWidth;i<0?l.open("center",e.top+n.offsetHeight-a.top):l.open(Math.max(r,i),e.top+n.offsetHeight-a.top)}else l.open(s,e.top+n.offsetHeight-a.top)}else l.classList.add("center"),l.open("center","center")}else if(i._addNewColumn){let e=i._addNewColumn.element,n=i.offset(e),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o);i.editing.addNewColumn._addButton&&i.editing.addNewColumn._addButton.classList.contains("show")&&(e=i.editing.addNewColumn._addButton,n=i.offset(i.editing.addNewColumn._addButton),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o)),l.open(s,n.top+e.offsetHeight-a.top)}else l.open("center","center"),l.classList.add("center")};s(),l.refresh=()=>{s()}}_getLocaleByCurrency(e){const t={AED:"ar_AE",AFN:"fa_AF",ALL:"sq",AMD:"hy",ANG:"nl",AOA:"pt_AO",ARS:"es_AR",AUD:"en",AWG:"nl_AW",AZN:"az",BAM:"bs",BBD:"en_BB",BDT:"bn_BD",BGN:"bg",BHD:"ar_BH",BIF:"fr_BI",BMD:"en_BM",BND:"ms_BN",BOB:"es_BO",BRL:"pt_BR",BSD:"en_BS",BTN:"dz",BWP:"en_BW",BYN:"be",BYR:"be",BZD:"en_BZ",CAD:"en_CA",CDF:"fr_CD",CHF:"de_CH",CLP:"es_CL",CNY:"zh_Hans_CN",COP:"es_CO",CRC:"es_CR",CUP:"es_CU",CVE:"pt_CV",CZK:"cs",DJF:"fr_DJ",DKK:"da_DK",DOP:"es_DO",DZD:"ar_DZ",EGP:"ar_EG",ERN:"ti_ER",ETB:"am",EUR:"de",FJD:"en_FJ",FKP:"en_FK",GBP:"en",GEL:"ka",GHS:"en_GH",GIP:"en_GI",GMD:"en_GM",GNF:"fr_GN",GTQ:"es_GT",GYD:"en_GY",HKD:"zh_Hans_HK",HNL:"es_HN",HRK:"hr_HR",HTG:"en",HUF:"hu_HU",IDR:"id",ILS:"he",INR:"en_IN",IQD:"ar_IQ",IRR:"fa_IR",ISK:"is",JMD:"en_JM",JOD:"ar_JO",JPY:"ja",KES:"en_KE",KGS:"ky",KHR:"km",KMF:"ar",KPW:"ko_KP",KRW:"ko_KR",KWD:"ar_KW",KYD:"en_KY",KZT:"kk",LAK:"lo",LBP:"ar_LB",LKR:"si",LRD:"en_LR",LSL:"en_LS",LYD:"ar_LY",MAD:"ar",MDL:"ro",MGA:"fr_MG",MKD:"mk",MMK:"my",MNT:"mn",MOP:"zh",MRO:"ar_MR",MRU:"ar_MR",MUR:"en_MU",MVR:"en",MWK:"en",MXN:"es_MX",MYR:"ms_MY",MZN:"pt_MZ",NAD:"en_NA",NGN:"en_NG",NIO:"es_NI",NOK:"nb_NO",NPR:"ne",NZD:"en_NZ",OMR:"ar_OM",PAB:"es_PA",PEN:"es_PE",PGK:"en_PG",PHP:"fil",PKR:"ur_PK",PLN:"pl",PYG:"es_PY",QAR:"ar_QA",RON:"ro",RSD:"sr",RUB:"ru",RWF:"rw",SAR:"ar_SA",SBD:"en_SB",SCR:"en_SC",SDG:"ar_SD",SEK:"sv_SE",SGD:"en_SG",SHP:"en_SH",SLL:"en_SL",SOS:"so_SO",SRD:"nl_SR",SSP:"en",STD:"pt_ST",STN:"pt_ST",SYP:"ar_SY",SZL:"en_SZ",THB:"th",TJS:"en",TMT:"tk",TND:"ar_TN",TOP:"to",TRY:"tr_TR",TTD:"en_TT",TWD:"zh_Hant_TW",TZS:"sw_TZ",UAH:"uk",UGX:"en_UG",USD:"en_US",UYU:"es_UY",UZS:"uz",VEF:"es_VE",VND:"vi",VUV:"en_BI",WST:"en_AS",XAF:"fr",XCD:"en",XOF:"fr",XPF:"fr_PF",YER:"ar_YE",ZAR:"zu",ZMW:"en_ZM",ZWL:"en_ZW"};return t[e]?t[e].replace("_","-"):"en-US"}_getCurrencies(){return[{currency:"US Dollar",sign:"$",abbreviation:"USD"},{currency:"Afghan Afghani",sign:"Af.",abbreviation:"AFN"},{currency:"Albanian Lek",sign:"Lek",abbreviation:"ALL"},{currency:"Algerian Dinar",sign:"din",abbreviation:"DZD"},{currency:"Angolan Kwanza",sign:"Kz",abbreviation:"AOA"},{currency:"Argentine Peso",sign:"$",abbreviation:"ARS"},{currency:"Armenian Dram",sign:"Dram",abbreviation:"AMD"},{currency:"Aruban Florin",sign:"Afl.",abbreviation:"AWG"},{currency:"Australian Dollar",sign:"$",abbreviation:"AUD"},{currency:"Azerbaijani Manat",sign:"₼",abbreviation:"AZN"},{currency:"Bahamian Dollar",sign:"$",abbreviation:"BSD"},{currency:"Bahraini Dinar",sign:"din",abbreviation:"BHD"},{currency:"Bangladeshi Taka",sign:"৳",abbreviation:"BDT"},{currency:"Barbadian Dollar",sign:"$",abbreviation:"BBD"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYN"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYR"},{currency:"Belize Dollar",sign:"$",abbreviation:"BZD"},{currency:"Bermudan Dollar",sign:"$",abbreviation:"BMD"},{currency:"Bhutanese Ngultrum",sign:"Nu.",abbreviation:"BTN"},{currency:"Bolivian Boliviano",sign:"Bs",abbreviation:"BOB"},{currency:"Bosnia-Herzegovina Convertible Mark",sign:"KM",abbreviation:"BAM"},{currency:"Botswanan Pula",sign:"P",abbreviation:"BWP"},{currency:"Brazilian Real",sign:"R$",abbreviation:"BRL"},{currency:"British Pound Sterling",sign:"£",abbreviation:"GBP"},{currency:"Brunei Dollar",sign:"$",abbreviation:"BND"},{currency:"Bulgarian Lev",sign:"лв.",abbreviation:"BGN"},{currency:"Burundian Franc",sign:"FBu",abbreviation:"BIF"},{currency:"Cambodian Riel",sign:"Riel",abbreviation:"KHR"},{currency:"Canadian Dollar",sign:"$",abbreviation:"CAD"},{currency:"Cape Verdean Escudo",sign:"CVE",abbreviation:"CVE"},{currency:"Cayman Islands Dollar",sign:"$",abbreviation:"KYD"},{currency:"CFA Franc BCEAO",sign:"CFA",abbreviation:"XOF"},{currency:"CFA Franc BEAC",sign:"FCFA",abbreviation:"XAF"},{currency:"CFP Franc",sign:"FCFP",abbreviation:"XPF"},{currency:"Chilean Peso",sign:"$",abbreviation:"CLP"},{currency:"Chinese Yuan",sign:"¥",abbreviation:"CNY"},{currency:"Chinese Yuan (offshore)",sign:"¥",abbreviation:"RMB"},{currency:"Colombian Peso",sign:"$",abbreviation:"COP"},{currency:"Comorian Franc",sign:"CF",abbreviation:"KMF"},{currency:"Congolese Franc",sign:"FrCD",abbreviation:"CDF"},{currency:"Costa Rican Colon",sign:"₡",abbreviation:"CRC"},{currency:"Croatian Kuna",sign:"kn",abbreviation:"HRK"},{currency:"Cuban Convertible Peso",sign:"$",abbreviation:"CUC"},{currency:"Cuban Peso",sign:"$",abbreviation:"CUP"},{currency:"Czech Republic Koruna",sign:"Kč",abbreviation:"CZK"},{currency:"Danish Krone",sign:"kr.",abbreviation:"DKK"},{currency:"Djiboutian Franc",sign:"Fdj",abbreviation:"DJF"},{currency:"Dominican Peso",sign:"RD$",abbreviation:"DOP"},{currency:"East Caribbean Dollar",sign:"$",abbreviation:"XCD"},{currency:"Egyptian Pound",sign:"£",abbreviation:"EGP"},{currency:"Eritrean Nakfa",sign:"Nfk",abbreviation:"ERN"},{currency:"Ethiopian Birr",sign:"Birr",abbreviation:"ETB"},{currency:"Euro",sign:"€",abbreviation:"EUR"},{currency:"Falkland Islands Pound",sign:"£",abbreviation:"FKP"},{currency:"Fijian Dollar",sign:"$",abbreviation:"FJD"},{currency:"Gambian Dalasi",sign:"GMD",abbreviation:"GMD"},{currency:"Georgian Lari",sign:"GEL",abbreviation:"GEL"},{currency:"Ghanaian Cedi",sign:"GHS",abbreviation:"GHS"},{currency:"Gibraltar Pound",sign:"£",abbreviation:"GIP"},{currency:"Guatemalan Quetzal",sign:"Q",abbreviation:"GTQ"},{currency:"Guinean Franc",sign:"FG",abbreviation:"GNF"},{currency:"Guyanaese Dollar",sign:"$",abbreviation:"GYD"},{currency:"Haitian Gourde",sign:"HTG",abbreviation:"HTG"},{currency:"Honduran Lempira",sign:"L",abbreviation:"HNL"},{currency:"Hong Kong Dollar",sign:"$",abbreviation:"HKD"},{currency:"Hungarian Forint",sign:"Ft",abbreviation:"HUF"},{currency:"Icelandic Krona",sign:"kr",abbreviation:"ISK"},{currency:"Indian Rupee",sign:"₹",abbreviation:"INR"},{currency:"Indonesian Rupiah",sign:"Rp",abbreviation:"IDR"},{currency:"Iranian Rial",sign:"Rial",abbreviation:"IRR"},{currency:"Iraqi Dinar",sign:"din",abbreviation:""},{currency:"Israeli New Sheqel",sign:" ₪",abbreviation:"ILS"},{currency:"Jamaican Dollar",sign:"$",abbreviation:"JMD"},{currency:"Japanese Yen",sign:"¥",abbreviation:"JPY"},{currency:"Jordanian Dinar",sign:"din",abbreviation:"JOD"},{currency:"Kazakhstani Tenge",sign:"₸",abbreviation:"KZT"},{currency:"Kenyan Shilling",sign:"Ksh",abbreviation:"KES"},{currency:"Kuwaiti Dinar",sign:"din",abbreviation:"KWD"},{currency:"Kyrgystani Som",sign:"KGS",abbreviation:"KGS"},{currency:"Laotian Kip",sign:"₭",abbreviation:"LAK"},{currency:"Lebanese Pound",sign:"L£",abbreviation:"LBP"},{currency:"Lesotho Loti",sign:"LSL",abbreviation:"LSL"},{currency:"Liberian Dollar",sign:"$",abbreviation:"LRD"},{currency:"Libyan Dinar",sign:"din",abbreviation:"LYD"},{currency:"Lithuanian Litas",sign:"Lt",abbreviation:"LTL"},{currency:"Macanese Pataca",sign:"MOP",abbreviation:"MOP"},{currency:"Macedonian Denar",sign:"din",abbreviation:"MKD"},{currency:"Malagasy Ariary",sign:"Ar",abbreviation:"MGA"},{currency:"Malawian Kwacha",sign:"MWK",abbreviation:"MWK"},{currency:"Malaysian Ringgit",sign:"RM",abbreviation:"MYR"},{currency:"Maldivian Rufiyaa",sign:"Rf",abbreviation:"MVR"},{currency:"Mauritanian Ouguiya",sign:"MRO",abbreviation:"MRO"},{currency:"Mauritian Rupee",sign:"MURs",abbreviation:"MUR"},{currency:"Mexican Peso",sign:"$",abbreviation:"MXN"},{currency:"Moldovan Leu",sign:"MDL",abbreviation:"MDL"},{currency:"Mongolian Tugrik",sign:"₮",abbreviation:"MNT"},{currency:"Moroccan Dirham",sign:"dh",abbreviation:"MAD"},{currency:"Mozambican Metical",sign:"MTn",abbreviation:"MZN"},{currency:"Myanma Kyat",sign:"K",abbreviation:"MMK"},{currency:"Namibian Dollar",sign:"$",abbreviation:"NAD"},{currency:"Nepalese Rupee",sign:"Rs",abbreviation:"NPR"},{currency:"Netherlands Antillean Guilder",sign:"NAf.",abbreviation:"ANG"},{currency:"New Taiwan Dollar",sign:"NT$",abbreviation:"TWD"},{currency:"New Zealand Dollar",sign:"$",abbreviation:"NZD"},{currency:"Nicaraguan Cordoba",sign:"C$",abbreviation:"NIO"},{currency:"Nigerian Naira",sign:"₦",abbreviation:"NGN"},{currency:"North Korean Won",sign:"₩KP",abbreviation:"KPW"},{currency:"Norwegian Krone",sign:"kr",abbreviation:"NOK"},{currency:"Omani Rial",sign:"Rial",abbreviation:"OMR"},{currency:"Pakistani Rupee",sign:"Rs",abbreviation:"PKR"},{currency:"Panamanian Balboa",sign:"B/.",abbreviation:"PAB"},{currency:"Papua New Guinean Kina",sign:"PGK",abbreviation:"PGK"},{currency:"Paraguayan Guarani",sign:"Gs.",abbreviation:"PYG"},{currency:"Peruvian Nuevo Sol",sign:"S/.",abbreviation:"PEN"},{currency:"Philippine Peso",sign:"₱",abbreviation:"PHP"},{currency:"Polish Zloty",sign:"zł",abbreviation:"PLN"},{currency:"Qatari Rial",sign:"Rial",abbreviation:"QAR"},{currency:"Romanian Leu",sign:"RON",abbreviation:"RON"},{currency:"Russian Ruble",sign:"₽",abbreviation:"RUB"},{currency:"Rwandan Franc",sign:"RF",abbreviation:"RWF"},{currency:"Saint Helena Pound",sign:"£",abbreviation:"SHP"},{currency:"Samoan Tala",sign:"WST",abbreviation:"WST"},{currency:"Sao Tomean Dobra",sign:"Db",abbreviation:"STD"},{currency:"Saudi Riyal",sign:"Rial",abbreviation:"SAR"},{currency:"Serbian Dinar",sign:"din",abbreviation:"RSD"},{currency:"Seychellois Rupee",sign:"SCR",abbreviation:"SCR"},{currency:"Sierra Leonean Leone",sign:"SLL",abbreviation:"SLL"},{currency:"Singapore Dollar",sign:"$",abbreviation:"SGD"},{currency:"Solomon Islands Dollar",sign:"$",abbreviation:"SBD"},{currency:"Somali Shilling",sign:"SOS",abbreviation:"SOS"},{currency:"South African Rand",sign:"R",abbreviation:"ZAR"},{currency:"South Korean Won",sign:"₩",abbreviation:"KRW"},{currency:"South Sudanese Pound",sign:"£",abbreviation:"SSP"},{currency:"Sri Lankan Rupee",sign:"Rs",abbreviation:"LKR"},{currency:"Sudanese Pound",sign:"SDG",abbreviation:"SDG"},{currency:"Surinamese Dollar",sign:"$",abbreviation:"SRD"},{currency:"Swazi Lilangeni",sign:"SZL",abbreviation:"SZL"},{currency:"Swedish Krona",sign:"kr",abbreviation:"SEK"},{currency:"Swiss Franc",sign:"CHF",abbreviation:"CHF"},{currency:"Syrian Pound",sign:"£",abbreviation:"SYP"},{currency:"Tajikistani Somoni",sign:"Som",abbreviation:"TJS"},{currency:"Tanzanian Shilling",sign:"TSh",abbreviation:"TZS"},{currency:"Thai Baht",sign:"฿",abbreviation:"THB"},{currency:"Tongan Pa'anga",sign:"T$",abbreviation:"TOP"},{currency:"Trinidad and Tobago Dollar",sign:"$",abbreviation:"TTD"},{currency:"Tunisian Dinar",sign:"din",abbreviation:"TND"},{currency:"Turkish Lira",sign:"₺",abbreviation:"TRY"},{currency:"Turkmenistani Manat",sign:"m",abbreviation:"TMT"},{currency:"Ugandan Shilling",sign:"UGX",abbreviation:"UGX"},{currency:"Ukrainian Hryvnia",sign:"грн.",abbreviation:"UAH"},{currency:"United Arab Emirates Dirham",sign:"dh",abbreviation:"AED"},{currency:"Uruguayan Peso",sign:"$",abbreviation:"UYU"},{currency:"Uzbekistan Som",sign:"soʼm",abbreviation:"UZS"},{currency:"Vanuatu Vatu",sign:"VUV",abbreviation:"VUV"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VEF"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VES"},{currency:"Vietnamese Dong",sign:"₫",abbreviation:"VND"},{currency:"Yemeni Rial",sign:"Rial",abbreviation:"YER"},{currency:"Zambian Kwacha",sign:"ZMW",abbreviation:"ZMW"},{currency:"Zimbabwean Dollar",sign:"$",abbreviation:"ZWD"}].map((e=>(e.label=e.currency,e.menuLabel='<div style="display: flex; justify-content: space-between;"><span>'+e.currency+'</span><span style="opacity: 0.7;">'+e.sign+" 1,000.00</span></div>",e.value=e.abbreviation,e)))}});
|
|
1450
1450
|
|
|
1451
1451
|
/***/ }),
|
|
1452
1452
|
|
|
1453
1453
|
/***/ 7422:
|
|
1454
1454
|
/***/ (() => {
|
|
1455
1455
|
|
|
1456
|
-
(()=>{Smart.Utilities.Assign("Grid.Edit",class{_renderCommandBar(){const e=this,t=e.editing.commandBar.dataSource,i="icon"!==e.editing.commandBar.displayMode,n="label"!==e.editing.commandBar.displayMode,o=o=>{for(let l in t){const a=t[l],d=document.createElement("div");d.classList.add("smart-grid-command-item"),d.label=e.localize(l);const r=d.label;let s="";n&&i?(s+='<span class="smart-grid-icon '+a.icon+'"></span>',s+='<span class="smart-grid-label">'+r+"</span>"):n&&!i?s+='<span title="'+r+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(s+='<span class="smart-grid-label">'+r+"</span>"),d.innerHTML=s,a.visible||d.classList.add("smart-hidden"),d.command=a.command,d.onclick=function(){const t=d.command;e._applyCommand(t,[])},o.appendChild(d)}};e.editing.enabled&&e.editing.commandBar.visible&&(e.$.headerCommandBar.innerHTML="",e.$.footerCommandBar.innerHTML="","far"!==e.editing.commandBar.position&&o(e.$.headerCommandBar),"near"!==e.editing.commandBar.position&&o(e.$.footerCommandBar))}commandKeyEditCommand(){const e=this;if(e._selection&&e._selection.focusedCell&&void 0!==e._selection.focusedCell.id){const t=e.rowById[e._selection.focusedCell.id];e.beginEdit(t.id)}}commandKeyCancelCommand(){this.cancelEdit()}commandKeyUpdateCommand(){this.endEdit()}commandColumnMenuCommand(){this._openColumnChooserMenu(this._commandColumn)}commandColumnEditCommand(e){this.beginEdit(e.id)}commandColumnUpdateCommand(){this.endEdit()}commandColumnRowMenuCommand(){}commandColumnCancelCommand(e){const t=this;if(t.editing.batch){const i=t._rowsDeleted?t._rowsDeleted.indexOf(e):-1;i>=0&&t._rowsDeleted.splice(i,1);for(let i=0;i<t.columns.length;i++){const n=t.columns[i].dataField;t._cellsUpdatedValues&&t._cellsUpdatedValues[e.id+"_"+n]&&(delete t._cellsUpdatedValues[e.id+"_"+n],t._cellsUpdatedValues.length--)}t._recycle(!1)}t.cancelEdit()}commandColumnDeleteCommand(e){this.deleteRow(e.id)}_renderAddNewRow(){const e=this;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[];const t=new Smart.Grid.Row({data:{},index:-1,grid:e,freeze:"near",visible:"far"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0}),i=new Smart.Grid.Row({data:{},index:-2,grid:e,freeze:"far",visible:"near"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0});if(e._newNearRow){const t=e._frozenNearRows.indexOf(e._newNearRow);if(t>=0&&(e._frozenNearRows.splice(t,1),e.$.rowNearContainer.children.length>0)){const t=e.$.rowNearContainer.children[0];t.parentNode.removeChild(t)}}if(e._newFarRow){const t=e._frozenFarRows.indexOf(e._newFarRow);if(t>=0&&(e._frozenFarRows.splice(t,1),e.$.rowFarContainer.children.length>0)){const t=e.$.rowFarContainer.children[e.$.rowFarContainer.children.length-1];t.parentNode.removeChild(t)}}e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode&&(e._frozenNearDefaultRows.push(t),e._frozenFarDefaultRows.push(i),e._frozenNearRows.splice(0,0,t),e._frozenFarRows.push(i));const n=()=>{e.editing.addNewRow.autoCreate&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e.addUnboundRow(1),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),"button"===e.editing.addNewRow.displayMode&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e._add({}),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max)};if(e._addRowOnButtonClickHandler||(e._addRowOnButtonClickHandler=n),e._scrollView&&e._scrollView.vScrollBar&&(e._scrollView.vScrollBar.$.farButton.removeEventListener("click",e._addRowOnButtonClickHandler),e._scrollView.vScrollBar.$.farButton.addEventListener("click",e._addRowOnButtonClickHandler)),e._newNearRow=t,e._newFarRow=i,e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){if(!e._newNearRow.element){const t=e._newNearRow,i=t.createElement();t.visible="far"!==e.editing.addNewRow.position,t.element=i,e.$.rowNearContainer.children.length>0?e.$.rowNearContainer.insertBefore(i,e.$.rowNearContainer.children[0]):e.$.rowNearContainer.appendChild(i)}if(!e._newFarRow.element){const t=e._newFarRow,i=t.createElement();t.visible="near"!==e.editing.addNewRow.position,t.element=i,e.$.rowFarContainer.children.length>0?e.$.rowFarContainer.insertBefore(i,e.$.rowFarContainer.children[0]):e.$.rowFarContainer.appendChild(i)}}}_insertNewRowAfter(e){return this._insertNewRowBefore(e,!0)}_insertNewRowBefore(e,t=!1){const i=this,n=new Smart.Grid.Row({index:t?0:-1,id:Smart.Utilities.Core.createGUID(),grid:i}),o={};for(let e=0;e<i.columns.length;e++){const t=i.columns[e];void 0!==t.defaultValue&&(o[t.dataField]=t.defaultValue)}n.data=o;const l=function(t,n){i._suppressSort=i._suppressFilter=!0;const o=e=>{i._supressEnter=!0,i.scrollTop=n?i.scrollHeight:0,i.editing.addDialog.enabled||setTimeout((function(){if(i.editing.enabled&&i.editing.addNewRow.autoEdit){i.ensureVisible(e.id);let t=null;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=()=>{i._selection.focusedCell={id:e.id,dataField:t,index:e.index},i._selection.rows=[],i._selection.columns=[],i._selection.cells=[],i._setSelection(e.id,t)};i.paging.enabled?setTimeout((()=>{if(!e.element){const t=e.createElement();e.element=t}n(),i._beginEdit(e)}),200):(n(),i._beginEdit(e))}}),100),i._suppressSort=i._suppressFilter=!1};!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("add")>=0?(i._batchAddRow(t,n?i.rows.length:0),o(t),e&&e(t)):i.addRow(t.data,n,(t=>{o(t),e&&e(t)}))}.bind(this);return i.editing.addDialog.enabled?i._openAddRowDialog(n,l):l(n,t),!0}commandBarBatchSaveCommand(){this._saveBatchEdit()}commandBarAddRowCommand(){this._insertNewRowAfter()}commandBarAddTopRowCommand(){this._insertNewRowBefore()}commandBarDeleteRowCommand(){const e=this;let t=1,i=e.rows[e.rows.length-t];for(e._rowsDeleted||(e._rowsDeleted=[]);e._rowsDeleted.indexOf(e.rows[e.rows.length-t])>=0;)t++;if(i=e.rows[e.rows.length-t],e.selection.enabled)if(e.selection.allowCellSelection){const t=e.getSelectedCells();if(t.length>0){const n=t[0][0];i=e.rowById[n]}}else{const t=e.getSelectedRowIds();t.length>0&&(i=e.rowById[t[0]])}i&&e.commandColumnDeleteCommand(i)}commandBarBatchRevertCommand(){this.revertBatchEdit()}_beginEdit(e,t){const i=this;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=i.columnByDataField[t];if(i.editing.allowColumnHeaderEdit&&!e&&n)return void i._beginColumnEdit(n);if(!e||!n||n&&n.autoGenerated)return!1;const o=e.getCell(t);if(!o)return!1;i.$.fireEvent("beginEdit",{id:e.id,dataField:n.dataField,row:e,column:n,cell:o,data:o.row.data,value:o.value}).defaultPrevented||("cell"===i.editing.mode?i._beginCellEdit(o):"row"===i.editing.mode&&i._beginRowEdit(e,o))}_saveUnboundRows(e){const t=this;if(t._unboundRows&&t._unboundRows.length>0&&t.editing.addNewRow.autoSave){const i=t.rowById[e];if(!i.unbound)return;const n=t._unboundRows.indexOf(i);if(n<0)return;const o=n+1;t.beginUpdate();for(let e=0;e<o;e++){const i=t._unboundRows[e];if(!i)continue;delete t.rowById[i.id],i.unbound=!1;let n=!1;t._selection.focusedCell&&t._selection.focusedCell.id===i.id&&(n=!0),t._nearRowsAdded&&t._nearRowsAdded.indexOf(i)>=0?(t._nearRowsAdded.splice(t._nearRowsAdded.indexOf(i),1),t._add(0,i.data),n&&(t._selection.focusedCell.id=t.rows[0].id,t._selection.focusedCell.index=t.rows[0].index)):t._farRowsAdded&&t._farRowsAdded.indexOf(i)>=0&&(t._farRowsAdded.splice(t._farRowsAdded.indexOf(i),1),t._add(i.data),n&&(t._selection.focusedCell.id=t.rows[t.rows.length-1].id,t._selection.focusedCell.id=t.rows[t.rows.length-1].index))}t._unboundRows.splice(0,o),t.endUpdate()}}_validateCell(e,t,n){const o=this;if(o._errorOverlay&&(o._errorOverlay.remove(),o._errorMessage.remove(),o._isUpdating=!1),e.column.validationRules||n||e.column.editor&&e.column.editor.onValidate){let l={},a=e._updating;if(e._updating=!0,e.error="",n){for(let i in n)n[i]&&"valid"!==i&&(e.error=n.message),"custom"===i&&n[i].minLength?e.error=o.localize("invalidCellValue",{value:t,validationRule:"minLength: "+n[i].value}):"custom"===i&&n[i].maxLength&&(e.error=o.localize("invalidCellValue",{value:t,validationRule:"maxLength: "+n[i].value}));e.error&&(o._isUpdating=!0)}for(let n of e.column.validationRules){switch(n.type){case"min":l.min=i.min(t,n.value);break;case"max":l.max=i.max(t,n.value);break;case"minLength":l.minLength=i.minLength(t,n.value);break;case"maxLength":l.maxLength=i.maxLength(t,n.value);break;case"minDate":l.minDate=i.minDate(t,n.value);break;case"maxDate":l.maxDate=i.maxDate(t,n.value);break;case"required":l.required=i.required(t);break;case"requiredTrue":l.requiredTrue=i.requiredTrue(t);break;case"pattern":l.pattern=i.pattern(t,n.value);break;case"email":l.email=i.email(t);break;case"null":l.null=i.null(t)}l[n.type]&&(n.message?e.error=n.message:e.error=o.localize("invalidCellValue",{value:t,validationRule:void 0!==n.value?n.type+": "+n.value:n.type}),e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""),o.clearSelection())}if(e.column.editor&&e.column.editor.onValidate){const i=e.column.editor.onValidate(t,e.row.data);"string"==typeof i&&(e.error=i,e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""),o.clearSelection())}if(e._updating=a,e.error){o._errorOverlay=o._createOverlay(),o._errorOverlay.onpointerdown=function(){o.endEdit()};const t=document.createElement("div");t.innerHTML=e.error,t.classList.add("smart-grid-validation-error");const i=o.offset(e.element),n=e.element.getBoundingClientRect();return i.top+n.height+5-o.offsetTop>o.offsetHeight?t.style.top=i.top-n.height-5-o.offsetTop+"px":t.style.top=i.top+n.height+5-o.offsetTop+"px",t.style.left=i.left-o.offsetLeft+"px",o._errorMessage=t,o.$.root.appendChild(o._errorOverlay),o.$.root.appendChild(o._errorMessage),!1}o._isUpdating=!1}return!0}_endCellEdit(e){const t=this,i=e||t.editing.editCell;if(!i||i&&!i.isEditing)return null;let n=t._getEditorValue(i),o=null;n&&n.error&&(i.canNotify=!1,i.element.setAttribute("error",""),i.row.element.setAttribute("error",""),i.error=!0,i.canNotify=!0,o=n.validity,n=n.value);const l=function(e,t){return"date"===i.column.dataType?e&&t?e.valueOf()===t.valueOf():!e&&!t:!("any"!==i.column.dataType||void 0===e||void 0===t||!Array.isArray(e)||0!==e.length||""!==t)||e===t},a=function(){const e=t._getEditorId(i);t._cellEditors[e].detach(),i.row.element.removeAttribute("edit"),i.element&&(i.element.removeAttribute("editor"),i.element.removeAttribute("error")),i.row.element.removeAttribute("error"),i.isEditing=!1,i.element&&(i.element.content.innerHTML="");const o=function(){t.editing.editRow||(t.dataSource&&t.dataSource.boundHierarchy?(t.dataSource.refreshHierarchy(),t._refreshRowHierarchy(),t.refresh()):t.layout.allowCellsWrap?t.refresh():t._recycle(!1))},a=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,d=void 0!==a?a:i.value,r=()=>{if(t._fireEndEdit){let e=i.value;if(t.editing.batch&&i.row&&i.column){const t=i.modifiedValue;void 0!==t&&(e=t)}t.$.fireEvent("endEdit",{id:i.row.id,dataField:i.column.dataField,row:i.row,column:i.column,cell:i,data:i.row.data,value:e}),t._fireEndEdit=!1}};if(l(n,d))r(),t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1,o());else{const e=function(){t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1),delete t._editInfo};if(!0===t.editing.batch||t.editing.batch&&t.editing.batch.indexOf("update")>=0)e(),t._batchUpdateCell(i.row,i.column,n,i.value),o(),r();else{const l=function(){e(),i._updating=!0,i.value=n,i._updating=!1,o(),r()};if(!t.editing.editRow&&t.dataSource&&t.dataSource.virtualDataSource){const e={};e[i.column.dataField]=n,t.updateRow(i.row.id,e,(()=>{l()}))}else l()}}return t.editing.commandColumn.visible&&!t.editing.commandColumn.width&&"cell"===t.editing.mode&&t.refresh(),t.focus(),!0};let d=t._validateCell(i,n,o);if(!d)return i.editor.instance&&!i.editor.autoOpen&&setTimeout((()=>{i.editor.instance.focus()}),50),!1;const r=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,s=void 0!==r?r:i.value;if(l(n,s))return a(),!!d;if(t._setCellUndoRedo(i,s,n),t.onCellUpdate&&!t.editing.editRow){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e),t.onCellUpdate([i],[s],[n],(function(o){o?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[s],[n],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,s,n)}),t)}else if(t.onRowUpdate){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e);const o=i.column.dataField,l=Object.assign({},i.row.data),d=Object.assign({},i.row.data);d[o]=n,t.onRowUpdate([i.row.index],[i.row],[l],[d],(function(n){n?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onRowUpdated&&t.onRowUpdated([i.row.index],[i.row],[i.row.data],t),t._onRowUpdated&&t._onRowUpdated(i.row.index,i.row,i.row.data)}),t)}else a();return!!d}_endRowEdit(){const e=this,t=e.editing.editRow;if(!t)return!1;let i=!0;const n=t.cells;let o={},l={};t.element.removeAttribute("error");for(let a=0;a<n.length;a++){const d=n[a];let r=e._getEditorValue(d),s=null;r&&r.error&&(d.canNotify=!1,d.element.setAttribute("error",""),d.row.element.setAttribute("error",""),d.error=!0,d.canNotify=!0,s=r.validity,r=r.value),o[d.column.dataField]=d.value,l[d.column.dataField]=r;if(!e._validateCell(d,r,s))return i=!1,t.element.setAttribute("error",""),e._isUpdating=!0,d.editor.instance&&setTimeout((()=>{d.editor.instance.focus()}),50),!1}if(i){const i=function(){const i=e._fireEndEdit;e._fireEndEdit=!1;for(let t=0;t<n.length;t++){const i=n[t];e._endCellEdit(i)}e._fireEndEdit=i,e.onRowUpdate||null===e.onRowUpdated||e.onRowUpdated([t.index],[t],[t.data],e),e.editing.isEditing=!1,e.editing.editRow=null,e.editing.commandColumn.visible&&!e.editing.commandColumn.width?e.refresh():e._recycle(!1)};if(!0===e.editing.batch||e.editing.batch&&e.editing.batch.indexOf("update")>=0)i();else if(e.onRowUpdate){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const n=e._createOverlay();e.$.root.appendChild(n);const a=e.onRowHistory;e.onRowHistory=null,t.updatedDate=new Date,t.updatedBy=e.currentUser,e.storeHistory&&e._updateRowHistory(t,o,l),setTimeout((()=>{e.onRowHistory=a}),100),e.onRowUpdate([t.index],[t],[o],[l],(function(o){const l=e.onRowUpdate,a=e.onCellUpdate;e.onRowUpdate=null,e.onCellUpdate=null,o?i():e.cancelEdit(),e.onRowUpdate=l,e.onCellUpdate=a,e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),n.parentNode.removeChild(n),e.endUpdate(),e.onRowUpdated&&e.onRowUpdated([t.index],[t],[t.data])}),e)}else if(e.dataSource&&e.dataSource.virtualDataSource&&e.editing.isEditing){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const t=e._createOverlay();e.$.root.appendChild(t);let n=Object.assign({},e.editing.editRow.data);for(let t=0;t<e.editing.editRow.cells.length;t++){const i=e.editing.editRow.cells[t];if(!i.column.allowEdit)continue;const o=e._getEditorValue(i);void 0!==o&&(n[i.column.dataField]=o)}e._editInfo={row:n},e._virtualDataRequest("update",(function(n){n?i():e.cancelEdit(),e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),t.parentNode.removeChild(t),e.endUpdate()}))}else i();return!0}return e.focus(),!1}_batchDeleteRow(e){const t=this;t._rowsDeleted||(t._rowsDeleted=[]),t._rowsDeleted.push(e.id),t._recycle(!1)}_batchAddRow(e,t){const i=this;i._rowsAdded||(i._rowsAdded=[]),i._rowsAdded.push(e.id),i.rowById[e.id]=e,e.index=i.rows.length+(i._rowsAdded?i._rowsAdded.length:0),0===t?i._nearRowsAdded.splice(0,0,e):i._farRowsAdded.push(e);i.isInitialized&&i._rowElements&&i._rowElements.length<i.rows.length+i._rowsAdded.length&&i._initializeRowElements(),i.refresh()}_batchUpdateCell(e,t,i,n){const o=this;o._cellsUpdatedValues||(o._cellsUpdatedValues=[]);!function(e,i){return"date"===t.dataType?!(!e&&i)&&(!(e&&!i)&&e.valueOf()===i.valueOf()):e===i}(i,n)?o._cellsUpdatedValues[e.id+"_"+t.dataField]=i:delete o._cellsUpdatedValues[e.id+"_"+t.dataField],o._cellsUpdatedValues.length++}_saveBatchEdit(){const e=this;for(let t in e._cellsUpdatedValues){const i=e._cellsUpdatedValues[t],n=t.substring(0,t.indexOf("_")),o=t.substring(t.indexOf("_")+1),l=e.rowById[n],a=l.getCell(o);if(e.dataSource.virtualDataSource){const t={};t[a.column.dataField]=i,l.data.$&&l.data.$.id?e.updateRow(l.data.$.id,t):(a._updating=!0,a.value=i,a._updating=!1)}else a._updating=!0,a.value=i,a._updating=!1}const t=e._rowsDeleted&&e._rowsDeleted.length>0||e._rowsAdded&&e._rowsAdded.length>0;if(t&&e.beginUpdate(),e._rowsAdded&&e._rowsAdded.length>0)for(let t in e._rowsAdded){const i=e._rowsAdded[t],n=e.rowById[i];if(n){if(e._rowsDeleted&&e._rowsDeleted.length>0){let t=!1;for(let n=0;n<e._rowsDeleted.length;n++){if(e._rowsDeleted[n].id===i){t=!0;break}}if(t)continue}e.dataSource.virtualDataSource?e.addRow(n.data,!0):e._nearRowsAdded.indexOf(n)>=0?e.rows.splice(0,0,n):e._farRowsAdded.indexOf(n)>=0&&e.rows.push(n)}}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const i=e._rowsDeleted[t],n=e.rowById[i];if(n)if(e.dataSource&&e.dataSource.virtualDataSource)e._editInfo={row:n.data},e._virtualDataRequest("remove",(function(t){if(t){const t=e.rows.indexOf(n);e.rows.splice(t,1),delete e.rowById[n.id]}}));else{const t=e.rows.indexOf(n);e.rows.splice(t,1)}}t&&e.endUpdate(),e._clearBatchEdit(!1),e.$.fireEvent("saveBatchEdit")}_clearBatchEdit(){const e=this;let t=!1;e._rowsAdded&&e._rowsAdded.length>0&&(t=!0),e._cellsUpdatedValues=[],e._rowsAdded=[],e._rowsDeleted=[],e._nearRowsAdded=[],e._farRowsAdded=[],t?e.refresh():e._recycle(!1),e.$.fireEvent("clearBatchEdit")}_getEditorId(e){const t=e.column._editorId?e.column._editorId:"";return e.editor!==e.column.editor?e.editor.template+"_"+e.column.dataField+"_"+e.row.id+t:e.editor.template+"_"+e.column.dataField+t}_applyCommand(e,t){const i=this;t||(t=[]);const n=function(){"function"==typeof e?e.apply(i,t):i[e]?i[e].apply(i,t):Smart[e]?Smart[e].apply(i,t):window[e]&&window[e].apply(i,t)};if(i.onCommand){t||(t=[]),t[1]||(t[1]=null);const o={name:e,command:n,details:t[0],event:t[1],handled:!1};setTimeout((()=>{i.onCommand.apply(i,[o]),o.handled||n()}),200)}else n()}_getCommandColumnCommandsTemplate(){const e=this,t=e.editing.commandColumn.dataSource,i="icon"!==e.editing.commandColumn.displayMode,n="label"!==e.editing.commandColumn.displayMode;let o="";for(let l in t){const a=t[l];let d="<div",r=!1;if("commandColumnMenu"===l)continue;r||(d+=' item="'+l+'" command="'+a.command+'" class="smart-grid-command-item">',r=!0);const s="{{messages}}"===a.label?e.localize(l):a.label;n&&i?(d+='<span class="smart-grid-icon '+a.icon+'"></span>',d+='<span class="smart-grid-label">'+s+"</span>"):n&&!i?d+='<span title="'+s+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(d+='<span class="smart-grid-label">'+s+"</span>"),d+="</div>",o+=d}return o}_updateCommandColumnCommandsVisibility(e,t){const i=this,n=e.children,o=i.editing.commandColumn.dataSource;for(let e=0;e<n.length;e++){const l=n[e],a=l.getAttribute("item"),d=o[a].visible;!0===d?l.classList.remove("smart-hidden"):!1===d?l.classList.add("smart-hidden"):"auto"===d&&(!i.editing.dialog.enabled&&(i.editing.editRow===t||i.editing.editCell&&i.editing.editCell.row===t)?"commandColumnEdit"===a?l.classList.add("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.remove("smart-hidden"):"commandColumnEdit"===a?l.classList.remove("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.add("smart-hidden"))}}_handleEditKeyDown(e){const t=this,i=e.key,n=t.editing.commandKeys;if(!t.editing.dialog.enabled)for(let o in n){const l=n[o],a=l.key.replace(/ /gi,"").split("|");if(("Tab"!==i||!t.editing.editRow)&&a.indexOf(i)>=0){if(t._applyCommand(l.command),"Enter"===i&&e){if(e.stopPropagation(),t._supressEnter)return void delete t._supressEnter;t.selection.enabled&&t.selection.allowCellSelection&&t._keyDownHandler(e)}break}}}_getCustomCellEditor(e){const t=this;e.editor.selector=e.editor.template,e.editor.template="custom";const i=t._getEditorId(e);if(!t._cellEditors[i]){let n=document.createElement("div");t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){const t=e.editor.instance.element.firstElementChild;Smart.Utilities.Core.isMobile||(e.editor.focus?setTimeout((function(){e.editor.focus.apply(e.editor.instance.element,[])}),50):setTimeout((function(){t.focus()}),50))},a=function(t){const i=e.editor.instance.element.firstElementChild;e.editor.blur?e.editor.blur.apply(e.editor.instance.element,[t]):i.blur()},d=function(t){const i=e.editor.instance.element.firstElementChild;if(!e.editor.isInitialized&&e.editor.settings&&i)for(let t in e.editor.settings)i[t]=e.editor.settings[t];if(e.editor.setValue)e.editor.setValue.apply(e.editor.instance.element,[t]);else{if(i.innerHTML.indexOf("{{")>=0){const n=i.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,e.row.id);i.innerHTML=n}i.value=t,t instanceof Date&&(i.value=t.toISOString().split("T")[0]),e.editor.instance.element.value=i.value}},r=function(){const t=e.editor.instance.element.firstElementChild;if(e.editor.getValue){const i=t.querySelector("input");return i&&i.blur(),e.editor.getValue.apply(e.editor.instance.element,[t.value])}const i=t.value;return e.editor.settings&&e.editor.settings.valueProperty?i?Array.isArray(i)&&i.length>0?i[0][e.editor.settings.valueProperty]:i[e.editor.settings.valueProperty]:"":i||""},s=function(){n.removeEventListener("keydown",o),e.editor.detach&&e.editor.detach.apply(n,[])},c=function(){n.addEventListener("keydown",o),e.editor.attach&&e.editor.attach.apply(n,[])};let u=null;if((e.editor.selector.startsWith("#")||e.editor.selector.startsWith("."))&&(u=document.querySelector(e.editor.selector)),u)n.appendChild(u.content.cloneNode(!0).firstElementChild);else{const i=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e.editor.selector);if(i){if("#text"===i.nodeName)return t._getInputCellEditor(e);n.appendChild(i)}}t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getSliderCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=document.createElement("input"),l=document.createElement("div"),a=document.createElement("smart-number-input");if(o.type="range",o.step="0.01",t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(a.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);a.numberFormat=i}e.editor.min&&(o.min=a.min=e.editor.min),e.editor.max&&(o.max=a.max=e.editor.max),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-slider-cell-editor"),l.classList.add("nav"),a.classList.add("smart-flex"),a.style.paddingLeft="6px",l.classList.add("smart-icon-resize-full","smart-grid-icon");const d=function(e){if("keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey))return l.click(),void e.preventDefault()};l.onclick=function(){const i=document.createElement("div"),n=document.createElement("input");n.type="range";const d=e.editor.instance.element,r=document.createElement("div");r.classList.add("smart-slider-editor"),i.setAttribute("theme",t.theme),r.appendChild(n);const s=Smart.Utilities.Core.createGUID().replace(/-/gi,"");i.id="Slider"+s,d.setAttribute("aria-owns",i.id),r.classList.add("smart-grid-slider-container"),n.value=o.value,o.min&&(n.min=o.min),o.max&&(n.max=o.max),l.sliderEditorDialog=i,l.popupSlider=n,n.onchange=n.oninput=function(){a.value=parseFloat(n.value)};const c=e=>{e&&e.key&&("Enter"===e.key&&(i.parentNode.removeChild(i),o.value=parseFloat(n.value),t.endEdit()),"Escape"===e.key&&(i.parentNode.removeChild(i),t.cancelEdit()))};a.onchange=a.onkeyup=e=>{n.value=a.value,c(e)},n.onkeydown=function(e){c(e)},i.classList.add("smart-grid-slider-dialog"),i.appendChild(r),document.body.appendChild(i),i.style.top=t._offsetTop(d)+d.offsetHeight+"px",i.style.left=t._offsetLeft(d)+15+d.offsetWidth-i.offsetHeight+"px",i.style.width=d.offsetWidth+"px";const u=t._offsetLeft(t)+t.offsetWidth;t._offsetLeft(d)+i.offsetWidth>u&&(i.style.left=u-i.offsetWidth-10+"px")};let r=e.value;void 0===r&&(r=0),a.value=r,o.value=r,n.appendChild(a);const s=e=>{"Escape"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),t.cancelEdit()),"Enter"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),o.value=parseFloat(a.value),t.endEdit())};return t._cellEditors[i]={element:n,focus:function(){l.click(),Smart.Utilities.Core.isMobile||setTimeout((function(){a.focus(),t.$.scrollView.scrollTop=0}),50)},blur:function(){},setValue:function(e){o.value=void 0!==e&&""!==e?parseFloat(e):0,a.isReady&&a.setValue(e)},getValue:function(){const e=parseFloat(o.value);return l.sliderEditorDialog&&l.sliderEditorDialog.parentNode?(o.value=parseFloat(l.popupSlider.value),o.value):e},attach:function(){o.addEventListener("keydown",d),a.addEventListener("keydown",s)},detach:function(){o.removeEventListener("keydown",d),a.removeEventListener("keydown",s),l.sliderEditorDialog&&l.sliderEditorDialog.parentNode&&(o.value=l.popupSlider.value,l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog))}},t._cellEditors[i]}_getTextAreaCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=document.createElement("textarea"),l=document.createElement("div");t._applyCellEditorUserSettings(n,e),o.style.direction="",t.rightToLeft&&(o.style.direction="rtl"),e.editor.min&&(o.minLength=e.editor.min),e.editor.max&&(o.maxLength=e.editor.max),o.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-text-area-cell-editor"),l.classList.add("nav"),l.classList.add("smart-icon-resize-full","smart-grid-icon");const a=function(e){if("keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey))return l.click(),void e.preventDefault()};l.onclick=function(){const n=document.createElement("div"),a=document.createElement("textarea"),d=e.editor.instance.element,r=document.createElement("div"),s=document.createElement("smart-scroll-bar");n.id="TextArea"+i,d.setAttribute("aria-owns",n.id),t.rightToLeft&&(a.style.direction="rtl"),s.orientation="vertical",n.setAttribute("theme",t.theme),r.appendChild(a),r.classList.add("smart-grid-text-area-container"),r.appendChild(s),a.value=o.value,a.classList.add("smart-input"),o.minLength>=0&&(a.minLength=o.minLength),o.maxLength>=0&&(a.maxLength=o.maxLength),l.textAreaEditorDialog=n,l.popupTextArea=a;const c=function(){s.value=a.scrollTop,s.max=a.scrollHeight-a.offsetHeight,s.onChange=null,a.offsetHeight>=a.scrollHeight?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),s.onChange=function(){a.scrollTop=s.value}};if(a.onscroll=function(){c()},a.onkeydown=function(e){if(a._key=e.key,"Escape"===e.key){try{n.parentNode.contains(n)&&n.parentNode.removeChild(n)}catch(e){n.error=e}t.editing.editCell&&t.cancelEdit()}("Tab"===e.key||"Enter"===e.key&&e.shiftKey)&&(o.value=a.value,t.editing.editCell?t.endEdit():a.blur(),e.preventDefault(),e.stopPropagation())},n.classList.add("smart-grid-text-area-dialog"),n.appendChild(r),document.body.appendChild(n),setTimeout((function(){Smart.Utilities.Core.isMobile||a.select(),c()}),50),c(),n.style.top=t._offsetTop(d)+"px",n.style.left=t._offsetLeft(d)+"px",n.style.width=d.offsetWidth+"px",t.grouping.enabled&&e.column._treeColumn){const e=d.parentNode.parentNode;n.style.top=t._offsetTop(e)+"px",n.style.left=t._offsetLeft(e)+"px",n.style.width=e.offsetWidth+"px"}a.onblur=()=>{"Escape"!==a._key&&(o.value=l.popupTextArea.value),o.focus();try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}},n.appendChild(o);return t._cellEditors[i]={element:n,focus:function(){l.click()},blur:function(){},setValue:function(e){o.value=e,l.popupTextArea&&(l.popupTextArea.value=o.value)},getValue:function(){const e=o.value;return l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode?(o.value=l.popupTextArea.value,o.value):e},attach:function(){o.addEventListener("keydown",a)},detach:function(){if(o.removeEventListener("keydown",a),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode){o.value=l.popupTextArea.value;try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}}},t._cellEditors[i]}_getColorInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=t._getColorInput();t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-color-input-cell-editor"),n.dropDownWidth=50,n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.rightToLeft=!0);const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(e){n.value=e},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("input");t._applyCellEditorUserSettings(n,e),e.editor.min&&(n.minLength=e.editor.min),e.editor.max&&(n.maxLength=e.editor.max),n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-input-cell-editor"),n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.style.direction="rtl");const o=function(i){if("keydown"===i.type)return"number"!==e.column.dataType&&"int"!==e.column.dataType&&"float"!==e.column.dataType||t.editing.editColumn||i.key.match(/[0-9]/)||"-"===i.key||1!==i.key.length?void t._handleEditKeyDown(i):(i.preventDefault(),void i.stopPropagation())},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(t){if(!e.column.rowHeaderColumn||t){if("number"===e.column.dataType||"int"===e.column.dataType||"float"===e.column.dataType){if(""===t)return;if(t&&!t.toString().match(/[0-9]/)&&"-"!==t)return}n.value=t}else n.value=e.editor.row.visibleIndex+1},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_applyCellEditorUserSettings(e,t){for(let i in t.editor)"template"!==i&&("list"!==i?"onInit"!==i&&"onRender"!==i&&(e[i]=t.editor[i]):e.setAttribute(i,t.editor[i]));if(t.editor.settings)for(let i in t.editor.settings)e[i]=t.editor.settings[i]}_getCheckInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-check-input")}_getMultiInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-multi-input")}_getMultiComboInputCellEditor(e){const t=this._getAutoCompleteCellEditor(e,"smart-multi-combo-input");return"tags"===e.column.template&&(t.getValue=()=>{const e=t.element.selectedItems;if(e&&0===e.length)return"";let i=[];for(let t=0;t<e.length;t++){const n=e[t];"string"==typeof n?i.push(n):i.push(n.value)}return i.toString()},t.setValue=e=>{if(e&&e.indexOf("{")>=0||e&&e.indexOf("[")>=0)t.element.selectedItems=JSON.parse(e);else if(e&&e.indexOf(",")>=0)if(e=e.split(",").map((e=>e.trim())),t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{for(let n=0;n<e.length;n++){const o=e[n];("string"==typeof t&&""+t===o||t&&void 0!==t.label&&""+t.value===o)&&i.push(t)}})),t.element.selectedItems=i}else t.element.selectedItems=e;else if(t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{("string"==typeof t&&""+t===e||t&&void 0!==t.label&&""+t.value===e)&&i.push(t)})),t.element.selectedItems=i}else t.element.value=e},t.focus=function(){if(Smart.Utilities.Core.isMobile)return;const e=t.element;setTimeout((()=>{t.element.readonly?t.element.focus():e&&e.select&&e.select()}),50)}),t}_getAutoCompleteCellEditor(e,t){const i=this,n=i._getEditorId(e);if(i._cellEditors[n]&&e.column.editor.isDirty&&(delete e.column.editor.isDirty,delete i._cellEditors[n]),!i._cellEditors[n]){let o=document.createElement("smart-input");t&&(o=document.createElement(t)),i._applyCellEditorUserSettings(o,e),o.readonly&&(o.dropDownButtonPosition="right");const l=function(e){o.opened||"keydown"!==e.type||i._handleEditKeyDown(e)};o.rightToLeft=i.rightToLeft,o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-auto-complete-cell-editor");const a=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{o&&o.select&&o.select()}),50)},d=function(e){e&&1===e.length&&o.readonly||(o.value=e)},r=function(){return o.value},s=function(){o&&o.close&&(o.value="",o.close(),o.removeEventListener("keydown",l))},c=function(){},u=function(){o.addEventListener("keydown",l)};i._cellEditors[n]={element:o,focus:a,blur:c,setValue:d,getValue:r,attach:u,detach:s}}if(!e.editor.dataSource&&!e.editor.isInitialized){const t=i.getVisibleRows(),o=[];for(let n=0;n<t.length;n++){let l=i.dataSource[t[n].index];if(l){if(l=l[e.column.dataField],!l)continue;-1===o.indexOf(l)&&o.push(l)}}i._cellEditors[n].element.dataSource=o}return i._cellEditors[n]}_getDateRangeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-range-input");n.dropDownButtonPosition="right",n.dropDownAppendTo="body",n.autoClose=!0,n.selectionMode="default",n.rightToLeft=t.rightToLeft,n.timepicker=!0,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},d=function(){return n._performSelect(),n.selectedDates},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getDateTimePickerCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-time-picker");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,e.column.cellsFormat&&(n.formatString=e.column.cellsFormat),t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(n.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){if("string"==typeof e&&1===e.length){if("string"==typeof e&&n.autoOpen&&"Invalid Date"===(e=new Date(e)).toString())return;n.$.input.value=e}else n.value=e},d=function(){return n.value&&n.value instanceof Smart.Utilities.DateTime?(n._validateValue(n.$.input.value),n.value.toDate()):n.value},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getTimeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-time-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},d=function(){const e=new Date;return e.setHours(n.value[0]),e.setMinutes(n.value[1]),"Invalid Date"===e.toString()?new Date:e},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getDateInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,n.formatString=(!e.column.cellsFormat||1!==e.column.cellsFormat.length&&"d"!==e.column.cellsFormat)&&e.column.cellsFormat?e.column.cellsFormat:"MM/dd/yyyy",t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened?"Enter"!==e.key&&"Escape"!==e.key||t._handleEditKeyDown(e):"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(e.editor.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){"string"==typeof e&&e.length>1&&"Invalid Date"===(e=new Date(e)).toString()||(n.value=e)},d=function(){return n.getValue()},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getImageCellEditor(e){const t=this,i=t._getEditorId(e);if(t._dialogImage&&(t._dialogImage.cell=e),!t._cellEditors[i]){const n=document.createElement("div");n.innerHTML=`\n <div style="display: grid;"><div title="${t.localize("addImages")}" class="smart-grid-icon smart-icon-plus show"></div><div class="images"><div class="container"></div></div></div>\n `,n.rightToLeft=t.rightToLeft,n.tabIndex=0,n.firstElementChild.style.gridTemplateColumns="25px 1fr",t.rightToLeft&&(n.style.direction="rtl");const o=n.querySelector(".smart-grid-icon"),l=n.querySelector(".images");o.onpointerdown=()=>{t._openImageDialog(t._dialogImage?t._dialogImage.cell:e)},l.onclick=e=>{"IMG"===e.target.nodeName&&t._openImagePreviewDialog(e.target)},n.ondrop=i=>{i.preventDefault(),t._openImageDialog(t._dialogImage?t._dialogImage.cell:e),t._dialogImage.dropZone.dropHere(i)},n.ondragover=e=>{e.preventDefault()},t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const a=function(){n.focus(),setTimeout((()=>{n.focus()}),50)},d=function(e){n.value=e,l.innerHTML=`<div class="container"><div style="justify-content: center; align-items: center; display: flex; margin-top: 3px;" class="smart-drop-image smart-micro smart-quiet">${t.localize("dropImages")}</div></div>`;const i=l.firstElementChild;if("string"==typeof e&&(e.indexOf("http")>=0||e.indexOf("base64")>=0)){let t="";try{t=JSON.parse(e)}catch(e){console.log(e)}e=t}Array.isArray(e)&&(i.innerHTML="",e.forEach((e=>{const t=document.createElement("img");t.src=e.value,i.appendChild(t)})))},r=function(){let e=n.value;return e&&(Array.isArray(e)||("string"==typeof e&&e.indexOf("base64"))>=0)&&Array.isArray(e)&&(e=JSON.stringify(e)),e},s=i=>{("+"===i.key||i.altKey&&"ArrowDown"===i.key)&&t._openImageDialog(t._dialogImage?t._dialogImage.cell:e),"Escape"===i.key&&t.cancelEdit(),"Enter"===i.key&&t.endEdit()},c=function(){n.value="",t._dialogImage&&t._dialogImage.close(),t._dialogImagePreview&&t._dialogImagePreview.close(),n.removeEventListener("keydown",s)},u=function(){},m=function(){n.addEventListener("keydown",s)};t._cellEditors[i]={element:n,focus:a,blur:u,setValue:d,getValue:r,attach:m,detach:c}}return t._cellEditors[i]}_getPhoneCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-phone-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-phone-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.value=e,n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1),t._phoneNumbers&&t._phoneNumbers[e]&&(n.selectedCountry=t._phoneNumbers[e])},d=function(){return t._phoneNumbers||(t._phoneNumbers=[]),n.value&&(t._phoneNumbers[n.value]=n.selectedCountry),n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getPasswordCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-password-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-password-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},d=function(){return n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getMaskCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-masked-text-box");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-masked-text-box-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},d=function(){return n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getNumberInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-number-input");if(t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(n.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t,i.minimumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("d")>=0){i={style:"decimal"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("f")>=0||e.column.cellsFormat.indexOf("n")>=0){i={};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.minimumFractionDigits=t,i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);n.numberFormat=i}n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-number-input-cell-editor");const o=function(e){t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.focus(),t.$.scrollView.scrollTop=0}),50)},a=function(){},d=function(e){n.isReady&&("string"==typeof e&&n.numberFormat&&n.numberFormat.style&&"percent"===n.numberFormat.style&&(e=parseFloat(e),e=""+(e/=100)),null!==e&&""!==e||(e=0),n.setValue(e))},r=function(){return n.getValue()},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getCheckBoxCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const e=document.createElement("div");e.classList.add("smart-input"),e.classList.add("smart-grid-cell-editor"),e.classList.add("smart-grid-check-box-cell-editor"),e.tabIndex=0;const n=function(){!0!==e.value&&!1!==e.value&&null!==e.value&&(e.value=!1),null===e.value?e.value=!1:e.value=!e.value,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},o=function(e){if(" "!==e.key){switch(e.key){case"ArrowLeft":case"ArrowDown":case"ArrowRight":case"ArrowUp":if(t.editing.dialog.enabled)return;t.endEdit()}t._handleEditKeyDown(e)}else n()},l=function(t){e.value="string"==typeof t?"false"!==t&&"0"!==t&&"null"!==t&&"undefined"!==t:t,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},a=function(){Smart.Utilities.Core.isMobile||(e.focus(),setTimeout((function(){e.focus()}),25))},d=function(){return e.value},r=function(){e.value=!1,e.removeEventListener("click",n),e.removeEventListener("keydown",o)},s=function(){},c=function(){e.addEventListener("keydown",o),e.addEventListener("click",n)};t._cellEditors[i]={getValue:d,setValue:l,focus:a,blur:s,element:e,detach:r,attach:c}}return t._cellEditors[i]}_getEditorValue(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors)return;const n=t._cellEditors[i];if(!n)return;const o=function(t){switch(e.column.dataType){case"string":t=null==t?"":void 0!==t&&"number"==typeof t?parseFloat(t):t&&"object"==typeof t&&t[0]&&t[0].label?t[0].label.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):t&&"object"==typeof t&&t instanceof Date?t.toLocaleString():t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""");break;case"float":case"int":case"number":t="int"===e.column.dataType?parseInt(t):parseFloat(t),isNaN(t)&&(t=0);break;case"bool":case"boolean":"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1);break;case"date":if(t instanceof Date)return t;"string"==typeof t&&(t=new Date(t));break;case"dateTime":t=new Smart.Utilities.DateTime(t)}return t};let l=null;switch(e.editor.template){case"dateRangeInput":try{l=n.getValue()}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"input":case"autoComplete":case"numberInput":case"slider":case"dateInput":case"timeInput":case"deteTimePicker":case"checkBox":try{l=o(n.getValue())}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"multiComboInput":case"image":l=n.getValue();break;default:l=o(n.getValue())}let a=!0,d=!1,r=!1;if(e.column.validator)a=e.column.validator.evaluate(l,e.row.data);else if("string"==typeof l){const t=e.editor.minLength||e.editor.min||0,i=e.editor.maxLength||e.editor.max||999999;(l.length<t||l>i)&&(a=!1),l.length<t&&(d=!0),l.length>i&&(r=!0),e.editor.required&&0===l.length&&(a=!1),e.editor.instance.element&&e.editor.instance.element.checkValidity&&(a=e.editor.instance.element.checkValidity())}if(a)return l;let s=null;const c=e.editor.instance.element;return c&&(s=c.validity,s&&(s.custom&&delete s.custom,d&&(s.custom={minLength:!0,value:e.editor.min}),r&&(s.custom={maxLength:!0,value:e.editor.max}),s.message=c.validationMessage)),{error:!0,validity:s,value:l}}_beginRowEdit(e,t){const i=this;if(e===i.editing.editRow)return!1;if(i.editing.editRow){if(!i.endEdit())return!1}const n=e.cells;i.editing.editRow=e,i.editing.commandColumn.visible&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),e.isEditing=!0;let o=!1;for(let e=0;e<n.length;e++){const l=n[e],a=l.column;if(!a.allowEdit||!1===a._visible)continue;const d=i._beginCellEdit(l);if(d){if(!0!==i.editing.recordNavigation){if(Smart.Utilities.Core.isMobile)return;let e=!0;switch(l.editor.template){case"textarea":case"slider":e=!1}e&&(t?l===t&&l.editor.instance.focus():d&&!o&&(o=!0,l.editor.instance.focus()))}i.editing.commandColumn.visible&&l.column.commandColumn&&l.render()}}return!0}_beginCellEdit(e,t){const i=this;if(e.isEditing)return!1;if(i._isUpdating)return!1;if(i.onCellBeginEdit){if(!i.onCellBeginEdit(e.row.id,e.column.dataField,e.value,i))return!1}let n=!1;if(e.column.autoGenerated&&e.column.rowHeaderColumn&&i.editing.allowRowHeaderEdit&&new Date-i._clickTime<i.behavior.doubleClickTimingDelay&&i._clickedCell===e.element&&(n=!0),(!e.column.allowEdit||e.column.autoGenerated||e.readonly)&&!n)return!1;if(i.editing.editCell&&!i.editing.editRow){i._fireEndEdit=!0;if(!1===i._endCellEdit())return!1}if(i._cellEditors||(i._cellEditors=[]),i.editing.editRow||(i.editing.editCell=e),i.editing.commandColumn.visible&&!i.editing.editRow&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),!e.row.element)return!1;e.row.element.setAttribute("edit",""),i.editing.isEditing=!0,i._selection.selectionRect&&i._selection.selectionRect.classList.add("smart-visibility-hidden");const o=t=>{const n=t.element;i.editing.dialog.enabled?i._openEditDialog(e,t):(e.element||e.createElement(),e.element.setAttribute("editor","string"==typeof e.editor.template?e.editor.template:"template"),e.element.content.innerHTML="",e.element.content.appendChild(n),e.column.cellsWrap||e.element.content.classList.add("nowrap"),i.editing.editRow&&e.element.setAttribute("row-editor","")),t.attach(),e.editor.row=e.row,e.editor.column=e.column,e.editor.cell=e,e.editor.instance=t,e.isEditing=!0},l=i._cellsUpdatedValues?i._cellsUpdatedValues[e.row.id+"_"+e.column.dataField]:void 0;let a=void 0!==l?l:e.value;if(void 0===a){a="";const t=e.column;"number"===t.dataType||"int"===t.dataType||"float"===t.dataType?a=0:"date"===t.dataType&&(a=new Date,a.setHours(0,0,0))}switch(e.editor||(e.editor="input"),"string"==typeof e.editor&&(e.canNotify=!1,e.editor={template:e.editor,autoFocus:!0},e.canNotify=!0),e.editor.template){default:case"custom":{const t=i._getCustomCellEditor(e);o(t),t.setValue(a);break}case"image":{const t=i._getImageCellEditor(e);o(t),t.setValue(a);break}case"checkBox":{const n=i._getCheckBoxCellEditor(e);o(n);const l=!0===a||1===a;if("checkBox"===e.template&&t){(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY)[0].classList.contains("smart-input")?n.setValue(!l):n.setValue(l)}else n.setValue(l);break}case"autoComplete":{const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"list":case"dropDownList":{e.editor.autoOpen=!0,e.editor.readonly=!0,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"comboBox":{e.editor.readonly=!1,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"password":{const t=i._getPasswordCellEditor(e);o(t),t.setValue(a);break}case"phone":{const t=i._getPhoneCellEditor(e);o(t),t.setValue(a);break}case"maskedTextBox":{const t=i._getMaskCellEditor(e);o(t),t.setValue(a);break}case"multiInput":{const t=i._getAutoCompleteCellEditor(e,"smart-multi-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"checkInput":{const t=i._getAutoCompleteCellEditor(e,"smart-check-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"multiComboInput":{e.editor.readonly=!0,e.editor.autoOpen=!0;const t=i._getMultiComboInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"timeInput":{const t=i._getTimeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateInput":{const t=i._getDateInputCellEditor(e);o(t),t.setValue(a);break}case"dateRangeInput":{const t=i._getDateRangeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateTimePicker":{const t=i._getDateTimePickerCellEditor(e);o(t),t.setValue(a);break}case"slider":{const t=i._getSliderCellEditor(e);o(t),t.setValue(a);break}case"colorInput":{const t=i._getColorInputCellEditor(e);o(t),t.setValue(a);break}case"textarea":case"textArea":{const t=i._getTextAreaCellEditor(e);o(t),t.setValue(a);break}case"numberInput":case"text":case"input":{const t="numberInput"===e.editor.template?i._getNumberInputCellEditor(e):i._getInputCellEditor(e);o(t),t.setValue(a);break}}if(!e.editor.isInitialized&&(e.editor.isInitialized=!0,e.editor.onInit)){const t=e.editor.onInit(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}if(e.editor.onRender){const t=e.editor.onRender(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}return i.editing.editCell&&e.editor.instance.focus(),!0}_onColumnDoubleClick(e){this._beginColumnEdit(e)}_beginColumnEdit(e){const t=this;if(t.editing.enabled&&t.editing.allowColumnHeaderEdit&&e.allowHeaderEdit){t.editing.isEditing&&t.endEdit(),t.editing.editColumn=e,t._cellEditors||(t._cellEditors=[]);const i=t._getInputCellEditor({column:e,row:t.rows[0],editor:{template:"input"}});i.element.value=e.label,i.focus(),e.headerEditor=i,e.element.setAttribute("edit",""),e.element.label.appendChild(i.element),i.attach(),t.editing.isEditing=!0,t.$.fireEvent("beginEdit",{id:null,dataField:e.dataField,row:null,column:e,cell:null,data:null,value:null})}}_endColumnEdit(e){const t=this;if(!1===t.editing.isEditing||t.editing.isEditing&&null===t.editing.editColumn)return!1;const i=t.editing.editColumn;return i.canNotify=!1,i.headerEditor.detach(),i.headerEditor.element.parentNode.removeChild(i.headerEditor.element),!0!==e&&(i.label=i.headerEditor.getValue()),i.headerEditor=null,t.editing.isEditing=!1,i.element.removeAttribute("edit"),i.element.scrollLeft=0,t.editing.editColumn=null,i.canNotify=!0,i.refresh(),t._recycle(),!0}_cancelColumnEdit(){this._endColumnEdit(!0)}_onCellClick(e,t){const i=this;if(e.row.addNewRow)e.row.inline||"far"===e.row.freeze?i._insertNewRowAfter():i._insertNewRowBefore();else if(!e.row.filterRow&&i.editing.enabled)if(i.editing.editColumn)i.endEdit();else{if(i.editing.commandColumn.visible)if(e.column.commandColumn){const n=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY);let o=null;for(let e=0;e<n.length;e++)if(n[e].classList.contains("smart-grid-command-item")){o=n[e];break}if(o||(o=e.element.querySelector(".smart-grid-command-item")),o&&!o.classList.contains("smart-hidden")){const n=o.getAttribute("command");return void i._applyCommand(n,[e.row,t])}}else if(i.editing.commandColumn.inline){const e=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.pageX,t.pageY);for(let t=0;t<e.length;t++)if(e[t].classList.contains("smart-grid-command-item"))return}if("none"===i.editing.action&&i.editing.isEditing){let t=!1;i.editing.editCell&&i.editing.editCell.row!==e.row&&(t=!0),i.editing.editRow&&i.editing.editRow!==e.row&&(t=!0),i.editing.editColumn&&(t=!0),t&&i.endEdit()}if(e.column.autoGenerated){if(i.editing.allowRowHeaderEdit&&e.column.rowHeaderColumn){if(i.editing.isEditing&&i.endEdit(),void 0!==e.row.label)return;i._beginCellEdit(e,t),i.editing.isEditing&&i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value})}}else if("click"===i.editing.action&&(!i.selection.enabled||e.selected||"extended"!==i.selection.mode))if("cell"===i.editing.mode){const n=e.parent();if(void 0!==e.row.label)return;i.ensureVisible(e.row.id,e.column.dataField),setTimeout((function(){n?(i._beginCellEdit(n,t),i.$.fireEvent("beginEdit",{id:n.row.id,dataField:n.column.dataField,row:n.row,column:n.column,cell:n,data:n.row.data,value:n.value})):(i._beginCellEdit(e,t),i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value}))}),25)}else if("row"===i.editing.mode){if(void 0!==e.row.label)return;i._beginRowEdit(e.row,e,t),i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value})}}}_onCellDoubleClick(e,t){const i=this;i.editing.enabled&&("doubleClick"!==i.editing.action||i.editing.isEditing||e.column.autoGenerated||("cell"===i.editing.mode?i._beginCellEdit(e,t):"row"===i.editing.mode&&i._beginRowEdit(e.row,e,t)))}_onRowClick(){}_onRowDoubleClick(){}beginEdit(e,t){const i=this,n=i.rowById[e];n&&i._beginEdit(n,t)}cancelEdit(){const e=this;if(e.editing.isEditing){if(e._errorOverlay){if(e._errorOverlay.remove(),e._errorMessage.remove(),e.editing.editCell&&(e.editing.editCell.error=""),e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){t[e].error=""}e.editing.editRow.element.removeAttribute("error"),e.editing.editRow.error=null}e._isUpdating=!1}if(e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){const i=t[e],n=i.element;0===e&&i.row.element.removeAttribute("edit"),n&&(n.removeAttribute("editor"),n.removeAttribute("error"),n.content.innerHTML=""),i.isEditing=!1}e.editing.editRow=null}else e.editing.editCell?(e.editing.editCell.row.element.removeAttribute("edit"),e.editing.editCell.row.element.removeAttribute("error"),e.editing.editCell.element.removeAttribute("editor"),e.editing.editCell.element.removeAttribute("error"),e.editing.editCell.element.content.innerHTML="",e.editing.editCell.isEditing=!1,e.editing.editCell=null):e.editing.editColumn&&e._cancelColumnEdit();e.editing.dialog.visible&&e.editing.dialog.enabled&&e._dialogEdit.close(),e.editing.isEditing=!1,e._recycle(!1),e.editing.commandColumn.visible&&e.refresh(),e.$.fireEvent("cancelEdit"),e.focus()}}removeRow(e,t){return this.deleteRow(e,t)}deleteRow(e,t){const i=this;if(e&&Array.isArray(e)){if(i.onRowRemove){if(!1===i.onRowRemove(e,i))return}i.beginUpdate();const n=i.dataSource.canNotify,o=i.rows.canNotify;i.rows.canNotify=!1,i.dataSource.canNotify=!1;const l=i.onRowRemoved;i.onRowRemoved=null;let a=[];for(let n in e){const o=i.rowById[e[n]];a.push(o.data.$.index),i.deleteRow(e[n],t),i.dataSource.removeAt(o.data.$.index)}return i.rows.canNotify=o,i.dataSource.canNotify=n,i.onRowRemoved=l,i.endUpdate(),i._refreshSummary(),void(l&&l(e,a,i))}const n=i.rowById[e];if(!n)return!1;const o=function(e){if(!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("delete")>=0)i._batchDeleteRow(e);else{if(i.dataSource&&i.dataSource.virtualDataSource)return i._editInfo={row:e.data},void i._virtualDataRequest("remove",(function(n){if(n){const n=i.rows.indexOf(e);i.rows.splice(n,1),delete i.rowById[e.id],t&&t(e)}}));const n=i.rows.indexOf(e);i._removeAt(n)}t&&t(e)};return i.editing.deleteDialog.enabled?i._openDeleteRowDialog(n,o):o(n),!0}addRow(e,t,i){const n=this;e||(e={});for(let t=0;t<n.columns.length;t++){const i=n.columns[t];void 0!==i.defaultValue&&void 0===e[i.dataField]&&(e[i.dataField]=i.defaultValue)}if(void 0===t&&(t=!0),n.dataSource&&n.dataSource.virtualDataSource)n._editInfo={row:e},n._virtualDataRequest("add",(o=>{o&&(n._add(e,t?n.rows.length:0),i&&i(t?n.rows[n.rows.length-1]:n.rows[0]))}));else{if(n.editing.batch)return void(t?n._insertNewRowAfter(i):n._insertNewRowBefore(i));"number"==typeof t?n._add(e,t,i):n._add(e,t?n.rows.length:0,i)}}insertRow(e,t,i){this.addRow(e,t,i)}flashCell(e,t){const i=this;i._flashTimer&&clearTimeout(i._flastTimer),i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell"),i.highlightCell(e,t,"smart-flash-cell"),i._flashTimer=setTimeout((()=>{i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell",delete i.highlightedCells[e][t])}),2e3)}highlightCell(e,t,i){const n=this,o=n.rowById[e],l=n.columnByDataField[t];o&&l&&(n.highlightedCells||(n.highlightedCells=[]),n.highlightedCells[e]||(n.highlightedCells[e]=[]),void 0!==n.highlightedCells[e][t]?i?n.highlightedCells[e][t].startsWith("off")?n.highlightedCells[e][t]=i||"":n.highlightedCells[e][t]="off_"+i:delete n.highlightedCells[e][t]:n.highlightedCells[e][t]=i||"",n._recycle(!1))}highlightRow(e,t){const i=this;i.rowById[e]&&(i.highlightedRows||(i.highlightedRows=[]),void 0!==i.highlightedRows[e]?t?i.highlightedRows[e].startsWith("off")?i.highlightedRows[e]=t||"":i.highlightedRows[e]="off_"+t:delete i.highlightedRows[e]:i.highlightedRows[e]=t||"",i._recycle(!1))}highlightColumn(e,t){const i=this.columnByDataField[e];i.highlight=!i.highlight,i._highlightCSS=t,this._recycle(!1)}setRowProperty(e,t,i){const n=this.rowById[e];n&&(n[t]=i)}getRowProperty(e,t){const i=this.rowById[e];if(i)return i[t]}getColumn(e){const t=this.columnByDataField[e];return t||null}getColumnProperty(e,t){const i=this.columnByDataField[e];if(i)return i[t]}setColumnProperty(e,t,i){const n=this.columnByDataField[e];n&&(n[t]=i)}getCellValue(e,t){const i=this.rowById[e],n=this.columnByDataField[t];if(!i||!n)return;return i.getCell(t).value}setCellValue(e,t,n,o){const l=this,a=l.rowById[e],d=l.columnByDataField[t];if(!a||!d)return!1;let r=[];if(d.validationRules&&d.validationRules.length>0&&(r=((e,t)=>{let n=[];for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}return n})(d.validationRules,n),Object.keys(r).length>0))return!1;const s=()=>{l.beginUpdate();const e=a.getCell(t);l._setCellUndoRedo(e,e.value,n),e.value=n,l.endUpdate(),o&&o(a)};if(l.dataSource&&l.dataSource.virtualDataSource){l.dataSource.id?a[l.dataSource.id]=e:a.id||(a.id=e);const i={};for(let e=0;e<l.columns.length;e++){const o=l.columns[e],d=a.getCell(o.dataField);i[o.dataField]=d.value,o.dataField===t&&(i[o.dataField]=n)}l._editInfo={row:i},l._virtualDataRequest("update",(function(e){e&&s(),l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility()}))}else s()}setRowData(e,t){this.updateRow(e,t,null)}getRowData(e){const t=this.rowById[e];if(!t)return null;const i=JSON.parse(JSON.stringify((e=>{const t={};for(let i in e)"leaf"!==i&&"$"!==i&&"parent"!==i&&"history"!==i&&"comments"!==i&&"style"!==i&&(t[i]=e[i]);return t})(t.data)));return delete i.$,i}getRow(e){const t=this.rowById[e];return t||null}forEachRow(e){const t=this;if(e)for(let i=0;i<t.rows.length;i++)e(t.rows[i])}forEachRowAfterFilterAndSort(e){const t=this;if(e)for(let i=0;i<t._recyclingRows.length;i++)e(t._recyclingRows[i])}getRowById(e){return this.rowById[e]}getRowByIndex(e){const t=this.rows[e];return t||null}getRowId(e){const t=this.rows[e];if(!t)return null;return t.id}validateRow(e,t){const n=this;if(!n.rowById[e])return!1;const o=(e,t)=>{let n=[];for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}return n.filter((e=>{}))},l=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];let a=[];if(void 0!==t[i.dataField])if(i.validationRules&&i.validationRules.length>0){let e=t[i.dataField];e&&e.error&&(e=e.value),a=o(i.validationRules,e),Object.keys(a).length>0&&(l[i.dataField]=a)}else{let e=null,n=t[i.dataField];n&&n.error&&(e=n.validity,n=n.value);for(let t in e)e[t]&&"valid"!==t&&"message"!==t&&(a[t]=!0),("custom"===t&&e[t].minLength||"custom"===t&&e[t].maxLength)&&(a[t]=!0);Object.keys(a).length>0&&(l[i.dataField]=a)}}return l}_updateRow(e,t,i){const n=this,o=n.rowById?n.rowById[e]:n.dataSource.dataItemById[e];if(!o)return;let l=[];n.dataSource&&n.dataSource.groupBy&&n.dataSource.groupBy.toArray&&(l=n.dataSource.groupBy.toArray().slice(0));const a=n.dataSource.boundSource.canNotify;n.dataSource.boundSource.canNotify=!1;const d=e=>{if(o.data[e]=t[e],n.dataSource.id&&o&&o.data&&o.data.$&&(o.data.$.id=t[n.dataSource.id]),o&&o.data.$&&void 0!==o.data.$.index){const i=o.data.$.index,a=n.dataSource.dataSource,d=()=>{const i=t[e];if(null==i){const t=n.columnByDataField[e];return t?"number"===t.dataType?0:"boolean"!==t.dataType&&("date"===t.dataType?new Date:""):""}return i};if(a&&a[i]&&(a[i][e]=d()),n.dataSource[i]){if(l.length>0&&!n._dirtyHierarchy){if(n.dataSource[i][e]!==d()&&l.indexOf(e)>=0){const e=n._getExpandedGroups(n.dataSource.boundHierarchy);n._dirtyHierarchy=e}}n.dataSource[i][e]=d()}}};let r=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];void 0!==t[i.dataField]&&(r[i.dataField]=!0,d(i.dataField))}if(i){const e=n.dataSource.dataFields;if(e)for(let t=0;t<e.length;t++)r[e[t].name]||(e[t].map?d(e[t].map):d(e[t].name))}n.dataSource.boundSource.canNotify=a,n.__updating||n.dataSource.refreshHierarchy()}updateRow(e,t,i){const n=this,o=n.rowById[e];if(!o)return!1;const l=n.validateRow(e,t);if(Object.keys(l).length>0)return!1;const a=()=>{n.beginUpdate();for(let e in t){if("$"===e)continue;const i=o.getCell(e);i?i.value=t[e]:o.data[e]&&(o.data[e]=t[e])}n.endUpdate(),i&&i(o)};n.dataSource&&n.dataSource.virtualDataSource?(n.dataSource.id?t[n.dataSource.id]=e:t.id||(t.id=e),n._editInfo={row:t},n._virtualDataRequest("update",(function(e){e&&a(),n.appearance.displayLoadingIndicator=!1,n._setLoadingIndicatorVisibility()}))):n.onRowUpdate?n.onRowUpdate([e],[o],[o.data],[t],(e=>{e&&a()}),n):a()}addUnboundRow(e,t){const i=this;void 0===e&&(e=1),void 0===t&&(t="far"),i._nearRowsAdded||(i._nearRowsAdded=[],i._farRowsAdded=[]),i._unboundRows||(i._unboundRows=[]),i.beginUpdate();for(let n=0;n<e;n++){const e=Smart.Utilities.Core.createGUID().replace(/-/gi,""),n=new Smart.Grid.Row({index:-1,unbound:!0,id:e,grid:i});i.rowById[n.id]=n,"far"===t?i._farRowsAdded.push(n):i._nearRowsAdded.push(n),i._unboundRows.push(n)}i.endUpdate()}addNewRow(e){const t=this;"near"===e?t._insertNewRowBefore():t._insertNewRowAfter()}_updateRowHistory(e,t,i){const n=this;if(!n._currentUser||n._currentUser&&!n._currentUser.info)return;const o="taskChecklist",l="taskColor",a="taskDueDate",d="taskPriority",r="taskProgress",s="taskStartDate",c="taskStatus",u="taskTags",m="taskText",g="taskDescription",f="taskUserId",p=()=>({user:n._currentUser.info.id,date:e.updatedDate}),h=[];if(i[f]!==t[f]){const n=p();n.action="user";let o=!0;t[f]||i[f]||(o=!1),o&&(n.details={oldValue:t[f],value:i[f]},e.addHistory(n)),h.push(f)}if(""+i[a]!=""+t[a]){const n=p();n.action="deadline",n.details={oldValue:t[a]?new Date(t[a]).toLocaleDateString():"",value:new Date(i[a]).toLocaleDateString()},e.addHistory(n),h.push(a)}if(""+i[s]!=""+t[s]){const n=p();n.action="deadline",n.details={oldValue:t[s]?new Date(t[s]).toLocaleDateString():"",value:new Date(i[s]).toLocaleDateString()},e.addHistory(n),h.push(s)}if(i[l]!==t[l]){const n=p();n.action="color",n.details={oldValue:t[l],value:i[l]},e.addHistory(n),h.push(c)}if(i[c]!==t[c]){const n=p();n.action="status",n.details={oldValue:t[c],value:i[c]},e.addHistory(n),h.push(c)}if(JSON.stringify(i[o])!==JSON.stringify(t[o])){const n=p();n.action="subtasks",n.details={oldValue:t[o],value:i[o]},e.addHistory(n),h.push(o)}else h.push(o);if(void 0!==i[r]&&parseFloat(i[r])!==parseFloat(t[r])){let n=!0;if(null===t[r]&&0===parseFloat(i[r])&&(n=!1),null===(null===t[r]&&i[r])&&(n=!1),n){const n=p();n.action="progress",n.details={oldValue:t[r]?100*t[r]+"%":"0%",value:100*i[r]+"%"},e.addHistory(n)}h.push(r)}if(i[g]!==t[g]){const n=p();n.action="description",n.details={oldValue:t[g],value:i[g]},e.addHistory(n),h.push(g)}if(i[d]!==t[d]){const n=p();n.action="priority",n.details={oldValue:t[d],value:i[d]},e.addHistory(n),h.push(d)}if(i[u]!==t[u]){const n=p();n.action="tags",n.details={oldValue:t[u],value:i[u]},e.addHistory(n),h.push(u)}if(i[m]!==t[m]){const n=p();n.action="text",n.details={oldValue:t[m],value:i[m]},e.addHistory(n),h.push(m)}for(let o=0;o<n.columns.length;o++){const l=n.columns[o].dataField;let a=t[l],d=i[l];if(-1===h.indexOf(l)&&a!==d){const t=p();"date"===n.columns[o].dataType&&(d&&"string"==typeof d&&(d=new Date(d)),a&&"string"==typeof a&&(a=new Date(a))),t.action=l,t.details={oldValue:a,value:d},e.addHistory(t)}}n.onRowHistory&&(n._tempRowHistory||(n._tempRowHistory=[]),n._tempRowHistory[e.index]={index:e.index,row:e,history:e.history},n._tempRowHistoryTimer&&clearTimeout(n._tempRowHistoryTimer),n._tempRowHistoryTimer=setTimeout((()=>{const e=[],t=[],i=[];for(let o in n._tempRowHistory)t.push(o),e.push(n._tempRowHistory[o].row),i.push(n._tempRowHistory[o].history);n.onRowHistory(t,e,i,n),delete n._tempRowHistory}),50))}_stringifyRow(e){const t=this;let i={};for(let n=0;n<t.columns.length;n++){const o=t.columns[n];i[o.dataField]=e.data[o.dataField]}return i=JSON.parse(JSON.stringify(i)),i}endEdit(){const e=this;let t=!1,i=null;e.editing.dialog.enabled&&e.editing.dialog.visible&&e._dialogEdit&&e._dialogEdit.close();let n=null,o=null,l=null;e._fireEndEdit=!0;let a=null,d=null,r=null;if(e.editing.editRow){o=e.editing.editRow,i=e.editing.editRow.id;let n=null;if(e.storeHistory&&(n=e._stringifyRow(o)),t=e._endRowEdit(),a=n,t&&!e.onRowUpdate&&(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory)){const t=e._stringifyRow(o);e._updateRowHistory(o,n,t)}}else if(e.editing.editCell){o=e.editing.editCell.row,l=e.editing.editCell.column,n=e.editing.editCell,i=e.editing.editCell.row.id,r=!0;let s=null;e.storeHistory&&(s=e._stringifyRow(o));const c=void 0!==n.value?n.value:"";d=c,a=s;let u=!1;const m=t=>{if(t!==c){if(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory){const i=e._stringifyRow(o);i[n.column.dataField]=t,e._updateRowHistory(o,s,i)}u=!0}};if(e.onCellUpdate&&e.onRowHistory){const t=e.onRowHistory;e.onRowHistory=null;m(e._getEditorValue(n)),setTimeout((()=>{e.onRowHistory=t}),100)}t=e._endCellEdit(),t&&!u&&e.cell&&m(e.cell.value)}else e.editing.editColumn&&(i=null,l=e.editing.editColumn,t=e._endColumnEdit());if(e._saveUnboundRows(i),e._selection.selectionRect&&e._selection.selectionRect.classList.remove("smart-visibility-hidden"),e.$.scrollView.scrollTop=0,e._fireEndEdit){e.$.fireEvent("endEdit",{id:o?o.id:null,dataField:l?l.dataField:null,row:o,column:l,cell:n,data:o?o.data:null,value:n?n.value:l?l.label:null}).defaultPrevented&&(r?e.setCellValue(o.id,l.dataField,d):e.setRowData(o.id,a))}return e.summaryRow.visible&&t&&(e.editing.isEditing=!1,e._calculateSummary(),e._recycle(!1)),e._refreshDataFilters(),e._renderConditionalFormatting(),t}getEditCells(){const e=this;return e.editing.editRow?e.editing.editRow.cells:e.editing.editCell?[e.editing.editCell]:[]}getBatchEditChanges(){const e=this,t=[],i=[],n=[];for(let i in e._cellsUpdatedValues){const n=e._cellsUpdatedValues[i],o=i.substring(0,i.indexOf("_")),l=i.substring(i.indexOf("_")+1),a=e.rowById[o].getCell(l);t.push({id:o,dataField:l,oldValue:a.value,newValue:n})}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const n=e._rowsDeleted[t],o=e.rowById[n];i.push({id:o.id,data:o.data})}if(e._rowsAdded&&e._rowsAdded.length>0)for(let t=0;t<e._rowsAdded.length;t++){const i=e._rowsAdded[t],o=e.rowById[i];n.push({id:o.id,data:o.data})}return{updated:t,deleted:i,added:n}}saveBatchEdit(){this._saveBatchEdit()}revertBatchEdit(){this._clearBatchEdit(!0)}});const e=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;function t(e){return null==e||0===e.length}class i{static null(e){return null===e}static email(i){return t(i)||e.test(i)?null:{email:!0}}static min(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static max(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static minDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static maxDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static required(e){return t(e)?{required:!0}:null}static requiredTrue(e){return!0===e?null:{required:!0}}static minLength(e,i){return(e=>{if(t(e))return null;const n=e?e.length:0;return n<i?{minlength:{requiredLength:i,actualLength:n}}:null})(e)}static maxLength(e,t){return(e=>{const i=e?e.length:0;return i>t?{maxlength:{requiredLength:t,actualLength:i}}:null})(e)}static url(e){return/^(ftp|http|https):\/\/[^ "]+$/.test(e)?null:{pattern:{requiredPattern:'^(ftp|http|https)://[^ "]+$',actualValue:e}}}static pattern(e,n){if(!n)return i.null;let o,l;return"string"==typeof n?(l="","^"!==n.charAt(0)&&(l+="^"),l+=n,"$"!==n.charAt(n.length-1)&&(l+="$"),o=new RegExp(l)):(l=n.toString(),o=n),(e=>t(e)||o.test(e)?null:{pattern:{requiredPattern:l,actualValue:e}})(e)}}window.Smart.Validator=i})();
|
|
1456
|
+
(()=>{Smart.Utilities.Assign("Grid.Edit",class{_renderCommandBar(){const e=this,t=e.editing.commandBar.dataSource,i="icon"!==e.editing.commandBar.displayMode,n="label"!==e.editing.commandBar.displayMode,o=o=>{for(let l in t){const a=t[l],d=document.createElement("div");d.classList.add("smart-grid-command-item"),d.label=e.localize(l);const r=d.label;let s="";n&&i?(s+='<span class="smart-grid-icon '+a.icon+'"></span>',s+='<span class="smart-grid-label">'+r+"</span>"):n&&!i?s+='<span title="'+r+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(s+='<span class="smart-grid-label">'+r+"</span>"),d.innerHTML=s,a.visible||d.classList.add("smart-hidden"),d.command=a.command,d.onclick=function(){const t=d.command;e._applyCommand(t,[])},o.appendChild(d)}};e.editing.enabled&&e.editing.commandBar.visible&&(e.$.headerCommandBar.innerHTML="",e.$.footerCommandBar.innerHTML="","far"!==e.editing.commandBar.position&&o(e.$.headerCommandBar),"near"!==e.editing.commandBar.position&&o(e.$.footerCommandBar))}commandKeyEditCommand(){const e=this;if(e._selection&&e._selection.focusedCell&&void 0!==e._selection.focusedCell.id){const t=e.rowById[e._selection.focusedCell.id];e.beginEdit(t.id)}}commandKeyCancelCommand(){this.cancelEdit()}commandKeyUpdateCommand(){this.endEdit()}commandColumnMenuCommand(){this._openColumnChooserMenu(this._commandColumn)}commandColumnEditCommand(e){this.beginEdit(e.id)}commandColumnUpdateCommand(){this.endEdit()}commandColumnRowMenuCommand(){}commandColumnCancelCommand(e){const t=this;if(t.editing.batch){const i=t._rowsDeleted?t._rowsDeleted.indexOf(e):-1;i>=0&&t._rowsDeleted.splice(i,1);for(let i=0;i<t.columns.length;i++){const n=t.columns[i].dataField;t._cellsUpdatedValues&&t._cellsUpdatedValues[e.id+"_"+n]&&(delete t._cellsUpdatedValues[e.id+"_"+n],t._cellsUpdatedValues.length--)}t._recycle(!1)}t.cancelEdit()}commandColumnDeleteCommand(e){this.deleteRow(e.id)}_renderAddNewRow(){const e=this;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[];const t=new Smart.Grid.Row({data:{},index:-1,grid:e,freeze:"near",visible:"far"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0}),i=new Smart.Grid.Row({data:{},index:-2,grid:e,freeze:"far",visible:"near"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0});if(e._newNearRow){const t=e._frozenNearRows.indexOf(e._newNearRow);if(t>=0&&(e._frozenNearRows.splice(t,1),e.$.rowNearContainer.children.length>0)){const t=e.$.rowNearContainer.children[0];t.parentNode.removeChild(t)}}if(e._newFarRow){const t=e._frozenFarRows.indexOf(e._newFarRow);if(t>=0&&(e._frozenFarRows.splice(t,1),e.$.rowFarContainer.children.length>0)){const t=e.$.rowFarContainer.children[e.$.rowFarContainer.children.length-1];t.parentNode.removeChild(t)}}e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode&&(e._frozenNearDefaultRows.push(t),e._frozenFarDefaultRows.push(i),e._frozenNearRows.splice(0,0,t),e._frozenFarRows.push(i));const n=()=>{e.editing.addNewRow.autoCreate&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e.addUnboundRow(1),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),"button"===e.editing.addNewRow.displayMode&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e._add({}),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max)};if(e._addRowOnButtonClickHandler||(e._addRowOnButtonClickHandler=n),e._scrollView&&e._scrollView.vScrollBar&&(e._scrollView.vScrollBar.$.farButton.removeEventListener("click",e._addRowOnButtonClickHandler),e._scrollView.vScrollBar.$.farButton.addEventListener("click",e._addRowOnButtonClickHandler)),e._newNearRow=t,e._newFarRow=i,e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){if(!e._newNearRow.element){const t=e._newNearRow,i=t.createElement();t.visible="far"!==e.editing.addNewRow.position,t.element=i,e.$.rowNearContainer.children.length>0?e.$.rowNearContainer.insertBefore(i,e.$.rowNearContainer.children[0]):e.$.rowNearContainer.appendChild(i)}if(!e._newFarRow.element){const t=e._newFarRow,i=t.createElement();t.visible="near"!==e.editing.addNewRow.position,t.element=i,e.$.rowFarContainer.children.length>0?e.$.rowFarContainer.insertBefore(i,e.$.rowFarContainer.children[0]):e.$.rowFarContainer.appendChild(i)}}}_insertNewRowAfter(e){return this._insertNewRowBefore(e,!0)}_insertNewRowBefore(e,t=!1){const i=this,n=new Smart.Grid.Row({index:t?0:-1,id:Smart.Utilities.Core.createGUID(),grid:i}),o={};for(let e=0;e<i.columns.length;e++){const t=i.columns[e];void 0!==t.defaultValue&&(o[t.dataField]=t.defaultValue)}n.data=o;const l=function(t,n){i._suppressSort=i._suppressFilter=!0;const o=e=>{i._supressEnter=!0,i.scrollTop=n?i.scrollHeight:0,i.editing.addDialog.enabled||setTimeout((function(){if(i.editing.enabled&&i.editing.addNewRow.autoEdit){i.ensureVisible(e.id);let t=null;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=()=>{i._selection.focusedCell={id:e.id,dataField:t,index:e.index},i._selection.rows=[],i._selection.columns=[],i._selection.cells=[],i._setSelection(e.id,t)};i.paging.enabled?setTimeout((()=>{if(!e.element){const t=e.createElement();e.element=t}n(),i._beginEdit(e)}),200):(n(),i._beginEdit(e))}}),100),i._suppressSort=i._suppressFilter=!1};!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("add")>=0?(i._batchAddRow(t,n?i.rows.length:0),o(t),e&&e(t)):i.addRow(t.data,n,(t=>{o(t),e&&e(t)}))}.bind(this);return i.editing.addDialog.enabled?i._openAddRowDialog(n,l):l(n,t),!0}commandBarBatchSaveCommand(){this._saveBatchEdit()}commandBarAddRowCommand(){this._insertNewRowAfter()}commandBarAddTopRowCommand(){this._insertNewRowBefore()}commandBarDeleteRowCommand(){const e=this;let t=1,i=e.rows[e.rows.length-t];for(e._rowsDeleted||(e._rowsDeleted=[]);e._rowsDeleted.indexOf(e.rows[e.rows.length-t])>=0;)t++;if(i=e.rows[e.rows.length-t],e.selection.enabled)if(e.selection.allowCellSelection){const t=e.getSelectedCells();if(t.length>0){const n=t[0][0];i=e.rowById[n]}}else{const t=e.getSelectedRowIds();t.length>0&&(i=e.rowById[t[0]])}i&&e.commandColumnDeleteCommand(i)}commandBarBatchRevertCommand(){this.revertBatchEdit()}_beginEdit(e,t){const i=this;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=i.columnByDataField[t];if(i.editing.allowColumnHeaderEdit&&!e&&n)return void i._beginColumnEdit(n);if(!e||!n||n&&n.autoGenerated)return!1;const o=e.getCell(t);if(!o)return!1;i.$.fireEvent("beginEdit",{id:e.id,dataField:n.dataField,row:e,column:n,cell:o,data:o.row.data,value:o.value}).defaultPrevented||("cell"===i.editing.mode?i._beginCellEdit(o):"row"===i.editing.mode&&i._beginRowEdit(e,o))}_saveUnboundRows(e){const t=this;if(t._unboundRows&&t._unboundRows.length>0&&t.editing.addNewRow.autoSave){const i=t.rowById[e];if(!i.unbound)return;const n=t._unboundRows.indexOf(i);if(n<0)return;const o=n+1;t.beginUpdate();for(let e=0;e<o;e++){const i=t._unboundRows[e];if(!i)continue;delete t.rowById[i.id],i.unbound=!1;let n=!1;t._selection.focusedCell&&t._selection.focusedCell.id===i.id&&(n=!0),t._nearRowsAdded&&t._nearRowsAdded.indexOf(i)>=0?(t._nearRowsAdded.splice(t._nearRowsAdded.indexOf(i),1),t._add(0,i.data),n&&(t._selection.focusedCell.id=t.rows[0].id,t._selection.focusedCell.index=t.rows[0].index)):t._farRowsAdded&&t._farRowsAdded.indexOf(i)>=0&&(t._farRowsAdded.splice(t._farRowsAdded.indexOf(i),1),t._add(i.data),n&&(t._selection.focusedCell.id=t.rows[t.rows.length-1].id,t._selection.focusedCell.id=t.rows[t.rows.length-1].index))}t._unboundRows.splice(0,o),t.endUpdate()}}_validateCell(e,t,n){const o=this;if(o._errorOverlay&&(o._errorOverlay.remove(),o._errorMessage.remove(),o._isUpdating=!1),e.column.validationRules||n||e.column.editor&&e.column.editor.onValidate){let l={},a=e._updating;if(e._updating=!0,e.error="",n){for(let i in n)n[i]&&"valid"!==i&&(e.error=n.message),"custom"===i&&n[i].minLength?e.error=o.localize("invalidCellValue",{value:t,validationRule:"minLength: "+n[i].value}):"custom"===i&&n[i].maxLength&&(e.error=o.localize("invalidCellValue",{value:t,validationRule:"maxLength: "+n[i].value}));e.error&&(o._isUpdating=!0)}for(let n of e.column.validationRules){switch(n.type){case"min":l.min=i.min(t,n.value);break;case"max":l.max=i.max(t,n.value);break;case"minLength":l.minLength=i.minLength(t,n.value);break;case"maxLength":l.maxLength=i.maxLength(t,n.value);break;case"minDate":l.minDate=i.minDate(t,n.value);break;case"maxDate":l.maxDate=i.maxDate(t,n.value);break;case"required":l.required=i.required(t);break;case"requiredTrue":l.requiredTrue=i.requiredTrue(t);break;case"pattern":l.pattern=i.pattern(t,n.value);break;case"email":l.email=i.email(t);break;case"null":l.null=i.null(t)}l[n.type]&&(n.message?e.error=n.message:e.error=o.localize("invalidCellValue",{value:t,validationRule:void 0!==n.value?n.type+": "+n.value:n.type}),e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""),o.clearSelection())}if(e.column.editor&&e.column.editor.onValidate){const i=e.column.editor.onValidate(t,e.row.data);"string"==typeof i&&(e.error=i,e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""),o.clearSelection())}if(e._updating=a,e.error){o._errorOverlay=o._createOverlay(),o._errorOverlay.onpointerdown=function(){o.endEdit()};const t=document.createElement("div");t.innerHTML=e.error,t.classList.add("smart-grid-validation-error");const i=o.offset(e.element),n=e.element.getBoundingClientRect(),l=o.offset(o);return i.left=i.left-l.left,i.top=i.top-l.top,i.top+n.height+5-o.offsetTop>o.offsetHeight?t.style.top=i.top-n.height-5-o.offsetTop+"px":t.style.top=i.top+n.height+5-o.offsetTop+"px",t.style.left=i.left-o.offsetLeft+"px",o._errorMessage=t,o.$.root.appendChild(o._errorOverlay),o.$.root.appendChild(o._errorMessage),!1}o._isUpdating=!1}return!0}_endCellEdit(e){const t=this,i=e||t.editing.editCell;if(!i||i&&!i.isEditing)return null;let n=t._getEditorValue(i),o=null;n&&n.error&&(i.canNotify=!1,i.element.setAttribute("error",""),i.row.element.setAttribute("error",""),i.error=!0,i.canNotify=!0,o=n.validity,n=n.value);const l=function(e,t){return"date"===i.column.dataType?e&&t?e.valueOf()===t.valueOf():!e&&!t:!("any"!==i.column.dataType||void 0===e||void 0===t||!Array.isArray(e)||0!==e.length||""!==t)||e===t},a=function(){const e=t._getEditorId(i);t._cellEditors[e].detach(),i.row.element.removeAttribute("edit"),i.element&&(i.element.removeAttribute("editor"),i.element.removeAttribute("error")),i.row.element.removeAttribute("error"),i.isEditing=!1,i.element&&(i.element.content.innerHTML="");const o=function(){t.editing.editRow||(t.dataSource&&t.dataSource.boundHierarchy?(t.dataSource.refreshHierarchy(),t._refreshRowHierarchy(),t.refresh()):t.layout.allowCellsWrap?t.refresh():t._recycle(!1))},a=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,d=void 0!==a?a:i.value,r=()=>{if(t._fireEndEdit){let e=i.value;if(t.editing.batch&&i.row&&i.column){const t=i.modifiedValue;void 0!==t&&(e=t)}t.$.fireEvent("endEdit",{id:i.row.id,dataField:i.column.dataField,row:i.row,column:i.column,cell:i,data:i.row.data,value:e}),t._fireEndEdit=!1}};if(l(n,d))r(),t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1,o());else{const e=function(){t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1),delete t._editInfo};if(!0===t.editing.batch||t.editing.batch&&t.editing.batch.indexOf("update")>=0)e(),t._batchUpdateCell(i.row,i.column,n,i.value),o(),r();else{const l=function(){e(),i._updating=!0,i.value=n,i._updating=!1,o(),r()};if(!t.editing.editRow&&t.dataSource&&t.dataSource.virtualDataSource){const e={};e[i.column.dataField]=n,t.updateRow(i.row.id,e,(()=>{l()}))}else l()}}return t.editing.commandColumn.visible&&!t.editing.commandColumn.width&&"cell"===t.editing.mode&&t.refresh(),t.focus(),!0};let d=t._validateCell(i,n,o);if(!d)return i.editor.instance&&!i.editor.autoOpen&&setTimeout((()=>{i.editor.instance.focus()}),50),!1;const r=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,s=void 0!==r?r:i.value;if(l(n,s))return a(),!!d;if(t._setCellUndoRedo(i,s,n),t.onCellUpdate&&!t.editing.editRow){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e),t.onCellUpdate([i],[s],[n],(function(o){o?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[s],[n],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,s,n)}),t)}else if(t.onRowUpdate){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e);const o=i.column.dataField,l=Object.assign({},i.row.data),d=Object.assign({},i.row.data);d[o]=n,t.onRowUpdate([i.row.index],[i.row],[l],[d],(function(n){n?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onRowUpdated&&t.onRowUpdated([i.row.index],[i.row],[i.row.data],t),t._onRowUpdated&&t._onRowUpdated(i.row.index,i.row,i.row.data)}),t)}else a();return!!d}_endRowEdit(){const e=this,t=e.editing.editRow;if(!t)return!1;let i=!0;const n=t.cells;let o={},l={};t.element.removeAttribute("error");for(let a=0;a<n.length;a++){const d=n[a];let r=e._getEditorValue(d),s=null;r&&r.error&&(d.canNotify=!1,d.element.setAttribute("error",""),d.row.element.setAttribute("error",""),d.error=!0,d.canNotify=!0,s=r.validity,r=r.value),o[d.column.dataField]=d.value,l[d.column.dataField]=r;if(!e._validateCell(d,r,s))return i=!1,t.element.setAttribute("error",""),e._isUpdating=!0,d.editor.instance&&setTimeout((()=>{d.editor.instance.focus()}),50),!1}if(i){const i=function(){const i=e._fireEndEdit;e._fireEndEdit=!1;for(let t=0;t<n.length;t++){const i=n[t];e._endCellEdit(i)}e._fireEndEdit=i,e.onRowUpdate||null===e.onRowUpdated||e.onRowUpdated([t.index],[t],[t.data],e),e.editing.isEditing=!1,e.editing.editRow=null,e.editing.commandColumn.visible&&!e.editing.commandColumn.width?e.refresh():e._recycle(!1)};if(!0===e.editing.batch||e.editing.batch&&e.editing.batch.indexOf("update")>=0)i();else if(e.onRowUpdate){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const n=e._createOverlay();e.$.root.appendChild(n);const a=e.onRowHistory;e.onRowHistory=null,t.updatedDate=new Date,t.updatedBy=e.currentUser,e.storeHistory&&e._updateRowHistory(t,o,l),setTimeout((()=>{e.onRowHistory=a}),100),e.onRowUpdate([t.index],[t],[o],[l],(function(o){const l=e.onRowUpdate,a=e.onCellUpdate;e.onRowUpdate=null,e.onCellUpdate=null,o?i():e.cancelEdit(),e.onRowUpdate=l,e.onCellUpdate=a,e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),n.parentNode.removeChild(n),e.endUpdate(),e.onRowUpdated&&e.onRowUpdated([t.index],[t],[t.data])}),e)}else if(e.dataSource&&e.dataSource.virtualDataSource&&e.editing.isEditing){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const t=e._createOverlay();e.$.root.appendChild(t);let n=Object.assign({},e.editing.editRow.data);for(let t=0;t<e.editing.editRow.cells.length;t++){const i=e.editing.editRow.cells[t];if(!i.column.allowEdit)continue;const o=e._getEditorValue(i);void 0!==o&&(n[i.column.dataField]=o)}e._editInfo={row:n},e._virtualDataRequest("update",(function(n){n?i():e.cancelEdit(),e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),t.parentNode.removeChild(t),e.endUpdate()}))}else i();return!0}return e.focus(),!1}_batchDeleteRow(e){const t=this;t._rowsDeleted||(t._rowsDeleted=[]),t._rowsDeleted.push(e.id),t._recycle(!1)}_batchAddRow(e,t){const i=this;i._rowsAdded||(i._rowsAdded=[]),i._rowsAdded.push(e.id),i.rowById[e.id]=e,e.index=i.rows.length+(i._rowsAdded?i._rowsAdded.length:0),0===t?i._nearRowsAdded.splice(0,0,e):i._farRowsAdded.push(e);i.isInitialized&&i._rowElements&&i._rowElements.length<i.rows.length+i._rowsAdded.length&&i._initializeRowElements(),i.refresh()}_batchUpdateCell(e,t,i,n){const o=this;o._cellsUpdatedValues||(o._cellsUpdatedValues=[]);!function(e,i){return"date"===t.dataType?!(!e&&i)&&(!(e&&!i)&&e.valueOf()===i.valueOf()):e===i}(i,n)?o._cellsUpdatedValues[e.id+"_"+t.dataField]=i:delete o._cellsUpdatedValues[e.id+"_"+t.dataField],o._cellsUpdatedValues.length++}_saveBatchEdit(){const e=this;for(let t in e._cellsUpdatedValues){const i=e._cellsUpdatedValues[t],n=t.substring(0,t.indexOf("_")),o=t.substring(t.indexOf("_")+1),l=e.rowById[n],a=l.getCell(o);if(e.dataSource.virtualDataSource){const t={};t[a.column.dataField]=i,l.data.$&&l.data.$.id?e.updateRow(l.data.$.id,t):(a._updating=!0,a.value=i,a._updating=!1)}else a._updating=!0,a.value=i,a._updating=!1}const t=e._rowsDeleted&&e._rowsDeleted.length>0||e._rowsAdded&&e._rowsAdded.length>0;if(t&&e.beginUpdate(),e._rowsAdded&&e._rowsAdded.length>0)for(let t in e._rowsAdded){const i=e._rowsAdded[t],n=e.rowById[i];if(n){if(e._rowsDeleted&&e._rowsDeleted.length>0){let t=!1;for(let n=0;n<e._rowsDeleted.length;n++){if(e._rowsDeleted[n].id===i){t=!0;break}}if(t)continue}e.dataSource.virtualDataSource?e.addRow(n.data,!0):e._nearRowsAdded.indexOf(n)>=0?e.rows.splice(0,0,n):e._farRowsAdded.indexOf(n)>=0&&e.rows.push(n)}}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const i=e._rowsDeleted[t],n=e.rowById[i];if(n)if(e.dataSource&&e.dataSource.virtualDataSource)e._editInfo={row:n.data},e._virtualDataRequest("remove",(function(t){if(t){const t=e.rows.indexOf(n);e.rows.splice(t,1),delete e.rowById[n.id]}}));else{const t=e.rows.indexOf(n);e.rows.splice(t,1)}}t&&e.endUpdate(),e._clearBatchEdit(!1),e.$.fireEvent("saveBatchEdit")}_clearBatchEdit(){const e=this;let t=!1;e._rowsAdded&&e._rowsAdded.length>0&&(t=!0),e._cellsUpdatedValues=[],e._rowsAdded=[],e._rowsDeleted=[],e._nearRowsAdded=[],e._farRowsAdded=[],t?e.refresh():e._recycle(!1),e.$.fireEvent("clearBatchEdit")}_getEditorId(e){const t=e.column._editorId?e.column._editorId:"";return e.editor!==e.column.editor?e.editor.template+"_"+e.column.dataField+"_"+e.row.id+t:e.editor.template+"_"+e.column.dataField+t}_applyCommand(e,t){const i=this;t||(t=[]);const n=function(){"function"==typeof e?e.apply(i,t):i[e]?i[e].apply(i,t):Smart[e]?Smart[e].apply(i,t):window[e]&&window[e].apply(i,t)};if(i.onCommand){t||(t=[]),t[1]||(t[1]=null);const o={name:e,command:n,details:t[0],event:t[1],handled:!1};setTimeout((()=>{i.onCommand.apply(i,[o]),o.handled||n()}),200)}else n()}_getCommandColumnCommandsTemplate(){const e=this,t=e.editing.commandColumn.dataSource,i="icon"!==e.editing.commandColumn.displayMode,n="label"!==e.editing.commandColumn.displayMode;let o="";for(let l in t){const a=t[l];let d="<div",r=!1;if("commandColumnMenu"===l)continue;r||(d+=' item="'+l+'" command="'+a.command+'" class="smart-grid-command-item">',r=!0);const s="{{messages}}"===a.label?e.localize(l):a.label;n&&i?(d+='<span class="smart-grid-icon '+a.icon+'"></span>',d+='<span class="smart-grid-label">'+s+"</span>"):n&&!i?d+='<span title="'+s+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(d+='<span class="smart-grid-label">'+s+"</span>"),d+="</div>",o+=d}return o}_updateCommandColumnCommandsVisibility(e,t){const i=this,n=e.children,o=i.editing.commandColumn.dataSource;for(let e=0;e<n.length;e++){const l=n[e],a=l.getAttribute("item"),d=o[a].visible;!0===d?l.classList.remove("smart-hidden"):!1===d?l.classList.add("smart-hidden"):"auto"===d&&(!i.editing.dialog.enabled&&(i.editing.editRow===t||i.editing.editCell&&i.editing.editCell.row===t)?"commandColumnEdit"===a?l.classList.add("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.remove("smart-hidden"):"commandColumnEdit"===a?l.classList.remove("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.add("smart-hidden"))}}_handleEditKeyDown(e){const t=this,i=e.key,n=t.editing.commandKeys;if(!t.editing.dialog.enabled)for(let o in n){const l=n[o],a=l.key.replace(/ /gi,"").split("|");if(("Tab"!==i||!t.editing.editRow)&&a.indexOf(i)>=0){if(t._applyCommand(l.command),"Enter"===i&&e){if(e.stopPropagation(),t._supressEnter)return void delete t._supressEnter;t.selection.enabled&&t.selection.allowCellSelection&&t._keyDownHandler(e)}break}}}_getCustomCellEditor(e){const t=this;e.editor.selector=e.editor.template,e.editor.template="custom";const i=t._getEditorId(e);if(!t._cellEditors[i]){let n=document.createElement("div");t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){const t=e.editor.instance.element.firstElementChild;Smart.Utilities.Core.isMobile||(e.editor.focus?setTimeout((function(){e.editor.focus.apply(e.editor.instance.element,[])}),50):setTimeout((function(){t.focus()}),50))},a=function(t){const i=e.editor.instance.element.firstElementChild;e.editor.blur?e.editor.blur.apply(e.editor.instance.element,[t]):i.blur()},d=function(t){const i=e.editor.instance.element.firstElementChild;if(!e.editor.isInitialized&&e.editor.settings&&i)for(let t in e.editor.settings)i[t]=e.editor.settings[t];if(e.editor.setValue)e.editor.setValue.apply(e.editor.instance.element,[t]);else{if(i.innerHTML.indexOf("{{")>=0){const n=i.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,e.row.id);i.innerHTML=n}i.value=t,t instanceof Date&&(i.value=t.toISOString().split("T")[0]),e.editor.instance.element.value=i.value}},r=function(){const t=e.editor.instance.element.firstElementChild;if(e.editor.getValue){const i=t.querySelector("input");return i&&i.blur(),e.editor.getValue.apply(e.editor.instance.element,[t.value])}const i=t.value;return e.editor.settings&&e.editor.settings.valueProperty?i?Array.isArray(i)&&i.length>0?i[0][e.editor.settings.valueProperty]:i[e.editor.settings.valueProperty]:"":i||""},s=function(){n.removeEventListener("keydown",o),e.editor.detach&&e.editor.detach.apply(n,[])},c=function(){n.addEventListener("keydown",o),e.editor.attach&&e.editor.attach.apply(n,[])};let u=null;if((e.editor.selector.startsWith("#")||e.editor.selector.startsWith("."))&&(u=document.querySelector(e.editor.selector)),u)n.appendChild(u.content.cloneNode(!0).firstElementChild);else{const i=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e.editor.selector);if(i){if("#text"===i.nodeName)return t._getInputCellEditor(e);n.appendChild(i)}}t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getSliderCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=document.createElement("input"),l=document.createElement("div"),a=document.createElement("smart-number-input");if(o.type="range",o.step="0.01",t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(a.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);a.numberFormat=i}e.editor.min&&(o.min=a.min=e.editor.min),e.editor.max&&(o.max=a.max=e.editor.max),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-slider-cell-editor"),l.classList.add("nav"),a.classList.add("smart-flex"),a.style.paddingLeft="6px",l.classList.add("smart-icon-resize-full","smart-grid-icon");const d=function(e){if("keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey))return l.click(),void e.preventDefault()};l.onclick=function(){const i=document.createElement("div"),n=document.createElement("input");n.type="range";const d=e.editor.instance.element,r=document.createElement("div");r.classList.add("smart-slider-editor"),i.setAttribute("theme",t.theme),r.appendChild(n);const s=Smart.Utilities.Core.createGUID().replace(/-/gi,"");i.id="Slider"+s,d.setAttribute("aria-owns",i.id),r.classList.add("smart-grid-slider-container"),n.value=o.value,o.min&&(n.min=o.min),o.max&&(n.max=o.max),l.sliderEditorDialog=i,l.popupSlider=n,n.onchange=n.oninput=function(){a.value=parseFloat(n.value)};const c=e=>{e&&e.key&&("Enter"===e.key&&(i.parentNode.removeChild(i),o.value=parseFloat(n.value),t.endEdit()),"Escape"===e.key&&(i.parentNode.removeChild(i),t.cancelEdit()))};a.onchange=a.onkeyup=e=>{n.value=a.value,c(e)},n.onkeydown=function(e){c(e)},i.classList.add("smart-grid-slider-dialog"),i.appendChild(r),document.body.appendChild(i),i.style.top=t._offsetTop(d)+d.offsetHeight+"px",i.style.left=t._offsetLeft(d)+15+d.offsetWidth-i.offsetHeight+"px",i.style.width=d.offsetWidth+"px";const u=t._offsetLeft(t)+t.offsetWidth;t._offsetLeft(d)+i.offsetWidth>u&&(i.style.left=u-i.offsetWidth-10+"px")};let r=e.value;void 0===r&&(r=0),a.value=r,o.value=r,n.appendChild(a);const s=e=>{"Escape"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),t.cancelEdit()),"Enter"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),o.value=parseFloat(a.value),t.endEdit())};return t._cellEditors[i]={element:n,focus:function(){l.click(),Smart.Utilities.Core.isMobile||setTimeout((function(){a.focus(),t.$.scrollView.scrollTop=0}),50)},blur:function(){},setValue:function(e){o.value=void 0!==e&&""!==e?parseFloat(e):0,a.isReady&&a.setValue(e)},getValue:function(){const e=parseFloat(o.value);return l.sliderEditorDialog&&l.sliderEditorDialog.parentNode?(o.value=parseFloat(l.popupSlider.value),o.value):e},attach:function(){o.addEventListener("keydown",d),a.addEventListener("keydown",s)},detach:function(){o.removeEventListener("keydown",d),a.removeEventListener("keydown",s),l.sliderEditorDialog&&l.sliderEditorDialog.parentNode&&(o.value=l.popupSlider.value,l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog))}},t._cellEditors[i]}_getTextAreaCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=document.createElement("textarea"),l=document.createElement("div");t._applyCellEditorUserSettings(n,e),o.style.direction="",t.rightToLeft&&(o.style.direction="rtl"),e.editor.min&&(o.minLength=e.editor.min),e.editor.max&&(o.maxLength=e.editor.max),o.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-text-area-cell-editor"),l.classList.add("nav"),l.classList.add("smart-icon-resize-full","smart-grid-icon");const a=function(e){if("keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey))return l.click(),void e.preventDefault()};l.onclick=function(){const n=document.createElement("div"),a=document.createElement("textarea"),d=e.editor.instance.element,r=document.createElement("div"),s=document.createElement("smart-scroll-bar");n.id="TextArea"+i,d.setAttribute("aria-owns",n.id),t.rightToLeft&&(a.style.direction="rtl"),s.orientation="vertical",s.onpointerdown=e=>{e.preventDefault(),e.stopPropagation()},n.setAttribute("theme",t.theme),r.appendChild(a),r.classList.add("smart-grid-text-area-container"),r.appendChild(s),a.value=o.value,a.classList.add("smart-input"),o.minLength>=0&&(a.minLength=o.minLength),o.maxLength>=0&&(a.maxLength=o.maxLength),l.textAreaEditorDialog=n,l.popupTextArea=a;const c=function(){s.value=a.scrollTop,s.max=a.scrollHeight-a.offsetHeight,s.onChange=null,a.offsetHeight>=a.scrollHeight?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),s.onChange=function(){a.scrollTop=s.value}};if(a.onkeyup=function(){c()},a.onscroll=function(){c()},a.onkeydown=function(e){if(a._key=e.key,"Escape"===e.key){try{n.parentNode.contains(n)&&n.parentNode.removeChild(n)}catch(e){n.error=e}t.editing.editCell&&t.cancelEdit()}("Tab"===e.key||"Enter"===e.key&&e.shiftKey)&&(o.value=a.value,t.editing.editCell?t.endEdit():a.blur(),e.preventDefault(),e.stopPropagation())},n.classList.add("smart-grid-text-area-dialog"),n.appendChild(r),document.body.appendChild(n),setTimeout((function(){Smart.Utilities.Core.isMobile||a.select(),c()}),50),c(),n.style.top=t._offsetTop(d)+"px",n.style.left=t._offsetLeft(d)+"px",n.style.width=d.offsetWidth+"px",t.grouping.enabled&&e.column._treeColumn){const e=d.parentNode.parentNode;n.style.top=t._offsetTop(e)+"px",n.style.left=t._offsetLeft(e)+"px",n.style.width=e.offsetWidth+"px"}a.onblur=()=>{"Escape"!==a._key&&(o.value=l.popupTextArea.value),o.focus();try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}},n.appendChild(o);return t._cellEditors[i]={element:n,focus:function(){l.click()},blur:function(){},setValue:function(e){o.value=e,l.popupTextArea&&(l.popupTextArea.value=o.value)},getValue:function(){const e=o.value;return l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode?(o.value=l.popupTextArea.value,o.value):e},attach:function(){o.addEventListener("keydown",a)},detach:function(){if(o.removeEventListener("keydown",a),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode){o.value=l.popupTextArea.value;try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}}},t._cellEditors[i]}_getColorInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=t._getColorInput();t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-color-input-cell-editor"),n.dropDownWidth=50,n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.rightToLeft=!0);const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(e){n.value=e},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("input");t._applyCellEditorUserSettings(n,e),e.editor.min&&(n.minLength=e.editor.min),e.editor.max&&(n.maxLength=e.editor.max),n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-input-cell-editor"),n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.style.direction="rtl");const o=function(i){if("keydown"===i.type)return"number"!==e.column.dataType&&"int"!==e.column.dataType&&"float"!==e.column.dataType||t.editing.editColumn||i.key.match(/[0-9]/)||"-"===i.key||1!==i.key.length?void t._handleEditKeyDown(i):(i.preventDefault(),void i.stopPropagation())},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(t){if(!e.column.rowHeaderColumn||t){if("number"===e.column.dataType||"int"===e.column.dataType||"float"===e.column.dataType){if(""===t)return;if(t&&!t.toString().match(/[0-9]/)&&"-"!==t)return}n.value=t}else n.value=e.editor.row.visibleIndex+1},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_applyCellEditorUserSettings(e,t){for(let i in t.editor)"template"!==i&&("list"!==i?"onInit"!==i&&"onRender"!==i&&(e[i]=t.editor[i]):e.setAttribute(i,t.editor[i]));if(t.editor.settings)for(let i in t.editor.settings)e[i]=t.editor.settings[i]}_getCheckInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-check-input")}_getMultiInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-multi-input")}_getMultiComboInputCellEditor(e){const t=this._getAutoCompleteCellEditor(e,"smart-multi-combo-input");return"tags"===e.column.template&&(t.getValue=()=>{const e=t.element.selectedItems;if(e&&0===e.length)return"";let i=[];for(let t=0;t<e.length;t++){const n=e[t];"string"==typeof n?i.push(n):i.push(n.value)}return i.toString()},t.setValue=e=>{if(e&&e.indexOf("{")>=0||e&&e.indexOf("[")>=0)t.element.selectedItems=JSON.parse(e);else if(e&&e.indexOf(",")>=0)if(e=e.split(",").map((e=>e.trim())),t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{for(let n=0;n<e.length;n++){const o=e[n];("string"==typeof t&&""+t===o||t&&void 0!==t.label&&""+t.value===o)&&i.push(t)}})),t.element.selectedItems=i}else t.element.selectedItems=e;else if(t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{("string"==typeof t&&""+t===e||t&&void 0!==t.label&&""+t.value===e)&&i.push(t)})),t.element.selectedItems=i}else t.element.value=e},t.focus=function(){if(Smart.Utilities.Core.isMobile)return;const e=t.element;setTimeout((()=>{t.element.readonly?t.element.focus():e&&e.select&&e.select()}),50)}),t}_getAutoCompleteCellEditor(e,t){const i=this,n=i._getEditorId(e);if(i._cellEditors[n]&&e.column.editor.isDirty&&(delete e.column.editor.isDirty,delete i._cellEditors[n]),!i._cellEditors[n]){let o=document.createElement("smart-input");t&&(o=document.createElement(t)),i._applyCellEditorUserSettings(o,e),o.readonly&&(o.dropDownButtonPosition="right");const l=function(e){o.opened||"keydown"!==e.type||i._handleEditKeyDown(e)};o.rightToLeft=i.rightToLeft,o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-auto-complete-cell-editor");const a=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{o&&o.select&&o.select()}),50)},d=function(e){e&&1===e.length&&o.readonly||(o.value=null!==e?e:"")},r=function(){return o.value},s=function(){o&&o.close&&(o.value="",o.close(),o.removeEventListener("keydown",l))},c=function(){},u=function(){o.addEventListener("keydown",l)};i._cellEditors[n]={element:o,focus:a,blur:c,setValue:d,getValue:r,attach:u,detach:s}}if(!e.editor.dataSource&&!e.editor.isInitialized){const t=i.getVisibleRows(),o=[];for(let n=0;n<t.length;n++){let l=i.dataSource[t[n].index];if(l){if(l=l[e.column.dataField],!l)continue;-1===o.indexOf(l)&&o.push(l)}}i._cellEditors[n].element.dataSource=o}return i._cellEditors[n]}_getDateRangeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-range-input");n.dropDownButtonPosition="right",n.dropDownAppendTo="body",n.autoClose=!0,n.selectionMode="default",n.rightToLeft=t.rightToLeft,n.timepicker=!0,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},d=function(){return n._performSelect(),n.selectedDates},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getDateTimePickerCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-time-picker");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,e.column.cellsFormat&&(n.formatString=e.column.cellsFormat),t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(n.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){if("string"==typeof e&&1===e.length){if("string"==typeof e&&n.autoOpen&&"Invalid Date"===(e=new Date(e)).toString())return;n.$.input.value=e}else n.value=e},d=function(){return n.value&&n.value instanceof Smart.Utilities.DateTime?(n._validateValue(n.$.input.value),n.value.toDate()):n.value},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getTimeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-time-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},d=function(){const e=new Date;return e.setHours(n.value[0]),e.setMinutes(n.value[1]),"Invalid Date"===e.toString()?new Date:e},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getDateInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,n.formatString=(!e.column.cellsFormat||1!==e.column.cellsFormat.length&&"d"!==e.column.cellsFormat)&&e.column.cellsFormat?e.column.cellsFormat:"MM/dd/yyyy",t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened?"Enter"!==e.key&&"Escape"!==e.key||t._handleEditKeyDown(e):"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(e.editor.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){"string"==typeof e&&e.length>1&&"Invalid Date"===(e=new Date(e)).toString()||(n.value=e)},d=function(){return n.getValue()},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getImageCellEditor(e){const t=this,i=t._getEditorId(e);if(t._dialogImage&&(t._dialogImage.cell=e),!t._cellEditors[i]){const n=document.createElement("div");n.innerHTML=`\n <div style="display: grid;"><div title="${t.localize("addImages")}" class="smart-grid-icon smart-icon-plus show"></div><div class="images"><div class="container"></div></div></div>\n `,n.rightToLeft=t.rightToLeft,n.tabIndex=0,n.firstElementChild.style.gridTemplateColumns="25px 1fr",t.rightToLeft&&(n.style.direction="rtl");const o=n.querySelector(".smart-grid-icon"),l=n.querySelector(".images");o.onpointerdown=()=>{t._openImageDialog(t._dialogImage?t._dialogImage.cell:e)},l.onclick=e=>{"IMG"===e.target.nodeName&&t._openImagePreviewDialog(e.target)},n.ondrop=i=>{i.preventDefault(),t._openImageDialog(t._dialogImage?t._dialogImage.cell:e),t._dialogImage.dropZone.dropHere(i)},n.ondragover=e=>{e.preventDefault()},t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const a=function(){n.focus(),setTimeout((()=>{n.focus()}),50)},d=function(e){n.value=e,l.innerHTML=`<div class="container"><div style="justify-content: center; align-items: center; display: flex; margin-top: 3px;" class="smart-drop-image smart-micro smart-quiet">${t.localize("dropImages")}</div></div>`;const i=l.firstElementChild;if("string"==typeof e&&(e.indexOf("http")>=0||e.indexOf("base64")>=0)){let t="";try{t=JSON.parse(e)}catch(e){console.log(e)}e=t}Array.isArray(e)&&(i.innerHTML="",e.forEach((e=>{const t=document.createElement("img");t.src=e.value,i.appendChild(t)})))},r=function(){let e=n.value;return e&&(Array.isArray(e)||("string"==typeof e&&e.indexOf("base64"))>=0)&&Array.isArray(e)&&(e=JSON.stringify(e)),e},s=i=>{("+"===i.key||i.altKey&&"ArrowDown"===i.key)&&t._openImageDialog(t._dialogImage?t._dialogImage.cell:e),"Escape"===i.key&&t.cancelEdit(),"Enter"===i.key&&t.endEdit()},c=function(){n.value="",t._dialogImage&&t._dialogImage.close(),t._dialogImagePreview&&t._dialogImagePreview.close(),n.removeEventListener("keydown",s)},u=function(){},m=function(){n.addEventListener("keydown",s)};t._cellEditors[i]={element:n,focus:a,blur:u,setValue:d,getValue:r,attach:m,detach:c}}return t._cellEditors[i]}_getPhoneCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-phone-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-phone-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.value=e,n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1),t._phoneNumbers&&t._phoneNumbers[e]&&(n.selectedCountry=t._phoneNumbers[e])},d=function(){return t._phoneNumbers||(t._phoneNumbers=[]),n.value&&(t._phoneNumbers[n.value]=n.selectedCountry),n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getPasswordCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-password-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-password-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},d=function(){return n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getMaskCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-masked-text-box");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-masked-text-box-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},d=function(){return n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getNumberInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-number-input");if(t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(n.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t,i.minimumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("d")>=0){i={style:"decimal"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("f")>=0||e.column.cellsFormat.indexOf("n")>=0){i={};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.minimumFractionDigits=t,i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);n.numberFormat=i}n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-number-input-cell-editor");const o=function(e){t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.focus(),t.$.scrollView.scrollTop=0}),50)},a=function(){},d=function(e){n.isReady&&("string"==typeof e&&n.numberFormat&&n.numberFormat.style&&"percent"===n.numberFormat.style&&(e=parseFloat(e),e=""+(e/=100)),null!==e&&""!==e||(e=0),n.setValue(e))},r=function(){return n.getValue()},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getCheckBoxCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const e=document.createElement("div");e.classList.add("smart-input"),e.classList.add("smart-grid-cell-editor"),e.classList.add("smart-grid-check-box-cell-editor"),e.tabIndex=0;const n=function(){!0!==e.value&&!1!==e.value&&null!==e.value&&(e.value=!1),null===e.value?e.value=!1:e.value=!e.value,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},o=function(e){if(" "!==e.key){switch(e.key){case"ArrowLeft":case"ArrowDown":case"ArrowRight":case"ArrowUp":if(t.editing.dialog.enabled)return;t.endEdit()}t._handleEditKeyDown(e)}else n()},l=function(t){e.value="string"==typeof t?"false"!==t&&"0"!==t&&"null"!==t&&"undefined"!==t:t,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},a=function(){Smart.Utilities.Core.isMobile||(e.focus(),setTimeout((function(){e.focus()}),25))},d=function(){return e.value},r=function(){e.value=!1,e.removeEventListener("click",n),e.removeEventListener("keydown",o)},s=function(){},c=function(){e.addEventListener("keydown",o),e.addEventListener("click",n)};t._cellEditors[i]={getValue:d,setValue:l,focus:a,blur:s,element:e,detach:r,attach:c}}return t._cellEditors[i]}_getEditorValue(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors)return;const n=t._cellEditors[i];if(!n)return;const o=function(t){switch(e.column.dataType){case"string":t=null==t?"":void 0!==t&&"number"==typeof t?parseFloat(t):t&&"object"==typeof t&&t[0]&&t[0].label?t[0].label.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):t&&"object"==typeof t&&t instanceof Date?t.toLocaleString():t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""");break;case"float":case"int":case"number":t="int"===e.column.dataType?parseInt(t):parseFloat(t),isNaN(t)&&(t=0);break;case"bool":case"boolean":"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1);break;case"date":if(t instanceof Date)return t;"string"==typeof t&&(t=new Date(t));break;case"dateTime":t=new Smart.Utilities.DateTime(t)}return t};let l=null;switch(e.editor.template){case"dateRangeInput":try{l=n.getValue()}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"input":case"autoComplete":case"numberInput":case"slider":case"dateInput":case"timeInput":case"deteTimePicker":case"checkBox":try{l=o(n.getValue())}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"multiComboInput":case"image":l=n.getValue();break;default:l=o(n.getValue())}let a=!0,d=!1,r=!1;if(e.column.validator)a=e.column.validator.evaluate(l,e.row.data);else if("string"==typeof l){const t=e.editor.minLength||e.editor.min||0,i=e.editor.maxLength||e.editor.max||999999;(l.length<t||l>i)&&(a=!1),l.length<t&&(d=!0),l.length>i&&(r=!0),e.editor.required&&0===l.length&&(a=!1),e.editor.instance.element&&e.editor.instance.element.checkValidity&&(a=e.editor.instance.element.checkValidity())}if(a)return l;let s=null;const c=e.editor.instance.element;return c&&(s=c.validity,s&&(s.custom&&delete s.custom,d&&(s.custom={minLength:!0,value:e.editor.min}),r&&(s.custom={maxLength:!0,value:e.editor.max}),s.message=c.validationMessage)),{error:!0,validity:s,value:l}}_beginRowEdit(e,t){const i=this;if(e===i.editing.editRow)return!1;if(i.editing.editRow){if(!i.endEdit())return!1}const n=e.cells;i.editing.editRow=e,i.editing.commandColumn.visible&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),e.isEditing=!0;let o=!1;for(let e=0;e<n.length;e++){const l=n[e],a=l.column;if(!a.allowEdit||!1===a._visible)continue;const d=i._beginCellEdit(l);if(d){if(!0!==i.editing.recordNavigation&&i.editing.enabled){if(Smart.Utilities.Core.isMobile)return;let e=!0;switch(l.editor.template){case"textarea":case"slider":e=!1}e&&(t?l===t&&l.editor.instance.focus():d&&!o&&(o=!0,l.editor.instance.focus()))}i.editing.commandColumn.visible&&l.column.commandColumn&&l.render()}}return!0}_beginCellEdit(e,t){const i=this;if(e.isEditing)return!1;if(i._isUpdating)return!1;if(i.onCellBeginEdit){if(!i.onCellBeginEdit(e.row.id,e.column.dataField,e.value,i))return!1}let n=!1;if(e.column.autoGenerated&&e.column.rowHeaderColumn&&i.editing.allowRowHeaderEdit&&new Date-i._clickTime<i.behavior.doubleClickTimingDelay&&i._clickedCell===e.element&&(n=!0),(!e.column.allowEdit||e.column.autoGenerated||e.readonly)&&!n)return!1;if(i.editing.editCell&&!i.editing.editRow){i._fireEndEdit=!0;if(!1===i._endCellEdit())return!1}if(i._cellEditors||(i._cellEditors=[]),i.editing.editRow||(i.editing.editCell=e),i.editing.commandColumn.visible&&!i.editing.editRow&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),!e.row.element)return!1;e.row.element.setAttribute("edit",""),i.editing.isEditing=!0,i._selection.selectionRect&&i._selection.selectionRect.classList.add("smart-visibility-hidden");const o=t=>{const n=t.element;i.editing.dialog.enabled?i._openEditDialog(e,t):(e.element||e.createElement(),e.element.setAttribute("editor","string"==typeof e.editor.template?e.editor.template:"template"),e.element.content.innerHTML="",e.element.content.appendChild(n),e.column.cellsWrap||e.element.content.classList.add("nowrap"),i.editing.editRow&&e.element.setAttribute("row-editor","")),t.attach(),e.editor.row=e.row,e.editor.column=e.column,e.editor.cell=e,e.editor.instance=t,e.isEditing=!0},l=i._cellsUpdatedValues?i._cellsUpdatedValues[e.row.id+"_"+e.column.dataField]:void 0;let a=void 0!==l?l:e.value;if(void 0===a){a="";const t=e.column;"number"===t.dataType||"int"===t.dataType||"float"===t.dataType?a=0:"date"===t.dataType&&(a=new Date,a.setHours(0,0,0))}switch(e.editor||(e.editor="input"),"string"==typeof e.editor&&(e.canNotify=!1,e.editor={template:e.editor,autoFocus:!0},e.canNotify=!0),e.editor.template){default:case"custom":{const t=i._getCustomCellEditor(e);o(t),t.setValue(a);break}case"image":{const t=i._getImageCellEditor(e);o(t),t.setValue(a);break}case"checkBox":{const n=i._getCheckBoxCellEditor(e);o(n);const l=!0===a||1===a;if("checkBox"===e.template&&t){(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY)[0].classList.contains("smart-input")?n.setValue(!l):n.setValue(l)}else n.setValue(l);break}case"autoComplete":{const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"list":case"dropDownList":{e.editor.autoOpen=!0,e.editor.readonly=!0,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"comboBox":{e.editor.readonly=!1,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"password":{const t=i._getPasswordCellEditor(e);o(t),t.setValue(a);break}case"phone":{const t=i._getPhoneCellEditor(e);o(t),t.setValue(a);break}case"maskedTextBox":{const t=i._getMaskCellEditor(e);o(t),t.setValue(a);break}case"multiInput":{const t=i._getAutoCompleteCellEditor(e,"smart-multi-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"checkInput":{const t=i._getAutoCompleteCellEditor(e,"smart-check-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"multiComboInput":{e.editor.readonly=!0,e.editor.autoOpen=!0;const t=i._getMultiComboInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"timeInput":{const t=i._getTimeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateInput":{const t=i._getDateInputCellEditor(e);o(t),t.setValue(a);break}case"dateRangeInput":{const t=i._getDateRangeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateTimePicker":{const t=i._getDateTimePickerCellEditor(e);o(t),t.setValue(a);break}case"slider":{const t=i._getSliderCellEditor(e);o(t),t.setValue(a);break}case"colorInput":{const t=i._getColorInputCellEditor(e);o(t),t.setValue(a);break}case"textarea":case"textArea":{const t=i._getTextAreaCellEditor(e);o(t),t.setValue(a);break}case"numberInput":case"text":case"input":{const t="numberInput"===e.editor.template?i._getNumberInputCellEditor(e):i._getInputCellEditor(e);o(t),t.setValue(a);break}}if(!e.editor.isInitialized&&(e.editor.isInitialized=!0,e.editor.onInit)){const t=e.editor.onInit(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}if(e.editor.onRender){const t=e.editor.onRender(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}return i.editing.editCell&&e.editor.instance.focus(),!0}_onColumnDoubleClick(e){this._beginColumnEdit(e)}_beginColumnEdit(e){const t=this;if(t.editing.enabled&&t.editing.allowColumnHeaderEdit&&e.allowHeaderEdit){t.editing.isEditing&&t.endEdit(),t.editing.editColumn=e,t._cellEditors||(t._cellEditors=[]);const i=t._getInputCellEditor({column:e,row:t.rows[0],editor:{template:"input"}});i.element.value=e.label,i.focus(),e.headerEditor=i,e.element.setAttribute("edit",""),e.element.label.appendChild(i.element),i.attach(),t.editing.isEditing=!0,t.$.fireEvent("beginEdit",{id:null,dataField:e.dataField,row:null,column:e,cell:null,data:null,value:null})}}_endColumnEdit(e){const t=this;if(!1===t.editing.isEditing||t.editing.isEditing&&null===t.editing.editColumn)return!1;const i=t.editing.editColumn;return i.canNotify=!1,i.headerEditor.detach(),i.headerEditor.element.parentNode.removeChild(i.headerEditor.element),!0!==e&&(i.label=i.headerEditor.getValue()),i.headerEditor=null,t.editing.isEditing=!1,i.element.removeAttribute("edit"),i.element.scrollLeft=0,t.editing.editColumn=null,i.canNotify=!0,i.refresh(),t._recycle(),!0}_cancelColumnEdit(){this._endColumnEdit(!0)}_onCellClick(e,t){const i=this;if(e.row.addNewRow)e.row.inline||"far"===e.row.freeze?i._insertNewRowAfter():i._insertNewRowBefore();else if(!e.row.filterRow&&i.editing.enabled)if(i.editing.editColumn)i.endEdit();else{if(i.editing.commandColumn.visible)if(e.column.commandColumn){const n=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY);let o=null;for(let e=0;e<n.length;e++)if(n[e].classList.contains("smart-grid-command-item")){o=n[e];break}if(o||(o=e.element.querySelector(".smart-grid-command-item")),o&&!o.classList.contains("smart-hidden")){const n=o.getAttribute("command");return void i._applyCommand(n,[e.row,t])}}else if(i.editing.commandColumn.inline){const e=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.pageX,t.pageY);for(let t=0;t<e.length;t++)if(e[t].classList.contains("smart-grid-command-item"))return}if("none"===i.editing.action&&i.editing.isEditing){let t=!1;i.editing.editCell&&i.editing.editCell.row!==e.row&&(t=!0),i.editing.editRow&&i.editing.editRow!==e.row&&(t=!0),i.editing.editColumn&&(t=!0),t&&i.endEdit()}if(e.column.autoGenerated){if(i.editing.allowRowHeaderEdit&&e.column.rowHeaderColumn){if(i.editing.isEditing&&i.endEdit(),void 0!==e.row.label)return;i._beginCellEdit(e,t),i.editing.isEditing&&i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value})}}else if("click"===i.editing.action&&(!i.selection.enabled||e.selected||"extended"!==i.selection.mode))if("cell"===i.editing.mode){const n=e.parent();if(void 0!==e.row.label)return;i.ensureVisible(e.row.id,e.column.dataField),setTimeout((function(){n?(i._beginCellEdit(n,t),i.$.fireEvent("beginEdit",{id:n.row.id,dataField:n.column.dataField,row:n.row,column:n.column,cell:n,data:n.row.data,value:n.value})):(i._beginCellEdit(e,t),i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value}))}),25)}else if("row"===i.editing.mode){if(void 0!==e.row.label)return;i._beginRowEdit(e.row,e,t),i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value})}}}_onCellDoubleClick(e,t){const i=this;i.editing.enabled&&("doubleClick"!==i.editing.action||i.editing.isEditing||e.column.autoGenerated||("cell"===i.editing.mode?i._beginCellEdit(e,t):"row"===i.editing.mode&&i._beginRowEdit(e.row,e,t)))}_onRowClick(){}_onRowDoubleClick(){}beginEdit(e,t){const i=this,n=i.rowById[e];n&&i._beginEdit(n,t)}cancelEdit(){const e=this;if(e.editing.isEditing){if(e._errorOverlay){if(e._errorOverlay.remove(),e._errorMessage.remove(),e.editing.editCell&&(e.editing.editCell.error=""),e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){t[e].error=""}e.editing.editRow.element.removeAttribute("error"),e.editing.editRow.error=null}e._isUpdating=!1}if(e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){const i=t[e],n=i.element;0===e&&i.row.element.removeAttribute("edit"),n&&(n.removeAttribute("editor"),n.removeAttribute("error"),n.content.innerHTML=""),i.isEditing=!1}e.editing.editRow=null}else e.editing.editCell?(e.editing.editCell.row.element.removeAttribute("edit"),e.editing.editCell.row.element.removeAttribute("error"),e.editing.editCell.element.removeAttribute("editor"),e.editing.editCell.element.removeAttribute("error"),e.editing.editCell.element.content.innerHTML="",e.editing.editCell.isEditing=!1,e.editing.editCell=null):e.editing.editColumn&&e._cancelColumnEdit();e.editing.dialog.visible&&e.editing.dialog.enabled&&e._dialogEdit.close(),e.editing.isEditing=!1,e._recycle(!1),e.editing.commandColumn.visible&&e.refresh(),e.$.fireEvent("cancelEdit"),e.focus()}}removeRow(e,t){return this.deleteRow(e,t)}deleteRow(e,t){const i=this;if(e&&Array.isArray(e)){if(i.onRowRemove){if(!1===i.onRowRemove(e,i))return}i.beginUpdate();const n=i.dataSource.canNotify,o=i.rows.canNotify;i.rows.canNotify=!1,i.dataSource.canNotify=!1;const l=i.onRowRemoved;i.onRowRemoved=null;let a=[];for(let n in e){const o=i.rowById[e[n]];a.push(o.data.$.index),i.deleteRow(e[n],t),i.dataSource.removeAt(o.data.$.index)}return i.rows.canNotify=o,i.dataSource.canNotify=n,i.onRowRemoved=l,i.endUpdate(),i._refreshSummary(),void(l&&l(e,a,i))}const n=i.rowById[e];if(!n)return!1;const o=function(e){if(!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("delete")>=0)i._batchDeleteRow(e);else{if(i.dataSource&&i.dataSource.virtualDataSource)return i._editInfo={row:e.data},void i._virtualDataRequest("remove",(function(n){if(n){const n=i.rows.indexOf(e);i.rows.splice(n,1),delete i.rowById[e.id],t&&t(e)}}));const n=i.rows.indexOf(e);i._removeAt(n)}t&&t(e)};return i.editing.deleteDialog.enabled?i._openDeleteRowDialog(n,o):o(n),!0}addRow(e,t,i){const n=this;e||(e={});for(let t=0;t<n.columns.length;t++){const i=n.columns[t];void 0!==i.defaultValue&&void 0===e[i.dataField]&&(e[i.dataField]=i.defaultValue)}if(void 0===t&&(t=!0),n.dataSource&&n.dataSource.virtualDataSource)n._editInfo={row:e},n._virtualDataRequest("add",(o=>{o&&(n._add(e,t?n.rows.length:0),i&&i(t?n.rows[n.rows.length-1]:n.rows[0]))}));else{if(n.editing.batch)return void(t?n._insertNewRowAfter(i):n._insertNewRowBefore(i));"number"==typeof t?n._add(e,t,i):n._add(e,t?n.rows.length:0,i)}}insertRow(e,t,i){this.addRow(e,t,i)}flashCell(e,t){const i=this;i._flashTimer&&clearTimeout(i._flastTimer),i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell"),i.highlightCell(e,t,"smart-flash-cell"),i._flashTimer=setTimeout((()=>{i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell",delete i.highlightedCells[e][t])}),2e3)}highlightCell(e,t,i){const n=this,o=n.rowById[e],l=n.columnByDataField[t];o&&l&&(n.highlightedCells||(n.highlightedCells=[]),n.highlightedCells[e]||(n.highlightedCells[e]=[]),void 0!==n.highlightedCells[e][t]?i?n.highlightedCells[e][t].startsWith("off")?n.highlightedCells[e][t]=i||"":n.highlightedCells[e][t]="off_"+i:delete n.highlightedCells[e][t]:n.highlightedCells[e][t]=i||"",n._recycle(!1))}highlightRow(e,t){const i=this;i.rowById[e]&&(i.highlightedRows||(i.highlightedRows=[]),void 0!==i.highlightedRows[e]?t?i.highlightedRows[e].startsWith("off")?i.highlightedRows[e]=t||"":i.highlightedRows[e]="off_"+t:delete i.highlightedRows[e]:i.highlightedRows[e]=t||"",i._recycle(!1))}highlightColumn(e,t){const i=this.columnByDataField[e];i.highlight=!i.highlight,i._highlightCSS=t,this._recycle(!1)}setRowProperty(e,t,i){const n=this.rowById[e];n&&(n[t]=i)}getRowProperty(e,t){const i=this.rowById[e];if(i)return i[t]}getColumn(e){const t=this.columnByDataField[e];return t||null}getColumnProperty(e,t){const i=this.columnByDataField[e];if(i)return i[t]}setColumnProperty(e,t,i){const n=this.columnByDataField[e];n&&(n[t]=i)}getCellValue(e,t){const i=this.rowById[e],n=this.columnByDataField[t];if(!i||!n)return;return i.getCell(t).value}setCellValue(e,t,n,o){const l=this,a=l.rowById[e],d=l.columnByDataField[t];if(!a||!d)return!1;let r=[];if(d.validationRules&&d.validationRules.length>0&&(r=((e,t)=>{let n=[];for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}return n})(d.validationRules,n),Object.keys(r).length>0))return!1;const s=()=>{l.beginUpdate();const e=a.getCell(t);l._setCellUndoRedo(e,e.value,n),e.value=n,l.endUpdate(),o&&o(a)};if(l.dataSource&&l.dataSource.virtualDataSource){l.dataSource.id?a[l.dataSource.id]=e:a.id||(a.id=e);const i={};for(let e=0;e<l.columns.length;e++){const o=l.columns[e],d=a.getCell(o.dataField);i[o.dataField]=d.value,o.dataField===t&&(i[o.dataField]=n)}l._editInfo={row:i},l._virtualDataRequest("update",(function(e){e&&s(),l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility()}))}else s()}setRowData(e,t){this.updateRow(e,t,null)}getRowData(e){const t=this.rowById[e];if(!t)return null;const i=JSON.parse(JSON.stringify((e=>{const t={};for(let i in e)"leaf"!==i&&"$"!==i&&"parent"!==i&&"history"!==i&&"comments"!==i&&"style"!==i&&(t[i]=e[i]);return t})(t.data)));return delete i.$,i}getRow(e){const t=this.rowById[e];return t||null}forEachRow(e){const t=this;if(e)for(let i=0;i<t.rows.length;i++)e(t.rows[i])}forEachRowAfterFilterAndSort(e){const t=this;if(e)for(let i=0;i<t._recyclingRows.length;i++)e(t._recyclingRows[i])}getRowById(e){return this.rowById[e]}getRowByIndex(e){const t=this.rows[e];return t||null}getRowId(e){const t=this.rows[e];if(!t)return null;return t.id}validateRow(e,t){const n=this;if(!n.rowById[e])return!1;const o=(e,t)=>{let n=[];for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}return n.filter((e=>{}))},l=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];let a=[];if(void 0!==t[i.dataField])if(i.validationRules&&i.validationRules.length>0){let e=t[i.dataField];e&&e.error&&(e=e.value),a=o(i.validationRules,e),Object.keys(a).length>0&&(l[i.dataField]=a)}else{let e=null,n=t[i.dataField];n&&n.error&&(e=n.validity,n=n.value);for(let t in e)e[t]&&"valid"!==t&&"message"!==t&&(a[t]=!0),("custom"===t&&e[t].minLength||"custom"===t&&e[t].maxLength)&&(a[t]=!0);Object.keys(a).length>0&&(l[i.dataField]=a)}}return l}_updateRow(e,t,i){const n=this,o=n.rowById?n.rowById[e]:n.dataSource.dataItemById[e];if(!o)return;let l=[];n.dataSource&&n.dataSource.groupBy&&n.dataSource.groupBy.toArray&&(l=n.dataSource.groupBy.toArray().slice(0));const a=n.dataSource.boundSource.canNotify;n.dataSource.boundSource.canNotify=!1;const d=e=>{if(o.data[e]=t[e],n.dataSource.id&&o&&o.data&&o.data.$&&(o.data.$.id=t[n.dataSource.id]),o&&o.data.$&&void 0!==o.data.$.index){const i=o.data.$.index,a=n.dataSource.dataSource,d=()=>{const i=t[e];if(null==i){const t=n.columnByDataField[e];return t?"number"===t.dataType?0:"boolean"!==t.dataType&&("date"===t.dataType?new Date:""):""}return i};if(a&&a[i]&&(a[i][e]=d()),n.dataSource[i]){if(l.length>0&&!n._dirtyHierarchy){if(n.dataSource[i][e]!==d()&&l.indexOf(e)>=0){const e=n._getExpandedGroups(n.dataSource.boundHierarchy);n._dirtyHierarchy=e}}n.dataSource[i][e]=d()}}};let r=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];void 0!==t[i.dataField]&&(r[i.dataField]=!0,d(i.dataField))}if(i){const e=n.dataSource.dataFields;if(e)for(let t=0;t<e.length;t++)r[e[t].name]||(e[t].map?d(e[t].map):d(e[t].name))}n.dataSource.boundSource.canNotify=a,n.__updating||n.dataSource.refreshHierarchy()}updateRow(e,t,i){const n=this,o=n.rowById[e];if(!o)return!1;const l=n.validateRow(e,t);if(Object.keys(l).length>0)return!1;const a=()=>{n.beginUpdate();for(let e in t){if("$"===e)continue;const i=o.getCell(e);i?i.value=t[e]:o.data[e]&&(o.data[e]=t[e])}n.endUpdate(),i&&i(o)};n.dataSource&&n.dataSource.virtualDataSource?(n.dataSource.id?t[n.dataSource.id]=e:t.id||(t.id=e),n._editInfo={row:t},n._virtualDataRequest("update",(function(e){e&&a(),n.appearance.displayLoadingIndicator=!1,n._setLoadingIndicatorVisibility()}))):n.onRowUpdate?n.onRowUpdate([e],[o],[o.data],[t],(e=>{e&&a()}),n):a()}addUnboundRow(e,t){const i=this;void 0===e&&(e=1),void 0===t&&(t="far"),i._nearRowsAdded||(i._nearRowsAdded=[],i._farRowsAdded=[]),i._unboundRows||(i._unboundRows=[]),i.beginUpdate();for(let n=0;n<e;n++){const e=Smart.Utilities.Core.createGUID().replace(/-/gi,""),n=new Smart.Grid.Row({index:-1,unbound:!0,id:e,grid:i});i.rowById[n.id]=n,"far"===t?i._farRowsAdded.push(n):i._nearRowsAdded.push(n),i._unboundRows.push(n)}i.endUpdate()}addNewRow(e){const t=this;"near"===e?t._insertNewRowBefore():t._insertNewRowAfter()}_updateRowHistory(e,t,i){const n=this;if(!n._currentUser||n._currentUser&&!n._currentUser.info)return;const o="taskChecklist",l="taskColor",a="taskDueDate",d="taskPriority",r="taskProgress",s="taskStartDate",c="taskStatus",u="taskTags",m="taskText",g="taskDescription",f="taskUserId",p=()=>({user:n._currentUser.info.id,date:e.updatedDate}),h=[];if(i[f]!==t[f]){const n=p();n.action="user";let o=!0;t[f]||i[f]||(o=!1),o&&(n.details={oldValue:t[f],value:i[f]},e.addHistory(n)),h.push(f)}if(""+i[a]!=""+t[a]){const n=p();n.action="deadline",n.details={oldValue:t[a]?new Date(t[a]).toLocaleDateString():"",value:new Date(i[a]).toLocaleDateString()},e.addHistory(n),h.push(a)}if(""+i[s]!=""+t[s]){const n=p();n.action="deadline",n.details={oldValue:t[s]?new Date(t[s]).toLocaleDateString():"",value:new Date(i[s]).toLocaleDateString()},e.addHistory(n),h.push(s)}if(i[l]!==t[l]){const n=p();n.action="color",n.details={oldValue:t[l],value:i[l]},e.addHistory(n),h.push(c)}if(i[c]!==t[c]){const n=p();n.action="status",n.details={oldValue:t[c],value:i[c]},e.addHistory(n),h.push(c)}if(JSON.stringify(i[o])!==JSON.stringify(t[o])){const n=p();n.action="subtasks",n.details={oldValue:t[o],value:i[o]},e.addHistory(n),h.push(o)}else h.push(o);if(void 0!==i[r]&&parseFloat(i[r])!==parseFloat(t[r])){let n=!0;if(null===t[r]&&0===parseFloat(i[r])&&(n=!1),null===(null===t[r]&&i[r])&&(n=!1),n){const n=p();n.action="progress",n.details={oldValue:t[r]?100*t[r]+"%":"0%",value:100*i[r]+"%"},e.addHistory(n)}h.push(r)}if(i[g]!==t[g]){const n=p();n.action="description",n.details={oldValue:t[g],value:i[g]},e.addHistory(n),h.push(g)}if(i[d]!==t[d]){const n=p();n.action="priority",n.details={oldValue:t[d],value:i[d]},e.addHistory(n),h.push(d)}if(i[u]!==t[u]){const n=p();n.action="tags",n.details={oldValue:t[u],value:i[u]},e.addHistory(n),h.push(u)}if(i[m]!==t[m]){const n=p();n.action="text",n.details={oldValue:t[m],value:i[m]},e.addHistory(n),h.push(m)}for(let o=0;o<n.columns.length;o++){const l=n.columns[o].dataField;let a=t[l],d=i[l];if(-1===h.indexOf(l)&&a!==d){const t=p();"date"===n.columns[o].dataType&&(d&&"string"==typeof d&&(d=new Date(d)),a&&"string"==typeof a&&(a=new Date(a))),t.action=l,t.details={oldValue:a,value:d},e.addHistory(t)}}n.onRowHistory&&(n._tempRowHistory||(n._tempRowHistory=[]),n._tempRowHistory[e.index]={index:e.index,row:e,history:e.history},n._tempRowHistoryTimer&&clearTimeout(n._tempRowHistoryTimer),n._tempRowHistoryTimer=setTimeout((()=>{const e=[],t=[],i=[];for(let o in n._tempRowHistory)t.push(o),e.push(n._tempRowHistory[o].row),i.push(n._tempRowHistory[o].history);n.onRowHistory(t,e,i,n),delete n._tempRowHistory}),50))}_stringifyRow(e){const t=this;let i={};for(let n=0;n<t.columns.length;n++){const o=t.columns[n];i[o.dataField]=e.data[o.dataField]}return i=JSON.parse(JSON.stringify(i)),i}endEdit(){const e=this;let t=!1,i=null;e.editing.dialog.enabled&&e.editing.dialog.visible&&e._dialogEdit&&e._dialogEdit.close();let n=null,o=null,l=null;e._fireEndEdit=!0;let a=null,d=null,r=null;if(e.editing.editRow){o=e.editing.editRow,i=e.editing.editRow.id;let n=null;if(e.storeHistory&&(n=e._stringifyRow(o)),t=e._endRowEdit(),a=n,t&&!e.onRowUpdate&&(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory)){const t=e._stringifyRow(o);e._updateRowHistory(o,n,t)}}else if(e.editing.editCell){o=e.editing.editCell.row,l=e.editing.editCell.column,n=e.editing.editCell,i=e.editing.editCell.row.id,r=!0;let s=null;e.storeHistory&&(s=e._stringifyRow(o));const c=void 0!==n.value?n.value:"";d=c,a=s;let u=!1;const m=t=>{if(t!==c){if(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory){const i=e._stringifyRow(o);i[n.column.dataField]=t,e._updateRowHistory(o,s,i)}u=!0}};if(e.onCellUpdate&&e.onRowHistory){const t=e.onRowHistory;e.onRowHistory=null;m(e._getEditorValue(n)),setTimeout((()=>{e.onRowHistory=t}),100)}t=e._endCellEdit(),t&&!u&&e.cell&&m(e.cell.value)}else e.editing.editColumn&&(i=null,l=e.editing.editColumn,t=e._endColumnEdit());if(e._saveUnboundRows(i),e._selection.selectionRect&&e._selection.selectionRect.classList.remove("smart-visibility-hidden"),e.$.scrollView.scrollTop=0,e._fireEndEdit){e.$.fireEvent("endEdit",{id:o?o.id:null,dataField:l?l.dataField:null,row:o,column:l,cell:n,data:o?o.data:null,value:n?n.value:l?l.label:null}).defaultPrevented&&(r?e.setCellValue(o.id,l.dataField,d):e.setRowData(o.id,a))}return e.summaryRow.visible&&t&&(e.editing.isEditing=!1,e._calculateSummary(),e._recycle(!1)),e._refreshDataFilters(),e._renderConditionalFormatting(),t}getEditCells(){const e=this;return e.editing.editRow?e.editing.editRow.cells:e.editing.editCell?[e.editing.editCell]:[]}getBatchEditChanges(){const e=this,t=[],i=[],n=[];for(let i in e._cellsUpdatedValues){const n=e._cellsUpdatedValues[i],o=i.substring(0,i.indexOf("_")),l=i.substring(i.indexOf("_")+1),a=e.rowById[o].getCell(l);t.push({id:o,dataField:l,oldValue:a.value,newValue:n})}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const n=e._rowsDeleted[t],o=e.rowById[n];i.push({id:o.id,data:o.data})}if(e._rowsAdded&&e._rowsAdded.length>0)for(let t=0;t<e._rowsAdded.length;t++){const i=e._rowsAdded[t],o=e.rowById[i];n.push({id:o.id,data:o.data})}return{updated:t,deleted:i,added:n}}saveBatchEdit(){this._saveBatchEdit()}revertBatchEdit(){this._clearBatchEdit(!0)}});const e=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;function t(e){return null==e||0===e.length}class i{static null(e){return null===e}static email(i){return t(i)||e.test(i)?null:{email:!0}}static min(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static max(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static minDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static maxDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static required(e){return t(e)?{required:!0}:null}static requiredTrue(e){return!0===e?null:{required:!0}}static minLength(e,i){return(e=>{if(t(e))return null;const n=e?e.length:0;return n<i?{minlength:{requiredLength:i,actualLength:n}}:null})(e)}static maxLength(e,t){return(e=>{const i=e?e.length:0;return i>t?{maxlength:{requiredLength:t,actualLength:i}}:null})(e)}static url(e){return/^(ftp|http|https):\/\/[^ "]+$/.test(e)?null:{pattern:{requiredPattern:'^(ftp|http|https)://[^ "]+$',actualValue:e}}}static pattern(e,n){if(!n)return i.null;let o,l;return"string"==typeof n?(l="","^"!==n.charAt(0)&&(l+="^"),l+=n,"$"!==n.charAt(n.length-1)&&(l+="$"),o=new RegExp(l)):(l=n.toString(),o=n),(e=>t(e)||o.test(e)?null:{pattern:{requiredPattern:l,actualValue:e}})(e)}}window.Smart.Validator=i})();
|
|
1457
1457
|
|
|
1458
1458
|
/***/ }),
|
|
1459
1459
|
|
|
@@ -1481,7 +1481,7 @@ Smart.Utilities.Assign("Grid.Filter",class{addFilter(e,t,l){const i=this,a=i.col
|
|
|
1481
1481
|
/***/ 7333:
|
|
1482
1482
|
/***/ (() => {
|
|
1483
1483
|
|
|
1484
|
-
Smart.Utilities.Assign("Grid.Menu",class{_openColumnChooserMenu(e){const t=this;if(e||(e=t._commandColumn),!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t._createColumnChooserMenuItems(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e,t._filterContainer&&("none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"));let l=n.right-n.width+window.pageXOffset,i=n.bottom+window.pageYOffset;l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,t.menu.classList.add("smart-open-right"),l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth)),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open")}_openColumnFilterMenu(e){const t=this;if(!e||t.filterRowMenu&&t.filterRowMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.filterRowMenu||(t.filterRowMenu=document.createElement("div"),t.filterRowMenu.classList.add("smart-grid-column-menu"),t.filterRowMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowMenu.classList.add("smart-animate"):t.filterRowMenu.classList.remove("smart-animate"),t._createColumnFilterMenuItems(e),t.filterRowMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowMenu.column&&t.filterRowMenu.column!==e&&(t.filterRowMenu.column.setProperty("menu",null),t.filterRowMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowMenu):document.body.appendChild(t.filterRowMenu),e.setProperty("filterRowMenu",t.filterRowMenu);const n=e.element.getBoundingClientRect();t.filterRowMenu.column=e;let l=n.left+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowMenu.offsetWidth,l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowMenu.offsetWidth)),t.filterRowMenu.style.left=l+"px",t.filterRowMenu.style.top=i+"px",t.filterRowMenu.classList.remove("smart-hidden"),t.filterRowMenu.classList.add("open"),setTimeout((()=>{t.filterRowMenu.querySelector("smart-menu").focus()}),50),t.filterRowMenu}openContextMenu(e,t){const n=this;if(n.contextMenu.selector){const l=document.querySelector(n.contextMenu.selector);l&&setTimeout((()=>{l.open(e,t)}),100)}else n._closeMenu(n._contextMenu),n._contextMenu||(n._contextMenu=document.createElement("div"),n._contextMenu.classList.add("smart-grid-column-menu"),n._contextMenu.setAttribute("theme",n.getAttribute("theme")),n._contextMenu.id=n.id+"_"+n.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),n.menu=n._contextMenu),n.appearance.allowColumnMenuAnimation?n._contextMenu.classList.add("smart-animate"):n._contextMenu.classList.remove("smart-animate"),n.rightToLeft?n._contextMenu.setAttribute("right-to-left",""):n._contextMenu.removeAttribute("right-to-left"),n.contextMenu.dataField?n._contextMenu.column=n.columnByDataField[n.contextMenu.dataField]:n._contextMenu.column=n.columns[0],n._createContextMenuItems(n._contextMenu),n._contextMenu.style.height=n.contextMenu.height?n.contextMenu.height+"px":"auto",n._contextMenu.style.width=n.contextMenu.width?n.contextMenu.width+"px":"auto",n.isInShadowDOM?n.getRootNode().appendChild(n.menu):document.body.appendChild(n._contextMenu),n._contextMenu.style.left=e+"px",n._contextMenu.style.top=t+"px",n._contextMenu.classList.remove("smart-hidden"),n._contextMenu.classList.add("open"),setTimeout((()=>{n._contextMenu&&n._contextMenu.querySelector("smart-menu").focus()}),50)}_openMenu(e){const t=this;if(!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls")||!1===t.columnMenu.enabled)return void t.closeMenu();t._closeMenu(t.filterRowMenu),t.$.headerBar&&t.header.visible&&t.$.headerBar.closePanel(),t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t.rightToLeft?t.menu.setAttribute("right-to-left",""):t.menu.removeAttribute("right-to-left"),t._createMenuItems(e),t._createFilterPanel(e),t._filterMenuItemsVisibility(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e;let l=n.right-e.element.actionButton.getBoundingClientRect().width+window.pageXOffset,i=n.bottom+window.pageYOffset;t.menu.classList.remove("smart-open-right"),t.rightToLeft&&(l=n.left+window.pageXOffset-t.menu.offsetWidth+e.element.actionButton.getBoundingClientRect().width,l<0&&(l=n.left+window.pageXOffset)),l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth),t.menu.classList.add("smart-open-right")),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.hasColumnMenu(e)?t.menu.classList.remove("smart-hidden"):t.closeMenu(),t.menu.classList.add("open"),setTimeout((()=>{t.menu&&(t.menu.querySelector(".smart-filter-panel-input")?t.menu.querySelector(".smart-filter-panel-input").focus():t.menu.querySelector("smart-menu").focus())}),50)}_menuItemClick(e){const t=this,n=e.detail.value;if(n&&n.properties){const e=n.properties.command;"function"==typeof e?e.apply(t,[n.column,n.properties]):t[e]&&t[e].apply(t,[n.column,n.properties]),n.column&&n.column.autoCloseMenu&&t.closeMenu()}}contextMenuItemDeleteCommand(){const e=this;void 0!==e.contextMenu.id&&e.deleteRow(e.contextMenu.id)}contextMenuItemEditCommand(){const e=this;void 0!==e.contextMenu.id&&e.editing.enabled&&("cell"===e.editing.mode?e.beginEdit(e.contextMenu.id,e.contextMenu.dataField):e.beginEdit(e.contextMenu.id))}removeGroupByCommand(e){this.removeGroup(e.dataField)}groupByCommand(e){const t=this;t.dataSource&&(t.$.headerBar?t.header.visible&&t.header.buttons.indexOf("group")>=0&&t.$.headerBar.openGroupPanel(e):t.addGroup(e.dataField))}sortAscCommand(e){this.sortBy(e.dataField,"asc")}sortDescCommand(e){this.sortBy(e.dataField,"desc")}removeSortCommand(e){this.sortBy(e.dataField,null)}addSortCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openSortPanel(e)}addFilterCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openFilterPanel(e)}removeFilterCommand(e){this.removeFilter(e.dataField)}customizeTypeCommand(e){this._openAddColumnDialog(e,"rename")}hideColumnCommand(e){e.visible=!1}deleteColumnCommand(e){this.columns.splice(this.columns.indexOf(e),1)}duplicateCommand(e,t,n){const l=this,i=new Smart.Grid.Column(e);let o=e.dataField,a=0;if(void 0===n){let t=!1;for(let n=0;n<l.rows.length;n++)if(l.rows[n].data[e.dataField]){t=!0;break}if(t)return void l._openDescriptionDialog(e,"duplicate")}for(let e=0;e<l.columns.length;e++)l.columns[e].dataField.indexOf(o)>=0&&a++;if(i.displayField=i.dataField=e.dataField+"_"+a,"object"==typeof e.editor){const t={};for(let n in e.editor)"instance"!==n&&"cell"!==n&&"column"!==n&&"row"!==n&&"isInitialized"!==n&&(t[n]=e.editor[n]);i.editor=JSON.parse(JSON.stringify(t))}const r=l.columns.indexOf(e);if(n)for(let t=0;t<l.rows.length;t++){const n=l.rows[t],o=n.data[e.dataField];n.data[i.dataField]=o}i.label=e.label+` ${l.localize("copy")} `+a,l.columns.splice(1+r,0,i),l.onColumnClone&&setTimeout((()=>{l.onColumnClone(e.dataField,i.dataField,1+r,n)}),100)}_removeMenu(){const e=this;if(e.menu){const t=e.menu.querySelector("smart-menu");t&&e.menu.removeChild(t)}if(e.filterRowMenu){const t=e.filterRowMenu.querySelector("smart-menu");t&&e.filterRowMenu.removeChild(t)}if(e._contextMenu){const t=e._contextMenu.querySelector("smart-menu");t&&(e._contextMenu.removeChild(t),e._contextMenu.parentNode.removeChild(e._contextMenu))}}_createColumnChooserMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();if(n.mode="vertical",n.dropDownAppendTo="body",n.checkboxes=!0,n.checkable=!0,n.classList.add("smart-grid-column-chooser-menu"),n.rightToLeft=t.rightToLeft,e&&"_addNewColumn"===e.dataField){if(t._kanbanViewColumns&&t._kanbanViewColumns.length>0)for(let e=0;e<t._kanbanViewColumns.length;e++){const n=t._kanbanViewColumns[e],i=t.columnByDataField[n.dataField];if(i&&i.visible)continue;const o=document.createElement("smart-menu-item"),a=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";o.checked=n.visible,n.allowHide&&(n.command=function(e){t.closeMenu();const n=t.columnByDataField[e.dataField];n.visible=!0,delete n._visible;const l=t._kanbanViewColumns.indexOf(e);l>=0&&t._kanbanViewColumns.splice(l,1)},o.label=t.localize(n.label)||n.label||n.dataField,o.value={column:n,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),l.appendChild(o))}const e=document.createElement("smart-menu-item");e.label='<span class="smart-grid-icon smart-icon-plus"></span>'+t.localize("dialogNewColumn"),e.value={properties:{command:()=>{t.closeMenu(),t._openAddColumnDialog()}}},l.appendChild(e)}else for(let e=0;e<t.columns.length;e++){const n=t.columns[e],i=document.createElement("smart-menu-item"),o=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";i.checked=n.visible,n.allowHide&&(n.command=function(e){e.visible=!e.visible},i.label=t.localize(n.label)||n.label||n.dataField,i.value={column:n,properties:n},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),l.appendChild(i))}n.appendChild(l),t.menu.appendChild(n),t.menu.itemCheckChange=t._menuItemClick.bind(t),t.menu.addEventListener("itemCheckChange",t.menu.itemCheckChange),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createColumnFilterMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu"),n.rightToLeft=t.rightToLeft;const i=e._filterInfo.dataSource;for(let t=0;t<i.length;t++){const n=i[t],o=document.createElement("smart-menu-item"),a=n.icon;o.label=n.label,o.value={column:e,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),e._filterInfo.condition===n.value&&o.setAttribute("focus",""),l.appendChild(o)}n.appendChild(l),t.filterRowMenu.appendChild(n),t.filterRowMenu.itemClick=t._menuItemClick.bind(t),t.filterRowMenu.addEventListener("itemClick",t.filterRowMenu.itemClick),t.filterRowMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowMenu)}))}_createMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment(),i=e.menuItems||t.columnMenu.dataSource;n.mode="vertical",n.dropDownAppendTo="body",n.rightToLeft=t.rightToLeft;for(let n in i){const o=i[n],a=document.createElement("smart-menu-item");let r=o.icon;a.label=t.localize(n),a.value={column:e,properties:o};const s=t=>{if(t){if("string"===e.dataType)return"A → Z";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"1 → 9";if("bool"===e.dataType||"boolean"===e.dataType)return"0 → 1"}else{if("string"===e.dataType)return"Z → A";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"9 → 1";if("bool"===e.dataType||"boolean"===e.dataType)return"1 → 0"}};"columnMenuItemSortAsc"===n?(a.label=t.localize(n,{mode:s(!0)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)):"columnMenuItemSortDesc"===n&&(a.label=t.localize(n,{mode:s(!1)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)),r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),l.appendChild(a)}n.appendChild(l),t._filterContainer?t.menu.insertBefore(n,t._filterContainer):t.menu.appendChild(n),t.menu.itemClick=t._menuItemClick.bind(t),t.menu.addEventListener("itemClick",t.menu.itemClick),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createContextMenuItems(){const e=this;e._removeMenu();const t=document.createElement("smart-menu"),n=document.createDocumentFragment(),l=e.contextMenu.dataSource;t.mode="vertical",t.dropDownAppendTo="body",t.rightToLeft=e.rightToLeft;for(let t in l){const i=l[t],o=document.createElement("smart-menu-item");let a=i.icon;!0===i.visible?o.classList.remove("smart-hidden"):!1===i.visible&&o.classList.add("smart-hidden"),"contextMenuItemEdit"===t?(e.editing.enabled||(o.disabled=!0),"{{messages}}"===i.label?"cell"===e.editing.mode?o.label=e.localize("contextMenuItemEditCell"):o.label=e.localize("contextMenuItemEditRow"):o.label=i.label):"{{messages}}"===i.label?o.label=e.localize(t):o.label=i.label,o.value={properties:i},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),n.appendChild(o)}t.appendChild(n),e._contextMenu.appendChild(t),e._contextMenu.itemClick=t=>{t.detail.value.column=t.detail.item.column=e._contextMenu.column,e._menuItemClick(t),e._closeMenu(e._contextMenu),e.$.fireEvent("contextMenuItemClick",{id:e._contextMenu.id,dataField:e._contextMenu.column.dataField,command:t.detail.value.properties.command})},e._contextMenu.style.minHeight="30px",e._contextMenu.addEventListener("itemClick",e._contextMenu.itemClick),e._contextMenu.addEventListener("keydown",e._keyDownHandler.bind(e))}_getFilterType(e){let t="string";switch(e.dataType.endsWith("?")?e.dataType.substring(0,e.dataType.length-1):e.dataType){case"number":case"int":case"float":case"int64":t="numeric";break;case"bool":case"boolean":t="bool";break;case"date":case"time":case"datetime":t="date";break;case"any":t="string"}return t}_createFilterPanel(e){const t=this;if(Smart.FilterPanel)if(t.filtering.enabled&&t.filtering.filterMenu.visible&&e.allowFilter&&!t.filtering.filterRow.visible&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){const n=t._getFilterType(e);t._filterPanel&&t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),t._filterPanel=t._filterPanels[n],t._filterPanel.dataField=e.dataField,t._filterPanel.rightToLeft=t.rightToLeft,t.filtering.filterMenu.messages?t._filterPanel.messages=t.filtering.filterMenu.messages:t._filterPanel.messages=t.messages,"excel"===e.filterMenuMode&&(t._filterPanel.dataField=e.dataField,t.dataSource&&t.dataSource.boundSource&&(t._filterPanel.data=t.dataSource.boundSource.toArray?t.dataSource.boundSource.toArray():t.dataSource.boundSource)),t._filterPanel.mode=e.filterMenuMode,t._filterPanel.locale=t.locale;const l=t._filterPanel.querySelectorAll(".smart-filter-panel-input");for(let e=0;e<l.length;e++)l[e].onkeydown=e=>{"Enter"===e.key&&t._filterPanel.filter()};if(!t._filterContainer){const e=document.createElement("div");e.classList.add("smart-filter-container"),t._filterContainer=e,requestAnimationFrame((function(){t.menu.appendChild(e)})),t._applyFilterHandler=function(){t.addFilter(t._filterPanel.dataField,t._filterPanel.getFilter()),t.columnByDataField[t._filterPanel.dataField]._filterState=t._filterPanel.getState()},t._clearFilterHandler=function(){requestAnimationFrame((()=>{t.removeFilter(t._filterPanel.dataField),t.columnByDataField[t._filterPanel.dataField]._filterState=null}))}}t._filterContainer.appendChild(t._filterPanel),t._filterPanel.classList.remove("smart-hidden"),t._filterPanel.removeEventListener("filter",t._applyFilterHandler),t._filterPanel.removeEventListener("clear",t._clearFilterHandler),t._filterPanel.addEventListener("filter",t._applyFilterHandler),t._filterPanel.addEventListener("clear",t._clearFilterHandler);const i=t._filterContainer.querySelector(".smart-grid-custom-filter-panel");if(i&&t._filterContainer.removeChild(i),"none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"),e.getFilterPanel)if(e._customFilterPanel)e.updateFilterPanel(e._customFilterPanel,e),t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(e._customFilterPanel);else{const n=e.getFilterPanel(e);n&&(n.classList.add("smart-grid-custom-filter-panel"),e._customFilterPanel=n,t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(n))}if(t._filterPanel.reset(),e._filterState)t._filterPanel.loadState(e._filterState);else if(e.filter){const n=e.filter,l=t._getFilterType(e);let i=n.getFilters();for(;i.length>0&&"FilterGroup"===i[0].type;)i=i[0].value;const o=n.getConditions(l),a=i.length>0?o.indexOf(i[0].condition):-1,r=i.length>1?o.indexOf(i[1].condition):-1,s=i.length>0?i[0].value:"",d=i.length>1?i[1].value:"",u=i.length>1?["and","or"].indexOf(i[1].logicalOperator):0;"excel"===e.filterMenuMode?(e._filterState={filters:i},t._filterPanel.loadState(e._filterState)):(e._filterState={firstFilterComparison:a,firstFilterValue:s,logicalOperator:u,secondFilterComparison:r,secondFilterValue:d},t._filterPanel.loadState(e._filterState))}}else t._filterPanel&&(t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),e._filterState=null)}hasColumnMenu(e){const t=this;if(!1===t.columnMenu.enabled)return!1;const n=e.menuItems||t.columnMenu.dataSource;let l=0,i=0;for(let o in n){const a=n[o];i++,!1===a.visible?l++:"auto"===a.visible&&("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))&&l++,"columnMenuItemGroupBy"!==o&&"columnMenuItemRemoveGroupBy"!==o||e.allowGroup&&t.grouping.enabled||l++,"columnMenuItemSort"!==o||e.allowSort||l++,"columnMenuItemFilter"!==o||e.allowFilter||l++,"columnMenuItemRemoveFilter"!==o||e.allowFilter||l++,"columnMenuItemGroupBy"!==o||e.allowGroup||l++,"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||e.allowSort&&t.sorting.enabled||l++)}return!!(t.filtering.enabled&&t.filtering.filterMenu.visible&&"none"!==e.filterMenuMode&&Smart.FilterPanel||Smart.Menu&&!(l>=i))}_filterMenuItemsVisibility(e){const t=this,n=(t.menu.parentElement&&(t.enableShadowDOM||t.isInShadowDOM)?t.menu.firstElementChild.shadowRoot:t.menu).querySelectorAll("smart-menu-item"),l=e.menuItems||t.columnMenu.dataSource;let i=0;for(let o in l){const a=n[i++],r=l[o];if(a.disabled=!r.enabled,a.classList.remove("smart-hidden"),"columnMenuItemDelete"!==o||e.allowDelete)if("columnMenuItemHide"!==o||e.allowHide){if("columnMenuItemRemoveSort"===o&&(e.sortOrder?a.disabled=!1:a.disabled=!0),("columnMenuItemSortAsc"===o&&"asc"===e.sortOrder||"columnMenuItemSortDesc"===o&&"desc"===e.sortOrder)&&(a.disabled=!0),!0===r.visible)a.classList.remove("smart-hidden");else if(!1===r.visible)a.classList.add("smart-hidden");else if("auto"===r.visible){if("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(!1===t.filtering.enabled?a.classList.add("smart-hidden"):((t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("filter")>=0&&a.classList.remove("smart-hidden"),e.filtered||"columnMenuItemRemoveFilter"!==o||a.classList.add("smart-hidden"))),"columnMenuItemSort"===o&&(!1===t.sorting.enabled?a.classList.add("smart-hidden"):t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.remove("smart-hidden")),"columnMenuItemGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n>=0}if("columnMenuItemRemoveGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("group")>=0&&a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n<0}"columnMenuItemFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSort"!==o||e.allowSort||a.classList.add("smart-hidden"),"columnMenuItemRemoveFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||(e.allowSort&&t.sorting.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.add("smart-hidden"))}}else a.classList.add("smart-hidden");else a.classList.add("smart-hidden")}}openMenu(e){const t=this.columnByDataField[e];t&&this._openMenu(t)}hasMenu(){const e=this;return!!(e.menu&&e.menu.column&&e.menu.parentNode)}_closeMenu(e){const t=this;(e=>{e&&e.column&&(e.column&&(e.column.setProperty("menu",null),e.column=null),e.parentNode&&(e.classList.remove("open"),t.appearance.allowColumnMenuAnimation||e.parentNode.removeChild(e)),e.removeEventListener("keydown",t._keyDownHandler.bind(t)),e.removeEventListener("itemClick",e.itemClick),e.removeEventListener("itemCheckChange",e.itemCheckChange),t.focus())})(e)}closeMenu(){const e=this,t=e.menu;if(e._closeMenu(t),e._closeMenu(e.filterRowMenu),e._closeMenu(e._contextMenu),e._filterPanel){const t=e._filterPanel.querySelectorAll("smart-drop-down-list");for(let e=0;e<t.length;e++){const n=t[e];n.opened&&n.close()}}}});
|
|
1484
|
+
Smart.Utilities.Assign("Grid.Menu",class{_openColumnChooserMenu(e){const t=this;if(e||(e=t._commandColumn),!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t._createColumnChooserMenuItems(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e,t._filterContainer&&("none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"));let l=n.right-n.width+window.pageXOffset,i=n.bottom+window.pageYOffset;l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,t.menu.classList.add("smart-open-right"),l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth)),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open")}_openColumnFilterMenu(e){const t=this;if(!e||t.filterRowMenu&&t.filterRowMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.filterRowMenu||(t.filterRowMenu=document.createElement("div"),t.filterRowMenu.classList.add("smart-grid-column-menu"),t.filterRowMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowMenu.classList.add("smart-animate"):t.filterRowMenu.classList.remove("smart-animate"),t._createColumnFilterMenuItems(e),t.filterRowMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowMenu.column&&t.filterRowMenu.column!==e&&(t.filterRowMenu.column.setProperty("menu",null),t.filterRowMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowMenu):document.body.appendChild(t.filterRowMenu),e.setProperty("filterRowMenu",t.filterRowMenu);const n=e.element.getBoundingClientRect();t.filterRowMenu.column=e;let l=n.left+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowMenu.offsetWidth,l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowMenu.offsetWidth)),t.filterRowMenu.style.left=l+"px",t.filterRowMenu.style.top=i+"px",t.filterRowMenu.classList.remove("smart-hidden"),t.filterRowMenu.classList.add("open"),setTimeout((()=>{t.filterRowMenu.querySelector("smart-menu").focus()}),50),t.filterRowMenu}openContextMenu(e,t){const n=this;if(n.contextMenu.selector){const l=document.querySelector(n.contextMenu.selector);l&&setTimeout((()=>{l.open(e,t)}),100)}else n._closeMenu(n._contextMenu),n._contextMenu||(n._contextMenu=document.createElement("div"),n._contextMenu.classList.add("smart-grid-column-menu"),n._contextMenu.setAttribute("theme",n.getAttribute("theme")),n._contextMenu.id=n.id+"_"+n.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),n.menu=n._contextMenu),n.appearance.allowColumnMenuAnimation?n._contextMenu.classList.add("smart-animate"):n._contextMenu.classList.remove("smart-animate"),n.rightToLeft?n._contextMenu.setAttribute("right-to-left",""):n._contextMenu.removeAttribute("right-to-left"),n.contextMenu.dataField?n._contextMenu.column=n.columnByDataField[n.contextMenu.dataField]:n._contextMenu.column=n.columns[0],n._createContextMenuItems(n._contextMenu),n._contextMenu.style.height=n.contextMenu.height?n.contextMenu.height+"px":"auto",n._contextMenu.style.width=n.contextMenu.width?n.contextMenu.width+"px":"auto",n.isInShadowDOM?n.getRootNode().appendChild(n.menu):document.body.appendChild(n._contextMenu),n._contextMenu.style.left=e+"px",n._contextMenu.style.top=t+"px",n._contextMenu.classList.remove("smart-hidden"),n._contextMenu.classList.add("open"),setTimeout((()=>{n._contextMenu&&n._contextMenu.querySelector("smart-menu").focus()}),50)}_openMenu(e){const t=this;if(!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls")||!1===t.columnMenu.enabled)return void t.closeMenu();t._closeMenu(t.filterRowMenu),t.$.headerBar&&t.header.visible&&t.$.headerBar.closePanel(),t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t.rightToLeft?t.menu.setAttribute("right-to-left",""):t.menu.removeAttribute("right-to-left"),t._createMenuItems(e),t._createFilterPanel(e),t._filterMenuItemsVisibility(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e;let l=n.right-e.element.actionButton.getBoundingClientRect().width+window.pageXOffset,i=n.bottom+window.pageYOffset;t.menu.classList.remove("smart-open-right"),t.rightToLeft&&(l=n.left+window.pageXOffset-t.menu.offsetWidth+e.element.actionButton.getBoundingClientRect().width,l<0&&(l=n.left+window.pageXOffset)),l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth),t.menu.classList.add("smart-open-right")),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.hasColumnMenu(e)?t.menu.classList.remove("smart-hidden"):t.closeMenu(),t.menu.classList.add("open"),setTimeout((()=>{t.menu&&(t.menu.querySelector(".smart-filter-panel-input")?t.menu.querySelector(".smart-filter-panel-input").focus():t.menu.querySelector("smart-menu").focus())}),50)}_menuItemClick(e){const t=this,n=e.detail.value;if(n&&n.properties){const e=n.properties.command;"function"==typeof e?e.apply(t,[n.column,n.properties]):t[e]&&t[e].apply(t,[n.column,n.properties]),n.column&&n.column.autoCloseMenu&&t.closeMenu()}}contextMenuItemDeleteCommand(){const e=this;void 0!==e.contextMenu.id&&e.deleteRow(e.contextMenu.id)}contextMenuItemEditCommand(){const e=this;void 0!==e.contextMenu.id&&e.editing.enabled&&("cell"===e.editing.mode?e.beginEdit(e.contextMenu.id,e.contextMenu.dataField):e.beginEdit(e.contextMenu.id))}removeGroupByCommand(e){this.removeGroup(e.dataField)}groupByCommand(e){const t=this;t.dataSource&&(t.$.headerBar?t.header.visible&&t.header.buttons.indexOf("group")>=0&&t.$.headerBar.openGroupPanel(e):t.addGroup(e.dataField))}sortAscCommand(e){this.sortBy(e.dataField,"asc")}sortDescCommand(e){this.sortBy(e.dataField,"desc")}removeSortCommand(e){this.sortBy(e.dataField,null)}addSortCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openSortPanel(e)}addFilterCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openFilterPanel(e)}removeFilterCommand(e){this.removeFilter(e.dataField)}customizeTypeCommand(e){this._openAddColumnDialog(e,"rename")}hideColumnCommand(e){e.visible=!1}deleteColumnCommand(e){this.columns.splice(this.columns.indexOf(e),1)}duplicateCommand(e,t,n){const l=this,i=new Smart.Grid.Column(e);let o=e.dataField,a=0;if(void 0===n){let t=!1;for(let n=0;n<l.rows.length;n++)if(l.rows[n].data[e.dataField]){t=!0;break}if(t)return void l._openDescriptionDialog(e,"duplicate")}for(let e=0;e<l.columns.length;e++)l.columns[e].dataField.indexOf(o)>=0&&a++;if(i.displayField=i.dataField=e.dataField+"_"+a,"object"==typeof e.editor){const t={};for(let n in e.editor)"instance"!==n&&"cell"!==n&&"column"!==n&&"row"!==n&&"isInitialized"!==n&&(t[n]=e.editor[n]);i.editor=JSON.parse(JSON.stringify(t))}const r=l.columns.indexOf(e);if(n)for(let t=0;t<l.rows.length;t++){const n=l.rows[t],o=n.data[e.dataField];n.data[i.dataField]=o}i.label=e.label+` ${l.localize("copy")} `+a,l.columns.splice(1+r,0,i),l.onColumnClone&&setTimeout((()=>{l.onColumnClone(e.dataField,i.dataField,1+r,n)}),100)}_removeMenu(){const e=this;if(e.menu){const t=e.menu.querySelector("smart-menu");t&&e.menu.removeChild(t)}if(e.filterRowMenu){const t=e.filterRowMenu.querySelector("smart-menu");t&&e.filterRowMenu.removeChild(t)}if(e._contextMenu){const t=e._contextMenu.querySelector("smart-menu");t&&(e._contextMenu.removeChild(t),e._contextMenu.parentNode.removeChild(e._contextMenu))}}_createColumnChooserMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();if(n.mode="vertical",n.dropDownAppendTo="body",n.checkboxes=!0,n.checkable=!0,n.classList.add("smart-grid-column-chooser-menu"),n.rightToLeft=t.rightToLeft,e&&"_addNewColumn"===e.dataField){if(t._kanbanViewColumns&&t._kanbanViewColumns.length>0)for(let e=0;e<t._kanbanViewColumns.length;e++){const n=t._kanbanViewColumns[e],i=t.columnByDataField[n.dataField];if(i&&i.visible)continue;const o=document.createElement("smart-menu-item"),a=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";o.checked=n.visible,n.allowHide&&(n.command=function(e){t.closeMenu();const n=t.columnByDataField[e.dataField];n.visible=!0,delete n._visible;const l=t._kanbanViewColumns.indexOf(e);l>=0&&t._kanbanViewColumns.splice(l,1)},o.label=t.localize(n.label)||n.label||n.dataField,o.value={column:n,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),l.appendChild(o))}const e=document.createElement("smart-menu-item");e.label='<span class="smart-grid-icon smart-icon-plus"></span>'+t.localize("dialogNewColumn"),e.value={properties:{command:()=>{t.closeMenu(),t._openAddColumnDialog()}}},l.appendChild(e)}else for(let e=0;e<t.columns.length;e++){const n=t.columns[e],i=document.createElement("smart-menu-item"),o=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";i.checked=n.visible,n.allowHide&&(n.command=function(e){e.visible=!e.visible},i.label=t.localize(n.label)||n.label||n.dataField,i.value={column:n,properties:n},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),l.appendChild(i))}n.appendChild(l),t.menu.appendChild(n),t.menu.itemCheckChange=t._menuItemClick.bind(t),t.menu.addEventListener("itemCheckChange",t.menu.itemCheckChange),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createColumnFilterMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu"),n.rightToLeft=t.rightToLeft;const i=e._filterInfo.dataSource;for(let t=0;t<i.length;t++){const n=i[t],o=document.createElement("smart-menu-item"),a=n.icon;o.label=n.label,o.value={column:e,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),e._filterInfo.condition===n.value&&o.setAttribute("focus",""),l.appendChild(o)}n.appendChild(l),t.filterRowMenu.appendChild(n),t.filterRowMenu.itemClick=t._menuItemClick.bind(t),t.filterRowMenu.addEventListener("itemClick",t.filterRowMenu.itemClick),t.filterRowMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowMenu)}))}_createMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment(),i=e.menuItems||t.columnMenu.dataSource;n.mode="vertical",n.dropDownAppendTo="body",n.rightToLeft=t.rightToLeft;for(let n in i){const o=i[n],a=document.createElement("smart-menu-item");let r=o.icon;a.label=t.localize(n),a.value={column:e,properties:o};const s=t=>{if(t){if("string"===e.dataType)return"A → Z";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"1 → 9";if("bool"===e.dataType||"boolean"===e.dataType)return"0 → 1"}else{if("string"===e.dataType)return"Z → A";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"9 → 1";if("bool"===e.dataType||"boolean"===e.dataType)return"1 → 0"}};"columnMenuItemSortAsc"===n?(a.label=t.localize(n,{mode:s(!0)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)):"columnMenuItemSortDesc"===n&&(a.label=t.localize(n,{mode:s(!1)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)),r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),l.appendChild(a)}n.appendChild(l),t._filterContainer?t.menu.insertBefore(n,t._filterContainer):t.menu.appendChild(n),t.menu.itemClick=t._menuItemClick.bind(t),t.menu.addEventListener("itemClick",t.menu.itemClick),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createContextMenuItems(){const e=this;e._removeMenu();const t=document.createElement("smart-menu"),n=document.createDocumentFragment(),l=e.contextMenu.dataSource;t.mode="vertical",t.dropDownAppendTo="body",t.rightToLeft=e.rightToLeft;for(let t in l){const i=l[t],o=document.createElement("smart-menu-item");let a=i.icon;!0===i.visible?o.classList.remove("smart-hidden"):!1===i.visible&&o.classList.add("smart-hidden"),"contextMenuItemEdit"===t?(e.editing.enabled||(o.disabled=!0),"{{messages}}"===i.label?"cell"===e.editing.mode?o.label=e.localize("contextMenuItemEditCell"):o.label=e.localize("contextMenuItemEditRow"):o.label=i.label):"{{messages}}"===i.label?o.label=e.localize(t):o.label=i.label,o.value={properties:i},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),n.appendChild(o)}t.appendChild(n),e._contextMenu.appendChild(t),e._contextMenu.itemClick=t=>{t.detail.value.column=t.detail.item.column=e._contextMenu.column,e._menuItemClick(t),e._closeMenu(e._contextMenu),e.$.fireEvent("contextMenuItemClick",{id:e._contextMenu.id,dataField:e._contextMenu.column.dataField,command:t.detail.value.properties.command})},e._contextMenu.style.minHeight="30px",e._contextMenu.addEventListener("itemClick",e._contextMenu.itemClick),e._contextMenu.addEventListener("keydown",e._keyDownHandler.bind(e))}_getFilterType(e){let t="string";switch(e.dataType.endsWith("?")?e.dataType.substring(0,e.dataType.length-1):e.dataType){case"number":case"int":case"float":case"int64":t="numeric";break;case"bool":case"boolean":t="bool";break;case"date":case"time":case"datetime":t="date";break;case"any":t="string"}return t}_createFilterPanel(e){const t=this;if(Smart.FilterPanel)if(t.filtering.enabled&&t.filtering.filterMenu.visible&&e.allowFilter&&!t.filtering.filterRow.visible&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){const n=t._getFilterType(e);t._filterPanel&&t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),t._filterPanel=t._filterPanels[n],t._filterPanel.dataField=e.dataField,t._filterPanel.rightToLeft=t.rightToLeft,t.filtering.filterMenu.messages?t._filterPanel.messages=t.filtering.filterMenu.messages:t._filterPanel.messages=t.messages,"excel"===e.filterMenuMode&&(t._filterPanel.dataField=e.dataField,t.dataSource&&t.dataSource.boundSource&&(t._filterPanel.data=t.dataSource.boundSource.toArray?t.dataSource.boundSource.toArray():t.dataSource.boundSource)),t._filterPanel.mode=e.filterMenuMode,t._filterPanel.locale=t.locale;const l=t._filterPanel.querySelectorAll(".smart-filter-panel-input");for(let e=0;e<l.length;e++)l[e].onkeydown=e=>{"Enter"===e.key&&t._filterPanel.filter()};if(!t._filterContainer){const e=document.createElement("div");e.classList.add("smart-filter-container"),t._filterContainer=e,requestAnimationFrame((function(){t.menu.appendChild(e)})),t._applyFilterHandler=function(){t.addFilter(t._filterPanel.dataField,t._filterPanel.getFilter()),t.columnByDataField[t._filterPanel.dataField]._filterState=t._filterPanel.getState()},t._clearFilterHandler=function(){requestAnimationFrame((()=>{t.removeFilter(t._filterPanel.dataField),t.columnByDataField[t._filterPanel.dataField]._filterState=null}))}}t._filterContainer.appendChild(t._filterPanel),t._filterPanel.classList.remove("smart-hidden"),t._filterPanel.removeEventListener("filter",t._applyFilterHandler),t._filterPanel.removeEventListener("clear",t._clearFilterHandler),t._filterPanel.addEventListener("filter",t._applyFilterHandler),t._filterPanel.addEventListener("clear",t._clearFilterHandler);const i=t._filterContainer.querySelector(".smart-grid-custom-filter-panel");if(i&&t._filterContainer.removeChild(i),"none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"),e.getFilterPanel)if(e._customFilterPanel)e.updateFilterPanel(e._customFilterPanel,e),t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(e._customFilterPanel);else{const n=e.getFilterPanel(e);n&&(n.classList.add("smart-grid-custom-filter-panel"),e._customFilterPanel=n,t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(n))}if(t._filterPanel.reset(),e._filterState)t._filterPanel.loadState(e._filterState);else if(e.filter){const n=e.filter,l=t._getFilterType(e);let i=n.getFilters();for(;i.length>0&&"FilterGroup"===i[0].type;)i=i[0].value;const o=n.getConditions(l),a=i.length>0?o.indexOf(i[0].condition):-1,r=i.length>1?o.indexOf(i[1].condition):-1,s=i.length>0?i[0].value:"",d=i.length>1?i[1].value:"",u=i.length>1?["and","or"].indexOf(i[1].logicalOperator):0;"excel"===e.filterMenuMode?(e._filterState={filters:i},t._filterPanel.loadState(e._filterState)):(e._filterState={firstFilterComparison:a,firstFilterValue:s,logicalOperator:u,secondFilterComparison:r,secondFilterValue:d},t._filterPanel.loadState(e._filterState))}}else t._filterPanel&&(t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),e._filterState=null)}hasColumnMenu(e){const t=this;if(!1===t.columnMenu.enabled)return!1;const n=e.menuItems||t.columnMenu.dataSource;let l=0,i=0;for(let o in n){const a=n[o];i++,!1===a.visible?l++:"auto"===a.visible&&("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))&&l++,"columnMenuItemGroupBy"!==o&&"columnMenuItemRemoveGroupBy"!==o||e.allowGroup&&t.grouping.enabled||l++,"columnMenuItemSort"!==o||e.allowSort&&t.sorting.enabled||l++,"columnMenuItemFilter"!==o||e.allowFilter&&t.filtering.enabled||l++,"columnMenuItemRemoveFilter"!==o||e.allowFilter&&t.filtering.enabled||l++,"columnMenuItemGroupBy"!==o||e.allowGroup||l++,"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||e.allowSort&&t.sorting.enabled||l++)}return!!(t.filtering.enabled&&t.filtering.filterMenu.visible&&"none"!==e.filterMenuMode&&Smart.FilterPanel||Smart.Menu&&!(l>=i))}_filterMenuItemsVisibility(e){const t=this,n=(t.menu.parentElement&&(t.enableShadowDOM||t.isInShadowDOM)?t.menu.firstElementChild.shadowRoot:t.menu).querySelectorAll("smart-menu-item"),l=e.menuItems||t.columnMenu.dataSource;let i=0;for(let o in l){const a=n[i++],r=l[o];if(a.disabled=!r.enabled,a.classList.remove("smart-hidden"),"columnMenuItemDelete"!==o||e.allowDelete)if("columnMenuItemHide"!==o||e.allowHide){if("columnMenuItemRemoveSort"===o&&(e.sortOrder?a.disabled=!1:a.disabled=!0),("columnMenuItemSortAsc"===o&&"asc"===e.sortOrder||"columnMenuItemSortDesc"===o&&"desc"===e.sortOrder)&&(a.disabled=!0),!0===r.visible)a.classList.remove("smart-hidden");else if(!1===r.visible)a.classList.add("smart-hidden");else if("auto"===r.visible){if("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(!1===t.filtering.enabled?a.classList.add("smart-hidden"):((t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("filter")>=0&&a.classList.remove("smart-hidden"),e.filtered||"columnMenuItemRemoveFilter"!==o||a.classList.add("smart-hidden"))),"columnMenuItemSort"===o&&(!1===t.sorting.enabled?a.classList.add("smart-hidden"):t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.remove("smart-hidden")),"columnMenuItemGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n>=0}if("columnMenuItemRemoveGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("group")>=0&&a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n<0}"columnMenuItemFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSort"!==o||e.allowSort||a.classList.add("smart-hidden"),"columnMenuItemRemoveFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemSort"!==o&&"columnMenuItemRemoveSort"!==o||(e.allowSort&&t.sorting.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.add("smart-hidden"))}}else a.classList.add("smart-hidden");else a.classList.add("smart-hidden")}}openMenu(e){const t=this.columnByDataField[e];t&&this._openMenu(t)}hasMenu(){const e=this;return!!(e.menu&&e.menu.column&&e.menu.parentNode)}_closeMenu(e){const t=this;(e=>{e&&e.column&&(e.column&&(e.column.setProperty("menu",null),e.column=null),e.parentNode&&(e.classList.remove("open"),t.appearance.allowColumnMenuAnimation||e.parentNode.removeChild(e)),e.removeEventListener("keydown",t._keyDownHandler.bind(t)),e.removeEventListener("itemClick",e.itemClick),e.removeEventListener("itemCheckChange",e.itemCheckChange),t.focus())})(e)}closeMenu(){const e=this,t=e.menu;if(e._closeMenu(t),e._closeMenu(e.filterRowMenu),e._closeMenu(e._contextMenu),e._filterPanel){const t=e._filterPanel.querySelectorAll("smart-drop-down-list");for(let e=0;e<t.length;e++){const n=t[e];n.opened&&n.close()}}}});
|
|
1485
1485
|
|
|
1486
1486
|
/***/ }),
|
|
1487
1487
|
|
|
@@ -1502,21 +1502,21 @@ Smart.Utilities.Assign("Grid.Reorder",class{reorderColumns(e,r,t=!1){const o=thi
|
|
|
1502
1502
|
/***/ 4045:
|
|
1503
1503
|
/***/ (() => {
|
|
1504
1504
|
|
|
1505
|
-
Smart.Utilities.Assign("Grid.Resize",class{autoSizeRows(e){const t=this,o=e||t._recyclingRows;t.rows.canNotify=!1;for(let e=0;e<o.length;e++){const i=o[e];i.element=t._rowElements[1],i.grid=t;const l=i._autoSize(i);i.cellHeight!==l&&(i.cellHeight=l),i.height=l}t.rows.canNotify=!0,t.refresh()}autoSizeColumn(e){const t=this.columnByDataField[e];t&&t.autoSize()}autoSizeColumns(e,t){const o=this,i=t||o.columns;let l=[];if(!e){const e=o._recyclingRows;for(let t=0;t<e.length;t++){const o=e[t];for(let e=0;e<i.length;e++){const t=i[e],s=o.getCell(t.dataField);l[t.dataField]||(l[t.dataField]=t.label),s.value&&s.value.toString().length>l[t.dataField].length&&(l[t.dataField]=s.value)}}}const s=[];for(let e=0;e<i.length;e++){const t=i[e],o=l[t.dataField]?l[t.dataField]:t.label;s.push(o)}const n=i[0]._measureSize(s);o.columns.canNotify=!1;for(let e=0;e<i.length;e++)i[e].width=n[e];o.columns.canNotify=!0,o.refresh()}_doubleClickHandler(e){const t=this;if("none"!==t.behavior.rowResizeMode||"none"!==t.behavior.columnResizeMode){if(t._downTime&&new Date-t._downTime<300){const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null,s=null,n=null;for(let e=0;e<o.length;e++){const t=o[e];if(t.getAttribute("data-field")&&(i=t.getAttribute("data-field"),"smart-grid-column"===t.nodeName.toLowerCase())){l=t;break}if(t.getAttribute("data-id")){s=t.getAttribute("data-id"),n=t;break}}const r=t.columnByDataField[i],a=t.rowById[s];if(t.behavior.allowColumnAutoSizeOnDoubleClick&&r&&r.allowResize&&"none"!==t.behavior.columnResizeMode&&l){const t=l.getBoundingClientRect(),o=t.right,i=10;o-i<=e.clientX&&e.clientX<=o+i&&t.top<=e.clientY&&t.bottom>=e.clientY&&(r.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))}if(t.behavior.allowRowAutoSizeOnDoubleClick&&a&&a.allowResize&&"none"!==t.behavior.rowResizeMode){const t=n.getBoundingClientRect().bottom,o=10;t-o<=e.clientY&&e.clientY<=t+o&&(a.computedHeight=null,a.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))}}t._downTime=new Date}}_endResize(){const e=this;e._overlay&&setTimeout((()=>{e._overlay&&(e._overlay.parentNode.removeChild(e._overlay),e._overlay=null)}),100);const t=e.getBoundingRect(e);if(delete e._columnDownPosition,delete e._rowDownPosition,e.classList.remove("smart-grid-resize-mode"),e.$.root.classList.remove("smart-grid-resize-mode"),e.classList.remove("smart-grid-row-resize-mode"),e.classList.remove("smart-grid-column-resize-mode"),e._rowToResize&&e._rowResizeStartLine&&e._rowResizeLine){const t=e.rowById[e._rowToResizeId],o=t.cellHeight+parseFloat(e._rowResizeLine.style.top)-parseFloat(e._rowResizeStartLine.style.top),i=t.cellHeight;if(e.rows.canNotify=!1,t.height=null,"split"===e.behavior.rowResizeMode){const i=e._nextRow(t),l=parseInt(t.height-o+t.cellHeight);t.computedHeight=o,i.computedHeight=parseInt(i.height)+l,i.height=null}else t.computedHeight=o;return e.rows.canNotify=!0,e._rowResizeStartLine.parentNode.removeChild(e._rowResizeStartLine),e._rowResizeLine.parentNode.removeChild(e._rowResizeLine),e.appearance.showResizeTooltips&&e._rowResizeTooltip.parentNode.removeChild(e._rowResizeTooltip),e._rowToResize.header?e._rowToResize.header.style.cursor="":e._rowToResize.style.cursor="",t.header&&(t.header.style.cursor=""),e._rowResizeLine=null,e._rowToResize=null,e._rowToResizeId=null,e._rowResizeStartLine=null,e.refresh(),void e.$.fireEvent("rowResize",{row:t,id:t.id,oldHeight:i,height:o})}if(!e._columnToResizeElement||!e._columnResizeLine)return;const o=e.columnByDataField[e._columnToResizeDataField],i=e._columnToResizeRect;let l=t.left+parseInt(e._columnResizeLine.style.left)-i.left+e.scrollLeft;const s=o.width;if(e.rightToLeft&&(l=t.left-parseFloat(e._columnResizeLine.style.left)+i.right-e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),l<o.minWidth&&(l=o.minWidth),e.columns.canNotify=!1,"split"===e.behavior.columnResizeMode){const t=e._nextColumn(o);if(t){const e=parseInt(o.computedWidth-l);o.width=l,t.width=parseInt(t.computedWidth)+e}}else o.width=l;e.columns.canNotify=!0,e._columnResizeLine.parentNode.removeChild(e._columnResizeLine),e._columnResizeLine=null,e._columnResizeStartLine.parentNode.removeChild(e._columnResizeStartLine),e._columnResizeTooltip.parentNode&&e._columnResizeTooltip.parentNode.removeChild(e._columnResizeTooltip),e._columnResizeStartLine=null,e._columnToResizeElement.style.cursor="",e._columnToResizeElement.sortButton.style.cursor="",e._columnToResizeElement.filterButton.style.cursor="",e._columnToResizeElement=null,e._columnToResizeRect=null,e._columnToResizeDataField=null,e._columnResizeTooltip=null,e.refresh(),o._state||(o._state={label:o.label,dataField:o.dataField,dataType:o.dataType}),o._state.width=o.width,e.$.fireEvent("columnResize",{column:o,dataField:o.dataField,oldWidth:s,width:l}),e.closeMenu()}_columnResizePrepare(){const e=this,t=e._columnToResizeRect,o=e.getBoundingRect(e.$.columnHeader);if(e._dragDetails)return;const i=function(){const i=document.createElement("div");return i.classList.add("smart-grid-resize-line"),e.rightToLeft?i.style.left=-o.left+t.left+"px":i.style.left=-o.left+t.right+"px",e.header.visible?i.style.top=-o.top+o.height+t.top+"px":i.style.top=-o.top+t.top+"px",i.style.height="calc(100% - "+i.style.top+")",i.style.cursor="col-resize",i},l=document.createElement("div");l.classList.add("smart-grid-resize-tooltip"),e._columnResizeTooltip=l,e._columnResizeTooltip.style.left=-o.left+t.right+"px",e.rightToLeft&&(e._columnResizeTooltip.style.left=-o.left+t.left+"px"),e._columnResizeTooltip.innerHTML=e.localize("columnResizeTooltip",{value:t.width}),e._columnResizeLine=i(),e._columnResizeStartLine=i(),"growAndShrink"===e.behavior.columnResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-column-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e.appearance.showResizeTooltips&&e.$.root.appendChild(e._columnResizeTooltip),e.$.root.appendChild(e._columnResizeLine),e.$.root.appendChild(e._columnResizeStartLine),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="col-resize",e.$.root.appendChild(e._overlay)}_columnDownResizeHandler(e){this._columnDownPosition=e.pageX}_columnMoveResizeHandler(e){const t=this;if(t._dragDetails)return;t._columnDownPosition&&Math.abs(e.pageX-t._columnDownPosition)>=3&&!t._columnResizeLine&&t._columnResizePrepare();const o=function(e){const o=t._columnToResizeRect;let i=e.left+parseFloat(t._columnResizeLine.style.left)-o.left+t.scrollLeft;t.rightToLeft&&(i=e.left-parseFloat(t._columnResizeLine.style.left)+o.right-t.scrollLeft-t._scrollView.vScrollBar.offsetWidth);const l=t.columnByDataField[t._columnToResizeDataField];i<l.minWidth&&(i=l.minWidth),t.appearance.showResizeTooltips&&(t._columnResizeTooltip.innerHTML=t.localize("columnResizeTooltip",{value:parseInt(i)}))};if(t._columnResizeLine){const i=t.columnByDataField[t._columnToResizeDataField],l=t._columnToResizeRect,s=i.minWidth,n=i.maxWidth,r=t._nextColumn(i),a=t.getBoundingRect(t);if(t.rightToLeft){if(e.pageX>a.right)return;if("split"===t.behavior.columnResizeMode&&r&&e.pageX<=t.offsetWidth-t.scrollLeft-r.left-r.computedWidth+r.minWidth)return t._columnResizeLine.style.left=t.offsetWidth-t.scrollLeft-r.left-r.computedWidth+r.minWidth+"px",void o(a);if(l.right-s-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-s-t.scrollLeft+"px",void o(a);if(l.left+n-t.scrollLeft>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-n-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+e.pageX+"px",o(a)}else{if(e.pageX<a.left)return;if("split"===t.behavior.columnResizeMode&&r&&e.pageX>=a.left+r.left+r.computedWidth-r.minWidth-t.scrollLeft)return t._columnResizeLine.style.left=-a.left+a.left+r.computedWidth+r.left-r.minWidth-t.scrollLeft+"px",void o(a);if(l.left+s-t.scrollLeft>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+s-t.scrollLeft+"px",void o(a);if(l.left+n-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+n-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+e.pageX+"px",o(a)}}else if(!t._columnDownPosition){const t=this;if(e.composedPath&&-1===e.composedPath().indexOf(this))return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null;if(t._columnResizeLine)return;for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-field")&&t.hasAttribute("header")){i=t.getAttribute("data-field"),l=t;break}}if(t._columnToResizeElement&&(t._columnToResizeElement.style.cursor="",t._columnToResizeElement.sortButton.style.cursor="",t._columnToResizeElement.filterButton.style.cursor="",t._columnToResizeElement=null),i){const o=t.rightToLeft?l.getBoundingClientRect().left:l.getBoundingClientRect().right;if(l.style.cursor="",l.sortButton.style.cursor="",l.filterButton.style.cursor="",o-10<=e.clientX&&e.clientX<=o+10){const e=t.columnByDataField[i];if(!e||e&&!e.allowResize)return;const o=t._isLastVisibleColumn(e);if("split"===t.behavior.columnResizeMode&&o)return;l.style.cursor="col-resize",l.sortButton.style.cursor="col-resize",l.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(l),t._columnToResizeElement=l,t._columnToResizeDataField=i}}}}_rowMoveResizeHandler(e){const t=this;if(t.viewColumns.length&&t.viewColumns[0].rowHeaderColumn&&!t._rowResizeLine){const o=t.offset(t.viewColumns[0].element);if(e.pageX<o.left||e.pageX>o.left+t.viewColumns[0].width)return}const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null;if(t._rowDownPosition&&Math.abs(e.pageY-t._rowDownPosition)>=3&&!t._rowResizeLine&&t._rowDownResizeHandler(e),t._rowResizeLine){const o=t._offsetTop(t.$.scrollView),i={top:o,bottom:t.$.scrollView.offsetHeight+o};if(e.pageY<=i.top)return;if(e.pageY>=i.bottom)return;const l=function(){const e=s.cellHeight+parseFloat(t._rowResizeLine.style.top)-parseFloat(t._rowResizeStartLine.style.top);t.appearance.showResizeTooltips&&(t._rowResizeTooltip.innerHTML=t.localize("rowResizeTooltip",{value:parseInt(e)}))},s=t.rowById[t._rowToResizeId],n=t._nextRow(s),r=t._rowToResizeBounds,a=s.minHeight,c=s.maxHeight;return"split"===t.behavior.rowResizeMode&&n&&r.bottom+n.height-n.minHeight<=e.pageY?(t._rowResizeLine.style.top=r.bottom+n.height-n.minHeight-o+"px",void l()):r.top+a+10>=e.pageY?(t._rowResizeLine.style.top=r.top+a-o+"px",void l()):r.top+c>=e.pageY-o?(t._rowResizeLine.style.top=r.top+c+10-o+"px",void l()):(t._rowResizeLine.style.top=-o+e.pageY-1+"px",void l())}if(!t._rowDownPosition){for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-id")&&t.hasAttribute("header")){l=t,i=t.getAttribute("data-id");break}}if(t._rowToResize&&(t._rowToResize.style.cursor="",t._rowToResize=null),null!==i){const o=t._offsetTop(l)+l.offsetHeight;if(l.style.cursor="",o-10<=e.clientY&&e.clientY<=o+10){const e=t.rowById[i];if(!e||e&&!e.allowResize)return;e.header&&(e.header.style.cursor="row-resize");const o=t._offsetTop(l);t._rowToResizeBounds={top:o,bottom:l.offsetHeight+o,height:l.offsetHeight},t._rowToResize=l,t._rowToResizeId=i}}}}_rowDownResizeHandler(){const e=this,t=e._rowToResizeBounds,o=function(){const o=document.createElement("div");return o.classList.add("smart-grid-resize-line","row"),o.style.width=e.$.scrollView.offsetWidth-e._rowToResize.offsetLeft+"px",o.style.left="0px",o.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",o.style.cursor="row-resize",o},i=document.createElement("div");i.classList.add("smart-grid-resize-tooltip"),e._rowResizeTooltip=i,e._rowResizeTooltip.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",e._rowResizeTooltip.innerHTML=e.localize("rowResizeTooltip",{value:t.height}),e._rowResizeTooltip.style.right="20px",e._rowResizeTooltip.style.bottom="initial","growAndShrink"===e.behavior.rowResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-row-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e._rowResizeLine=o(),e._rowResizeStartLine=o(),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="row-resize",e.$.root.appendChild(e._overlay),e.$.scrollView.appendChild(e._rowResizeLine),e.$.scrollView.appendChild(e._rowResizeStartLine),e.appearance.showResizeTooltips&&e.$.scrollView.appendChild(e._rowResizeTooltip)}_rowResizeHandler(e){const t=this;let o=e.clientX,i=e.clientY;void 0!==o&&void 0!==i||(o=e.touches[0].clientX,i=e.touches[0].clientY);const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,i);let s=null;for(let e=0;e<l.length;e++){const t=l[e];t.getAttribute("data-id")&&(s=t.getAttribute("data-id"))}null===s||!t._rowToResize||t._rowResizeLine||(t._rowDownPosition=e.pageY)}});
|
|
1505
|
+
Smart.Utilities.Assign("Grid.Resize",class{autoSizeRows(e){const t=this,o=e||t._recyclingRows;t.rows.canNotify=!1;for(let e=0;e<o.length;e++){const i=o[e];i.element=t._rowElements[1],i.grid=t;const l=i._autoSize(i);i.cellHeight!==l&&(i.cellHeight=l),i.height=l}t.rows.canNotify=!0,t.refresh()}autoSizeColumn(e){const t=this.columnByDataField[e];t&&t.autoSize()}autoSizeColumns(e,t){const o=this,i=t||o.columns;let l=[];if(!e){const e=o._recyclingRows;for(let t=0;t<e.length;t++){const o=e[t];for(let e=0;e<i.length;e++){const t=i[e],s=o.getCell(t.dataField);l[t.dataField]||(l[t.dataField]=t.label),s.value&&s.value.toString().length>l[t.dataField].length&&(l[t.dataField]=s.value)}}}const s=[];for(let e=0;e<i.length;e++){const t=i[e],o=l[t.dataField]?l[t.dataField]:t.label;s.push(o)}const n=i[0]._measureSize(s);o.columns.canNotify=!1;for(let e=0;e<i.length;e++)i[e].width=n[e];o.columns.canNotify=!0,o.refresh()}_doubleClickHandler(e){const t=this;if("none"!==t.behavior.rowResizeMode||"none"!==t.behavior.columnResizeMode){if(t._downTime&&new Date-t._downTime<300){const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null,s=null,n=null;for(let e=0;e<o.length;e++){const t=o[e];if(t.getAttribute("data-field")&&(i=t.getAttribute("data-field"),"smart-grid-column"===t.nodeName.toLowerCase())){l=t;break}if(t.getAttribute("data-id")){s=t.getAttribute("data-id"),n=t;break}}const r=t.columnByDataField[i],a=t.rowById[s];if(t.behavior.allowColumnAutoSizeOnDoubleClick&&r&&r.allowResize&&"none"!==t.behavior.columnResizeMode&&l){const t=l.getBoundingClientRect(),o=t.right,i=10;o-i<=e.clientX&&e.clientX<=o+i&&t.top<=e.clientY&&t.bottom>=e.clientY&&(r.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))}if(t.behavior.allowRowAutoSizeOnDoubleClick&&a&&a.allowResize&&"none"!==t.behavior.rowResizeMode){const t=n.getBoundingClientRect().bottom,o=10;t-o<=e.clientY&&e.clientY<=t+o&&(a.computedHeight=null,a.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))}}t._downTime=new Date}}_endResize(){const e=this;e._overlay&&setTimeout((()=>{e._overlay&&(e._overlay.parentNode.removeChild(e._overlay),e._overlay=null)}),100);const t=e.getBoundingRect(e);if(delete e._columnDownPosition,delete e._rowDownPosition,e.classList.remove("smart-grid-resize-mode"),e.$.root.classList.remove("smart-grid-resize-mode"),e.classList.remove("smart-grid-row-resize-mode"),e.classList.remove("smart-grid-column-resize-mode"),e._rowToResize&&e._rowResizeStartLine&&e._rowResizeLine){const t=e.rowById[e._rowToResizeId],o=t.cellHeight+parseFloat(e._rowResizeLine.style.top)-parseFloat(e._rowResizeStartLine.style.top),i=t.cellHeight;if(e.rows.canNotify=!1,t.height=null,"split"===e.behavior.rowResizeMode){const i=e._nextRow(t),l=parseInt(t.height-o+t.cellHeight);t.computedHeight=o,i.computedHeight=parseInt(i.height)+l,i.height=null}else t.computedHeight=o;return e.rows.canNotify=!0,e._rowResizeStartLine.parentNode.removeChild(e._rowResizeStartLine),e._rowResizeLine.parentNode.removeChild(e._rowResizeLine),e.appearance.showResizeTooltips&&e._rowResizeTooltip.parentNode.removeChild(e._rowResizeTooltip),e._rowToResize.header?e._rowToResize.header.style.cursor="":e._rowToResize.style.cursor="",t.header&&(t.header.style.cursor=""),e._rowResizeLine=null,e._rowToResize=null,e._rowToResizeId=null,e._rowResizeStartLine=null,e.refresh(),e.$.fireEvent("rowResize",{row:t,id:t.id,oldHeight:i,height:o}),void(e.onRowResize&&e.onRowResize({row:t,id:t.id,oldHeight:i,height:o}))}if(!e._columnToResizeElement||!e._columnResizeLine)return;const o=e.columnByDataField[e._columnToResizeDataField],i=e._columnToResizeRect;let l=t.left+parseInt(e._columnResizeLine.style.left)-i.left+e.scrollLeft;const s=o.width;if(e.rightToLeft&&(l=t.left-parseFloat(e._columnResizeLine.style.left)+i.right-e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),l<o.minWidth&&(l=o.minWidth),e.columns.canNotify=!1,"split"===e.behavior.columnResizeMode){const t=e._nextColumn(o);if(t){const e=parseInt(o.computedWidth-l);o.width=l,t.width=parseInt(t.computedWidth)+e}}else o.width=l;e.columns.canNotify=!0,e._columnResizeLine.parentNode.removeChild(e._columnResizeLine),e._columnResizeLine=null,e._columnResizeStartLine.parentNode.removeChild(e._columnResizeStartLine),e._columnResizeTooltip.parentNode&&e._columnResizeTooltip.parentNode.removeChild(e._columnResizeTooltip),e._columnResizeStartLine=null,e._columnToResizeElement.style.cursor="",e._columnToResizeElement.sortButton.style.cursor="",e._columnToResizeElement.filterButton.style.cursor="",e._columnToResizeElement=null,e._columnToResizeRect=null,e._columnToResizeDataField=null,e._columnResizeTooltip=null,e.refresh(),o._state||(o._state={label:o.label,dataField:o.dataField,dataType:o.dataType}),o._state.width=o.width,e.$.fireEvent("columnResize",{column:o,dataField:o.dataField,oldWidth:s,width:l}),e.onColumnResize&&e.onColumnResize({column:o,dataField:o.dataField,oldWidth:s,width:l}),e.closeMenu()}_columnResizePrepare(){const e=this,t=e._columnToResizeRect,o=e.getBoundingRect(e.$.columnHeader);if(e._dragDetails)return;const i=function(){const i=document.createElement("div");return i.classList.add("smart-grid-resize-line"),e.rightToLeft?i.style.left=-o.left+t.left+"px":i.style.left=-o.left+t.right+"px",e.header.visible?i.style.top=-o.top+o.height+t.top+"px":i.style.top=-o.top+t.top+"px",i.style.height="calc(100% - "+i.style.top+")",i.style.cursor="col-resize",i},l=document.createElement("div");l.classList.add("smart-grid-resize-tooltip"),e._columnResizeTooltip=l,e._columnResizeTooltip.style.left=-o.left+t.right+"px",e.rightToLeft&&(e._columnResizeTooltip.style.left=-o.left+t.left+"px"),e._columnResizeTooltip.innerHTML=e.localize("columnResizeTooltip",{value:t.width}),e._columnResizeLine=i(),e._columnResizeStartLine=i(),"growAndShrink"===e.behavior.columnResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-column-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e.appearance.showResizeTooltips&&e.$.root.appendChild(e._columnResizeTooltip),e.$.root.appendChild(e._columnResizeLine),e.$.root.appendChild(e._columnResizeStartLine),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="col-resize",e.$.root.appendChild(e._overlay)}_columnDownResizeHandler(e){this._columnDownPosition=e.pageX}_columnMoveResizeHandler(e){const t=this;if(t._dragDetails)return;t._columnDownPosition&&Math.abs(e.pageX-t._columnDownPosition)>=3&&!t._columnResizeLine&&t._columnResizePrepare();const o=function(e){const o=t._columnToResizeRect;let i=e.left+parseFloat(t._columnResizeLine.style.left)-o.left+t.scrollLeft;t.rightToLeft&&(i=e.left-parseFloat(t._columnResizeLine.style.left)+o.right-t.scrollLeft-t._scrollView.vScrollBar.offsetWidth);const l=t.columnByDataField[t._columnToResizeDataField];i<l.minWidth&&(i=l.minWidth),t.appearance.showResizeTooltips&&(t._columnResizeTooltip.innerHTML=t.localize("columnResizeTooltip",{value:parseInt(i)}))};if(t._columnResizeLine){const i=t.columnByDataField[t._columnToResizeDataField],l=t._columnToResizeRect,s=i.minWidth,n=i.maxWidth,r=t._nextColumn(i),a=t.getBoundingRect(t);if(t.rightToLeft){if(e.pageX>a.right)return;if("split"===t.behavior.columnResizeMode&&r&&e.pageX<=t.offsetWidth-t.scrollLeft-r.left-r.computedWidth+r.minWidth)return t._columnResizeLine.style.left=t.offsetWidth-t.scrollLeft-r.left-r.computedWidth+r.minWidth+"px",void o(a);if(l.right-s-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-s-t.scrollLeft+"px",void o(a);if(l.left+n-t.scrollLeft>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-n-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+e.pageX+"px",o(a)}else{if(e.pageX<a.left)return;if("split"===t.behavior.columnResizeMode&&r&&e.pageX>=a.left+r.left+r.computedWidth-r.minWidth-t.scrollLeft)return t._columnResizeLine.style.left=-a.left+a.left+r.computedWidth+r.left-r.minWidth-t.scrollLeft+"px",void o(a);if(l.left+s-t.scrollLeft>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+s-t.scrollLeft+"px",void o(a);if(l.left+n-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+n-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+e.pageX+"px",o(a)}}else if(!t._columnDownPosition){const t=this;if(e.composedPath&&-1===e.composedPath().indexOf(this))return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null;if(t._columnResizeLine)return;for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-field")&&t.hasAttribute("header")){i=t.getAttribute("data-field"),l=t;break}}if(t._columnToResizeElement&&(t._columnToResizeElement.style.cursor="",t._columnToResizeElement.sortButton.style.cursor="",t._columnToResizeElement.filterButton.style.cursor="",t._columnToResizeElement=null),i){const o=t.rightToLeft?l.getBoundingClientRect().left:l.getBoundingClientRect().right;if(l.style.cursor="",l.sortButton.style.cursor="",l.filterButton.style.cursor="",o-10<=e.clientX&&e.clientX<=o+10){const e=t.columnByDataField[i];if(!e||e&&!e.allowResize)return;const o=t._isLastVisibleColumn(e);if("split"===t.behavior.columnResizeMode&&o)return;l.style.cursor="col-resize",l.sortButton.style.cursor="col-resize",l.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(l),t._columnToResizeElement=l,t._columnToResizeDataField=i}}}}_rowMoveResizeHandler(e){const t=this;if(t.viewColumns.length&&t.viewColumns[0].rowHeaderColumn&&!t._rowResizeLine){const o=t.offset(t.viewColumns[0].element);if(e.pageX<o.left||e.pageX>o.left+t.viewColumns[0].width)return}const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null;if(t._rowDownPosition&&Math.abs(e.pageY-t._rowDownPosition)>=3&&!t._rowResizeLine&&t._rowDownResizeHandler(e),t._rowResizeLine){const o=t._offsetTop(t.$.scrollView),i={top:o,bottom:t.$.scrollView.offsetHeight+o};if(e.pageY<=i.top)return;if(e.pageY>=i.bottom)return;const l=function(){const e=s.cellHeight+parseFloat(t._rowResizeLine.style.top)-parseFloat(t._rowResizeStartLine.style.top);t.appearance.showResizeTooltips&&(t._rowResizeTooltip.innerHTML=t.localize("rowResizeTooltip",{value:parseInt(e)}))},s=t.rowById[t._rowToResizeId],n=t._nextRow(s),r=t._rowToResizeBounds,a=s.minHeight,c=s.maxHeight;return"split"===t.behavior.rowResizeMode&&n&&r.bottom+n.height-n.minHeight<=e.pageY?(t._rowResizeLine.style.top=r.bottom+n.height-n.minHeight-o+"px",void l()):r.top+a+10>=e.pageY?(t._rowResizeLine.style.top=r.top+a-o+"px",void l()):r.top+c>=e.pageY-o?(t._rowResizeLine.style.top=r.top+c+10-o+"px",void l()):(t._rowResizeLine.style.top=-o+e.pageY-1+"px",void l())}if(!t._rowDownPosition){for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-id")&&t.hasAttribute("header")){l=t,i=t.getAttribute("data-id");break}}if(t._rowToResize&&(t._rowToResize.style.cursor="",t._rowToResize=null),null!==i){const o=t._offsetTop(l)+l.offsetHeight;if(l.style.cursor="",o-10<=e.clientY&&e.clientY<=o+10){const e=t.rowById[i];if(!e||e&&!e.allowResize)return;e.header&&(e.header.style.cursor="row-resize");const o=t._offsetTop(l);t._rowToResizeBounds={top:o,bottom:l.offsetHeight+o,height:l.offsetHeight},t._rowToResize=l,t._rowToResizeId=i}}}}_rowDownResizeHandler(){const e=this,t=e._rowToResizeBounds,o=function(){const o=document.createElement("div");return o.classList.add("smart-grid-resize-line","row"),o.style.width=e.$.scrollView.offsetWidth-e._rowToResize.offsetLeft+"px",o.style.left="0px",o.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",o.style.cursor="row-resize",o},i=document.createElement("div");i.classList.add("smart-grid-resize-tooltip"),e._rowResizeTooltip=i,e._rowResizeTooltip.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",e._rowResizeTooltip.innerHTML=e.localize("rowResizeTooltip",{value:t.height}),e._rowResizeTooltip.style.right="20px",e._rowResizeTooltip.style.bottom="initial","growAndShrink"===e.behavior.rowResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-row-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e._rowResizeLine=o(),e._rowResizeStartLine=o(),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="row-resize",e.$.root.appendChild(e._overlay),e.$.scrollView.appendChild(e._rowResizeLine),e.$.scrollView.appendChild(e._rowResizeStartLine),e.appearance.showResizeTooltips&&e.$.scrollView.appendChild(e._rowResizeTooltip)}_rowResizeHandler(e){const t=this;let o=e.clientX,i=e.clientY;void 0!==o&&void 0!==i||(o=e.touches[0].clientX,i=e.touches[0].clientY);const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,i);let s=null;for(let e=0;e<l.length;e++){const t=l[e];t.getAttribute("data-id")&&(s=t.getAttribute("data-id"))}null===s||!t._rowToResize||t._rowResizeLine||(t._rowDownPosition=e.pageY)}});
|
|
1506
1506
|
|
|
1507
1507
|
/***/ }),
|
|
1508
1508
|
|
|
1509
1509
|
/***/ 1193:
|
|
1510
1510
|
/***/ (() => {
|
|
1511
1511
|
|
|
1512
|
-
Smart.Utilities.Assign("Grid.Row",class{constructor(e){const t=this;if(e||(e={}),Object.assign(t,e),e){if(void 0===t.data){const i={$:{}};if(e.grid&&e.grid.dataSource){const t=e.grid.dataSource;for(let e=0;e<t.dataFields.length;e++)i[(t.dataFields?t.dataFields[e]:{}).name]=""}else Object.assign(i,e);e.id&&(i.$.id=e.id),t.data=i}if((void 0===e.$||e.$&&void 0===e.$.id)&&(e.data?(e.data.$&&e.data.$.id&&(t.id=e.data.$.id),t.id||(t.id=e.index)):void 0===t.id&&(t.id=e.index),void 0===t.id&&(t.id=Smart.Utilities.Core.createGUID())),void 0===t.detailHeight&&(t.grid?t.detailHeight=t.grid.rowDetail.height:t.detailHeight=200),void 0===t.height&&t.grid&&(t.height=t.grid.layout.rowMinHeight,t.grid.__autoRowHeight&&(t.height=t.grid.__autoRowHeight),t.grid.layout.rowHeight&&(t.height=t.grid.layout.rowHeight)),void 0===t.cellHeight&&(t.cellHeight=t.height),void 0===t.showDetail&&(t.showDetail=!1),void 0===t.index&&(t.index=-1),void 0===t.visibleIndex&&(t.visibleIndex=-1),void 0===t.freeze&&(t.freeze=!1),void 0===t.height&&(t.height=null),void 0===t.minHeight&&(t.minHeight=25,t.grid&&(t.minHeight=t.grid.layout.rowMinHeight)),void 0===t.checked&&(t.checked=!1),void 0===t.selected?(t.selected=!1,(t.grid&&t.grid._selection.rows[t.id]||t.grid&&t.grid._selection.indexes[t.index])&&(t.selected=!0)):t.selected&&t.grid&&(t.grid._selection.rows[t.id]=!0,t.grid._selection.indexes[t.index]=t.index),void 0===t.enabled&&(t.enabled=!0),void 0===t.visible&&(t.visible=!0),void 0===t.allowCheck&&(t.allowCheck=!0),void 0===t.filtered&&(t.filtered=!0),void 0===t.allowResize&&(t.allowResize=!0),void 0===t.allowReorder&&(t.allowReorder=!0),void 0===t.allowToggle&&(t.allowToggle=!0),void 0===t.allowSelect&&(t.allowSelect=!0),void 0===t.starred&&(t.starred=!1),void 0===t.expanded&&(e.data&&void 0!==e.data.expanded?t.expanded=e.data.expanded:t.expanded=!1),t._addStyle(),t.headerCell=null,t._cells=[],t.name="",t.comments=[],!t.autoGenerated&&999999!==t.index){if(t.data){if(t.data.comments&&("string"==typeof t.data.comments?t.data.comments=JSON.parse(t.data.comments):t.comments=t.data.comments),t.data.rowStyle&&(t.style=t._style=e.rowStyle),t.data.history&&(t.history=t.data.history),t.data.style&&(t.style=t._style=t.data.style,t.grid&&(t.grid._cellStyles||(t.grid._cellStyles=[]),t.grid._cellStyles["row"+t.id]=!0,t.grid._cellStyles.length++)),t.data.settings){const e=JSON.parse(t.data.settings);void 0!==e.starred&&(t.starred=e.starred),void 0!==e.height&&(t.height=t.cellHeight=e.height)}const e=t.data.$?t.data.$:t.data;e.history&&(t.history=e.history),e.style&&(t.style=t._style=e.style),e.height&&(t.height=t.cellHeight=e.height),e.comments&&(t.comments=e.comments),e.starred&&(t.starred=e.starred),e.createdDate&&(t.createdDate=e.createdDate),e.createdBy&&(t.createdBy=e.createdBy),e.updatedDate&&(t.updatedDate=e.updatedDate),e.updatedBy&&(t.updatedBy=e.updatedBy)}t.grid&&t.grid._currentUser&&t.grid._currentUser.info&&(void 0===t.createdUserId?(t.createdUserId=t.grid._currentUser.info.id,t.createdDate=new Date):t.createdDate||(t.createdDate=new Date),t.history||(t.history=[],t.addHistory({action:"created",user:t.grid._currentUser.info.id,details:{value:t.name},date:t.createdDate})))}}}_addStyle(){this.style=this._style={background:"",color:"",status:"",fontSize:"",fontFamily:"",fontWeight:"",textDecoration:"",fontStyle:""}}setStyle(e){const t=this;t._style||t._addStyle(),["background","color","fontSize","status","fontFamily","fontWeight","textDecoration","fontStyle"].forEach((i=>{e[i]&&(t._style[i]=e[i])})),t.grid&&(t._style._changed=!0,t.grid._recycle(!1))}get properties(){return["allowToggle","allowResize","allowSelect","allowReorder","allowCheck","createdDate","updatedDate","createdBy","updatedBy","canNotify","children","starred","checked","cells","detailHeight","detailTemplate","cellHeight","expandHeight","data","enabled","expanded","filtered","freeze","grid","headerCell","height","index","id","minHeight","unbound","name","selected","showDetail","visible","parent","leaf","visibleIndex","history","comments","style"]}createElement(){const e=document.createElement("smart-grid-row");return this.element=e,e.setAttribute("role","row"),e._initialize(this),e}_autoSize(e){const t=this,i=t.grid;if(!i)return;let l=i.layout.rowMinHeight;void 0!==t.minHeight&&(l=t.minHeight);const a=t.element;if(e||(e=t),e&&(t.data=e.data),!a)return t.height;i.__autoHeightRows||(i.__autoHeightRows=[]);const n=(e,t,a)=>{if(!a||!t||t.autoGenerated)return 0;i.__autoHeightRows[t.dataField]||(i.__autoHeightRows[t.dataField]=[]);let n=""+e.data[t.dataField];"date"===t.dataType&&e.data[t.dataField]&&(n=""+e.data[t.dataField].toLocaleString());let r=n.length;e._templatesHeight&&e._templatesHeight[t.dataField]&&(r=e._templatesHeight[t.dataField]);const o=i.__autoHeightRows[t.dataField][r],d=o||function(e){a.style.height="auto",t.cellsWrap?a.content.classList.add("wrap"):a.content.classList.add("nowrap");let i=0;if(e&&t)if(t.template){const l=e.canNotify;if(e.canNotify=!1,a.cell.row=e,"function"==typeof t.template)if(a.content.textContent=e.data[t.dataField],e._templatesHeight&&e._templatesHeight[t.dataField])i=e._templatesHeight[t.dataField];else{const i={row:e,column:t,cell:a.cell,oldValue:a.cell.oldValue,value:a.cell.value,template:null,isMeasuring:!0},l=a.innerHTML;a.cell.template(i),i.template?(a.content.textContent="",a.innerHTML=l):a.content.textContent=e.data[t.dataField]}else a._setTemplate(e.data[t.dataField]||"",t.template,a.content);e.canNotify=l}else if("date"===t.dataType){const i=a.cell.getFormattedValue(e.data[t.dataField],t.cellsFormat);a.content.textContent=i}else a.content.textContent=e.data[t.dataField];let l=a.offsetHeight;return"function"==typeof t.template&&i>0&&(l=i),a.style.height="",a.content.classList.remove("wrap"),a.content.classList.remove("nowrap"),l}(e);l=Math.max(l,d),i.__autoHeightRows[t.dataField][r]=d};for(let t=0;t<i._frozenNearColumns.length;t++)n(e,i._frozenNearColumns[t],a.children[0].children[t]);for(let t=0;t<i._frozenFarColumns.length;t++)n(e,i._frozenFarColumns[t],a.children[2].children[t]);for(let t=0;t<a.children[1].children.length;t++)n(e,i._columnElements[t].column,a.children[1].children[t]);return l}addHistory(e){const t=this;e&&(t.grid.storeHistory?(void 0===t.history&&(t.history=[]),t.history.length===t.grid.storeHistoryItems&&t.history.splice(0,1),t.history.push(e)):t.history=[])}clearHistory(){this.history=[]}autoSize(){const e=this,t=e.grid._measureRowElement(e.data),i=e.data?t.row._autoSize(e):e.grid.layout.rowMinHeight;e.height=i,t.remove()}getCell(e){const t=this,i=t.grid;if(!i)return null;if("string"!=typeof e&&"number"!=typeof e||(e=i.columnByDataField[e]),!e)return null;if(t["column_"+e.dataField]){const i=t["column_"+e.dataField];return i.column=e,i}{const l=new Smart.Grid.Cell(t,e,i);return t["column_"+e.dataField]=l,l}}get cells(){const e=this;return e._cells&&e.grid&&e._cells.length===e.grid.columns.length||e.createCells(),e._cells}get viewCells(){const e=this,t=[];for(let i=0;i<e.grid.viewColumns.length;i++){const l=e.grid.viewColumns[i];if(e["column_"+l.dataField]){const i=e["column_"+l.dataField];t.push(i)}else{const i=new Smart.Grid.Cell(e,l,e.grid);e["column_"+l.dataField]=i,t.push(i)}}return e._viewCells=t,t}createCells(){const e=this,t=e.grid;e._cells=[];for(let i=0;i<t.viewColumns.length;i++){const l=t.viewColumns[i];if(!l.autoGenerated)if(e["column_"+l.dataField]){const t=e["column_"+l.dataField];e._cells.push(t)}else{const i=new Smart.Grid.Cell(e,l,t);e["column_"+l.dataField]=i,e._cells.push(i)}}}toggle(e){this.element._handleExpandCollapse(!this.expanded,e)}select(){this.setProperty("selected",!0)}unselect(){this.setProperty("selected",!1)}expand(){this.element&&this.element._handleExpandCollapse(!0)}collapse(){this.element&&this.element._handleExpandCollapse(!1)}render(){const e=this;e.element.row=e,e.element._render()}setProperty(e,t){const i=this,l=i.getProperty(e);i[e]=t,l!==t&&(i.canNotify=!1,i.propertyChanged(e,l,t),i.canNotify=!0)}getProperty(e){const t=this;if("selected"===e&&t.grid){let i=!1;t.grid._selection.cells["row"+t.id]&&(i=null),t.grid&&t.grid._selection.rows[t.id]&&(i=!0),t.grid&&t.grid._selection.indexes[t.index]&&(i=!0);const l=t.grid.rows.canNotify;return t.grid.rows.canNotify=!1,t[e]=i,t.grid.rows.canNotify=l,i}return t[e]}_updateData(){const e=this;e.data&&e.data.$&&["updatedBy","updatedDate","createdDate","createdBy","starred","comments","history","style"].forEach((t=>{void 0!==e.data.$[t]?(e[t]=e.data.$[t],"style"===t&&(e._style=e[t],e._style._changed=!0)):"starred"===t?e[t]=!1:"comments"===t||"history"===t?e[t]=[]:"updatedBy"===t?e[t]=-1:"updatedDate"===t?e[t]=null:"style"===t&&(e._addStyle(),e._style._changed=!0)}))}propertyChanged(e,t,i){const l=this;if("updatedBy"!==e&&"createdBy"!==e&&"userData"!==e&&"starred"!==e&&"style"!==e&&"history"!==e&&"updatedDate"!==e&&"createdDate"!==e&&"comments"!==e){if("showDetail"===e){l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled&&(l.height=0);const e=l.element.rowDetail;if(l.grid.appearance.allowRowDetailToggleAnimation&&!l.grid.rowDetail.dialog.enabled){l.grid._resizeHandling=!1;const t=function(e){const t=l.grid._toggledRow;!t||"transform"!==e.propertyName&&"height"!==e.propertyName||a(t)},a=function(e){e.grid.$.content.style.transition="",e.element.rowDetail.removeEventListener("transitionend",t),e.element.rowDetail.removeEventListener("transitioncancel",t),e.grid._toggledRow=null,e.element.removeAttribute("has-detail"),l.grid._refresh(),setTimeout((()=>{l.grid._resizeHandling=!0}),50)};l.grid._toggledRow=l,e.addEventListener("transitionend",t),e.addEventListener("transitioncancel",t),i?(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.element.toggleDetailButton.classList.remove("smart-animate"),setTimeout((()=>{l.element.toggleDetailButton.classList.add("smart-animate"),l.element.toggleDetailButton.setAttribute("toggled",""),l.element.setAttribute("show-detail","")})),l.element.style.height=l.cellHeight+l.detailHeight+"px",l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)+l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),e.classList.remove("smart-hidden"),e.style.height!==l.detailHeight+"px"&&(e.style.height=l.detailHeight+"px"),e.style.lineHeight!==l.detailHeight+"px"&&(e.style.lineHeight=l.detailHeight+"px"),e.style.top!==l.cellHeight+"px"&&(e.style.top=l.cellHeight+"px")):(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)-l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),setTimeout((()=>{l.element.style.height=l.cellHeight+"px",l.element.removeAttribute("show-detail")})))}else l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled?l.grid._refresh():l.grid._recycle()}if("allowCheck"!==e&&"allowSelect"!==e||l.grid._recycle(),"checked"===e&&(l.grid.checkBoxes.hasThreeStates&&l.grid._hasThreeStates(l,l),l.grid._recycle()),"selected"===e){if(!1===l.allowSelect)return;if(i?(l.grid._selection.rows[l.id]=!0,l.grid._selection.indexes[l.index]=l.index):!1===i&&(void 0!==l.grid._selection.rows[l.id]&&delete l.grid._selection.rows[l.id],void 0!==l.grid._selection.indexes[l.index]&&delete l.grid._selection.indexes[l.index]),!l.element)return;i?l.element.setAttribute("aria-selected",!0):l.element.removeAttribute("aria-selected"),l.grid._recycle()}"visible"===e&&l.grid.refresh(),"expanded"===e&&(l.expandHeight||l.grid.refresh()),"height"===e&&(l.expandHeight||l.cellHeight!==i&&(l.cellHeight=i,l.grid.refresh())),"minHeight"===e&&(l.height=null,l.grid.refresh()),"freeze"===e&&(!0===i||"near"===i?l.grid._frozenNearRows.push(l):"far"===i?l.grid._frozenFarRows.push(l):(l.grid._frozenNearRows.splice(l.grid._frozenNearRows.indexOf(l),1),l.grid._frozenFarRows.splice(l.grid._frozenFarRows.indexOf(l),1)),l.grid.refresh())}else l.data&&l.data.$&&(l.data.$[e]=i,"style"===e&&(l._style=i,l._style._changed=!0))}}),Smart("smart-grid-row",class extends Smart.BaseElement{static get properties(){return{}}get isUtilityElement(){return!0}get hasStyleObserver(){return!1}addThemeClass(){}addDefaultClass(){}_initialize(e){const t=this,i=e.grid,l=i._columnElements,a=i._frozenNearColumns,n=i._frozenFarColumns,r=document.createElement("div"),o=document.createElement("div"),d=document.createElement("div"),s=document.createDocumentFragment(),c=document.createDocumentFragment(),g=document.createDocumentFragment();i.rightToLeft?(o.classList.add("far","smart-grid-cell-container"),r.classList.add("center","smart-grid-cell-container"),d.classList.add("near","smart-grid-cell-container")):(o.classList.add("near","smart-grid-cell-container"),r.classList.add("center","smart-grid-cell-container"),d.classList.add("far","smart-grid-cell-container")),t._properties=[],t.row=e,e.createCells(),t._mouseEnter=function(){if(!i.isScrolling&&!i.editing.isEditing&&(t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.commandColumn.inline&&!t.commandBar)){const e=document.createElement("div"),l=i._getCommandColumnCommandsTemplate();e.classList.add("smart-grid-command-bar"),e.innerHTML=l,r.appendChild(e),requestAnimationFrame((()=>{e.classList.add("show")})),i._updateCommandColumnCommandsVisibility(e,t.row),e.onmousedown=function(e){const l=e.composedPath();let a=null;for(let e=0;e<l.length;e++)if(l[e].classList.contains("smart-grid-command-item")){a=l[e];break}if(a){const l=a.getAttribute("command");i._applyCommand(l,[t.row]),t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),t.removeAttribute("hover"),e.stopPropagation(),e.preventDefault()}},t.commandBar=e}},t._mouseLeave=function(){i.isScrolling||i.editing.isEditing||t.commandBar&&(t.commandBar.classList.remove("show"),t.commandBar.addEventListener("transitionend",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})),t.commandBar.addEventListener("transitioncancel",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})))},t.addEventListener("mouseenter",t._mouseEnter),t.addEventListener("mouseleave",t._mouseLeave);for(let t=0;t<a.length;t++){const i=a[t],l=e.getCell(i).createElement();c.appendChild(l)}for(let t=0;t<n.length;t++){const i=n[t],l=e.getCell(i).createElement();g.appendChild(l)}for(let i=0;i<l.length;i++){const a=l[i],n=a.column;if(!a.parentNode||!n)break;const r=e.getCell(n).createElement();n&&n._treeColumn&&(t.toggleButton=r.toggleButton),s.appendChild(r)}o.appendChild(c),r.appendChild(s),d.appendChild(g);const h=document.createElement("div");h.classList.add("smart-grid-row-detail","smart-hidden","smart-animate");const m=document.createElement("div");m.classList.add("smart-grid-row-sub-container","smart-hidden"),t._rowFragment=document.createDocumentFragment(),t._rowFragment.appendChild(o),t._rowFragment.appendChild(r),t._rowFragment.appendChild(d),t._rowFragment.appendChild(h),t._rowFragment.appendChild(m),t.appendChild(t._rowFragment),t.cellsNearContainerElement=t.children[0],t.cellsContainerElement=t.children[1],t.cellsFarContainerElement=t.children[2],t.rowDetail=t.children[3],t.rowContainer=t.children[4],i.layout.rowHeight&&"auto"!==i.layout.rowHeight&&(e.filterRow?t.style.height=i.layout.rowMinHeight+"px":t.style.height=i.layout.rowHeight+"px"),delete t._rowFragment}get enableShadowDOM(){return!1}_handleExpandCollapse(e,t){const i=this,l=i.row,a=l.grid;if(!l.allowToggle)return null;a._toggledRow=l;let n={row:l,id:l.id};t&&(n.originalEvent=t.originalEvent),a.$.fireEvent(e?"rowExpand":"rowCollapse",n);const r=a.dataSource.virtualDataSourceOnExpand&&e&&!0!==l.data._loaded;if(e?a.dataSource._expandedRowIds[l.data.$.id]=!0:delete a.dataSource._expandedRowIds[l.data.$.id],!a.appearance.allowRowToggleAnimation||r)a.rows.canNotify=!1,l.expanded=e,a.rows.canNotify=!0,l.data.expanded=e,r?(l.data._loaded=!0,l.element.querySelector("button").setAttribute("load",""),a._virtualDataRequest("expand")):(a._toggledRow=null,a._refresh()),r&&a.appearance.allowRowToggleAnimation&&(i.toggleButton.removeAttribute("toggled"),i.toggleButton.classList.remove("smart-animate"),setTimeout((()=>{i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")}),50));else{const t=function(e){e.height=e.cellHeight,a.$.content.style.transition="",e.element.rowContainer.innerHTML="",e.element.rowContainer.classList.add("smart-hidden"),e.element.rowContainer.removeEventListener("transitionend",n),e.element.rowContainer.removeEventListener("transitioncancel",n),e.element.rowContainer.style.height="",e.element.rowContainer.style.transform="",e.element.rowContainer.style.transition="",e.element.rowContainer.classList.remove("smart-animate"),e.element.toggleButton&&e.element.toggleButton.classList.remove("smart-animate"),a._refresh()},n=function(e){const l=a._toggledRow;i._toggleTimer=null,a._toggledRow=null,!l||"transform"!==e.propertyName&&"height"!==e.propertyName||setTimeout((()=>{t(l)}),50)};if(i._toggleTimer){clearTimeout(i._toggleTimer);const e=a._toggledRow;a._toggledRow=null,t(e)}i._toggleTimer=setTimeout((()=>{const t=function(){!function(){const e=a._toggledRow;a._refresh(),a._refreshRowHierarchy();let t=0;for(let e=0;e<a.rowHierarchy.length;e++){const i=a.rowHierarchy[e];let l=i.parent;for(;l;)l.id===a._toggledRow.id&&(t+=i.height),l=l.parent}const i=a._scrollView.scrollTop,l=a._contentHeight-(e.cellHeight+e.top-i);e.expandHeight=Math.min(l,t),e.height=e.cellHeight+e.expandHeight}(),a._recycle(!1),i.style.overflow="hidden",i.style.height="auto",i.style.lineHeight=l.cellHeight+"px"};e?(l.expanded=!0,t(),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",i.toggleButton&&i.toggleButton.removeAttribute("toggled"),a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),setTimeout((function(){i.toggleButton&&(i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")),i.rowContainer.addEventListener("transitionend",n),i.rowContainer.addEventListener("transitioncancel",n),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)"}))):(t(),l.expanded=!1,i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px",a.$.content.style.transition="",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)",i.toggleButton&&(i.toggleButton.setAttribute("toggled",""),i.toggleButton.classList.add("smart-animate")),setTimeout((function(){i.toggleButton&&i.toggleButton.removeAttribute("toggled",""),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),i.rowContainer.addEventListener("transitionend",n),i.rowContainer.addEventListener("transitioncancel",n),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px"}),0))}),50)}}_renderAddNewRow(){const e=this,t=e.row,i=t.grid,l=t.element,a=new Smart.Grid.Cell(t,i.columns[0],i);t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden");let n=i.editing.addNewRow.label;n.indexOf("{{")>=0&&(n=i.localize("addNewRow")),l.innerHTML="<smart-grid-cell><div>"+n+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),l.firstChild.cell=a,i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px"))}_renderFilterRow(){const e=this,t=e.row,i=t.grid,l=t.element;t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),l.innerHTML="<smart-grid-cell><div>"+i.localize("addNewRow")+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")}_renderEmpty(){this.classList.add("smart-hidden")}_renderCell(e,t,i){if(!t)return void i.classList.add("smart-hidden");let l=e.getCell(t);if(l.element!==i&&(l._styleChanged=!0),e._style&&!t.autoGenerated){const t=l._updating;l._updating=!0,e._style._changed&&(l.color=e._style.color,l.background=e._style.background,l.fontFamily=e._style.fontFamily,l.fontSize=e._style.fontSize,l.fontStyle=e._style.fontStyle,l.textDecoration=e._style.textDecoration,l.fontWeight=e._style.fontWeight);const a=i.firstElementChild,n=e=>a._style&&a._style[e]?a._style[e]:"backgroundColor"===e&&null===l.background&&""===a.style[e]||null===l[e]&&""===a.style[e]?null:a.style[e];n("backgroundColor")===l.background&&n("fontFamily")===l.fontFamily&&n("fontSize")===l.fontSize&&n("fontStyle")===l.fontStyle&&n("textDecoration")===l.textDecoration&&n("fontWeight")===l.fontWeight&&n("color")===l.color||(l._styleChanged=!0),l._updating=t}i.cell!==l&&(i.cell.background===l.background&&i.cell.borderColor===l.borderColor&&i.cell.color===l.color&&i.cell.fontSize===l.fontSize&&i.cell.fontFamily===l.fontFamily&&i.cell.textDecoration===l.textDecoration&&i.cell.fontWeight===l.fontWeight&&i.cell.fontStyle===l.fontStyle||(l._styleChanged=!0)),l.element=i,i.cell=l,t._treeColumn&&l.element.isRendered&&!e.filterRow&&l.element._refresh(),l.render(),t&&t.rowHeaderColumn&&(e.header=i,i.setAttribute("data-id",e.id))}_alternate(){const e=this,t=e.row,i=t.grid,l=i.appearance.alternationStart,a=i.appearance.alternationEnd>0?i.appearance.alternationEnd:1/0;if(!(i.appearance.alternationCount<=0)&&(e.removeAttribute("alternation-index"),t.visibleIndex>=l&&t.visibleIndex<=a)){const a=(t.visibleIndex-l)%i.appearance.alternationCount;e.setAttribute("alternation-index",a)}}_openRowDetailDialog(e){const t=this,i=t.row.grid,l=t.row;if(!i.rowDetail.dialog.enabled||!l.showDetail)return!1;const a=i._dialogRowDetail||i._createDialog(i.rowDetail.dialog);if(!l.detailTemplate&&!i.rowDetail.template&&i._openRowSettingsDialog)return void(i.editing.dialog.visible||(t._settingsDialogRowId=l.id,i._openRowSettingsDialog(l.id)));if(i.rowDetail.dialog.visible&&a.row!==l)return void(l.showDetail=!1);const n="{{message}}"===i.rowDetail.dialog.header?i.localize("dialogRowDetailHeader",{value:l.visibleIndex+1}):i.rowDetail.dialog.header;!i.rowDetail.dialog.visible||i.rowDetail.dialog.row!==l||l.showDetail?(a.header.innerHTML=n,a.content.innerHTML="",a.content.style.width="100%",a.content.style.height="100%",a.row=l,a.querySelector(".smart-footer").classList.add("smart-hidden"),i._dialogRowDetail||(a.setAttribute("tabindex",0),a.modal=!0,a.btnConfirm.innerHTML=i.localize("dialogRowDetailButtonConfirm"),a.btnCancel.innerHTML=i.localize("dialogRowDetailButtonCancel"),a.btnCancel.classList.add("smart-hidden"),a.onOpen=function(){i.rowDetail.dialog.visible=!0},a.onClose=function(){i.rowDetail.dialog.visible=!1,a.row.showDetail=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},i._dialogRowDetail=a),a.open(),setTimeout((function(){a.focus()}),100),a.content.appendChild(e)):a.close()}_renderDetail(e){const t=this,i=t.row.grid,l=t.row;let a=l.id,n=l.detailTemplate||i.rowDetail.template;if(n.startsWith("#")&&(n=document.querySelector(n)),l._detail)return e.firstChild===l._detail||(e.firstChild&&e.removeChild(e.firstChild),e.appendChild(l._detail)),void(i.onRowDetailUpdated&&i.onRowDetailUpdated(l.index,l,e.firstChild));if(n instanceof HTMLTemplateElement){const t=n.content.cloneNode(!0).firstElementChild;a=a.toString(),a=a.replace(/'/gi,"\\'"),a=a.replace(/"/gi,'\\"');let i=t.outerHTML.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id);i.indexOf("{{value=")>=0&&(a?(i=i.substring(0,i.indexOf("{{value="))+a+i.substring(i.indexOf("}")),i=i.replace(/}/gi,""),i=i.replace(/{/gi,"")):(i=i.replace(/{{value=/gi,""),i=i.replace(/}}/gi,""))),i="<div>"+i+"</div>";for(let e in l.data)i=i.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==i&&(e.innerHTML=i)}else{let t="<div>"+n.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id)+"</div>";for(let e in l.data)t=t.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==t&&(e.innerHTML=t)}i.onRowDetailInit&&i.onRowDetailInit(l.index,l,e.firstChild),i.rowDetail.dialog.enabled?i.rowDetail.dialog.visible?t._openRowDetailDialog(e.firstChild):t._openRowDetailDialog(e.firstChild.firstElementChild):l._detail=e.firstChild}_render(){let e=this;const t=e.row,i=t.grid;if(!i)return;const l=t.getProperty("selected");if(!1===l&&e.hasAttribute("selected")?e.removeAttribute("selected"):!0===l?e.setAttribute("selected",""):null===l&&e.setAttribute("selected","indeterminate"),t.allowSelect||e.setAttribute("selected","none"),e.hasAttribute("unbound")&&e.removeAttribute("unbound"),t.unbound&&e.setAttribute("unbound",""),e.removeAttribute("focus"),i._selection.focusedCell&&i._selection.focusedCell.row&&i._selection.focusedCell.row.id===t.id&&e.setAttribute("focus",""),!i._toggledRow&&e.classList.contains("smart-animate"))return e.classList.remove("smart-animate"),e.rowContainer.innerHTML="",e.rowContainer.classList.add("smart-hidden"),i._refreshLayout(),void i._recycle();if(0===i.columns.length)return void e._renderEmpty();if(t.addNewRow&&!t.inline)return void e._renderAddNewRow();let a=!1;if(t.addNewRow&&t.inline&&(a=!0),i._toggledRow&&(t.id===i._toggledRow.id?e.setAttribute("toggle",""):e.hasAttribute("toggle")&&e.removeAttribute("toggle")),i._toggledRow&&i.appearance.allowRowToggleAnimation){let l=t.parent;if(!i._toggledRow.expanded&&i._toggledRow.id===t.id){const t=e.rowContainer;for(let e=0;e<t.children.length;e++){const l=t.children[e],a=l.getAttribute("data-id"),n=i.rowById[a];l.getAttribute("data-rendered")||(l.setAttribute("data-rendered",!0),n.element=l,n.render())}}for(;l;){if(l.id===i._toggledRow.id){const a=l.element.rowContainer;if(i._toggledRow.expanded){e.classList.add("smart-hidden");let l=t.createElement(i);for(let e=0;e<a.children.length;e++){const i=a.children[e];if(i.getAttribute("data-id")===t.id.toString())return void(l=i)}t.element=l,a.appendChild(l),a.classList.remove("smart-hidden"),l.row=t,e=l}break}l=l.parent}}e._alternate();const n=parseFloat(i.$.columnNearContainer.style.width),r=parseFloat(i.$.columnContainer.style.width),o=parseFloat(i.$.columnFarContainer.style.width),d=e.children[1],s=e.children[0],c=e.children[2];if(i.rightToLeft?(s.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&s.classList.add("vscroll")):(c.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&c.classList.add("vscroll")),e.hasAttribute("group")&&e.removeAttribute("group"),e.hasAttribute("tree")&&e.removeAttribute("tree"),e.hasAttribute("level")&&(e.removeAttribute("level"),e.removeAttribute("aria-level")),e.hasAttribute("leaf")&&e.removeAttribute("leaf"),e.hasAttribute("expanded")&&e.removeAttribute("expanded"),e.hasAttribute("summary")&&e.removeAttribute("summary"),e.hasAttribute("filter")&&e.removeAttribute("filter"),null===t.filtered&&e.setAttribute("filter","indeterminate"),i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&"advanced"===i.grouping.renderMode&&!t.filterRow?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),void 0!==t.label&&t.level===i.dataSource.groupBy.length-1&&e.setAttribute("leaf",""),void 0!==t.label?e.setAttribute("group",""):e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):i.dataSource.boundHierarchy?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),t.leaf&&e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):(t.canNotify=!1,t.leaf=!0,t.expanded=!1,t.summaryRow=!1,t.data||(t.data={}),t.data.summaryRow&&(t.summaryRow=!0),t.level=0,e.toggleButton&&e.toggleButton.classList.add("smart-hidden"),t.canNotify=!0),e.setAttribute("data-id",t.id),e.visible=t.visible,e.cellsNearContainerElement.classList.remove("smart-visibility-hidden"),e.cellsContainerElement.classList.remove("smart-visibility-hidden"),e.cellsFarContainerElement.classList.remove("smart-visibility-hidden"),e.removeAttribute("rowspan"),i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")),i.rightToLeft?(d.style.right!==i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"&&(d.style.right=i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"),i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth<=0&&!i._scrollView.scrollWidth&&(d.style.right=-i.offsetWidth+i._computedColumnsWidth+"px")):d.style.left!==-i._scrollView.scrollLeft+"px"&&(d.style.left=-i._scrollView.scrollLeft+"px"),i.rowDetail.enabled){const l=e.rowDetail;e.removeAttribute("show-detail"),t.showDetail?(l.classList.remove("smart-hidden"),e.setAttribute("show-detail",""),i.rowDetail.dialog.enabled?l.classList.add("smart-hidden"):(l.style.height!==t.detailHeight+"px"&&(l.style.height=t.detailHeight+"px"),l.style.lineHeight!==t.detailHeight+"px"&&(l.style.lineHeight=t.detailHeight+"px"),l.style.top!==t.cellHeight+"px"&&(l.style.top=t.cellHeight+"px")),e._renderDetail(l)):l.classList.add("smart-hidden")}else e.rowDetail&&e.rowDetail.classList.add("smart-hidden");if(s.classList.remove("smart-hidden"),c.classList.remove("smart-hidden"),s.style.width!==n+"px"&&(s.style.width=n+"px"),d.style.width!==r+"px"&&(d.style.width=r+"px"),c.style.width!==o+"px"&&(c.style.width=o+"px"),s.style.height=t.cellHeight+"px",d.style.height=t.cellHeight+"px",c.style.height=t.cellHeight+"px",0===o&&c.classList.add("smart-hidden"),0===n&&s.classList.add("smart-hidden"),n>0&&(parseInt(n),parseInt(i._autoGeneratedColumnsNearWidth)),o>0&&parseInt(o)===parseInt(i._autoGeneratedColumnsFarWidth)&&c.classList.add("border-collapse"),t._classNames="",i.onRowClass){const e=i.onRowClass(t.visibleIndex,t.data,t);if(e){const i=e.trim().split(" ");t._classNames=i}}if(i.rowCSSRules){const e=Object.keys(i.rowCSSRules);for(let l=0;l<e.length;l++){let a=e[l];const n={index:t.visibleIndex,data:t.data,row:t,api:i};i.rowCSSRules[a](n)&&(t._classNames=[a])}}for(let l=0;l<i._frozenNearColumns.length;l++){const a=i._frozenNearColumns[l];let n=e.children[0].children[l];n||(n=t.getCell(a).createElement(),e.children[0].appendChild(n)),!1!==a.visbile&&e._renderCell(t,a,n)}for(let l=0;l<i._frozenFarColumns.length;l++){const a=i._frozenFarColumns[l];let n=e.children[2].children[l];n||(n=t.getCell(a).createElement(),e.children[2].appendChild(n)),!1!==a.visbile&&e._renderCell(t,a,n)}for(let l=0;l<d.children.length;l++)if(!i._columnElements[l+i._frozenNearColumns.length]){let i=e.children[1].children[l];e._renderCell(t,null,i)}for(let l=0;l<i._columnElements.length;l++){const a=i._columnElements[l],n=a.column;if(!a.parentNode||!n){if(a&&!n){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}continue}let r=e.children[1].children[l];r||(a.column||(a.column=n),r=t.getCell(n).createElement(),e.children[1].appendChild(r)),a.classList.contains("smart-visibility-hidden")?r.classList.add("smart-visibility-hidden"):(r.classList.remove("smart-visibility-hidden"),e._renderCell(t,n,r))}if(a){let t=e.children[1].children[0];const l=d.getBoundingClientRect(),a=s.getBoundingClientRect();for(let e=0;e<s.children.length;e++)s.children[e].classList.add("smart-add-new-row");s.children[0].innerHTML='<div style="width: 100%;" class="smart-grid-icon smart-icon-plus show"></div>',s.children[0].style.width="50px",s.children[0].style.zIndex=9;const n=i.editing.addNewColumn.visible?i._addNewColumn.width:0,r=l.width-a.width-n;t.style.width=r+"px",t.style.left=a.width+"px",i.selection.enabled?(t.content.innerHTML=r>=250?i.localize("addNewRowAlt"):i.localize("addNewRowAltSmall"),s.children[1]&&(t.content.title=s.children[1].title=i.localize("addNewRow")),i.rightToLeft&&(t.style.left="initial",t.style.right=a.width+"px"),!1===i.appearance.showRowHeader&&(i.rightToLeft?t.content.innerHTML='<span style="margin-right: 35px;"></span>'+i.localize("addNewRowAlt"):t.content.innerHTML='<span style="margin-left: 35px;"></span>'+i.localize("addNewRowAlt"))):t.content.innerHTML=i.localize("addNewRow"),t.classList.add("smart-add-new-row")}t&&t._style&&(t._style._changed=!1),e.visible?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")}template(){return""}_detach(){const e=this;e.row.headerCell=null,e.row._cells=[],e.row=null,delete e.row,e.element=null,e.removeEventListener("mouseenter",e._mouseEnter),e.removeEventListener("mouseleave",e._mouseLeave),delete e.element,delete e.grid,delete e._mouseEnter,delete e._mouseLeave,delete e.cellsNearContainerElement,delete e.cellsContainerElement,delete e.cellsFarContainerElement,delete e.rowDetail,delete e.rowContainer}onDetached(){this._detach()}});
|
|
1512
|
+
Smart.Utilities.Assign("Grid.Row",class{constructor(e){const t=this;if(e||(e={}),Object.assign(t,e),e){if(void 0===t.data){const i={$:{}};if(e.grid&&e.grid.dataSource){const t=e.grid.dataSource;for(let e=0;e<t.dataFields.length;e++)i[(t.dataFields?t.dataFields[e]:{}).name]=""}else Object.assign(i,e);e.id&&(i.$.id=e.id),t.data=i}if((void 0===e.$||e.$&&void 0===e.$.id)&&(e.data?(e.data.$&&e.data.$.id&&(t.id=e.data.$.id),t.id||(t.id=e.index)):void 0===t.id&&(t.id=e.index),void 0===t.id&&(t.id=Smart.Utilities.Core.createGUID())),void 0===t.detailHeight&&(t.grid?t.detailHeight=t.grid.rowDetail.height:t.detailHeight=200),void 0===t.height&&t.grid&&(t.height=t.grid.layout.rowMinHeight,t.grid.__autoRowHeight&&(t.height=t.grid.__autoRowHeight),t.grid.layout.rowHeight&&(t.height=t.grid.layout.rowHeight)),void 0===t.cellHeight&&(t.cellHeight=t.height),void 0===t.showDetail&&(t.showDetail=!1),void 0===t.index&&(t.index=-1),void 0===t.visibleIndex&&(t.visibleIndex=-1),void 0===t.freeze&&(t.freeze=!1),void 0===t.height&&(t.height=null),void 0===t.minHeight&&(t.minHeight=25,t.grid&&(t.minHeight=t.grid.layout.rowMinHeight)),void 0===t.checked&&(t.checked=!1),void 0===t.selected?(t.selected=!1,(t.grid&&t.grid._selection.rows[t.id]||t.grid&&t.grid._selection.indexes[t.index])&&(t.selected=!0)):t.selected&&t.grid&&(t.grid._selection.rows[t.id]=!0,t.grid._selection.indexes[t.index]=t.index),void 0===t.enabled&&(t.enabled=!0),void 0===t.visible&&(t.visible=!0),void 0===t.allowCheck&&(t.allowCheck=!0),void 0===t.filtered&&(t.filtered=!0),void 0===t.allowResize&&(t.allowResize=!0),void 0===t.allowReorder&&(t.allowReorder=!0),void 0===t.allowToggle&&(t.allowToggle=!0),void 0===t.allowSelect&&(t.allowSelect=!0),void 0===t.starred&&(t.starred=!1),void 0===t.expanded&&(e.data&&void 0!==e.data.expanded?t.expanded=e.data.expanded:t.expanded=!1),t._addStyle(),t.headerCell=null,t._cells=[],t.name="",t.comments=[],!t.autoGenerated&&999999!==t.index){if(t.data){if(t.data.comments&&("string"==typeof t.data.comments?t.data.comments=JSON.parse(t.data.comments):t.comments=t.data.comments),t.data.rowStyle&&(t.style=t._style=e.rowStyle),t.data.history&&(t.history=t.data.history),t.data.style&&(t.style=t._style=t.data.style,t.grid&&(t.grid._cellStyles||(t.grid._cellStyles=[]),t.grid._cellStyles["row"+t.id]=!0,t.grid._cellStyles.length++)),t.data.settings){const e=JSON.parse(t.data.settings);void 0!==e.starred&&(t.starred=e.starred),void 0!==e.height&&(t.height=t.cellHeight=e.height)}const e=t.data.$?t.data.$:t.data;e.history&&(t.history=e.history),e.style&&(t.style=t._style=e.style),e.height&&(t.height=t.cellHeight=e.height),e.comments&&(t.comments=e.comments),e.starred&&(t.starred=e.starred),e.createdDate&&(t.createdDate=e.createdDate),e.createdBy&&(t.createdBy=e.createdBy),e.updatedDate&&(t.updatedDate=e.updatedDate),e.updatedBy&&(t.updatedBy=e.updatedBy)}t.grid&&t.grid._currentUser&&t.grid._currentUser.info&&(void 0===t.createdUserId?(t.createdUserId=t.grid._currentUser.info.id,t.createdDate=new Date):t.createdDate||(t.createdDate=new Date),t.history||(t.history=[],t.addHistory({action:"created",user:t.grid._currentUser.info.id,details:{value:t.name},date:t.createdDate})))}}}_addStyle(){this.style=this._style={background:"",color:"",status:"",fontSize:"",fontFamily:"",fontWeight:"",textDecoration:"",fontStyle:""}}setStyle(e){const t=this;t._style||t._addStyle(),["background","color","fontSize","status","fontFamily","fontWeight","textDecoration","fontStyle"].forEach((i=>{e[i]&&(t._style[i]=e[i])})),t.grid&&(t._style._changed=!0,t.grid._recycle(!1))}get properties(){return["allowToggle","allowResize","allowSelect","allowReorder","allowCheck","createdDate","updatedDate","createdBy","updatedBy","canNotify","children","starred","checked","cells","detailHeight","detailTemplate","cellHeight","expandHeight","data","enabled","expanded","filtered","freeze","grid","headerCell","height","index","id","minHeight","unbound","name","selected","showDetail","visible","parent","leaf","visibleIndex","history","comments","style"]}createElement(){const e=document.createElement("smart-grid-row");return this.element=e,e.setAttribute("role","row"),e._initialize(this),e}_autoSize(e){const t=this,i=t.grid;if(!i)return;let l=i.layout.rowMinHeight;void 0!==t.minHeight&&(l=t.minHeight);const a=t.element;if(e||(e=t),e&&(t.data=e.data),!a)return t.height;i.__autoHeightRows||(i.__autoHeightRows=[]);const n=(e,t,a)=>{if(!a||!t||t.autoGenerated)return 0;i.__autoHeightRows[t.dataField]||(i.__autoHeightRows[t.dataField]=[]);let n=""+e.data[t.dataField];"date"===t.dataType&&e.data[t.dataField]&&(n=""+e.data[t.dataField].toLocaleString());let r=n.length;e._templatesHeight&&e._templatesHeight[t.dataField]&&(r=e._templatesHeight[t.dataField]);const o=i.__autoHeightRows[t.dataField][r],d=o||function(e){a.style.height="auto",t.cellsWrap?a.content.classList.add("wrap"):a.content.classList.add("nowrap");let i=0;if(e&&t)if(t.template){const l=e.canNotify;if(e.canNotify=!1,a.cell.row=e,"function"==typeof t.template)if(a.content.textContent=e.data[t.dataField],e._templatesHeight&&e._templatesHeight[t.dataField])i=e._templatesHeight[t.dataField];else{const i={row:e,column:t,cell:a.cell,oldValue:a.cell.oldValue,value:a.cell.value,template:null,isMeasuring:!0},l=a.innerHTML;a.cell.template(i),i.template?(a.content.textContent="",a.innerHTML=l):a.content.textContent=e.data[t.dataField]}else a._setTemplate(e.data[t.dataField]||"",t.template,a.content);e.canNotify=l}else if("date"===t.dataType){const i=a.cell.getFormattedValue(e.data[t.dataField],t.cellsFormat);a.content.textContent=i}else a.content.textContent=e.data[t.dataField];let l=a.offsetHeight;return"function"==typeof t.template&&i>0&&(l=i),a.style.height="",a.content.classList.remove("wrap"),a.content.classList.remove("nowrap"),l}(e);l=Math.max(l,d),i.__autoHeightRows[t.dataField][r]=d};for(let t=0;t<i._frozenNearColumns.length;t++)n(e,i._frozenNearColumns[t],a.children[0].children[t]);for(let t=0;t<i._frozenFarColumns.length;t++)n(e,i._frozenFarColumns[t],a.children[2].children[t]);for(let t=0;t<a.children[1].children.length;t++)n(e,i._columnElements[t].column,a.children[1].children[t]);return l}addHistory(e){const t=this;e&&(t.grid.storeHistory?(void 0===t.history&&(t.history=[]),t.history.length===t.grid.storeHistoryItems&&t.history.splice(0,1),t.history.push(e)):t.history=[])}clearHistory(){this.history=[]}autoSize(){const e=this,t=e.grid._measureRowElement(e.data),i=e.data?t.row._autoSize(e):e.grid.layout.rowMinHeight;e.height=i,t.remove()}getCell(e){const t=this,i=t.grid;if(!i)return null;if("string"!=typeof e&&"number"!=typeof e||(e=i.columnByDataField[e]),!e)return null;if(t["column_"+e.dataField]){const i=t["column_"+e.dataField];return i.column=e,i}{const l=new Smart.Grid.Cell(t,e,i);return t["column_"+e.dataField]=l,l}}get cells(){const e=this;return e._cells&&e.grid&&e._cells.length===e.grid.columns.length||e.createCells(),e._cells}get viewCells(){const e=this,t=[];for(let i=0;i<e.grid.viewColumns.length;i++){const l=e.grid.viewColumns[i];if(e["column_"+l.dataField]){const i=e["column_"+l.dataField];t.push(i)}else{const i=new Smart.Grid.Cell(e,l,e.grid);e["column_"+l.dataField]=i,t.push(i)}}return e._viewCells=t,t}createCells(){const e=this,t=e.grid;e._cells=[];for(let i=0;i<t.viewColumns.length;i++){const l=t.viewColumns[i];if(!l.autoGenerated)if(e["column_"+l.dataField]){const t=e["column_"+l.dataField];e._cells.push(t)}else{const i=new Smart.Grid.Cell(e,l,t);e["column_"+l.dataField]=i,e._cells.push(i)}}}toggle(e){this.element._handleExpandCollapse(!this.expanded,e)}select(){this.setProperty("selected",!0)}unselect(){this.setProperty("selected",!1)}expand(){this.element&&this.element._handleExpandCollapse(!0)}collapse(){this.element&&this.element._handleExpandCollapse(!1)}render(){const e=this;e.element.row=e,e.element._render()}setProperty(e,t){const i=this,l=i.getProperty(e);i[e]=t,l!==t&&(i.canNotify=!1,i.propertyChanged(e,l,t),i.canNotify=!0)}getProperty(e){const t=this;if("selected"===e&&t.grid){let i=!1;t.grid._selection.cells["row"+t.id]&&(i=null),t.grid&&t.grid._selection.rows[t.id]&&(i=!0),t.grid&&t.grid._selection.indexes[t.index]&&(i=!0);const l=t.grid.rows.canNotify;return t.grid.rows.canNotify=!1,t[e]=i,t.grid.rows.canNotify=l,i}return t[e]}_updateData(){const e=this;e.data&&e.data.$&&["updatedBy","updatedDate","createdDate","createdBy","starred","comments","history","style"].forEach((t=>{void 0!==e.data.$[t]?(e[t]=e.data.$[t],"style"===t&&(e._style=e[t],e._style._changed=!0)):"starred"===t?e[t]=!1:"comments"===t||"history"===t?e[t]=[]:"updatedBy"===t?e[t]=-1:"updatedDate"===t?e[t]=null:"style"===t&&(e._addStyle(),e._style._changed=!0)}))}propertyChanged(e,t,i){const l=this;if("updatedBy"!==e&&"createdBy"!==e&&"userData"!==e&&"starred"!==e&&"style"!==e&&"history"!==e&&"updatedDate"!==e&&"createdDate"!==e&&"comments"!==e){if("showDetail"===e){l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled&&(l.height=0);const e=l.element.rowDetail;if(l.grid.appearance.allowRowDetailToggleAnimation&&!l.grid.rowDetail.dialog.enabled){l.grid._resizeHandling=!1;const t=function(e){const t=l.grid._toggledRow;!t||"transform"!==e.propertyName&&"height"!==e.propertyName||a(t)},a=function(e){e.grid.$.content.style.transition="",e.element.rowDetail.removeEventListener("transitionend",t),e.element.rowDetail.removeEventListener("transitioncancel",t),e.grid._toggledRow=null,e.element.removeAttribute("has-detail"),l.grid._refresh(),setTimeout((()=>{l.grid._resizeHandling=!0}),50)};l.grid._toggledRow=l,e.addEventListener("transitionend",t),e.addEventListener("transitioncancel",t),i?(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.element.toggleDetailButton.classList.remove("smart-animate"),setTimeout((()=>{l.element.toggleDetailButton.classList.add("smart-animate"),l.element.toggleDetailButton.setAttribute("toggled",""),l.element.setAttribute("show-detail","")})),l.element.style.height=l.cellHeight+l.detailHeight+"px",l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)+l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),e.classList.remove("smart-hidden"),e.style.height!==l.detailHeight+"px"&&(e.style.height=l.detailHeight+"px"),e.style.lineHeight!==l.detailHeight+"px"&&(e.style.lineHeight=l.detailHeight+"px"),e.style.top!==l.cellHeight+"px"&&(e.style.top=l.cellHeight+"px")):(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)-l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),setTimeout((()=>{l.element.style.height=l.cellHeight+"px",l.element.removeAttribute("show-detail")})))}else l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled?l.grid._refresh():l.grid._recycle()}if("allowCheck"!==e&&"allowSelect"!==e||l.grid._recycle(),"checked"===e&&(l.grid.checkBoxes.hasThreeStates&&l.grid._hasThreeStates(l,l),l.grid._recycle()),"selected"===e){if(!1===l.allowSelect)return;if(i?(l.grid._selection.rows[l.id]=!0,l.grid._selection.indexes[l.index]=l.index):!1===i&&(void 0!==l.grid._selection.rows[l.id]&&delete l.grid._selection.rows[l.id],void 0!==l.grid._selection.indexes[l.index]&&delete l.grid._selection.indexes[l.index]),!l.element)return;i?l.element.setAttribute("aria-selected",!0):l.element.removeAttribute("aria-selected"),l.grid._recycle()}"visible"===e&&l.grid.refresh(),"expanded"===e&&(l.expandHeight||l.grid.refresh()),"height"===e&&(l.expandHeight||l.cellHeight!==i&&(l.cellHeight=i,l.grid.refresh())),"minHeight"===e&&(l.height=null,l.grid.refresh()),"freeze"===e&&(!0===i||"near"===i?l.grid._frozenNearRows.push(l):"far"===i?l.grid._frozenFarRows.push(l):(l.grid._frozenNearRows.splice(l.grid._frozenNearRows.indexOf(l),1),l.grid._frozenFarRows.splice(l.grid._frozenFarRows.indexOf(l),1)),l.grid.refresh())}else l.data&&l.data.$&&(l.data.$[e]=i,"style"===e&&(l._style=i,l._style._changed=!0))}}),Smart("smart-grid-row",class extends Smart.BaseElement{static get properties(){return{}}get isUtilityElement(){return!0}get hasStyleObserver(){return!1}addThemeClass(){}addDefaultClass(){}_initialize(e){const t=this,i=e.grid,l=i._columnElements,a=i._frozenNearColumns,n=i._frozenFarColumns,r=document.createElement("div"),o=document.createElement("div"),d=document.createElement("div"),s=document.createDocumentFragment(),c=document.createDocumentFragment(),g=document.createDocumentFragment();i.rightToLeft?(o.classList.add("far","smart-grid-cell-container"),r.classList.add("center","smart-grid-cell-container"),d.classList.add("near","smart-grid-cell-container")):(o.classList.add("near","smart-grid-cell-container"),r.classList.add("center","smart-grid-cell-container"),d.classList.add("far","smart-grid-cell-container")),t._properties=[],t.row=e,e.createCells(),t._mouseEnter=function(){if(!i.isScrolling&&!i.editing.isEditing&&(t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.commandColumn.inline&&!t.commandBar)){const e=document.createElement("div"),l=i._getCommandColumnCommandsTemplate();e.classList.add("smart-grid-command-bar"),e.innerHTML=l,r.appendChild(e),requestAnimationFrame((()=>{e.classList.add("show")})),i._updateCommandColumnCommandsVisibility(e,t.row),e.onmousedown=function(e){const l=e.composedPath();let a=null;for(let e=0;e<l.length;e++)if(l[e].classList.contains("smart-grid-command-item")){a=l[e];break}if(a){const l=a.getAttribute("command");i._applyCommand(l,[t.row]),t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),t.removeAttribute("hover"),e.stopPropagation(),e.preventDefault()}},t.commandBar=e}},t._mouseLeave=function(){i.isScrolling||i.editing.isEditing||t.commandBar&&(t.commandBar.classList.remove("show"),t.commandBar.addEventListener("transitionend",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})),t.commandBar.addEventListener("transitioncancel",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})))},t.addEventListener("mouseenter",t._mouseEnter),t.addEventListener("mouseleave",t._mouseLeave);for(let t=0;t<a.length;t++){const i=a[t],l=e.getCell(i).createElement();c.appendChild(l)}for(let t=0;t<n.length;t++){const i=n[t],l=e.getCell(i).createElement();g.appendChild(l)}for(let i=0;i<l.length;i++){const a=l[i],n=a.column;if(!a.parentNode||!n)break;const r=e.getCell(n).createElement();n&&n._treeColumn&&(t.toggleButton=r.toggleButton),s.appendChild(r)}o.appendChild(c),r.appendChild(s),d.appendChild(g);const h=document.createElement("div");h.classList.add("smart-grid-row-detail","smart-hidden","smart-animate");const m=document.createElement("div");m.classList.add("smart-grid-row-sub-container","smart-hidden"),t._rowFragment=document.createDocumentFragment(),t._rowFragment.appendChild(o),t._rowFragment.appendChild(r),t._rowFragment.appendChild(d),t._rowFragment.appendChild(h),t._rowFragment.appendChild(m),t.appendChild(t._rowFragment),t.cellsNearContainerElement=t.children[0],t.cellsContainerElement=t.children[1],t.cellsFarContainerElement=t.children[2],t.rowDetail=t.children[3],t.rowContainer=t.children[4],i.layout.rowHeight&&"auto"!==i.layout.rowHeight&&(e.filterRow?t.style.height=i.layout.rowMinHeight+"px":t.style.height=i.layout.rowHeight+"px"),delete t._rowFragment}get enableShadowDOM(){return!1}_handleExpandCollapse(e,t){const i=this,l=i.row,a=l.grid;if(!l.allowToggle)return null;a._toggledRow=l;let n={row:l,id:l.id};t&&(n.originalEvent=t.originalEvent),a.$.fireEvent(e?"rowExpand":"rowCollapse",n);const r=a.dataSource.virtualDataSourceOnExpand&&e&&!0!==l.data._loaded;if(e?a.dataSource._expandedRowIds[l.data.$.id]=!0:delete a.dataSource._expandedRowIds[l.data.$.id],!a.appearance.allowRowToggleAnimation||r)a.rows.canNotify=!1,l.expanded=e,a.rows.canNotify=!0,l.data.expanded=e,r?(l.data._loaded=!0,l.element.querySelector("button").setAttribute("load",""),a._virtualDataRequest("expand")):(a._toggledRow=null,a._refresh()),r&&a.appearance.allowRowToggleAnimation&&(i.toggleButton.removeAttribute("toggled"),i.toggleButton.classList.remove("smart-animate"),setTimeout((()=>{i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")}),50));else{const t=function(e){e.height=e.cellHeight,a.$.content.style.transition="",e.element.rowContainer.innerHTML="",e.element.rowContainer.classList.add("smart-hidden"),e.element.rowContainer.removeEventListener("transitionend",n),e.element.rowContainer.removeEventListener("transitioncancel",n),e.element.rowContainer.style.height="",e.element.rowContainer.style.transform="",e.element.rowContainer.style.transition="",e.element.rowContainer.classList.remove("smart-animate"),e.element.toggleButton&&e.element.toggleButton.classList.remove("smart-animate"),a._refresh()},n=function(e){const l=a._toggledRow;i._toggleTimer=null,a._toggledRow=null,!l||"transform"!==e.propertyName&&"height"!==e.propertyName||setTimeout((()=>{t(l)}),50)};if(i._toggleTimer){clearTimeout(i._toggleTimer);const e=a._toggledRow;a._toggledRow=null,t(e)}i._toggleTimer=setTimeout((()=>{const t=function(){!function(){const e=a._toggledRow;a._refresh(),a._refreshRowHierarchy();let t=0;for(let e=0;e<a.rowHierarchy.length;e++){const i=a.rowHierarchy[e];let l=i.parent;for(;l;)l.id===a._toggledRow.id&&(t+=i.height),l=l.parent}const i=a._scrollView.scrollTop,l=a._contentHeight-(e.cellHeight+e.top-i);e.expandHeight=Math.min(l,t),e.height=e.cellHeight+e.expandHeight}(),a._recycle(!1),i.style.overflow="hidden",i.style.height="auto",i.style.lineHeight=l.cellHeight+"px"};e?(l.expanded=!0,t(),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",i.toggleButton&&i.toggleButton.removeAttribute("toggled"),a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),setTimeout((function(){i.toggleButton&&(i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")),i.rowContainer.addEventListener("transitionend",n),i.rowContainer.addEventListener("transitioncancel",n),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)"}))):(t(),l.expanded=!1,i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px",a.$.content.style.transition="",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)",i.toggleButton&&(i.toggleButton.setAttribute("toggled",""),i.toggleButton.classList.add("smart-animate")),setTimeout((function(){i.toggleButton&&i.toggleButton.removeAttribute("toggled",""),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),i.rowContainer.addEventListener("transitionend",n),i.rowContainer.addEventListener("transitioncancel",n),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px"}),0))}),50)}}_renderAddNewRow(){const e=this,t=e.row,i=t.grid,l=t.element,a=new Smart.Grid.Cell(t,i.columns[0],i);t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden");let n=i.editing.addNewRow.label;n.indexOf("{{")>=0&&(n=i.localize("addNewRow")),l.innerHTML="<smart-grid-cell><div>"+n+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),l.firstChild.cell=a,i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px"))}_renderFilterRow(){const e=this,t=e.row,i=t.grid,l=t.element;t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),l.innerHTML="<smart-grid-cell><div>"+i.localize("addNewRow")+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")}_renderEmpty(){this.classList.add("smart-hidden")}_renderCell(e,t,i){if(!t)return void i.classList.add("smart-hidden");let l=e.getCell(t);if(l.element!==i&&(l._styleChanged=!0),e._style&&!t.autoGenerated){const t=l._updating;l._updating=!0,e._style._changed&&(l.color=e._style.color,l.background=e._style.background,l.fontFamily=e._style.fontFamily,l.fontSize=e._style.fontSize,l.fontStyle=e._style.fontStyle,l.textDecoration=e._style.textDecoration,l.fontWeight=e._style.fontWeight);const a=i.firstElementChild,n=e=>a._style&&a._style[e]?a._style[e]:"backgroundColor"===e&&null===l.background&&""===a.style[e]||null===l[e]&&""===a.style[e]?null:a.style[e];n("backgroundColor")===l.background&&n("fontFamily")===l.fontFamily&&n("fontSize")===l.fontSize&&n("fontStyle")===l.fontStyle&&n("textDecoration")===l.textDecoration&&n("fontWeight")===l.fontWeight&&n("color")===l.color||(l._styleChanged=!0),l._updating=t}i.cell!==l&&(i.cell.background===l.background&&i.cell.borderColor===l.borderColor&&i.cell.color===l.color&&i.cell.fontSize===l.fontSize&&i.cell.fontFamily===l.fontFamily&&i.cell.textDecoration===l.textDecoration&&i.cell.fontWeight===l.fontWeight&&i.cell.fontStyle===l.fontStyle||(l._styleChanged=!0)),l.element=i,i.cell=l,t._treeColumn&&l.element.isRendered&&!e.filterRow&&l.element._refresh(),l.render(),t&&t.rowHeaderColumn&&(e.header=i,i.setAttribute("data-id",e.id))}_alternate(){const e=this,t=e.row,i=t.grid,l=i.appearance.alternationStart,a=i.appearance.alternationEnd>0?i.appearance.alternationEnd:1/0;if(!(i.appearance.alternationCount<=0)&&(e.removeAttribute("alternation-index"),t.visibleIndex>=l&&t.visibleIndex<=a)){const a=(t.visibleIndex-l)%i.appearance.alternationCount;e.setAttribute("alternation-index",a)}}_openRowDetailDialog(e){const t=this,i=t.row.grid,l=t.row;if(!i.rowDetail.dialog.enabled||!l.showDetail)return!1;const a=i._dialogRowDetail||i._createDialog(i.rowDetail.dialog);if(!l.detailTemplate&&!i.rowDetail.template&&i._openRowSettingsDialog)return void(i.editing.dialog.visible||(t._settingsDialogRowId=l.id,i._openRowSettingsDialog(l.id)));if(i.rowDetail.dialog.visible&&a.row!==l)return void(l.showDetail=!1);const n="{{message}}"===i.rowDetail.dialog.header?i.localize("dialogRowDetailHeader",{value:l.visibleIndex+1}):i.rowDetail.dialog.header;!i.rowDetail.dialog.visible||i.rowDetail.dialog.row!==l||l.showDetail?(a.header.innerHTML=n,a.content.innerHTML="",a.content.style.width="100%",a.content.style.height="100%",a.row=l,a.querySelector(".smart-footer").classList.add("smart-hidden"),i._dialogRowDetail||(a.setAttribute("tabindex",0),a.modal=!0,a.btnConfirm.innerHTML=i.localize("dialogRowDetailButtonConfirm"),a.btnCancel.innerHTML=i.localize("dialogRowDetailButtonCancel"),a.btnCancel.classList.add("smart-hidden"),a.onOpen=function(){i.rowDetail.dialog.visible=!0},a.onClose=function(){i.rowDetail.dialog.visible=!1,a.row.showDetail=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},i._dialogRowDetail=a),a.open(),setTimeout((function(){a.focus()}),100),a.content.appendChild(e)):a.close()}_renderDetail(e){const t=this,i=t.row.grid,l=t.row;let a=l.id,n=l.detailTemplate||i.rowDetail.template;if(n.startsWith("#")&&(n=document.querySelector(n)),l._detail)return e.firstChild===l._detail||(e.firstChild&&e.removeChild(e.firstChild),e.appendChild(l._detail)),void(i.onRowDetailUpdated&&i.onRowDetailUpdated(l.index,l,e.firstChild));if(n instanceof HTMLTemplateElement){const t=n.content.cloneNode(!0).firstElementChild;a=a.toString(),a=a.replace(/'/gi,"\\'"),a=a.replace(/"/gi,'\\"');let i=t.outerHTML.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id);i.indexOf("{{value=")>=0&&(a?(i=i.substring(0,i.indexOf("{{value="))+a+i.substring(i.indexOf("}")),i=i.replace(/}/gi,""),i=i.replace(/{/gi,"")):(i=i.replace(/{{value=/gi,""),i=i.replace(/}}/gi,""))),i="<div>"+i+"</div>";for(let e in l.data)i=i.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==i&&(e.innerHTML=i)}else{let t="<div>"+n.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id)+"</div>";for(let e in l.data)t=t.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==t&&(e.innerHTML=t)}i.onRowDetailInit&&i.onRowDetailInit(l.index,l,e.firstChild),i.rowDetail.dialog.enabled?i.rowDetail.dialog.visible?t._openRowDetailDialog(e.firstChild):t._openRowDetailDialog(e.firstChild.firstElementChild):l._detail=e.firstChild}_render(){let e=this;const t=e.row,i=t.grid;if(!i)return;const l=t.getProperty("selected");if(!1===l&&e.hasAttribute("selected")?e.removeAttribute("selected"):!0===l?e.setAttribute("selected",""):null===l&&e.setAttribute("selected","indeterminate"),t.allowSelect||e.setAttribute("selected","none"),e.hasAttribute("unbound")&&e.removeAttribute("unbound"),t.unbound&&e.setAttribute("unbound",""),e.removeAttribute("focus"),i._selection.focusedCell&&i._selection.focusedCell.row&&i._selection.focusedCell.row.id===t.id&&e.setAttribute("focus",""),!i._toggledRow&&e.classList.contains("smart-animate"))return e.classList.remove("smart-animate"),e.rowContainer.innerHTML="",e.rowContainer.classList.add("smart-hidden"),i._refreshLayout(),void i._recycle();if(0===i.columns.length)return void e._renderEmpty();if(t.addNewRow&&!t.inline)return void e._renderAddNewRow();let a=!1;if(t.addNewRow&&t.inline&&(a=!0),i._toggledRow&&(t.id===i._toggledRow.id?e.setAttribute("toggle",""):e.hasAttribute("toggle")&&e.removeAttribute("toggle")),i._toggledRow&&i.appearance.allowRowToggleAnimation){let l=t.parent;if(!i._toggledRow.expanded&&i._toggledRow.id===t.id){const t=e.rowContainer;for(let e=0;e<t.children.length;e++){const l=t.children[e],a=l.getAttribute("data-id"),n=i.rowById[a];l.getAttribute("data-rendered")||(l.setAttribute("data-rendered",!0),n.element=l,n.render())}}for(;l;){if(l.id===i._toggledRow.id){const a=l.element.rowContainer;if(i._toggledRow.expanded){e.classList.add("smart-hidden");let l=t.createElement(i);for(let e=0;e<a.children.length;e++){const i=a.children[e];if(i.getAttribute("data-id")===t.id.toString())return void(l=i)}t.element=l,a.appendChild(l),a.classList.remove("smart-hidden"),l.row=t,e=l}break}l=l.parent}}e._alternate();const n=parseFloat(i.$.columnNearContainer.style.width),r=parseFloat(i.$.columnContainer.style.width),o=parseFloat(i.$.columnFarContainer.style.width),d=e.children[1],s=e.children[0],c=e.children[2];if(i.rightToLeft?(s.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&s.classList.add("vscroll")):(c.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&c.classList.add("vscroll")),e.hasAttribute("group")&&e.removeAttribute("group"),e.hasAttribute("tree")&&e.removeAttribute("tree"),e.hasAttribute("level")&&(e.removeAttribute("level"),e.removeAttribute("aria-level")),e.hasAttribute("leaf")&&e.removeAttribute("leaf"),e.hasAttribute("expanded")&&e.removeAttribute("expanded"),e.hasAttribute("summary")&&e.removeAttribute("summary"),e.hasAttribute("filter")&&e.removeAttribute("filter"),null===t.filtered&&e.setAttribute("filter","indeterminate"),i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&"advanced"===i.grouping.renderMode&&!t.filterRow?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),void 0!==t.label&&t.level===i.dataSource.groupBy.length-1&&e.setAttribute("leaf",""),void 0!==t.label?e.setAttribute("group",""):e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):i.dataSource.boundHierarchy?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),t.leaf&&e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):(t.canNotify=!1,t.leaf=!0,t.expanded=!1,t.summaryRow=!1,t.data||(t.data={}),t.data.summaryRow&&(t.summaryRow=!0),t.level=0,e.toggleButton&&e.toggleButton.classList.add("smart-hidden"),t.canNotify=!0),e.setAttribute("data-id",t.id),e.visible=t.visible,e.cellsNearContainerElement.classList.remove("smart-visibility-hidden"),e.cellsContainerElement.classList.remove("smart-visibility-hidden"),e.cellsFarContainerElement.classList.remove("smart-visibility-hidden"),e.removeAttribute("rowspan"),i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")),i.rightToLeft?(d.style.right!==i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"&&(d.style.right=i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"),i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth<=0&&!i._scrollView.scrollWidth&&(d.style.right=-i.offsetWidth+i._computedColumnsWidth+"px")):d.style.left!==-i._scrollView.scrollLeft+"px"&&(d.style.left=-i._scrollView.scrollLeft+"px"),i.rowDetail.enabled){const l=e.rowDetail;e.removeAttribute("show-detail"),t.showDetail?(l.classList.remove("smart-hidden"),e.setAttribute("show-detail",""),i.rowDetail.dialog.enabled?l.classList.add("smart-hidden"):(l.style.height!==t.detailHeight+"px"&&(l.style.height=t.detailHeight+"px"),l.style.lineHeight!==t.detailHeight+"px"&&(l.style.lineHeight=t.detailHeight+"px"),l.style.top!==t.cellHeight+"px"&&(l.style.top=t.cellHeight+"px")),e._renderDetail(l)):l.classList.add("smart-hidden")}else e.rowDetail&&e.rowDetail.classList.add("smart-hidden");if(s.classList.remove("smart-hidden"),c.classList.remove("smart-hidden"),s.style.width!==n+"px"&&(s.style.width=n+"px"),d.style.width!==r+"px"&&(d.style.width=r+"px"),c.style.width!==o+"px"&&(c.style.width=o+"px"),s.style.height=t.cellHeight+"px",d.style.height=t.cellHeight+"px",c.style.height=t.cellHeight+"px",0===o&&c.classList.add("smart-hidden"),0===n&&s.classList.add("smart-hidden"),n>0&&(parseInt(n),parseInt(i._autoGeneratedColumnsNearWidth)),o>0&&parseInt(o)===parseInt(i._autoGeneratedColumnsFarWidth)&&c.classList.add("border-collapse"),t._classNames="",i.onRowClass){const e=i.onRowClass(t.visibleIndex,t.data,t);if(e){const i=e.trim().split(" ");t._classNames=i}}if(i.rowCSSRules){const e=Object.keys(i.rowCSSRules);for(let l=0;l<e.length;l++){let a=e[l];const n={index:t.visibleIndex,data:t.data,row:t,api:i};i.rowCSSRules[a](n)&&(t._classNames=[a])}}for(let l=0;l<i._frozenNearColumns.length;l++){const a=i._frozenNearColumns[l];let n=e.children[0].children[l];n||(n=t.getCell(a).createElement(),e.children[0].appendChild(n)),!1!==a.visbile&&e._renderCell(t,a,n)}for(let l=0;l<i._frozenFarColumns.length;l++){const a=i._frozenFarColumns[l];let n=e.children[2].children[l];n||(n=t.getCell(a).createElement(),e.children[2].appendChild(n)),!1!==a.visbile&&e._renderCell(t,a,n)}for(let l=0;l<d.children.length;l++)if(!i._columnElements[l+i._frozenNearColumns.length]){let i=e.children[1].children[l];e._renderCell(t,null,i)}for(let l=0;l<i._columnElements.length;l++){const a=i._columnElements[l],n=a.column;if(!a.parentNode||!n){if(a&&!n){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}continue}let r=e.children[1].children[l];r||(a.column||(a.column=n),r=t.getCell(n).createElement(),e.children[1].appendChild(r)),a.classList.contains("smart-visibility-hidden")?r.classList.add("smart-visibility-hidden"):(r.classList.remove("smart-visibility-hidden"),e._renderCell(t,n,r))}if(a){let t=e.children[1].children[0];const l=d.getBoundingClientRect(),a=s.getBoundingClientRect();for(let e=0;e<s.children.length;e++)s.children[e].classList.add("smart-add-new-row");s.children[0].innerHTML='<div style="width: 100%;" class="smart-grid-icon smart-icon-plus show"></div>',s.children[0].style.width="50px",s.children[0].style.zIndex=9;const n=i.editing.addNewColumn.visible?i._addNewColumn.width:0,r=l.width-a.width-n;t.style.width=r+"px",t.style.left=i._scrollView.scrollLeft+a.width+"px",i.selection.enabled?(t.content.innerHTML=r>=250?i.localize("addNewRowAlt"):i.localize("addNewRowAltSmall"),s.children[1]&&(t.content.title=s.children[1].title=i.localize("addNewRow")),i.rightToLeft&&(t.style.left="initial",t.style.right=a.width+"px"),!1===i.appearance.showRowHeader&&(i.rightToLeft?t.content.innerHTML='<span style="margin-right: 35px;"></span>'+i.localize("addNewRowAlt"):t.content.innerHTML='<span style="margin-left: 35px;"></span>'+i.localize("addNewRowAlt"))):t.content.innerHTML=i.localize("addNewRow"),t.classList.add("smart-add-new-row"),t.firstElementChild.classList.add("align-left"),t.firstElementChild.classList.remove("align-right")}t&&t._style&&(t._style._changed=!1),e.visible?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")}template(){return""}_detach(){const e=this;e.row.headerCell=null,e.row._cells=[],e.row=null,delete e.row,e.element=null,e.removeEventListener("mouseenter",e._mouseEnter),e.removeEventListener("mouseleave",e._mouseLeave),delete e.element,delete e.grid,delete e._mouseEnter,delete e._mouseLeave,delete e.cellsNearContainerElement,delete e.cellsContainerElement,delete e.cellsFarContainerElement,delete e.rowDetail,delete e.rowContainer}onDetached(){this._detach()}});
|
|
1513
1513
|
|
|
1514
1514
|
/***/ }),
|
|
1515
1515
|
|
|
1516
1516
|
/***/ 8469:
|
|
1517
1517
|
/***/ (() => {
|
|
1518
1518
|
|
|
1519
|
-
Smart.Utilities.Assign("Grid.Select",class{_refreshSelection(){const e=this;if(e.selection.enabled&&(e._selectionColumn.refresh(),!e._isVirtualMode()&&e._selection&&e._selection.rows))for(let t in e._selection.rows)e.rowById[t]||delete e._selection.rows[t];e._refreshCellSelectionRect()}_toggleColumnSelection(e){const t=this;if(!t.selection.enabled||"none"===t.selection.checkBoxes.selectAllMode)return void(t._inputOverlay&&t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay));let l=e.element.getAttribute("selected");l="indeterminate"===l||""!==l;let n=t._recyclingRows;t._selectionColumn._selecting=!0,t.beginUpdate(),t._selection.indexes=[];for(let e=0;e<n.length;e++)n[e].selected=l;if(t._selectionColumn._selecting=!1,t.endUpdate(!1),t._isVirtualMode())if(l)for(let e=0;e<t.dataSource.virtualDataSourceLength;e++)l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e);else t._selection.indexes=[],t._selection.rows=[];if(t._recycle(!1),t.$.fireEvent("change",{started:!1,finished:!0}),t.selection.enabled&&t.selection.checkBoxes.enabled&&"none"!==t.selection.checkBoxes.selectAllMode){const l=e.element,n=l.querySelector(".smart-input");t._inputOverlay?t._inputOverlay.parentNode!==t.$.columnHeader&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)):(t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)),t._inputOverlay.column=e,t._inputOverlay.onpointerdown=function(){t._inputOverlay||(t._inputOverlay.onpointerdown=null);const e=t._inputOverlay.column;t._inputOverlay.classList.remove("smart-animate"),t._selectionColumn._selecting=!0,t.beginUpdate();let l=e.element.hasAttribute("selected"),n=t._recyclingRows;for(let e=0;e<n.length;e++)n[e].selected=!l;t._selectionColumn._selecting=!1;const o=t._inputOverlay;if(t.endUpdate(!1),t._isVirtualMode())if(l)t._selection.indexes=[],t._selection.rows=[];else for(let e=0;e<t.dataSource.virtualDataSourceLength;e++)l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e);return t._recycle(),t.$.fireEvent("change",{started:!1,finished:!0}),t.$.fireEvent("columnClick",{column:e,dataField:e.dataField}),t.$.columnHeader.appendChild(o),t._inputOverlay=o,t._inputOverlay.classList.add("smart-animate"),!1},t._inputOverlay.classList.add("smart-input-overlay"),t._inputOverlay.classList.add("smart-input-overlay-column"),t.appearance.allowCheckBoxesSelectionAnimation&&t._inputOverlay.classList.add("smart-animate"),t._inputOverlay.style.top=(l.offsetHeight-n.offsetHeight)/4+1+"px";const o=t._selectionColumn.element.parentElement.offsetLeft+t._selectionColumn.element.offsetLeft;t.rightToLeft?t._inputOverlay.style.right=o+"px":t._inputOverlay.style.left=o+"px",t._inputOverlay.style.height=l.offsetWidth+"px",t._inputOverlay.style.width=l.offsetWidth+"px",t._inputOverlay.onmousedown=null,t._inputOverlay.classList.add("smart-input-overlay-on"),t._selectionColumn.refresh()}}_refreshCheckBoxColumnSelection(){const e=this;if(e.selection.enabled&&e.selection.checkBoxes.enabled){const t=e._selectionColumn.element;"none"===e.selection.checkBoxes.selectAllMode?(t.removeAttribute("checkbox"),t.label.classList.remove("smart-input")):(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")),e._selectionColumn.refresh()}}_handleExtendedRowSelection(e,t){const l=this;if(!e)return;let n=l._recyclingRows;if(l.paging.enabled&&"page"===l.selection.selectAllMode&&(n=n.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize)),!t||t.ctrlKey||t.metaKey||(l._selection.rows=[],l._selection.indexes=[]),t&&!t.shiftKey&&(l._rangeSelectionStartRow=e,l._rangeSelectionEndRow=e),t&&t.shiftKey){l._rangeSelectionEndRow=e;const t=n.indexOf(l._rangeSelectionStartRow),o=n.indexOf(l._rangeSelectionEndRow),i=Math.min(t,o),a=Math.max(t,o);if(-1===t||-1===o)return;for(let e=i;e<=a;e++){const t=n[e];t.allowSelect&&t.setProperty("selected",!0)}}else!1!==e.allowSelect&&(t&&(t.ctrlKey||t.metaKey)?null===e.selected?e.setProperty("selected",!0):e.setProperty("selected",!e.selected):e.setProperty("selected",!0))}_setSelection(e,t,l){const n=this;if(!n.selection.enabled)return;if(n._lastColumnSelectionRange=null,n._lastRowSelectionRange=null,n.closeMenu(),null===e&&null===t)return void n.clearSelection();const o=function(){if(l&&!l.ctrlKey&&!l.metaKey&&!l.shiftKey||"one"===n.selection.mode){if("many"!==n.selection.mode){for(let e in n._selection.rows){const t=n.rowById[e];t&&(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}n._selection.indexes=[],n._selection.rows=[],n._selection.columns=[],n._selection.cells=[]}n._selection.focusedCell=null}if(n._selection.selectionRect){const e=n._selection.selectionRect;e.parentNode.removeChild(e);const t={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(t.down="touchstart",t.move="touchmove",t.up="touchend"),document.removeEventListener(t.move,e.onMove),document.removeEventListener(t.up,e.onUp),document.removeEventListener(t.down,e.onDown),n._selection.selectionRect=null}};n.beginUpdate();const i=n.columnByDataField[t],a=()=>{const t=n.rowById[e];t&&(t.allowSelect||null===t.allowSelect&&!l)&&(n.selection.checkBoxes.enabled&&l&&l.originalEvent&&l.originalEvent.target&&l.originalEvent.target.parentNode&&l.originalEvent.target.parentNode.hasAttribute("checkbox")&&(l.ctrlKey=!0),o(),n._selectRow(e,l))};if(n.selection.allowCellSelection&&null!=e&&i&&!i.autoGenerated){const i=n.rowById[e];if(!i)return n.endUpdate(!1),void n._recycle();let a=i.getCell(t);const s=n._getParentCell(i,t);s&&(a=s.row.getCell(s.column.dataField)),a&&a.column.allowSelect&&(o(),!l||l.ctrlKey||l.metaKey||(n._selection.rows=[],n._selection.indexes=[],n._selection.columns=[],"many"!==n.selection.mode&&(n._selection.cells=[])),"extended"===n.selection.mode?l&&(l.ctrlKey||l.metaKey)?a.selected=!a.selected:a.selected=!0:"one"===n.selection.mode?a.selected=!0:a.selected=!a.selected,(l&&!l.shiftKey||!n._selection.focusedCell)&&(n._selection.focusedCell={id:a.row.id,value:a.value,index:a.row.index,dataField:a.column.dataField}),l&&(l.shiftKey||n._selection.focusedCell.id===a.row.id&&n._selection.focusedCell.dataField===a.column.dataField&&"extended"===n.selection.mode)&&(s?n._renderCellSelectionRect(a.row,a.column,s.endRow,s.endColumn):n._renderCellSelectionRect(a.row,a.column,a.row,a.column)))}else n.selection.allowRowHeaderSelection&&null!=e&&void 0===n.columnByDataField[t]||n.selection.checkBoxes.enabled&&null!=e&&"_checkBoxColumn"===t&&void 0===n.columnByDataField[t]?a():null==e||null!=t&&void 0===n.columnByDataField[t]||!n.selection.allowRowSelection?n.selection.allowColumnHeaderSelection&&i&&(o(),n._selectColumn(t,l||new KeyboardEvent("keydown"))):a();n.endUpdate(!1,!1),n._recycle(),null==e||i||n._renderInputOverlay(e,l),n.__selectionStarted=new Date}_renderCellSelectionRect(e,t,l,n){const o=this;let i=o._recyclingRows;const a=i.indexOf(e),s=i.indexOf(l);if(!(o.grouping.enabled&&"advanced"===o.grouping.renderMode&&o.dataSource&&o.dataSource.groupBy.length>0)&&a>=0&&s>=0){if(!o._selection.selectionRect){const e=function(e){const t=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div");return n.classList.add("smart-selection-overlay"),n.appendChild(l),l.appendChild(t),t.classList.add("smart-selection-overlay-content"),l.classList.add("smart-selection-overlay-border-content"),o.selection.allowCellDragSelectionHandle&&e&&l.classList.add("handle"),o.$.scrollView.appendChild(n),n},t=o._selection.selectionRect=e(!0);if(o.selection.allowCellDragSelectionHandle){let e=null,l=null,n=null;t.onMove=function(t){const a=o._selection.selectionRect;let s=t.clientX,r=t.clientY;t.touches&&(s=t.touches[0].clientX,r=t.touches[0].clientY);const d=function(e){const t=(o.enableShadowDOM?o.shadowRoot:o.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null;for(let e=0;e<t.length;e++){const n=t[e];if(n.getAttribute("data-field")){l=n.getAttribute("data-field");break}}let n=null;for(let e=0;e<t.length;e++){const l=t[e];if(l.getAttribute("data-id")){n=l.row;break}}return{column:o.columnByDataField[l],row:n}};if(a&&a.capturedDrag){let e=d({clientX:s,clientY:r}),l=d({clientX:s,clientY:r+a.top}).row,n=d({clientX:s+a.left,clientY:r}).column;if(l||(l=i[i.length-1]),n||(n=e.column),l&&n&&e.row&&e.column){a.row=e.row,a.rowId=a.row.id,a.column=e.column,a.endDragRow=a.endRow=l,a.endDragColumn=a.endColumn=n,a.endDragRowId=a.endDragRow.id,o._dragSelectionStartDataField=a.column.dataField,o._dragSelectionStartRow=a.row;const t=a.row.getCell(a.column.dataField);o._selection.focusedCell={index:t.row.index,id:t.row.id,dataField:t.column.dataField,value:t.value}}o._resizeSelectionRect(),t.preventDefault()}else if(a&&a.captured)if(o._dragSelectionStartDataField=o._selection.focusedCell.dataField,o._dragSelectionStartRow=o.rowById[o._selection.focusedCell.id],null===l&&null===n&&(Math.abs(s-e.left)>=30?l=!0:Math.abs(r-e.top)>=30&&(n=!0)),a.lastPoint&&Math.abs(a.lastPoint.top-r)>=40?(l=null,n=!0):a.lastPoint&&Math.abs(a.lastPoint.left-s)>=40&&(n=null,l=!0),l){const t=a.endDragColumn.dataField,l=d({clientX:s,clientY:e.top-5});l.row&&l.column&&(a.endDragRow=a.endRow,a.endDragColumn=l.column,a.endDragColumn.dataField!==t&&(a.lastPoint={left:s,top:r}),o._resizeSelectionRect())}else if(n){const t=a.endDragRow,l=d({clientX:e.left-5,clientY:r});l.row&&l.column&&(a.endDragRow=l.row,a.endDragColumn=a.endColumn,a.endDragRow.id&&a.endDragRow.id!==t.id&&(a.lastPoint={left:s,top:r}),o._resizeSelectionRect())}a&&a.captured&&o.selection.allowDragSelectionAutoScroll&&(o._autoScrollSelectionDragInterval&&clearInterval(o._autoScrollSelectionDragInterval),o.selection.isDragging=!0,o._autoScrollSelectionDragInterval=setInterval((function(){const e=o.$.scrollView.getBoundingClientRect();s<=e.left+20?(o.scrollLeft-=15,o._resizeSelectionRect()):s>=e.left+e.width-20&&(o.scrollLeft+=15,o._resizeSelectionRect()),r<=e.top+20?(o.scrollTop-=15,o._resizeSelectionRect()):r>=e.top+e.height-20&&(o.scrollTop+=15,o._resizeSelectionRect())}),25))},t.onUp=function(){if(!t.captured)return;o._autoScrollSelectionDragInterval&&clearInterval(o._autoScrollSelectionDragInterval),o.editing.editCell||o.editing.editRow||o.focus(),t.capturedDrag=!1,t.captured=!1,l=null,n=null,e=null,t.lastPoint=null;const i=t.cellValues;t.minRow&&t.maxRow&&t.maxRow&&t.maxColumn&&(o._selectCellsRange(t.minRow,t.maxRow,t.minColumn.dataField,t.maxColumn.dataField),t.row=t.minRow,t.rowId=t.row.id,t.column=t.minColumn,t.endColumn=t.maxColumn,t.endRow=t.maxRow,t.endRowId=t.maxRow.id,t.cellValues=i,o._resizeSelectionRect(),o.selection.allowCellDragSelectionAutoFill&&o._pasteSelectedCells({row:t.row,endRow:t.endDragRow,column:t.column,endColumn:t.endColumn},i)),t.endDragColumn=null,t.endDragRow=null,t.minColumn=null,t.minRow=null,t.maxColumn=null,t.maxRow=null},t.onDown=function(l){if(t.captured&&!e){let t=l.clientX,n=l.clientY;l.touches&&(t=l.touches[0].clientX,n=l.touches[0].clientY),e={left:t,top:n}}};const a={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(a.down="touchstart",a.move="touchmove",a.up="touchend"),t["on"+a.down]=function(e){const l=t.getBoundingClientRect();let n=e.clientX,i=e.clientY;e.touches&&(n=e.touches[0].clientX,i=e.touches[0].clientY),n>=l.right-5&&i>=l.bottom-5?(t.captured=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn):o.selection.allowCellDragDropSelectionHandle&&i>=l.bottom-5?(t.captured=!0,t.capturedDrag=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn,t.left=t.endColumn.left-t.column.left,t.top=t.endRow.top-t.row.top):t.captured||o._rowDownHandler(e)},document.addEventListener(a.move,t.onMove,{passive:!1}),document.addEventListener(a.up,t.onUp,{passive:!1}),document.addEventListener(a.down,t.onDown,{passive:!1})}}const e=o._selection.selectionRect;e.row=o.rowById[o._selection.focusedCell.id],e.rowId=o._selection.focusedCell.id,e.column=o.columnByDataField[o._selection.focusedCell.dataField],e.endRow=l,e.endRowId=l.id,e.endDragRow=l,e.endColumn=n,e.endDragColumn=n,o._refreshCellSelectionRect()}}_resizeSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t)return;let l=e._recyclingRows,n=t.row,o=t.endDragRow,i=t.column,a=t.endDragColumn;const s=e.viewColumns,r=l.indexOf(n),d=l.indexOf(o),c=l.indexOf(t.endRow),u=s.indexOf(i),f=s.indexOf(a),_=s.indexOf(t.endColumn),g=Math.min(c,Math.min(r,d)),m=Math.max(c,Math.max(r,d)),p=Math.min(_,Math.min(u,f)),w=Math.max(_,Math.max(u,f));c<=Math.min(r,d)?t.minRow=t.endRow:t.minRow=r<=d?n:o,c>=Math.max(r,d)?t.maxRow=t.endRow:t.maxRow=r>=d?n:o,_<=Math.min(u,f)?t.minColumn=t.endColumn:t.minColumn=u<=f?i:a,_>=Math.max(u,f)?t.maxColumn=t.endColumn:t.maxColumn=u>=f?i:a;let h=0,y=0,S=0,v=0;for(let e=g;e<=m;e++){const t=l[e];if(t){e===g&&(h=t.top),e===m&&(y=t.top+t.height-h);for(let e=p;e<=w;e++){const l=s[e].dataField,n=t.getCell(l);e===p&&(S=n.column.left),e===w&&(v=n.column.left+n.column.computedWidth-S)}}}t.style.top=h-e.scrollTop-1+"px",e._isVirtualMode()&&(t.style.top=h+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft?t.style.right=S-e.scrollLeft+"px":t.style.left=S-e.scrollLeft+"px",t.style.height=y+1+"px",t.style.width=v+1+"px"}_getPatternValue(e,t,l){let n=[],o=0,i=[],a=[],s=[],r=[];const d={names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},c={names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},u=function(e){if(void 0!==e&&!(e.toString().indexOf("GMT+")>=0||e.toString().indexOf("GMT-")>=0)){if(!isNaN(parseFloat(e)))return/[A-Za-z]/.test(e.toString())?void 0:parseFloat(e);if(d.names.indexOf(e)>=0)return r=d.names,d.names.indexOf(e);if(d.namesAbbr.indexOf(e)>=0)return r=d.namesAbbr,d.namesAbbr.indexOf(e);if(d.namesShort.indexOf(e)>=0)return r=d.namesShort,d.namesShort.indexOf(e);if(c.names.indexOf(e)>=0)return r=c.names,c.names.indexOf(e);if(c.namesAbbr.indexOf(e)>=0)return r=c.namesAbbr,c.namesAbbr.indexOf(e);if(void 0!==e&&(null===e&&(e=""),/\d+/.test(e.toString()))){s.push(e.toString().replace(/[0-9]/,"#")),s[s.length-1]=s[s.length-1].replace(/[0-9]/g,"");const t=parseFloat(e.toString().replace(/\D/g,""));return isNaN(t)?0:t}}};let f=0;for(let e in l){let t=l[e];n[o]=[],f=0;for(let e in t){let l=u(t[e]);void 0!==l&&(n[o].push(l),f++)}if(0===n[o].length)continue;let a=n[o][0],d=0;for(let e=0;e<n[o].length;e++){let t=u(n[o][e-1]),l=u(n[o][e]);0===e&&(t=l),a+=l,d+=l-t}a/=n[o].length,a-=n[o][0],a+=n[o][n[o].length-1],0!==d&&(d/=n[o].length-1),(r.length>0||s.length>0)&&(d=1,a=n[o][0]),n[o].length<=2&&(a=n[o][n[o].length-1]+d),i.push({step:d,stepStart:a}),o++}for(let e=0;e<f;e++){let t=n[0][e],l=0;for(let o=1;o<n.length;o++){const i=u(n[o-1][e]),a=u(n[o][e]);t+=a,l+=a-i}t/=n.length,t-=n[0][e],t+=n[n.length-1][e],0!==l&&(l/=n.length-1),(r.length>0||s.length>0)&&(l=1,t=n[0][e]),n.length<=2&&(t=n[n.length-1][e]+l),a.push({step:l,stepStart:t})}if(!n[e]){let l=n.length;for(let o=l;o<=e;o++){n[o]=[];for(let e=0;e<=t;e++)a[e]||(a[e]=a[e-1]),a[e]&&(o===l?n[o][e]=a[e].stepStart:(n[o][e]=n[o-1][e]+a[e].step,r.length>1&&n[o][e]>=r.length&&(n[o][e]=0)))}return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}if(!n[e][t]){let l=f;for(let o=l;o<=t;o++)i[e]&&(o===l?n[e].push(i[e].stepStart):(n[e][o]=n[e][o-1]+i[e].step,r.length>1&&n[e][o]>=r.length&&(n[e][o]=0)));return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}return n[e]&&n[e][t]?s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]:0}_pasteDataType(e){const t=this.dataSource&&"number"==typeof this.dataSource.dataSource,l=e.cell,n=e.value;let o=l.column.dataType;return o&&!t||(o=isNaN(parseFloat(n))?"string":n instanceof Date?"date":"true"===n||"false"===n?"boolean":"number"),o}_pasteModeCopy(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell;let i=e.value;if(o.column.editor&&o.column.editor.dataSource&&i)for(let e=0;e<o.column.editor.dataSource.length;e++){const t=o.column.editor.dataSource[e];if("string"!=typeof t&&t.label===i){i=t.value;break}}const a=i,s=e.dataField;let r=a,d=!1;if("string"===n)r=a,d=!0;else if("bool"===n||"boolean"===n)1!==a&&"1"!==a&&!0!==a&&"true"!==a&&"TRUE"!==a&&"True"!==a||(r=!0,d=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):(r=a,d=!0)}else if("number"===n||"float"===n||"int"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):null!==a?"int"===n||"integer"===n?(r=parseInt(a),d=!0):(r=parseFloat(a),isNaN(r)&&(r=null),d=!0):(r=null,d=!0)}if(d)if(t.dataSource&&t.dataSource.virtualDataSource){const e={};e[o.column.dataField]=r,t.updateRow(o.row.id,e)}else{const e=o.value;if(t._setCellUndoRedo(o,e,r),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]),t._pasteTempValues.push({id:o.row.id,cell:o,dataField:o.column.dataField,oldValue:e,newValue:r}),t._pasteTimer&&clearTimeout(t._pasteTimer);const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};t._pasteTimer=setTimeout((()=>{if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1)}}),t)}else t.onCellUpdate([o],[e],[r],(function(e){e&&(l(o,r),o.value=r)}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const e=Object.assign({},o.row.data),l=Object.assign({},o.row.data);l[o.column.dataField]=r,o.row.updatedDate=new Date,o.row.updatedBy=t.currentUser,t.onRowUpdate([o.row.index],[o.row],[e],[l],(function(e){e&&(o.value=r)}),t)}else o.value=r}}_pasteModeFill(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell,i=e.selectedValues,a=e.minRowIndex,s=e.minColumnIndex,r=e.currentRowIndex,d=e.currentColumnIndex,c=e.dataField;let u=e.value;if("string"===n)/\d+/.test(u.toString())?(u=t._getPatternValue(r-a,d-s,i),void 0===u&&i[r-a]&&i[r-a][d-s]&&(u=i[r-a][d-s])):(u=t._getPatternValue(r-a,d-s,i),void 0===u&&(u=i[r-a]?i[r-a][d-s]:e.value),void 0===u&&(u=e.value)),void 0!==u&&(o.value=u);else if("bool"===n||"boolean"===n)1!==u&&"1"!==u&&!0!==u&&"true"!==u&&"TRUE"!==u&&"True"!==u||(o.value=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n&&(o.value=null),i[r-a]&&(u=i[r-a][d-s],void 0!==u&&(o.value=u))}else if("number"===n||"float"===n||"int"===n){u=t._getPatternValue(r-a,d-s,i);const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n?o.value=null:o.value=null!==u?"int"===n||"integer"===n?parseInt(u):parseFloat(u):null}}_pasteSelectedCells(e,t){const l=this;l.beginUpdate();let n=l._recyclingRows,o=e.row,i=e.endRow,a=e.column,s=e.endColumn;const r=n.indexOf(o),d=n.indexOf(i),c=n.indexOf(e.endRow),u=l.viewColumns,f=u.indexOf(a),_=u.indexOf(s),g=u.indexOf(e.endColumn),m=Math.min(c,Math.min(r,d)),p=Math.max(c,Math.max(r,d)),w=Math.min(g,Math.min(f,_)),h=Math.max(g,Math.max(f,_));let y=0,S=0,v=0,R=0;for(let e in t)0===y&&(S+=Object.keys(t[e]).length),y++;for(let e=m;e<=p;e++){const o=n[e];v=0;for(let n=w;n<=h;n++){if(!u[n])continue;const i=u[n].dataField,a=o.getCell(i);let s=0;for(let r in t){if(s===R){let s=0,d=t[r];for(let r in d){if(v===s){let s=d[r],c=!0;if(t[o.id]&&t[o.id][i]&&(c=!1),c&&"none"!==l.clipboard.autoFillMode){const o={value:s,targetValue:a.value,dataField:r,index:a.row.visibleIndex,targetDataField:i,targetRowIndex:e};if(l.clipboard.onPasteValue){l.clipboard.onPasteValue(o);const e=a.value;a.value=o.value,l._setCellUndoRedo(a,e,o.value)}else o.cell=a,o.selectedValues=t,o.minRowIndex=m,o.maxRowIndex=p,o.minColumnIndex=w,o.maxColumnIndex=h,o.currentColumnIndex=n,o.currentRowIndex=e,"copy"===l.clipboard.autoFillMode?l._pasteModeCopy(o):"fillSeries"===l.clipboard.autoFillMode&&l._pasteModeFill(o)}}s++}}s++}v++,v>=S&&(v=0)}R++,R>=y&&(R=0)}l.endUpdate(!1),l._recycle(!1),l._refreshDataFilters()}_refreshCellSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t||t&&t.captured)return;let l=e._recyclingRows,n=t.row,o=t.endRow,i=t.column,a=t.endColumn;const s=e.viewColumns;if(!a||!i)return;if(e._isVirtualMode()){if(n.id!==t.rowId&&!e.rowById[t.rowId])return t.style.height="0px",void(t.style.width="0px");n=e.rowById[t.rowId],o=e.rowById[t.endRowId]}if(!i.allowSelect||!a.allowSelect){if(i===a)return t.style.width="0px",void(t.style.height="0px");{const e=s.indexOf(i),l=s.indexOf(a);i=null,a=null;for(let t=e;t<l;t++){const e=s[t];e.allowSelect&&!i&&(i=e),a=e}if(!i||!a)return t.style.width="0px",void(t.style.height="0px")}}const r=l.indexOf(n),d=l.indexOf(o),c=s.indexOf(i),u=s.indexOf(a);let f=Math.min(r,d),_=Math.max(r,d),g=Math.min(c,u),m=Math.max(c,u);g=Math.max(0,g),f=Math.max(0,f);const p=function(e){const t=l.indexOf(e.row),n=l.indexOf(e.endRow),o=s.indexOf(e.column),i=s.indexOf(e.endColumn);f=Math.min(f,t),f=Math.min(f,n),f=Math.max(0,f),_=Math.max(_,t),_=Math.max(_,n),g=Math.min(g,o),g=Math.min(g,i),g=Math.max(0,g),m=Math.max(m,o),m=Math.max(m,i)},w=e._getParentCell(n,i.dataField),h=e._getParentCell(n,a.dataField),y=e._getParentCell(o,a.dataField),S=e._getParentCell(o,i.dataField);w&&p(w),h&&p(h),y&&p(y),S&&p(S);let v=0,R=0,C=0,x=0;t.cellValues=[];for(let n=f;n<=_;n++){const o=l[n];if(n===f&&(v=o.top,!0!==o.freeze&&"near"!==o.freeze&&(v+=e.__frozenNearHeight),"far"===o.freeze&&(v=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight)),n===_){let t=o.top;"far"===o.freeze&&(t=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight),R=t+o.height-v,!0!==o.freeze&&"near"!==o.freeze&&(R+=e.__frozenNearHeight)}t.cellValues[o.id]=[];const i=e._isUpdating;e._isUpdating=!0;for(let l=g;l<=m;l++){const n=s[l].dataField,i=o.getCell(n);let a=i.element?i.element.textContent:i.value;if(void 0===a&&(a=""),t.cellValues[o.id][n]=a,l===g&&(C=i.column.left,i.column.freeze&&"far"===i.column.freeze&&(C=e.__clientSize.width-e.__frozenFarWidth+C+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth)),l===m){let t=i.column.left;i.column.freeze&&"far"===i.column.freeze&&(t=e.__clientSize.width-e.__frozenFarWidth+t+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),x=t+i.column.computedWidth-C}i.selected=!0}e._isUpdating=i}if(v-e.scrollTop<e.layout.rowMinHeight&&e.filtering.enabled&&e.filtering.filterRow.visible){const t=v;v=e.layout.rowMinHeight+e.scrollTop,R-=v-t}if(R<=0)t.classList.add("smart-visibility-hidden");else{if(t.classList.remove("smart-visibility-hidden"),t.style.top=v-e.scrollTop-1+"px",e._isVirtualMode()&&(t.style.top=v+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft)t.style.right=C-e.scrollLeft+"px";else if(t.style.left=C-e.scrollLeft+"px",C-e.scrollLeft<e.__frozenNearWidth-1){let l=0;for(let t=0;t<e._frozenNearColumns.length;t++){const n=e._frozenNearColumns[t];n&&n.autoGenerated&&n.visible&&(l+=n.width)}if(C-e.scrollLeft<l){const n=l-C+e.scrollLeft;x-=n,t.style.left=n+C-e.scrollLeft+"px"}}t.style.height=R+1+"px",t.style.width=x+1+"px"}}_renderInputOverlay(e,t,l){const n=this,o=n.rowById[e];if(o&&!1!==o.allowSelect&&!o.label&&t&&n.selection.checkBoxes.enabled){n._inputOverlay&&n._inputOverlay.classList.contains("smart-input-overlay-column")&&(n._inputOverlay.parentNode&&n._inputOverlay.parentNode.removeChild(n._inputOverlay),n._inputOverlay=null),n._inputOverlay||(n._inputOverlay=document.createElement("div"),n.$.scrollView.appendChild(n._inputOverlay),n._inputOverlay.classList.add("smart-input-overlay"));let e=o.freeze?o.top:n.__frozenNearHeight+o.top;const t=Math.round((o.cellHeight-n._selectionColumn.computedWidth)/2),i=n._selectionColumn.element.parentElement.offsetLeft+n._selectionColumn.element.offsetLeft;if(n._inputOverlay.style.left=i+"px",n._inputOverlay.style.height=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.width=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.top=e+t-n.scrollTop+"px",o&&o.element){const e=o.element.querySelector("smart-grid-cell");e&&(n._inputOverlay.cell=e.cell)}n._inputOverlay.row=o,n._inputOverlay.onpointerdown=function(e){n._inputOverlay||(n._inputOverlay.onpointerdown=null);const t=n._inputOverlay.row,l=n._inputOverlay.cell;n.beginUpdate(),t.selected=!t.selected,n.endUpdate(!1),n.$.fireEvent("change",{started:!1,finished:!0}),n._refreshSummary(!1);const o=e.originalEvent?e.originalEvent:e,i=3===o.which;n.$.fireEvent("rowClick",{row:t,id:t.id,isRightClick:i,originalEvent:o,pageX:o.pageX,pageY:o.pageY}),l&&n.$.fireEvent("cellClick",{cell:l,id:t.id,dataField:l.column.dataField,isRightClick:i,originalEvent:o,pageX:o.pageX,pageY:o.pageY}),n._recycle(),n._renderInputOverlay(t.id,e,!0)},n.appearance.allowCheckBoxesSelectionAnimation&&void 0===l&&n._inputOverlay.classList.add("smart-animate"),requestAnimationFrame((()=>{n._inputOverlay&&n._inputOverlay.classList.add("smart-input-overlay-on")}))}}_selectRow(e,t){const l=this,n=l.rowById[e];if(n&&l.selection.enabled&&(!n.header||"row-resize"!==n.header.style.cursor)){if(t&&(!t.shiftKey||!l._selection.focusedCell)){const t=n.getCell(l.columns[0].dataField);l._selection.focusedCell={index:t.row.index,id:e,dataField:t.column.dataField,value:t.value}}l._lastRowsSelectionRange=null,"extended"===l.selection.mode?l._handleExtendedRowSelection(n,t):"one"===l.selection.mode?n.select():n.selected?n.unselect():n.select()}}_getParentCell(e,t){const l=this;let n=l._recyclingRows;for(let o=0;o<l._cellsMerge.length;o++){const i=l._cellsMerge[o];let a=[],s=[];if(a.push(i.row),i.rowSpan>1){const e=n.indexOf(i.row);if(e>=0)for(let t=e;t<e+i.rowSpan;t++)n[t]&&-1===a.indexOf(n[t])&&a.push(n[t])}if(s.push(i.column.dataField),i.colSpan>1){const e=l.viewColumns.indexOf(l.columnByDataField[i.column.dataField]);for(let t=e;t<e+i.colSpan;t++)s[t]&&-1===s.indexOf(s[t].dataField)&&s.push(s[t].dataField)}if(a.indexOf(e)>=0&&s.indexOf(t)>=0)return{row:i.row,column:i.column,endRow:a[a.length-1],endColumn:l.columnByDataField[s[s.length-1]]}}if(l._cellRowSpan)for(let o=0;o<l._cellRowSpan.length;o++){const o=e.visibleIndex;let i=-1,a=null;for(let e=0;e<l._cellRowSpan.length;e++){const t=l._cellRowSpan[e];if(o>t[0]&&o<t[1]){i=t[0],a=t[2];break}}if(i>=0&&a===t){const e=n[i];if(e)return{row:e,column:l.columnByDataField[t],endRow:e,endColumn:l.columnByDataField[t]}}}return null}_selectCellsRange(e,t,l,n){const o=this,i=o._selection.selectionRect;if(o._lastRowsSelectionRange&&o._lastRowsSelectionRange.id===e.id&&o._lastRowsSelectionRange.endId===t.id&&o._lastColumnSelectionRange&&o._lastColumnSelectionRange.dataField===l&&o._lastColumnSelectionRange.endDataField===n)return;o.beginUpdate(),o._clearSelection(),o._lastRowsSelectionRange={id:e.id,endId:t.id},o._lastColumnSelectionRange={dataField:l,endDataField:n},(!i||i&&!i.captured)&&o._selection.focusedCell&&o._renderCellSelectionRect(o.rowById[o._selection.focusedCell.id],o.columnByDataField[o._selection.focusedCell.dataField],o.rowById[o._lastRowsSelectionRange.endId],o.columnByDataField[o._lastColumnSelectionRange.endDataField]);let a=o._recyclingRows;const s=o.viewColumns;let r=-1,d=-1,c=a.indexOf(e),u=a.indexOf(t),f=-1;for(let e=0;e<s.length;e++){const t=s[e];t.allowSelect&&(-1===f&&(f=e),t.dataField===l&&(r=e),t.dataField===n&&(d=e))}if(-1===f)return o.endUpdate(!1),void o._recycle();-1===r?r=f:-1===d&&(d=f);let _=Math.min(c,u),g=Math.max(c,u),m=Math.min(r,d),p=Math.max(r,d);const w=function(e){const t=a.indexOf(e.row),l=a.indexOf(e.endRow),n=s.indexOf(e.column),o=s.indexOf(e.endColumn);_=Math.min(_,t),_=Math.min(_,l),g=Math.max(g,t),g=Math.max(g,l),m=Math.min(m,n),m=Math.min(m,o),p=Math.max(p,n),p=Math.max(p,o)},h=o._getParentCell(e,l),y=o._getParentCell(t,n);if(h&&w(h),y&&w(y),g<0||_<0||m<0||p<0)return o.endUpdate(!1),void o._recycle();for(let e=_;e<=g;e++){const t=a[e];if(t.allowSelect)for(let e=0;e<s.length;e++){const l=s[e];l.allowSelect&&e>=m&&e<=p&&(t.getCell(l.dataField).selected=!0)}}o.endUpdate(!1,!1),o._recycle(!1),o._selectionTimer&&clearTimeout(o._selectionTimer),o._selectionTimer=setTimeout((()=>{o._recycle()}),50)}_selectRowsRange(e,t,l){const n=this;if(n._lastRowsSelectionRange&&n._lastRowsSelectionRange.id===e.id&&n._lastRowsSelectionRange.endId===t.id)return;if(n._dragDrop&&n._dragDrop.dragDetails)return;n.beginUpdate(),n._clearSelection(),n._lastRowsSelectionRange={id:e.id,endId:t.id};let o=n._recyclingRows;const i=o.indexOf(e),a=o.indexOf(t),s=Math.min(i,a),r=Math.max(i,a);if(r<0)return n.endUpdate(!1),void n._recycle();for(let e=s;e<=r;e++){const t=o[e];t&&t.allowSelect&&(t.selected=!1!==l)}n.endUpdate(!1),n._recycle()}_selectColumnsRange(e,t){const l=this;if(l._lastColumnSelectionRange&&l._lastColumnSelectionRange.dataField===e&&l._lastColumnSelectionRange.endDataField===t)return;if(l._dragDrop&&l._dragDrop.dragDetails)return;l.beginUpdate(),l._clearSelection(),l._lastColumnSelectionRange={dataField:e,endDataField:t};const n=l.viewColumns;let o=-1,i=n.length;for(let l=0;l<n.length;l++){const a=n[l];a.allowSelect&&(a.dataField===e&&(o=l),a.dataField===t&&(i=l))}const a=Math.min(o,i),s=Math.max(o,i);for(let e=0;e<n.length;e++){const t=n[e];t.allowSelect&&e>=a&&e<=s&&(t.selected=!0)}l.endUpdate(!1),l._recycle()}_selectColumn(e,t){const l=this,n=l.columnByDataField[e],o=l.viewColumns;if(!n||!l.selection.enabled||!1===n.allowSelect||!l.selection.allowColumnHeaderSelection)return;if(n&&"col-resize"===n.element.style.cursor)return;let i=!1;if(n&&(n.allowSelect||null===n.allowSelect&&!t)&&(i=!0),i&&t)if("extended"===l.selection.mode){if(t.ctrlKey||t.metaKey||t.shiftKey||(l._rangeSelectionStartColumn=n,l._rangeSelectionEndColumn=n),t.ctrlKey||t.metaKey?n.selected=!n.selected:n.selected=!0,t&&t.shiftKey){l._rangeSelectionStartColumn||(l._rangeSelectionStartColumn=n),l._rangeSelectionEndColumn=n,l._selection.columns=[];const e=o.indexOf(l._rangeSelectionStartColumn),t=o.indexOf(l._rangeSelectionEndColumn),i=Math.min(e,t),a=Math.max(e,t);for(let e=i;e<=a;e++){const t=o[e];t&&!1!==t.allowSelect&&(t.selected=!0)}}}else"one"===l.selection.mode||null===n.selected?n.selected=!0:n.selected=!n.selected}selectAllRows(){const e=this;let t=e.rows;e._selectionColumn._selecting=!0,e.beginUpdate();for(let e=0;e<t.length;e++)t[e].selected=!0;e._selectionColumn._selecting=!1,e.endUpdate(!1),e._refreshSummary(!1),e._recycle(!1),e._refreshCheckBoxColumnSelection(),e.$.fireEvent("change",{started:!1,finished:!0})}hasSelectedRows(){const e=this.getVisibleRows(),t=this._getSelectedRows(!0,!1);return t.length===e.length||t.length>0&&t.length<e.length||0!==t.length&&0!==e.length&&void 0}areAllRowsSelected(){const e=this.getVisibleRows(),t=this._getSelectedRows(!0,!1);return t.length>0&&t.length===e.length}_getSelectedRows(e,t){const l=this,n=[];let o=l.rows;if(l.rows.canNotify=!1,e&&(o=l.getVisibleRows()),l._isVirtualMode()){let e=l._selection.indexes;return l.paging.enabled&&t&&l._isVirtualMode()&&(e=e.slice(0,l.paging.pageSize)),l.rows.canNotify=!0,Object.keys(e).length}l.paging.enabled&&t&&(o=l._isVirtualMode()?o.slice(0,l.paging.pageSize):o.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize));for(let e=0;e<o.length;e++){const t=o[e];t.getProperty("selected")?n.push(t):(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}return l.rows.canNotify=!0,n}_dragSelectionEnd(e){const t=this;t._dragSelectionStartDataField=null,t._dragSelectionStartRow=null,t.__selectionStarted&&(t.$.fireEvent("change",{started:!1,finished:!0,originalEvent:e}),t._refreshSummary(),delete t.__selectionStarted,delete t.__selectionStartedFired),t.selection.allowDragSelection&&t.selection.isDragging&&(t.selection.isDragging=!1,t._autoScrollSelectionDragInterval&&(clearInterval(t._autoScrollSelectionDragInterval),t.editing.isEditing||t._recycle()))}_dragSelection(e){const t=this;if("extended"!==t.selection.mode||!1===t.selection.allowDragSelection)return;if(!t._dragSelectionStartDataField&&!t._dragSelectionStartRow)return;const l=()=>{t.__selectionStarted&&!t.__selectionStartedFired&&(t.$.fireEvent("change",{started:!0,finished:!1,originalEvent:e}),t.__selectionStartedFired=!0),t.$.fireEvent("change",{started:!1,finished:!1,originalEvent:e})};if(!t.selection.allowCellSelection||!t._dragSelectionStartDataField||t._columnResizeLine||t._dragSelectionStartDataField.startsWith("_")||!t._dragSelectionStartRow||t._rowResizeLine){if(t._dragSelectionStartRow&&!t._rowResizeLine&&(t.selection.allowRowSelection&&!t._dragSelectionStartDataField.startsWith("_")||t.selection.allowRowHeaderSelection&&t._dragSelectionStartDataField.startsWith("_"))){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){o=t.row,!o&&t.cell&&(o=t.cell.row);break}}let i=!0;t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&o&&t._lastRowsSelectionRange.endId===o.id&&(i=!1),o&&!o.allowSelect&&(i=!1),o&&o.allowSelect&&t._selectRowsRange(t._dragSelectionStartRow,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,i&&l(),t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25)}else if(t._dragSelectionStartDataField&&!t._columnResizeLine&&!t._dragSelectionStartDataField.startsWith("_")&&t.selection.allowColumnHeaderSelection){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}o&&t._selectColumnsRange(t._dragSelectionStartDataField,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval);let i=!0;t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(i=!1),i&&l(),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15)}),25)}}else{const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}let i=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){i=t.row;break}}if(!i&&n.length&&n[0].classList.contains("smart-grid-scroll-view")){i=t._recyclingRows[t._recyclingRows.length-1];const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,i.element.getBoundingClientRect().top);for(let e=0;e<l.length;e++){const t=l[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}}if(o&&i){if(i.id===t._dragSelectionStartRow.id&&t._dragSelectionStartDataField===o)return;if(o&&o.startsWith("_"))return;let e=!0;t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(e=!1),t._selectCellsRange(t._dragSelectionStartRow,i,t._dragSelectionStartDataField,o),t._removeCellContentPopup(),e&&l()}t.selection.allowDragSelectionAutoScroll&&(t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15),e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25))}}select(e,t){const l=this;l.isInitialized&&(!t&&void 0!==e&&l._selection&&l._selection.rows[e]||(l._setSelection(e,t),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary()))}selectRowsByIndex(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._isVirtualMode()){let l=[];for(let t=0;t<e.length;t++)l[e[t]]=!0;return t._selection.indexes=l,void t._recycle()}t.beginUpdate();for(let l in e){const e=t.rows[l];e&&t._setSelection(e.id)}t.endUpdate(!1),t._recycle()}))}selectRowsRange(e,t){const l=this,n=l.rowById[e],o=l.rowById[t];n&&o&&(l._selectRowsRange(n,o),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}selectCellsByQuery(e){const t=this,l=t.findCells(e);requestAnimationFrame((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t.beginUpdate();for(let e in l){const n=l[e][0],o=l[e][1];t._setSelection(n,o)}t.endUpdate(!1),t._recycle()}))}selectRowsByQuery(e,t,l){const n=this,o=n.find(e,t,l).map((e=>e.$.id));o.length&&n.selectRows(o)}selectRows(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t.beginUpdate();for(let l in e)t._setSelection(e[l]);t.endUpdate(!1),t._recycle()}))}selectCells(e,t){const l=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let n in e)for(let o=0;o<t.length;o++)l._setSelection(e[n],t[o]);l.endUpdate(!1),l._recycle()}))}selectRange(e,t,l,n){const o=this;!function(){const i=new KeyboardEvent("keydown",{shiftKey:!0});requestAnimationFrame((()=>{"extended"!==o.selection.mode&&"many"!==o.selection.mode&&o._clearSelection(),o.beginUpdate(),o._setSelection(e,t),o._setSelection(l,n,i),o.ensureVisible(e,t),o.endUpdate(!1),o._refreshSummary(!1),o._recycle()}))}(),o.$.fireEvent("change",{started:!1,finished:!0})}unselect(e,t){const l=this;l._selection&&(l._selection.rows&&l._selection.rows[e]&&delete l._selection.rows[e],l._selection.columns&&l._selection.columns[t]&&delete l._selection.columns[t],l._selection.cells&&(l._selection.cells["row"+e]&&(delete l._selection.cells["row"+e][t],1===Object.getOwnPropertyNames(l._selection.cells["row"+e]).length&&delete l._selection.cells["row"+e]),l._selection.cells["column"+t]&&(delete l._selection.cells["column"+t][e],1===Object.getOwnPropertyNames(l._selection.cells["column"+t]).length&&delete l._selection.cells["column"+t])),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}getSelectedRows(){const e=this;let t=[];if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);if(e._isVirtualMode()){for(let e in l){const n=l[e];t.push([n,{}])}return t}for(let n in l){const o=l[n],i=e.rowById[o];if(!i)continue;const a={};for(let e in i.data)switch(e){case"$":case"parent":case"level":case"leaf":case"children":continue;default:a[e]=i.data[e]}t.push([i.id,a])}}return t}getSelectedRowIndexes(){const e=this;return e._selection.indexes&&Object.keys(e._selection.indexes).length>0?e._selection.indexes:[]}getSelectedRowIds(){const e=this;let t=[];if(e._isVirtualMode())return e._selection.rows&&Object.keys(e._selection.rows).length>0?e._selection.rows:void 0;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);for(let n in l){const o=l[n],i=e.rowById[o];i&&t.push(i.id)}}return t}getSelectedCells(e){const t=this;let l=[];if(t._selection.cells)for(let n in t._selection.cells)if(n.startsWith("row")){let o=n.replace("row",""),i=null;for(let a in t._selection.cells[n])if(i=a.replace("column",""),l||(l=[]),!1===e)l.push([o,i]);else{const e=t.getCellValue(o,i);l.push([o,i,e])}}return l}getSelection(){const e=this;let t=null,l=null,n=null,o=null;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);t=[];for(let n=0;n<l.length;n++){const o=l[n];t.push({id:o,row:e.rowById[o]})}}if(e._selection.columns&&Object.keys(e._selection.columns).length>0){const t=Object.keys(e._selection.columns);l=[];for(let n=0;n<t.length;n++){const o=t[n];l.push({dataField:o,column:e.columnByDataField[o]})}}if(e._selection.cells)for(let t in e._selection.cells)if(t.startsWith("row")){let l=t.replace("row",""),o=null;for(let i in e._selection.cells[t])o=i.replace("column",""),n||(n=[]),n.push({id:l,dataField:o,column:e.columnByDataField[o],row:e.rowById[l]})}return e._selection.focusedCell&&(e._isVirtualMode(),o={index:e._selection.focusedCell.index,id:e._selection.focusedCell.id,dataField:e._selection.focusedCell.dataField}),{rows:t,columns:l,cells:n,focused:o}}focusAndSelect(e,t){const l=this;if(l.focus(),l.selection.enabled&&l.selection.allowCellSelection)l._focusCell(e,t);else{const t=l.rowById[e];if(!t)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e),l._selection.focusedCell={id:t.id,value:null,index:t.index,dataField:l.columns[0].dataField},l.endUpdate(!1)}}_focusCell(e,t){const l=this;if(l.selection.enabled&&l.selection.allowCellSelection){const n=l.rowById[e];if(!n)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e,t);const o=n.getCell(t);o&&(l._selection.focusedCell={id:o.row.id,value:o.value,dataField:t,index:o.row.index}),l.endUpdate(!1)}}_clearSelection(e){const t=this;if(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[],e&&(t._selection.focusedCell=null,t._selection.selectionRect)){const e=t._selection.selectionRect;e.parentNode.removeChild(e);const l={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(l.down="touchstart",l.move="touchmove",l.up="touchend"),document.removeEventListener(l.move,e.onMove),document.removeEventListener(l.up,e.onUp),document.removeEventListener(l.down,e.onDown),t._selection.selectionRect=null}t._recycle(),t._refreshCheckBoxColumnSelection()}_getSelectionCellValues(){const e=this;if(e._selection.selectionRect)return e._selection.selectionRect.cellValues;const t=e.viewColumns;if(e._selection.rows.length>0){let l=[];for(let n in e._selection.rows){const o=e.rowById[n];for(let e=0;e<t.length;e++){const i=t[e];i&&(l[n]||(l[n]=[]),i.autoGenerated||(l[n][i.dataField]=o.data[i.dataField]))}}return l}if(e._selection.columns.length>0){let t=[];for(let l in e._selection.columns){const n=e.columnByDataField[l];if(n)for(let l=0;l<e._recyclingRows.length;l++){const o=e._recyclingRows[l];o&&(t[o.id]||(t[o.id]=[]),t[o.id][n.dataField]=o.data[n.dataField])}}return t}if(e._selection.cells&&Object.keys(e._selection.cells).length>0){const t=e.getSelection();if(t.cells){let e=[];for(let l in t.cells){const n=t.cells[l],o=n.id;e[o]||(e[o]=[]),e[o][n.column.dataField]=n.row.data[n.column.dataField]}return e}}}_clipboardHandler(e,t){const l=this;if(l.clipboard.enabled){if((t.ctrlKey||t.metaKey)&&("c"===e||"x"===e)){const t=l._getSelectionCellValues();let n="",o=Object.keys(t).length,i=0;for(let a in t){let s="",r=Object.keys(t[a]).length,d=0;for(let e in t[a])s+=t[a][e],d++,d<r&&(s+="\t");if(n+=s,i++,i<o&&(n+="\r\n"),"x"===e){const e=l.getSelection();if(e.cells){l.beginUpdate();for(let t=0;t<e.cells.length;t++){const n=e.cells[t],o=l.rowById[n.id];if(o){const e=o.getCell(n.dataField),t=l._pasteDataType({cell:e,value:e.value});let i=null;"int"!==t&&"number"!==t||(i=0),"string"===t&&(i=""),"boolean"!==t&&"bool"!==t||(i=!1),"date"===t&&(i=new Date),e.column.allowNull&&(i=null);const a=e.oldValue;if(l.onCellUpdate)l.onCellUpdate([e],[a],[i],(function(t){t&&(e.value=i)}),l);else if(l.onRowUpdate){const t=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,l.onRowUpdate([e.row.index],[e.row],[t],[n],(function(t){t&&(e.value=i)}),l)}else e.value=i}}l.endUpdate(!1),l._recycle()}}}if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(n).then((function(){}),(function(){}));else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),e.remove(),l._clipboardText=n}),25)}}if(t.shiftKey&&" "===e&&(l._keyboardAdd=!0,l._addNewGridRow(),l._keyboardAddTimer&&clearTimeout(l._keyboardAddTimer),l._keyboardAddTimer=setTimeout((()=>{l._keyboardAdd=!1}),300)),(t.ctrlKey||t.metaKey)&&"v"===e){if(navigator.clipboard&&!navigator.clipboard.readText)return;const e=e=>{if(!e)return;const t=[],n=e.split("\r");for(let e=0;e<n.length;e++){const l=n[e].split("\t");let o={};for(let e=0;e<l.length;e++)o[e]=l[e].trim(),void 0!==o[e]&&"undefined"!==o[e]||(o[e]="");t[e]=o}const o=l._selection.selectionRect;if(o)l._pasteSelectedCells({row:o.row,endRow:o.endDragRow,column:o.column,endColumn:o.endColumn},t);else{let e=null,n=null;for(let t in l._selection.rows){const o=l.rowById[t];e||(e=o),n||(n=o),e.visibleIndex>o.visibleIndex&&(e=o),n.visibleIndex<o.visibleIndex&&(n=o)}if(e&&n&&l._pasteSelectedCells({row:e,endRow:n,column:l.firstColumn(),endColumn:l.lastColumn()},t),0===l._selection.rows.length){const o=l.getSelectedCells();let i=null,a=null;for(let t=0;t<o.length;t++){const s=l.rowById[o[t][0]];if(!s)continue;e||(e=s),n||(n=s);const r=l.columnByDataField[o[t][1]];i||(i=a=r),i&&i.visibleIndex>r.visibleIndex&&(i=r),a&&a.visibleIndex<r.visibleIndex&&(a=r),e.visibleIndex>s.visibleIndex&&(e=s),n.visibleIndex<s.visibleIndex&&(n=s)}l._pasteSelectedCells({row:e,endRow:n,column:i,endColumn:a},t)}}};if(!window.isSecureContext)return void e(l._clipboardText);navigator.clipboard.readText().then((t=>{e(t)}))}}}_setRemoveUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){t._removeUndoRedoHigherIndexes();const n=t.getRowData(e.id);t._undoRedo.push({action:"remove",data:n,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_setAddUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){let n=!1;for(let l=0;l<t._undoRedo.length;l++){const o=t._undoRedo[l];"add"===o.action&&o.index===e.index&&(n=!0)}if(n)return;t._removeUndoRedoHigherIndexes();const o=t.getRowData(e.id);t._undoRedo.push({action:"add",data:o,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_removeUndoRedoHigherIndexes(){const e=this,t=e._undoRedoIndex;t>=0?e._undoRedo.splice(t+1,e._undoRedo.length-t):-1===t&&(e._undoRedo=[])}_setCellUndoRedo(e,t,l){const n=this;if(!n.isInitialized)return;const o=Smart.Utilities.Core.createGUID().replace(/-/gi,"");n._setCellUndoRedoTimer&&clearTimeout(n._setCellUndoRedoTimer),n._undoRedoAction||(n._pasteUndoRedoValues||(n._pasteUndoRedoValues=[]),void 0===t&&(t=null),n._pasteUndoRedoValues.push({cell:e,index:e.row.index,dataField:e.column.dataField,oldValue:t,newValue:l}),n._setCellUndoRedoTimer=setTimeout((()=>{delete n._setCellUndoRedoTimer,n._removeUndoRedoHigherIndexes(),n._pasteUndoRedoValues.length>1?n._undoRedo.push({action:"updateMultiple",items:n._pasteUndoRedoValues,uid:o}):n._undoRedo.push({action:"update",index:e.row.visibleIndex,cell:e,dataField:e.column.dataField,oldValue:t,newValue:l,uid:o}),n._undoRedoIndex=n._undoRedo.length-1,n._pasteUndoRedoValues=[]}),50))}_undoRedoHandler(e){const t=this,l=e.key;if(e.ctrlKey||e.metaKey){if("z"===l)return t.undo(),void e.preventDefault();if("y"===l)return t.redo(),void e.preventDefault()}}_updateMultiple(e,t){const l=this;let n=9999999,o=0,i=999999,a=0,s=l._recyclingRows;l.beginUpdate();for(let r=0;r<e.items.length;r++){const d=e.items[r],c=s[d.index];if(c){const e=c.id,s=d.dataField,r=t?d.oldValue:d.newValue,u=l.columnByDataField[s],f=l.viewColumns.indexOf(u);i=Math.min(i,f),a=Math.max(a,f),n=Math.min(n,c.visibleIndex),o=Math.max(o,c.visibleIndex),l.setCellValue(e,s,r)}}l._focusCell(s[n].id,l.viewColumns[i].dataField),l._selectCellsRange(s[n],s[o],l.viewColumns[i].dataField,l.viewColumns[a].dataField),delete l._undoRedoAction,l.endUpdate(!1)}redo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t+1];if(l)switch(e._undoRedoIndex++,e._undoRedoAction=!0,l.action){case"add":e.addRow(l.data,!0);break;case"remove":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.newValue;e.setCellValue(n,o,i),e._focusCell(n,o)}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!1)}else delete e._undoRedoAction}undo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t];if(l)switch(e._undoRedoIndex--,e._undoRedoAction=!0,l.action){case"add":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"remove":{const t=l.data;t&&(e._recyclingRows[l.index]?e.insertRow(t,l.index):e.addRow(t,!0));break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.oldValue;void 0!==(e._cellsUpdatedValues?e._cellsUpdatedValues[n+"_"+o]:void 0)&&delete e._cellsUpdatedValues[n+"_"+o],e.setCellValue(n,o,i),e._focusCell(n,o)}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!0)}else e._currentUndoRedo=e._undoRedo[0],delete e._undoRedoAction}_keyDownHandler(e){const t=this;if("grid"!==t.view)return;if(t.onKey&&(t.onKey(e),e.defaultPrevented))return;let l=e.key;if(t.disabled||t.displayLoadingIndicator)return;if(t._undoRedoHandler(e),0===t.dataSource.length)return;if(t.editing.editRow||t.editing.editCell||t.filtering.filterRow.cell)return;t.rightToLeft&&("ArrowLeft"===l?l="ArrowRight":"ArrowRight"===l&&(l="ArrowLeft")),t._refreshCellSelectionRect();const n=t.getSelection();let o=n.focused;if(!n.focused){if(t.editing.enabled&&!0!==t.editing.isEditing&&("F2"===l||"Enter"===l)&&n.columns&&n.columns.length>0){const e=n.columns[n.columns.length-1];e.column.allowHeaderEdit&&t._beginColumnEdit(e.column)}return void(t.menu&&t.menu.classList.contains("open")&&"Escape"===l&&t.closeMenu())}if(e.shiftKey&&e.ctrlKey&&" "===l){const e=t.rowById[o.id];if(e){const t=e.getCell(o.dataField);if(t)return void t.autoWrap()}}const i=t._getParentCell(t.rowById[o.id],o.dataField);if(i&&("ArrowLeft"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowRight"===l?(o.id=i.row.id,o.dataField=i.endColumn.dataField):"ArrowUp"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowDown"===l&&(o.id=i.endRow.id,o.dataField=i.column.dataField)),t._selection.selectionRect&&e.shiftKey&&!e.ctrlKey&&!e.metaKey?(t._selection.selectionRect.endRow&&(o.id=t._selection.selectionRect.endRow.id),t._selection.selectionRect.endColumn&&(o.dataField=t._selection.selectionRect.endColumn.dataField)):t.selection.allowRowSelection&&!t.selection.allowCellSelection&&void 0!==t._rangeSelectionEndRow&&(o.id=t._rangeSelectionEndRow.id),t._clipboardHandler(l,e),((e.ctrlKey||e.metaKey)&&"x"!==l&&"c"!==l&&"v"!==l&&"Control"!==l||"Tab"===l)&&(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[]),"Escape"===l)return t.closeMenu(),t.cancelEdit(),void t._setSelection(o.id,o.dataField,e);if(t.hasMenu())return;if(e.shiftKey&&"Enter"===l&&t.rowDetail.dialog.enabled&&!t.rowDetail.dialog.visible){const l=t.rowById[o.id];if(l)return l.showDetail=!0,e.preventDefault(),void e.stopPropagation()}if(e.ctrlKey||e.metaKey){let n=!1;"f"===l&&(t.$.headerBar&&t.$.headerBar.openSearchPanel(),n=!0),"s"===l&&(t.$.headerBar&&t.$.headerBar.openSortPanel(),n=!0),"d"===l&&(t.$.headerBar&&t.$.headerBar._openDownloadMenu(),n=!0),"u"===l&&(t.$.headerBar&&t.$.headerBar.openFilterPanel(),n=!0),"w"===l&&(t.$.headerBar&&t.$.headerBar._openViewsMenu(),n=!0),n&&(e.stopPropagation(),e.preventDefault())}if(e.altKey){if("ArrowDown"===l){const l=t.columnByDataField[o.dataField];l&&t.hasColumnMenu(l)&&(l.element._showActionButton(),l.onAction(),t.menu&&t.menu.querySelector("smart-menu").$.dispatch(e))}else"ArrowUp"===l&&t.closeMenu();if("s"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.sorted?"asc"===e.sortOrder?t.sortBy(e.dataField,"desc"):t.sortBy(e.dataField,null):t.sortBy(e.dataField,"asc"))}if("g"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.group=!e.group)}return}const a=function(l,n){const o=(l,n)=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(!0),"many"===t.selection.mode){if(" "===e.key)t._setSelection(l,n,e);else{const e=t.rowById[l].getCell(n);t._selection.focusedCell={id:e.row.id,value:e.value,dataField:n,index:e.row.index}}return t.ensureVisible(l,n),void t._recycle()}t.beginUpdate(),t._setSelection(l,n,e),t.ensureVisible(l,n),t.endUpdate(!1,!1),"ArrowDown"===e.key||"ArrowUp"===e.key?t._recycle(!1,!0):t._recycle(),e.shiftKey?t.__selectionStarted&&!t.__selectionStartedFired?(t.$.fireEvent("change",{started:!0,finished:!1}),t.__selectionStartedFired=!0):t.$.fireEvent("change",{started:!1,finished:!1}):(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())};if(t._isVirtualMode()){t._keyboardNavigationTimer&&clearTimeout(t._keyboardNavigationTimer);const e=e=>{for(let l=0;l<t.rows.length;l++){const n=t.rows[l];if(n.index===e)return n.id}return null},i=l,a=JSON.parse(JSON.stringify(t._selection.focusedCell));t._selection.focusedCell.index=i,t._selection.focusedCell.dataField=n;const s=t.rows[0],r=s.height;if(-1===i)return;const d=t._scrollView.hScrollBar,c="virtual"!==t.scrolling?s.top:i*r;let u=0;if(t.paging.enabled||(c+d.offsetHeight+t.__frozenNearHeight>t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight?(t._scrollView.scrollTop=c-t.$.scrollView.offsetHeight-t.__frozenFarHeight+d.offsetHeight,u=50):c<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=c,u=50)),t._onDataUpdated||(t._onDataUpdated=()=>{t._recycle();const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t.paging.enabled&&(t._selection.focusedCell=a),t._onDataUpdated=null}),t.paging.enabled){const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t._selection.focusedCell=a}else t._keyboardNavigationTimer=setTimeout((()=>{const l=e(t._selection.focusedCell.index);t.rowById[l]&&o(l,t._selection.focusedCell.dataField)}),u)}else requestAnimationFrame((()=>{o(l,n)})),e.stopPropagation(),e.preventDefault()};switch(l){case"Tab":{if("none"===t.selection.tabKeyBehavior)return;const l=e.shiftKey?t.prevColumn(o.dataField):t.nextColumn(o.dataField);if(l&&t.selection.allowCellSelection){const n=t.rowById[o.id].getCell(l.dataField);t._selection.focusedCell={id:n.row.id,value:n.value,dataField:l.dataField,index:n.row.index},t._setSelection(o.id,l.dataField,e),t.ensureVisible(o.id,l.dataField),t.focus(),e.stopPropagation(),e.preventDefault()}else{let l=e.shiftKey?t.prevRow(o.id):t.nextRow(o.id),n=e.shiftKey?t.lastColumn().dataField:t.firstColumn().dataField;if(t.editing.addNewRow.autoCreate&&!e.shiftKey&&o.id===t.lastRow().id&&(t.addUnboundRow(1),l=t.lastRow()),!l)return;e.shiftKey&&(t._selection.focusedCell=null),a(t._isVirtualMode()?l.index:l.id,n)}break}case" ":case"F2":{const n=t.rowById[o.id];if(!n||t.editing.editCell)return;if(e.ctrlKey||e.metaKey)return;if(" "===l&&t.dataSource.boundHierarchy&&(n.checked=!n.checked),t.editing.enabled&&!e.shiftKey){const e=t.getSelectedCells();let i=!1;if(e.length>0){let l=[];for(let n=0;n<e.length;n++){const o=e[n],i=o[1],a=t.columnByDataField[i];!a||"bool"!==a.dataType&&"boolean"!==a.dataType||l.push(o)}if(l.length>0){i=!0,t.beginUpdate();for(let e=0;e<l.length;e++){const n=l[e],o=n[1],i=n[0],a=n[2];t.setCellValue(i,o,!a)}t.endUpdate(!1)}}i||(t._beginEdit(n,o.dataField),setTimeout((function(){if(t.editing.editCell&&t.editing.editCell.column.dataType.indexOf("bool")>=0){const e=t.editing.editCell.editor.instance,n=e.getValue();" "===l&&e.setValue(!n)}}),50))}else t.selection.enabled&&"many"===t.selection.mode&&(t._isVirtualMode()?a(o.index,o.dataField):a(o.id,o.dataField));break}case"Delete":case"Backspace":{const e=t.rowById[o.id];if(!e||t.editing.editCell)return;const i=e.getCell(o.dataField),a=i.value;if(n.cells){t.beginUpdate();for(let e=0;e<n.cells.length;e++){const l=n.cells[e],o=t.rowById[l.id];if(o){const e=o.getCell(l.dataField);if(!e.column.allowEdit)continue;const n=t._pasteDataType({cell:e,value:e.value});let i=null;"int"!==n&&"number"!==n||(i=0),"string"===n&&(i=""),"boolean"!==n&&"bool"!==n||(i=!1),"date"===n&&(i=new Date),e.column.allowNull&&(i=null);const a=e.value;if(t.dataSource&&t.dataSource.virtualDataSource){const l={};l[e.column.dataField]=i,t.updateRow(e.row.id,l)}else if(t._setCellUndoRedo(e,a,i),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]);const n=i;t._pasteTempValues.push({id:e.row.id,cell:e,dataField:l.column.dataField,oldValue:a,newValue:n}),t._pasteTimer&&clearTimeout(t._pasteTimer),t._pasteTimer=setTimeout((()=>{const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1)}}),t)}else t.onCellUpdate([e],[a],[n],(function(t){t&&(l(e,n),e.value=n)}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else e.value=i}}t.endUpdate(!1),t._recycle(),t._refreshDataFilters()}"Backspace"===l&&(t._beginEdit(e,o.dataField),i.canNotify=!1,i.value=a,i.canNotify=!0);break}default:if(t.editing.enabled&&!t.editing.editCell&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!t.editing.editRow){const e=t.rowById[o.id];if(!e)return;if(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)>=0)return;t._beginEdit(e,o.dataField),setTimeout((function(){if(t.editing.editCell)t.editing.editCell.editor.instance.setValue(l);else if(t.editing.editRow){const e=t.editing.editRow.getCell(o.dataField);if(!e)return;e.editor.instance.setValue(l)}}),50)}break;case"Home":{const l=t.firstRow();if(t.paging.enabled&&e.shiftKey)return t.firstPage(),e.stopPropagation(),void e.preventDefault();if(!l)return;a(l.id,o.dataField);break}case"End":{if(t.paging.enabled&&e.shiftKey)return t.lastPage(),e.stopPropagation(),void e.preventDefault();const l=t.lastRow();if(!l)return;a(l.id,o.dataField);break}case"PageUp":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.prevPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.max(o.index-e,0),o.dataField)}else{for(let e=i;e>=0;e--){const i=l[e];if(n.top-i.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.firstRow().id,o.dataField)}break}case"PageDown":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.nextPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.min(o.index+e,t.dataSource.virtualDataSourceLength-1),o.dataField)}else{for(let e=i;e<l.length;e++){const i=l[e];if(i.top-n.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.lastRow().id,o.dataField)}break}case"ArrowDown":case"Enter":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():o.index+1,o.dataField);else{let n=e.ctrlKey||e.metaKey?t.lastRow():t.nextRow(o.id);if(!t.editing.addNewRow.autoCreate||"Enter"!==l||o.id!==t.lastRow().id||e.ctrlKey||e.metaKey||(t.addUnboundRow(1),n=t.lastRow()),!n)return;let i=!0;"Enter"===l&&(e.ctrlKey||e.metaKey)&&(i=!1),i&&a(n.id,o.dataField)}break;case"ArrowUp":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():Math.max(0,o.index-1),o.dataField);else{const l=e.ctrlKey||e.metaKey?t.firstRow():t.prevRow(o.id);if(!l)return;a(l.id,o.dataField)}break;case"ArrowRight":{const l=t.rowById[o.id],n=t.columnByDataField[o.dataField]._treeColumn;if((!t.selection.allowCellSelection||n)&&!1===l.leaf){if(!l.expanded)return l.expand(),e.stopPropagation(),void e.preventDefault();{const e=t.nextRow(o.id);if(e)return void a(e.id,o.dataField)}}const i=e.ctrlKey||e.metaKey?t.lastColumn():t.nextColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}case"ArrowLeft":{const l=t.rowById[o.id],n=t.columnByDataField[o.dataField]._treeColumn;if(!t.selection.allowCellSelection||n){if(!1===l.leaf)return void(l.expanded?(l.collapse(),e.stopPropagation(),e.preventDefault()):l.parent&&a(l.parent.id,o.dataField));if(!0===l.leaf&&l.parent)return void a(l.parent.id,o.dataField)}const i=e.ctrlKey||e.metaKey?t.firstColumn():t.prevColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}}["Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)<0||(e.stopPropagation(),e.preventDefault())}_keyUpHandler(e){const t=this;"Escape"===e.key&&t._dragDrop&&t._endDrag(e),t._focused&&"Shift"===e.key&&(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())}firstRow(){const e=this._recyclingRows;if(this._isVirtualMode())return{id:0};if(e&&e.length>0){if(!e[0].autoGenerated&&e[0].allowSelect)return e[0];for(let t=0;t<e.length;t++)if(!e[t].autoGenerated&&e[t].allowSelect)return e[t]}return null}lastRow(){const e=this,t=e._recyclingRows;if(e._isVirtualMode())return{id:e.dataSource.virtualDataSourceLength-1};if(t&&t.length>0){const e=t[t.length-1];if(!e.autoGenerated&&e.allowSelect)return e;for(let e=t.length-1;e>=0;e--)if(!t[e].autoGenerated&&t[e].allowSelect)return t[e]}return null}nextRow(e){const t=this._recyclingRows,l=this.rowById[e],n=t.indexOf(l);let o=1;if(l&&void 0!==l._rowSpan&&(o=l._rowSpan),n>=0&&t[n+o]&&!t[n+o].autoGenerated){const e=t[n+o];if(e.allowSelect&&!e.disabled)return e;for(let e=n+o;e<t.length;e++){const l=t[e];if(l.allowSelect&&!l.disabled)return l}}return null}_isVirtualMode(){const e=this;return e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling}prevRow(e){const t=this,l=t._recyclingRows,n=t.rowById[e],o=l.indexOf(n);if(t._isVirtualMode())return 0===e?null:{id:n.index-1};if(o>=0&&l[o-1]&&!l[o-1].autoGenerated){const e=l[o-1];if(e.allowSelect&&!e.disabled)return e;for(let e=o-1;e>=0;e--){const t=l[e];if(t.allowSelect&&!t.disabled)return t}}return null}firstColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=0;t<e.length;t++){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}lastColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=e.length-1;t>=0;t--){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}nextColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n<t.length;){const e=t[n+1];if(e.autoGenerated)return null;if(e.visible)return e;n++}return null}prevColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n>0;){const e=t[n-1];if(e.autoGenerated)return null;if(e.visible)return e;n--}return null}isVisible(e,t){const l=this,n=l._scrollView.vScrollBar,o=l._scrollView.hScrollBar,i=l.rowById[e],a=l.columnByDataField[t];return{row:function(e){if(!e)return!1;const t=e.visibleIndex;if(-1===t)return!1;const n=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&l.dataSource.length>l.virtualModeCachedRowsCount&&"infinite"!==l.scrolling;let i=e.top;return n&&(i=t*l.rows[0].height),!(i+e.height+o.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight||i<=l._scrollView.scrollTop)}(i),column:function(e){return!!t&&!(-1===e.visibleIndex||e.left+e.computedWidth+n.offsetWidth>=l._scrollView.scrollLeft+l._clientSize.width||e.left<=l._scrollView.scrollLeft)}(a)}}_ensureRowVisible(e){const t=this;if(!t._scrollView)return;const l=t._scrollView.hScrollBar;if(!e)return;const n=e.visibleIndex;if(-1===n)return;const o="virtual"!==t.scrolling?e.top:n*t.rows[0].height,i=t.summaryRow.visible?t.layout.rowMinHeight:0;if(o+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight-i&&(t._scrollView.scrollTop=o+e.height-t.$.scrollView.offsetHeight+t.__frozenNearHeight+t.__frozenFarHeight+l.offsetHeight+i),o<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=o),t.paging.enabled){const o=t.paging.pageSize,i=Math.floor(n/o);if(t.paging.pageIndex!==i)return t.goToPage(i),t._scrollView.scrollTop=0,void setTimeout((()=>{e.top+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight&&(t._scrollView.scrollTop=e.top+e.height),e.top<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=e.top)}),50)}0===n?t._scrollView.scrollTop=0:n===t.dataSource.length-1&&(t._scrollView.scrollTop=t._scrollView.scrollHeight)}_ensureColumnVisible(e){const t=this,l=t._scrollView.vScrollBar;if(!e)return;const n=e.visibleIndex;-1!==n&&(e.left+e.computedWidth+l.offsetWidth>=t._scrollView.scrollLeft+t._clientSize.width&&(t._scrollView.scrollLeft=t._scrollView.scrollLeft+e.computedWidth),e.left<=t._scrollView.scrollLeft&&(t._scrollView.scrollLeft=e.left),0===n?t._scrollView.scrollLeft=0:n===t.columns.length-1&&(t._scrollView.scrollLeft=t._scrollView.scrollWidth))}ensureVisible(e,t){const l=this,n=l.rowById[e],o=l.columnByDataField[t];if("virtual"===l.scrolling){const e=l._scrollView.hScrollBar,t=n.visibleIndex*l.rows[0].height,i=l.summaryRow.visible?l.layout.rowMinHeight:0;return t+n.height+e.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight-i&&l.setVerticalScrollValue(t),void l._ensureColumnVisible(o)}l._ensureRowVisible(n),l._ensureColumnVisible(o)}clearSelection(){const e=this;delete e._rangeSelectionStartRow,delete e._rangeSelectionEndRow,e._clearSelection(!0),e.$.fireEvent("change",{started:!1,finished:!0}),e._refreshSummary()}});
|
|
1519
|
+
Smart.Utilities.Assign("Grid.Select",class{_refreshSelection(){const e=this;if(e.selection.enabled&&(e._selectionColumn.refresh(),!e._isVirtualMode()&&e._selection&&e._selection.rows))for(let t in e._selection.rows)e.rowById[t]||delete e._selection.rows[t];e._refreshCellSelectionRect()}_toggleColumnSelection(e){const t=this;if(!t.selection.enabled||"none"===t.selection.checkBoxes.selectAllMode)return void(t._inputOverlay&&t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay));let l=e.element.getAttribute("selected");l="indeterminate"===l||""!==l;let n=t._recyclingRows;t._selectionColumn._selecting=!0,t.beginUpdate(),t._selection.indexes=[];for(let e=0;e<n.length;e++)n[e].selected=l;if(t._selectionColumn._selecting=!1,t.endUpdate(!1),t._isVirtualMode())if(l)for(let e=0;e<t.dataSource.virtualDataSourceLength;e++)l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e);else t._selection.indexes=[],t._selection.rows=[];if(t._recycle(!1),t.$.fireEvent("change",{started:!1,finished:!0}),t.selection.enabled&&t.selection.checkBoxes.enabled&&"none"!==t.selection.checkBoxes.selectAllMode){const l=e.element,n=l.querySelector(".smart-input");t._inputOverlay?t._inputOverlay.parentNode!==t.$.columnHeader&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)):(t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)),t._inputOverlay.column=e,t._inputOverlay.onpointerdown=function(){t._inputOverlay||(t._inputOverlay.onpointerdown=null);const e=t._inputOverlay.column;t._inputOverlay.classList.remove("smart-animate"),t._selectionColumn._selecting=!0,t.beginUpdate();let l=e.element.hasAttribute("selected"),n=t._recyclingRows;for(let e=0;e<n.length;e++)n[e].selected=!l;t._selectionColumn._selecting=!1;const o=t._inputOverlay;if(t.endUpdate(!1),t._isVirtualMode())if(l)t._selection.indexes=[],t._selection.rows=[];else for(let e=0;e<t.dataSource.virtualDataSourceLength;e++)l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e);return t._recycle(),t.$.fireEvent("change",{started:!1,finished:!0}),t.$.fireEvent("columnClick",{column:e,dataField:e.dataField}),t.$.columnHeader.appendChild(o),t._inputOverlay=o,t._inputOverlay.classList.add("smart-animate"),!1},t._inputOverlay.classList.add("smart-input-overlay"),t._inputOverlay.classList.add("smart-input-overlay-column"),t.appearance.allowCheckBoxesSelectionAnimation&&t._inputOverlay.classList.add("smart-animate"),t._inputOverlay.style.top=(l.offsetHeight-n.offsetHeight)/4+1+"px";const o=t._selectionColumn.element.parentElement.offsetLeft+t._selectionColumn.element.offsetLeft;t.rightToLeft?t._inputOverlay.style.right=o+"px":t._inputOverlay.style.left=o+"px",t._inputOverlay.style.height=l.offsetWidth+"px",t._inputOverlay.style.width=l.offsetWidth+"px",t._inputOverlay.onmousedown=null,t._inputOverlay.classList.add("smart-input-overlay-on"),t._selectionColumn.refresh()}}_refreshCheckBoxColumnSelection(){const e=this;if(e.selection.enabled&&e.selection.checkBoxes.enabled){const t=e._selectionColumn.element;"none"===e.selection.checkBoxes.selectAllMode?(t.removeAttribute("checkbox"),t.label.classList.remove("smart-input")):(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")),e._selectionColumn.refresh()}}_handleExtendedRowSelection(e,t){const l=this;if(!e)return;let n=l._recyclingRows;if(l.paging.enabled&&"page"===l.selection.selectAllMode&&(n=n.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize)),!t||t.ctrlKey||t.metaKey||(l._selection.rows=[],l._selection.indexes=[]),t&&!t.shiftKey&&(l._rangeSelectionStartRow=e,l._rangeSelectionEndRow=e),t&&t.shiftKey){l._rangeSelectionEndRow=e;const t=n.indexOf(l._rangeSelectionStartRow),o=n.indexOf(l._rangeSelectionEndRow),i=Math.min(t,o),a=Math.max(t,o);if(-1===t||-1===o)return;for(let e=i;e<=a;e++){const t=n[e];t.allowSelect&&t.setProperty("selected",!0)}}else!1!==e.allowSelect&&(t&&(t.ctrlKey||t.metaKey)?null===e.selected?e.setProperty("selected",!0):e.setProperty("selected",!e.selected):e.setProperty("selected",!0))}_setSelection(e,t,l){const n=this;if(!n.selection.enabled)return;if(n._lastColumnSelectionRange=null,n._lastRowSelectionRange=null,n.closeMenu(),null===e&&null===t)return void n.clearSelection();const o=function(){if(l&&!l.ctrlKey&&!l.metaKey&&!l.shiftKey||"one"===n.selection.mode){if("many"!==n.selection.mode){for(let e in n._selection.rows){const t=n.rowById[e];t&&(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}n._selection.indexes=[],n._selection.rows=[],n._selection.columns=[],n._selection.cells=[]}n._selection.focusedCell=null}if(n._selection.selectionRect){const e=n._selection.selectionRect;e.parentNode.removeChild(e);const t={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(t.down="touchstart",t.move="touchmove",t.up="touchend"),document.removeEventListener(t.move,e.onMove),document.removeEventListener(t.up,e.onUp),document.removeEventListener(t.down,e.onDown),n._selection.selectionRect=null}};n.beginUpdate();const i=n.columnByDataField[t],a=()=>{const t=n.rowById[e];t&&(t.allowSelect||null===t.allowSelect&&!l)&&(n.selection.checkBoxes.enabled&&l&&l.originalEvent&&l.originalEvent.target&&l.originalEvent.target.parentNode&&l.originalEvent.target.parentNode.hasAttribute("checkbox")&&(l.ctrlKey=!0),o(),n._selectRow(e,l))};if(n.selection.allowCellSelection&&null!=e&&i&&!i.autoGenerated){const i=n.rowById[e];if(!i)return n.endUpdate(!1),void n._recycle();let a=i.getCell(t);const s=n._getParentCell(i,t);s&&(a=s.row.getCell(s.column.dataField)),a&&a.column.allowSelect&&(o(),!l||l.ctrlKey||l.metaKey||(n._selection.rows=[],n._selection.indexes=[],n._selection.columns=[],"many"!==n.selection.mode&&(n._selection.cells=[])),"extended"===n.selection.mode?l&&(l.ctrlKey||l.metaKey)?a.selected=!a.selected:a.selected=!0:"one"===n.selection.mode?a.selected=!0:a.selected=!a.selected,(l&&!l.shiftKey||!n._selection.focusedCell)&&(n._selection.focusedCell={id:a.row.id,value:a.value,index:a.row.index,dataField:a.column.dataField}),l&&(l.shiftKey||n._selection.focusedCell.id===a.row.id&&n._selection.focusedCell.dataField===a.column.dataField&&"extended"===n.selection.mode)&&(s?n._renderCellSelectionRect(a.row,a.column,s.endRow,s.endColumn):n._renderCellSelectionRect(a.row,a.column,a.row,a.column)))}else n.selection.allowRowHeaderSelection&&null!=e&&void 0===n.columnByDataField[t]||n.selection.checkBoxes.enabled&&null!=e&&"_checkBoxColumn"===t&&void 0===n.columnByDataField[t]?a():null==e||null!=t&&void 0===n.columnByDataField[t]||!n.selection.allowRowSelection?n.selection.allowColumnHeaderSelection&&i&&(o(),n._selectColumn(t,l||new KeyboardEvent("keydown"))):a();n.endUpdate(!1,!1),n._recycle(!1,!0,!1),null==e||i||n._renderInputOverlay(e,l),n.__selectionStarted=new Date}_renderCellSelectionRect(e,t,l,n){const o=this;let i=o._recyclingRows;const a=i.indexOf(e),s=i.indexOf(l);if(!(o.grouping.enabled&&"advanced"===o.grouping.renderMode&&o.dataSource&&o.dataSource.groupBy.length>0)&&a>=0&&s>=0){if(!o._selection.selectionRect){const e=function(e){const t=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div");return n.classList.add("smart-selection-overlay"),n.appendChild(l),l.appendChild(t),t.classList.add("smart-selection-overlay-content"),l.classList.add("smart-selection-overlay-border-content"),o.selection.allowCellDragSelectionHandle&&e&&l.classList.add("handle"),o.$.scrollView.appendChild(n),n},t=o._selection.selectionRect=e(!0);if(o.selection.allowCellDragSelectionHandle){let e=null,l=null,n=null;t.onMove=function(t){const a=o._selection.selectionRect;let s=t.clientX,r=t.clientY;t.touches&&(s=t.touches[0].clientX,r=t.touches[0].clientY);const d=function(e){const t=(o.enableShadowDOM?o.shadowRoot:o.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null;for(let e=0;e<t.length;e++){const n=t[e];if(n.getAttribute("data-field")){l=n.getAttribute("data-field");break}}let n=null;for(let e=0;e<t.length;e++){const l=t[e];if(l.getAttribute("data-id")){n=l.row;break}}return{column:o.columnByDataField[l],row:n}};if(a&&a.capturedDrag){let e=d({clientX:s,clientY:r}),l=d({clientX:s,clientY:r+a.top}).row,n=d({clientX:s+a.left,clientY:r}).column;if(l||(l=i[i.length-1]),n||(n=e.column),l&&n&&e.row&&e.column){a.row=e.row,a.rowId=a.row.id,a.column=e.column,a.endDragRow=a.endRow=l,a.endDragColumn=a.endColumn=n,a.endDragRowId=a.endDragRow.id,o._dragSelectionStartDataField=a.column.dataField,o._dragSelectionStartRow=a.row;const t=a.row.getCell(a.column.dataField);o._selection.focusedCell={index:t.row.index,id:t.row.id,dataField:t.column.dataField,value:t.value}}o._resizeSelectionRect(),t.preventDefault()}else if(a&&a.captured)if(o._dragSelectionStartDataField=o._selection.focusedCell.dataField,o._dragSelectionStartRow=o.rowById[o._selection.focusedCell.id],null===l&&null===n&&(Math.abs(s-e.left)>=30?l=!0:Math.abs(r-e.top)>=30&&(n=!0)),a.lastPoint&&Math.abs(a.lastPoint.top-r)>=40?(l=null,n=!0):a.lastPoint&&Math.abs(a.lastPoint.left-s)>=40&&(n=null,l=!0),l){const t=a.endDragColumn.dataField,l=d({clientX:s,clientY:e.top-5});l.row&&l.column&&(a.endDragRow=a.endRow,a.endDragColumn=l.column,a.endDragColumn.dataField!==t&&(a.lastPoint={left:s,top:r}),o._resizeSelectionRect())}else if(n){const t=a.endDragRow,l=d({clientX:e.left-5,clientY:r});l.row&&l.column&&(a.endDragRow=l.row,a.endDragColumn=a.endColumn,a.endDragRow.id&&a.endDragRow.id!==t.id&&(a.lastPoint={left:s,top:r}),o._resizeSelectionRect())}a&&a.captured&&o.selection.allowDragSelectionAutoScroll&&(o._autoScrollSelectionDragInterval&&clearInterval(o._autoScrollSelectionDragInterval),o.selection.isDragging=!0,o._autoScrollSelectionDragInterval=setInterval((function(){const e=o.$.scrollView.getBoundingClientRect();s<=e.left+20?(o.scrollLeft-=15,o._resizeSelectionRect()):s>=e.left+e.width-20&&(o.scrollLeft+=15,o._resizeSelectionRect()),r<=e.top+20?(o.scrollTop-=15,o._resizeSelectionRect()):r>=e.top+e.height-20&&(o.scrollTop+=15,o._resizeSelectionRect())}),25))},t.onUp=function(){if(!t.captured)return;o._autoScrollSelectionDragInterval&&clearInterval(o._autoScrollSelectionDragInterval),o.editing.editCell||o.editing.editRow||o.focus(),t.capturedDrag=!1,t.captured=!1,l=null,n=null,e=null,t.lastPoint=null;const i=t.cellValues;t.minRow&&t.maxRow&&t.maxRow&&t.maxColumn&&(o._selectCellsRange(t.minRow,t.maxRow,t.minColumn.dataField,t.maxColumn.dataField),t.row=t.minRow,t.rowId=t.row.id,t.column=t.minColumn,t.endColumn=t.maxColumn,t.endRow=t.maxRow,t.endRowId=t.maxRow.id,t.cellValues=i,o._resizeSelectionRect(),o.selection.allowCellDragSelectionAutoFill&&o._pasteSelectedCells({row:t.row,endRow:t.endDragRow,column:t.column,endColumn:t.endColumn},i)),t.endDragColumn=null,t.endDragRow=null,t.minColumn=null,t.minRow=null,t.maxColumn=null,t.maxRow=null},t.onDown=function(l){if(t.captured&&!e){let t=l.clientX,n=l.clientY;l.touches&&(t=l.touches[0].clientX,n=l.touches[0].clientY),e={left:t,top:n}}};const a={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(a.down="touchstart",a.move="touchmove",a.up="touchend"),t["on"+a.down]=function(e){const l=t.getBoundingClientRect();let n=e.clientX,i=e.clientY;e.touches&&(n=e.touches[0].clientX,i=e.touches[0].clientY),n>=l.right-5&&i>=l.bottom-5?(t.captured=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn):o.selection.allowCellDragDropSelectionHandle&&i>=l.bottom-5?(t.captured=!0,t.capturedDrag=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn,t.left=t.endColumn.left-t.column.left,t.top=t.endRow.top-t.row.top):t.captured||o._rowDownHandler(e)},document.addEventListener(a.move,t.onMove,{passive:!1}),document.addEventListener(a.up,t.onUp,{passive:!1}),document.addEventListener(a.down,t.onDown,{passive:!1})}}const e=o._selection.selectionRect;e.row=o.rowById[o._selection.focusedCell.id],e.rowId=o._selection.focusedCell.id,e.column=o.columnByDataField[o._selection.focusedCell.dataField],e.endRow=l,e.endRowId=l.id,e.endDragRow=l,e.endColumn=n,e.endDragColumn=n,o._refreshCellSelectionRect()}}_resizeSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t)return;let l=e._recyclingRows,n=t.row,o=t.endDragRow,i=t.column,a=t.endDragColumn;const s=e.viewColumns,r=l.indexOf(n),d=l.indexOf(o),c=l.indexOf(t.endRow),u=s.indexOf(i),f=s.indexOf(a),_=s.indexOf(t.endColumn),g=Math.min(c,Math.min(r,d)),m=Math.max(c,Math.max(r,d)),w=Math.min(_,Math.min(u,f)),p=Math.max(_,Math.max(u,f));c<=Math.min(r,d)?t.minRow=t.endRow:t.minRow=r<=d?n:o,c>=Math.max(r,d)?t.maxRow=t.endRow:t.maxRow=r>=d?n:o,_<=Math.min(u,f)?t.minColumn=t.endColumn:t.minColumn=u<=f?i:a,_>=Math.max(u,f)?t.maxColumn=t.endColumn:t.maxColumn=u>=f?i:a;let h=0,y=0,S=0,v=0;for(let e=g;e<=m;e++){const t=l[e];if(t){e===g&&(h=t.top),e===m&&(y=t.top+t.height-h);for(let e=w;e<=p;e++){const l=s[e].dataField,n=t.getCell(l);e===w&&(S=n.column.left),e===p&&(v=n.column.left+n.column.computedWidth-S)}}}t.style.top=h-e.scrollTop-1+"px",e._isVirtualMode()&&(t.style.top=h+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft?t.style.right=S-e.scrollLeft+"px":t.style.left=S-e.scrollLeft+"px",t.style.height=y+1+"px",t.style.width=v+1+"px"}_getPatternValue(e,t,l){let n=[],o=0,i=[],a=[],s=[],r=[];const d={names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},c={names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},u=function(e){if(void 0!==e&&!(e.toString().indexOf("GMT+")>=0||e.toString().indexOf("GMT-")>=0)){if(!isNaN(parseFloat(e)))return/[A-Za-z]/.test(e.toString())?void 0:parseFloat(e);if(d.names.indexOf(e)>=0)return r=d.names,d.names.indexOf(e);if(d.namesAbbr.indexOf(e)>=0)return r=d.namesAbbr,d.namesAbbr.indexOf(e);if(d.namesShort.indexOf(e)>=0)return r=d.namesShort,d.namesShort.indexOf(e);if(c.names.indexOf(e)>=0)return r=c.names,c.names.indexOf(e);if(c.namesAbbr.indexOf(e)>=0)return r=c.namesAbbr,c.namesAbbr.indexOf(e);if(void 0!==e&&(null===e&&(e=""),/\d+/.test(e.toString()))){s.push(e.toString().replace(/[0-9]/,"#")),s[s.length-1]=s[s.length-1].replace(/[0-9]/g,"");const t=parseFloat(e.toString().replace(/\D/g,""));return isNaN(t)?0:t}}};let f=0;for(let e in l){let t=l[e];n[o]=[],f=0;for(let e in t){let l=u(t[e]);void 0!==l&&(n[o].push(l),f++)}if(0===n[o].length)continue;let a=n[o][0],d=0;for(let e=0;e<n[o].length;e++){let t=u(n[o][e-1]),l=u(n[o][e]);0===e&&(t=l),a+=l,d+=l-t}a/=n[o].length,a-=n[o][0],a+=n[o][n[o].length-1],0!==d&&(d/=n[o].length-1),(r.length>0||s.length>0)&&(d=1,a=n[o][0]),n[o].length<=2&&(a=n[o][n[o].length-1]+d),i.push({step:d,stepStart:a}),o++}for(let e=0;e<f;e++){let t=n[0][e],l=0;for(let o=1;o<n.length;o++){const i=u(n[o-1][e]),a=u(n[o][e]);t+=a,l+=a-i}t/=n.length,t-=n[0][e],t+=n[n.length-1][e],0!==l&&(l/=n.length-1),(r.length>0||s.length>0)&&(l=1,t=n[0][e]),n.length<=2&&(t=n[n.length-1][e]+l),a.push({step:l,stepStart:t})}if(!n[e]){let l=n.length;for(let o=l;o<=e;o++){n[o]=[];for(let e=0;e<=t;e++)a[e]||(a[e]=a[e-1]),a[e]&&(o===l?n[o][e]=a[e].stepStart:(n[o][e]=n[o-1][e]+a[e].step,r.length>1&&n[o][e]>=r.length&&(n[o][e]=0)))}return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}if(!n[e][t]){let l=f;for(let o=l;o<=t;o++)i[e]&&(o===l?n[e].push(i[e].stepStart):(n[e][o]=n[e][o-1]+i[e].step,r.length>1&&n[e][o]>=r.length&&(n[e][o]=0)));return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}return n[e]&&n[e][t]?s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]:0}_pasteDataType(e){const t=this.dataSource&&"number"==typeof this.dataSource.dataSource,l=e.cell,n=e.value;let o=l.column.dataType;return o&&!t||(o=isNaN(parseFloat(n))?"string":n instanceof Date?"date":"true"===n||"false"===n?"boolean":"number"),o}_pasteModeCopy(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell;let i=e.value;if(o.column.editor&&o.column.editor.dataSource&&i)for(let e=0;e<o.column.editor.dataSource.length;e++){const t=o.column.editor.dataSource[e];if("string"!=typeof t&&t.label===i){i=t.value;break}}const a=i,s=e.dataField;let r=a,d=!1;if("string"===n)r=a,d=!0;else if("bool"===n||"boolean"===n)1!==a&&"1"!==a&&!0!==a&&"true"!==a&&"TRUE"!==a&&"True"!==a||(r=!0,d=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):(r=a,d=!0)}else if("number"===n||"float"===n||"int"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):null!==a?"int"===n||"integer"===n?(r=parseInt(a),d=!0):(r=parseFloat(a),isNaN(r)&&(r=null),d=!0):(r=null,d=!0)}if(d)if(t.dataSource&&t.dataSource.virtualDataSource){const e={};e[o.column.dataField]=r,t.updateRow(o.row.id,e)}else{const e=o.value;if(t._setCellUndoRedo(o,e,r),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]),t._pasteTempValues.push({id:o.row.id,cell:o,dataField:o.column.dataField,oldValue:e,newValue:r}),t._pasteTimer&&clearTimeout(t._pasteTimer);const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};t._pasteTimer=setTimeout((()=>{if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1)}}),t)}else t.onCellUpdate([o],[e],[r],(function(e){e&&(l(o,r),o.value=r)}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const e=Object.assign({},o.row.data),l=Object.assign({},o.row.data);l[o.column.dataField]=r,o.row.updatedDate=new Date,o.row.updatedBy=t.currentUser,t.onRowUpdate([o.row.index],[o.row],[e],[l],(function(e){e&&(o.value=r)}),t)}else o.value=r}}_pasteModeFill(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell,i=e.selectedValues,a=e.minRowIndex,s=e.minColumnIndex,r=e.currentRowIndex,d=e.currentColumnIndex,c=e.dataField;let u=e.value;if("string"===n)/\d+/.test(u.toString())?(u=t._getPatternValue(r-a,d-s,i),void 0===u&&i[r-a]&&i[r-a][d-s]&&(u=i[r-a][d-s])):(u=t._getPatternValue(r-a,d-s,i),void 0===u&&(u=i[r-a]?i[r-a][d-s]:e.value),void 0===u&&(u=e.value)),void 0!==u&&(o.value=u);else if("bool"===n||"boolean"===n)1!==u&&"1"!==u&&!0!==u&&"true"!==u&&"TRUE"!==u&&"True"!==u||(o.value=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n&&(o.value=null),i[r-a]&&(u=i[r-a][d-s],void 0!==u&&(o.value=u))}else if("number"===n||"float"===n||"int"===n){u=t._getPatternValue(r-a,d-s,i);const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n?o.value=null:o.value=null!==u?"int"===n||"integer"===n?parseInt(u):parseFloat(u):null}}_pasteSelectedCells(e,t){const l=this;l.beginUpdate();let n=l._recyclingRows,o=e.row,i=e.endRow,a=e.column,s=e.endColumn;const r=n.indexOf(o),d=n.indexOf(i),c=n.indexOf(e.endRow),u=l.viewColumns,f=u.indexOf(a),_=u.indexOf(s),g=u.indexOf(e.endColumn),m=Math.min(c,Math.min(r,d)),w=Math.max(c,Math.max(r,d)),p=Math.min(g,Math.min(f,_)),h=Math.max(g,Math.max(f,_));let y=0,S=0,v=0,R=0;for(let e in t)0===y&&(S+=Object.keys(t[e]).length),y++;for(let e=m;e<=w;e++){const o=n[e];v=0;for(let n=p;n<=h;n++){if(!u[n])continue;const i=u[n].dataField,a=o.getCell(i);let s=0;for(let r in t){if(s===R){let s=0,d=t[r];for(let r in d){if(v===s){let s=d[r],c=!0;if(t[o.id]&&t[o.id][i]&&(c=!1),c&&"none"!==l.clipboard.autoFillMode){const o={value:s,targetValue:a.value,dataField:r,index:a.row.visibleIndex,targetDataField:i,targetRowIndex:e};if(l.clipboard.onPasteValue){l.clipboard.onPasteValue(o);const e=a.value;a.value=o.value,l._setCellUndoRedo(a,e,o.value)}else o.cell=a,o.selectedValues=t,o.minRowIndex=m,o.maxRowIndex=w,o.minColumnIndex=p,o.maxColumnIndex=h,o.currentColumnIndex=n,o.currentRowIndex=e,"copy"===l.clipboard.autoFillMode?l._pasteModeCopy(o):"fillSeries"===l.clipboard.autoFillMode&&l._pasteModeFill(o)}}s++}}s++}v++,v>=S&&(v=0)}R++,R>=y&&(R=0)}l.endUpdate(!1),l._recycle(!1),l._refreshDataFilters()}_refreshCellSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t||t&&t.captured)return;let l=e._recyclingRows,n=t.row,o=t.endRow,i=t.column,a=t.endColumn;const s=e.viewColumns;if(!a||!i)return;if(e._isVirtualMode()){if(n.id!==t.rowId&&!e.rowById[t.rowId])return t.style.height="0px",void(t.style.width="0px");n=e.rowById[t.rowId],o=e.rowById[t.endRowId]}if(!i.allowSelect||!a.allowSelect){if(i===a)return t.style.width="0px",void(t.style.height="0px");{const e=s.indexOf(i),l=s.indexOf(a);i=null,a=null;for(let t=e;t<l;t++){const e=s[t];e.allowSelect&&!i&&(i=e),a=e}if(!i||!a)return t.style.width="0px",void(t.style.height="0px")}}const r=l.indexOf(n),d=l.indexOf(o),c=s.indexOf(i),u=s.indexOf(a);let f=Math.min(r,d),_=Math.max(r,d),g=Math.min(c,u),m=Math.max(c,u);g=Math.max(0,g),f=Math.max(0,f);const w=function(e){const t=l.indexOf(e.row),n=l.indexOf(e.endRow),o=s.indexOf(e.column),i=s.indexOf(e.endColumn);f=Math.min(f,t),f=Math.min(f,n),f=Math.max(0,f),_=Math.max(_,t),_=Math.max(_,n),g=Math.min(g,o),g=Math.min(g,i),g=Math.max(0,g),m=Math.max(m,o),m=Math.max(m,i)},p=e._getParentCell(n,i.dataField),h=e._getParentCell(n,a.dataField),y=e._getParentCell(o,a.dataField),S=e._getParentCell(o,i.dataField);p&&w(p),h&&w(h),y&&w(y),S&&w(S);let v=0,R=0,C=0,x=0;t.cellValues=[];for(let n=f;n<=_;n++){const o=l[n];if(n===f&&(v=o.top,!0!==o.freeze&&"near"!==o.freeze&&(v+=e.__frozenNearHeight),"far"===o.freeze&&(v=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight)),n===_){let t=o.top;"far"===o.freeze&&(t=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight),R=t+o.height-v,!0!==o.freeze&&"near"!==o.freeze&&(R+=e.__frozenNearHeight)}t.cellValues[o.id]=[];const i=e._isUpdating;e._isUpdating=!0;for(let l=g;l<=m;l++){const n=s[l].dataField,i=o.getCell(n);let a=i.element?i.element.textContent:i.value;if(void 0===a&&(a=""),t.cellValues[o.id][n]=a,l===g&&(C=i.column.left,i.column.freeze&&"far"===i.column.freeze&&(C=e.__clientSize.width-e.__frozenFarWidth+C+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth)),l===m){let t=i.column.left;i.column.freeze&&"far"===i.column.freeze&&(t=e.__clientSize.width-e.__frozenFarWidth+t+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),x=t+i.column.computedWidth-C}i.selected=!0}e._isUpdating=i}if(v-e.scrollTop<e.layout.rowMinHeight&&e.filtering.enabled&&e.filtering.filterRow.visible){const t=v;v=e.layout.rowMinHeight+e.scrollTop,R-=v-t}if(R<=0)t.classList.add("smart-visibility-hidden");else{if(t.classList.remove("smart-visibility-hidden"),t.style.top=v-e.scrollTop-1+"px",e._isVirtualMode()&&(t.style.top=v+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft)t.style.right=C-e.scrollLeft+"px";else if(t.style.left=C-e.scrollLeft+"px",C-e.scrollLeft<e.__frozenNearWidth-1){let l=0;for(let t=0;t<e._frozenNearColumns.length;t++){const n=e._frozenNearColumns[t];n&&n.autoGenerated&&n.visible&&(l+=n.width)}if(C-e.scrollLeft<l){const n=l-C+e.scrollLeft;x-=n,t.style.left=n+C-e.scrollLeft+"px"}}t.style.height=R+1+"px",t.style.width=x+1+"px"}}_renderInputOverlay(e,t,l){const n=this,o=n.rowById[e];if(o&&!1!==o.allowSelect&&!o.label&&t&&n.selection.checkBoxes.enabled){n._inputOverlay&&n._inputOverlay.classList.contains("smart-input-overlay-column")&&(n._inputOverlay.parentNode&&n._inputOverlay.parentNode.removeChild(n._inputOverlay),n._inputOverlay=null),n._inputOverlay||(n._inputOverlay=document.createElement("div"),n.$.scrollView.appendChild(n._inputOverlay),n._inputOverlay.classList.add("smart-input-overlay"));let e=o.freeze?o.top:n.__frozenNearHeight+o.top;const t=Math.round((o.cellHeight-n._selectionColumn.computedWidth)/2),i=n._selectionColumn.element.parentElement.offsetLeft+n._selectionColumn.element.offsetLeft;if(n._inputOverlay.style.left=i+"px",n._inputOverlay.style.height=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.width=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.top=e+t-n.scrollTop+"px",o&&o.element){const e=o.element.querySelector("smart-grid-cell");e&&(n._inputOverlay.cell=e.cell)}n._inputOverlay.row=o,n._inputOverlay.onpointerdown=function(e){n._inputOverlay||(n._inputOverlay.onpointerdown=null);const t=n._inputOverlay.row,l=n._inputOverlay.cell;n.beginUpdate(),t.selected=!t.selected,n.endUpdate(!1),n.$.fireEvent("change",{started:!1,finished:!0}),n._refreshSummary(!1);const o=e.originalEvent?e.originalEvent:e,i=3===o.which;n.$.fireEvent("rowClick",{row:t,id:t.id,isRightClick:i,originalEvent:o,pageX:o.pageX,pageY:o.pageY}),l&&n.$.fireEvent("cellClick",{cell:l,id:t.id,dataField:l.column.dataField,isRightClick:i,originalEvent:o,pageX:o.pageX,pageY:o.pageY}),n._recycle(),n._renderInputOverlay(t.id,e,!0)},n.appearance.allowCheckBoxesSelectionAnimation&&void 0===l&&n._inputOverlay.classList.add("smart-animate"),requestAnimationFrame((()=>{n._inputOverlay&&n._inputOverlay.classList.add("smart-input-overlay-on")}))}}_selectRow(e,t){const l=this,n=l.rowById[e];if(n&&l.selection.enabled&&(!n.header||"row-resize"!==n.header.style.cursor)){if(t&&(!t.shiftKey||!l._selection.focusedCell)){const t=n.getCell(l.columns[0].dataField);l._selection.focusedCell={index:t.row.index,id:e,dataField:t.column.dataField,value:t.value}}l._lastRowsSelectionRange=null,"extended"===l.selection.mode?l._handleExtendedRowSelection(n,t):"one"===l.selection.mode?n.select():n.selected?n.unselect():n.select()}}_getParentCell(e,t){const l=this;let n=l._recyclingRows;for(let o=0;o<l._cellsMerge.length;o++){const i=l._cellsMerge[o];let a=[],s=[];if(a.push(i.row),i.rowSpan>1){const e=n.indexOf(i.row);if(e>=0)for(let t=e;t<e+i.rowSpan;t++)n[t]&&-1===a.indexOf(n[t])&&a.push(n[t])}if(s.push(i.column.dataField),i.colSpan>1){const e=l.viewColumns.indexOf(l.columnByDataField[i.column.dataField]);for(let t=e;t<e+i.colSpan;t++)s[t]&&-1===s.indexOf(s[t].dataField)&&s.push(s[t].dataField)}if(a.indexOf(e)>=0&&s.indexOf(t)>=0)return{row:i.row,column:i.column,endRow:a[a.length-1],endColumn:l.columnByDataField[s[s.length-1]]}}if(l._cellRowSpan)for(let o=0;o<l._cellRowSpan.length;o++){const o=e.visibleIndex;let i=-1,a=null;for(let e=0;e<l._cellRowSpan.length;e++){const t=l._cellRowSpan[e];if(o>t[0]&&o<t[1]){i=t[0],a=t[2];break}}if(i>=0&&a===t){const e=n[i];if(e)return{row:e,column:l.columnByDataField[t],endRow:e,endColumn:l.columnByDataField[t]}}}return null}_selectCellsRange(e,t,l,n){const o=this,i=o._selection.selectionRect;if(o._lastRowsSelectionRange&&o._lastRowsSelectionRange.id===e.id&&o._lastRowsSelectionRange.endId===t.id&&o._lastColumnSelectionRange&&o._lastColumnSelectionRange.dataField===l&&o._lastColumnSelectionRange.endDataField===n)return;o.beginUpdate(),o._clearSelection(),o._lastRowsSelectionRange={id:e.id,endId:t.id},o._lastColumnSelectionRange={dataField:l,endDataField:n},(!i||i&&!i.captured)&&o._selection.focusedCell&&o._renderCellSelectionRect(o.rowById[o._selection.focusedCell.id],o.columnByDataField[o._selection.focusedCell.dataField],o.rowById[o._lastRowsSelectionRange.endId],o.columnByDataField[o._lastColumnSelectionRange.endDataField]);let a=o._recyclingRows;const s=o.viewColumns;let r=-1,d=-1,c=a.indexOf(e),u=a.indexOf(t),f=-1;for(let e=0;e<s.length;e++){const t=s[e];t.allowSelect&&(-1===f&&(f=e),t.dataField===l&&(r=e),t.dataField===n&&(d=e))}if(-1===f)return o.endUpdate(!1),void o._recycle();-1===r?r=f:-1===d&&(d=f);let _=Math.min(c,u),g=Math.max(c,u),m=Math.min(r,d),w=Math.max(r,d);const p=function(e){const t=a.indexOf(e.row),l=a.indexOf(e.endRow),n=s.indexOf(e.column),o=s.indexOf(e.endColumn);_=Math.min(_,t),_=Math.min(_,l),g=Math.max(g,t),g=Math.max(g,l),m=Math.min(m,n),m=Math.min(m,o),w=Math.max(w,n),w=Math.max(w,o)},h=o._getParentCell(e,l),y=o._getParentCell(t,n);if(h&&p(h),y&&p(y),g<0||_<0||m<0||w<0)return o.endUpdate(!1),void o._recycle();for(let e=_;e<=g;e++){const t=a[e];if(t.allowSelect)for(let e=0;e<s.length;e++){const l=s[e];l.allowSelect&&e>=m&&e<=w&&(t.getCell(l.dataField).selected=!0)}}o.endUpdate(!1,!1),o._recycle(!1,!0,!1),o._selectionTimer&&clearTimeout(o._selectionTimer),o._selectionTimer=setTimeout((()=>{o._recycle(!1,!0,!1)}),50)}_selectRowsRange(e,t,l){const n=this;if(n._lastRowsSelectionRange&&n._lastRowsSelectionRange.id===e.id&&n._lastRowsSelectionRange.endId===t.id)return;if(n._dragDrop&&n._dragDrop.dragDetails)return;n.beginUpdate(),n._clearSelection(),n._lastRowsSelectionRange={id:e.id,endId:t.id};let o=n._recyclingRows;const i=o.indexOf(e),a=o.indexOf(t),s=Math.min(i,a),r=Math.max(i,a);if(r<0)return n.endUpdate(!1),void n._recycle();for(let e=s;e<=r;e++){const t=o[e];t&&t.allowSelect&&(t.selected=!1!==l)}n.endUpdate(!1),n._recycle()}_selectColumnsRange(e,t){const l=this;if(l._lastColumnSelectionRange&&l._lastColumnSelectionRange.dataField===e&&l._lastColumnSelectionRange.endDataField===t)return;if(l._dragDrop&&l._dragDrop.dragDetails)return;l.beginUpdate(),l._clearSelection(),l._lastColumnSelectionRange={dataField:e,endDataField:t};const n=l.viewColumns;let o=-1,i=n.length;for(let l=0;l<n.length;l++){const a=n[l];a.allowSelect&&(a.dataField===e&&(o=l),a.dataField===t&&(i=l))}const a=Math.min(o,i),s=Math.max(o,i);for(let e=0;e<n.length;e++){const t=n[e];t.allowSelect&&e>=a&&e<=s&&(t.selected=!0)}l.endUpdate(!1),l._recycle()}_selectColumn(e,t){const l=this,n=l.columnByDataField[e],o=l.viewColumns;if(!n||!l.selection.enabled||!1===n.allowSelect||!l.selection.allowColumnHeaderSelection)return;if(n&&"col-resize"===n.element.style.cursor)return;let i=!1;if(n&&(n.allowSelect||null===n.allowSelect&&!t)&&(i=!0),i&&t)if("extended"===l.selection.mode){if(t.ctrlKey||t.metaKey||t.shiftKey||(l._rangeSelectionStartColumn=n,l._rangeSelectionEndColumn=n),t.ctrlKey||t.metaKey?n.selected=!n.selected:n.selected=!0,t&&t.shiftKey){l._rangeSelectionStartColumn||(l._rangeSelectionStartColumn=n),l._rangeSelectionEndColumn=n,l._selection.columns=[];const e=o.indexOf(l._rangeSelectionStartColumn),t=o.indexOf(l._rangeSelectionEndColumn),i=Math.min(e,t),a=Math.max(e,t);for(let e=i;e<=a;e++){const t=o[e];t&&!1!==t.allowSelect&&(t.selected=!0)}}}else"one"===l.selection.mode||null===n.selected?n.selected=!0:n.selected=!n.selected}selectAllRows(){const e=this;let t=e.rows;e._selectionColumn._selecting=!0,e.beginUpdate();for(let e=0;e<t.length;e++)t[e].selected=!0;e._selectionColumn._selecting=!1,e.endUpdate(!1),e._refreshSummary(!1),e._recycle(!1),e._refreshCheckBoxColumnSelection(),e.$.fireEvent("change",{started:!1,finished:!0})}hasSelectedRows(){const e=this.getVisibleRows(),t=this._getSelectedRows(!0,!1);return t.length===e.length||t.length>0&&t.length<e.length||0!==t.length&&0!==e.length&&void 0}areAllRowsSelected(){const e=this.getVisibleRows(),t=this._getSelectedRows(!0,!1);return t.length>0&&t.length===e.length}_getSelectedRows(e,t){const l=this,n=[];let o=l.rows;if(l.rows.canNotify=!1,e&&(o=l.getVisibleRows()),l._isVirtualMode()){let e=l._selection.indexes;return l.paging.enabled&&t&&l._isVirtualMode()&&(e=e.slice(0,l.paging.pageSize)),l.rows.canNotify=!0,Object.keys(e).length}l.paging.enabled&&t&&(o=l._isVirtualMode()?o.slice(0,l.paging.pageSize):o.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize));for(let e=0;e<o.length;e++){const t=o[e];t.getProperty("selected")?n.push(t):(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}return l.rows.canNotify=!0,n}_dragSelectionEnd(e){const t=this;t._dragSelectionStartDataField=null,t._dragSelectionStartRow=null,t.__selectionStarted&&(t.$.fireEvent("change",{started:!1,finished:!0,originalEvent:e}),t._refreshSummary(),delete t.__selectionStarted,delete t.__selectionStartedFired),t.selection.allowDragSelection&&t.selection.isDragging&&(t.selection.isDragging=!1,t._autoScrollSelectionDragInterval&&(clearInterval(t._autoScrollSelectionDragInterval),t.editing.isEditing||t._recycle()))}_dragSelection(e){const t=this;if("extended"!==t.selection.mode||!1===t.selection.allowDragSelection)return;if(!t._dragSelectionStartDataField&&!t._dragSelectionStartRow)return;const l=()=>{t.__selectionStarted&&!t.__selectionStartedFired&&(t.$.fireEvent("change",{started:!0,finished:!1,originalEvent:e}),t.__selectionStartedFired=!0),t.$.fireEvent("change",{started:!1,finished:!1,originalEvent:e})};if(!t.selection.allowCellSelection||!t._dragSelectionStartDataField||t._columnResizeLine||t._dragSelectionStartDataField.startsWith("_")||!t._dragSelectionStartRow||t._rowResizeLine){if(t._dragSelectionStartRow&&!t._rowResizeLine&&(t.selection.allowRowSelection&&!t._dragSelectionStartDataField.startsWith("_")||t.selection.allowRowHeaderSelection&&t._dragSelectionStartDataField.startsWith("_"))){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){o=t.row,!o&&t.cell&&(o=t.cell.row);break}}let i=!0;t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&o&&t._lastRowsSelectionRange.endId===o.id&&(i=!1),o&&!o.allowSelect&&(i=!1),o&&o.allowSelect&&t._selectRowsRange(t._dragSelectionStartRow,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,i&&l(),t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25)}else if(t._dragSelectionStartDataField&&!t._columnResizeLine&&!t._dragSelectionStartDataField.startsWith("_")&&t.selection.allowColumnHeaderSelection){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}o&&t._selectColumnsRange(t._dragSelectionStartDataField,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval);let i=!0;t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(i=!1),i&&l(),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15)}),25)}}else{const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}let i=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){i=t.row;break}}if(!i&&n.length&&n[0].classList.contains("smart-grid-scroll-view")){i=t._recyclingRows[t._recyclingRows.length-1];const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,i.element.getBoundingClientRect().top);for(let e=0;e<l.length;e++){const t=l[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}}if(o&&i){if(i.id===t._dragSelectionStartRow.id&&t._dragSelectionStartDataField===o)return;if(o&&o.startsWith("_"))return;let e=!0;t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(e=!1),t._selectCellsRange(t._dragSelectionStartRow,i,t._dragSelectionStartDataField,o),t._removeCellContentPopup(),e&&l()}t.selection.allowDragSelectionAutoScroll&&(t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15),e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25))}}select(e,t){const l=this;l.isInitialized&&(!t&&void 0!==e&&l._selection&&l._selection.rows[e]||(l._setSelection(e,t),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary()))}selectRowsByIndex(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._isVirtualMode()){let l=[];for(let t=0;t<e.length;t++)l[e[t]]=!0;return t._selection.indexes=l,void t._recycle()}t.beginUpdate();for(let l in e){const e=t.rows[l];e&&t._setSelection(e.id)}t.endUpdate(!1),t._recycle()}))}selectRowsRange(e,t){const l=this,n=l.rowById[e],o=l.rowById[t];n&&o&&(l._selectRowsRange(n,o),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}selectCellsByQuery(e){const t=this,l=t.findCells(e);requestAnimationFrame((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t.beginUpdate();for(let e in l){const n=l[e][0],o=l[e][1];t._setSelection(n,o)}t.endUpdate(!1),t._recycle()}))}selectRowsByQuery(e,t,l){const n=this,o=n.find(e,t,l).map((e=>e.$.id));o.length&&n.selectRows(o)}selectRows(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t.beginUpdate();for(let l in e)t._setSelection(e[l]);t.endUpdate(!1),t._recycle()}))}selectCells(e,t){const l=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let n in e)for(let o=0;o<t.length;o++)l._setSelection(e[n],t[o]);l.endUpdate(!1),l._recycle()}))}selectRange(e,t,l,n){const o=this;!function(){const i=new KeyboardEvent("keydown",{shiftKey:!0});requestAnimationFrame((()=>{"extended"!==o.selection.mode&&"many"!==o.selection.mode&&o._clearSelection(),o.beginUpdate(),o._setSelection(e,t),o._setSelection(l,n,i),o.ensureVisible(e,t),o.endUpdate(!1),o._refreshSummary(!1),o._recycle()}))}(),o.$.fireEvent("change",{started:!1,finished:!0})}unselect(e,t){const l=this;l._selection&&(l._selection.rows&&l._selection.rows[e]&&delete l._selection.rows[e],l._selection.columns&&l._selection.columns[t]&&delete l._selection.columns[t],l._selection.cells&&(l._selection.cells["row"+e]&&(delete l._selection.cells["row"+e][t],1===Object.getOwnPropertyNames(l._selection.cells["row"+e]).length&&delete l._selection.cells["row"+e]),l._selection.cells["column"+t]&&(delete l._selection.cells["column"+t][e],1===Object.getOwnPropertyNames(l._selection.cells["column"+t]).length&&delete l._selection.cells["column"+t])),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}getSelectedRows(){const e=this;let t=[];if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);if(e._isVirtualMode()){for(let e in l){const n=l[e];t.push([n,{}])}return t}for(let n in l){const o=l[n],i=e.rowById[o];if(!i)continue;const a={};for(let e in i.data)switch(e){case"$":case"parent":case"level":case"leaf":case"children":continue;default:a[e]=i.data[e]}t.push([i.id,a])}}return t}getSelectedRowIndexes(){const e=this;return e._selection.indexes&&Object.keys(e._selection.indexes).length>0?e._selection.indexes:[]}getSelectedRowIds(){const e=this;let t=[];if(e._isVirtualMode())return e._selection.rows&&Object.keys(e._selection.rows).length>0?e._selection.rows:void 0;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);for(let n in l){const o=l[n],i=e.rowById[o];i&&t.push(i.id)}}return t}getSelectedCells(e){const t=this;let l=[];if(t._selection.cells)for(let n in t._selection.cells)if(n.startsWith("row")){let o=n.replace("row",""),i=null;for(let a in t._selection.cells[n])if(i=a.replace("column",""),l||(l=[]),!1===e)l.push([o,i]);else{const e=t.getCellValue(o,i);l.push([o,i,e])}}return l}getSelection(){const e=this;let t=null,l=null,n=null,o=null;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);t=[];for(let n=0;n<l.length;n++){const o=l[n];t.push({id:o,row:e.rowById[o]})}}if(e._selection.columns&&Object.keys(e._selection.columns).length>0){const t=Object.keys(e._selection.columns);l=[];for(let n=0;n<t.length;n++){const o=t[n];l.push({dataField:o,column:e.columnByDataField[o]})}}if(e._selection.cells)for(let t in e._selection.cells)if(t.startsWith("row")){let l=t.replace("row",""),o=null;for(let i in e._selection.cells[t])o=i.replace("column",""),n||(n=[]),n.push({id:l,dataField:o,column:e.columnByDataField[o],row:e.rowById[l]})}return e._selection.focusedCell&&(e._isVirtualMode(),o={index:e._selection.focusedCell.index,id:e._selection.focusedCell.id,dataField:e._selection.focusedCell.dataField}),{rows:t,columns:l,cells:n,focused:o}}focusAndSelect(e,t){const l=this;if(l.focus(),l.selection.enabled&&l.selection.allowCellSelection)l._focusCell(e,t);else{const t=l.rowById[e];if(!t)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e),l._selection.focusedCell={id:t.id,value:null,index:t.index,dataField:l.columns[0].dataField},l.endUpdate(!1)}}_focusCell(e,t){const l=this;if(l.selection.enabled&&l.selection.allowCellSelection){const n=l.rowById[e];if(!n)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e,t);const o=n.getCell(t);o&&(l._selection.focusedCell={id:o.row.id,value:o.value,dataField:t,index:o.row.index}),l.endUpdate(!1)}}_clearSelection(e){const t=this;if(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[],e&&(t._selection.focusedCell=null,t._selection.selectionRect)){const e=t._selection.selectionRect;e.parentNode.removeChild(e);const l={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(l.down="touchstart",l.move="touchmove",l.up="touchend"),document.removeEventListener(l.move,e.onMove),document.removeEventListener(l.up,e.onUp),document.removeEventListener(l.down,e.onDown),t._selection.selectionRect=null}t._recycle(),t._refreshCheckBoxColumnSelection()}_getSelectionCellValues(){const e=this;if(e._selection.selectionRect)return e._selection.selectionRect.cellValues;const t=e.viewColumns;if(e._selection.rows.length>0){let l=[];for(let n in e._selection.rows){const o=e.rowById[n];for(let e=0;e<t.length;e++){const i=t[e];i&&(l[n]||(l[n]=[]),i.autoGenerated||(l[n][i.dataField]=o.data[i.dataField]))}}return l}if(e._selection.columns.length>0){let t=[];for(let l in e._selection.columns){const n=e.columnByDataField[l];if(n)for(let l=0;l<e._recyclingRows.length;l++){const o=e._recyclingRows[l];o&&(t[o.id]||(t[o.id]=[]),t[o.id][n.dataField]=o.data[n.dataField])}}return t}if(e._selection.cells&&Object.keys(e._selection.cells).length>0){const t=e.getSelection();if(t.cells){let e=[];for(let l in t.cells){const n=t.cells[l],o=n.id;e[o]||(e[o]=[]),e[o][n.column.dataField]=n.row.data[n.column.dataField]}return e}}}_clipboardHandler(e,t){const l=this;if(l.clipboard.enabled){if((t.ctrlKey||t.metaKey)&&("c"===e||"x"===e)){const t=l._getSelectionCellValues();let n="",o=Object.keys(t).length,i=0;for(let a in t){let s="",r=Object.keys(t[a]).length,d=0;for(let e in t[a])s+=t[a][e],d++,d<r&&(s+="\t");if(n+=s,i++,i<o&&(n+="\r\n"),"x"===e&&l.editing.enabled){const e=l.getSelection();if(e.cells){l.beginUpdate();for(let t=0;t<e.cells.length;t++){const n=e.cells[t],o=l.rowById[n.id];if(o){const e=o.getCell(n.dataField),t=l._pasteDataType({cell:e,value:e.value});let i=null;"int"!==t&&"number"!==t||(i=0),"string"===t&&(i=""),"boolean"!==t&&"bool"!==t||(i=!1),"date"===t&&(i=new Date),e.column.allowNull&&(i=null);const a=e.oldValue;if(l.onCellUpdate)l.onCellUpdate([e],[a],[i],(function(t){t&&(e.value=i)}),l);else if(l.onRowUpdate){const t=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,l.onRowUpdate([e.row.index],[e.row],[t],[n],(function(t){t&&(e.value=i)}),l)}else e.value=i}}l.endUpdate(!1),l._recycle()}}}if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(n).then((function(){}),(function(){})),Smart.Utilities.Core.Browser.Firefox&&(l._clipboardText=n);else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),e.remove(),l._clipboardText=n}),25)}}if(t.shiftKey&&" "===e&&l.editing.addNewRow.visible&&(l._keyboardAdd=!0,l._addNewGridRow(),l._keyboardAddTimer&&clearTimeout(l._keyboardAddTimer),l._keyboardAddTimer=setTimeout((()=>{l._keyboardAdd=!1}),300)),(t.ctrlKey||t.metaKey)&&"v"===e&&l.editing.enabled){const e=window.Smart.Utilities.Core.Browser.Firefox;if(navigator.clipboard&&!navigator.clipboard.readText&&!e)return;const t=e=>{if(!e)return;const t=[],n=e.split("\r");for(let e=0;e<n.length;e++){const l=n[e].split("\t");let o={};for(let e=0;e<l.length;e++)o[e]=l[e].trim(),void 0!==o[e]&&"undefined"!==o[e]||(o[e]="");t[e]=o}const o=l._selection.selectionRect;if(o)l._pasteSelectedCells({row:o.row,endRow:o.endDragRow,column:o.column,endColumn:o.endColumn},t);else{let e=null,n=null;for(let t in l._selection.rows){const o=l.rowById[t];e||(e=o),n||(n=o),e.visibleIndex>o.visibleIndex&&(e=o),n.visibleIndex<o.visibleIndex&&(n=o)}if(e&&n&&l._pasteSelectedCells({row:e,endRow:n,column:l.firstColumn(),endColumn:l.lastColumn()},t),0===l._selection.rows.length){const o=l.getSelectedCells();let i=null,a=null;for(let t=0;t<o.length;t++){const s=l.rowById[o[t][0]];if(!s)continue;e||(e=s),n||(n=s);const r=l.columnByDataField[o[t][1]];i||(i=a=r),i&&i.visibleIndex>r.visibleIndex&&(i=r),a&&a.visibleIndex<r.visibleIndex&&(a=r),e.visibleIndex>s.visibleIndex&&(e=s),n.visibleIndex<s.visibleIndex&&(n=s)}l._pasteSelectedCells({row:e,endRow:n,column:i,endColumn:a},t)}}};if(!window.isSecureContext||e)return void t(l._clipboardText);navigator.clipboard.readText().then((e=>{t(e)}))}}}_setRemoveUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){t._removeUndoRedoHigherIndexes();const n=t.getRowData(e.id);t._undoRedo.push({action:"remove",data:n,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_setAddUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){let n=!1;for(let l=0;l<t._undoRedo.length;l++){const o=t._undoRedo[l];"add"===o.action&&o.index===e.index&&(n=!0)}if(n)return;t._removeUndoRedoHigherIndexes();const o=t.getRowData(e.id);t._undoRedo.push({action:"add",data:o,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_removeUndoRedoHigherIndexes(){const e=this,t=e._undoRedoIndex;t>=0?e._undoRedo.splice(t+1,e._undoRedo.length-t):-1===t&&(e._undoRedo=[])}_setCellUndoRedo(e,t,l){const n=this;if(!n.isInitialized)return;const o=Smart.Utilities.Core.createGUID().replace(/-/gi,"");n._setCellUndoRedoTimer&&clearTimeout(n._setCellUndoRedoTimer),n._undoRedoAction||(n._pasteUndoRedoValues||(n._pasteUndoRedoValues=[]),void 0===t&&(t=null),n._pasteUndoRedoValues.push({cell:e,index:e.row.index,dataField:e.column.dataField,oldValue:t,newValue:l}),n._setCellUndoRedoTimer=setTimeout((()=>{delete n._setCellUndoRedoTimer,n._removeUndoRedoHigherIndexes(),n._pasteUndoRedoValues.length>1?n._undoRedo.push({action:"updateMultiple",items:n._pasteUndoRedoValues,uid:o}):n._undoRedo.push({action:"update",index:e.row.visibleIndex,cell:e,dataField:e.column.dataField,oldValue:t,newValue:l,uid:o}),n._undoRedoIndex=n._undoRedo.length-1,n._pasteUndoRedoValues=[]}),50))}_undoRedoHandler(e){const t=this,l=e.key;if(e.ctrlKey||e.metaKey){if("z"===l)return t.undo(),void e.preventDefault();if("y"===l)return t.redo(),void e.preventDefault()}}_updateMultiple(e,t){const l=this;let n=9999999,o=0,i=999999,a=0,s=l._recyclingRows;l.beginUpdate();for(let r=0;r<e.items.length;r++){const d=e.items[r],c=s[d.index];if(c){const e=c.id,s=d.dataField,r=t?d.oldValue:d.newValue,u=l.columnByDataField[s],f=l.viewColumns.indexOf(u);i=Math.min(i,f),a=Math.max(a,f),n=Math.min(n,c.visibleIndex),o=Math.max(o,c.visibleIndex),l.setCellValue(e,s,r)}}l._focusCell(s[n].id,l.viewColumns[i].dataField),l._selectCellsRange(s[n],s[o],l.viewColumns[i].dataField,l.viewColumns[a].dataField),delete l._undoRedoAction,l.endUpdate(!1)}redo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t+1];if(l)switch(e._undoRedoIndex++,e._undoRedoAction=!0,l.action){case"add":e.addRow(l.data,!0);break;case"remove":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.newValue;e.setCellValue(n,o,i),e._focusCell(n,o)}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!1)}else delete e._undoRedoAction}undo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t];if(l)switch(e._undoRedoIndex--,e._undoRedoAction=!0,l.action){case"add":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"remove":{const t=l.data;t&&(e._recyclingRows[l.index]?e.insertRow(t,l.index):e.addRow(t,!0));break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.oldValue;void 0!==(e._cellsUpdatedValues?e._cellsUpdatedValues[n+"_"+o]:void 0)&&delete e._cellsUpdatedValues[n+"_"+o],e.setCellValue(n,o,i),e._focusCell(n,o)}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!0)}else e._currentUndoRedo=e._undoRedo[0],delete e._undoRedoAction}_keyDownHandler(e){const t=this;if("grid"!==t.view)return;if(t.onKey&&(t.onKey(e),e.defaultPrevented))return;let l=e.key;if(t.disabled||t.displayLoadingIndicator)return;if(t._undoRedoHandler(e),0===t.dataSource.length)return;if(t.editing.editRow||t.editing.editCell||t.filtering.filterRow.cell)return;t.rightToLeft&&("ArrowLeft"===l?l="ArrowRight":"ArrowRight"===l&&(l="ArrowLeft")),t._refreshCellSelectionRect();const n=t.getSelection();let o=n.focused;if(!n.focused){if(t.editing.enabled&&!0!==t.editing.isEditing&&("F2"===l||"Enter"===l)&&n.columns&&n.columns.length>0){const e=n.columns[n.columns.length-1];e.column.allowHeaderEdit&&t._beginColumnEdit(e.column)}return void(t.menu&&t.menu.classList.contains("open")&&"Escape"===l&&t.closeMenu())}if(e.shiftKey&&e.ctrlKey&&" "===l){const e=t.rowById[o.id];if(e){const t=e.getCell(o.dataField);if(t)return void t.autoWrap()}}const i=t._getParentCell(t.rowById[o.id],o.dataField);if(i&&("ArrowLeft"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowRight"===l?(o.id=i.row.id,o.dataField=i.endColumn.dataField):"ArrowUp"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowDown"===l&&(o.id=i.endRow.id,o.dataField=i.column.dataField)),t._selection.selectionRect&&e.shiftKey&&!e.ctrlKey&&!e.metaKey?(t._selection.selectionRect.endRow&&(o.id=t._selection.selectionRect.endRow.id),t._selection.selectionRect.endColumn&&(o.dataField=t._selection.selectionRect.endColumn.dataField)):t.selection.allowRowSelection&&!t.selection.allowCellSelection&&void 0!==t._rangeSelectionEndRow&&(o.id=t._rangeSelectionEndRow.id),t._clipboardHandler(l,e),((e.ctrlKey||e.metaKey)&&"x"!==l&&"c"!==l&&"v"!==l&&"Control"!==l||"Tab"===l)&&(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[]),"Escape"===l)return t.closeMenu(),t.cancelEdit(),void t._setSelection(o.id,o.dataField,e);if(t.hasMenu())return;if(e.shiftKey&&"Enter"===l&&t.rowDetail.dialog.enabled&&!t.rowDetail.dialog.visible){const l=t.rowById[o.id];if(l)return l.showDetail=!0,e.preventDefault(),void e.stopPropagation()}if(e.ctrlKey||e.metaKey){let n=!1;"f"===l&&(t.$.headerBar&&t.$.headerBar.openSearchPanel(),n=!0),"s"===l&&(t.$.headerBar&&t.$.headerBar.openSortPanel(),n=!0),"d"===l&&(t.$.headerBar&&t.$.headerBar._openDownloadMenu(),n=!0),"u"===l&&(t.$.headerBar&&t.$.headerBar.openFilterPanel(),n=!0),"w"===l&&(t.$.headerBar&&t.$.headerBar._openViewsMenu(),n=!0),n&&(e.stopPropagation(),e.preventDefault())}if(e.altKey){if("ArrowDown"===l){const l=t.columnByDataField[o.dataField];l&&t.hasColumnMenu(l)&&(l.element._showActionButton(),l.onAction(),t.menu&&t.menu.querySelector("smart-menu").$.dispatch(e))}else"ArrowUp"===l&&t.closeMenu();if("s"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.sorted?"asc"===e.sortOrder?t.sortBy(e.dataField,"desc"):t.sortBy(e.dataField,null):t.sortBy(e.dataField,"asc"))}if("g"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.group=!e.group)}return}const a=function(l,n){const o=(l,n)=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(!0),"many"===t.selection.mode){if(" "===e.key)t._setSelection(l,n,e);else{const e=t.rowById[l].getCell(n);t._selection.focusedCell={id:e.row.id,value:e.value,dataField:n,index:e.row.index}}return t.ensureVisible(l,n),void t._recycle()}t.beginUpdate(),t._setSelection(l,n,e),t.ensureVisible(l,n),t.endUpdate(!1,!1),"ArrowDown"===e.key||"ArrowUp"===e.key?t._recycle(!1,!0):t._recycle(),e.shiftKey?t.__selectionStarted&&!t.__selectionStartedFired?(t.$.fireEvent("change",{started:!0,finished:!1}),t.__selectionStartedFired=!0):t.$.fireEvent("change",{started:!1,finished:!1}):(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())};if(t._isVirtualMode()){t._keyboardNavigationTimer&&clearTimeout(t._keyboardNavigationTimer);const e=e=>{for(let l=0;l<t.rows.length;l++){const n=t.rows[l];if(n.index===e)return n.id}return null},i=l,a=JSON.parse(JSON.stringify(t._selection.focusedCell));t._selection.focusedCell.index=i,t._selection.focusedCell.dataField=n;const s=t.rows[0],r=s.height;if(-1===i)return;const d=t._scrollView.hScrollBar,c="virtual"!==t.scrolling?s.top:i*r;let u=0;if(t.paging.enabled||(c+d.offsetHeight+t.__frozenNearHeight>t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight?(t._scrollView.scrollTop=c-t.$.scrollView.offsetHeight-t.__frozenFarHeight+d.offsetHeight,u=50):c<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=c,u=50)),t._onDataUpdated||(t._onDataUpdated=()=>{t._recycle();const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t.paging.enabled&&(t._selection.focusedCell=a),t._onDataUpdated=null}),t.paging.enabled){const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t._selection.focusedCell=a}else t._keyboardNavigationTimer=setTimeout((()=>{const l=e(t._selection.focusedCell.index);t.rowById[l]&&o(l,t._selection.focusedCell.dataField)}),u)}else requestAnimationFrame((()=>{o(l,n)})),e.stopPropagation(),e.preventDefault()};switch(l){case"Tab":{if("none"===t.selection.tabKeyBehavior)return;const l=e.shiftKey?t.prevColumn(o.dataField):t.nextColumn(o.dataField);if(l&&t.selection.allowCellSelection){const n=t.rowById[o.id].getCell(l.dataField);t._selection.focusedCell={id:n.row.id,value:n.value,dataField:l.dataField,index:n.row.index},t._setSelection(o.id,l.dataField,e),t.ensureVisible(o.id,l.dataField),t.focus(),e.stopPropagation(),e.preventDefault()}else{let l=e.shiftKey?t.prevRow(o.id):t.nextRow(o.id),n=e.shiftKey?t.lastColumn().dataField:t.firstColumn().dataField;if(t.editing.addNewRow.autoCreate&&!e.shiftKey&&o.id===t.lastRow().id&&(t.addUnboundRow(1),l=t.lastRow()),!l)return;e.shiftKey&&(t._selection.focusedCell=null),a(t._isVirtualMode()?l.index:l.id,n)}break}case" ":case"F2":{const n=t.rowById[o.id];if(!n||t.editing.editCell)return;if(e.ctrlKey||e.metaKey)return;if(" "===l&&t.dataSource.boundHierarchy&&(n.checked=!n.checked),t.editing.enabled&&!e.shiftKey){const e=t.getSelectedCells();let i=!1;if(e.length>0){let l=[];for(let n=0;n<e.length;n++){const o=e[n],i=o[1],a=t.columnByDataField[i];!a||"bool"!==a.dataType&&"boolean"!==a.dataType||l.push(o)}if(l.length>0){i=!0,t.beginUpdate();for(let e=0;e<l.length;e++){const n=l[e],o=n[1],i=n[0],a=n[2];t.setCellValue(i,o,!a)}t.endUpdate(!1)}}i||(t._beginEdit(n,o.dataField),setTimeout((function(){if(t.editing.editCell&&t.editing.editCell.column.dataType.indexOf("bool")>=0){const e=t.editing.editCell.editor.instance,n=e.getValue();" "===l&&e.setValue(!n)}}),50))}else t.selection.enabled&&"many"===t.selection.mode&&(t._isVirtualMode()?a(o.index,o.dataField):a(o.id,o.dataField));break}case"Delete":case"Backspace":{const e=t.rowById[o.id];if(!e||t.editing.editCell)return;if(t.editing.enabled){const i=e.getCell(o.dataField),a=i.value;if(n.cells){t.beginUpdate();for(let e=0;e<n.cells.length;e++){const l=n.cells[e],o=t.rowById[l.id];if(o){const e=o.getCell(l.dataField);if(!e.column.allowEdit)continue;const n=t._pasteDataType({cell:e,value:e.value});let i=null;"int"!==n&&"number"!==n||(i=0),"string"===n&&(i=""),"boolean"!==n&&"bool"!==n||(i=!1),"date"===n&&(i=new Date),e.column.allowNull&&(i=null);const a=e.value;if(t.dataSource&&t.dataSource.virtualDataSource){const l={};l[e.column.dataField]=i,t.updateRow(e.row.id,l)}else if(t._setCellUndoRedo(e,a,i),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]);const n=i;t._pasteTempValues.push({id:e.row.id,cell:e,dataField:l.column.dataField,oldValue:a,newValue:n}),t._pasteTimer&&clearTimeout(t._pasteTimer),t._pasteTimer=setTimeout((()=>{const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1)}}),t)}else t.onCellUpdate([e],[a],[n],(function(t){t&&(l(e,n),e.value=n)}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else e.value=i}}t.endUpdate(!1),t._recycle(),t._refreshDataFilters()}"Backspace"===l&&(t._beginEdit(e,o.dataField),i.canNotify=!1,i.value=a,i.canNotify=!0)}break}default:if(t.editing.enabled&&!t.editing.editCell&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!t.editing.editRow){const e=t.rowById[o.id];if(!e)return;if(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)>=0)return;t._beginEdit(e,o.dataField),setTimeout((function(){if(t.editing.editCell)t.editing.editCell.editor.instance.setValue(l);else if(t.editing.editRow){const e=t.editing.editRow.getCell(o.dataField);if(!e)return;e.editor.instance.setValue(l)}}),50)}break;case"Home":{const l=t.firstRow();if(t.paging.enabled&&e.shiftKey)return t.firstPage(),e.stopPropagation(),void e.preventDefault();if(!l)return;a(l.id,o.dataField);break}case"End":{if(t.paging.enabled&&e.shiftKey)return t.lastPage(),e.stopPropagation(),void e.preventDefault();const l=t.lastRow();if(!l)return;a(l.id,o.dataField);break}case"PageUp":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.prevPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.max(o.index-e,0),o.dataField)}else{for(let e=i;e>=0;e--){const i=l[e];if(n.top-i.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.firstRow().id,o.dataField)}break}case"PageDown":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.nextPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.min(o.index+e,t.dataSource.virtualDataSourceLength-1),o.dataField)}else{for(let e=i;e<l.length;e++){const i=l[e];if(i.top-n.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.lastRow().id,o.dataField)}break}case"ArrowDown":case"Enter":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():o.index+1,o.dataField);else{let n=e.ctrlKey||e.metaKey?t.lastRow():t.nextRow(o.id);if(!t.editing.addNewRow.autoCreate||"Enter"!==l||o.id!==t.lastRow().id||e.ctrlKey||e.metaKey||(t.addUnboundRow(1),n=t.lastRow()),!n)return;let i=!0;"Enter"===l&&(e.ctrlKey||e.metaKey)&&(i=!1),i&&a(n.id,o.dataField)}break;case"ArrowUp":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():Math.max(0,o.index-1),o.dataField);else{const l=e.ctrlKey||e.metaKey?t.firstRow():t.prevRow(o.id);if(!l)return;a(l.id,o.dataField)}break;case"ArrowRight":{const l=t.rowById[o.id],n=t.columnByDataField[o.dataField]._treeColumn;if((!t.selection.allowCellSelection||n)&&!1===l.leaf){if(!l.expanded)return l.expand(),e.stopPropagation(),void e.preventDefault();{const e=t.nextRow(o.id);if(e)return void a(e.id,o.dataField)}}const i=e.ctrlKey||e.metaKey?t.lastColumn():t.nextColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}case"ArrowLeft":{const l=t.rowById[o.id],n=t.columnByDataField[o.dataField]._treeColumn;if(!t.selection.allowCellSelection||n){if(!1===l.leaf)return void(l.expanded?(l.collapse(),e.stopPropagation(),e.preventDefault()):l.parent&&a(l.parent.id,o.dataField));if(!0===l.leaf&&l.parent)return void a(l.parent.id,o.dataField)}const i=e.ctrlKey||e.metaKey?t.firstColumn():t.prevColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}}["Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)<0||(e.stopPropagation(),e.preventDefault())}_keyUpHandler(e){const t=this;"Escape"===e.key&&t._dragDrop&&t._endDrag(e),t._focused&&"Shift"===e.key&&(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())}firstRow(){const e=this._recyclingRows;if(this._isVirtualMode())return{id:0};if(e&&e.length>0){if(!e[0].autoGenerated&&e[0].allowSelect)return e[0];for(let t=0;t<e.length;t++)if(!e[t].autoGenerated&&e[t].allowSelect)return e[t]}return null}lastRow(){const e=this,t=e._recyclingRows;if(e._isVirtualMode())return{id:e.dataSource.virtualDataSourceLength-1};if(t&&t.length>0){const e=t[t.length-1];if(!e.autoGenerated&&e.allowSelect)return e;for(let e=t.length-1;e>=0;e--)if(!t[e].autoGenerated&&t[e].allowSelect)return t[e]}return null}nextRow(e){const t=this._recyclingRows,l=this.rowById[e],n=t.indexOf(l);let o=1;if(l&&void 0!==l._rowSpan&&(o=l._rowSpan),n>=0&&t[n+o]&&!t[n+o].autoGenerated){const e=t[n+o];if(e.allowSelect&&!e.disabled)return e;for(let e=n+o;e<t.length;e++){const l=t[e];if(l.allowSelect&&!l.disabled)return l}}return null}_isVirtualMode(){const e=this;return e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling}prevRow(e){const t=this,l=t._recyclingRows,n=t.rowById[e],o=l.indexOf(n);if(t._isVirtualMode())return 0===e?null:{id:n.index-1};if(o>=0&&l[o-1]&&!l[o-1].autoGenerated){const e=l[o-1];if(e.allowSelect&&!e.disabled)return e;for(let e=o-1;e>=0;e--){const t=l[e];if(t.allowSelect&&!t.disabled)return t}}return null}firstColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=0;t<e.length;t++){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}lastColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=e.length-1;t>=0;t--){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}nextColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n<t.length;){const e=t[n+1];if(e.autoGenerated)return null;if(e.visible)return e;n++}return null}prevColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n>0;){const e=t[n-1];if(e.autoGenerated)return null;if(e.visible)return e;n--}return null}isVisible(e,t){const l=this,n=l._scrollView.vScrollBar,o=l._scrollView.hScrollBar,i=l.rowById[e],a=l.columnByDataField[t];return{row:function(e){if(!e)return!1;const t=e.visibleIndex;if(-1===t)return!1;const n=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&l.dataSource.length>l.virtualModeCachedRowsCount&&"infinite"!==l.scrolling;let i=e.top;return n&&(i=t*l.rows[0].height),!(i+e.height+o.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight||i<=l._scrollView.scrollTop)}(i),column:function(e){return!!t&&!(-1===e.visibleIndex||e.left+e.computedWidth+n.offsetWidth>=l._scrollView.scrollLeft+l._clientSize.width||e.left<=l._scrollView.scrollLeft)}(a)}}_ensureRowVisible(e){const t=this;if(!t._scrollView)return;const l=t._scrollView.hScrollBar;if(!e)return;const n=e.visibleIndex;if(-1===n)return;const o="virtual"!==t.scrolling?e.top:n*t.rows[0].height,i=t.summaryRow.visible?t.layout.rowMinHeight:0;if(o+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight-i&&(t._scrollView.scrollTop=o+e.height-t.$.scrollView.offsetHeight+t.__frozenNearHeight+t.__frozenFarHeight+l.offsetHeight+i),o<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=o),t.paging.enabled){const o=t.paging.pageSize,i=Math.floor(n/o);if(t.paging.pageIndex!==i)return t.goToPage(i),t._scrollView.scrollTop=0,void setTimeout((()=>{e.top+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight&&(t._scrollView.scrollTop=e.top+e.height),e.top<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=e.top)}),50)}0===n?t._scrollView.scrollTop=0:n===t.dataSource.length-1&&(t._scrollView.scrollTop=t._scrollView.scrollHeight)}_ensureColumnVisible(e){const t=this,l=t._scrollView.vScrollBar;if(!e)return;const n=e.visibleIndex;-1!==n&&(e.left+e.computedWidth+l.offsetWidth>=t._scrollView.scrollLeft+t._clientSize.width&&(t._scrollView.scrollLeft=t._scrollView.scrollLeft+e.computedWidth),e.left<=t._scrollView.scrollLeft&&(t._scrollView.scrollLeft=e.left),0===n?t._scrollView.scrollLeft=0:n===t.columns.length-1&&(t._scrollView.scrollLeft=t._scrollView.scrollWidth))}ensureVisible(e,t){const l=this,n=l.rowById[e],o=l.columnByDataField[t];if("virtual"===l.scrolling){const e=l._scrollView.hScrollBar,t=n.visibleIndex*l.rows[0].height,i=l.summaryRow.visible?l.layout.rowMinHeight:0;return t+n.height+e.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight-i&&l.setVerticalScrollValue(t),void l._ensureColumnVisible(o)}l._ensureRowVisible(n),l._ensureColumnVisible(o)}clearSelection(){const e=this;delete e._rangeSelectionStartRow,delete e._rangeSelectionEndRow,e._clearSelection(!0),e.$.fireEvent("change",{started:!1,finished:!0}),e._refreshSummary()}});
|
|
1520
1520
|
|
|
1521
1521
|
/***/ }),
|
|
1522
1522
|
|
|
@@ -1530,7 +1530,7 @@ Smart.Utilities.Assign("Grid.Sort",class{clearSort(){const t=this;if(!t._isSorti
|
|
|
1530
1530
|
/***/ 238:
|
|
1531
1531
|
/***/ (() => {
|
|
1532
1532
|
|
|
1533
|
-
Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden")})),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;(t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled")})(e.dataSource&&0===e.dataSource.length),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget),t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight+"px";const a=()=>{if(e){const a=t.grid.offset(e);a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px"}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",a())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));if(super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t.grid.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),350)}}openSortPanel(e){const t=this,a=t.dataSource;t._refreshColumns("sort");const o=t.columns.map((e=>{const o=Object.assign({},e),n=t._appliedSorting.dataFields.indexOf(o.dataField),s=a.dataFields.find((e=>e.name===o.dataField));return s&&(o.dataType=s.dataType,o.sortIndex=n,-1!==n&&(o.sortDirection=t._appliedSorting.orderBy[n])),o})).filter((e=>e.allowSort));if(e&&t._appliedSorting&&-1===t._appliedSorting.dataFields.indexOf(e.dataField)){const a=o.find((t=>t.dataField===e.dataField));a.sortDirection="ascending",a.sortIndex=t._appliedSorting.dataFields.length}super.openSortPanel(o),t._closeDownloadMenu(),t._closeViewsMenu();const n=t.grid;n.closeMenu();const s=t.$.headerDropDown.querySelector("smart-sort-panel");if(!s)return;s.grid=n,s.$.maintainSortContainer.classList.remove("smart-hidden"),n.sorting.maintainSort?s.$.maintainSortContainer.firstElementChild.setAttribute("active",""):s.$.maintainSortContainer.firstElementChild.removeAttribute("active"),s._changeApplyButtonText();const i=s.$.inputNotSorted,r=()=>{const e=s.querySelectorAll(".smart-grid-panel-item");"many"===t.grid.sorting.mode||e.length<1?i.classList.remove("smart-visibility-hidden"):e.length>=1&&i.classList.add("smart-visibility-hidden")};s.onDataSourceChange=()=>{r()},r()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,n=0,s=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(o--,i.push(r.dataField)),r.visible||(n++,s.push(r.dataField)),t.push(r)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===n||o===n&&i.toString()!==s.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,n=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let s;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)s=o.querySelector("smart-column-panel"),s.locale=e.locale,s.messages=e._innerElementMessages.columnPanel,s.set("dataSource",n),s.propertyChangedHandler("dataSource",void 0,n),s.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=n,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],n=o[0],s=o[1];a.grid.columnByDataField[n].filter=s}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.sorting.maintainSort=t.maintainSort,e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")&&(t="customize"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,n=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&n.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();n.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)&&t.addSort(o.sortByInfo),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target;const o=t.grid.$.header;if(t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]),t._closeDownloadMenu(),t._closeViewsMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||a!==o&&o.contains(a))){const n=a.closest("smart-scroll-viewer"),s=a.closest(".smart-drop-down");if((!n||!o.contains(n.ownerElement))&&(!s||s.ownerElement&&!o.contains(s.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(n&&n.ownerElement){const e=n.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,n=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((e=>!1!==e._visible)),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible,sortIndex:void 0!==e.sortIndex&&null!==e.sortIndex?e.sortIndex:-1,sortDirection:void 0!==e.sortOrder?e.sortOrder:null}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;n.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;n.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.grid._openRowSettingsDialog=t._openRowSettingsDialog,t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),e.header.onInit&&e.header.onInit(t)}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-views-menu"),a.rightToLeft=t.rightToLeft;const n=(e,a)=>{const o=document.createElement("smart-menu-item");let n="#D50000",s="smart-icon-table-alt";switch(a){case"grid":n="#3f51b5",s="smart-icon-table-alt","grid"===t.view&&o.setAttribute("focus","");break;case"pdf":n="#f4511e";break;case"kanban":n="#C40093",s="smart-icon-kanban","kanban"===t.view&&o.setAttribute("focus","");break;case"json":n="#8e24aa"}return o.label='<span style="color: '+n+'" class="smart-grid-icon '+s+'"></span>'+e,o.value=a,o};o.appendChild(n(t.localize("viewGrid"),"grid")),o.appendChild(n(t.localize("viewKanban"),"kanban")),a.appendChild(o),e.viewsMenu.appendChild(a),a.onItemClick=t=>{e._setView(t.detail.value)}}_setView(e){const t=this,a=t.grid;if(a.view!==e){if("kanban"===e){const e=a.context;a.context=a,a.view="kanban",a.context=e,a._kanbanInitialized&&a.columnByDataField.taskStatus?(a._showKanbanView(),t._refresh()):(delete a._kanbanInitialized,a._initKanbanView())}else"grid"===e&&(a.view="grid",a._hideKanbanView(),t._refresh());a.$.fireEvent("viewChanged",{view:e}),t._refresh()}}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const n=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const n='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+n+e,a.value=t,a};o.appendChild(n(t.localize("download")+" CSV","csv")),o.appendChild(n(t.localize("download")+" XLSX","xlsx")),o.appendChild(n(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")&&e._closeViewsMenu()}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled&&"grid"===t.view?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},t._sortedColumns){const a=[],o=[],n=[];for(let e=0;e<t._sortedColumns.length;e++){const s=t._sortedColumns[e];a.push(s.dataField),o.push(s.sortOrder),n.push(s.dataType)}e._appliedSorting={dataFields:a,dataTypes:n,orderBy:o},e._refreshSortButton()}if("grid"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumns();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const n=t.filters[o];a.filters.push([e,n.condition,n.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}else e.$.sortButton.classList.add("smart-hidden"),e.$.filterButton.classList.add("smart-hidden");e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e.refreshTools()}_refreshViewsButton(){const e=this;let t=e.grid.localize("viewGrid");switch(e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":e.$.viewsButton.classList.remove("kanban"),t=e.grid.localize("viewGrid")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>"}_refreshDownloadButton(){this.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation">'+this.grid.localize("download")+"</div>"}_openRowSettingsDialog(e){let t=this;t.getSelectedRows||(t=t.grid);const a=t.editing.dialog.enabled,o=t.editing.mode,n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=e,t.beginEdit(e),t._endToolbarEdit?(t.removeEventListener("endEdit",t._endToolbarEdit,null),t.removeEventListener("cancelEdit",t._endToolbarEdit,null)):t._endToolbarEdit=()=>{t.context=t,t.editing.dialog.enabled=a,t.editing.mode=o,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endToolbarEdit),t.addEventListener("cancelEdit",t._endToolbarEdit)}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.querySelector("smart-grid-toolbar").$.deleteButton;0!==t?(a.classList.remove("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.querySelector("smart-grid-toolbar")._refreshDeleteButton()}openGroupPanel(e){const t=this;let a;const o=t.grid;t.$.headerDropDown.classList.add("group-panel"),t.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","format-panel"),t.$.group.classList.remove("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.sort.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t.$.format.classList.add("smart-hidden"),t._closeDownloadMenu(),t._closeViewsMenu(),t._refreshColumns("group"),o.closeMenu();const n=t.columns.map((e=>{const a=Object.assign({},e);if(t._appliedGrouping&&t._appliedGrouping.dataFields){const e=t._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=e}return a})).filter((e=>e.allowGroup));e&&t._appliedGrouping&&-1===t._appliedGrouping.dataFields.indexOf(e.dataField)&&(n.find((t=>t.dataField===e.dataField)).groupIndex=t._appliedGrouping.dataFields.length),t._groupPartCreated?(a=t.$.group.firstElementChild,a.rightToLeft=t.rightToLeft,a.dataSource=n,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel):(a=document.createElement("smart-group-panel"),a.rightToLeft=t.rightToLeft,a.animation=t.animation,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel,a.theme=t.theme,a.dataSource=n,t.$.group.appendChild(a),t._groupPartCreated=!0,a.onExpandAll=()=>{if(t._appliedGrouping.expandAll)return t._appliedGrouping.expandAll=!1,void a.querySelector(".smart-group-panel-expand-button").removeAttribute("active");t._appliedGrouping.expandAll=!0,t._appliedGrouping.collapseAll=!1,a.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},a.onCollapseAll=()=>{if(t._appliedGrouping.collapseAll)return t._appliedGrouping.collapseAll=!1,void a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active");t._appliedGrouping.expandAll=!1,t._appliedGrouping.collapseAll=!0,a.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),a.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},a.addEventListener("apply",(e=>{const a=e.detail.sortByInfo,n=t._appliedGrouping.dataFields;t._appliedGrouping.dataFields=a.dataFields;const s=o.onRowInserted;if(o.onRowInserted=null,o.beginUpdate(),o.grouping.autoHideGroupColumn&&n)for(let e=0;e<n.length;e++){const t=o.columnByDataField[n[e]];t&&(t.visible=!0)}o.clearGroups();for(let e=0;e<a.dataFields.length;e++){const t=a.dataFields[e];o.addGroup(t)}t._appliedGrouping.expandAll&&o.expandAllRows(),t._appliedGrouping.collapseAll&&o.collapseAllRows(),o.endUpdate();const i=[];for(let e=0;e<o.dataSource.groupBy.length;e++)i.push(o.dataSource.groupBy[e]);o.$.fireEvent("group",{groups:i}),o.paging.enabled&&o._refreshPagesCount(),o.onRowInserted=s}))),t._refreshGroupButton(),t._openHeaderDropDown(t.$.groupButton)}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search("",!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),t.closeMenu();const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const n=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:n,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,void a.grid._recycle(!1);const o=a._searchInfo.source,n=[],s=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),n.push([t,a])})),o._filter(n,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(s.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=s,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,s.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:s.length}),a._searchInfo.highlighted=s[0],a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if("kanban"===t.view&&t._kanban)return e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++)}const o=-1===t.header.buttons.indexOf("views");a>0&&o?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"))}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let n=0,s=[],i=[],r=[];const l=o.onColumnChange;o.onColumnChange=null;for(let t in e){const a=e[t],l=o.columnByDataField[a.dataField];l&&(l.visible!==a.visible&&(s.push(a),i.push(l.visible),r.push(a.visible)),l.visible=a.visible,a.visible||n++)}o.onColumnChange=l,o.onColumnChange&&o.onColumnChange(s,"visible",i,r),n>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],n=a.oldIndex,s=a.newIndex,i=o.columns[s+1],r=o.columns[s-1],l=o.columns[n];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),o.reorderColumns(n,s,!0)}o.endUpdate()}});
|
|
1533
|
+
Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden")})),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;(t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled")})(e.dataSource&&0===e.dataSource.length),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget),t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight+"px";const a=()=>{if(e){const a=t.grid.offset(e);a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px"}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",a())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));if(super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t.grid.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),350)}}openSortPanel(e){const t=this,a=t.dataSource;t._refreshColumns("sort");const o=t.columns.map((e=>{const o=Object.assign({},e),n=t._appliedSorting.dataFields.indexOf(o.dataField),s=a.dataFields.find((e=>e.name===o.dataField));return s&&(o.dataType=s.dataType,o.sortIndex=n,-1!==n&&(o.sortDirection=t._appliedSorting.orderBy[n])),o})).filter((e=>e.allowSort));if(e&&t._appliedSorting&&-1===t._appliedSorting.dataFields.indexOf(e.dataField)){const a=o.find((t=>t.dataField===e.dataField));a.sortDirection="ascending",a.sortIndex=t._appliedSorting.dataFields.length}super.openSortPanel(o),t._closeDownloadMenu(),t._closeViewsMenu();const n=t.grid;n.closeMenu();const s=t.$.headerDropDown.querySelector("smart-sort-panel");if(!s)return;s.grid=n,s.$.maintainSortContainer.classList.remove("smart-hidden"),n.sorting.maintainSort?s.$.maintainSortContainer.firstElementChild.setAttribute("active",""):s.$.maintainSortContainer.firstElementChild.removeAttribute("active"),s._changeApplyButtonText();const i=s.$.inputNotSorted,r=()=>{const e=s.querySelectorAll(".smart-grid-panel-item");"many"===t.grid.sorting.mode||e.length<1?i.classList.remove("smart-visibility-hidden"):e.length>=1&&i.classList.add("smart-visibility-hidden")};s.onDataSourceChange=()=>{r()},r()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,n=0,s=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(o--,i.push(r.dataField)),r.visible||(n++,s.push(r.dataField)),t.push(r)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===n||o===n&&i.toString()!==s.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,n=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let s;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)s=o.querySelector("smart-column-panel"),s.locale=e.locale,s.messages=e._innerElementMessages.columnPanel,s.set("dataSource",n),s.propertyChangedHandler("dataSource",void 0,n),s.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=n,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],n=o[0],s=o[1];a.grid.columnByDataField[n].filter=s}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.sorting.maintainSort=t.maintainSort,e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")&&(t="customize"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,n=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&n.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();n.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)&&t.addSort(o.sortByInfo),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target;const o=t.grid.$.header;if(t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]),t._closeDownloadMenu(),t._closeViewsMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||a!==o&&o.contains(a))){const n=a.closest("smart-scroll-viewer"),s=a.closest(".smart-drop-down");if((!n||!o.contains(n.ownerElement))&&(!s||s.ownerElement&&!o.contains(s.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(n&&n.ownerElement){const e=n.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,n=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((t=>!1!==t._visible&&("filter"!==e&&"sort"!==e||!1!==t.visible))),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible,sortIndex:void 0!==e.sortIndex&&null!==e.sortIndex?e.sortIndex:-1,sortDirection:void 0!==e.sortOrder?e.sortOrder:null}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;n.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;n.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.grid._openRowSettingsDialog=t._openRowSettingsDialog,t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),e.header.onInit&&e.header.onInit(t)}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-views-menu"),a.rightToLeft=t.rightToLeft;const n=(e,a)=>{const o=document.createElement("smart-menu-item");let n="#D50000",s="smart-icon-table-alt";switch(a){case"grid":n="#3f51b5",s="smart-icon-table-alt","grid"===t.view&&o.setAttribute("focus","");break;case"pdf":n="#f4511e";break;case"kanban":n="#C40093",s="smart-icon-kanban","kanban"===t.view&&o.setAttribute("focus","");break;case"json":n="#8e24aa"}return o.label='<span style="color: '+n+'" class="smart-grid-icon '+s+'"></span>'+e,o.value=a,o};o.appendChild(n(t.localize("viewGrid"),"grid")),o.appendChild(n(t.localize("viewKanban"),"kanban")),a.appendChild(o),e.viewsMenu.appendChild(a),a.onItemClick=t=>{e._setView(t.detail.value)}}_setView(e){const t=this,a=t.grid;if(a.view!==e){if("kanban"===e){const e=a.context;a.context=a,a.view="kanban",a.context=e,a._kanbanInitialized&&a.columnByDataField.taskStatus?(a._showKanbanView(),t._refresh()):(delete a._kanbanInitialized,a._initKanbanView())}else"grid"===e&&(a.view="grid",a._hideKanbanView(),t._refresh());a.$.fireEvent("viewChanged",{view:e}),t._refresh()}}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const n=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const n='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+n+e,a.value=t,a};o.appendChild(n(t.localize("download")+" CSV","csv")),o.appendChild(n(t.localize("download")+" XLSX","xlsx")),o.appendChild(n(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")&&e._closeViewsMenu()}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled&&"grid"===t.view?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},t._sortedColumns){const a=[],o=[],n=[];for(let e=0;e<t._sortedColumns.length;e++){const s=t._sortedColumns[e];a.push(s.dataField),o.push(s.sortOrder),n.push(s.dataType)}e._appliedSorting={dataFields:a,dataTypes:n,orderBy:o},e._refreshSortButton()}if("grid"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumns();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const n=t.filters[o];a.filters.push([e,n.condition,n.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}else e.$.sortButton.classList.add("smart-hidden"),e.$.filterButton.classList.add("smart-hidden");e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e.refreshTools()}_refreshViewsButton(){const e=this;let t=e.grid.localize("viewGrid");switch(e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":e.$.viewsButton.classList.remove("kanban"),t=e.grid.localize("viewGrid")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>"}_refreshDownloadButton(){this.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation">'+this.grid.localize("download")+"</div>"}_openRowSettingsDialog(e){let t=this;t.getSelectedRows||(t=t.grid);const a=t.editing.dialog.enabled,o=t.editing.mode,n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=e,t.beginEdit(e),t._endToolbarEdit?(t.removeEventListener("endEdit",t._endToolbarEdit,null),t.removeEventListener("cancelEdit",t._endToolbarEdit,null)):t._endToolbarEdit=()=>{t.context=t,t.editing.dialog.enabled=a,t.editing.mode=o,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endToolbarEdit),t.addEventListener("cancelEdit",t._endToolbarEdit)}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.querySelector("smart-grid-toolbar").$.deleteButton;0!==t?(a.classList.remove("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.querySelector("smart-grid-toolbar")._refreshDeleteButton()}openGroupPanel(e){const t=this;let a;const o=t.grid;t.$.headerDropDown.classList.add("group-panel"),t.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","format-panel"),t.$.group.classList.remove("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.sort.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t.$.format.classList.add("smart-hidden"),t._closeDownloadMenu(),t._closeViewsMenu(),t._refreshColumns("group"),o.closeMenu();const n=t.columns.map((e=>{const a=Object.assign({},e);if(t._appliedGrouping&&t._appliedGrouping.dataFields){const e=t._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=e}return a})).filter((e=>e.allowGroup));e&&t._appliedGrouping&&-1===t._appliedGrouping.dataFields.indexOf(e.dataField)&&(n.find((t=>t.dataField===e.dataField)).groupIndex=t._appliedGrouping.dataFields.length),t._groupPartCreated?(a=t.$.group.firstElementChild,a.rightToLeft=t.rightToLeft,a.dataSource=n,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel):(a=document.createElement("smart-group-panel"),a.rightToLeft=t.rightToLeft,a.animation=t.animation,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel,a.theme=t.theme,a.dataSource=n,t.$.group.appendChild(a),t._groupPartCreated=!0,a.onExpandAll=()=>{if(t._appliedGrouping.expandAll)return t._appliedGrouping.expandAll=!1,void a.querySelector(".smart-group-panel-expand-button").removeAttribute("active");t._appliedGrouping.expandAll=!0,t._appliedGrouping.collapseAll=!1,a.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},a.onCollapseAll=()=>{if(t._appliedGrouping.collapseAll)return t._appliedGrouping.collapseAll=!1,void a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active");t._appliedGrouping.expandAll=!1,t._appliedGrouping.collapseAll=!0,a.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),a.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},a.addEventListener("apply",(e=>{const a=e.detail.sortByInfo,n=t._appliedGrouping.dataFields;t._appliedGrouping.dataFields=a.dataFields;const s=o.onRowInserted;if(o.onRowInserted=null,o.beginUpdate(),o.grouping.autoHideGroupColumn&&n)for(let e=0;e<n.length;e++){const t=o.columnByDataField[n[e]];t&&(t.visible=!0)}o.clearGroups();for(let e=0;e<a.dataFields.length;e++){const t=a.dataFields[e];o.addGroup(t)}t._appliedGrouping.expandAll&&o.expandAllRows(),t._appliedGrouping.collapseAll&&o.collapseAllRows(),o.endUpdate();const i=[];for(let e=0;e<o.dataSource.groupBy.length;e++)i.push(o.dataSource.groupBy[e]);o.$.fireEvent("group",{groups:i}),o.paging.enabled&&o._refreshPagesCount(),o.onRowInserted=s}))),t._refreshGroupButton(),t._openHeaderDropDown(t.$.groupButton)}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search("",!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),t.closeMenu();const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const n=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:n,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,void a.grid._recycle(!1);const o=a._searchInfo.source,n=[],s=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),n.push([t,a])})),o._filter(n,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(s.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=s,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,s.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:s.length}),a._searchInfo.highlighted=s[0],a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if("kanban"===t.view&&t._kanban)return e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++)}const o=-1===t.header.buttons.indexOf("views");a>0&&o?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"))}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let n=0,s=[],i=[],r=[];const l=o.onColumnChange;o.onColumnChange=null;for(let t in e){const a=e[t],l=o.columnByDataField[a.dataField];l&&(l.visible!==a.visible&&(s.push(a),i.push(l.visible),r.push(a.visible)),l.visible=a.visible,a.visible||n++)}o.onColumnChange=l,o.onColumnChange&&o.onColumnChange(s,"visible",i,r),n>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],n=a.oldIndex,s=a.newIndex,i=o.columns[s+1],r=o.columns[s-1],l=o.columns[n];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),o.reorderColumns(n,s,!0)}o.endUpdate()}});
|
|
1534
1534
|
|
|
1535
1535
|
/***/ }),
|
|
1536
1536
|
|
|
@@ -1544,7 +1544,7 @@ Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div i
|
|
|
1544
1544
|
/***/ 2292:
|
|
1545
1545
|
/***/ (() => {
|
|
1546
1546
|
|
|
1547
|
-
Smart.Utilities.Assign("Grid.View",class{createBasicKanban(){this._initKanbanView("basic")}createBlankKanban(){this._initKanbanView("blank")}_getStatusColumn(e){const t=this;return new Smart.Grid.Column({label:!e||e&&"blank"===e?t.localize("dialogNewColumn"):t.localize("status"),description:t.localize("dialogAddColumnStatusDescription"),dataField:"taskStatus",showDescriptionButton:!0,dataType:"string",defaultValue:"",editor:{template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""},{color:"#33B679",label:t.localize("toDo"),value:"toDo"},{color:"#039BE5",label:t.localize("inProgress"),value:"inProgress"},{color:"#8E24AA",label:t.localize("done"),value:"done"}]},template:"tags",cellsAlign:"left",align:"left",grid:t,visible:!0,_visible:!0,_view:!0})}_initKanbanView(e){const t=this;if(t._kanbanInitialized)return;t._kanbanInitialized=!0;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a._dataField&&!t.columnByDataField[a._dataField]&&(t.columnByDataField[a._dataField]=a)}const a=t._getStatusColumn(e),l=t.columnByDataField.taskStatus;return l&&l.statusColumn?(t.beginUpdate(),t._createKanban(t.columnByDataField.taskStatus),t._refreshHeaderBar(),t.endUpdate(!1),void t._showKanbanView(!1)):(t._onColumnUpdated=(e,a)=>{e._view&&(delete e._view,delete e._state,delete t._onColumnUpdated,e.allowSort=e.allowEdit=e.allowFilter=!0,"blank"===a.kanban?(delete t.columnByDataField.taskStatus,e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"",singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""}]}):t.columnByDataField.taskStatus&&(t.columnByDataField.taskStatus.editor=e.editor,e=t.columnByDataField.taskStatus),e.statusColumn=!0,t.beginUpdate(),t._createKanban(e),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())},e&&"blank"===e?(delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label="New Column",t.beginUpdate(),t._createKanban(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate()):e&&"basic"===e?(delete a._view,t.beginUpdate(),t._createKanban(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate()):void t._openAddColumnDialog(a,!0,(e=>{!1===e&&(delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"",singleSelect:!0,dataSource:[{color:"#DD5347",label:t.localize("uncategorized"),value:""}]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label=t.localize("dialogNewColumn"),t.beginUpdate(),t._createKanban(a),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())})))}_showKanbanView(e){const t=this;t.beginUpdate(),t.$.viewContent.classList.remove("smart-hidden"),t.$.content.classList.add("smart-hidden"),t._showAddNewRowButton("float"),t.$.viewContent.appendChild(t._kanban),t.classList.add("smart-kanban-view"),!1!==e&&(t._updateKanbanView(),t._kanban.refresh()),t._onFilter=t._onSort=()=>{"kanban"===t.view&&(t._updateKanbanView(),t._kanban.refresh())}}_hideKanbanView(){const e=this;e.classList.contains("smart-kanban-view")&&(e.$.viewContent.classList.add("smart-hidden"),e.$.content.classList.remove("smart-hidden"),e._kanban.remove(),e.classList.remove("smart-kanban-view"),e._resetCachedLayout(),e.dataSource.boundHierarchy&&(e.dataSource.refreshHierarchy(),e._refreshRowHierarchy(!0,!0)),e.endUpdate(),e.dataSource.boundHierarchy&&e._recycle())}_getPriorityDataSource(){const e=this;return[{color:"#33B679",label:e.localize("priority_low"),value:"low"},{color:"#039BE5",label:e.localize("priority_average"),value:"average"},{color:"#DD5347",label:e.localize("priority_high"),value:"high"},{color:"#AF0020",label:e.localize("priority_critical"),value:"critical"}]}_getKanbanTaskField(e){const t=this;switch(e){case"startDate":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeStartDate"),dataField:"taskStartDate",cellsFormat:"d",showDescriptionButton:!0,dataType:"date",allowDelete:!0,editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e>a.taskDueDate&&a.taskDueDate&&e)||t.localize("invalidMaxValue",{value:t.localize("dialogAddColumnTypeStartDate"),max:a.taskDueDate.toLocaleDateString()})},visible:!0,_visible:!0,grid:t});case"dueDate":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeDueDate"),dataField:"taskDueDate",cellsFormat:"d",showDescriptionButton:!0,allowDelete:!0,dataType:"date",editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e<a.taskStartDate&&a.taskStartDate&&e)||t.localize("invalidMinValue",{value:t.localize("dialogAddColumnTypeDueDate"),min:a.taskStartDate.toLocaleDateString()})},visible:!0,_visible:!0,grid:t});case"progress":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeProgress"),dataField:"taskProgress",showDescriptionButton:!0,allowDelete:!0,visible:!0,_visible:!0,disabledDialogOptions:["numberFormat","minValue","maxValue"],dataType:"number",cellsFormat:"p0",template:"progress",editor:{disabledDialogOptions:!0,template:"numberInput",min:0,max:1},grid:t});case"checklist":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeChecklist"),dataField:"taskChecklist",allowGroup:!1,showDescriptionButton:!0,allowSort:!1,allowDelete:!0,allowFilter:!1,visible:!0,_visible:!0,disabledDialogOptions:["allowFilter","allowSort"],formatFunction(e){if(e.value&&e.value.indexOf("[")>=0&&(e.value=JSON.parse(e.value)),e.value&&Array.isArray(e.value)&&e.value.length>0){const a=e.value.filter((e=>e.completed)).length;e.value=t.localize("completed",{value:a})+"/"+e.value.length}else e.value=""},editor:{template:"<smart-multi-combo-input></smart-multi-combo-input>",settings:{inputTagsMode:"one",readonly:!0,allowItemsAdd:!0,allowItemsRemove:!0},onRender:function(e,a,l,o){const i="string"==typeof o[a]&&o[a]?JSON.parse(o[a]):o[a],n=[],s=l.firstElementChild;if(s.isInitialized&&t._kanban&&t._kanban.messages[t.locale]&&(s.messages[t.locale].tagLabel=t._kanban.messages[t.locale].taskCompleted,s.messages[t.locale].tagLabelOne=t._kanban.messages[t.locale].taskCompleted),i){const e=i.map((e=>{const t={label:e.text,value:e.text};return e.completed&&n.push(t),t}));s.dataSource=e}else s.dataSource=[];s.selectedItems=n,!t.editing.editRow&&s.open&&s.open()},setValue:function(){},getValue:function(){const e=this.firstElementChild;return e.dataSource.map((t=>{const a=e.selectedItems.find((e=>t.value===e.value));return{text:t.label,completed:void 0!==a}}))}},dataType:"any",grid:t});case"priority":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypePriority"),dataField:"taskPriority",showDescriptionButton:!0,dataType:"string",visible:!0,_visible:!0,allowDelete:!0,defaultValue:"average",disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,allowEmptyItem:!1,disabledDialogOptions:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:t._getPriorityDataSource()},template:"tags",grid:t});case"tags":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeTags"),dataField:"taskTags",allowDelete:!0,allowGroup:!1,visible:!0,_visible:!0,showDescriptionButton:!0,dataType:"string",template:"tags",grid:t});case"name":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeName"),allowDelete:!0,allowGroup:!1,dataField:"taskText",showDescriptionButton:!0,dataType:"string",_visible:!0,visible:!0,grid:t});case"description":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeDescription"),dataField:"taskDescription",allowGroup:!1,allowDelete:!0,showDescriptionButton:!0,editor:{template:"textarea"},dataType:"string",_visible:!0,visible:!0,grid:t});case"assigned":{let e=[""];for(let a=0;a<t.users.length;a++)e.push({label:t.users[a].name,value:t.users[a].id,id:t.users[a].id,image:t.users[a].image,color:t.users[a].color||""});return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeAssigned"),allowDelete:!0,dataField:"taskUserId",showDescriptionButton:!0,disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,collaborator:!0,disabledDialogOptions:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!0,dataSource:e},dataType:"string",visible:!0,_visible:!0,template:"tags",grid:t})}case"color":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeColor"),allowDelete:!0,dataField:"taskColor",showDescriptionButton:!0,dataType:"string",editor:{template:"colorInput"},template:"color",width:60,visible:!0,_visible:!0,grid:t});case"status":return t._getStatusColumn("basic")}}_getKanbanTaskFields(e){const t=this,a=[],l=t._getKanbanTaskField("startDate"),o=t._getKanbanTaskField("dueDate"),i=t._getKanbanTaskField("priority"),n=t._getKanbanTaskField("tags"),s=t._getKanbanTaskField("progress"),r=t._getKanbanTaskField("description"),d=t._getKanbanTaskField("name"),u=t._getKanbanTaskField("color"),c=t._getKanbanTaskField("checklist");let m=!0;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.editor&&a.editor.collaborator){m=!1;break}}if(a.push(d),a.push(r),a.push(e),a.push(l),a.push(o),a.push(s),a.push(i),a.push(n),a.push(c),a.push(u),m){let e=[""];for(let a=0;a<t.users.length;a++)e.push({label:t.users[a].name,value:t.users[a].id,id:t.users[a].id,image:t.users[a].image,color:t.users[a].color||""});const o=t._getKanbanTaskField("assigned");a.push(o),t._kanbanViewColumns=[l,o,s,i,n,c,u]}else t._kanbanViewColumns=[l,s,i,n,c,u];return a}getKanbanProperties(){const e=this;return e._kanbanProperties||(e._kanbanProperties={},e._kanbanProperties=Object.assign({},{taskColorEntireSurface:!1,collapsible:!0,addNewButton:!0,addNewButtonDisplayMode:"both",addNewColumn:!0,allowColumnRemove:!0,editable:!0,columnActions:!0,columnEditMode:"headerAndMenu",allowColumnEdit:!0,allowColumnReorder:!0,taskActions:!0,taskDue:!0,autoColumnHeight:!0,columnWidth:270,taskComments:!0,taskProgress:!0,columnSummary:!0,columnColors:!0,taskPriority:!0,taskUserIcon:!0,taskSubTasks:"none",columnColorEntireSurface:!0,columnFooter:!0})),e._kanbanProperties}setKanbanProperties(e){const t=this,a=t.getKanbanProperties();for(let t in e)void 0!==e[t]&&void 0!==a[t]&&(a[t]=e[t]);t._kanbanProperties=a,t.classList.contains("smart-kanban-view")&&(t._updateKanbanView(),t._kanban.refresh())}_updateKanbanView(e){const t=this;if(!t._kanban)return;if(!t.isInitialized)return;if(!e&&!(e=t.columnByDataField.taskStatus))return;const a=t._kanban,l=a.context;a.context=a;const o=e.editor.dataSource&&e.editor.dataSource.length>0?e.editor.dataSource:[{label:e.label,value:e.value,color:"#DD5347"}];a.users=t.users,a.currentUser=t.currentUser;const i=t.getKanbanProperties();for(let e in i)a[e]=i[e];let n=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];let l=a.dataField;if(a._dataField&&(l=a._dataField),l.startsWith("task")){let e=l.replace("task","");e=e.substring(0,1).toLowerCase()+e.substring(1),-1===n.indexOf(e)&&n.push(e)}}a.$.scrollViewer&&(a.$.scrollViewer.scrollLeft=0),a.dialogEditors=n;let s=[];for(let e=0;e<o.length;e++){const a=o[e];let l=a.label;""===a.label&&(l=a.labelAlt?a.labelAlt:t.localize("uncategorized")),s.push({label:l,value:a.value,status:a.value,dataField:a.value,color:a.color})}a.columns=s;let r=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.dataField.startsWith("task"))continue;if(a._dataField)continue;if(!1===a.allowEdit)continue;if("any"===a.dataType)continue;r.push({label:a.label||"",dataField:a.dataField,dataType:a.dataType,visible:a.visible,editor:a.editor.template});const l=r[r.length-1];a.editor.dataSource&&(l.dataSource=[...a.editor.dataSource]),a.editor.colorItems&&(l.colorItems=a.editor.colorItems),a.editor.colorItems&&(l.pills=a.editor.pills),a.editor.colorItems&&(l.singleSelect=a.editor.singleSelect),a.editor.dropDownButtonPosition&&(l.dropDownButtonPosition=a.editor.dropDownButtonPosition),["min","max","minLength","maxLength","minDate","maxDate"].forEach((e=>{void 0!==a.editor[e]&&(l[e]=a.editor[e])}))}a.taskCustomFields=r;const d=[];for(let e=0;e<t.dataSource.length;e++){const a=t.dataSource[e],l={},o=a.$.id;if(!1===a.$.filtered)continue;const i=t.rowById[o];i&&(l.history=i.history,i.comments&&(l.comments=i.comments)),t.columnByDataField.taskStatus||void 0===a.taskStatus&&(a.taskStatus="");for(let e in a){if(e.startsWith("$"))continue;let o=a[e];const i=t.columnByDataField[e];if(i&&i._dataField&&(e=i._dataField),e.startsWith("task")){let t=e.replace("task","");t=t.substring(0,1).toLowerCase()+t.substring(1),"progress"===t&&(o=100*parseFloat(o)),"checklist"===t&&(o&&o.length?"string"==typeof o&&(o=JSON.parse(o)):o=[]),l[t]=o}else l[e]=o}l.id=a.$.id,void 0===l.taskStatus&&(l.taskStatus=""),d.push(l)}a.dataSource=d,a.context=l}_getTaskData(e){const t=this,a={},l=t._kanban;if(e.checklist&&e.checklist.length>0&&!t.columnByDataField.taskChecklist){const e=t._getKanbanTaskField("checklist");t.columns.push(e)}if(e.priority&&l.taskPriority&&!t.columnByDataField.taskPriority){const e=t._getKanbanTaskField("priority");t.columns.push(e)}for(let o=0;o<t.columns.length;o++){const i=t.columns[o];let n=i.dataField,s=n;if(i._dataField&&(n=i._dataField),n.startsWith("task")){let t=n.replace("task","");if(t=t.substring(0,1).toLowerCase()+t.substring(1),"checklist"===t){e.checklist?a[n]=e.checklist:a[n]="";continue}if("history"===t&&(a[n]=e.history),void 0===e[t])continue;if("status"===t)a[n]=e[t];else if("priority"===t){const l=e[t];a[n]=l}else a[n]="progress"===t?parseFloat(e[t])/100:e[t];i._dataField&&(a[s]=a[n],delete a[n])}else l.taskCustomFields&&l.taskCustomFields.length&&l.taskCustomFields.find((e=>e.dataField===n))&&(a[n]=e[n])}return a}_createKanban(e){const t=this;if(t._kanban)return void(t.columnByDataField[e.dataField]||(t.columns.push(e),t._updateKanbanView(e)));t.columnByDataField[e.dataField]||(t.columns.push(e),t._updateKanbanView(e));const a=document.createElement("smart-kanban");t._kanban=a,t.onViewInit&&t.onViewInit(a),t._updateKanbanView(e),a.style.width="100%",a.style.height="100%",a.style.borderTopColor="transparent",a.style.borderLeftColor="transparent",a.style.borderRightColor="transparent",a.style.borderBottomColor="transparent",a.style.background="inherit","kanban"===t.view&&(t.$.viewContent.classList.remove("smart-hidden"),t.$.content.classList.add("smart-hidden")),t.$.viewContent.appendChild(a),"kanban"===t.view&&t.classList.add("smart-kanban-view"),t.editing.addNewColumn._addButton&&t.editing.addNewColumn._addButton.classList.remove("show");const l=()=>{const e=this,t=e.columnByDataField.taskStatus,a=e._kanban,l=[];for(let e=0;e<a.columns.length;e++){const t=a.columns[e],o={label:t.dataField?t.label:"",labelAlt:t.label,value:t.dataField,color:t.color};l.push(o)}if(t.editor.isDirty=!0,t.editor.dataSource=l,t._state&&(t._state.editor=t.editor),delete t.editor._items,e.onColumnUpdated){const a=e.viewColumns.indexOf(t);e.onColumnUpdated(a,t)}};a.addEventListener("columnUpdate",(()=>{l()})),a.addEventListener("columnAdd",(()=>{l()})),a.addEventListener("columnRemove",(()=>{l()})),a.addEventListener("taskAdd",(e=>{const a=e.detail.value,l=t._getTaskData(a);t._onRowInserted=e=>{a.id=e.id},t.addRow(l,!0,(e=>{a.id=e.id})),t._refreshHeaderBar(),delete t._onRowInserted})),a.addEventListener("taskRemove",(e=>{t.removeRow(e.detail.id),t._refreshHeaderBar()})),a.addEventListener("taskUpdate",(e=>{const l=e.detail.value,o=t._getTaskData(l);t.updateRow(e.detail.id,o);for(let e=0;e<a.taskCustomFields.length;e++){const l=a.taskCustomFields[e],o=t.columnByDataField[l.dataField];o&&(o.visible=l.visible)}const i=t.rowById[e.detail.id];i&&(i.history=l.history,i.comments=l.comments,t.onComment&&t.onComment(e.detail.id,i.comments))}))}});
|
|
1547
|
+
Smart.Utilities.Assign("Grid.View",class{createBasicKanban(){this._initKanbanView("basic")}createBlankKanban(){this._initKanbanView("blank")}_getStatusColumn(e){const t=this;return new Smart.Grid.Column({label:!e||e&&"blank"===e?t.localize("dialogNewColumn"):t.localize("status"),description:t.localize("dialogAddColumnStatusDescription"),dataField:"taskStatus",showDescriptionButton:!0,dataType:"string",defaultValue:"",editor:{template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""},{color:"#33B679",label:t.localize("toDo"),value:"toDo"},{color:"#039BE5",label:t.localize("inProgress"),value:"inProgress"},{color:"#8E24AA",label:t.localize("done"),value:"done"}]},template:"tags",cellsAlign:"left",align:"left",grid:t,visible:!0,_visible:!0,_view:!0})}_initKanbanView(e){const t=this;if(t._kanbanInitialized)return;t._kanbanInitialized=!0;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];a._dataField&&!t.columnByDataField[a._dataField]&&(t.columnByDataField[a._dataField]=a)}const a=t._getStatusColumn(e),l=t.columnByDataField.taskStatus;if(l&&(l.statusColumn||!1===t.editing.enabled))return t.beginUpdate(),t._createKanban(t.columnByDataField.taskStatus),t._refreshHeaderBar(),t.endUpdate(!1),void t._showKanbanView(!1);if(t._onColumnUpdated=(e,a)=>{e._view&&(delete e._view,delete e._state,delete t._onColumnUpdated,e.allowSort=e.allowEdit=e.allowFilter=!0,"blank"===a.kanban?(delete t.columnByDataField.taskStatus,e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"",singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""}]}):t.columnByDataField.taskStatus&&(t.columnByDataField.taskStatus.editor=e.editor,e=t.columnByDataField.taskStatus),e.statusColumn=!0,t.beginUpdate(),t._createKanban(e),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())},e&&"blank"===e)return delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label="New Column",t.beginUpdate(),t._createKanban(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate();if(e&&"basic"===e)return delete a._view,t.beginUpdate(),t._createKanban(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate();if(l){a.label=l.label,a.description=l.description;const e=l.editor.dataSource.filter((e=>""!==e));a.editor.dataSource=e}t._openAddColumnDialog(a,!0,(e=>{!1===e&&(delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"",singleSelect:!0,dataSource:[{color:"#DD5347",label:t.localize("uncategorized"),value:""}]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label=t.localize("dialogNewColumn"),t.beginUpdate(),t._createKanban(a),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())}))}_showKanbanView(e){const t=this;t.beginUpdate(),t.$.viewContent.classList.remove("smart-hidden"),t.$.content.classList.add("smart-hidden"),t.$.footerPager.classList.add("smart-hidden"),t._showAddNewRowButton("float"),t.$.viewContent.appendChild(t._kanban),t.classList.add("smart-kanban-view"),!1!==e&&(t._updateKanbanView(),t._kanban.refresh()),t._onFilter=t._onSort=()=>{"kanban"===t.view&&(t._updateKanbanView(),t._kanban.refresh())}}_hideKanbanView(){const e=this;e.classList.contains("smart-kanban-view")&&(e.$.viewContent.classList.add("smart-hidden"),e.$.content.classList.remove("smart-hidden"),e.$.footerPager.classList.remove("smart-hidden"),e._kanban.remove(),e.classList.remove("smart-kanban-view"),e._resetCachedLayout(),e.dataSource.boundHierarchy&&(e.dataSource.refreshHierarchy(),e._refreshRowHierarchy(!0,!0)),e.endUpdate(),e.dataSource.boundHierarchy&&e._recycle())}_getPriorityDataSource(){const e=this;return[{color:"#33B679",label:e.localize("priority_low"),value:"low"},{color:"#039BE5",label:e.localize("priority_average"),value:"average"},{color:"#DD5347",label:e.localize("priority_high"),value:"high"},{color:"#AF0020",label:e.localize("priority_critical"),value:"critical"}]}_updateKanbanTaskFields(){const e=this;for(let t=0;t<e.columns.length;t++){const a=e.columns[t];if(a.dataField.startsWith("taskStartDate")){const t=e._getKanbanTaskField("startDate");a.editor=t.editor}else if(a.dataField.startsWith("taskDueDate")){const t=e._getKanbanTaskField("dueDate");a.editor=t.editor}else if("checklist"===a.template){const t=e._getKanbanTaskField("checklist");a.editor=t.editor}}}_getKanbanTaskField(e){const t=this;switch(e){case"startDate":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeStartDate"),dataField:"taskStartDate",cellsFormat:"d",showDescriptionButton:!0,dataType:"date",allowDelete:!0,editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e>a.taskDueDate&&a.taskDueDate&&e)||t.localize("invalidMaxValue",{value:t.localize("dialogAddColumnTypeStartDate"),max:a.taskDueDate.toLocaleDateString()})},visible:!0,_visible:!0,grid:t});case"dueDate":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeDueDate"),dataField:"taskDueDate",cellsFormat:"d",showDescriptionButton:!0,allowDelete:!0,dataType:"date",editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e<a.taskStartDate&&a.taskStartDate&&e)||t.localize("invalidMinValue",{value:t.localize("dialogAddColumnTypeDueDate"),min:a.taskStartDate.toLocaleDateString()})},visible:!0,_visible:!0,grid:t});case"progress":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeProgress"),dataField:"taskProgress",showDescriptionButton:!0,allowDelete:!0,visible:!0,_visible:!0,disabledDialogOptions:["numberFormat","minValue","maxValue"],dataType:"number",cellsFormat:"p0",template:"progress",editor:{disabledDialogOptions:!0,template:"numberInput",min:0,max:1},grid:t});case"checklist":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeChecklist"),dataField:"taskChecklist",allowGroup:!1,showDescriptionButton:!0,allowSort:!1,allowDelete:!0,allowFilter:!1,visible:!0,_visible:!0,disabledDialogOptions:["allowFilter","allowSort"],template:"checklist",editor:{template:"<smart-multi-combo-input></smart-multi-combo-input>",settings:{inputTagsMode:"one",readonly:!0,allowItemsAdd:!0,allowItemsRemove:!0},onRender:function(e,a,l,o){const i="string"==typeof o[a]&&o[a]?JSON.parse(o[a]):o[a],s=[],n=l.firstElementChild;if(n.isInitialized&&t._kanban&&t._kanban.messages[t.locale]&&(n.messages[t.locale].tagLabel=t._kanban.messages[t.locale].taskCompleted,n.messages[t.locale].tagLabelOne=t._kanban.messages[t.locale].taskCompleted),i){const e=i.map((e=>{const t={label:e.text,value:e.text};return e.completed&&s.push(t),t}));n.dataSource=e}else n.dataSource=[];n.selectedItems=s,!t.editing.editRow&&n.open&&n.open()},setValue:function(){},getValue:function(){const e=this.firstElementChild;return e.dataSource.map((t=>{const a=e.selectedItems.find((e=>t.value===e.value));return{text:t.label,completed:void 0!==a}}))}},dataType:"any",grid:t});case"priority":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypePriority"),dataField:"taskPriority",showDescriptionButton:!0,dataType:"string",visible:!0,_visible:!0,allowDelete:!0,defaultValue:"average",disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,allowEmptyItem:!1,disabledDialogOptions:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:t._getPriorityDataSource()},template:"tags",grid:t});case"tags":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeTags"),dataField:"taskTags",allowDelete:!0,allowGroup:!1,visible:!0,_visible:!0,showDescriptionButton:!0,dataType:"string",template:"tags",grid:t});case"name":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeName"),allowDelete:!0,allowGroup:!1,dataField:"taskText",showDescriptionButton:!0,dataType:"string",_visible:!0,visible:!0,grid:t});case"description":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeDescription"),dataField:"taskDescription",allowGroup:!1,allowDelete:!0,showDescriptionButton:!0,editor:{template:"textarea"},dataType:"string",_visible:!0,visible:!0,grid:t});case"assigned":{let e=[""];for(let a=0;a<t.users.length;a++)e.push({label:t.users[a].name,value:t.users[a].id,id:t.users[a].id,image:t.users[a].image,color:t.users[a].color||""});return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeAssigned"),allowDelete:!0,dataField:"taskUserId",showDescriptionButton:!0,disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,collaborator:!0,disabledDialogOptions:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!0,dataSource:e},dataType:"string",visible:!0,_visible:!0,template:"tags",grid:t})}case"color":return new Smart.Grid.Column({label:t.localize("dialogAddColumnTypeColor"),allowDelete:!0,dataField:"taskColor",showDescriptionButton:!0,dataType:"string",editor:{template:"colorInput"},template:"color",width:60,visible:!0,_visible:!0,grid:t});case"status":return t._getStatusColumn("basic")}}_getKanbanTaskFields(e){const t=this,a=[],l=t._getKanbanTaskField("startDate"),o=t._getKanbanTaskField("dueDate"),i=t._getKanbanTaskField("priority"),s=t._getKanbanTaskField("tags"),n=t._getKanbanTaskField("progress"),r=t._getKanbanTaskField("description"),d=t._getKanbanTaskField("name"),u=t._getKanbanTaskField("color"),c=t._getKanbanTaskField("checklist");let m=!0;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.editor&&a.editor.collaborator){m=!1;break}}if(a.push(d),a.push(r),a.push(e),a.push(l),a.push(o),a.push(n),a.push(i),a.push(s),a.push(c),a.push(u),m){let e=[""];for(let a=0;a<t.users.length;a++)e.push({label:t.users[a].name,value:t.users[a].id,id:t.users[a].id,image:t.users[a].image,color:t.users[a].color||""});const o=t._getKanbanTaskField("assigned");a.push(o),t._kanbanViewColumns=[l,o,n,i,s,c,u]}else t._kanbanViewColumns=[l,n,i,s,c,u];return a}getKanbanProperties(){const e=this;if(e._kanbanProperties)return e._kanbanProperties;e._kanbanProperties={};const t={taskColorEntireSurface:!1,collapsible:!0,addNewButton:!0,addNewButtonDisplayMode:"both",addNewColumn:!0,allowColumnRemove:!0,editable:!0,columnActions:!0,columnEditMode:"headerAndMenu",allowColumnEdit:!0,allowColumnReorder:!0,taskActions:!0,taskDue:!0,autoColumnHeight:!0,columnWidth:270,taskComments:!0,taskProgress:!0,columnSummary:!0,columnColors:!0,taskPriority:!0,taskUserIcon:!0,taskSubTasks:"none",taskCustomFieldsHide:!0,columnColorEntireSurface:!0,columnFooter:!0};return!1===e.editing.enabled&&(t.allowDrag=!1,t.allowDrop=!1,t.allowColumnReorder=!1,t.allowColumnRemove=!1,t.allowColumnEdit=!1,t.addNewButton=!1,t.addNewColumn=!1,t.columnActions=!1,t.editable=!1),e._kanbanProperties=Object.assign({},t),e._kanbanProperties}setKanbanProperties(e){const t=this,a=t.getKanbanProperties();for(let t in e)void 0!==e[t]&&void 0!==a[t]&&(a[t]=e[t]);t._kanbanProperties=a,t.classList.contains("smart-kanban-view")&&(t._updateKanbanView(),t._kanban.refresh())}_updateKanbanView(e){const t=this;if(!t._kanban)return;if(!t.isInitialized)return;if(!e&&!(e=t.columnByDataField.taskStatus))return;const a=t._kanban,l=a.context;a.context=a;const o=e.editor.dataSource&&e.editor.dataSource.length>0?e.editor.dataSource:[{label:e.label,value:e.value,color:"#DD5347"}];a.users=t.users,a.currentUser=t.currentUser;const i=t.getKanbanProperties();for(let e in i)a[e]=i[e];let s=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];let l=a.dataField;if(a._dataField&&(l=a._dataField),l.startsWith("task")){let e=l.replace("task","");e=e.substring(0,1).toLowerCase()+e.substring(1),-1===s.indexOf(e)&&s.push(e)}}a.$.scrollViewer&&(a.$.scrollViewer.scrollLeft=0),a.dialogEditors=s;let n=[];for(let e=0;e<o.length;e++){const a=o[e];let l=a.label;""===a.label&&(l=a.labelAlt?a.labelAlt:t.localize("uncategorized")),n.push({label:l,value:a.value,status:a.value,dataField:a.value,color:a.color})}a.columns=n;let r=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.dataField.startsWith("task"))continue;if(a._dataField)continue;if(!1===a.allowEdit)continue;if("any"===a.dataType)continue;r.push({label:a.label||"",dataField:a.dataField,dataType:a.dataType,visible:a.visible,editor:a.editor.template});const l=r[r.length-1];a.editor.dataSource&&(l.dataSource=[...a.editor.dataSource]),a.editor.colorItems&&(l.colorItems=a.editor.colorItems),a.editor.colorItems&&(l.pills=a.editor.pills),a.editor.colorItems&&(l.singleSelect=a.editor.singleSelect),a.editor.dropDownButtonPosition&&(l.dropDownButtonPosition=a.editor.dropDownButtonPosition),["min","max","minLength","maxLength","minDate","maxDate"].forEach((e=>{void 0!==a.editor[e]&&(l[e]=a.editor[e])}))}a.taskCustomFields=r;const d=[];for(let e=0;e<t.dataSource.length;e++){const a=t.dataSource[e],l={},o=a.$.id;if(!1===a.$.filtered)continue;const i=t.rowById[o];i&&(l.history=i.history,i.comments&&(l.comments=i.comments)),t.columnByDataField.taskStatus||void 0===a.taskStatus&&(a.taskStatus="");for(let e in a){if(e.startsWith("$"))continue;let o=a[e];const i=t.columnByDataField[e];if(i&&i._dataField&&(e=i._dataField),e.startsWith("task")){let t=e.replace("task","");t=t.substring(0,1).toLowerCase()+t.substring(1),"progress"===t&&(o=100*parseFloat(o)),"checklist"===t&&(o&&o.length?"string"==typeof o&&(o=JSON.parse(o)):o=[]),l[t]=o}else l[e]=o}l.id=a.$.id,void 0===l.status?l.status="":n.find((e=>e.value===l.status))||(l.status=""),d.push(l)}a.dataSource=d,a.context=l}_getTaskData(e){const t=this,a={},l=t._kanban;if(e.checklist&&e.checklist.length>0&&!t.columnByDataField.taskChecklist){const e=t._getKanbanTaskField("checklist");e.visible=e._visible=!1,t.columns.push(e)}if(e.priority&&l.taskPriority&&!t.columnByDataField.taskPriority){const e=t._getKanbanTaskField("priority");e.visible=e._visible=!1,t.columns.push(e)}for(let o=0;o<t.columns.length;o++){const i=t.columns[o];let s=i.dataField,n=s;if(i._dataField&&(s=i._dataField),s.startsWith("task")){let t=s.replace("task","");if(t=t.substring(0,1).toLowerCase()+t.substring(1),"checklist"===t){e.checklist?a[s]=e.checklist:a[s]="";continue}if("history"===t&&(a[s]=e.history),void 0===e[t])continue;if("status"===t)a[s]=e[t];else if("priority"===t){const l=e[t];a[s]=l}else a[s]="progress"===t?parseFloat(e[t])/100:e[t];i._dataField&&(a[n]=a[s],delete a[s])}else l.taskCustomFields&&l.taskCustomFields.length&&l.taskCustomFields.find((e=>e.dataField===s))&&(a[s]=e[s])}return a}_createKanban(e){const t=this;if(t._kanban)return void(t.columnByDataField[e.dataField]||(t.columns.push(e),t._updateKanbanView(e)));t.columnByDataField[e.dataField]||(t.columns.push(e),t._updateKanbanView(e));const a=document.createElement("smart-kanban");t._kanban=a,t.onViewInit&&t.onViewInit(a),t._updateKanbanView(e),a.style.width="100%",a.style.height="100%",a.style.borderTopColor="transparent",a.style.borderLeftColor="transparent",a.style.borderRightColor="transparent",a.style.borderBottomColor="transparent",a.style.background="inherit","kanban"===t.view&&(t.$.viewContent.classList.remove("smart-hidden"),t.$.content.classList.add("smart-hidden"),t.$.footerPager.classList.add("smart-hidden")),t.$.viewContent.appendChild(a),"kanban"===t.view&&t.classList.add("smart-kanban-view"),t.editing.addNewColumn._addButton&&t.editing.addNewColumn._addButton.classList.remove("show");const l=()=>{const e=this,t=e.columnByDataField.taskStatus,a=e._kanban,l=[];for(let e=0;e<a.columns.length;e++){const t=a.columns[e],o={label:t.dataField?t.label:"",labelAlt:t.label,value:t.dataField,color:t.color};l.push(o)}if(t.editor.isDirty=!0,t.editor.dataSource=l,t._state&&(t._state.editor=t.editor),delete t.editor._items,e.onColumnUpdated){const a=e.viewColumns.indexOf(t);e.onColumnUpdated(a,t)}};a.addEventListener("columnUpdate",(()=>{l()})),a.addEventListener("columnAdd",(()=>{l()})),a.addEventListener("columnRemove",(()=>{l()})),a.addEventListener("taskAdd",(e=>{const a=e.detail.value,l=t._getTaskData(a);t._onRowInserted=e=>{a.id=e.id},t.addRow(l,!0,(e=>{a.id=e.id})),t._refreshHeaderBar(),delete t._onRowInserted})),a.addEventListener("taskRemove",(e=>{t.removeRow(e.detail.id),t._refreshHeaderBar()})),a.addEventListener("taskUpdate",(e=>{const l=e.detail.value,o=t._getTaskData(l);t.updateRow(e.detail.id,o);for(let e=0;e<a.taskCustomFields.length;e++){const l=a.taskCustomFields[e],o=t.columnByDataField[l.dataField];o&&(o.visible=l.visible)}const i=t.rowById[e.detail.id];i&&(i.history=l.history,i.comments=l.comments,t.onComment&&t.onComment(e.detail.id,i.comments))}))}});
|
|
1548
1548
|
|
|
1549
1549
|
/***/ }),
|
|
1550
1550
|
|
|
@@ -1593,7 +1593,7 @@ Smart("smart-menu-item",class extends Smart.BaseElement{static get properties(){
|
|
|
1593
1593
|
/***/ 9633:
|
|
1594
1594
|
/***/ (() => {
|
|
1595
1595
|
|
|
1596
|
-
Smart("smart-multi-combo-input",class extends Smart.CheckInput{static get properties(){return{allowItemsAdd:{value:!1,type:"boolean"},allowItemsRemove:{value:!1,type:"boolean"},autoAddNewTags:{value:!0,type:"boolean"},colorItems:{value:!0,type:"boolean"},inputTagsMode:{allowedValues:["one","many"],value:"many",type:"string"},hideInputTagsCloseButton:{value:!1,type:"boolean"},messages:{value:{en:{newItem:"New item",tagLabelOne:"{{value}} item selected",tagLabel:"{{value}} items selected",selectAll:"Select All",unselectAll:"Unselect All"}},type:"object",extend:!0},pills:{value:!1,type:"boolean"},singleSelect:{value:!1,type:"boolean"},selectAll:{value:!1,type:"boolean"}}}template(){return'<div id="inputContainer" role="presentation"><div id="optionsContainer" inner-h-t-m-l=\'{{innerHTML}}\' class="smart-hidden"></div><div class="smart-action-button" role="presentation" id="actionButton"> <input class="smart-input" id=\'input\' readonly=\'[[readonly]]\' placeholder=\'[[placeholder]]\' type=\'[[type]]\' name=\'[[name]]\' disabled=\'[[disabled]]\' aria-label="[[placeholder]]" /></div><span class="smart-hidden smart-hint" id="span">[[hint]]</span><div id="dropDownButton" tabindex=-1 class="smart-drop-down-button" role="button" aria-label="Toggle popup"><div id="arrow" class="arrow" aria-hidden="true"></div></div></div>'}_downHandler(e){const t=this,l=e.originalEvent.target;t.readonly&&l&&l.classList&&!l.classList.contains("smart-drop-down-list-unselect-button")?t._dropDownButtonDownHandler(e):t._tokenCloseButtonClick!==l.closest(".smart-drop-down-list-unselect-button")&&(t._tokenCloseButtonClick=l.closest(".smart-drop-down-list-unselect-button"),t.readonly&&t._dropDownButtonDownHandler(e))}focus(){const e=this;e.readonly?HTMLElement.prototype.focus.apply(e,[]):e.$.input.focus()}_setFocusable(){const e=this;if(e.readonly){if(e.disabled||e.unfocusable)return void e.removeAttribute("tabindex");e.tabIndex=e.tabIndex>0?e.tabIndex:0,e.$.listen("keydown",e._keyDownHandler),e.$.listen("keyup",e._keyUpHandler)}}_documentUpHandler(e){const t=this,l=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(t._tokenCloseButtonClick&&t._tokenCloseButtonClick===l.closest(".smart-drop-down-list-unselect-button")){const e=l.closest(".smart-token"),[a,s]=[e.getAttribute("data-label"),e.getAttribute("value")],n=t._selectedItems.findIndex((e=>a===e.label&&s===e.value)),[o,i]=[t.value,t.$.input.dataValue];let r,d;return n>-1&&t._selectedItems.splice(n,1),t.set("value",d=t._selectedItems.map((e=>e.label)).join(t.separator)),t.$.input.dataValue=r=t._selectedItems.map((e=>e.value)).join(t.separator),t._updateValue(),t.$.actionButton.contains(e)&&t.$.actionButton.removeChild(e),t.close(),void(d===o&&r===i||(t.$.fireEvent("change",{value:r,label:d,oldValue:i,oldLabel:o}),t._updateTargetValue()))}if(!t.contains(l))if(t.$.dropDownContainer.contains(l.shadowParent||l)){if(t._isPointerDown){if(t._isPointerDown=!1,t.opened&&(t._preventLookup=!0),l.hasAttribute("add-new"))return;t.focus()}}else t.opened&&(t._preventLookup=!0),t._isPointerDown||t.close(),t._isPointerDown=!1}get selectedItems(){return this._selectedItems?this._selectedItems:[]}set selectedItems(e){this._selectedItems=e,this._updateValue()}_performSelect(e,t){const l=this;if(!e)return void l.close();const a=e.target?e.target.closest("li"):e;if(!a)return;l._selectedItems||(l._selectedItems=[]),a.classList.toggle("selected"),l.singleSelect&&(l._selectedItems=[],a.classList.add("selected"));const s=a.classList.contains("selected"),n={label:a.getAttribute("data-label"),value:a.getAttribute("value"),color:a.getAttribute("color"),image:a.getAttribute("image")},o=l.$.menu.children;for(let e=0;e<o.length;e++)l.singleSelect&&o[e]!==a&&o[e].classList.remove("selected"),o[e].classList.remove("active"),o[e].setAttribute("aria-selected",!1);if(s){if(l.dataSource&&l.dataSource[0]&&"string"==typeof l.dataSource[0])l._selectedItems.push(n);else{const e=l.dataSource.findIndex((e=>e.label===n.label&&""+e.value===n.value));l.dataSource&&e>=0?l._selectedItems.push(l.dataSource[e]):l._selectedItems.push(n)}if(e.noActiveState||(l._setActiveDescendant(a),a.classList.add("active")),l.dataSource)if(l.dataSource[0]&&"string"==typeof l.dataSource[0]){const e=l.dataSource.findIndex((e=>e===n.label));l.set("selectedIndex",e)}else{const e=l.dataSource.findIndex((e=>e.label===n.label&&""+e.value===n.value));l.set("selectedIndex",e)}}else{if(l.dataSource&&l.dataSource[0]&&"string"==typeof l.dataSource[0]){const e=l.dataSource.findIndex((e=>e===n.label));if(e>-1){const e=l._selectedItems.findIndex((e=>e===n.label));l._selectedItems.splice(e,1),l.set("selectedIndex",-1)}else l.set("selectedIndex",e)}else{const e=l.dataSource.findIndex((e=>e.label===n.label&&""+e.value===n.value));if(l.dataSource)if(e>-1){const e=l._selectedItems.findIndex((e=>e.label===n.label&&""+e.value===n.value));l._selectedItems.splice(e,1),l.set("selectedIndex",-1)}else l.set("selectedIndex",e)}a.classList.remove("active")}a.setAttribute("aria-selected",s),l._updateValue(t),l.singleSelect&&l.close()}_updateValue(e){const t=this;if(!t.isInitialized)return;let l=t._selectedItems,a=t.value,s=t.$.input.dataValue,[n,o]=[[],[]];l||(l=[]);for(let e=0;e<l.length;e++){const t=l[e];t?"string"==typeof t?(n.push(t),o.push(t)):(n.push(t.label),o.push(t.value)):(n.push(""),o.push(""))}if(t._createTags(),l&&l.length>0&&"string"==typeof l[0]?t.set("selectedValues",l):t.set("selectedValues",l.map((e=>e.value))),n=n.join(t.separator),t.set("value",n),t.$.input.dataValue=o=o.join(t.separator),t.$.input.value="",t.setAttribute("value",t.value),e||n===a&&o===s||(t.$.fireEvent("change",{value:o,label:n,oldValue:s,oldLabel:a}),t._updateTargetValue()),t.selectAll&&t._setSelectAllItemState(),!t.opened)return;const i=t.getBoundingClientRect(),r=window.scrollX,d=window.scrollY;t.$.dropDownContainer.style.left=-3+i.left+r+"px",t.$.dropDownContainer.style.top=i.bottom+d+1+"px"}_setSelection(){const e=this;super._setSelection(),e.singleSelect&&(e._selectedItems.length>0&&(e._selectedItems=[e._selectedItems[e._selectedItems.length-1]]),e.selectedValues.length>0&&(e.selectedValues=[e.selectedValues[e.selectedValues.length-1]])),this._createTags()}_createTags(){const e=this,t=e._selectedItems||[];let l,a=document.createDocumentFragment();for(;"SPAN"===e.$.actionButton.firstElementChild.nodeName;)e.$.actionButton.removeChild(e.$.actionButton.firstElementChild);if(0===t.length&&"one"===e.inputTagsMode&&e.readonly){const s="one"===e.inputTagsMode?t.length>1?e.localize("tagLabel",{value:t.length,count:e.dataSource.length}):e.localize("tagLabelOne",{value:t.length,count:e.dataSource.length}):"";l=document.createElement("span"),l.classList.add("smart-token"),l.innerHTML="<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+s+"</span>",a.appendChild(l)}for(let s=0;s<t.length;s++){const n=t[s];if("one"===e.inputTagsMode&&!l||"many"===e.inputTagsMode){let s="one"===e.inputTagsMode?t.length>1?e.localize("tagLabel",{value:t.length,count:e.dataSource.length}):e.localize("tagLabelOne",{value:t.length,count:e.dataSource.length}):"string"==typeof n?n:n.label;"many"===e.inputTagsMode&&void 0===s&&(s=""),l=document.createElement("span"),l.classList.add("smart-token");let o=null,i="";if(n.image&&"many"===e.inputTagsMode&&(o=document.createElement("span"),o.style.backgroundImage=`url('${n.image}')`,o.className="smart-drop-down-list-selection-image",i=o.outerHTML),l.innerHTML=i+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+s+"</span>",e.singleSelect||"one"===e.inputTagsMode||(l.innerHTML+='<span class=\'smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span>'),"many"===e.inputTagsMode){n.label?(l.setAttribute("data-label",n.label),l.setAttribute("value",n.value)):(l.setAttribute("data-label",""),l.setAttribute("value","")),l.setAttribute("separator",e.separator);const t=n.color;if(t&&e.colorItems){l.setAttribute("color",t),l.style.setProperty("--smart-primary",t);const e=new Smart.Color(t).getInvertedColor();l.style.setProperty("--smart-primary-color",e)}}if(""===s&&e.singleSelect)continue;a.appendChild(l)}}e.$.actionButton.insertBefore(a,e.$.input);const s=e.getBoundingClientRect(),n=window.scrollX,o=window.scrollY;e.$.scrollView.style.left=-3+s.left+n+"px",e.$.scrollView.style.top=s.bottom+o+1+"px"}_render(e){const t=this,l=(e,l)=>{let a=e,s=e,n=e,o=null;"object"==typeof e&&(a=e.label,s=void 0!==e.value?e.value:a,o=void 0!==e.color?e.color:"",n=void 0!==e.id?e.id:l);const i=document.createElement("li"),r=document.createElement("a");if(r.href="#",i.id=t.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),i.setAttribute("data-label",a),i.setAttribute("value",s),i.setAttribute("role","option"),i.setAttribute("aria-selected",!1),i.setAttribute("aria-label",a),void 0!==n&&(i.id=n),o&&t.colorItems){i.setAttribute("color",o),i.style.setProperty("--smart-primary",o);const e=new Smart.Color(o).getInvertedColor();i.style.setProperty("--smart-primary-color",e)}if(r.innerHTML=t.highlighter?t.highlighter(a):t._highlighter(a),r.setAttribute("aria-hidden",!0),e.icon&&(r.classList.add("icon"),r.classList.add(e.icon)),e.image){const t=document.createElement("span");t.style.backgroundImage=`url('${e.image}')`,t.className="smart-drop-down-list-selection-image",i.setAttribute("image",e.image),r.innerHTML=t.outerHTML+r.innerHTML}if(i.appendChild(r),t.allowItemsRemove){const l=document.createElement("span");l.classList.add("close-button"),r.appendChild(l),l.onpointerdown=l=>{l.preventDefault(),l.stopPropagation();const n=t.dataSource.findIndex((t=>t.value===e.value));if(n>=0){if(t.dataSource.splice(n,1),i.remove(),t.$.scrollView.refresh&&t.$.scrollView.refresh(),"one"===t.inputTagsMode){const e=t._selectedItems.findIndex((e=>e.label===a&&e.value===s));e>=0&&t._selectedItems.splice(e,1),t._createTags()}t.$.fireEvent("remove",{index:n,label:e.label,value:e.value})}}}return(t.singleSelect&&""===e||t.singleSelect&&e&&""===e.label)&&(i.innerHTML=""),i},a=e.map((function(e,t){return l(e,t)}));t.$.menu.innerHTML="",t._selectedItems||(t._selectedItems=[]);let s=t._selectedItems.map((e=>"string"==typeof e?e:e.value));s.length||(s=(t.$.input.dataValue||t.$.input.value).split(t.separator).map((e=>e.trim())));let n=Array.from(t.$.actionButton.getElementsByClassName("smart-token")).map((e=>e.textContent.trim()));if(t.allowItemsAdd){const e=document.createElement("div"),a=document.createElement("smart-button"),s=document.createElement("input");e.classList.add("add-new-item"),a.setAttribute("add-new",""),s.setAttribute("add-new",""),s.placeholder=t.localize("newItem"),s.classList.add("smart-input"),a.onclick=()=>{if(!s.value)return;const e={label:s.value,value:s.value.trim().replace(/ /gi,"")};t.dataSource||(t.dataSource=[]),t.dataSource.push(e);const a=l(e,t.dataSource.length-1);t.$.menu.appendChild(a),t.$.scrollView.refresh&&t.$.scrollView.refresh(),s.value="","one"===t.inputTagsMode&&t._createTags(),t.$.fireEvent("add",{label:e.label,value:e.value,index:t.dataSource.length-1})},s.onkeydown=e=>{"Enter"===e.key&&a.click()},e.appendChild(s),e.appendChild(a),t.$.menu.appendChild(e)}for(let e=0;e<a.length;e++){const l=a[e],o=l.getAttribute("value"),i=l.getAttribute("data-label"),r=s.findIndex((e=>""+e==""+o));r>-1&&("one"===t.inputTagsMode||n[r]===i)&&(l.classList.add("selected"),l.setAttribute("aria-selected",!0),t._setActiveDescendant(l),t._selectedItems.findIndex((e=>"string"==typeof e?e===i:e.label===i&&e.value===o))<0&&t._selectedItems.findIndex((e=>"string"==typeof e?e===o:""+e.value==""+o))<0&&t._selectedItems.push({label:l.getAttribute("data-label"),value:l.getAttribute("value")})),t._setSelectAllItemState(),t.$.menu.appendChild(l)}}_next(){const e=this;let t=e._selectedItems?e._selectedItems[e._selectedItems.length-1]:void 0;t&&(t=e.$.menu.querySelector(`.active[data-label="${t.label}"][value="${t.value}"]`));const l=t||e.$.menu.querySelector(".active");if(!l){const t=e.$.menu.firstElementChild;return t.classList.add("active","focused"),void e._setActiveDescendant(t)}const a=e.$.menu.children;for(let e=0;e<a.length;e++)a[e].classList.remove("active","focused");e._setActiveDescendant();let s=l.nextElementSibling;s||(s=e.$.menu.firstElementChild),s.classList.add("active","focused"),e._setActiveDescendant(s),e.ensureVisible()}_prev(){const e=this;let t=e._selectedItems?e._selectedItems[e._selectedItems.length-1]:void 0;t&&(t=e.$.menu.querySelector(`.active[data-label="${t.label}"][value="${t.value}"]`));const l=t||e.$.menu.querySelector(".active");if(!l){const t=e.$.menu.firstElementChild;return t.classList.add("active","focused"),void e._setActiveDescendant(t)}const a=e.$.menu.children;for(let e=0;e<a.length;e++)a[e].classList.remove("active","focused");e._setActiveDescendant();let s=l.previousElementSibling;s||(s=e.$.menu.lastElementChild),s.classList.add("active","focused"),e._setActiveDescendant(s),e.ensureVisible()}_keyDownHandler(e){const t=this;t._suppressKeyPressRepeat=![40,38,9,13,27,16,17,18].includes(e.keyCode),e.shiftKey||e.altKey||e.ctrlKey?delete t._inputValue:(t._move(e),t._inputValue=t.$.input.value)}_keyUpHandler(e){const t=this;let l=t.$.input.value;if(t._selectedItems&&(l=t._selectedItems.map((e=>e.label)),t.$.input.value&&l.push(t.$.input.value),l=l.join(t.separator)),t.set("value",l),!e.shiftKey&&"F2"!==e.key){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:40===e.keyCode&&e.altKey&&t.open(),38===e.keyCode&&e.altKey&&t.close();break;case 8:{if(t.readonly)break;if(t.opened&&t.close(),t._inputValue&&t._inputValue.length)break;if(!t._selectedItems){t.readonly||(t.$.input.dataValue=t.$.input.value);break}const e=t._selectedItems[t._selectedItems.length-1];if(!e)break;t.$.menu.querySelector(`li[data-label="${e.label}"][value="${e.value}"]`)&&(t._selectedItems.pop(),t._updateValue());break}case 9:case 13:if(!t.opened)return void(t.autoAddNewTags&&13===e.keyCode&&"many"===t.inputTagsMode&&t._autoCreateTags());t._performSelect(t.$.menu.querySelector(".active")),e.stopPropagation(),e.preventDefault();break;case 27:if(!t.opened)return;t.close(),e.stopPropagation(),e.preventDefault();break;default:t._lookup(e),!t.opened||e.ctrlKey||e.shiftKey||(e.stopPropagation(),e.preventDefault())}delete t._inputValue}}_blurHandler(){super._blurHandler(),this._autoCreateTags()}_autoCreateTags(){const e=this;if(!e.autoAddNewTags||"many"===!e.inputTagsMode)return;e.dataSource||(e.dataSource=[]);const t=e.$.input.value.trim();if(!e.dataSource.find((e=>"string"==typeof e?e===t:e.label===t))){e._tempItems||(e._tempItems=[]);let l=t.trim();if(t.indexOf(",")>=0){l=t.split(",");for(let t=0;t<l.length;t++){const a=l[t].trim();""!==a&&(e._tempItems.push(a),e._creteaTagsFromValue(a))}}else""!==l&&(e._tempItems.push(l),e._creteaTagsFromValue(l));e.query="",e._updateValue(!0)}}propertyChangedHandler(e,t,l){const a=this;if("disabled"===e&&a._setFocusable(),"value"===e){a.displayMember!==a.valueMember&&"string"!=typeof l?(a.value=l[a.displayMember],a.$.input.dataValue=l[a.valueMember]):a.$.input.dataValue="";const e=a.$.menu.children;for(let t=0;t<e.length;t++)e[t].classList.remove("selected"),e[t].setAttribute("aria-selected",!1);a._setActiveDescendant(a.$.menu.querySelector("active")),a._creteaTagsFromValue(l)}else if("separator"===e){const e=a.$.actionButton.children;for(let t=0;t<e.length;t++){const a=e[t];a.classList.contains("smart-token")&&a.setAttribute("separator",l)}}else if("inputTagsMode"===e)a._createTags();else if("theme"===e||"rightToLeft"===e)a.$.scrollView[e]=l,l?a.$.dropDownContainer.setAttribute(Smart.Utilities.Core.toDash(e),""):a.$.dropDownContainer.removeAttribute(Smart.Utilities.Core.toDash(e));else if("inverted"===e)l?a.$.dropDownContainer.setAttribute("inverted",""):a.$.dropDownContainer.removeAttribute("inverted");else if("selectAll"===e)a._handleSelectAllItem();else if("selectedIndex"===e){if(super.propertyChangedHandler(e,t,l),a._selectedItems=[],a.dataSource){const e=a.dataSource[l];e&&a._selectedItems.push(e),a._updateValue(!0)}}else if("selectedValues"===e){if(super.propertyChangedHandler(e,t,l),a.dataSource){a._selectedItems=[];const e=a.dataSource.filter((e=>{if("string"==typeof e){if(a.selectedValues.indexOf(e)>=0)return!0}else if(a.selectedValues.indexOf(e.value)>=0)return!0}));a._selectedItems=e,a._updateValue(!0)}}else super.propertyChangedHandler(e,t,l)}_createElement(){const e=this,t=document.createElement("ul"),l=document.createElement("smart-scroll-viewer"),a=document.createElement("div");if(l.rightToLeft=e.rightToLeft,l.theme=e.theme,l.horizontalScrollBarVisibility="hidden",l.classList.add("smart-multi-combo-input-scroll-viewer"),e.rightToLeft&&a.setAttribute("right-to-left",""),e.dataSource&&"string"==typeof e.dataSource&&(e.dataSource=e.$.deserialize(e.dataSource,"array")),a.setAttribute("theme",e.theme),a.classList.add("smart-multi-combo-input-drop-down-menu","smart-input-drop-down-menu","smart-check-input-drop-down-menu"),e.pills&&a.setAttribute("pills",""),e.singleSelect&&a.setAttribute("single-select",""),e.inverted?a.setAttribute("inverted",""):a.removeAttribute("inverted"),e.classList.add("smart-input"),a.appendChild(l),t.setAttribute("aria-multiselectable",!0),e.$.scrollView=l,e.$.menu=t,e.$.dropDownContainer=a,e.$.menu.onclick=function(t){t.stopPropagation(),t.preventDefault(),t.target&&t.target.hasAttribute("add-new")||(e._performSelect(t),e.focus())},e.classList.add("smart-input"),e.$.input.value="",e.selectedValues&&e.selectedValues.length>0){const t=e.dataSource.filter((t=>{if("string"==typeof t){if(e.selectedValues.indexOf(t)>=0)return!0}else if(e.selectedValues.indexOf(t.value)>=0)return!0}));e.selectedItems=t}else{const t=e.value;t&&e._creteaTagsFromValue(t)}e._handleSelectAllItem(),e._setFocusable()}_creteaTagsFromValue(e=""){const t=this;if(e){const e=t.value.split(",");for(t.$.input.value="",t._selectedItems=[];"SPAN"===t.$.actionButton.firstElementChild.nodeName;)t.$.actionButton.removeChild(t.$.actionButton.firstElementChild);for(let l=0,a=e.length;l<a;l+=1){const a=e[l].trim();if(a)if(t.dataSource){const e=t.dataSource.find((e=>{if("string"==typeof e){if(e===a)return e}else if(""+e.value===a)return e}));e&&e.label?e.color?t._selectedItems.push({color:e.color,label:e.label,value:e.value}):t._selectedItems.push({label:e.label,value:e.value}):t._selectedItems.push({label:a,value:a})}else t._selectedItems.push({label:a,value:a})}t._createTags()}else t.$.input.value="",t._selectedItems=[],t._createTags()}_handleSelectAllItem(){const e=this;if(e.selectAll){if(!e.$.selectAll){const t=document.createElement("ul"),l=document.createElement("li"),a=document.createElement("a");a.href="#",a.innerHTML=e.localize("selectAll"),a.setAttribute("aria-hidden",!0),l.id=e.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),l.setAttribute("role","option"),l.setAttribute("value",e.localize("selectAll")),l.setAttribute("aria-label",e.localize("selectAll")),l.classList.add("smart-select-all"),l.appendChild(a),l.onclick=function(t){t.stopPropagation(),t.preventDefault(),Array.from(e.$.menu.children).find((e=>!e.classList.contains("selected")))?e._selectAll():e._clearSelection(),e._setSelectAllItemState(),l.classList.contains("selected")&&l.classList.add("active"),e.focus()},t.appendChild(l),e.$.selectAll=t}e._setSelectAllItemState(),e.$.dropDownContainer.insertBefore(e.$.selectAll,e.$.scrollView)}else e.$.selectAll&&e.$.selectAll.remove()}_setSelectAllItemState(){const e=this;if(!e.$.selectAll)return;const t=e.$.selectAll.firstElementChild,l=t.firstElementChild,a=!Array.from(e.$.menu.children).find((e=>!e.classList.contains("selected")));t.removeAttribute("indeterminate"),t.classList.remove("selected","active"),l.innerHTML=e.localize("selectAll"),e._selectedItems&&e._selectedItems.length>0&&(a?(t.classList.add("selected"),l.innerHTML=e.localize("unselectAll")):t.setAttribute("indeterminate",""))}_selectAll(){const e=this,t=e._selectedItems.length,l=e.$.input.dataValue,a=e.value;e._clearSelection(!0);const s=e.$.menu.children;for(let t=0;t<s.length;t++)s[t].classList.contains("selected")||e._performSelect({target:s[t],noActiveState:!0},!0);t!==e._selectedItems.length&&(e.$.fireEvent("change",{value:e.$.input.dataValue,label:e.value,oldValue:l,oldLabel:a}),e._updateTargetValue())}_clearSelection(e){const t=this;if(!t._selectedItems.length)return;const l=t.$.input.dataValue,a=t.value;for(t.$.input.dataValue="",t.value=t.$.input.value,t._selectedItems=[];"SPAN"===t.$.actionButton.firstElementChild.nodeName;)t.$.actionButton.removeChild(t.$.actionButton.firstElementChild);const s=t.$.menu.children;for(let e=0;e<s.length;e++)s[e].classList.remove("selected"),s[e].classList.remove("active"),s[e].setAttribute("aria-selected",!1);t._setActiveDescendant(t.$.menu.querySelector("active")),e||(t.$.fireEvent("change",{value:"",label:"",oldValue:l,oldLabel:a}),t._updateTargetValue());const n=t.getBoundingClientRect(),o=window.scrollX,i=window.scrollY;t.$.dropDownContainer.style.left=-3+n.left+o+"px",t.$.dropDownContainer.style.top=n.bottom+i+1+"px"}_open(){const e=this,t=e.getBoundingClientRect(),l=window.scrollX,a=window.scrollY;let s=0,n=0;if(!this.opened){if(e.timer&&clearTimeout(e.timer),e.$.scrollView.classList.remove("smart-input-drop-down-menu"),e.$.dropDownContainer.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),document.body.appendChild(e.$.dropDownContainer),e.setAttribute("aria-owns",e.$.dropDownContainer.id),e.readonly||e.$.input.setAttribute("aria-controls",e.$.dropDownContainer.id),e.$.scrollView.enableShadowDOM&&!e._importedStyle&&(e.$.scrollView.importStyle(e._getStyleUrl("smart.textbox.css")),e._importedStyle=!0),"static"!==getComputedStyle(document.body).position){const e=document.body.getBoundingClientRect();s=e.left,n=e.top}e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",""),e.$.dropDownContainer.style.left=-3+t.left+l-s+"px",e.$.dropDownContainer.style.top=t.bottom+a-n+1+"px",e.$.dropDownContainer.classList.remove("open"),e.$.dropDownContainer.onpointerdown=function(){e._isPointerDown=!0},requestAnimationFrame((function(){const t=e.dropDownWidth;if(e.$.scrollView.refresh&&e.$.scrollView.refresh(),e._refreshMenu(),e.$.dropDownContainer.setAttribute("open",""),e.setAttribute("open",""),e.$.dropDownButton.setAttribute("open",""),e.$.input.setAttribute("open",""),t&&"string"==typeof t&&-1!==t.indexOf("%")){const l=parseFloat(t)/100;e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",e.offsetWidth*l+"px")}else if("auto"!==t&&t)e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",parseFloat(t)+"px");else if("auto"===t){if(e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",""),e.$.scrollView.$.scrollViewerContainer.classList.contains("vscroll")){const t=e.$.scrollView.offsetWidth+parseFloat(getComputedStyle(e.$.scrollView).getPropertyValue("--smart-scroll-bar-size"));e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",t+"px")}}else{e.$.menu.style.width="auto";let t=e.$.menu.offsetWidth;const l=e.$.menu.querySelectorAll("li");for(let t=0;t<l.length;t++)e._maxDropDownWidth=Math.max((l[t].firstElementChild||l[t]).offsetWidth,e._maxDropDownWidth);e.$.scrollView.computedVerticalScrollBarVisibility&&(t+=e.$.scrollView.$&&e.$.scrollView.$.verticalScrollBar?e.$.scrollView.$.verticalScrollBar.offsetWidth:30),e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",Math.max(t,e.offsetWidth-8)+"px"),e.$.menu.style.width=""}(e.shadowRoot||e.isInShadowDOM)&&e.$.scrollView._scrollView&&Smart.ScrollBar&&requestAnimationFrame((()=>e.$.scrollView._scrollView.vScrollBar.refresh()))})),e.$.scrollView.refresh&&e.$.scrollView.refresh(),e._refreshMenu(),this.opened=!0,e.setAttribute("aria-expanded",!0)}}close(){const e=this;return!!e.opened&&(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((function(){e.$.dropDownContainer.parentNode&&!e.opened&&(document.body.removeChild(e.$.dropDownContainer),e.removeAttribute("aria-owns"),e.readonly||e.$.input.removeAttribute("aria-controls"))}),1e3),e.$.dropDownContainer.removeAttribute("open"),e.$.dropDownButton.removeAttribute("open"),e.$.input.removeAttribute("open"),e.removeAttribute("open"),e.opened=!1,e.setAttribute("aria-expanded",!1),e.focus(),e.$.fireEvent("close"),!0)}});
|
|
1596
|
+
Smart("smart-multi-combo-input",class extends Smart.CheckInput{static get properties(){return{allowItemsAdd:{value:!1,type:"boolean"},allowItemsRemove:{value:!1,type:"boolean"},autoAddNewTags:{value:!0,type:"boolean"},colorItems:{value:!0,type:"boolean"},inputTagsMode:{allowedValues:["one","many"],value:"many",type:"string"},hideInputTagsCloseButton:{value:!1,type:"boolean"},messages:{value:{en:{newItem:"New item",tagLabelOne:"{{value}} item selected",tagLabel:"{{value}} items selected",selectAll:"Select All",unselectAll:"Unselect All"}},type:"object",extend:!0},pills:{value:!1,type:"boolean"},singleSelect:{value:!1,type:"boolean"},selectAll:{value:!1,type:"boolean"}}}template(){return'<div id="inputContainer" role="presentation"><div id="optionsContainer" inner-h-t-m-l=\'{{innerHTML}}\' class="smart-hidden"></div><div class="smart-action-button" role="presentation" id="actionButton"> <input class="smart-input" id=\'input\' readonly=\'[[readonly]]\' placeholder=\'[[placeholder]]\' type=\'[[type]]\' name=\'[[name]]\' disabled=\'[[disabled]]\' aria-label="[[placeholder]]" /></div><span class="smart-hidden smart-hint" id="span">[[hint]]</span><div id="dropDownButton" tabindex=-1 class="smart-drop-down-button" role="button" aria-label="Toggle popup"><div id="arrow" class="arrow" aria-hidden="true"></div></div></div>'}_downHandler(e){const t=this,l=e.originalEvent.target;t.readonly&&l&&l.classList&&!l.classList.contains("smart-drop-down-list-unselect-button")?t._dropDownButtonDownHandler(e):t._tokenCloseButtonClick!==l.closest(".smart-drop-down-list-unselect-button")&&(t._tokenCloseButtonClick=l.closest(".smart-drop-down-list-unselect-button"),t.readonly&&t._dropDownButtonDownHandler(e))}focus(){const e=this;e.readonly?HTMLElement.prototype.focus.apply(e,[]):e.$.input.focus()}_setFocusable(){const e=this;if(e.readonly){if(e.disabled||e.unfocusable)return void e.removeAttribute("tabindex");e.tabIndex=e.tabIndex>0?e.tabIndex:0,e.$.listen("keydown",e._keyDownHandler),e.$.listen("keyup",e._keyUpHandler)}}_documentUpHandler(e){const t=this,l=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(l!==t&&l!==t.$.dropDownButton&&l!==t.$.input&&l!==t.$.arrow){if(t._tokenCloseButtonClick&&t._tokenCloseButtonClick===l.closest(".smart-drop-down-list-unselect-button")){const e=l.closest(".smart-token"),[a,s]=[e.getAttribute("data-label"),e.getAttribute("value")],n=t._selectedItems.findIndex((e=>a===e.label&&s===e.value)),[o,i]=[t.value,t.$.input.dataValue];let r,d;return n>-1&&t._selectedItems.splice(n,1),t.set("value",d=t._selectedItems.map((e=>e.label)).join(t.separator)),t.$.input.dataValue=r=t._selectedItems.map((e=>e.value)).join(t.separator),t._updateValue(),t.$.actionButton.contains(e)&&t.$.actionButton.removeChild(e),t.close(),void(d===o&&r===i||(t.$.fireEvent("change",{value:r,label:d,oldValue:i,oldLabel:o}),t._updateTargetValue()))}if(!t.contains(l))if(t.$.dropDownContainer.contains(l.shadowParent||l)){if(t._isPointerDown){if(t._isPointerDown=!1,t.opened&&(t._preventLookup=!0),l.hasAttribute("add-new"))return;t.focus()}}else t.opened&&(t._preventLookup=!0),t._isPointerDown||t.close(),t._isPointerDown=!1}else t._isPointerDown=!1}get selectedItems(){return this._selectedItems?this._selectedItems:[]}set selectedItems(e){this._selectedItems=e,this._updateValue()}_performSelect(e,t){const l=this;if(!e)return void l.close();const a=e.target?e.target.closest("li"):e;if(!a)return;l._selectedItems||(l._selectedItems=[]),a.classList.toggle("selected"),l.singleSelect&&(l._selectedItems=[],a.classList.add("selected"));const s=a.classList.contains("selected"),n={label:a.getAttribute("data-label"),value:a.getAttribute("value"),color:a.getAttribute("color"),image:a.getAttribute("image")},o=l.$.menu.children;for(let e=0;e<o.length;e++)l.singleSelect&&o[e]!==a&&o[e].classList.remove("selected"),o[e].classList.remove("active"),o[e].setAttribute("aria-selected",!1);if(s){if(l.dataSource&&l.dataSource[0]&&"string"==typeof l.dataSource[0])l._selectedItems.push(n);else{const e=l.dataSource.findIndex((e=>e.label===n.label&&""+e.value===n.value));l.dataSource&&e>=0?l._selectedItems.push(l.dataSource[e]):l._selectedItems.push(n)}if(e.noActiveState||(l._setActiveDescendant(a),a.classList.add("active")),l.dataSource)if(l.dataSource[0]&&"string"==typeof l.dataSource[0]){const e=l.dataSource.findIndex((e=>e===n.label));l.set("selectedIndex",e)}else{const e=l.dataSource.findIndex((e=>e.label===n.label&&""+e.value===n.value));l.set("selectedIndex",e)}}else{if(l.dataSource&&l.dataSource[0]&&"string"==typeof l.dataSource[0]){const e=l.dataSource.findIndex((e=>e===n.label));if(e>-1){const e=l._selectedItems.findIndex((e=>e===n.label));l._selectedItems.splice(e,1),l.set("selectedIndex",-1)}else l.set("selectedIndex",e)}else{const e=l.dataSource.findIndex((e=>e.label===n.label&&""+e.value===n.value));if(l.dataSource)if(e>-1){const e=l._selectedItems.findIndex((e=>e.label===n.label&&""+e.value===n.value));l._selectedItems.splice(e,1),l.set("selectedIndex",-1)}else l.set("selectedIndex",e)}a.classList.remove("active")}a.setAttribute("aria-selected",s),l._updateValue(t),l.singleSelect&&l.close()}_updateValue(e){const t=this;if(!t.isInitialized)return;let l=t._selectedItems,a=t.value,s=t.$.input.dataValue,[n,o]=[[],[]];l||(l=[]);for(let e=0;e<l.length;e++){const t=l[e];t?"string"==typeof t?(n.push(t),o.push(t)):(n.push(t.label),o.push(t.value)):(n.push(""),o.push(""))}if(t._createTags(),l&&l.length>0&&"string"==typeof l[0]?t.set("selectedValues",l):t.set("selectedValues",l.map((e=>e.value))),n=n.join(t.separator),t.set("value",n),t.$.input.dataValue=o=o.join(t.separator),t.$.input.value="",t.setAttribute("value",t.value),e||n===a&&o===s||(t.$.fireEvent("change",{value:o,label:n,oldValue:s,oldLabel:a}),t._updateTargetValue()),t.selectAll&&t._setSelectAllItemState(),!t.opened)return;const i=t.getBoundingClientRect(),r=window.scrollX,d=window.scrollY;t.$.dropDownContainer.style.left=-3+i.left+r+"px",t.$.dropDownContainer.style.top=i.bottom+d+1+"px"}_setSelection(){const e=this;super._setSelection(),e.singleSelect&&(e._selectedItems.length>0&&(e._selectedItems=[e._selectedItems[e._selectedItems.length-1]]),e.selectedValues.length>0&&(e.selectedValues=[e.selectedValues[e.selectedValues.length-1]])),this._createTags()}_createTags(){const e=this,t=e._selectedItems||[];let l,a=document.createDocumentFragment();for(;"SPAN"===e.$.actionButton.firstElementChild.nodeName;)e.$.actionButton.removeChild(e.$.actionButton.firstElementChild);if(0===t.length&&"one"===e.inputTagsMode&&e.readonly){const s="one"===e.inputTagsMode?t.length>1?e.localize("tagLabel",{value:t.length,count:e.dataSource.length}):e.localize("tagLabelOne",{value:t.length,count:e.dataSource.length}):"";l=document.createElement("span"),l.classList.add("smart-token"),l.innerHTML="<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+s+"</span>",a.appendChild(l)}for(let s=0;s<t.length;s++){const n=t[s];if("one"===e.inputTagsMode&&!l||"many"===e.inputTagsMode){let s="one"===e.inputTagsMode?t.length>1?e.localize("tagLabel",{value:t.length,count:e.dataSource.length}):e.localize("tagLabelOne",{value:t.length,count:e.dataSource.length}):"string"==typeof n?n:n.label;"many"===e.inputTagsMode&&void 0===s&&(s=""),l=document.createElement("span"),l.classList.add("smart-token");let o=null,i="";if(n.image&&"many"===e.inputTagsMode&&(o=document.createElement("span"),o.style.backgroundImage=`url('${n.image}')`,o.className="smart-drop-down-list-selection-image",i=o.outerHTML),l.innerHTML=i+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+s+"</span>",e.singleSelect||"one"===e.inputTagsMode||(l.innerHTML+='<span class=\'smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span>'),"many"===e.inputTagsMode){n.label?(l.setAttribute("data-label",n.label),l.setAttribute("value",n.value)):(l.setAttribute("data-label",""),l.setAttribute("value","")),l.setAttribute("separator",e.separator);const t=n.color;if(t&&e.colorItems){l.setAttribute("color",t),l.style.setProperty("--smart-primary",t);const e=new Smart.Color(t).getInvertedColor();l.style.setProperty("--smart-primary-color",e)}}if(""===s&&e.singleSelect)continue;a.appendChild(l)}}e.$.actionButton.insertBefore(a,e.$.input);const s=e.getBoundingClientRect(),n=window.scrollX,o=window.scrollY;e.$.scrollView.style.left=-3+s.left+n+"px",e.$.scrollView.style.top=s.bottom+o+1+"px"}_render(e){const t=this,l=(e,l)=>{let a=e,s=e,n=e,o=null;"object"==typeof e&&(a=e.label,s=void 0!==e.value?e.value:a,o=void 0!==e.color?e.color:"",n=void 0!==e.id?e.id:l);const i=document.createElement("li"),r=document.createElement("a");if(r.href="#",i.id=t.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),i.setAttribute("data-label",a),i.setAttribute("value",s),i.setAttribute("role","option"),i.setAttribute("aria-selected",!1),i.setAttribute("aria-label",a),void 0!==n&&(i.id=n),o&&t.colorItems){i.setAttribute("color",o),i.style.setProperty("--smart-primary",o);const e=new Smart.Color(o).getInvertedColor();i.style.setProperty("--smart-primary-color",e)}if(r.innerHTML=t.highlighter?t.highlighter(a):t._highlighter(a),r.setAttribute("aria-hidden",!0),e.icon&&(r.classList.add("icon"),r.classList.add(e.icon)),e.image){const t=document.createElement("span");t.style.backgroundImage=`url('${e.image}')`,t.className="smart-drop-down-list-selection-image",i.setAttribute("image",e.image),r.innerHTML=t.outerHTML+r.innerHTML}if(i.appendChild(r),t.allowItemsRemove){const l=document.createElement("span");l.classList.add("close-button"),r.appendChild(l),l.onpointerdown=l=>{l.preventDefault(),l.stopPropagation();const n=t.dataSource.findIndex((t=>t.value===e.value));if(n>=0){if(t.dataSource.splice(n,1),i.remove(),t.$.scrollView.refresh&&t.$.scrollView.refresh(),"one"===t.inputTagsMode){const e=t._selectedItems.findIndex((e=>e.label===a&&e.value===s));e>=0&&t._selectedItems.splice(e,1),t._createTags()}t.$.fireEvent("remove",{index:n,label:e.label,value:e.value})}}}return(t.singleSelect&&""===e||t.singleSelect&&e&&""===e.label)&&(i.innerHTML=""),i},a=e.map((function(e,t){return l(e,t)}));t.$.menu.innerHTML="",t._selectedItems||(t._selectedItems=[]);let s=t._selectedItems.map((e=>"string"==typeof e?e:e.value));s.length||(s=(t.$.input.dataValue||t.$.input.value).split(t.separator).map((e=>e.trim())));let n=Array.from(t.$.actionButton.getElementsByClassName("smart-token")).map((e=>e.textContent.trim()));if(t.allowItemsAdd){const e=document.createElement("div"),a=document.createElement("smart-button"),s=document.createElement("input");e.classList.add("add-new-item"),a.setAttribute("add-new",""),s.setAttribute("add-new",""),s.placeholder=t.localize("newItem"),s.classList.add("smart-input"),a.onclick=()=>{if(!s.value)return;const e={label:s.value,value:s.value.trim().replace(/ /gi,"")};t.dataSource||(t.dataSource=[]),t.dataSource.push(e);const a=l(e,t.dataSource.length-1);t.$.menu.appendChild(a),t.$.scrollView.refresh&&t.$.scrollView.refresh(),s.value="","one"===t.inputTagsMode&&t._createTags(),t.$.fireEvent("add",{label:e.label,value:e.value,index:t.dataSource.length-1})},s.onkeydown=e=>{"Enter"===e.key&&a.click()},e.appendChild(s),e.appendChild(a),t.$.menu.appendChild(e)}for(let e=0;e<a.length;e++){const l=a[e],o=l.getAttribute("value"),i=l.getAttribute("data-label"),r=s.findIndex((e=>""+e==""+o));r>-1&&("one"===t.inputTagsMode||n[r]===i)&&(l.classList.add("selected"),l.setAttribute("aria-selected",!0),t._setActiveDescendant(l),t._selectedItems.findIndex((e=>"string"==typeof e?e===i:e.label===i&&e.value===o))<0&&t._selectedItems.findIndex((e=>"string"==typeof e?e===o:""+e.value==""+o))<0&&t._selectedItems.push({label:l.getAttribute("data-label"),value:l.getAttribute("value")})),t._setSelectAllItemState(),t.$.menu.appendChild(l)}}_next(){const e=this;let t=e._selectedItems?e._selectedItems[e._selectedItems.length-1]:void 0;t&&(t=e.$.menu.querySelector(`.active[data-label="${t.label}"][value="${t.value}"]`));const l=t||e.$.menu.querySelector(".active");if(!l){const t=e.$.menu.firstElementChild;return t.classList.add("active","focused"),void e._setActiveDescendant(t)}const a=e.$.menu.children;for(let e=0;e<a.length;e++)a[e].classList.remove("active","focused");e._setActiveDescendant();let s=l.nextElementSibling;s||(s=e.$.menu.firstElementChild),s.classList.add("active","focused"),e._setActiveDescendant(s),e.ensureVisible()}_prev(){const e=this;let t=e._selectedItems?e._selectedItems[e._selectedItems.length-1]:void 0;t&&(t=e.$.menu.querySelector(`.active[data-label="${t.label}"][value="${t.value}"]`));const l=t||e.$.menu.querySelector(".active");if(!l){const t=e.$.menu.firstElementChild;return t.classList.add("active","focused"),void e._setActiveDescendant(t)}const a=e.$.menu.children;for(let e=0;e<a.length;e++)a[e].classList.remove("active","focused");e._setActiveDescendant();let s=l.previousElementSibling;s||(s=e.$.menu.lastElementChild),s.classList.add("active","focused"),e._setActiveDescendant(s),e.ensureVisible()}_keyDownHandler(e){const t=this;t._suppressKeyPressRepeat=![40,38,9,13,27,16,17,18].includes(e.keyCode),e.shiftKey||e.altKey||e.ctrlKey?delete t._inputValue:(t._move(e),t._inputValue=t.$.input.value)}_keyUpHandler(e){const t=this;let l=t.$.input.value;if(t._selectedItems&&(l=t._selectedItems.map((e=>e.label)),t.$.input.value&&l.push(t.$.input.value),l=l.join(t.separator)),t.set("value",l),!e.shiftKey&&"F2"!==e.key){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:40===e.keyCode&&e.altKey&&t.open(),38===e.keyCode&&e.altKey&&t.close();break;case 8:{if(t.readonly)break;if(t.opened&&t.close(),t._inputValue&&t._inputValue.length)break;if(!t._selectedItems){t.readonly||(t.$.input.dataValue=t.$.input.value);break}const e=t._selectedItems[t._selectedItems.length-1];if(!e)break;t.$.menu.querySelector(`li[data-label="${e.label}"][value="${e.value}"]`)&&(t._selectedItems.pop(),t._updateValue());break}case 9:case 13:if(!t.opened)return void(t.autoAddNewTags&&13===e.keyCode&&"many"===t.inputTagsMode&&t._autoCreateTags());t._performSelect(t.$.menu.querySelector(".active")),e.stopPropagation(),e.preventDefault();break;case 27:if(!t.opened)return;t.close(),e.stopPropagation(),e.preventDefault();break;default:t._lookup(e),!t.opened||e.ctrlKey||e.shiftKey||(e.stopPropagation(),e.preventDefault())}delete t._inputValue}}_blurHandler(){super._blurHandler(),this._autoCreateTags()}_autoCreateTags(){const e=this;if(!e.autoAddNewTags||"many"===!e.inputTagsMode)return;e.dataSource||(e.dataSource=[]);const t=e.$.input.value.trim();if(!e.dataSource.find((e=>"string"==typeof e?e===t:e.label===t))){e._tempItems||(e._tempItems=[]);let l=t.trim();if(t.indexOf(",")>=0){l=t.split(",");for(let t=0;t<l.length;t++){const a=l[t].trim();""!==a&&(e._tempItems.push(a),e._creteaTagsFromValue(a))}}else""!==l&&(e._tempItems.push(l),e._creteaTagsFromValue(l));e.query="",e._updateValue(!0)}}propertyChangedHandler(e,t,l){const a=this;if("disabled"===e&&a._setFocusable(),"value"===e){a.displayMember!==a.valueMember&&"string"!=typeof l?(a.value=l[a.displayMember],a.$.input.dataValue=l[a.valueMember]):a.$.input.dataValue="";const e=a.$.menu.children;for(let t=0;t<e.length;t++)e[t].classList.remove("selected"),e[t].setAttribute("aria-selected",!1);a._setActiveDescendant(a.$.menu.querySelector("active")),a._creteaTagsFromValue(l)}else if("separator"===e){const e=a.$.actionButton.children;for(let t=0;t<e.length;t++){const a=e[t];a.classList.contains("smart-token")&&a.setAttribute("separator",l)}}else if("inputTagsMode"===e)a._createTags();else if("theme"===e||"rightToLeft"===e)a.$.scrollView[e]=l,l?a.$.dropDownContainer.setAttribute(Smart.Utilities.Core.toDash(e),""):a.$.dropDownContainer.removeAttribute(Smart.Utilities.Core.toDash(e));else if("inverted"===e)l?a.$.dropDownContainer.setAttribute("inverted",""):a.$.dropDownContainer.removeAttribute("inverted");else if("selectAll"===e)a._handleSelectAllItem();else if("selectedIndex"===e){if(super.propertyChangedHandler(e,t,l),a._selectedItems=[],a.dataSource){const e=a.dataSource[l];e&&a._selectedItems.push(e),a._updateValue(!0)}}else if("selectedValues"===e){if(super.propertyChangedHandler(e,t,l),a.dataSource){a._selectedItems=[];const e=a.dataSource.filter((e=>{if("string"==typeof e){if(a.selectedValues.indexOf(e)>=0)return!0}else if(a.selectedValues.indexOf(e.value)>=0)return!0}));a._selectedItems=e,a._updateValue(!0)}}else super.propertyChangedHandler(e,t,l)}_createElement(){const e=this,t=document.createElement("ul"),l=document.createElement("smart-scroll-viewer"),a=document.createElement("div");if(l.rightToLeft=e.rightToLeft,l.theme=e.theme,l.horizontalScrollBarVisibility="hidden",l.classList.add("smart-multi-combo-input-scroll-viewer"),e.rightToLeft&&a.setAttribute("right-to-left",""),e.dataSource&&"string"==typeof e.dataSource&&(e.dataSource=e.$.deserialize(e.dataSource,"array")),a.setAttribute("theme",e.theme),a.classList.add("smart-multi-combo-input-drop-down-menu","smart-input-drop-down-menu","smart-check-input-drop-down-menu"),e.pills&&a.setAttribute("pills",""),e.singleSelect&&a.setAttribute("single-select",""),e.inverted?a.setAttribute("inverted",""):a.removeAttribute("inverted"),e.classList.add("smart-input"),a.appendChild(l),t.setAttribute("aria-multiselectable",!0),e.$.scrollView=l,e.$.menu=t,e.$.dropDownContainer=a,e.$.menu.onclick=function(t){t.stopPropagation(),t.preventDefault(),t.target&&t.target.hasAttribute("add-new")||(e._performSelect(t),e.focus())},e.classList.add("smart-input"),e.$.input.value="",e.selectedValues&&e.selectedValues.length>0){const t=e.dataSource.filter((t=>{if("string"==typeof t){if(e.selectedValues.indexOf(t)>=0)return!0}else if(e.selectedValues.indexOf(t.value)>=0)return!0}));e.selectedItems=t}else{const t=e.value;t&&e._creteaTagsFromValue(t)}e._handleSelectAllItem(),e._setFocusable()}_creteaTagsFromValue(e=""){const t=this;if(e){const e=t.value.split(",");for(t.$.input.value="",t._selectedItems=[];"SPAN"===t.$.actionButton.firstElementChild.nodeName;)t.$.actionButton.removeChild(t.$.actionButton.firstElementChild);for(let l=0,a=e.length;l<a;l+=1){const a=e[l].trim();if(a)if(t.dataSource){const e=t.dataSource.find((e=>{if("string"==typeof e){if(e===a)return e}else if(""+e.value===a)return e}));e&&e.label?e.color?t._selectedItems.push({color:e.color,label:e.label,value:e.value}):t._selectedItems.push({label:e.label,value:e.value}):t._selectedItems.push({label:a,value:a})}else t._selectedItems.push({label:a,value:a})}t._createTags()}else t.$.input.value="",t._selectedItems=[],t._createTags()}_handleSelectAllItem(){const e=this;if(e.selectAll){if(!e.$.selectAll){const t=document.createElement("ul"),l=document.createElement("li"),a=document.createElement("a");a.href="#",a.innerHTML=e.localize("selectAll"),a.setAttribute("aria-hidden",!0),l.id=e.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),l.setAttribute("role","option"),l.setAttribute("value",e.localize("selectAll")),l.setAttribute("aria-label",e.localize("selectAll")),l.classList.add("smart-select-all"),l.appendChild(a),l.onclick=function(t){t.stopPropagation(),t.preventDefault(),Array.from(e.$.menu.children).find((e=>!e.classList.contains("selected")))?e._selectAll():e._clearSelection(),e._setSelectAllItemState(),l.classList.contains("selected")&&l.classList.add("active"),e.focus()},t.appendChild(l),e.$.selectAll=t}e._setSelectAllItemState(),e.$.dropDownContainer.insertBefore(e.$.selectAll,e.$.scrollView)}else e.$.selectAll&&e.$.selectAll.remove()}_setSelectAllItemState(){const e=this;if(!e.$.selectAll)return;const t=e.$.selectAll.firstElementChild,l=t.firstElementChild,a=!Array.from(e.$.menu.children).find((e=>!e.classList.contains("selected")));t.removeAttribute("indeterminate"),t.classList.remove("selected","active"),l.innerHTML=e.localize("selectAll"),e._selectedItems&&e._selectedItems.length>0&&(a?(t.classList.add("selected"),l.innerHTML=e.localize("unselectAll")):t.setAttribute("indeterminate",""))}_selectAll(){const e=this,t=e._selectedItems.length,l=e.$.input.dataValue,a=e.value;e._clearSelection(!0);const s=e.$.menu.children;for(let t=0;t<s.length;t++)s[t].classList.contains("selected")||e._performSelect({target:s[t],noActiveState:!0},!0);t!==e._selectedItems.length&&(e.$.fireEvent("change",{value:e.$.input.dataValue,label:e.value,oldValue:l,oldLabel:a}),e._updateTargetValue())}_clearSelection(e){const t=this;if(!t._selectedItems.length)return;const l=t.$.input.dataValue,a=t.value;for(t.$.input.dataValue="",t.value=t.$.input.value,t._selectedItems=[];"SPAN"===t.$.actionButton.firstElementChild.nodeName;)t.$.actionButton.removeChild(t.$.actionButton.firstElementChild);const s=t.$.menu.children;for(let e=0;e<s.length;e++)s[e].classList.remove("selected"),s[e].classList.remove("active"),s[e].setAttribute("aria-selected",!1);t._setActiveDescendant(t.$.menu.querySelector("active")),e||(t.$.fireEvent("change",{value:"",label:"",oldValue:l,oldLabel:a}),t._updateTargetValue());const n=t.getBoundingClientRect(),o=window.scrollX,i=window.scrollY;t.$.dropDownContainer.style.left=-3+n.left+o+"px",t.$.dropDownContainer.style.top=n.bottom+i+1+"px"}_open(){const e=this,t=e.getBoundingClientRect(),l=window.scrollX,a=window.scrollY;let s=0,n=0;if(!this.opened){if(e.timer&&clearTimeout(e.timer),e.$.scrollView.classList.remove("smart-input-drop-down-menu"),e.$.dropDownContainer.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),document.body.appendChild(e.$.dropDownContainer),e.setAttribute("aria-owns",e.$.dropDownContainer.id),e.readonly||e.$.input.setAttribute("aria-controls",e.$.dropDownContainer.id),e.$.scrollView.enableShadowDOM&&!e._importedStyle&&(e.$.scrollView.importStyle(e._getStyleUrl("smart.textbox.css")),e._importedStyle=!0),"static"!==getComputedStyle(document.body).position){const e=document.body.getBoundingClientRect();s=e.left,n=e.top}e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",""),e.$.dropDownContainer.style.left=-3+t.left+l-s+"px",e.$.dropDownContainer.style.top=t.bottom+a-n+1+"px",e.$.dropDownContainer.classList.remove("open"),e.$.dropDownContainer.onpointerdown=function(){e._isPointerDown=!0},requestAnimationFrame((function(){const t=e.dropDownWidth;if(e.$.scrollView.refresh&&e.$.scrollView.refresh(),e._refreshMenu(),e.$.dropDownContainer.setAttribute("open",""),e.setAttribute("open",""),e.$.dropDownButton.setAttribute("open",""),e.$.input.setAttribute("open",""),t&&"string"==typeof t&&-1!==t.indexOf("%")){const l=parseFloat(t)/100;e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",e.offsetWidth*l+"px")}else if("auto"!==t&&t)e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",parseFloat(t)+"px");else if("auto"===t){if(e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",""),e.$.scrollView.$.scrollViewerContainer.classList.contains("vscroll")){const t=e.$.scrollView.offsetWidth+parseFloat(getComputedStyle(e.$.scrollView).getPropertyValue("--smart-scroll-bar-size"));e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",t+"px")}}else{e.$.menu.style.width="auto";let t=e.$.menu.offsetWidth;const l=e.$.menu.querySelectorAll("li");for(let t=0;t<l.length;t++)e._maxDropDownWidth=Math.max((l[t].firstElementChild||l[t]).offsetWidth,e._maxDropDownWidth);e.$.scrollView.computedVerticalScrollBarVisibility&&(t+=e.$.scrollView.$&&e.$.scrollView.$.verticalScrollBar?e.$.scrollView.$.verticalScrollBar.offsetWidth:30),e.$.dropDownContainer.style.setProperty("--smart-input-drop-down-menu-width",Math.max(t,e.offsetWidth-8)+"px"),e.$.menu.style.width=""}(e.shadowRoot||e.isInShadowDOM)&&e.$.scrollView._scrollView&&Smart.ScrollBar&&requestAnimationFrame((()=>e.$.scrollView._scrollView.vScrollBar.refresh()))})),e.$.scrollView.refresh&&e.$.scrollView.refresh(),e._refreshMenu(),this.opened=!0,e.setAttribute("aria-expanded",!0)}}close(){const e=this;return!!e.opened&&(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((function(){e.$.dropDownContainer.parentNode&&!e.opened&&(document.body.removeChild(e.$.dropDownContainer),e.removeAttribute("aria-owns"),e.readonly||e.$.input.removeAttribute("aria-controls"))}),1e3),e.$.dropDownContainer.removeAttribute("open"),e.$.dropDownButton.removeAttribute("open"),e.$.input.removeAttribute("open"),e.removeAttribute("open"),e.opened=!1,e.setAttribute("aria-expanded",!1),e.focus(),e.$.fireEvent("close"),!0)}});
|
|
1597
1597
|
|
|
1598
1598
|
/***/ }),
|
|
1599
1599
|
|
|
@@ -1882,7 +1882,7 @@ var __webpack_exports__ = {};
|
|
|
1882
1882
|
/* harmony import */ var _smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(5306);
|
|
1883
1883
|
/* harmony import */ var _smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61___default = /*#__PURE__*/__webpack_require__.n(_smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61__);
|
|
1884
1884
|
|
|
1885
|
-
/* Smart UI v14.2.
|
|
1885
|
+
/* Smart UI v14.2.89 (2022-09-14)
|
|
1886
1886
|
Copyright (c) 2011-2022 jQWidgets.
|
|
1887
1887
|
License: https://htmlelements.com/license/ */ //
|
|
1888
1888
|
|