smart-webcomponents-react 18.0.2 → 18.0.11
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.d.ts +2 -0
- package/accordion/accordion.esm.js +1 -1
- package/accordion/accordion.umd.js +2 -3
- package/accordion/accordionitem.d.ts +2 -0
- package/alertwindow/alertwindow.d.ts +2 -0
- package/alertwindow/alertwindow.esm.js +1 -1
- package/alertwindow/alertwindow.umd.js +2 -3
- package/array/array.d.ts +2 -0
- package/array/array.esm.js +1 -1
- package/array/array.umd.js +2 -3
- package/barcode/barcode.d.ts +2 -0
- package/barcode/barcode.esm.js +1 -1
- package/barcode/barcode.umd.js +2 -3
- package/breadcrumb/breadcrumb.d.ts +2 -0
- package/breadcrumb/breadcrumb.esm.js +1 -1
- package/breadcrumb/breadcrumb.umd.js +2 -3
- package/button/button.d.ts +2 -0
- package/button/button.esm.js +1 -1
- package/button/button.umd.js +2 -3
- package/button/buttongroup.d.ts +2 -0
- package/button/dropdownbutton.d.ts +2 -0
- package/button/multisplitbutton.d.ts +2 -0
- package/button/powerbutton.d.ts +2 -0
- package/button/radiobutton.d.ts +2 -0
- package/button/repeatbutton.d.ts +2 -0
- package/button/switchbutton.d.ts +2 -0
- package/button/togglebutton.d.ts +2 -0
- package/buttongroup/buttongroup.d.ts +2 -0
- package/buttongroup/buttongroup.esm.js +1 -1
- package/buttongroup/buttongroup.umd.js +2 -3
- package/calendar/calendar.d.ts +7 -0
- package/calendar/calendar.esm.js +13 -2
- package/calendar/calendar.umd.js +14 -4
- package/card/card.d.ts +2 -0
- package/card/card.esm.js +1 -1
- package/card/card.umd.js +2 -3
- package/card/cardview.d.ts +2 -0
- package/cardview/cardview.d.ts +2 -0
- package/cardview/cardview.esm.js +1 -1
- package/cardview/cardview.umd.js +2 -3
- package/carousel/carousel.d.ts +2 -0
- package/carousel/carousel.esm.js +1 -1
- package/carousel/carousel.umd.js +2 -3
- package/chart/chart.d.ts +2 -0
- package/chart/chart.esm.js +1 -1
- package/chart/chart.umd.js +2 -3
- package/chart/ganttchart.d.ts +2 -0
- package/chart/threedchart.d.ts +2 -0
- package/checkbox/checkbox.d.ts +2 -0
- package/checkbox/checkbox.esm.js +1 -1
- package/checkbox/checkbox.umd.js +2 -3
- package/checkinput/checkinput.d.ts +2 -0
- package/checkinput/checkinput.esm.js +1 -1
- package/checkinput/checkinput.umd.js +2 -3
- package/chip/chip.d.ts +2 -0
- package/chip/chip.esm.js +1 -1
- package/chip/chip.umd.js +2 -3
- package/colorinput/colorinput.d.ts +2 -0
- package/colorinput/colorinput.esm.js +1 -1
- package/colorinput/colorinput.umd.js +2 -3
- package/colorpanel/colorpanel.d.ts +2 -0
- package/colorpanel/colorpanel.esm.js +1 -1
- package/colorpanel/colorpanel.umd.js +2 -3
- package/colorpicker/colorpicker.d.ts +2 -0
- package/colorpicker/colorpicker.esm.js +1 -1
- package/colorpicker/colorpicker.umd.js +2 -3
- package/columnpanel/columnpanel.d.ts +2 -0
- package/columnpanel/columnpanel.esm.js +1 -1
- package/columnpanel/columnpanel.umd.js +2 -3
- package/combobox/combobox.d.ts +2 -0
- package/combobox/combobox.esm.js +1 -1
- package/combobox/combobox.umd.js +2 -3
- package/countryinput/countryinput.d.ts +2 -0
- package/countryinput/countryinput.esm.js +1 -1
- package/countryinput/countryinput.umd.js +2 -3
- package/customizationdialog/customizationdialog.d.ts +2 -0
- package/customizationdialog/customizationdialog.esm.js +1 -1
- package/customizationdialog/customizationdialog.umd.js +2 -3
- package/dateinput/dateinput.d.ts +2 -0
- package/dateinput/dateinput.esm.js +1 -1
- package/dateinput/dateinput.umd.js +2 -3
- package/daterangeinput/daterangeinput.d.ts +2 -0
- package/daterangeinput/daterangeinput.esm.js +1 -1
- package/daterangeinput/daterangeinput.umd.js +2 -3
- package/datetimepicker/datetimepicker.d.ts +2 -0
- package/datetimepicker/datetimepicker.esm.js +1 -1
- package/datetimepicker/datetimepicker.umd.js +2 -3
- package/dialogwindow/dialogwindow.d.ts +2 -0
- package/dialogwindow/dialogwindow.esm.js +1 -1
- package/dialogwindow/dialogwindow.umd.js +2 -3
- package/dockinglayout/dockinglayout.d.ts +2 -0
- package/dockinglayout/dockinglayout.esm.js +1 -1
- package/dockinglayout/dockinglayout.umd.js +2 -3
- package/dropdownbutton/dropdownbutton.d.ts +2 -0
- package/dropdownbutton/dropdownbutton.esm.js +1 -1
- package/dropdownbutton/dropdownbutton.umd.js +2 -3
- package/dropdownlist/dropdownlist.d.ts +2 -0
- package/dropdownlist/dropdownlist.esm.js +1 -1
- package/dropdownlist/dropdownlist.umd.js +2 -3
- package/editor/editor.d.ts +2 -0
- package/editor/editor.esm.js +1 -1
- package/editor/editor.umd.js +2 -3
- package/element/element.d.ts +2 -0
- package/element/element.esm.js +1 -1
- package/element/element.umd.js +2 -3
- package/fileupload/fileupload.d.ts +2 -0
- package/fileupload/fileupload.esm.js +1 -1
- package/fileupload/fileupload.umd.js +2 -3
- package/filterbuilder/filterbuilder.d.ts +2 -0
- package/filterbuilder/filterbuilder.esm.js +1 -1
- package/filterbuilder/filterbuilder.umd.js +2 -3
- package/filterpanel/filterpanel.d.ts +2 -0
- package/filterpanel/filterpanel.esm.js +1 -1
- package/filterpanel/filterpanel.umd.js +2 -3
- package/filterpanel/multicolumnfilterpanel.d.ts +2 -0
- package/form/form.d.ts +2 -0
- package/form/form.esm.js +1 -1
- package/form/form.umd.js +2 -3
- package/form/formcontrol.d.ts +2 -0
- package/form/formgroup.d.ts +2 -0
- package/ganttchart/ganttchart.d.ts +2 -0
- package/ganttchart/ganttchart.esm.js +1 -1
- package/ganttchart/ganttchart.umd.js +2 -3
- package/gauge/gauge.d.ts +2 -0
- package/gauge/gauge.esm.js +1 -1
- package/gauge/gauge.umd.js +2 -3
- package/grid/grid.d.ts +23 -12
- package/grid/grid.esm.js +25 -14
- package/grid/grid.umd.js +26 -16
- package/grouppanel/grouppanel.d.ts +2 -0
- package/grouppanel/grouppanel.esm.js +1 -1
- package/grouppanel/grouppanel.umd.js +2 -3
- package/index.d.ts +54 -3
- package/input/checkinput.d.ts +2 -0
- package/input/colorinput.d.ts +2 -0
- package/input/countryinput.d.ts +2 -0
- package/input/dateinput.d.ts +2 -0
- package/input/daterangeinput.d.ts +2 -0
- package/input/input.d.ts +2 -0
- package/input/input.esm.js +1 -1
- package/input/input.umd.js +2 -3
- package/input/multicomboinput.d.ts +2 -0
- package/input/multiinput.d.ts +2 -0
- package/input/numberinput.d.ts +2 -0
- package/input/passwordinput.d.ts +2 -0
- package/input/phoneinput.d.ts +2 -0
- package/input/timeinput.d.ts +2 -0
- package/kanban/kanban.d.ts +2 -0
- package/kanban/kanban.esm.js +1 -1
- package/kanban/kanban.umd.js +2 -3
- package/layout/dockinglayout.d.ts +2 -0
- package/layout/layout.d.ts +2 -0
- package/layout/layout.esm.js +1 -1
- package/layout/layout.umd.js +2 -3
- package/layout/layoutgroup.d.ts +2 -0
- package/layout/layoutitem.d.ts +2 -0
- package/layout/tablayoutgroup.d.ts +2 -0
- package/layout/tablayoutitem.d.ts +2 -0
- package/led/led.d.ts +2 -0
- package/led/led.esm.js +1 -1
- package/led/led.umd.js +2 -3
- package/listbox/listbox.d.ts +2 -0
- package/listbox/listbox.esm.js +1 -1
- package/listbox/listbox.umd.js +2 -3
- package/listmenu/listmenu.d.ts +2 -0
- package/listmenu/listmenu.esm.js +1 -1
- package/listmenu/listmenu.umd.js +2 -3
- package/map/map.d.ts +2 -0
- package/map/map.esm.js +1 -1
- package/map/map.umd.js +2 -3
- package/maskedtextbox/maskedtextbox.d.ts +2 -0
- package/maskedtextbox/maskedtextbox.esm.js +1 -1
- package/maskedtextbox/maskedtextbox.umd.js +2 -3
- package/menu/listmenu.d.ts +2 -0
- package/menu/menu.d.ts +2 -0
- package/menu/menu.esm.js +1 -1
- package/menu/menu.umd.js +2 -3
- package/menu/menuitem.d.ts +2 -0
- package/menu/menuitemsgroup.d.ts +2 -0
- package/multicolumnfilterpanel/multicolumnfilterpanel.d.ts +2 -0
- package/multicolumnfilterpanel/multicolumnfilterpanel.esm.js +1 -1
- package/multicolumnfilterpanel/multicolumnfilterpanel.umd.js +2 -3
- package/multicomboinput/multicomboinput.d.ts +2 -0
- package/multicomboinput/multicomboinput.esm.js +1 -1
- package/multicomboinput/multicomboinput.umd.js +2 -3
- package/multiinput/multiinput.d.ts +2 -0
- package/multiinput/multiinput.esm.js +1 -1
- package/multiinput/multiinput.umd.js +2 -3
- package/multilinetextbox/multilinetextbox.d.ts +2 -0
- package/multilinetextbox/multilinetextbox.esm.js +1 -1
- package/multilinetextbox/multilinetextbox.umd.js +2 -3
- package/multilinewindow/multilinewindow.d.ts +2 -0
- package/multilinewindow/multilinewindow.esm.js +1 -1
- package/multilinewindow/multilinewindow.umd.js +2 -3
- package/multisplitbutton/multisplitbutton.d.ts +2 -0
- package/multisplitbutton/multisplitbutton.esm.js +1 -1
- package/multisplitbutton/multisplitbutton.umd.js +2 -3
- package/numberinput/numberinput.d.ts +2 -0
- package/numberinput/numberinput.esm.js +1 -1
- package/numberinput/numberinput.umd.js +2 -3
- package/numerictextbox/numerictextbox.d.ts +2 -0
- package/numerictextbox/numerictextbox.esm.js +1 -1
- package/numerictextbox/numerictextbox.umd.js +2 -3
- package/package.json +1 -1
- package/pager/pager.d.ts +2 -0
- package/pager/pager.esm.js +1 -1
- package/pager/pager.umd.js +2 -3
- package/passwordinput/passwordinput.d.ts +2 -0
- package/passwordinput/passwordinput.esm.js +1 -1
- package/passwordinput/passwordinput.umd.js +2 -3
- package/passwordtextbox/passwordtextbox.d.ts +2 -0
- package/passwordtextbox/passwordtextbox.esm.js +1 -1
- package/passwordtextbox/passwordtextbox.umd.js +2 -3
- package/path/path.d.ts +2 -0
- package/path/path.esm.js +1 -1
- package/path/path.umd.js +2 -3
- package/phoneinput/phoneinput.d.ts +2 -0
- package/phoneinput/phoneinput.esm.js +1 -1
- package/phoneinput/phoneinput.umd.js +2 -3
- package/pivottable/pivottable.d.ts +2 -0
- package/pivottable/pivottable.esm.js +1 -1
- package/pivottable/pivottable.umd.js +2 -3
- package/progressbar/circularprogressbar.d.ts +2 -0
- package/progressbar/progressbar.d.ts +2 -0
- package/progressbar/progressbar.esm.js +1 -1
- package/progressbar/progressbar.umd.js +2 -3
- package/progresswindow/progresswindow.d.ts +2 -0
- package/progresswindow/progresswindow.esm.js +1 -1
- package/progresswindow/progresswindow.umd.js +2 -3
- package/promptwindow/promptwindow.d.ts +2 -0
- package/promptwindow/promptwindow.esm.js +1 -1
- package/promptwindow/promptwindow.umd.js +2 -3
- package/qrcode/qrcode.d.ts +2 -0
- package/qrcode/qrcode.esm.js +1 -1
- package/qrcode/qrcode.umd.js +2 -3
- package/querybuilder/querybuilder.d.ts +2 -0
- package/querybuilder/querybuilder.esm.js +1 -1
- package/querybuilder/querybuilder.umd.js +2 -3
- package/radiobutton/radiobutton.d.ts +2 -0
- package/radiobutton/radiobutton.esm.js +1 -1
- package/radiobutton/radiobutton.umd.js +2 -3
- package/rating/rating.d.ts +2 -0
- package/rating/rating.esm.js +1 -1
- package/rating/rating.umd.js +2 -3
- package/ribbon/ribbon.d.ts +2 -0
- package/ribbon/ribbon.esm.js +1 -1
- package/ribbon/ribbon.umd.js +2 -3
- package/ribbon/ribbongroup.d.ts +2 -0
- package/ribbon/ribbonitem.d.ts +2 -0
- package/ribbon/ribbontab.d.ts +2 -0
- package/scheduler/scheduler.d.ts +2 -0
- package/scheduler/scheduler.esm.js +1 -1
- package/scheduler/scheduler.umd.js +2 -3
- package/scrollbar/scrollbar.d.ts +2 -0
- package/scrollbar/scrollbar.esm.js +1 -1
- package/scrollbar/scrollbar.umd.js +2 -3
- package/slider/slider.d.ts +2 -0
- package/slider/slider.esm.js +1 -1
- package/slider/slider.umd.js +2 -3
- package/sortable/sortable.d.ts +2 -0
- package/sortable/sortable.esm.js +1 -1
- package/sortable/sortable.umd.js +2 -3
- package/sortpanel/sortpanel.d.ts +2 -0
- package/sortpanel/sortpanel.esm.js +1 -1
- package/sortpanel/sortpanel.umd.js +2 -3
- package/source/modules/smart.3dchart.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 +3 -3
- package/source/modules/smart.card.js +1 -1
- package/source/modules/smart.cardview.js +5 -5
- package/source/modules/smart.carousel.js +1 -1
- package/source/modules/smart.chart.js +2 -2
- package/source/modules/smart.checkbox.js +1 -1
- package/source/modules/smart.checkinput.js +2 -2
- package/source/modules/smart.chip.js +1 -1
- package/source/modules/smart.colorinput.js +2 -2
- 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 +3 -3
- package/source/modules/smart.countryinput.js +2 -2
- package/source/modules/smart.dateinput.js +3 -3
- package/source/modules/smart.daterangeinput.js +3 -3
- package/source/modules/smart.datetimepicker.js +3 -3
- 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 +2 -2
- package/source/modules/smart.element.js +1 -1
- package/source/modules/smart.fileupload.js +1 -1
- package/source/modules/smart.form.js +3 -3
- package/source/modules/smart.formulaparser.js +1 -1
- package/source/modules/smart.ganttchart.js +6 -6
- package/source/modules/smart.gauge.js +1 -1
- package/source/modules/smart.grid.js +15 -15
- package/source/modules/smart.gridpanel.js +5 -5
- package/source/modules/smart.input.js +2 -2
- package/source/modules/smart.kanban.js +5 -5
- 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 +2 -2
- package/source/modules/smart.menu.js +1 -1
- package/source/modules/smart.multicomboinput.js +2 -2
- package/source/modules/smart.multiinput.js +2 -2
- package/source/modules/smart.multilinetextbox.js +1 -1
- package/source/modules/smart.multisplitbutton.js +1 -1
- package/source/modules/smart.numberinput.js +2 -2
- package/source/modules/smart.numerictextbox.js +1 -1
- package/source/modules/smart.pager.js +2 -2
- package/source/modules/smart.passwordinput.js +2 -2
- package/source/modules/smart.passwordtextbox.js +2 -2
- package/source/modules/smart.path.js +1 -1
- package/source/modules/smart.phoneinput.js +2 -2
- package/source/modules/smart.pivottable.js +6 -6
- 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.ribbon.js +2 -2
- package/source/modules/smart.router.js +2 -2
- package/source/modules/smart.scheduler.js +5 -5
- 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 +4 -4
- package/source/modules/smart.tabs.js +1 -1
- package/source/modules/smart.tank.js +1 -1
- package/source/modules/smart.textarea.js +3 -3
- package/source/modules/smart.textbox.js +1 -1
- package/source/modules/smart.timeinput.js +2 -2
- 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 +2 -2
- package/source/modules/smart.validator.js +1 -1
- package/source/modules/smart.window.js +1 -1
- package/source/smart.3dchart.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 +2 -2
- package/source/smart.date.js +1 -1
- package/source/smart.dateformatpanel.js +1 -1
- package/source/smart.dateinput.js +1 -1
- 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 +16 -16
- package/source/smart.export.js +1 -1
- package/source/smart.fileupload.js +1 -1
- package/source/smart.filter.js +2 -2
- package/source/smart.filterbuilder.js +1 -1
- 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 +2 -2
- 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 +2 -2
- 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 +1 -1
- package/source/smart.grid.pager.js +1 -1
- package/source/smart.grid.reorder.js +1 -1
- package/source/smart.grid.resize.js +1 -1
- 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 +1 -1
- package/source/smart.grid.tree.js +1 -1
- package/source/smart.grid.view.js +1 -1
- package/source/smart.gridpanel.js +1 -1
- package/source/smart.input.js +2 -2
- package/source/smart.kanban.js +1 -1
- 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 +1 -1
- 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.ribbon.js +1 -1
- package/source/smart.router.js +1 -1
- package/source/smart.scheduler.js +1 -1
- package/source/smart.scrollbar.js +1 -1
- package/source/smart.slider.js +1 -1
- package/source/smart.sortable.js +1 -1
- package/source/smart.sparkline.js +6 -0
- package/source/smart.splitter.js +1 -1
- package/source/smart.switchbutton.js +1 -1
- package/source/smart.table.js +1 -1
- package/source/smart.tabs.js +1 -1
- package/source/smart.tank.js +1 -1
- package/source/smart.textarea.js +2 -2
- 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 +2 -2
- 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.grid.css +1 -1
- package/source/styles/components/smart.validator.css +1 -1
- package/source/styles/default/scss/smart.grid.scss +230 -168
- package/source/styles/default/scss/smart.validator.scss +1 -0
- package/source/styles/default/smart.grid.css +48 -9
- package/source/styles/default/smart.validator.css +123 -121
- package/source/styles/smart.default.css +2 -2
- package/source/typescript/smart.calendar.d.ts +5 -0
- package/source/typescript/smart.elements.d.ts +54 -3
- package/source/typescript/smart.grid.d.ts +33 -3
- package/source/typescript/smart.textarea.d.ts +5 -0
- package/source/typescript/smart.tree.d.ts +11 -0
- package/splitter/splitter.d.ts +2 -0
- package/splitter/splitter.esm.js +1 -1
- package/splitter/splitter.umd.js +2 -3
- package/splitter/splitterbar.d.ts +2 -0
- package/splitter/splitteritem.d.ts +2 -0
- package/switchbutton/switchbutton.d.ts +2 -0
- package/switchbutton/switchbutton.esm.js +1 -1
- package/switchbutton/switchbutton.umd.js +2 -3
- package/table/pivottable.d.ts +2 -0
- package/table/sortable.d.ts +2 -0
- package/table/table.d.ts +2 -0
- package/table/table.esm.js +1 -1
- package/table/table.umd.js +2 -3
- package/tabs/tabs.d.ts +2 -0
- package/tabs/tabs.esm.js +1 -1
- package/tabs/tabs.umd.js +2 -3
- package/tabs/tabswindow.d.ts +2 -0
- package/tabswindow/tabswindow.d.ts +2 -0
- package/tabswindow/tabswindow.esm.js +1 -1
- package/tabswindow/tabswindow.umd.js +2 -3
- package/tank/tank.d.ts +2 -0
- package/tank/tank.esm.js +1 -1
- package/tank/tank.umd.js +2 -3
- package/textarea/textarea.d.ts +7 -0
- package/textarea/textarea.esm.js +13 -2
- package/textarea/textarea.umd.js +14 -4
- package/textbox/maskedtextbox.d.ts +2 -0
- package/textbox/multilinetextbox.d.ts +2 -0
- package/textbox/numerictextbox.d.ts +2 -0
- package/textbox/passwordtextbox.d.ts +2 -0
- package/textbox/textbox.d.ts +2 -0
- package/textbox/textbox.esm.js +1 -1
- package/textbox/textbox.umd.js +2 -3
- package/threedchart/threedchart.d.ts +2 -0
- package/threedchart/threedchart.esm.js +1 -1
- package/threedchart/threedchart.umd.js +2 -3
- package/timeinput/timeinput.d.ts +2 -0
- package/timeinput/timeinput.esm.js +1 -1
- package/timeinput/timeinput.umd.js +2 -3
- package/timepicker/datetimepicker.d.ts +2 -0
- package/timepicker/timepicker.d.ts +2 -0
- package/timepicker/timepicker.esm.js +1 -1
- package/timepicker/timepicker.umd.js +2 -3
- package/toast/toast.d.ts +2 -0
- package/toast/toast.esm.js +1 -1
- package/toast/toast.umd.js +2 -3
- package/tooltip/tooltip.d.ts +2 -0
- package/tooltip/tooltip.esm.js +1 -1
- package/tooltip/tooltip.umd.js +2 -3
- package/tree/tree.d.ts +12 -0
- package/tree/tree.esm.js +9 -2
- package/tree/tree.umd.js +10 -4
- package/tree/treeitem.d.ts +2 -0
- package/tree/treeitemsgroup.d.ts +2 -0
- package/validator/validator.d.ts +2 -0
- package/validator/validator.esm.js +1 -1
- package/validator/validator.umd.js +2 -3
- package/waitwindow/waitwindow.d.ts +2 -0
- package/waitwindow/waitwindow.esm.js +1 -1
- package/waitwindow/waitwindow.umd.js +2 -3
- package/window/alertwindow.d.ts +2 -0
- package/window/dialogwindow.d.ts +2 -0
- package/window/multilinewindow.d.ts +2 -0
- package/window/progresswindow.d.ts +2 -0
- package/window/promptwindow.d.ts +2 -0
- package/window/tabswindow.d.ts +2 -0
- package/window/waitwindow.d.ts +2 -0
- package/window/window.d.ts +2 -0
- package/window/window.esm.js +1 -1
- package/window/window.umd.js +2 -3
|
@@ -38,7 +38,7 @@ Smart("smart-check-box",class extends Smart.ToggleButton{static get properties()
|
|
|
38
38
|
/***/ 6057:
|
|
39
39
|
/***/ (() => {
|
|
40
40
|
|
|
41
|
-
(()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),void 0===e.skipFirstRow&&(t.skipFirstRow=!1),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0)t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0)t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0)t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0)t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType))t._bindToICS(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType))t._bindToXML(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType))t._bindToCSV(),a();else if("array"===t.dataSourceType)t._bindToArray(),a();else if("json"===t.dataSourceType){if(t.dataSource&&t.dataSource.url)return t.url=t.dataSource.url,t.dataSource.method&&(t.type=t.dataSource.method),t.dataSource.type&&(t.type=t.dataSource.type),t.dataSource.data&&(t.data=t.dataSource.data),void new e(t,(e=>{t.dataSource=e}));t._bindToJSON(),a()}}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={};let l=i[t].split(a);if(t>0){let e=[],a=0,n=!1,r=i[t];for(let t=0;t<r.length;t++)if('"'===r.charAt(t))n=!n;else if(","===r.charAt(t)&&!n){let n=r.substring(a,t);n=n.trim(),n=n.replaceAll('"',""),e.push(n),a=t+1}let o=r.substring(a);o=o.trim(),o=o.replaceAll('"',""),","===o?e.push('""'):e.push(o),l=e}for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/")&&-1===i.indexOf("-"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):i.indexOf(".")>=0&&i.lastIndexOf(".")!==i.indexOf(".")?-1===i.indexOf(",")&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}0===t&&e.skipFirstRow||(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),t.data=r.data,a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{let a=t.value,n=t.valueTo;if(a&&a instanceof Date){a=`'${new Smart.Utilities.DateTime(a).toString("yyyy-MM-dd")}'`}if(t.valueTo&&t.valueTo instanceof Date){n=`'${new Smart.Utilities.DateTime(n).toString("yyyy-MM-dd")}'`}switch(t.condition){case"EQUAL":return e+" = "+a;case"NOT_EQUAL":return e+" != "+a;case"GREATER_THAN":return e+" > "+a;case"GREATER_THAN_OR_EQUAL":return e+" >= "+a;case"LESS_THAN":return e+" < "+a;case"LESS_THAN_OR_EQUAL":return e+" <= "+a;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+a+" and "+e+" <= "+n+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1!==o.logicalOperators[t]&&"or"!==o.logicalOperators[t]||(s=" OR ")}l.length&&r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e).replace(/</g,"<").replace(/>/g,">")}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n].replace(/</g,"<").replace(/>/g,">")+"'");null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=JSON.parse(JSON.stringify(e.boundSource[n]));if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=s.boundSource.canNotify;s.boundSource.canNotify=!1;const f=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let h=new Array;for(let t=0;t<e.length;t++)h[t]=f();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const p=new Array,g=new Array;let S=0;const y=function(t){let a=t;for(let n=0;n<e.length;n++){if(void 0===t[e[n]]){a=s._getDataItem(t,t.$.index);break}}if(n)for(let e in n){const t=n[e];t.name&&t.map&&(a[t.map]=a[t.name])}return a};let m=!1;for(let n=0;n<d.length;n++){let u=y(d[n]);u[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=u[a];null!=n?((""===n||void 0===n&&0===t)&&(m=!0),T[b++]={value:n,group:a,hash:h[t]}):(T[b++]={value:null,group:a,hash:h[t]},0===t&&(m=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===g[v]||null===g[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=u,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==u[c.expanded]?x[c.expanded]=u[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=u[i]),x[t]=new Array;let e=p.length+l;this.id&&"number"!=typeof u.$.id&&!isFinite(u.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),p[S++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=u,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==u[c.expanded]?e[c.expanded]=u[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=u[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}g[v]=x}else x=g[v]}u&&(u[c.leaf]=!0),null!==x?(null===this.id?void 0===u.$.id&&(u.$.id=x.$.id+"_"+x[t].length):void 0===u.$.id&&-1===u.$.id.toString().indexOf(x.$.id)&&(u.$.id=x.$.id+"_"+u.$.id),u[o]=x,u[c.level]=x[c.level]+1,x[t][x[t].length]=u):void 0===u.$.id&&(u.$.id=f())}if(m){let e=null,t=!1;for(let a=0;a<p.length;a++){const n=p[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),p.splice(a,1);break}}if(e&&(p.push(e),t))for(let e=0;e<p.length;e++){const t=p[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return s.boundSource.canNotify=u,p}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(void 0!==d&&"uncategorized"!==d||(d=""),o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("status"===t)n=r[o.dataField][t],null==n&&(n=[]),n[d]||(n[d]=[]),n[d].push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}else if("status"===t){let e=r[o.dataField][t];null==e&&(e=[]),e[d]||(e[d]=[]),e[d].push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].status){const e=r[n.dataField].status;r[n.dataField].status=e}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType){if(o&&"string"==typeof o&&o.indexOf("[")>=0){const e=JSON.parse(o);if(r.formatString&&Smart.Utilities.DateTime){const t=Smart.Utilities.DateTime.ParseDate(e[0],r.formatString),a=Smart.Utilities.DateTime.ParseDate(e[1],r.formatString);e[0]=t,e[1]=a}else{const t=a.$document.deserialize(""+e[0],r.dataType,!0),n=a.$document.deserialize(""+e[1],r.dataType,!0);e[0]=t,e[1]=n}o=e,n[r.name]=o;continue}if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0)}else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o),o.indexOf("<br")>=0&&(o=o.replaceAll("<br/>","\n\r"),o=o.replaceAll("<br>","\n\r")))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];if(""!==t&&" "!==t){if("true"===t.trim()){i.push(!0);continue}if("false"===t.trim()){i.push(!1);continue}if(t.indexOf("or ")>=0||t.indexOf("and ")>=0||t.indexOf("1 ")>=0||t.indexOf("0 ")>=0||t.indexOf("| ")>=0||t.indexOf("& ")>=0){const e=t.trim().split(" ");if(e.length>1){const t=e[0].trim(),a=e[1].trim();"1"===t?i.push("or"):"0"===t?i.push("and"):i.push(t),i.push(a)}else i.push(t.trim())}else i.push(t.trim())}}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy){if(o.virtualDataSource)return;throw new Error("sort: Missing or Invalid arguments!")}"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
|
|
41
|
+
(()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),void 0===e.skipFirstRow&&(t.skipFirstRow=!1),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0)t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0)t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0)t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0)t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType))t._bindToICS(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType))t._bindToXML(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType))t._bindToCSV(),a();else if("array"===t.dataSourceType)t._bindToArray(),a();else if("json"===t.dataSourceType){if(t.dataSource&&t.dataSource.url)return t.url=t.dataSource.url,t.dataSource.method&&(t.type=t.dataSource.method),t.dataSource.type&&(t.type=t.dataSource.type),t.dataSource.data&&(t.data=t.dataSource.data),void new e(t,(e=>{t.dataSource=e}));t._bindToJSON(),a()}}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={};let l=i[t].split(a);if(t>0){let e=[],a=0,n=!1,r=i[t];for(let t=0;t<r.length;t++)if('"'===r.charAt(t))n=!n;else if(","===r.charAt(t)&&!n){let n=r.substring(a,t);n=n.trim(),n=n.replaceAll('"',""),e.push(n),a=t+1}let o=r.substring(a);o=o.trim(),o=o.replaceAll('"',""),","===o?e.push('""'):e.push(o),l=e}for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/")&&-1===i.indexOf("-"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):i.indexOf(".")>=0&&i.lastIndexOf(".")!==i.indexOf(".")?-1===i.indexOf(",")&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}0===t&&e.skipFirstRow||(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),t.data=r.data,a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{let a=t.value,n=t.valueTo;if(a&&a instanceof Date){a=`'${new Smart.Utilities.DateTime(a).toString("yyyy-MM-dd")}'`}if(t.valueTo&&t.valueTo instanceof Date){n=`'${new Smart.Utilities.DateTime(n).toString("yyyy-MM-dd")}'`}switch(t.condition){case"EQUAL":return e+" = "+a;case"NOT_EQUAL":return e+" != "+a;case"GREATER_THAN":return e+" > "+a;case"GREATER_THAN_OR_EQUAL":return e+" >= "+a;case"LESS_THAN":return e+" < "+a;case"LESS_THAN_OR_EQUAL":return e+" <= "+a;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+a+" and "+e+" <= "+n+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1!==o.logicalOperators[t]&&"or"!==o.logicalOperators[t]||(s=" OR ")}l.length&&r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e).replace(/</g,"<").replace(/>/g,">")}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n].replace(/</g,"<").replace(/>/g,">")+"'");null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=JSON.parse(JSON.stringify(e.boundSource[n]));if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=s.boundSource.canNotify;s.boundSource.canNotify=!1;const f=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let h=new Array;for(let t=0;t<e.length;t++)h[t]=f();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const p=new Array,g=new Array;let S=0;const y=function(t){let a=t;for(let n=0;n<e.length;n++){if(void 0===t[e[n]]){a=s._getDataItem(t,t.$.index);break}}if(n)for(let e in n){const t=n[e];t.name&&t.map&&(a[t.map]=a[t.name])}return a};let m=!1;for(let n=0;n<d.length;n++){let u=y(d[n]);u[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=u[a];null!=n?((""===n||void 0===n&&0===t)&&(m=!0),T[b++]={value:n,group:a,hash:h[t]}):(T[b++]={value:null,group:a,hash:h[t]},0===t&&(m=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===g[v]||null===g[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=u,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==u[c.expanded]?x[c.expanded]=u[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=u[i]),x[t]=new Array;let e=p.length+l;this.id&&"number"!=typeof u.$.id&&!isFinite(u.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),p[S++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=u,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==u[c.expanded]?e[c.expanded]=u[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=u[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}g[v]=x}else x=g[v]}u&&(u[c.leaf]=!0),null!==x?(null===this.id?void 0===u.$.id&&(u.$.id=x.$.id+"_"+x[t].length):void 0===u.$.id&&-1===u.$.id.toString().indexOf(x.$.id)&&(u.$.id=x.$.id+"_"+u.$.id),u[o]=x,u[c.level]=x[c.level]+1,x[t][x[t].length]=u):void 0===u.$.id&&(u.$.id=f())}if(m){let e=null,t=!1;for(let a=0;a<p.length;a++){const n=p[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),p.splice(a,1);break}}if(e&&(p.push(e),t))for(let e=0;e<p.length;e++){const t=p[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return s.boundSource.canNotify=u,p}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(void 0!==d&&"uncategorized"!==d||(d=""),o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("status"===t)n=r[o.dataField][t],null==n&&(n=[]),n[d]||(n[d]=[]),n[d].push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}else if("status"===t){let e=r[o.dataField][t];null==e&&(e=[]),e[d]||(e[d]=[]),e[d].push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].status){const e=r[n.dataField].status;r[n.dataField].status=e}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType){if(o&&"string"==typeof o&&o.indexOf("[")>=0){const e=JSON.parse(o);if(r.formatString&&Smart.Utilities.DateTime){const t=Smart.Utilities.DateTime.ParseDate(e[0],r.formatString),a=Smart.Utilities.DateTime.ParseDate(e[1],r.formatString);e[0]=t,e[1]=a}else{const t=a.$document.deserialize(""+e[0],r.dataType,!0),n=a.$document.deserialize(""+e[1],r.dataType,!0);e[0]=t,e[1]=n}o=e,n[r.name]=o;continue}if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0)}else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o),o.indexOf("<br")>=0&&(o=o.replaceAll("<br/>","\n\r"),o=o.replaceAll("<br>","\n\r")))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];if(""!==t&&" "!==t){if("true"===t.trim()){i.push(!0);continue}if("false"===t.trim()){i.push(!1);continue}if(t.indexOf(" GMT")>=0)i.push(t.trim());else if(t.indexOf("or ")>=0||t.indexOf("and ")>=0||t.indexOf("1 ")>=0||t.indexOf("0 ")>=0||t.indexOf("| ")>=0||t.indexOf("& ")>=0){const e=t.trim().split(" ");if(e.length>1){const t=e[0].trim(),a=e[1].trim();"1"===t?i.push("or"):"0"===t?i.push("and"):i.push(t),i.push(a)}else i.push(t.trim())}else i.push(t.trim())}}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy){if(o.virtualDataSource)return;throw new Error("sort: Missing or Invalid arguments!")}"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
|
|
42
42
|
|
|
43
43
|
/***/ }),
|
|
44
44
|
|
|
@@ -73,14 +73,14 @@ Smart.Utilities.Assign("DataExporter",class{constructor(e,t,a,o){const l=this;e|
|
|
|
73
73
|
/***/ 6170:
|
|
74
74
|
/***/ (() => {
|
|
75
75
|
|
|
76
|
-
Smart.Utilities.Assign("FilterGroup",class t{constructor(){const t=this;t.stringConditions=["EMPTY","NOT_EMPTY","CONTAINS","CONTAINS_CASE_SENSITIVE","DOES_NOT_CONTAIN","DOES_NOT_CONTAIN_CASE_SENSITIVE","STARTS_WITH","STARTS_WITH_CASE_SENSITIVE","ENDS_WITH","ENDS_WITH_CASE_SENSITIVE","EQUAL","NOT_EQUAL","EQUAL_CASE_SENSITIVE","NOT_EQUAL_CASE_SENSITIVE","NULL","NOT_NULL"],t.numericConditions=["EQUAL","NOT_EQUAL","LESS_THAN","LESS_THAN_OR_EQUAL","GREATER_THAN","GREATER_THAN_OR_EQUAL","NULL","NOT_NULL"],t.dateConditions=["EQUAL","NOT_EQUAL","LESS_THAN","LESS_THAN_OR_EQUAL","GREATER_THAN","GREATER_THAN_OR_EQUAL","NULL","NOT_NULL"],t.booleanConditions=["EQUAL","NOT_EQUAL","NULL","NOT_NULL"],t.filters=new Array,t.logicalOperators=new Array}toString(){const t=this;let e="";for(let r=0;r<t.filters.length;r++){r>0&&(e+=" "+t.logicalOperators[r-1]+" ");let n=t.filters[r].toString();n.indexOf("[object")>=0&&"object"==typeof t.filters[r]&&(n=t.filters[r].condition+' "'+t.filters[r].value+'"'),e+=n}return e}evaluate(t){const e=this;let r=!0;for(let n=0;n<e.filters.length;n++){if(!e.filters[n].evaluate)continue;let i=e.filters[n].evaluate(t);r=0===n?i:1===e.logicalOperators[n]||"or"===e.logicalOperators[n]?r||i:r&&i}return r}getFiltersCount(){return this.filters.length}setConditions(t,e){const r=this;switch(t){case"numeric":r.numericConditions=e;break;case"string":r.stringConditions=e;break;case"date":case"time":r.dateConditions=e;break;case"bool":case"boolean":r.booleanConditions=e}}getConditions(t){const e=this;let r=new Array;switch(t){case"numeric":r=e.numericConditions.slice(0);break;case"string":r=e.stringConditions.slice(0);break;case"date":case"time":r=e.dateConditions.slice(0);break;case"bool":case"boolean":r=e.booleanConditions.slice(0)}return r}generateFilterKey(){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+"-"+t()+"-"+t()}createFilter(t,e,r,n,i,s,l){if(null==t)return null;switch(t){case"int":case"float":case"int64":case"double":case"numeric":case"number":case"numericFilter":return new Smart.Utilities.NumericFilter(e,r.toUpperCase());case"string":case"stringFilter":return new Smart.Utilities.StringFilter(e,r.toUpperCase(),s);case"date":case"time":case"dateFilter":return new Smart.Utilities.DateFilter(e,r.toUpperCase(),i,s,l);case"bool":case"boolean":case"booleanFilter":return new Smart.Utilities.BooleanFilter(e,r.toUpperCase());case"custom":return new Smart.Utilities.CustomFilter(e,r.toUpperCase(),n)}throw new Error('smartGrid: There is no such filter type. The available filter types are: "numericFilter", "stringFilter", "dateFilter" and "booleanFilter"')}getFilters(){const e=this;let r=new Array;for(let n=0;n<e.filters.length;n++){const i=e.filters[n];if(i instanceof t){let t=i.getFilters();r.push({value:t,logicalOperator:e.logicalOperators[n],type:"FilterGroup"})}else{const t={value:i.value,condition:i.condition,logicalOperator:e.logicalOperators[n],type:i.type};i.data&&(t.id=i.data),r.push(t)}}return r}addFilter(t,e){const r=this;r.filters[r.filters.length]=e,e.key=r.generateFilterKey(),r.logicalOperators[r.logicalOperators.length]=t}removeFilter(t){const e=this;for(let r=0;r<e.filters.length;r++)if(e.filters[r].key===t.key){e.filters.splice(r,1),e.logicalOperators.splice(r,1);break}}getOperatorAt(t){return null==t||t<0||t>this.filters.length?null:this.logicalOperators[t]}setOperatorAt(t,e){return null==t||t<0||t>this.filters.length?null:void(this.logicalOperators[e]=e)}getFilterAt(t){return null==t||t<0||t>this.filters.length?null:this.filters[t]}setFilterAt(t,e){const r=this;return null==t||t<0||t>r.filters.length?null:(e.key=r.generateFilterKey(),void(r.filters[t]=e))}clear(){this.filters=new Array,this.logicalOperators=new Array}getUniqueValues(t,e){const r=t.data,n=[],i=[],s="dateFilter"===t.filterType&&"timePicker"===t.displayMode;let l,a=!1;for(let e=0;e<r.length;e++){let l,o=r[e][t.dataField];""!==o&&null!=o?(l=s?new Smart.Utilities.DateTime(o).toString(t.formatString):o.toString(),-1===n.indexOf(l)&&(n.push(l),i.push({label:l,value:o,customAttribute:"default-item"}))):a=!0}switch(t.filterType){case"numericFilter":case"booleanFilter":l=function(t,e){return t.value-e.value};break;case"stringFilter":l=function(t,e){return(new Intl.Collator).compare(t.value,e.value)};break;case"dateFilter":l=s?function(t,e){try{const r=t.value.getHours(),n=e.value.getHours();if(r!==n)return r-n;const i=t.value.getMinutes(),s=e.value.getMinutes();if(i!==s)return i-s;const l=t.value.getSeconds(),a=e.value.getSeconds();return l!==a?l-a:0}catch(t){return-1}}:function(t,e){try{return t.value.getTime()-e.value.getTime()}catch(t){return-1}}}return i.sort(l),"booleanFilter"===t.filterType&&i.map((function(t){t.label=t.label.toUpperCase()})),a&&i.push({label:e.localize("blanks"),value:"",customAttribute:"default-item"}),i}}),Smart.Utilities.Assign("StringFilter",class{constructor(t,e,r){const n=this;n.value=t,n.condition=e,n.locale=r||"en",n.type="stringFilter"}toString(){return this.condition+' "'+this.value+'"'}evaluate(t){const e=this,r=e.value,n=e.condition;if(null==t||""===t){if("NULL"===n)return!0;if("EQUAL"===n&&t===r)return!0;if("NOT_EQUAL"===n&&t!==r)return!0;if("CONTAINS"===n&&t===r)return!0;if("EMPTY"!==n)return!1;if(""===t)return!0}let i="";try{i=t.toString()}catch(t){return!0}const s=function(t,r){const i=e.locale;switch(n){case"EQUAL":return 0===t.localeCompare(r,i,{sensitivity:"accent"});case"EQUAL_CASE_SENSITIVE":return 0===t.localeCompare(r,i,{sensitivity:"variant"});case"NOT_EQUAL":return 0!==t.localeCompare(r,i,{sensitivity:"accent"});case"NOT_EQUAL_CASE_SENSITIVE":return 0!==t.localeCompare(r,i,{sensitivity:"variant"});case"CONTAINS":return"number"==typeof r?t===r:-1!==t.toLowerCase().indexOf(r.toLowerCase());case"CONTAINS_CASE_SENSITIVE":return-1!==t.indexOf(r);case"DOES_NOT_CONTAIN":return-1===t.toLowerCase().indexOf(r.toLowerCase());case"DOES_NOT_CONTAIN_CASE_SENSITIVE":return-1===t.indexOf(r);case"EMPTY":return""===t;case"NOT_EMPTY":return""!==t;case"NOT_NULL":return null!==t;case"STARTS_WITH":return 0===(t=t.substring(0,r.length)).localeCompare(r,i,{sensitivity:"accent"});case"ENDS_WITH":return 0===(t=t.substring(t.length-r.length,t.length)).localeCompare(r,i,{sensitivity:"accent"});case"ENDS_WITH_CASE_SENSITIVE":return 0===(t=t.substring(t.length-r.length,t.length)).localeCompare(r,i,{sensitivity:"variant"});case"STARTS_WITH_CASE_SENSITIVE":return 0===(t=t.substring(0,r.length)).localeCompare(r,i,{sensitivity:"variant"});default:return!1}},l=new Array;if(r&&r.indexOf&&(r.indexOf("|")>=0||r.indexOf(" AND ")>=0||r.indexOf(" OR ")>=0||r.indexOf(" and ")>=0||r.indexOf(" or ")>=0)){const t=s(i,r);if(t)return t;const e=r.indexOf(" and ")>=0?r.split(" and "):new Array,n=r.indexOf(" or ")>=0?r.split(" or "):new Array,a=r.indexOf("|")>=0?r.split("|"):new Array;let o=r.indexOf(" AND ")>=0?r.split(" AND "):new Array,c=r.indexOf(" OR ")>=0?r.split(" OR "):new Array;if(a.length>0)for(let t=0;t<a.length;t++)a[t]=a[t].trim;const u=r.indexOf(" ")>=0?r.split(" "):new Array;if(u.length>0)for(let t=0;t<u.length;t++)u[t]=u[t].trim;if(o=o.concat(u),o=o.concat(e),c=c.concat(a),c=c.concat(n),o.length>0)for(let t=0;t<o.length;t++)!o[t].indexOf(" OR ")>=0&&l.push(o[t]);if(c.length>0)for(let t=0;t<c.length;t++)!c[t].indexOf(" AND ")>=0&&l.push(c[t]);let S;for(let t=0;t<l.length;t++){const e=s(i,l[t]),r=t<o.length?"and":"or";S=void 0===S?e:"or"===r?S||e:S&&e}return S}return s(i,r)}}),Smart.Utilities.Assign("BooleanFilter",class{constructor(t,e){const r=this;r.value=t,r.condition=e,r.type="booleanFilter"}toString(){return this.condition+" "+this.value}evaluate(t){const e=this.value,r=t;switch(this.condition){case"EQUAL":return r===e;case"NOT_EQUAL":return r!==e;case"NULL":return null==t||""===t;case"NOT_NULL":return!(null==t||""===t);default:return!1}}}),Smart.Utilities.Assign("NumericFilter",class{constructor(t,e){const r=this;r.value=t,r.condition=e,r.type="numericFilter"}toString(){return this.condition+" "+this.value}evaluate(t){let e=this.value,r=this.condition;if(null==t||""===t){if("NOT_NULL"===r)return!1;if("NULL"===r)return!0;switch(r){case"EQUAL":return t===e;case"NOT_EQUAL":return t!==e}return!1}if("NULL"===r)return!1;if("NOT_NULL"===r)return!0;let n=t;try{n=parseFloat(n)}catch(e){if(null!==t&&""!==t.toString())return!1}const i=function(t,e){switch("number"==typeof t&&"number"!=typeof e&&(e=parseFloat(e)),r){case"EQUAL":return t===e;case"NOT_EQUAL":return t!==e;case"GREATER_THAN":return t>e;case"GREATER_THAN_OR_EQUAL":return t>=e;case"LESS_THAN":return t<e;case"LESS_THAN_OR_EQUAL":return t<=e;case"STARTS_WITH":return e=e.toString().toLowerCase(),t.toString().toLowerCase().substring(0,e.length)===e;case"ENDS_WITH":return t=t.toString().toLowerCase(),e=e.toString().toLowerCase(),t.substring(t.length-e.length,t.length)===e;case"ENDS_WITH_CASE_SENSITIVE":return t=t.toString(),e=e.toString(),t.substring(t.length-e.length,t.length)===e;case"STARTS_WITH_CASE_SENSITIVE":return e=e.toString(),t.toString().substring(0,e.length)===e;case"CONTAINS":return-1!==t.toString().toLowerCase().indexOf(e.toString().toLowerCase());case"CONTAINS_CASE_SENSITIVE":return-1!==t.toString().indexOf(e.toString());case"DOES_NOT_CONTAIN":return-1===t.toString().toLowerCase().indexOf(e.toString().toLowerCase());case"DOES_NOT_CONTAIN_CASE_SENSITIVE":return-1===t.toString().indexOf(e.toString());default:return!0}};let s=new Array;if(e&&e.indexOf&&(e.indexOf("|")>=0||e.indexOf(" AND ")>=0||e.indexOf(" OR ")>=0||e.indexOf(" and ")>=0||e.indexOf(" or ")>=0)){let t=i(n,e);if(t)return t;e=e.toString();const r=e.indexOf(" and ")>=0?e.split(" and "):new Array,l=e.indexOf(" or ")>=0?e.split(" or "):new Array,a=e.indexOf("|")>=0?e.split("|"):new Array;let o,c=e.indexOf(" AND ")>=0?e.split(" AND "):new Array,u=e.indexOf(" OR ")>=0?e.split(" OR "):new Array;if(c=c.concat(r),u=u.concat(l),a.length>0)for(let t=0;t<a.length;t++)a[t]=a[t].trim;if(u=u.concat(a),c.length>0)for(let t=0;t<c.length;t++)!c[t].indexOf(" OR ")>=0&&s.push(c[t]);if(u.length>0)for(let t=0;t<u.length;t++)!u[t].indexOf(" AND ")>=0&&s.push(u[t]);for(let e=0;e<s.length;e++){const r=s[e];if(r&&r.indexOf&&r.indexOf("..")>=0){const e=r.toString().split("..");2===e.length&&(t=n>=e[0]&&n<=e[1])}else t=i(n,r);const l=e<c.length?"and":"or";o=void 0===o?t:"or"===l?o||t:o&&t}return o}return e&&e.indexOf&&e.indexOf("..")>=0&&(s=e.toString().split(".."),2===s.length)?n>=s[0]&&n<=s[1]:i(n,e)}}),Smart.Utilities.Assign("DateFilter",class{constructor(t,e,r,n,i){const s=this,l=new Smart.Utilities.DateTime;if(s.value=t,s.type="dateFilter",void 0!==r){const e=l.parseDate(t,r);if(null!==e)s.filterdate=e;else{const e=l.tryparseDate(t);null!==e&&(s.filterdate=e)}}else{const e=new Date(t);"NaN"===e.toString()||"Invalid Date"===e.toString()?s.filterdate=l.tryparseDate(t):s.filterdate=e}if(!s.filterdate){const e=new Date(t);"NaN"===e.toString()||"Invalid Date"===e.toString()?s.filterdate=l.tryparseDate(t):s.filterdate=e}s.condition=e,s.formatString=r,s.timeOnly=i}toString(){return this.value&&this.value instanceof Date?this.condition+' "'+this.value.toISOString()+'"':this.condition+" "+this.value}evaluate(t){const e=this,r=e.condition,n=e.formatString;let i=e.value;if(e.timeOnly)return e.evaluateTimeOnly(t);if(null==t||""===t){if("NOT_NULL"===r)return!1;if("NULL"===r)return!0;switch(r){case"EQUAL":return t===i;case"NOT_EQUAL":return t!==i}return!1}if("NULL"===r)return!1;if("NOT_NULL"===r)return!0;let s,l=new Date;l.setFullYear(1900,0,1),l.setHours(12,0,0,0);try{const r=new Smart.Utilities.DateTime,a=new Date(t);if(l=t="NaN"===a.toString()||"Invalid Date"===a.toString()?r.tryparseDate(t):a,s=!1,void 0!==n&&(n.indexOf("t")>=0||n.indexOf("T")>=0||n.indexOf(":")>=0||n.indexOf("f")>=0)&&(s=!0,i&&-1===i.toString().indexOf(":"))){const t=r.tryparseDate(i.toString()+":00");null!==t&&(e.filterdate=t)}s||(l.setHours(0),l.setMinutes(0),l.setSeconds(0))}catch(e){if(null!==t&&""!==t.toString())return!1}if(null!==e.filterdate)i=e.filterdate;else if(i&&i.indexOf&&(-1!==i.indexOf(":")||!isNaN(parseInt(i)))){const t=new Date(l);t.setHours(12,0,0,0);const e=i.split(":");for(let r=0;r<e.length;r++)0===r&&t.setHours(e[r]),1===r&&t.setMinutes(e[r]),2===r&&t.setSeconds(e[r]);i=t}s&&i&&i.setFullYear&&l&&l.getFullYear&&-1===n.indexOf("d")&&-1===n.indexOf("M")&&-1===n.indexOf("y")&&i.setFullYear(l.getFullYear(),l.getMonth(),l.getDate());const a=function(t,e){switch(null===t&&(t=""),r){case"EQUAL":return t.toString()===e.toString();case"NOT_EQUAL":return t.toString()!==e.toString();case"GREATER_THAN":return t>e;case"GREATER_THAN_OR_EQUAL":return t>=e;case"LESS_THAN":return t<e;case"LESS_THAN_OR_EQUAL":return t<=e;case"STARTS_WITH":return e=e.toString().toLowerCase(),t.toString().toLowerCase().substring(0,e.length)===e;case"ENDS_WITH":return t=t.toString().toLowerCase(),e=e.toString().toLowerCase(),t.substring(t.length-e.length,t.length)===e;case"ENDS_WITH_CASE_SENSITIVE":return t=t.toString(),e=e.toString(),t.substring(t.length-e.length,t.length)===e;case"STARTS_WITH_CASE_SENSITIVE":return e=e.toString(),t.toString().substring(0,e.length)===e;case"CONTAINS":return-1!==t.toString().toLowerCase().indexOf(e.toString().toLowerCase());case"CONTAINS_CASE_SENSITIVE":return-1!==t.toString().indexOf(e.toString());case"DOES_NOT_CONTAIN":return-1===t.toString().toLowerCase().indexOf(e.toString().toLowerCase());case"DOES_NOT_CONTAIN_CASE_SENSITIVE":return-1===t.toString().indexOf(e.toString());default:return!0}};let o=new Array;if(i&&i.indexOf&&(i.indexOf("|")>=0||i.indexOf(" AND ")>=0||i.indexOf(" OR ")>=0||i.indexOf(" and ")>=0||i.indexOf(" or ")>=0)){let t=a(l,i);if(t)return t;const e=i.indexOf(" and ")>=0?i.split(" and "):new Array,r=i.indexOf(" or ")>=0?i.split(" or "):new Array,n=i.indexOf("|")>=0?i.split("|"):new Array;let s,c=i.indexOf(" AND ")>=0?i.split(" AND "):new Array,u=i.indexOf(" OR ")>=0?i.split(" OR "):new Array;if(c=c.concat(e),u=u.concat(r),n.length>0)for(let t=0;t<n.length;t++)n[t]=n[t].trim;if(u=u.concat(n),c.length>0)for(let t=0;t<c.length;t++)!c[t].indexOf(" OR ")>=0&&o.push(c[t]);if(u.length>0)for(let t=0;t<u.length;t++)!u[t].indexOf(" AND ")>=0&&o.push(u[t]);for(let e=0;e<o.length;e++){const r=o[e];if(r&&r.indexOf&&r.indexOf("..")>=0){const e=r.toString().split("..");2===e.length&&(t=l>=e[0]&&l<=e[1])}else t=a(l,r);const n=e<c.length?"and":"or";s=void 0===s?t:"or"===n?s||t:s&&t}return s}return i&&i.indexOf&&i.indexOf("..")>=0&&(o=i.toString().split(".."),2===o.length)?l>=o[0]&&l<=o[1]:a(l,i)}evaluateTimeOnly(t){const e=this.value;return e?!!(t&&t instanceof Date)&&(t.getHours()===e.getHours()&&(t.getMinutes()===e.getMinutes()&&t.getSeconds()===e.getSeconds())):!t}}),Smart.Utilities.Assign("CustomFilter",class{constructor(t,e,r){const n=this;n.value=t,n.condition=e,n.customfilter=r}toString(){return this.condition+" "+this.value}evaluate(t){const e=this;return e.customfilter(e.value,t,e.condition)}}),Smart.FilterGroup=Smart.Utilities.FilterGroup,Smart.StringFilter=Smart.Utilities.StringFilter,Smart.NumericFilter=Smart.Utilities.NumericFilter,Smart.DateFilter=Smart.Utilities.DateFilter,Smart.CustomFilter=Smart.Utilities.CustomFilter;
|
|
76
|
+
Smart.Utilities.Assign("FilterGroup",class t{constructor(){const t=this;t.stringConditions=["EMPTY","NOT_EMPTY","CONTAINS","CONTAINS_CASE_SENSITIVE","DOES_NOT_CONTAIN","DOES_NOT_CONTAIN_CASE_SENSITIVE","STARTS_WITH","STARTS_WITH_CASE_SENSITIVE","ENDS_WITH","ENDS_WITH_CASE_SENSITIVE","EQUAL","NOT_EQUAL","EQUAL_CASE_SENSITIVE","NOT_EQUAL_CASE_SENSITIVE","NULL","NOT_NULL"],t.numericConditions=["EQUAL","NOT_EQUAL","LESS_THAN","LESS_THAN_OR_EQUAL","GREATER_THAN","GREATER_THAN_OR_EQUAL","NULL","NOT_NULL"],t.dateConditions=["EQUAL","NOT_EQUAL","LESS_THAN","LESS_THAN_OR_EQUAL","GREATER_THAN","GREATER_THAN_OR_EQUAL","NULL","NOT_NULL"],t.booleanConditions=["EQUAL","NOT_EQUAL","NULL","NOT_NULL"],t.filters=new Array,t.logicalOperators=new Array}toString(){const t=this;let e="";for(let r=0;r<t.filters.length;r++){r>0&&(e+=" "+t.logicalOperators[r-1]+" ");let n=t.filters[r].toString();n.indexOf("[object")>=0&&"object"==typeof t.filters[r]&&(n=t.filters[r].condition+' "'+t.filters[r].value+'"'),e+=n}return e}evaluate(t){const e=this;let r=!0;for(let n=0;n<e.filters.length;n++){if(!e.filters[n].evaluate)continue;let i=e.filters[n].evaluate(t);r=0===n?i:1===e.logicalOperators[n]||"or"===e.logicalOperators[n]?r||i:r&&i}return r}getFiltersCount(){return this.filters.length}setConditions(t,e){const r=this;switch(t){case"numeric":r.numericConditions=e;break;case"string":r.stringConditions=e;break;case"date":case"time":r.dateConditions=e;break;case"bool":case"boolean":r.booleanConditions=e}}getConditions(t){const e=this;let r=new Array;switch(t){case"numeric":r=e.numericConditions.slice(0);break;case"string":r=e.stringConditions.slice(0);break;case"date":case"time":r=e.dateConditions.slice(0);break;case"bool":case"boolean":r=e.booleanConditions.slice(0)}return r}generateFilterKey(){const t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+"-"+t()+"-"+t()}createFilter(t,e,r,n,i,s,l){if(null==t)return null;switch(t){case"int":case"float":case"int64":case"double":case"numeric":case"number":case"numericFilter":return new Smart.Utilities.NumericFilter(e,r.toUpperCase());case"string":case"stringFilter":return new Smart.Utilities.StringFilter(e,r.toUpperCase(),s);case"date":case"time":case"dateFilter":return new Smart.Utilities.DateFilter(e,r.toUpperCase(),i,s,l);case"bool":case"boolean":case"booleanFilter":return new Smart.Utilities.BooleanFilter(e,r.toUpperCase());case"custom":return new Smart.Utilities.CustomFilter(e,r.toUpperCase(),n)}throw new Error('smartGrid: There is no such filter type. The available filter types are: "numericFilter", "stringFilter", "dateFilter" and "booleanFilter"')}getFilters(){const e=this;let r=new Array;for(let n=0;n<e.filters.length;n++){const i=e.filters[n];if(i instanceof t){let t=i.getFilters();r.push({value:t,logicalOperator:e.logicalOperators[n],type:"FilterGroup"})}else{const t={value:i.value,condition:i.condition,logicalOperator:e.logicalOperators[n],type:i.type};i.data&&(t.id=i.data),r.push(t)}}return r}addFilter(t,e){const r=this;r.filters[r.filters.length]=e,e.key=r.generateFilterKey(),r.logicalOperators[r.logicalOperators.length]=t}removeFilter(t){const e=this;for(let r=0;r<e.filters.length;r++)if(e.filters[r].key===t.key){e.filters.splice(r,1),e.logicalOperators.splice(r,1);break}}getOperatorAt(t){return null==t||t<0||t>this.filters.length?null:this.logicalOperators[t]}setOperatorAt(t,e){return null==t||t<0||t>this.filters.length?null:void(this.logicalOperators[e]=e)}getFilterAt(t){return null==t||t<0||t>this.filters.length?null:this.filters[t]}setFilterAt(t,e){const r=this;return null==t||t<0||t>r.filters.length?null:(e.key=r.generateFilterKey(),void(r.filters[t]=e))}clear(){this.filters=new Array,this.logicalOperators=new Array}getUniqueValues(t,e){const r=t.data,n=[],i=[],s="dateFilter"===t.filterType&&"timePicker"===t.displayMode;let l,a=!1;for(let e=0;e<r.length;e++){let l,o=r[e][t.dataField];""!==o&&null!=o?(l=s?new Smart.Utilities.DateTime(o).toString(t.formatString):o.toString(),-1===n.indexOf(l)&&(n.push(l),i.push({label:l,value:o,customAttribute:"default-item"}))):a=!0}switch(t.filterType){case"numericFilter":case"booleanFilter":l=function(t,e){return t.value-e.value};break;case"stringFilter":l=function(t,e){return(new Intl.Collator).compare(t.value,e.value)};break;case"dateFilter":l=s?function(t,e){try{const r=t.value.getHours(),n=e.value.getHours();if(r!==n)return r-n;const i=t.value.getMinutes(),s=e.value.getMinutes();if(i!==s)return i-s;const l=t.value.getSeconds(),a=e.value.getSeconds();return l!==a?l-a:0}catch(t){return-1}}:function(t,e){try{return t.value.getTime()-e.value.getTime()}catch(t){return-1}}}return i.sort(l),"booleanFilter"===t.filterType&&i.map((function(t){const r=e.localize(t.label);t.label=""+r})),a&&i.push({label:e.localize("blanks"),value:"",customAttribute:"default-item"}),i}}),Smart.Utilities.Assign("StringFilter",class{constructor(t,e,r){const n=this;n.value=t,n.condition=e,n.locale=r||"en",n.type="stringFilter"}toString(){return this.condition+' "'+this.value+'"'}evaluate(t){const e=this,r=e.value,n=e.condition;if(null==t||""===t){if("NULL"===n)return!0;if("EQUAL"===n&&t===r)return!0;if("NOT_EQUAL"===n&&t!==r)return!0;if("CONTAINS"===n&&t===r)return!0;if("EMPTY"!==n)return!1;if(""===t)return!0}let i="";try{i=t.toString()}catch(t){return!0}const s=function(t,r){const i=e.locale;switch(n){case"EQUAL":return 0===t.localeCompare(r,i,{sensitivity:"accent"});case"EQUAL_CASE_SENSITIVE":return 0===t.localeCompare(r,i,{sensitivity:"variant"});case"NOT_EQUAL":return 0!==t.localeCompare(r,i,{sensitivity:"accent"});case"NOT_EQUAL_CASE_SENSITIVE":return 0!==t.localeCompare(r,i,{sensitivity:"variant"});case"CONTAINS":return"number"==typeof r?t===r:-1!==t.toLowerCase().indexOf(r.toLowerCase());case"CONTAINS_CASE_SENSITIVE":return-1!==t.indexOf(r);case"DOES_NOT_CONTAIN":return-1===t.toLowerCase().indexOf(r.toLowerCase());case"DOES_NOT_CONTAIN_CASE_SENSITIVE":return-1===t.indexOf(r);case"EMPTY":return""===t;case"NOT_EMPTY":return""!==t;case"NOT_NULL":return null!==t;case"STARTS_WITH":return 0===(t=t.substring(0,r.length)).localeCompare(r,i,{sensitivity:"accent"});case"ENDS_WITH":return 0===(t=t.substring(t.length-r.length,t.length)).localeCompare(r,i,{sensitivity:"accent"});case"ENDS_WITH_CASE_SENSITIVE":return 0===(t=t.substring(t.length-r.length,t.length)).localeCompare(r,i,{sensitivity:"variant"});case"STARTS_WITH_CASE_SENSITIVE":return 0===(t=t.substring(0,r.length)).localeCompare(r,i,{sensitivity:"variant"});default:return!1}},l=new Array;if(r&&r.indexOf&&(r.indexOf("|")>=0||r.indexOf(" AND ")>=0||r.indexOf(" OR ")>=0||r.indexOf(" and ")>=0||r.indexOf(" or ")>=0)){const t=s(i,r);if(t)return t;const e=r.indexOf(" and ")>=0?r.split(" and "):new Array,n=r.indexOf(" or ")>=0?r.split(" or "):new Array,a=r.indexOf("|")>=0?r.split("|"):new Array;let o=r.indexOf(" AND ")>=0?r.split(" AND "):new Array,c=r.indexOf(" OR ")>=0?r.split(" OR "):new Array;if(a.length>0)for(let t=0;t<a.length;t++)a[t]=a[t].trim;const u=r.indexOf(" ")>=0?r.split(" "):new Array;if(u.length>0)for(let t=0;t<u.length;t++)u[t]=u[t].trim;if(o=o.concat(u),o=o.concat(e),c=c.concat(a),c=c.concat(n),o.length>0)for(let t=0;t<o.length;t++)!o[t].indexOf(" OR ")>=0&&l.push(o[t]);if(c.length>0)for(let t=0;t<c.length;t++)!c[t].indexOf(" AND ")>=0&&l.push(c[t]);let S;for(let t=0;t<l.length;t++){const e=s(i,l[t]),r=t<o.length?"and":"or";S=void 0===S?e:"or"===r?S||e:S&&e}return S}return s(i,r)}}),Smart.Utilities.Assign("BooleanFilter",class{constructor(t,e){const r=this;r.value=t,r.condition=e,r.type="booleanFilter"}toString(){return this.condition+" "+this.value}evaluate(t){const e=this.value,r=t;switch(this.condition){case"EQUAL":return r===e;case"NOT_EQUAL":return r!==e;case"NULL":return null==t||""===t;case"NOT_NULL":return!(null==t||""===t);default:return!1}}}),Smart.Utilities.Assign("NumericFilter",class{constructor(t,e){const r=this;r.value=t,r.condition=e,r.type="numericFilter"}toString(){return this.condition+" "+this.value}evaluate(t){let e=this.value,r=this.condition;if(null==t||""===t){if("NOT_NULL"===r)return!1;if("NULL"===r)return!0;switch(r){case"EQUAL":return t===e;case"NOT_EQUAL":return t!==e}return!1}if("NULL"===r)return!1;if("NOT_NULL"===r)return!0;let n=t;try{n=parseFloat(n)}catch(e){if(null!==t&&""!==t.toString())return!1}const i=function(t,e){switch("number"==typeof t&&"number"!=typeof e&&(e=parseFloat(e)),r){case"EQUAL":return t===e;case"NOT_EQUAL":return t!==e;case"GREATER_THAN":return t>e;case"GREATER_THAN_OR_EQUAL":return t>=e;case"LESS_THAN":return t<e;case"LESS_THAN_OR_EQUAL":return t<=e;case"STARTS_WITH":return e=e.toString().toLowerCase(),t.toString().toLowerCase().substring(0,e.length)===e;case"ENDS_WITH":return t=t.toString().toLowerCase(),e=e.toString().toLowerCase(),t.substring(t.length-e.length,t.length)===e;case"ENDS_WITH_CASE_SENSITIVE":return t=t.toString(),e=e.toString(),t.substring(t.length-e.length,t.length)===e;case"STARTS_WITH_CASE_SENSITIVE":return e=e.toString(),t.toString().substring(0,e.length)===e;case"CONTAINS":return-1!==t.toString().toLowerCase().indexOf(e.toString().toLowerCase());case"CONTAINS_CASE_SENSITIVE":return-1!==t.toString().indexOf(e.toString());case"DOES_NOT_CONTAIN":return-1===t.toString().toLowerCase().indexOf(e.toString().toLowerCase());case"DOES_NOT_CONTAIN_CASE_SENSITIVE":return-1===t.toString().indexOf(e.toString());default:return!0}};let s=new Array;if(e&&e.indexOf&&(e.indexOf("|")>=0||e.indexOf(" AND ")>=0||e.indexOf(" OR ")>=0||e.indexOf(" and ")>=0||e.indexOf(" or ")>=0)){let t=i(n,e);if(t)return t;e=e.toString();const r=e.indexOf(" and ")>=0?e.split(" and "):new Array,l=e.indexOf(" or ")>=0?e.split(" or "):new Array,a=e.indexOf("|")>=0?e.split("|"):new Array;let o,c=e.indexOf(" AND ")>=0?e.split(" AND "):new Array,u=e.indexOf(" OR ")>=0?e.split(" OR "):new Array;if(c=c.concat(r),u=u.concat(l),a.length>0)for(let t=0;t<a.length;t++)a[t]=a[t].trim;if(u=u.concat(a),c.length>0)for(let t=0;t<c.length;t++)!c[t].indexOf(" OR ")>=0&&s.push(c[t]);if(u.length>0)for(let t=0;t<u.length;t++)!u[t].indexOf(" AND ")>=0&&s.push(u[t]);for(let e=0;e<s.length;e++){const r=s[e];if(r&&r.indexOf&&r.indexOf("..")>=0){const e=r.toString().split("..");2===e.length&&(t=n>=e[0]&&n<=e[1])}else t=i(n,r);const l=e<c.length?"and":"or";o=void 0===o?t:"or"===l?o||t:o&&t}return o}return e&&e.indexOf&&e.indexOf("..")>=0&&(s=e.toString().split(".."),2===s.length)?n>=s[0]&&n<=s[1]:i(n,e)}}),Smart.Utilities.Assign("DateFilter",class{constructor(t,e,r,n,i){const s=this,l=new Smart.Utilities.DateTime;if(s.value=t,s.type="dateFilter",void 0!==r){const e=l.parseDate(t,r);if(null!==e)s.filterdate=e;else{const e=l.tryparseDate(t);null!==e&&(s.filterdate=e)}}else{const e=new Date(t);"NaN"===e.toString()||"Invalid Date"===e.toString()?s.filterdate=l.tryparseDate(t):s.filterdate=e}if(!s.filterdate){const e=new Date(t);"NaN"===e.toString()||"Invalid Date"===e.toString()?s.filterdate=l.tryparseDate(t):s.filterdate=e}s.condition=e,s.formatString=r,s.timeOnly=i}toString(){return this.value&&this.value instanceof Date?this.condition+' "'+this.value.toISOString()+'"':this.condition+" "+this.value}evaluate(t){const e=this,r=e.condition,n=e.formatString;let i=e.value;if(e.timeOnly)return e.evaluateTimeOnly(t);if(null==t||""===t){if("NOT_NULL"===r)return!1;if("NULL"===r)return!0;switch(r){case"EQUAL":return t===i;case"NOT_EQUAL":return t!==i}return!1}if("NULL"===r)return!1;if("NOT_NULL"===r)return!0;let s,l=new Date;l.setFullYear(1900,0,1),l.setHours(12,0,0,0);try{const r=new Smart.Utilities.DateTime,a=new Date(t);if(l=t="NaN"===a.toString()||"Invalid Date"===a.toString()?r.tryparseDate(t):a,s=!1,void 0!==n&&(n.indexOf("t")>=0||n.indexOf("T")>=0||n.indexOf(":")>=0||n.indexOf("f")>=0)&&(s=!0,i&&-1===i.toString().indexOf(":"))){const t=r.tryparseDate(i.toString()+":00");null!==t&&(e.filterdate=t)}s||(l.setHours(0),l.setMinutes(0),l.setSeconds(0))}catch(e){if(null!==t&&""!==t.toString())return!1}if(null!==e.filterdate)i=e.filterdate;else if(i&&i.indexOf&&(-1!==i.indexOf(":")||!isNaN(parseInt(i)))){const t=new Date(l);t.setHours(12,0,0,0);const e=i.split(":");for(let r=0;r<e.length;r++)0===r&&t.setHours(e[r]),1===r&&t.setMinutes(e[r]),2===r&&t.setSeconds(e[r]);i=t}s&&i&&i.setFullYear&&l&&l.getFullYear&&-1===n.indexOf("d")&&-1===n.indexOf("M")&&-1===n.indexOf("y")&&i.setFullYear(l.getFullYear(),l.getMonth(),l.getDate());const a=function(t,e){switch(null===t&&(t=""),r){case"EQUAL":return t.toString()===e.toString();case"NOT_EQUAL":return t.toString()!==e.toString();case"GREATER_THAN":return t>e;case"GREATER_THAN_OR_EQUAL":return t>=e;case"LESS_THAN":return t<e;case"LESS_THAN_OR_EQUAL":return t<=e;case"STARTS_WITH":return e=e.toString().toLowerCase(),t.toString().toLowerCase().substring(0,e.length)===e;case"ENDS_WITH":return t=t.toString().toLowerCase(),e=e.toString().toLowerCase(),t.substring(t.length-e.length,t.length)===e;case"ENDS_WITH_CASE_SENSITIVE":return t=t.toString(),e=e.toString(),t.substring(t.length-e.length,t.length)===e;case"STARTS_WITH_CASE_SENSITIVE":return e=e.toString(),t.toString().substring(0,e.length)===e;case"CONTAINS":return-1!==t.toString().toLowerCase().indexOf(e.toString().toLowerCase());case"CONTAINS_CASE_SENSITIVE":return-1!==t.toString().indexOf(e.toString());case"DOES_NOT_CONTAIN":return-1===t.toString().toLowerCase().indexOf(e.toString().toLowerCase());case"DOES_NOT_CONTAIN_CASE_SENSITIVE":return-1===t.toString().indexOf(e.toString());default:return!0}};let o=new Array;if(i&&i.indexOf&&(i.indexOf("|")>=0||i.indexOf(" AND ")>=0||i.indexOf(" OR ")>=0||i.indexOf(" and ")>=0||i.indexOf(" or ")>=0)){let t=a(l,i);if(t)return t;const e=i.indexOf(" and ")>=0?i.split(" and "):new Array,r=i.indexOf(" or ")>=0?i.split(" or "):new Array,n=i.indexOf("|")>=0?i.split("|"):new Array;let s,c=i.indexOf(" AND ")>=0?i.split(" AND "):new Array,u=i.indexOf(" OR ")>=0?i.split(" OR "):new Array;if(c=c.concat(e),u=u.concat(r),n.length>0)for(let t=0;t<n.length;t++)n[t]=n[t].trim;if(u=u.concat(n),c.length>0)for(let t=0;t<c.length;t++)!c[t].indexOf(" OR ")>=0&&o.push(c[t]);if(u.length>0)for(let t=0;t<u.length;t++)!u[t].indexOf(" AND ")>=0&&o.push(u[t]);for(let e=0;e<o.length;e++){const r=o[e];if(r&&r.indexOf&&r.indexOf("..")>=0){const e=r.toString().split("..");2===e.length&&(t=l>=e[0]&&l<=e[1])}else t=a(l,r);const n=e<c.length?"and":"or";s=void 0===s?t:"or"===n?s||t:s&&t}return s}return i&&i.indexOf&&i.indexOf("..")>=0&&(o=i.toString().split(".."),2===o.length)?l>=o[0]&&l<=o[1]:a(l,i)}evaluateTimeOnly(t){const e=this.value;return e?!!(t&&t instanceof Date)&&(t.getHours()===e.getHours()&&(t.getMinutes()===e.getMinutes()&&t.getSeconds()===e.getSeconds())):!t}}),Smart.Utilities.Assign("CustomFilter",class{constructor(t,e,r){const n=this;n.value=t,n.condition=e,n.customfilter=r}toString(){return this.condition+" "+this.value}evaluate(t){const e=this;return e.customfilter(e.value,t,e.condition)}}),Smart.FilterGroup=Smart.Utilities.FilterGroup,Smart.StringFilter=Smart.Utilities.StringFilter,Smart.NumericFilter=Smart.Utilities.NumericFilter,Smart.DateFilter=Smart.Utilities.DateFilter,Smart.CustomFilter=Smart.Utilities.CustomFilter;
|
|
77
77
|
|
|
78
78
|
/***/ }),
|
|
79
79
|
|
|
80
80
|
/***/ 5766:
|
|
81
81
|
/***/ (() => {
|
|
82
82
|
|
|
83
|
-
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,l){super.propertyChangedHandler(e,t,l);const a=this,i=a._filterHandler;function s(){a.$.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 a._filterHandler}(),a._filterHandler=new(Smart.Utilities[a.filterType.slice(0,1).toUpperCase()+a.filterType.slice(1)+"FilterHandler"])(a)}switch(e){case"animation":case"disabled":case"rightToLeft":case"unfocusable":switch(a.mode){case"default":case"basic":[i.firstList,i.firstInput,i.logicalOperatorList,i.secondList,i.secondInput].forEach((function(t){t[e]=l}));break;case"excel":i.tree[e]=l;break;case"filterBuilder":i.filterBuilder[e]=l,i.caseSensitive&&(i.caseSensitive[e]=l)}break;case"buttons":a._setButtonsVisibility();break;case"data":case"dataField":"excel"!==a.mode||Array.isArray(a.dataSource)||s();break;case"dataSource":"excel"===a.mode&&s();break;case"filterType":a._filterType=l+"Filter",s();break;case"mode":s();break;case"formatString":if("date"!==a.filterType)return;switch(a.mode){case"default":case"basic":i.firstInput.formatString=l,i.secondInput.formatString=l;break;case"excel":s();break;case"filterBuilder":i.filterBuilder.formatStringDate=l,i.filterBuilder.formatStringDateTime=l}break;case"locale":case"messages":switch(a._localize(),a.mode){case"default":case"basic":{const t=i.firstList.selectedIndex,l=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:a.localize("and")},{value:1,label:a.localize("or")}],i.secondList.dataSource=JSON.parse(JSON.stringify(i.defaultListSource)),a.filterType){case"date":r.forEach((function(t){t.messages[a.locale]||(t.messages[a.locale]={});const l=a.localize("dateTabLabel");l&&(t.messages[a.locale].dateTabLabel=l);const i=a.localize("timeTabLabel");if(i&&(t.messages[a.locale].timeTabLabel=i),"locale"===e&&(t.locale=a.locale),"timePicker"===t._dropDownDisplayMode){const e=a.localize("placeholderTime");e&&(t.placeholder=e,t.placeholder=e)}else{const e=a.localize("placeholderDate");e&&(t.placeholder=e,t.placeholder=e)}}));break;case"numeric":r[0].placeholder=a.localize("placeholderNumber"),r[1].placeholder=a.localize("placeholderNumber");break;case"string":r[0].placeholder=a.localize("placeholderValue"),r[1].placeholder=a.localize("placeholderValue");break;case"boolean":r[0].placeholder=a.localize("placeholderBoolean"),r[1].placeholder=a.localize("placeholderBoolean")}i.firstList.selectedIndex=t,i.logicalOperatorList.selectedIndex=l,i.secondList.selectedIndex=s;break}case"excel":i.tree.selectAll&&(i.tree.selectAll.label=a.localize("selectAll")),i.tree.blanks&&(i.tree.blanks.label=a.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(l){-1!==t.indexOf(l)?e["$"+l+"Button"].removeClass("smart-hidden"):e["$"+l+"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 l=new Smart.Utilities.DateTime,a=e.formatString,i=l.getParseRegExp(l.calendar,a.replace(/y+/g,"yyyyy"));t.displayMode=Smart.Utilities.DateTime.detectDisplayMode(l,a,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,l=document.createElement("smart-input"),a=document.createElement("smart-input"),i=document.createElement("smart-input"),s=document.createDocumentFragment(),r=e=>{e.readonly=!0,e.dropDownButtonPosition="right"};l.classList.add("smart-filter-panel-list"),l.dataSource=JSON.parse(JSON.stringify(this.defaultListSource)),l.selectedIndex=e.defaultListSelection,r(l),a.classList.add("smart-filter-panel-operator-list"),a.dataSource=[{value:0,label:t.localize("and")},{value:1,label:t.localize("or")}],r(a),i.classList.add("smart-filter-panel-list"),i.dataSource=JSON.parse(JSON.stringify(this.defaultListSource)),i.selectedIndex=e.defaultListSelection,r(i),e.firstList=l,e.logicalOperatorList=a,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")),a.dropDownHeight="auto",a.selectedIndex=0,[l,e.firstInput,e.firstInputMatchCase,a,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,l){const a=this;a.cachedFilter={firstFilterComparison:e,firstFilterValue:a.firstInput.value,firstFilterCaseSensitive:a.firstInputMatchCase.classList.contains("active"),logicalOperator:t,secondFilterComparison:l,secondFilterValue:a.secondInput.value,secondFilterCaseSensitive:a.secondInputMatchCase.classList.contains("active")}}defaultFilter(){const e=this,t=e.context,l=e.getFilterInputValue(e.firstInput),a=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)),""!==l||-1!==["NULL","NOT_NULL","EMPTY","NOT_EMPTY"].indexOf(r)){const i=s.createFilter(t._filterType,l,r,void 0,t.formatString,t.locale,"timePicker"===e.firstInput._dropDownDisplayMode);s.addFilter(a,i)}if(""!==i||-1!==["NULL","NOT_NULL","EMPTY","NOT_EMPTY"].indexOf(n)){const l=s.createFilter(t._filterType,i,n,void 0,t.formatString,t.locale,"timePicker"===e.secondInput._dropDownDisplayMode);s.addFilter(a,l)}let o=e.firstList.selectedIndexes[0],d=e.secondList.selectedIndexes[0];const u=s.stringConditions;l&&"string"==typeof l&&(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 l=e.tree,a=e.filterObject;if(a.clear(),e.customItems=[],l._menuItems[0].selected)return void e.excelClear();const i=l.selectedIndexes;if(i.forEach((function(i){const s=l._menuItems[i];if(s instanceof Smart.TreeItem){const l=s.value;if(s.hasAttribute("default-item"))if(l instanceof Date){const i=new Smart.FilterGroup,s=new Date(l.getFullYear(),l.getMonth(),1),r=new Date(l.getFullYear(),l.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),a.addFilter("or",i)}else{const i=e.getExcelComparison(l),s=a.createFilter(t._filterType,l,i,void 0,t.formatString,t.locale,e.timeOnly);a.addFilter("or",s)}else e.customItems.push(s)}})),0===i.length){const l=e.getExcelComparison("Empty Filter"),i=a.createFilter(t._filterType,"Empty Filter",l,void 0,t.formatString,t.locale,e.timeOnly);a.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 l=e.context,a=[],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 a=0;a<t.length;a++){const s=t[a],r=e.operationsMapping[s[1]],n=i.createFilter(l._filterType,s[2],r,void 0,l.formatString,l.locale,e.timeOnly);i.addFilter("and",n)}a.push(i)}})),e.customExcelFilterObjects=a,e.cachedFilter=i.slice(0)}getExcelComparison(e){return""===e?"NULL":"EQUAL"}filterBuilderFilter(){const e=this,t=e.filterBuilder.value,l="string"===e.context.filterType&&e.caseSensitive.checked,a={filters:[]};!function t(a,i){const s=new Smart.Utilities.FilterGroup,r=a[1];i.logicalOperator=r;for(let n=0;n<a.length;n++){if(1===n)continue;const c=a[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,l))}s.filters.length>0&&i.filters.push(s)}(t,a),e.filterBuilderObject=a,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:l}}createFilterBuilderFilter(e,t,l){const a=this.context;let i=this.operationsMapping[t[1]];return l&&-1!==["CONTAINS","DOES_NOT_CONTAIN","STARTS_WITH","ENDS_WITH","EQUAL"].indexOf(i)&&(i+="_CASE_SENSITIVE"),e.createFilter(a._filterType,t[2],i,void 0,a.formatString,a.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,l=null;if(e.filterObject){const a=e.filterObject.stringConditions,i=e.filterObject.numericConditions,s=e.filterObject.booleanConditions,r=e.filterObject.dateConditions;t=a[e.cachedFilter.firstFilterComparison],l=a[e.cachedFilter.secondFilterComparison],e.cachedFilter.firstFilterValue&&"string"!=typeof e.cachedFilter.firstFilterValue&&(!0===e.cachedFilter.firstFilterValue||!1===e.cachedFilter.firstFilterValue?(t=s[e.cachedFilter.firstFilterComparison],l=s[e.cachedFilter.secondFilterComparison]):e.cachedFilter.firstFilterValue&&e.cachedFilter.firstFilterValue instanceof Date?(t=r[e.cachedFilter.firstFilterComparison],l=r[e.cachedFilter.secondFilterComparison]):(t=i[e.cachedFilter.firstFilterComparison],l=i[e.cachedFilter.secondFilterComparison]))}let a=-1;e.firstList.dataSource.find(((e,l)=>{if(e.value===t)return a=l,e}));let i=-1;e.secondList.dataSource.find(((e,t)=>{if(e.value===l)return i=t,e})),e.firstList.selectedIndexes=[a],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,l=e.cachedFilter.secondFilterValue,a=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===l?("NOT_EQUAL"!==s[a]&&"DOES_NOT_CONTAIN"!==s[a]||r.pop(),"NOT_EQUAL"!==s[i]&&"DOES_NOT_CONTAIN"!==s[i]||r.pop()):e.label===t&&e.label===l||("EQUAL"!==s[a]&&"EQUAL_CASE_SENSITIVE"!==s[a]&&"CONTAINS"!==s[a]&&"ENDS_WITH"!==s[a]&&"STARTS_WITH"!==s[a]||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(((l,a)=>{t.push("0."+a);let i=!1;e.cachedFilter.filters.forEach((e=>{e.value===l.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,l=document.createElement("smart-tree"),a={data:t.data,dataField:t.dataField,filterType:t._filterType};if(t.dataSource&&Array.isArray(t.dataSource))e.processCustomDataSource(l);else{if(t.data&&t.dataField||t.error(t.localize("missingProperty")),"date"===t.filterType){a.formatString=t.formatString,a.displayMode=e.displayMode,e.dataSource=e.filterObject.getUniqueValues(a,t);try{e.getHierarchicalDataSource(e.displayMode)}catch(e){t.error(t.localize("mismatchedProperties"))}e.timeOnly?l.classList.add("standard-excel"):l.classList.add("date-excel")}else e.dataSource=e.filterObject.getUniqueValues(a,t),l.classList.add("standard-excel");"function"==typeof t.dataSource&&(e.dataSource=t.dataSource(e.dataSource)||e.dataSource)}l.animation=t.animation,l.disabled=t.disabled,l.unfocusable=t.unfocusable,l.dataSource=[{label:t.localize("selectAll"),value:"",items:e.dataSource,expanded:!0,selected:!0}],l.selectionMode="checkBox",l.hasThreeStates=!0,l.theme=t.theme,l.animation="none",l.toggleMode="arrow",l.rightToLeft=t.rightToLeft,l.addEventListener("collapsing",(function(e){1===e.detail.item.level&&e.preventDefault()})),l._onCompleted=function(){if(e.cachedFilter=l.selectedIndexes.slice(0),l.classList.contains("date-excel"))for(let e in l._menuItems){if("0"===e)continue;const t=l._menuItems[e];t.firstElementChild.style.paddingLeft=20*(t.level-1)-10+"px"}else l._menuItems[0].firstElementChild.style.paddingLeft=0;l.selectAll=l._menuItems[0],l.blanks=l.querySelector('[label="'+t.localize("blanks")+'"]'),"en"!==t.locale&&(l.selectAll&&(l.selectAll.label=t.localize("selectAll")),l.blanks&&(l.blanks.label=t.localize("blanks")))},e.tree=l,t.$.mainContainer.appendChild(l)}processCustomDataSource(e){const t=this.context.dataSource;e.classList.add("standard-excel"),this.dataSource=t}createBuilderHTMLStructure(){const e=this,t=e.context,l=document.createElement("smart-filter-builder"),a=t.dataField,i="numeric"===t.filterType?"number":t.filterType;if(e.filterBuilder=l,l.animation=t.animation,l.disabled=t.disabled,l.unfocusable=t.unfocusable,l.value=["and"],l.fields=[{label:a,dataField:a,dataType:i,filterOperations:e.filterBuilderOperations}],e.localizeFilterBuilder(),t.$.mainContainer.appendChild(l),"string"===i){const l=document.createElement("smart-check-box");l.classList.add("case-sensitive"),l.innerHTML="Case sensitive",l.animation=t.animation,l.disabled=t.disabled,l.unfocusable=t.unfocusable,l.checked=!1,e.caseSensitive=l,t.$.mainContainer.appendChild(l)}e.filterBuilderObject={filters:[]},e.cachedFilter={filterBuilder:["and"],caseSensitive:!1}}localizeFilterBuilder(){const e=this.context,t=this.filterBuilder;let l=t.messages[e.locale];l||(l={},t.messages[e.locale]=l),t.customOperations=[{name:"NULL",label:e.localize("null"),hideValue:!0},{name:"NOT_NULL",label:e.localize("notNull"),hideValue:!0}],l.addCondition=e.localize("addCondition"),l.addGroup=e.localize("addGroup"),l["<"]=e.localize("lessThan"),l["<="]=e.localize("lessThanOrEqual"),l["<>"]=e.localize("notEqual"),l["="]=e.localize("equal"),l[">"]=e.localize("greaterThan"),l[">="]=e.localize("greaterThanOrEqual"),l.and=e.localize("and"),l.contains=e.localize("contains"),l.endswith=e.localize("endsWith"),l.isblank=e.localize("empty"),l.isnotblank=e.localize("notEmpty"),l.notcontains=e.localize("doesNotContain"),l.or=e.localize("or"),l.startswith=e.localize("startsWith"),l.dateTabLabel=e.localize("dateTabLabel"),l.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,l=t.context;if("default"===l.mode||"basic"===l.mode)return t.filterObject.evaluate(e);if("excel"===l.mode){let a=!1;if(Array.isArray(l.dataSource)){if(!t.customExcelFilterObjects||0===t.customExcelFilterObjects.length)return!0;for(let l=0;l<t.customExcelFilterObjects.length;l++)a=a||t.customExcelFilterObjects[l].evaluate(e);return a}if(t.customItems&&t.customItems.length>0){if(t.filterObject.filters.length>0&&(a=t.filterObject.evaluate(e)),t.customItems&&l.evaluateFilterExpression)for(let i=0;i<t.customItems.length;i++){const s=l.evaluateFilterExpression(e,t.customItems[i].value);void 0!==s&&(a=a||s)}}else a=t.filterObject.evaluate(e);return a}return!t.filterBuilderObject.logicalOperator||function t(l){let a="and"===l.logicalOperator;for(let i=0;i<l.filters.length;i++){let s;s=l.filters[i]instanceof Smart.Utilities.FilterGroup?l.filters[i].evaluate(e):t(l.filters[i]),a="and"===l.logicalOperator?a&&s:a||s}return a}(t.filterBuilderObject)}}),Smart.Utilities.Assign("NumericFilterHandler",class extends Smart.Utilities.BaseFilterHandler{appendInputs(){let e=this,t=document.createElement("smart-number-input"),l=document.createElement("smart-number-input");t.placeholder=e.context.localize("placeholderNumber"),l.placeholder=e.context.localize("placeholderNumber"),t.nullable=!0,t.spinButtons=!0,t.value=null,l.nullable=!0,l.spinButtons=!0,l.value=null,e.firstInput=t,e.secondInput=l}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"),l=document.createElement("input");t.placeholder=e.context.localize("placeholderValue"),t.setAttribute("aria-label",t.placeholder),l.placeholder=e.context.localize("placeholderValue"),l.setAttribute("aria-label",l.placeholder),t.classList.add("smart-input"),l.classList.add("smart-input"),e.firstInput=t,e.secondInput=l,e.firstInputMatchCase.onclick=()=>{e.firstInputMatchCase.classList.toggle("active")},e.secondInputMatchCase.onclick=()=>{e.secondInputMatchCase.classList.toggle("active")};const a=(e,t,l)=>{if(0===e.selectedValues.length)return t.classList.remove("case-sensitive"),void l.classList.remove("case-sensitive");const a=e.selectedValues[0];t.classList.remove("case-sensitive"),l.classList.remove("case-sensitive"),["EQUAL","NOT_EQUAL","CONTAINS","DOES_NOT_CONTAIN","STARTS_WITH","ENDS_WITH"].indexOf(a)>=0&&(t.classList.add("case-sensitive"),l.classList.add("case-sensitive"))};e.firstList.onchange=()=>{a(e.firstList,e.firstInput,e.firstInputMatchCase)},e.secondList.onchange=()=>{a(e.secondList,e.secondInput,e.secondInputMatchCase)},setTimeout((()=>{a(e.firstList,e.firstInput,e.firstInputMatchCase),a(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,l){const a=this;a.cachedFilter={firstFilterComparison:e,firstFilterValue:a.firstInput.getValue(),logicalOperator:t,secondFilterComparison:l,secondFilterValue:a.secondInput.getValue()}}appendInputs(){let e=this,t=e.context,l=document.createElement("smart-date-input"),a=document.createElement("smart-date-input");t.formatString&&!(t.formatString.indexOf("d")>=0||t.formatString.indexOf("M")>=0||t.formatString.indexOf("y")>=0)&&(l=document.createElement("smart-time-input"),a=document.createElement("smart-time-input")),l.calendarButton=!0,l.editMode="partial",l.formatString=t.formatString,l.dropDownDisplayMode="auto",l.locale=t.locale,l.autoClose=!0,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,a.autoClose=!0,a.calendarButton=!0,a.formatString=t.formatString,a.dropDownDisplayMode="auto",a.locale=t.locale,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,e.firstInput=l,e.secondInput=a}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,l=t.dataSource,a={},i=[];let s;if("timePicker"!==e){""===l[l.length-1].value&&(s=l[l.length-1],l.pop()),l.forEach((function(e){const l=e.value,i=l.getFullYear(),s=new Intl.DateTimeFormat(t.context.locale,{month:"long"}).format(l);a[i]||(a[i]={}),a[i][s]||(a[i][s]=e.value)}));for(let e in a){const t={expanded:!0,label:e,items:[],customAttribute:"default-item"};i.push(t);for(let l in a[e]){const i={value:a[e][l],expanded:!0,label:l,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,l){const a=this;a.cachedFilter={firstFilterComparison:e,firstFilterValue:a.firstInput.selectedIndexes.slice(0),logicalOperator:t,secondFilterComparison:l,secondFilterValue:a.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"),l=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",l.dataSource=[{value:!0,label:"true"},{value:!1,label:"false"}],l.placeholder=e.context.localize("placeholderBoolean"),l.selectedIndexes=[],l.selectionMode="zeroOrOne",l.readonly=!0,l.dropDownButtonPosition="right",e.firstInput=t,e.secondInput=l}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}});
|
|
83
|
+
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",true:"true",false:"false"}},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,l){super.propertyChangedHandler(e,t,l);const a=this,i=a._filterHandler;function s(){a.$.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 a._filterHandler}(),a._filterHandler=new(Smart.Utilities[a.filterType.slice(0,1).toUpperCase()+a.filterType.slice(1)+"FilterHandler"])(a)}switch(e){case"animation":case"disabled":case"rightToLeft":case"unfocusable":switch(a.mode){case"default":case"basic":[i.firstList,i.firstInput,i.logicalOperatorList,i.secondList,i.secondInput].forEach((function(t){t[e]=l}));break;case"excel":i.tree[e]=l;break;case"filterBuilder":i.filterBuilder[e]=l,i.caseSensitive&&(i.caseSensitive[e]=l)}break;case"buttons":a._setButtonsVisibility();break;case"data":case"dataField":"excel"!==a.mode||Array.isArray(a.dataSource)||s();break;case"dataSource":"excel"===a.mode&&s();break;case"filterType":a._filterType=l+"Filter",s();break;case"mode":s();break;case"formatString":if("date"!==a.filterType)return;switch(a.mode){case"default":case"basic":i.firstInput.formatString=l,i.secondInput.formatString=l;break;case"excel":s();break;case"filterBuilder":i.filterBuilder.formatStringDate=l,i.filterBuilder.formatStringDateTime=l}break;case"locale":case"messages":switch(a._localize(),a.mode){case"default":case"basic":{const t=i.firstList.selectedIndex,l=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:a.localize("and")},{value:1,label:a.localize("or")}],i.secondList.dataSource=JSON.parse(JSON.stringify(i.defaultListSource)),a.filterType){case"date":r.forEach((function(t){t.messages[a.locale]||(t.messages[a.locale]={});const l=a.localize("dateTabLabel");l&&(t.messages[a.locale].dateTabLabel=l);const i=a.localize("timeTabLabel");if(i&&(t.messages[a.locale].timeTabLabel=i),"locale"===e&&(t.locale=a.locale),"timePicker"===t._dropDownDisplayMode){const e=a.localize("placeholderTime");e&&(t.placeholder=e,t.placeholder=e)}else{const e=a.localize("placeholderDate");e&&(t.placeholder=e,t.placeholder=e)}}));break;case"numeric":r[0].placeholder=a.localize("placeholderNumber"),r[1].placeholder=a.localize("placeholderNumber");break;case"string":r[0].placeholder=a.localize("placeholderValue"),r[1].placeholder=a.localize("placeholderValue");break;case"boolean":r[0].placeholder=a.localize("placeholderBoolean"),r[1].placeholder=a.localize("placeholderBoolean")}i.firstList.selectedIndex=t,i.logicalOperatorList.selectedIndex=l,i.secondList.selectedIndex=s;break}case"excel":i.tree.selectAll&&(i.tree.selectAll.label=a.localize("selectAll")),i.tree.blanks&&(i.tree.blanks.label=a.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(l){-1!==t.indexOf(l)?e["$"+l+"Button"].removeClass("smart-hidden"):e["$"+l+"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 l=new Smart.Utilities.DateTime,a=e.formatString,i=l.getParseRegExp(l.calendar,a.replace(/y+/g,"yyyyy"));t.displayMode=Smart.Utilities.DateTime.detectDisplayMode(l,a,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,l=document.createElement("smart-input"),a=document.createElement("smart-input"),i=document.createElement("smart-input"),s=document.createDocumentFragment(),r=e=>{e.readonly=!0,e.dropDownButtonPosition="right"};l.classList.add("smart-filter-panel-list"),l.dataSource=JSON.parse(JSON.stringify(this.defaultListSource)),l.selectedIndex=e.defaultListSelection,r(l),a.classList.add("smart-filter-panel-operator-list"),a.dataSource=[{value:0,label:t.localize("and")},{value:1,label:t.localize("or")}],r(a),i.classList.add("smart-filter-panel-list"),i.dataSource=JSON.parse(JSON.stringify(this.defaultListSource)),i.selectedIndex=e.defaultListSelection,r(i),e.firstList=l,e.logicalOperatorList=a,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")),a.dropDownHeight="auto",a.selectedIndex=0,[l,e.firstInput,e.firstInputMatchCase,a,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,l){const a=this;a.cachedFilter={firstFilterComparison:e,firstFilterValue:a.firstInput.value,firstFilterCaseSensitive:a.firstInputMatchCase.classList.contains("active"),logicalOperator:t,secondFilterComparison:l,secondFilterValue:a.secondInput.value,secondFilterCaseSensitive:a.secondInputMatchCase.classList.contains("active")}}defaultFilter(){const e=this,t=e.context,l=e.getFilterInputValue(e.firstInput),a=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)),""!==l||-1!==["NULL","NOT_NULL","EMPTY","NOT_EMPTY"].indexOf(r)){const i=s.createFilter(t._filterType,l,r,void 0,t.formatString,t.locale,"timePicker"===e.firstInput._dropDownDisplayMode);s.addFilter(a,i)}if(""!==i||-1!==["NULL","NOT_NULL","EMPTY","NOT_EMPTY"].indexOf(n)){const l=s.createFilter(t._filterType,i,n,void 0,t.formatString,t.locale,"timePicker"===e.secondInput._dropDownDisplayMode);s.addFilter(a,l)}let o=e.firstList.selectedIndexes[0],d=e.secondList.selectedIndexes[0];const u=s.stringConditions;l&&"string"==typeof l&&(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 l=e.tree,a=e.filterObject;if(a.clear(),e.customItems=[],l._menuItems[0].selected)return void e.excelClear();const i=l.selectedIndexes;if(i.forEach((function(i){const s=l._menuItems[i];if(s instanceof Smart.TreeItem){const l=s.value;if(s.hasAttribute("default-item"))if(l instanceof Date){const i=new Smart.FilterGroup,s=new Date(l.getFullYear(),l.getMonth(),1),r=new Date(l.getFullYear(),l.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),a.addFilter("or",i)}else{const i=e.getExcelComparison(l),s=a.createFilter(t._filterType,l,i,void 0,t.formatString,t.locale,e.timeOnly);a.addFilter("or",s)}else e.customItems.push(s)}})),0===i.length){const l=e.getExcelComparison("Empty Filter"),i=a.createFilter(t._filterType,"Empty Filter",l,void 0,t.formatString,t.locale,e.timeOnly);a.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 l=e.context,a=[],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 a=0;a<t.length;a++){const s=t[a],r=e.operationsMapping[s[1]],n=i.createFilter(l._filterType,s[2],r,void 0,l.formatString,l.locale,e.timeOnly);i.addFilter("and",n)}a.push(i)}})),e.customExcelFilterObjects=a,e.cachedFilter=i.slice(0)}getExcelComparison(e){return""===e?"NULL":"EQUAL"}filterBuilderFilter(){const e=this,t=e.filterBuilder.value,l="string"===e.context.filterType&&e.caseSensitive.checked,a={filters:[]};!function t(a,i){const s=new Smart.Utilities.FilterGroup,r=a[1];i.logicalOperator=r;for(let n=0;n<a.length;n++){if(1===n)continue;const c=a[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,l))}s.filters.length>0&&i.filters.push(s)}(t,a),e.filterBuilderObject=a,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:l}}createFilterBuilderFilter(e,t,l){const a=this.context;let i=this.operationsMapping[t[1]];return l&&-1!==["CONTAINS","DOES_NOT_CONTAIN","STARTS_WITH","ENDS_WITH","EQUAL"].indexOf(i)&&(i+="_CASE_SENSITIVE"),e.createFilter(a._filterType,t[2],i,void 0,a.formatString,a.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,l=null;if(e.filterObject){const a=e.filterObject.stringConditions,i=e.filterObject.numericConditions,s=e.filterObject.booleanConditions,r=e.filterObject.dateConditions;t=a[e.cachedFilter.firstFilterComparison],l=a[e.cachedFilter.secondFilterComparison],e.cachedFilter.firstFilterValue&&"string"!=typeof e.cachedFilter.firstFilterValue&&(!0===e.cachedFilter.firstFilterValue||!1===e.cachedFilter.firstFilterValue?(t=s[e.cachedFilter.firstFilterComparison],l=s[e.cachedFilter.secondFilterComparison]):e.cachedFilter.firstFilterValue&&e.cachedFilter.firstFilterValue instanceof Date?(t=r[e.cachedFilter.firstFilterComparison],l=r[e.cachedFilter.secondFilterComparison]):(t=i[e.cachedFilter.firstFilterComparison],l=i[e.cachedFilter.secondFilterComparison]))}let a=-1;e.firstList.dataSource.find(((e,l)=>{if(e.value===t)return a=l,e}));let i=-1;e.secondList.dataSource.find(((e,t)=>{if(e.value===l)return i=t,e})),e.firstList.selectedIndexes=[a],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,l=e.cachedFilter.secondFilterValue,a=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===l?("NOT_EQUAL"!==s[a]&&"DOES_NOT_CONTAIN"!==s[a]||r.pop(),"NOT_EQUAL"!==s[i]&&"DOES_NOT_CONTAIN"!==s[i]||r.pop()):e.label===t&&e.label===l||("EQUAL"!==s[a]&&"EQUAL_CASE_SENSITIVE"!==s[a]&&"CONTAINS"!==s[a]&&"ENDS_WITH"!==s[a]&&"STARTS_WITH"!==s[a]||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(((l,a)=>{t.push("0."+a);let i=!1;e.cachedFilter.filters.forEach((e=>{"booleanFilter"===e.type&&e.value===l.value&&(i=!0),e.value===l.label&&(i=!0)})),i||t.pop()})),void setTimeout((()=>{const l=e.tree.selectedIndexes;e.tree.selectedIndexes=t,e.tree._applySelection(!1,l)}))}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,l=document.createElement("smart-tree"),a={data:t.data,dataField:t.dataField,filterType:t._filterType};if(t.dataSource&&Array.isArray(t.dataSource))e.processCustomDataSource(l);else{if(t.data&&t.dataField||t.error(t.localize("missingProperty")),"date"===t.filterType){a.formatString=t.formatString,a.displayMode=e.displayMode,e.dataSource=e.filterObject.getUniqueValues(a,t);try{e.getHierarchicalDataSource(e.displayMode)}catch(e){t.error(t.localize("mismatchedProperties"))}e.timeOnly?l.classList.add("standard-excel"):l.classList.add("date-excel")}else e.dataSource=e.filterObject.getUniqueValues(a,t),l.classList.add("standard-excel");"function"==typeof t.dataSource&&(e.dataSource=t.dataSource(e.dataSource)||e.dataSource)}l.animation=t.animation,l.disabled=t.disabled,l.unfocusable=t.unfocusable,l.dataSource=[{label:t.localize("selectAll"),value:"",items:e.dataSource,expanded:!0,selected:!0}],l.selectionMode="checkBox",l.hasThreeStates=!0,l.theme=t.theme,l.animation="none",l.toggleMode="arrow",l.rightToLeft=t.rightToLeft,l.addEventListener("collapsing",(function(e){1===e.detail.item.level&&e.preventDefault()})),l._onCompleted=function(){if(e.cachedFilter=l.selectedIndexes.slice(0),l.classList.contains("date-excel"))for(let e in l._menuItems){if("0"===e)continue;const t=l._menuItems[e];t.firstElementChild.style.paddingLeft=20*(t.level-1)-10+"px"}else l._menuItems[0].firstElementChild.style.paddingLeft=0;l.selectAll=l._menuItems[0],l.blanks=l.querySelector('[label="'+t.localize("blanks")+'"]'),"en"!==t.locale&&(l.selectAll&&(l.selectAll.label=t.localize("selectAll")),l.blanks&&(l.blanks.label=t.localize("blanks")))},e.tree=l,t.$.mainContainer.appendChild(l)}processCustomDataSource(e){const t=this.context.dataSource;e.classList.add("standard-excel"),this.dataSource=t}createBuilderHTMLStructure(){const e=this,t=e.context,l=document.createElement("smart-filter-builder"),a=t.dataField,i="numeric"===t.filterType?"number":t.filterType;if(e.filterBuilder=l,l.animation=t.animation,l.disabled=t.disabled,l.unfocusable=t.unfocusable,l.value=["and"],l.fields=[{label:a,dataField:a,dataType:i,filterOperations:e.filterBuilderOperations}],e.localizeFilterBuilder(),t.$.mainContainer.appendChild(l),"string"===i){const l=document.createElement("smart-check-box");l.classList.add("case-sensitive"),l.innerHTML="Case sensitive",l.animation=t.animation,l.disabled=t.disabled,l.unfocusable=t.unfocusable,l.checked=!1,e.caseSensitive=l,t.$.mainContainer.appendChild(l)}e.filterBuilderObject={filters:[]},e.cachedFilter={filterBuilder:["and"],caseSensitive:!1}}localizeFilterBuilder(){const e=this.context,t=this.filterBuilder;let l=t.messages[e.locale];l||(l={},t.messages[e.locale]=l),t.customOperations=[{name:"NULL",label:e.localize("null"),hideValue:!0},{name:"NOT_NULL",label:e.localize("notNull"),hideValue:!0}],l.addCondition=e.localize("addCondition"),l.addGroup=e.localize("addGroup"),l["<"]=e.localize("lessThan"),l["<="]=e.localize("lessThanOrEqual"),l["<>"]=e.localize("notEqual"),l["="]=e.localize("equal"),l[">"]=e.localize("greaterThan"),l[">="]=e.localize("greaterThanOrEqual"),l.and=e.localize("and"),l.contains=e.localize("contains"),l.endswith=e.localize("endsWith"),l.isblank=e.localize("empty"),l.isnotblank=e.localize("notEmpty"),l.notcontains=e.localize("doesNotContain"),l.or=e.localize("or"),l.startswith=e.localize("startsWith"),l.dateTabLabel=e.localize("dateTabLabel"),l.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,l=t.context;if("default"===l.mode||"basic"===l.mode)return t.filterObject.evaluate(e);if("excel"===l.mode){let a=!1;if(Array.isArray(l.dataSource)){if(!t.customExcelFilterObjects||0===t.customExcelFilterObjects.length)return!0;for(let l=0;l<t.customExcelFilterObjects.length;l++)a=a||t.customExcelFilterObjects[l].evaluate(e);return a}if(t.customItems&&t.customItems.length>0){if(t.filterObject.filters.length>0&&(a=t.filterObject.evaluate(e)),t.customItems&&l.evaluateFilterExpression)for(let i=0;i<t.customItems.length;i++){const s=l.evaluateFilterExpression(e,t.customItems[i].value);void 0!==s&&(a=a||s)}}else a=t.filterObject.evaluate(e);return a}return!t.filterBuilderObject.logicalOperator||function t(l){let a="and"===l.logicalOperator;for(let i=0;i<l.filters.length;i++){let s;s=l.filters[i]instanceof Smart.Utilities.FilterGroup?l.filters[i].evaluate(e):t(l.filters[i]),a="and"===l.logicalOperator?a&&s:a||s}return a}(t.filterBuilderObject)}}),Smart.Utilities.Assign("NumericFilterHandler",class extends Smart.Utilities.BaseFilterHandler{appendInputs(){let e=this,t=document.createElement("smart-number-input"),l=document.createElement("smart-number-input");t.placeholder=e.context.localize("placeholderNumber"),l.placeholder=e.context.localize("placeholderNumber"),t.nullable=!0,t.spinButtons=!0,t.value=null,l.nullable=!0,l.spinButtons=!0,l.value=null,e.firstInput=t,e.secondInput=l}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"),l=document.createElement("input");t.placeholder=e.context.localize("placeholderValue"),t.setAttribute("aria-label",t.placeholder),l.placeholder=e.context.localize("placeholderValue"),l.setAttribute("aria-label",l.placeholder),t.classList.add("smart-input"),l.classList.add("smart-input"),e.firstInput=t,e.secondInput=l,e.firstInputMatchCase.onclick=()=>{e.firstInputMatchCase.classList.toggle("active")},e.secondInputMatchCase.onclick=()=>{e.secondInputMatchCase.classList.toggle("active")};const a=(e,t,l)=>{if(0===e.selectedValues.length)return t.classList.remove("case-sensitive"),void l.classList.remove("case-sensitive");const a=e.selectedValues[0];t.classList.remove("case-sensitive"),l.classList.remove("case-sensitive"),["EQUAL","NOT_EQUAL","CONTAINS","DOES_NOT_CONTAIN","STARTS_WITH","ENDS_WITH"].indexOf(a)>=0&&(t.classList.add("case-sensitive"),l.classList.add("case-sensitive"))};e.firstList.onchange=()=>{a(e.firstList,e.firstInput,e.firstInputMatchCase)},e.secondList.onchange=()=>{a(e.secondList,e.secondInput,e.secondInputMatchCase)},setTimeout((()=>{a(e.firstList,e.firstInput,e.firstInputMatchCase),a(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,l){const a=this;a.cachedFilter={firstFilterComparison:e,firstFilterValue:a.firstInput.getValue(),logicalOperator:t,secondFilterComparison:l,secondFilterValue:a.secondInput.getValue()}}appendInputs(){let e=this,t=e.context,l=document.createElement("smart-date-input"),a=document.createElement("smart-date-input");t.formatString&&!(t.formatString.indexOf("d")>=0||t.formatString.indexOf("M")>=0||t.formatString.indexOf("y")>=0)&&(l=document.createElement("smart-time-input"),a=document.createElement("smart-time-input")),l.calendarButton=!0,l.editMode="partial",l.formatString=t.formatString,l.dropDownDisplayMode="auto",l.locale=t.locale,l.autoClose=!0,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,a.autoClose=!0,a.calendarButton=!0,a.formatString=t.formatString,a.dropDownDisplayMode="auto",a.locale=t.locale,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,e.firstInput=l,e.secondInput=a}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,l=t.dataSource,a={},i=[];let s;if("timePicker"!==e){""===l[l.length-1].value&&(s=l[l.length-1],l.pop()),l.forEach((function(e){const l=e.value,i=l.getFullYear(),s=new Intl.DateTimeFormat(t.context.locale,{month:"long"}).format(l);a[i]||(a[i]={}),a[i][s]||(a[i][s]=e.value)}));for(let e in a){const t={expanded:!0,label:e,items:[],customAttribute:"default-item"};i.push(t);for(let l in a[e]){const i={value:a[e][l],expanded:!0,label:l,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,l){const a=this;a.cachedFilter={firstFilterComparison:e,firstFilterValue:a.firstInput.selectedIndexes.slice(0),logicalOperator:t,secondFilterComparison:l,secondFilterValue:a.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"),l=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",l.dataSource=[{value:!0,label:"true"},{value:!1,label:"false"}],l.placeholder=e.context.localize("placeholderBoolean"),l.selectedIndexes=[],l.selectionMode="zeroOrOne",l.readonly=!0,l.dropDownButtonPosition="right",e.firstInput=t,e.secondInput=l}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}});
|
|
84
84
|
|
|
85
85
|
/***/ }),
|
|
86
86
|
|
|
@@ -101,7 +101,7 @@ Smart("smart-grid-panel",class extends Smart.BaseElement{static get properties()
|
|
|
101
101
|
/***/ 8588:
|
|
102
102
|
/***/ (() => {
|
|
103
103
|
|
|
104
|
-
Smart("smart-input",class extends Smart.BaseElement{static get properties(){return{autoCompleteDelay:{value:100,type:"number"},dataSource:{type:"any",value:[],reflectToAttribute:!1},dropDownClassList:{value:[],type:"array",reflectToAttribute:!1},dropDownDataSource:{type:"any",reflectToAttribute:!1,value:[]},dropDownHeight:{type:"any",value:200},dropDownOpenMode:{allowedValues:["default","manual"],value:"default",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownWidth:{type:"any",value:null},dropDownButtonPosition:{allowedValues:["none","left","right"],value:"none",type:"string"},dropDownOpenPosition:{allowedValues:["bottom","top","auto"],value:"bottom",type:"string"},dropDownPlaceholder:{type:"string",value:""},hint:{type:"string",value:""},inputPurpose:{type:"string",value:"off"},items:{type:"number",value:8},minLength:{type:"number",value:1},maxLength:{type:"number",value:99999999},name:{value:"",type:"string"},prefix:{value:"",type:"string",reflectToAttribute:!1},suffix:{value:"",type:"string",reflectToAttribute:!1},onAffixClick:{value:null,type:"any",reflectToAttribute:!1},opened:{value:!1,type:"boolean"},query:{type:"string",value:""},queryMode:{allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string",value:"containsIgnoreCase"},placeholder:{value:"",type:"string"},readonly:{type:"boolean",value:!1},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},selectedIndex:{type:"number",value:-1},selectedValue:{type:"any",value:""},selectedValues:{value:[],type:"array"},type:{type:"string"},value:{type:"string",value:""},innerHTML:{type:"string",reflectToAttribute:!1}}}static get styleUrls(){return["smart.textbox.css"]}template(){return'<div id="inputContainer" role="presentation"><div id="optionsContainer" inner-h-t-m-l=\'{{innerHTML}}\' class="smart-hidden"></div><span class="smart-input-prefix" id="prefix" inner-h-t-m-l=\'{{prefix}}\'></span><input maxlength=\'[[maxLength]]\' class="smart-input" id=\'input\' readonly=\'[[readonly]]\' placeholder=\'[[placeholder]]\' type=\'[[type]]\' name=\'[[name]]\' value=\'{{value::keyup}}\' disabled=\'[[disabled]]\' aria-label="[[placeholder]]" /><span class="smart-hidden smart-hint" id="span">[[hint]]</span><span id="suffix" class="smart-input-suffix" inner-h-t-m-l=\'{{suffix}}\'></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.focus":"_focusHandler","input.blur":"_blurHandler","input.keydown":"_keyDownHandler","input.keyup":"_keyUpHandler","input.keypress":"_keyPressHandler","input.paste":"_pasteHandler","prefix.click":"_prefixClick","suffix.click":"_suffixClick","dropDownButton.down":"_dropDownButtonDownHandler","inputContainer.down":"_downHandler","document.up":"_documentUpHandler"}}_prefixClick(e){const t=this;if(t.onAffixClick)if("string"==typeof t.onAffixClick){const o=t.onAffixClick.replace("()","");window[o]&&window[o].apply(t,e)}else t.onAffixClick(e)}_suffixClick(e){const t=this;if("string"==typeof t.onAffixClick){const o=t.onAffixClick.replace("()","");window[o]&&window[o].apply(t,e)}else t.onAffixClick(e)}get selectedIndexes(){return this.isCompleted?[this.selectedIndex]:[]}set selectedIndexes(e){if(!this.isCompleted)return;const t=this;if(e&&void 0!==e[0]){if(this.selectedIndex=e[0],null===this.dataSource)return;const o=this.dataSource[this.selectedIndex];if(!o)return;const a=this.context;this.context=this,this.$.input.dataValue=this.selectedValue="string"==typeof o?o:o.value,this.setAttribute("data-value",this.$.input.dataValue);let l=t.dataSource;"string"==typeof l&&(l=t.$.deserialize(l,"array"));for(let e=0;e<l.length;e++){let o=l[e];"string"!=typeof o&&"number"!=typeof o&&(o.value===t.$.input.dataValue?o.selected=!0:o.selected=!1)}this.context=a}else{const e=this.context;this.context=this,this.$.input.dataValue=this.selectedValue="",this.setAttribute("data-value",this.$.input.dataValue),this.selectedIndex=-1;let o=t.dataSource;if("string"==typeof o&&(o=t.$.deserialize(o,"array")),o&&Array.isArray(o))for(let e=0;e<o.length;e++){let a=o[e];"string"!=typeof a&&(a.value===t.$.input.dataValue?a.selected=!0:a.selected=!1)}this.context=e}}focus(){this.$.input.focus()}select(){const e=this;e.readonly?e.$.input.focus():e.$.input.select()}_documentUpHandler(e){const t=this,o=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;o!==t&&o!==t.$.dropDownButton&&o!==t.$.input&&o!==t.$.arrow?t.$.scrollView.contains(o.shadowParent||o)?t._isPointerDown&&(t._isPointerDown=!1,t.opened&&(t._preventLookup=!0),t.$.input.focus()):(t.opened&&(t._preventLookup=!0),"manual"===t.dropDownOpenMode||t._isPointerDown||t.close(),t._isPointerDown=!1):t._isPointerDown=!1}_focusHandler(){const e=this;e.setAttribute("focus",""),e.readonly||0!==e.minLength||0!==e.$.input.value.length||e._preventLookup?(e.$.fireEvent("focus"),delete e._preventLookup):e._lookup()}_blurHandler(){const e=this;e.opened||e.removeAttribute("focus"),e.opened||e.$.fireEvent("blur"),e._refreshSelectedIndex(),delete e._preventLookup}_pasteHandler(e){const t=this,o=t.$.input,a=o.value,l=o.selectionStart,r=o.selectionEnd;if(!e.clipboardData&&!window.clipboardData)return;if(t.disabled)return;const i=(e.clipboardData||window.clipboardData).getData("text");let n=a.slice(0,l)+i;n.length,n+=a.slice(r),t.setAttribute("data-value",n),t._refreshSelectedIndex()}_refreshSelectedIndex(){const e=this;let t=e.dataSource;if(t){let o=-1,a=null;if(e.dataSource instanceof Promise)return;if("function"==typeof e.dataSource)return;"string"==typeof t&&(t=e.$.deserialize(t,"array"));for(let l=0;l<t.length;l++){let r=t[l];if("number"!=typeof r&&"boolean"!=typeof r||(r=""+r),"string"==typeof r){if(r===e.value){o=l,a=e.value;break}}else r&&(delete r.selected,r.label===e.value&&(o=l,a=r.value,r.selected=!0))}e.set("selectedIndex",o,!1),e.set("selectedValue",a,!1),-1===e.selectedIndex&&(e.$.input.dataValue=null)}}selectItem(e){const t=this;let o=t.dataSource;if("string"==typeof o&&(o=t.$.deserialize(o,"array")),o)for(let a=0;a<o.length;a++){const l=o[a];if(t.set("selectedIndex",-1),t.set("value",""),t.$.input.dataValue=null,"string"==typeof l){if(l===e)return t.set("selectedIndex",a,!1),t.set("value",t.$.input.dataValue=e),void t.setAttribute("data-value",t.$.input.dataValue)}else if(l.value===e)return t.set("selectedIndex",a,!1),t.set("value",l.label),t.$.input.dataValue=e,void t.setAttribute("data-value",t.$.input.dataValue)}else t.set("value",t.$.input.dataValue=e),t.setAttribute("data-value",t.$.input.dataValue),t.set("selectedIndex",-1,!1)}getItem(e){const t=this;if(t.dataSource)for(let o=0;o<t.dataSource.length;o++){const a=t.dataSource[o];if(a.value===e)return a}return null}getPrevItem(){const e=this,t=e.getSelectedItem();if(e.dataSource&&t)for(let o=0;o<e.dataSource.length;o++)if(e.dataSource[o].value===t.value)return e.dataSource[o-1];return null}getNextItem(){const e=this,t=e.getSelectedItem();if(e.dataSource&&t)for(let o=0;o<e.dataSource.length;o++)if(e.dataSource[o].value===t.value)return e.dataSource[o+1];return null}getSelectedItem(){const e=this;return e.dataSource&&0===e.dataSource.length?{label:e.value,value:e.$.input.dataValue?e.$.input.dataValue:e.value}:{label:e.value,value:void 0!==e.$.input.dataValue?e.$.input.dataValue:e.value}}_refreshMenu(){const e=this;e.$.menu.classList.remove("scroll"),e.$.scrollView.computedVerticalScrollBarVisibility&&e.$.menu.classList.add("scroll")}_fromHTMLEntities(e){const t=this,o=t._textArea?t._textArea:document.createElement("textarea");return o.innerHTML=e,t._textArea=o,o.value}_performSelect(){const e=this,t=e.$.menu.querySelector(".active");let o="",a="";t&&(o=t.getAttribute("data-label"),o=e._fromHTMLEntities(o),a=t.dataValue);let l=e.value,r=e.$.input.dataValue;e.set("value",o),e.$.input.dataValue=a,e.setAttribute("data-value",a),t&&e.set("selectedIndex",t.index),e.set("selectedValues",[e.$.input.dataValue]),e.set("selectedValue",e.$.input.dataValue);let i=e.dataSource;if("string"==typeof i&&(i=e.$.deserialize(i,"array")),i&&Array.isArray(i))for(let t=0;t<i.length;t++){let o=i[t];"string"!=typeof o&&"number"!=typeof o&&(o.value===e.$.input.dataValue?o.selected=!0:o.selected=!1)}e.close(),o===l&&a===r||(e.$.fireEvent("change",{value:a,label:o,oldValue:r,oldLabel:l}),e._updateTargetValue())}_open(){const e=this;if(e.opened)return;const t=window.scrollX,o=window.scrollY;let a=e.getBoundingClientRect(),l=0,r=0;if(e.timer&&clearTimeout(e.timer),e.getRootNode()&&e.getRootNode().host)e.getRootNode().host.shadowRoot.appendChild(e.$.scrollView);else if(e.dropDownAppendTo){if("body"===e.dropDownAppendTo||e.dropDownAppendTo===document.body)document.body.appendChild(e.$.scrollView);else if(e.dropDownAppendTo instanceof HTMLElement)e.dropDownAppendTo.appendChild(e.$.scrollView);else if("string"==typeof dropDownAppendTo){let t=document.getElementById(e.dropDownAppendTo);t instanceof HTMLElement?t.appendChild(e.$.scrollView):document.body.appendChild(e.$.scrollView)}}else document.body.appendChild(e.$.scrollView);if(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();l=e.left,r=e.top}if(e.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",""),e.$.scrollView.style.left=-3+a.left+t-l+"px",e.$.scrollView.classList.remove("open"),e.$.scrollView.removeAttribute("top"),"bottom"===e.dropDownOpenPosition)e.$.scrollView.style.top=a.bottom+o-r+1+"px";else if("top"===e.dropDownOpenPosition)e.$.scrollView.style.top=a.top-e.$.scrollView.offsetHeight+o-r-2+"px",e.$.scrollView.setAttribute("top","");else if("auto"===e.dropDownOpenPosition){e.$.scrollView.style.top=a.bottom+o-r+1+"px";const t=a.top-e.$.scrollView.offsetHeight+o-r-2;window.innerHeight<parseInt(e.$.scrollView.style.top)+e.$.scrollView.offsetHeight-o?t>=0&&(e.$.scrollView.style.top=t+"px",e.$.scrollView.setAttribute("top","")):e.$.scrollView.style.top=a.bottom+o-r+1+"px"}if(e.dropDownAppendTo&&"body"!==e.dropDownAppendTo){e.$.scrollView.style.position="absolute",e.$.scrollView.style.width="auto",e.$.scrollView.style.height="auto";const t=e.$.scrollView.parentNode.getBoundingClientRect();e.$.scrollView.style.top=a.bottom-t.top+"px","top"===e.dropDownOpenPosition&&(e.$.scrollView.style.top=a.top-t.top-e.$.scrollView.offsetHeight+"px"),e.$.scrollView.style.left=-3+a.left-t.left+"px",e.dropDownHeight&&(e.$.scrollView.style.height=e.dropDownHeight),e.dropDownWidth&&(e.$.scrollView.style.width=e.dropDownWidth)}e.opening=!0,e._positionTimer&&clearInterval(e._positionTimer),e.dropDownAppendTo||(e._positionTimer=setInterval((()=>{const t=e.getBoundingClientRect();if(e.opening)e.opening=!1,a=t;else if(Math.abs(parseInt(t.top)-parseInt(a.top))>=10||Math.abs(parseInt(t.left)-parseInt(a.left))>=10){const o=window.scrollX,a=window.scrollY;return e.$.scrollView.style.left=-3+t.left+o-l+"px",void("bottom"===e.dropDownOpenPosition?e.$.scrollView.style.top=t.bottom+a-r+1+"px":"top"===e.dropDownOpenPosition?e.$.scrollView.style.top=t.top-e.$.scrollView.offsetHeight+a-r+1+"px":"auto"===e.dropDownOpenPosition&&(e.$.scrollView.removeAttribute("top"),e.$.scrollView.style.top=t.bottom+a-r+1+"px",window.innerHeight<parseInt(e.$.scrollView.style.top)+e.$.scrollView.offsetHeight-a?(e.$.scrollView.style.top=t.top-e.$.scrollView.offsetHeight+a-r+1+"px",e.$.scrollView.setAttribute("top","")):e.$.scrollView.style.top=t.bottom+a-r+1+"px"))}}),50)),e.$.scrollView.onpointerdown=function(t){e._isPointerDown=!0,t.stopPropagation(),t.preventDefault()},requestAnimationFrame((function(){const t=e.dropDownWidth;if(e.$.scrollView.refresh&&e.$.scrollView.refresh(),e._refreshMenu(),e.$.scrollView.setAttribute("open",""),e.setAttribute("open",""),e.$.dropDownButton.setAttribute("open",""),e.$.input.setAttribute("open",""),t&&"string"==typeof t&&-1!==t.indexOf("%")){const o=parseFloat(t)/100;e.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",e.offsetWidth*o+"px")}else if("auto"!==t&&t)e.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",parseFloat(t)+"px");else if("auto"===t){if(e.$.scrollView.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.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",t+"px")}}else{e.$.menu.style.width="auto";let t=e.$.menu.offsetWidth;const o=e.$.menu.querySelectorAll("li");for(let t=0;t<o.length;t++)e._maxDropDownWidth=Math.max((o[t].firstElementChild||o[t]).offsetWidth,e._maxDropDownWidth);e.$.scrollView.computedVerticalScrollBarVisibility&&(t+=e.$.scrollView.$&&e.$.scrollView.$.verticalScrollBar?e.$.scrollView.$.verticalScrollBar.offsetWidth:30),e.$.scrollView.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&&e.$.scrollView._scrollView.vScrollBar.refresh()}))})),e.$.scrollView.refresh&&e.$.scrollView.refresh(),e._refreshMenu(),e.set("opened",!0),e.setAttribute("aria-expanded",!0),e.$.fireEvent("open")}close(){const e=this;return!!e.opened&&(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((function(){e.$.scrollView.parentNode&&!e.opened&&(e.$.scrollView.remove(),e.removeAttribute("aria-owns"),e.readonly||e.$.input.removeAttribute("aria-controls"))}),1e3),e._positionTimer&&clearInterval(e._positionTimer),e.$.scrollView.removeAttribute("open"),e.$.dropDownButton.removeAttribute("open"),e.$.input.removeAttribute("open"),e.removeAttribute("open"),e.set("opened",!1),e.setAttribute("aria-expanded",!1),e.$.input.focus(),e.$.fireEvent("close"),!0)}refresh(){const e=this;e.$.scrollView.refresh&&e.$.scrollView.refresh(),e._getDataSourceFromOption(),e.close()}_lookup(e){const t=this;t.query=t.$.input.value;const o=t.context;if(t.context=t,t.selectedIndex=-1,t.selectedValue=null,t.context=o,t.$.input.readonly&&(t._incrementalSearchQuery||(t._incrementalSearchQuery=""),t._incrementalSearchQuery+=e.key,t._incrementalSearchTimer&&clearTimeout(t._incrementalSearchTimer),t.query=t._incrementalSearchQuery,t._incrementalSearchTimer=setTimeout((function(){t._incrementalSearchQuery=""}),700)),t.query.length<t.minLength)return void t.close();const a=function(e){clearTimeout(t._autoCompleteTimeout),t._autoCompleteTimeout=setTimeout((()=>{const o=t.context;t.context=t,t._process(e),t.context=o}),t.autoCompleteDelay)};"function"==typeof t.dataSource?t.dataSource(t.query,a):a(t.dataSource)}_downHandler(e){const t=this;t.readonly&&t._dropDownButtonDownHandler(e)}_dropDownButtonDownHandler(e){const t=this;return"manual"!==t.dropDownOpenMode&&(t._toggle(),t.focus()),e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),t._isPointerDown=!0,!1}_toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this;function t(t){e._process(t);const o=e.$.menu.querySelector(".active");if(o){const t=e.$.input.dataValue;for(let a=0;a<e.$.menu.children.length;a++){const l=e.$.menu.children[a],r=l.getAttribute("data-label"),i=l.dataValue;if(void 0!==t&&i===t||void 0===t&&r===e.$.input.value){o.classList.remove("active"),l.classList.add("active"),e._setActiveDescendant(l),e.$.input.dataValue=i,e.setAttribute("data-value",i);break}}}e.ensureVisible(),e.$.input.focus(),setTimeout((function(){e.$.input.focus()}),25)}e.dropDownDataSource&&(Array.isArray(e.dropDownDataSource)&&e.dropDownDataSource.length>0||"function"==typeof e.dropDownDataSource)?(e.query="","function"==typeof e.dropDownDataSource?e.dropDownDataSource(e.query,t):t(e.dropDownDataSource)):(e.query="","function"==typeof e.dataSource?e.dataSource(e.query,t):t(e.dataSource))}_process(e){const t=this;"string"==typeof e&&(e=t.$.deserialize(e,"array")),e=t.readonly?e.filter((function(){return!0})):e.filter((function(e){return""===e||(t.matcher?t.matcher(e):t._matcher(e))})),e=t._sorter(e),t.sorted&&(e.sort(((e,t)=>void 0!==e.label?e.label.localeCompare(t.label):e.localeCompare(t))),"desc"===t.sortDirection&&e.reverse()),!e.length&&t.opened&&t.close(),0===e.length&&!0!==t.allowItemsAdd&&""===t.dropDownPlaceholder||(t.query.length>0?t._render(e.slice(0,t.items)):t._render(e),t._open(),t.$.scrollView.refresh&&t.$.scrollView.refresh(),t._refreshMenu(),t.ensureVisible())}_matcher(e){const t=this.query;switch(null===e&&(e="null"),e=""+(e=e.label||e),this.queryMode){case"startsWith":return e.startsWith(t);case"startsWithIgnoreCase":return e.toLowerCase().startsWith(t.toLowerCase());case"doesNotContain":return e.indexOf(t)<0;case"doesNotContainIgnoreCase":return e.toLowerCase().indexOf(t.toLowerCase())<0;case"contains":return e.indexOf(t)>-1;default:case"containsIgnoreCase":return~e.toLowerCase().indexOf(t.toLowerCase());case"equals":return 0===e.localeCompare(t);case"equalsIgnoreCase":return 0===e.toLowerCase().localeCompare(t.toLowerCase());case"endsWith":return e.endsWith(t);case"endsWithIgnoreCase":return e.toLowerCase().endsWith(t.toLowerCase())}}_sorter(e){const t=this;let o,a=[],l=[],r=[];if(e&&""===e[0])return e;for(;o=e.shift();){let e=o.label||o;e=""+e,e.toLowerCase().indexOf(t.query.toLowerCase())?~e.indexOf(t.query)?l.push(o):r.push(o):a.push(o)}return a.concat(l,r)}_highlighter(e){const t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return this.query?e.replace(new RegExp("("+t+")","ig"),(function(e,t){return"<strong>"+t+"</strong>"})):e}_render(e){const t=this;let o=0,a=-1,l=null;const r=e.map((function(e){let r=e,i=e;"object"==typeof e&&(r=e.label,i=void 0!==e.value?e.value:r),r=""+r,r=r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""");const n=document.createElement("li"),s=document.createElement("a");if(s.href="javascript:void(0)",n.id=t.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),n.setAttribute("data-label",r),n.index=o++,n.dataValue=i,"string"==typeof i?n.setAttribute("value",i):n.setAttribute("value",JSON.stringify(i)),n.setAttribute("role","option"),n.setAttribute("aria-label",r),void 0!==e.menuLabel?(r=e.menuLabel,s.innerHTML=r):s.innerHTML=t.highlighter?t.highlighter(r):t._highlighter(r),s.setAttribute("aria-hidden",!0),e.disabled&&n.classList.add("smart-disabled"),e.icon&&(s.classList.add("icon"),s.classList.add(e.icon)),e.prefix){const t=document.createElement("span");t.innerHTML=e.prefix,s.classList.add("has-prefix"),s.innerHTML=t.innerHTML+s.innerHTML}if(e.suffix){const t=document.createElement("span");t.innerHTML=e.suffix,s.classList.add("has-suffix"),s.innerHTML=s.innerHTML+t.innerHTML}if(e.dataset)for(let t in e.dataset)n.setAttribute("data-"+t,e.dataset[t]);if(e.className){const t=e.className.split(" ");for(let e=0;e<t.length;e++)n.classList.add(t[e].trim())}return void 0!==t.selectedValue&&void 0!==e.value&&""!==t.selectedValue&&t.selectedValue===e.value&&(e.selected=!0,l=e,a=n.index,n.classList.add("active")),n.appendChild(s),n}));function i(){const e=t.$.menu.getElementsByClassName("active");e[0]&&e[0].classList.remove("active"),this.classList.add("active"),t._setActiveDescendant(this)}-1===a&&r.length>0&&(r[0].classList.add("active"),t._setActiveDescendant(r[0])),l&&(t.$.input.value=l.label,t.$.input.dataValue=l.value,t.setAttribute("data-value",t.$.input.dataValue)),t.$.menu.innerHTML="",0===r.length&&t.dropDownPlaceholder&&(t.$.menu.innerHTML='<div class="smart-flex smart-truncate smart-quiet" style="padding:10px; align-items: center;">'+t.dropDownPlaceholder+"</div>");for(let e=0;e<r.length;e++){const o=r[e];t.$.menu.appendChild(o),o.onmouseenter=i,o.onmouseleave=function(){this.classList.remove("active"),t._setActiveDescendant(null)},o.onclick=i}}ensureVisible(){const e=this,t=e.$.menu.querySelector(".active");t&&(t.offsetTop+t.offsetHeight>=e.$.scrollView.scrollTop+e.$.scrollView.offsetHeight&&(e.$.scrollView.scrollTop=t.offsetTop+t.offsetHeight),(t.offsetTop<=e.$.scrollView.scrollTop||t.offsetTop>=e.$.scrollView.scrollTop+e.$.scrollView.offsetHeight)&&(e.$.scrollView.scrollTop=t.offsetTop),0===[...e.$.menu.children].indexOf(t)?e.$.scrollView.scrollTop=0:[...e.$.menu.children].indexOf(t)===e.$.menu.children.length-1&&(e.$.scrollView.scrollTop=e.$.scrollView.scrollHeight))}_next(){const e=this,t=e.$.menu.querySelector(".active");if(!t){const t=e.$.menu.firstElementChild;return t.classList.add("active"),void e._setActiveDescendant(t)}t.classList.remove("active");let o=t.nextElementSibling;o||(o=e.$.menu.firstElementChild),o.classList.add("active"),e._setActiveDescendant(o),e.ensureVisible()}_prev(){const e=this,t=e.$.menu.querySelector(".active");if(!t){const t=e.$.menu.firstElementChild;return t.classList.add("active"),void e._setActiveDescendant(t)}t.classList.remove("active");let o=t.previousElementSibling;o||(o=e.$.menu.lastElementChild),o.classList.add("active"),e._setActiveDescendant(o),e.ensureVisible()}_move(e){const t=this;if(t.readonly&&!t.opened){if("ArrowUp"===e.key){const o=t.getPrevItem();o&&t.selectItem(o.value),e.preventDefault()}if("ArrowDown"===e.key){const o=t.getNextItem();o&&t.selectItem(o.value),e.preventDefault()}}if(t.opened){switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),t._prev();break;case 40:e.preventDefault(),t._next()}e.stopPropagation()}}_keyDownHandler(e){const t=this;if(t._suppressKeyPressRepeat=![40,38,9,13,27,16,17,18].includes(e.keyCode),t._oldValue=t.$.input.value,!(e.shiftKey||e.altKey||e.ctrlKey))return t.opened&&"Escape"===e.key?(t.close(),e.stopPropagation(),void e.preventDefault()):void t._move(e)}_keyPressHandler(e){this._suppressKeyPressRepeat||e.shiftKey||e.altKey||e.ctrlKey||this._move(e)}_keyUpHandler(e){const t=this;if(!(e.shiftKey||"F2"===e.key||"a"===e.key&&e.ctrlKey))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 9:case 13:if(!t.opened)return;t._performSelect(),e.stopPropagation(),e.preventDefault();break;case 27:if(!t.opened)return;t.close(),e.stopPropagation(),e.preventDefault();break;default:if(t._lookup(e),!t.opened||e.ctrlKey||e.shiftKey||(e.stopPropagation(),e.preventDefault()),t.$.fireEvent("changing",{value:t.$.input.value,oldValue:t._oldValue}),t.dataSource&&t.dataSource.length)for(let e=0;e<t.dataSource.length;e++){const o=t.dataSource[e];if("string"==typeof o){if(o===t.$.input.value){t.$.input.dataValue=t.$.input.value,t.setAttribute("data-value",t.$.input.dataValue);break}}else if(void 0!==o.label&&o.label===t.$.input.value){t.$.input.dataValue=o.value,t.setAttribute("data-value",o.value);break}}else t.$.input.dataValue=t.$.input.value,t.setAttribute("data-value",t.$.input.dataValue);t._updateTargetValue()}}clearValue(){const e=this;e.$.input.value="",e.$.input.dataValue="",e.removeAttribute("data-value"),e.set("value",""),e.set("selectedIndex",-1),e.set("selectedValues",[e.$.input.dataValue]),e.set("selectedValue",e.$.input.dataValue)}propertyChangedHandler(e,t,o){super.propertyChangedHandler(e,t,o);const a=this;if("innerHTML"===e&&(a._getDataSourceFromOption(),a._setSelection(!1)),"selectedValue"===e){let e=-1;if(a.dataSource&&Array.isArray(a.dataSource)&&a.dataSource.forEach(((t,a)=>{"string"==typeof t?t===o&&(e=a):t&&t.value===o&&(e=a)})),e>=0){const t=a.context;a.context=a,a.selectedIndex=e,a.context=t}a._setSelection()}if("selectedIndex"===e){let e=a.dataSource;if(a.selectedValue=null,e&&Array.isArray(e))for(let t=0;t<e.length;t++){let o=e[t];"string"!=typeof o&&"number"!=typeof o&&(o.selected=!1)}a._setSelection()}else if("dataSource"===e){if(a.dataSource&&Array.isArray(a.dataSource)){let e=-1;if(a.dataSource.forEach(((t,o)=>{t.selected&&(e=o)})),e>=0){const t=a.context;a.context=a,a.selectedIndex=e,a.context=t}}a._setSelection(!1)}else if("dropDownClassList"===e){const e=a.$.scrollView;for(let o=0,a=t.length;o<a;o+=1)e.classList.remove(t[o]);for(let t=0,a=o.length;t<a;t+=1)e.classList.add(o[t])}else if("dropDownHeight"===e)"auto"!==a.dropDownHeight?a.$.scrollView.style.setProperty("--smart-input-drop-down-menu-height",a.dropDownHeight+"px"):a.$.scrollView.style.setProperty("--smart-input-drop-down-menu-height","auto");else if("opened"===e)a.opened=t,o?a.open():a.close();else if("placeholder"===e){if(a.readonly){const e=a.getAttribute("aria-label");if(e&&e!==t)return;o?a.setAttribute("aria-label",o):a.removeAttribute("aria-label")}}else if("selectedValues"===e)if(null===o)a.$.input.value="",a.$.input.dataValue=o,a.setAttribute("data-value",o),a._refreshSelectedIndex();else{const e=o.join(","),t=a.value;if(a.$.input.dataValue=e,e&&-1===e.indexOf(",")){let e=-1,t=o[0];if(a.dataSource&&Array.isArray(a.dataSource)&&a.dataSource.forEach(((a,l)=>{"string"==typeof a?a!==o&&a!==t||(e=l):a&&a.value===t&&(e=l)})),e>=0){const t=a.context;a.context=a,a.selectedIndex=e,a.context=t}}a._setSelection(),a.propertyChangedHandler("value",t,a.value)}else"value"===e?(a.displayMember!==a.valueMember&&"string"!=typeof o?(a.set("value",o[a.displayMember]),a.$.input.dataValue=o[a.valueMember],a.setAttribute("data-value",a.$.input.dataValue)):(a.$.input.value=a.$.input.dataValue=o,a.setAttribute("data-value",o)),a._refreshSelectedIndex()):"readonly"===e?(a._setAriaRelations(),a._setInputPurpose()):"theme"===e||"rightToLeft"===e?a.$.scrollView[e]=o:"inputPurpose"===e?a._setInputPurpose():"inverted"===e?o?a.$.scrollView.setAttribute("inverted",""):a.$.scrollView.removeAttribute("inverted"):"disabled"!==e&&"unfocusable"!==e||a._setFocusable()}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const o=e.dataset.property,a=e.value;o&&void 0!==t[o]&&(t[o]=a)}}}detached(){super.detached(),this.close(),this.removeAttribute("focus")}_getDataSourceFromOption(){const e=this;if(e.innerHTML.indexOf("<option")>=0){e.$.optionsContainer.innerHTML=e.innerHTML.trim();const t=e.querySelectorAll("option");let o=[];for(let e=0;e<t.length;e++){const a=t[e],l=a.hasAttribute("selected")||a.hasAttribute("is-selected")&&"false"!==a.getAttribute("is-selected");let r=(""+a.textContent).trim();const i=(""+a.innerHTML).trim(),n=a.hasAttribute("value")?a.getAttribute("value"):r,s=a.hasAttribute("disabled"),u=a.hasAttribute("label")?a.getAttribute("label"):null;u&&(r=u),o.push({label:r,menuLabel:i,value:n,disabled:s,selected:l,className:a.className,dataset:a.dataset}),a.classList.add("smart-hidden")}e.dataSource=o}}render(){const e=this,t=e.dropDownClassList;if(e._getDataSourceFromOption(),e.selectedValues&&e.selectedValues.length){const t=e.selectedValues.join(",");e.value=t}e._createElement&&e._createElement();const o=e.$.scrollView;for(let e=0,a=t.length;e<a;e+=1)o.classList.add(t[e]);e.opened&&(e.opened=!1,e.open());const a=e.$.menu;a&&(a.setAttribute("role","presentation"),o.appendChild(a)),"auto"!==e.dropDownHeight?o.style.setProperty("--smart-input-drop-down-menu-height",e.dropDownHeight+"px"):o.style.setProperty("--smart-input-drop-down-menu-height","auto"),o.classList.add("smart-input-drop-down-menu");for(let t=0;t<e.classList.length;t++){const a=e.classList[t];"smart-element"!==a&&"smart-input"!==a&&o.classList.add(a+"-drop-down-menu")}o.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),o.ownerElement=e;let l=e.dataSource;if("string"==typeof l&&(l=e.$.deserialize(l,"array")),l&&l.length&&Array.isArray(l)){let t=-1;if(l.forEach(((e,o)=>{e.selected&&(t=o)})),t>=0){e.selectedIndex=t;const o=l[t];e.selectedValue="string"==typeof o?l[t]:l[t].value}}e._setAriaRelations(),e._setInputPurpose(),e._setSelection(),e.isInitialized=!0,e.hasAttribute("tabindex")&&(e.readonly||(e.$.input.setAttribute("tabindex",e.getAttribute("tabindex")),e.removeAttribute("tabindex"))),super.render()}_setSelection(e){const t=this;let o=t.dataSource;if("string"==typeof o&&(o=t.$.deserialize(o,"array")),t.selectedIndex>=0&&o&&o.length>0){let a=o[t.selectedIndex];if("number"!=typeof a&&"boolean"!=typeof a||(a=""+a),"string"==typeof a){let o=t.$.input.dataValue,l=t.value;t.set("value",a),t.$.input.dataValue=a,t.$.input.setAttribute("data-value",a),t.selectedValues=[t.$.input.dataValue],t.isInitialized&&!1!==e&&(t.$.fireEvent("change",{value:t.value,label:t.label,oldValue:o,oldLabel:l}),t._updateTargetValue())}else{let o=t.$.input.dataValue,l=t.value;a&&(void 0!==a.value?(t.set("value",void 0!==a.value?a.value+"":""),t.$.input.dataValue=a.value,t.$.input.setAttribute("data-value",a.value),t.selectedValues=[t.$.input.dataValue]):a.label&&(t.selectedValues=[a.value]),a.label&&t.set("value",a.label)),t.isInitialized&&!1!==e&&(t.$.fireEvent("change",{value:t.$.input.dataValue,label:a.value,oldValue:o,oldLabel:l}),t._updateTargetValue())}}}_createElement(){const e=this,t=document.createElement("ul"),o=document.createElement("smart-scroll-viewer");o.rightToLeft=e.rightToLeft,o.theme=e.theme,o.horizontalScrollBarVisibility="hidden",e.inverted?o.setAttribute("inverted",""):o.removeAttribute("inverted"),e.$.scrollView=o,e.$.menu=t,e._setFocusable();const a=e.$.input;e.$.menu.onpointerdown=function(t){const o=t.target.closest("li"),l=e.$.menu.querySelector(".active");l&&o&&(l.classList.remove("active"),o.classList.add("active")),t.stopPropagation(),t.preventDefault(),setTimeout((()=>{e._performSelect(),o&&o.parentNode&&e.$.fireEvent("itemClick",{index:[...o.parentNode.children].indexOf(o),item:o,label:o.getAttribute("aria-label"),value:o.dataValue}),a.focus()}),50)},e.$.menu.onpointerup=function(t){t.stopPropagation(),t.preventDefault(),e.$.scrollView.$.verticalScrollBar.thumbCapture&&(e.$.scrollView.$.verticalScrollBar.thumbCapture=!1)}}_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-activedescendant"),e.$.input.removeAttribute("aria-controls"),e.$.dropDownButton.setAttribute("aria-hidden",!0)):(e.setAttribute("role","combobox"),t&&t===e.placeholder&&e.removeAttribute("aria-label"),e.$.input.setAttribute("role","searchbox"),e.$.input.removeAttribute("aria-hidden",!0),e.$.dropDownButton.removeAttribute("aria-hidden")),e.setAttribute("aria-expanded",e.opened),e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-owns",e.$.scrollView.id),e.$.scrollView.setAttribute("role","listbox")}_setActiveDescendant(e){const t=this;t.readonly||(e?t.setAttribute("aria-activedescendant",e.id):t.removeAttribute("aria-activedescendant"))}_setInputPurpose(){const e=this;e.readonly?e.$.input.removeAttribute("autocomplete"):e.$.input.setAttribute("autocomplete",e.inputPurpose)}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.$.input.setAttribute("tabindex",-1):e.$.input.removeAttribute("tabindex")}});
|
|
104
|
+
Smart("smart-input",class extends Smart.BaseElement{static get properties(){return{autoCompleteDelay:{value:100,type:"number"},dataSource:{type:"any",value:[],reflectToAttribute:!1},dropDownClassList:{value:[],type:"array",reflectToAttribute:!1},dropDownDataSource:{type:"any",reflectToAttribute:!1,value:[]},dropDownHeight:{type:"any",value:200},dropDownOpenMode:{allowedValues:["default","manual"],value:"default",type:"string"},dropDownAppendTo:{value:null,type:"any"},dropDownWidth:{type:"any",value:null},dropDownButtonPosition:{allowedValues:["none","left","right"],value:"none",type:"string"},dropDownOpenPosition:{allowedValues:["bottom","top","auto"],value:"bottom",type:"string"},dropDownPlaceholder:{type:"string",value:""},hint:{type:"string",value:""},inputPurpose:{type:"string",value:"off"},items:{type:"number",value:8},minLength:{type:"number",value:1},maxLength:{type:"number",value:99999999},name:{value:"",type:"string"},prefix:{value:"",type:"string",reflectToAttribute:!1},suffix:{value:"",type:"string",reflectToAttribute:!1},onAffixClick:{value:null,type:"any",reflectToAttribute:!1},opened:{value:!1,type:"boolean"},query:{type:"string",value:""},queryMode:{allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string",value:"containsIgnoreCase"},placeholder:{value:"",type:"string"},readonly:{type:"boolean",value:!1},sorted:{value:!1,type:"boolean"},sortDirection:{value:"asc",type:"string"},selectedIndex:{type:"number",value:-1},selectedValue:{type:"any",value:""},selectedValues:{value:[],type:"array"},type:{type:"string"},value:{type:"string",value:""},innerHTML:{type:"string",reflectToAttribute:!1}}}static get styleUrls(){return["smart.textbox.css"]}template(){return'<div id="inputContainer" role="presentation"><div id="optionsContainer" inner-h-t-m-l=\'{{innerHTML}}\' class="smart-hidden"></div><span class="smart-input-prefix" id="prefix" inner-h-t-m-l=\'{{prefix}}\'></span><input maxlength=\'[[maxLength]]\' class="smart-input" id=\'input\' readonly=\'[[readonly]]\' placeholder=\'[[placeholder]]\' type=\'[[type]]\' name=\'[[name]]\' value=\'{{value::keyup}}\' disabled=\'[[disabled]]\' aria-label="[[placeholder]]" /><span class="smart-hidden smart-hint" id="span">[[hint]]</span><span id="suffix" class="smart-input-suffix" inner-h-t-m-l=\'{{suffix}}\'></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.focus":"_focusHandler","input.blur":"_blurHandler","input.keydown":"_keyDownHandler","input.keyup":"_keyUpHandler","input.keypress":"_keyPressHandler","input.paste":"_pasteHandler","prefix.click":"_prefixClick","suffix.click":"_suffixClick","dropDownButton.down":"_dropDownButtonDownHandler","inputContainer.down":"_downHandler","document.up":"_documentUpHandler"}}_prefixClick(e){const t=this;if(t.onAffixClick)if("string"==typeof t.onAffixClick){const o=t.onAffixClick.replace("()","");window[o]&&window[o].apply(t,e)}else t.onAffixClick(e)}_suffixClick(e){const t=this;if("string"==typeof t.onAffixClick){const o=t.onAffixClick.replace("()","");window[o]&&window[o].apply(t,e)}else t.onAffixClick(e)}get selectedIndexes(){return this.isCompleted?[this.selectedIndex]:[]}set selectedIndexes(e){if(!this.isCompleted)return;const t=this;if(e&&void 0!==e[0]){if(this.selectedIndex=e[0],null===this.dataSource)return;const o=this.dataSource[this.selectedIndex];if(!o)return;const a=this.context;this.context=this,this.$.input.dataValue=this.selectedValue="string"==typeof o?o:o.value,this.setAttribute("data-value",this.$.input.dataValue);let l=t.dataSource;"string"==typeof l&&(l=t.$.deserialize(l,"array"));for(let e=0;e<l.length;e++){let o=l[e];"string"!=typeof o&&"number"!=typeof o&&(o.value===t.$.input.dataValue?o.selected=!0:o.selected=!1)}this.context=a}else{const e=this.context;this.context=this,this.$.input.dataValue=this.selectedValue="",this.setAttribute("data-value",this.$.input.dataValue),this.selectedIndex=-1;let o=t.dataSource;if("string"==typeof o&&(o=t.$.deserialize(o,"array")),o&&Array.isArray(o))for(let e=0;e<o.length;e++){let a=o[e];"string"!=typeof a&&(a.value===t.$.input.dataValue?a.selected=!0:a.selected=!1)}this.context=e}}focus(){this.$.input.focus()}select(){const e=this;e.readonly?e.$.input.focus():e.$.input.select()}_documentUpHandler(e){const t=this,o=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;o!==t&&o!==t.$.dropDownButton&&o!==t.$.input&&o!==t.$.arrow?t.$.scrollView.contains(o.shadowParent||o)?t._isPointerDown&&(t._isPointerDown=!1,t.opened&&(t._preventLookup=!0),t.$.input.focus()):(t.opened&&(t._preventLookup=!0),"manual"===t.dropDownOpenMode||t._isPointerDown||t.close(),t._isPointerDown=!1):t._isPointerDown=!1}_focusHandler(){const e=this;e.setAttribute("focus",""),e.readonly||0!==e.minLength||0!==e.$.input.value.length||e._preventLookup?(e.$.fireEvent("focus"),delete e._preventLookup):e._lookup()}_blurHandler(){const e=this;e.opened||e.removeAttribute("focus"),e.opened||e.$.fireEvent("blur"),e._refreshSelectedIndex(),delete e._preventLookup}_pasteHandler(e){const t=this,o=t.$.input,a=o.value,l=o.selectionStart,r=o.selectionEnd;if(!e.clipboardData&&!window.clipboardData)return;if(t.disabled)return;const i=(e.clipboardData||window.clipboardData).getData("text");let n=a.slice(0,l)+i;n.length,n+=a.slice(r),t.setAttribute("data-value",n),t._refreshSelectedIndex()}_refreshSelectedIndex(){const e=this;let t=e.dataSource;if(t){let o=-1,a=null;if(e.dataSource instanceof Promise)return;if("function"==typeof e.dataSource)return;"string"==typeof t&&(t=e.$.deserialize(t,"array"));for(let l=0;l<t.length;l++){let r=t[l];if("number"!=typeof r&&"boolean"!=typeof r||(r=""+r),"string"==typeof r){if(r===e.value){o=l,a=e.value;break}}else r&&(delete r.selected,r.label===e.value&&(o=l,a=r.value,r.selected=!0))}e.set("selectedIndex",o,!1),e.set("selectedValue",a,!1),-1===e.selectedIndex&&(e.$.input.dataValue=null)}}selectItem(e){const t=this;let o=t.dataSource;if("string"==typeof o&&(o=t.$.deserialize(o,"array")),o)for(let a=0;a<o.length;a++){const l=o[a];if(t.set("selectedIndex",-1),t.set("value",""),t.$.input.dataValue=null,"string"==typeof l){if(l===e)return t.set("selectedIndex",a,!1),t.set("value",t.$.input.dataValue=e),void t.setAttribute("data-value",t.$.input.dataValue)}else if(l.value===e)return t.set("selectedIndex",a,!1),t.set("value",l.label),t.$.input.dataValue=e,void t.setAttribute("data-value",t.$.input.dataValue)}else t.set("value",t.$.input.dataValue=e),t.setAttribute("data-value",t.$.input.dataValue),t.set("selectedIndex",-1,!1)}getItem(e){const t=this;if(t.dataSource)for(let o=0;o<t.dataSource.length;o++){const a=t.dataSource[o];if(a.value===e)return a}return null}getPrevItem(){const e=this,t=e.getSelectedItem();if(e.dataSource&&t)for(let o=0;o<e.dataSource.length;o++)if(e.dataSource[o].value===t.value)return e.dataSource[o-1];return null}getNextItem(){const e=this,t=e.getSelectedItem();if(e.dataSource&&t)for(let o=0;o<e.dataSource.length;o++)if(e.dataSource[o].value===t.value)return e.dataSource[o+1];return null}getSelectedItem(){const e=this;return e.dataSource&&0===e.dataSource.length?{label:e.value,value:e.$.input.dataValue?e.$.input.dataValue:e.value}:{label:e.value,value:void 0!==e.$.input.dataValue?e.$.input.dataValue:e.value}}_refreshMenu(){const e=this;e.$.menu.classList.remove("scroll"),e.$.scrollView.computedVerticalScrollBarVisibility&&e.$.menu.classList.add("scroll")}_fromHTMLEntities(e){const t=this,o=t._textArea?t._textArea:document.createElement("textarea");return o.innerHTML=e,t._textArea=o,o.value}_performSelect(){const e=this,t=e.$.menu.querySelector(".active");let o="",a="";t&&(o=t.getAttribute("data-label"),o=e._fromHTMLEntities(o),a=t.dataValue);let l=e.value,r=e.$.input.dataValue;e.set("value",o),e.$.input.dataValue=a,e.setAttribute("data-value",a),t&&e.set("selectedIndex",t.index),e.set("selectedValues",[e.$.input.dataValue]),e.set("selectedValue",e.$.input.dataValue);let i=e.dataSource;if("string"==typeof i&&(i=e.$.deserialize(i,"array")),i&&Array.isArray(i))for(let t=0;t<i.length;t++){let o=i[t];"string"!=typeof o&&"number"!=typeof o&&(o.value===e.$.input.dataValue?o.selected=!0:o.selected=!1)}e.close(),o===l&&a===r||(e.$.fireEvent("change",{value:a,label:o,oldValue:r,oldLabel:l}),e._updateTargetValue())}_open(){const e=this;if(e.opened)return;const t=window.scrollX,o=window.scrollY;let a=e.getBoundingClientRect(),l=0,r=0;if(e.timer&&clearTimeout(e.timer),e.getRootNode()&&e.getRootNode().host)e.getRootNode().host.shadowRoot.appendChild(e.$.scrollView);else if(e.dropDownAppendTo){if("body"===e.dropDownAppendTo||e.dropDownAppendTo===document.body)document.body.appendChild(e.$.scrollView);else if(e.dropDownAppendTo instanceof HTMLElement)e.dropDownAppendTo.appendChild(e.$.scrollView);else if("string"==typeof dropDownAppendTo){let t=document.getElementById(e.dropDownAppendTo);t instanceof HTMLElement?t.appendChild(e.$.scrollView):document.body.appendChild(e.$.scrollView)}}else document.body.appendChild(e.$.scrollView);if(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();l=e.left,r=e.top}if(e.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",""),e.$.scrollView.style.left=-3+a.left+t-l+"px",e.$.scrollView.classList.remove("open"),e.$.scrollView.removeAttribute("top"),"bottom"===e.dropDownOpenPosition)e.$.scrollView.style.top=a.bottom+o-r+1+"px";else if("top"===e.dropDownOpenPosition)e.$.scrollView.style.top=a.top-e.$.scrollView.offsetHeight+o-r-2+"px",e.$.scrollView.setAttribute("top","");else if("auto"===e.dropDownOpenPosition){e.$.scrollView.style.top=a.bottom+o-r+1+"px";const t=a.top-e.$.scrollView.offsetHeight+o-r-2;window.innerHeight<parseInt(e.$.scrollView.style.top)+e.$.scrollView.offsetHeight-o?t>=0&&(e.$.scrollView.style.top=t+"px",e.$.scrollView.setAttribute("top","")):e.$.scrollView.style.top=a.bottom+o-r+1+"px"}if(e.dropDownAppendTo&&"body"!==e.dropDownAppendTo){e.$.scrollView.style.position="absolute",e.$.scrollView.style.width="auto",e.$.scrollView.style.height="auto";const t=e.$.scrollView.parentNode.getBoundingClientRect();e.$.scrollView.style.top=a.bottom-t.top+"px","top"===e.dropDownOpenPosition&&(e.$.scrollView.style.top=a.top-t.top-e.$.scrollView.offsetHeight+"px"),e.$.scrollView.style.left=-3+a.left-t.left+"px",e.dropDownHeight&&(e.$.scrollView.style.height=e.dropDownHeight),e.dropDownWidth&&(e.$.scrollView.style.width=e.dropDownWidth)}e.opening=!0,e._positionTimer&&clearInterval(e._positionTimer),e.dropDownAppendTo||(e._positionTimer=setInterval((()=>{const t=e.getBoundingClientRect();if(e.opening)e.opening=!1,a=t;else if(Math.abs(parseInt(t.top)-parseInt(a.top))>=10||Math.abs(parseInt(t.left)-parseInt(a.left))>=10){const o=window.scrollX,a=window.scrollY;return e.$.scrollView.style.left=-3+t.left+o-l+"px",void("bottom"===e.dropDownOpenPosition?e.$.scrollView.style.top=t.bottom+a-r+1+"px":"top"===e.dropDownOpenPosition?e.$.scrollView.style.top=t.top-e.$.scrollView.offsetHeight+a-r+1+"px":"auto"===e.dropDownOpenPosition&&(e.$.scrollView.removeAttribute("top"),e.$.scrollView.style.top=t.bottom+a-r+1+"px",window.innerHeight<parseInt(e.$.scrollView.style.top)+e.$.scrollView.offsetHeight-a?(e.$.scrollView.style.top=t.top-e.$.scrollView.offsetHeight+a-r+1+"px",e.$.scrollView.setAttribute("top","")):e.$.scrollView.style.top=t.bottom+a-r+1+"px"))}}),50)),e.$.scrollView.onpointerdown=function(t){e._isPointerDown=!0,t.stopPropagation(),t.preventDefault()},requestAnimationFrame((function(){const t=e.dropDownWidth;if(e.$.scrollView.refresh&&e.$.scrollView.refresh(),e._refreshMenu(),e.$.scrollView.setAttribute("open",""),e.setAttribute("open",""),e.$.dropDownButton.setAttribute("open",""),e.$.input.setAttribute("open",""),t&&"string"==typeof t&&-1!==t.indexOf("%")){const o=parseFloat(t)/100;e.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",e.offsetWidth*o+"px")}else if("auto"!==t&&t)e.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",parseFloat(t)+"px");else if("auto"===t){if(e.$.scrollView.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.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",t+"px")}}else{e.$.menu.style.width="auto";let t=e.$.menu.offsetWidth;const o=e.$.menu.querySelectorAll("li");for(let t=0;t<o.length;t++)e._maxDropDownWidth=Math.max((o[t].firstElementChild||o[t]).offsetWidth,e._maxDropDownWidth);e.$.scrollView.computedVerticalScrollBarVisibility&&(t+=e.$.scrollView.$&&e.$.scrollView.$.verticalScrollBar?e.$.scrollView.$.verticalScrollBar.offsetWidth:30),e.$.scrollView.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&&e.$.scrollView._scrollView.vScrollBar.refresh()}))})),e.$.scrollView.refresh&&e.$.scrollView.refresh(),e._refreshMenu(),e.set("opened",!0),e.setAttribute("aria-expanded",!0),e.$.fireEvent("open")}close(){const e=this;return!!e.opened&&(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((function(){e.$.scrollView.parentNode&&!e.opened&&(e.$.scrollView.remove(),e.removeAttribute("aria-owns"),e.readonly||e.$.input.removeAttribute("aria-controls"))}),1e3),e._positionTimer&&clearInterval(e._positionTimer),e.$.scrollView.removeAttribute("open"),e.$.dropDownButton.removeAttribute("open"),e.$.input.removeAttribute("open"),e.removeAttribute("open"),e.set("opened",!1),e.setAttribute("aria-expanded",!1),e.$.input.focus(),e.$.fireEvent("close"),!0)}refresh(){const e=this;e.$.scrollView.refresh&&e.$.scrollView.refresh(),e._getDataSourceFromOption(),e.close()}_lookup(e){const t=this;t.query=t.$.input.value;const o=t.context;if(t.context=t,t.selectedIndex=-1,t.selectedValue=null,t.context=o,t.$.input.readonly&&(t._incrementalSearchQuery||(t._incrementalSearchQuery=""),t._incrementalSearchQuery+=e.key,t._incrementalSearchTimer&&clearTimeout(t._incrementalSearchTimer),t.query=t._incrementalSearchQuery,t._incrementalSearchTimer=setTimeout((function(){t._incrementalSearchQuery=""}),700)),t.query.length<t.minLength)return void t.close();const a=function(e){clearTimeout(t._autoCompleteTimeout),t._autoCompleteTimeout=setTimeout((()=>{const o=t.context;t.context=t,t._process(e),t.context=o}),t.autoCompleteDelay)};"function"==typeof t.dataSource?t.dataSource(t.query,a):a(t.dataSource)}_downHandler(e){const t=this;t.readonly&&t._dropDownButtonDownHandler(e)}_dropDownButtonDownHandler(e){const t=this;return"manual"!==t.dropDownOpenMode&&(t._toggle(),t.focus()),e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),t._isPointerDown=!0,!1}_toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this;function t(t){e._process(t);const o=e.$.menu.querySelector(".active");if(o){const t=e.$.input.dataValue;for(let a=0;a<e.$.menu.children.length;a++){const l=e.$.menu.children[a],r=l.getAttribute("data-label"),i=l.dataValue;if(void 0!==t&&i===t||void 0===t&&r===e.$.input.value){o.classList.remove("active"),l.classList.add("active"),e._setActiveDescendant(l),e.$.input.dataValue=i,e.setAttribute("data-value",i);break}}}e.ensureVisible(),e.$.input.focus(),setTimeout((function(){e.$.input.focus()}),25)}e.dropDownDataSource&&(Array.isArray(e.dropDownDataSource)&&e.dropDownDataSource.length>0||"function"==typeof e.dropDownDataSource)?(e.query="","function"==typeof e.dropDownDataSource?e.dropDownDataSource(e.query,t):t(e.dropDownDataSource)):(e.query="","function"==typeof e.dataSource?e.dataSource(e.query,t):t(e.dataSource))}_process(e){const t=this;"string"==typeof e&&(e=t.$.deserialize(e,"array")),e=t.readonly?e.filter((function(){return!0})):e.filter((function(e){return""===e||(t.matcher?t.matcher(e):t._matcher(e))})),e=t._sorter(e),t.sorted&&(e.sort(((e,t)=>void 0!==e.label?e.label.localeCompare(t.label):e.localeCompare(t))),"desc"===t.sortDirection&&e.reverse()),!e.length&&t.opened&&""===t.dropDownPlaceholder&&t.close(),0===e.length&&!0!==t.allowItemsAdd&&""===t.dropDownPlaceholder||(t.query.length>0?t._render(e.slice(0,t.items)):t._render(e),t._open(),t.$.scrollView.refresh&&t.$.scrollView.refresh(),t._refreshMenu(),t.ensureVisible())}_matcher(e){const t=this.query;switch(null===e&&(e="null"),e=""+(e=e.label||e),this.queryMode){case"startsWith":return e.startsWith(t);case"startsWithIgnoreCase":return e.toLowerCase().startsWith(t.toLowerCase());case"doesNotContain":return e.indexOf(t)<0;case"doesNotContainIgnoreCase":return e.toLowerCase().indexOf(t.toLowerCase())<0;case"contains":return e.indexOf(t)>-1;default:case"containsIgnoreCase":return~e.toLowerCase().indexOf(t.toLowerCase());case"equals":return 0===e.localeCompare(t);case"equalsIgnoreCase":return 0===e.toLowerCase().localeCompare(t.toLowerCase());case"endsWith":return e.endsWith(t);case"endsWithIgnoreCase":return e.toLowerCase().endsWith(t.toLowerCase())}}_sorter(e){const t=this;let o,a=[],l=[],r=[];if(e&&""===e[0])return e;for(;o=e.shift();){let e=o.label||o;e=""+e,e.toLowerCase().indexOf(t.query.toLowerCase())?~e.indexOf(t.query)?l.push(o):r.push(o):a.push(o)}return a.concat(l,r)}_highlighter(e){const t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return this.query?e.replace(new RegExp("("+t+")","ig"),(function(e,t){return"<strong>"+t+"</strong>"})):e}_render(e){const t=this;let o=0,a=-1,l=null;const r=e.map((function(e){let r=e,i=e;"object"==typeof e&&(r=e.label,i=void 0!==e.value?e.value:r),r=""+r,r=r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""");const n=document.createElement("li"),s=document.createElement("a");if(s.href="javascript:void(0)",n.id=t.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),n.setAttribute("data-label",r),n.index=o++,n.dataValue=i,"string"==typeof i?n.setAttribute("value",i):n.setAttribute("value",JSON.stringify(i)),n.setAttribute("role","option"),n.setAttribute("aria-label",r),void 0!==e.menuLabel?(r=e.menuLabel,s.innerHTML=r):s.innerHTML=t.highlighter?t.highlighter(r):t._highlighter(r),s.setAttribute("aria-hidden",!0),e.disabled&&n.classList.add("smart-disabled"),e.icon&&(s.classList.add("icon"),s.classList.add(e.icon)),e.prefix){const t=document.createElement("span");t.innerHTML=e.prefix,s.classList.add("has-prefix"),s.innerHTML=t.innerHTML+s.innerHTML}if(e.suffix){const t=document.createElement("span");t.innerHTML=e.suffix,s.classList.add("has-suffix"),s.innerHTML=s.innerHTML+t.innerHTML}if(e.dataset)for(let t in e.dataset)n.setAttribute("data-"+t,e.dataset[t]);if(e.className){const t=e.className.split(" ");for(let e=0;e<t.length;e++)n.classList.add(t[e].trim())}return void 0!==t.selectedValue&&void 0!==e.value&&""!==t.selectedValue&&t.selectedValue===e.value&&(e.selected=!0,l=e,a=n.index,n.classList.add("active")),n.appendChild(s),n}));function i(){const e=t.$.menu.getElementsByClassName("active");e[0]&&e[0].classList.remove("active"),this.classList.add("active"),t._setActiveDescendant(this)}-1===a&&r.length>0&&(r[0].classList.add("active"),t._setActiveDescendant(r[0])),l&&(t.$.input.value=l.label,t.$.input.dataValue=l.value,t.setAttribute("data-value",t.$.input.dataValue)),t.$.menu.innerHTML="",0===r.length&&t.dropDownPlaceholder&&(t.$.menu.innerHTML='<div class="smart-flex smart-truncate smart-quiet" style="padding:10px; align-items: center;">'+t.dropDownPlaceholder+"</div>");for(let e=0;e<r.length;e++){const o=r[e];t.$.menu.appendChild(o),o.onmouseenter=i,o.onmouseleave=function(){this.classList.remove("active"),t._setActiveDescendant(null)},o.onclick=i}}ensureVisible(){const e=this,t=e.$.menu.querySelector(".active");t&&(t.offsetTop+t.offsetHeight>=e.$.scrollView.scrollTop+e.$.scrollView.offsetHeight&&(e.$.scrollView.scrollTop=t.offsetTop+t.offsetHeight),(t.offsetTop<=e.$.scrollView.scrollTop||t.offsetTop>=e.$.scrollView.scrollTop+e.$.scrollView.offsetHeight)&&(e.$.scrollView.scrollTop=t.offsetTop),0===[...e.$.menu.children].indexOf(t)?e.$.scrollView.scrollTop=0:[...e.$.menu.children].indexOf(t)===e.$.menu.children.length-1&&(e.$.scrollView.scrollTop=e.$.scrollView.scrollHeight))}_next(){const e=this,t=e.$.menu.querySelector(".active");if(!t){const t=e.$.menu.firstElementChild;return t.classList.add("active"),void e._setActiveDescendant(t)}t.classList.remove("active");let o=t.nextElementSibling;o||(o=e.$.menu.firstElementChild),o.classList.add("active"),e._setActiveDescendant(o),e.ensureVisible()}_prev(){const e=this,t=e.$.menu.querySelector(".active");if(!t){const t=e.$.menu.firstElementChild;return t.classList.add("active"),void e._setActiveDescendant(t)}t.classList.remove("active");let o=t.previousElementSibling;o||(o=e.$.menu.lastElementChild),o.classList.add("active"),e._setActiveDescendant(o),e.ensureVisible()}_move(e){const t=this;if(t.readonly&&!t.opened){if("ArrowUp"===e.key){const o=t.getPrevItem();o&&t.selectItem(o.value),e.preventDefault()}if("ArrowDown"===e.key){const o=t.getNextItem();o&&t.selectItem(o.value),e.preventDefault()}}if(t.opened){switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),t._prev();break;case 40:e.preventDefault(),t._next()}e.stopPropagation()}}_keyDownHandler(e){const t=this;if(t._suppressKeyPressRepeat=![40,38,9,13,27,16,17,18].includes(e.keyCode),t._oldValue=t.$.input.value,!(e.shiftKey||e.altKey||e.ctrlKey))return t.opened&&"Escape"===e.key?(t.close(),e.stopPropagation(),void e.preventDefault()):void t._move(e)}_keyPressHandler(e){this._suppressKeyPressRepeat||e.shiftKey||e.altKey||e.ctrlKey||this._move(e)}_keyUpHandler(e){const t=this;if(!(e.shiftKey||"F2"===e.key||"a"===e.key&&e.ctrlKey))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 9:case 13:if(!t.opened)return;if(!t.readonly&&!t.$.menu.querySelector(".active")){const o=t.$.input.value;return t._performSelect(),t.value=t.$.input.value=o,e.stopPropagation(),void e.preventDefault()}t._performSelect(),e.stopPropagation(),e.preventDefault();break;case 27:if(!t.opened)return;t.close(),e.stopPropagation(),e.preventDefault();break;default:t._lookupTimer&&clearTimeout(t._lookupTimer),t._lookupTimer=setTimeout((()=>{if(t._lookup(e),!t.opened||e.ctrlKey||e.shiftKey||(e.stopPropagation(),e.preventDefault()),t.$.fireEvent("changing",{value:t.$.input.value,oldValue:t._oldValue}),t.dataSource&&t.dataSource.length)for(let e=0;e<t.dataSource.length;e++){const o=t.dataSource[e];if("string"==typeof o){if(o===t.$.input.value){t.$.input.dataValue=t.$.input.value,t.setAttribute("data-value",t.$.input.dataValue);break}}else if(void 0!==o.label&&o.label===t.$.input.value){t.$.input.dataValue=o.value,t.setAttribute("data-value",o.value);break}}else t.$.input.dataValue=t.$.input.value,t.setAttribute("data-value",t.$.input.dataValue);t._updateTargetValue()}),300)}}clearValue(){const e=this;e.$.input.value="",e.$.input.dataValue="",e.removeAttribute("data-value"),e.set("value",""),e.set("selectedIndex",-1),e.set("selectedValues",[e.$.input.dataValue]),e.set("selectedValue",e.$.input.dataValue)}propertyChangedHandler(e,t,o){super.propertyChangedHandler(e,t,o);const a=this;if("innerHTML"===e&&(a._getDataSourceFromOption(),a._setSelection(!1)),"selectedValue"===e){let e=-1;if(a.dataSource&&Array.isArray(a.dataSource)&&a.dataSource.forEach(((t,a)=>{"string"==typeof t?t===o&&(e=a):t&&t.value===o&&(e=a)})),e>=0){const t=a.context;a.context=a,a.selectedIndex=e,a.context=t}a._setSelection()}if("selectedIndex"===e){let e=a.dataSource;if(a.selectedValue=null,e&&Array.isArray(e))for(let t=0;t<e.length;t++){let o=e[t];"string"!=typeof o&&"number"!=typeof o&&(o.selected=!1)}a._setSelection()}else if("dataSource"===e){if(a.dataSource&&Array.isArray(a.dataSource)){let e=-1;if(a.dataSource.forEach(((t,o)=>{t.selected&&(e=o)})),e>=0){const t=a.context;a.context=a,a.selectedIndex=e,a.context=t}}a._setSelection(!1)}else if("dropDownClassList"===e){const e=a.$.scrollView;for(let o=0,a=t.length;o<a;o+=1)e.classList.remove(t[o]);for(let t=0,a=o.length;t<a;t+=1)e.classList.add(o[t])}else if("dropDownHeight"===e)"auto"!==a.dropDownHeight?a.$.scrollView.style.setProperty("--smart-input-drop-down-menu-height",a.dropDownHeight+"px"):a.$.scrollView.style.setProperty("--smart-input-drop-down-menu-height","auto");else if("opened"===e)a.opened=t,o?a.open():a.close();else if("placeholder"===e){if(a.readonly){const e=a.getAttribute("aria-label");if(e&&e!==t)return;o?a.setAttribute("aria-label",o):a.removeAttribute("aria-label")}}else if("selectedValues"===e)if(null===o)a.$.input.value="",a.$.input.dataValue=o,a.setAttribute("data-value",o),a._refreshSelectedIndex();else{const e=o.join(","),t=a.value;if(a.$.input.dataValue=e,e&&-1===e.indexOf(",")){let e=-1,t=o[0];if(a.dataSource&&Array.isArray(a.dataSource)&&a.dataSource.forEach(((a,l)=>{"string"==typeof a?a!==o&&a!==t||(e=l):a&&a.value===t&&(e=l)})),e>=0){const t=a.context;a.context=a,a.selectedIndex=e,a.context=t}}a._setSelection(),a.propertyChangedHandler("value",t,a.value)}else"value"===e?(a.displayMember!==a.valueMember&&"string"!=typeof o?(a.set("value",o[a.displayMember]),a.$.input.dataValue=o[a.valueMember],a.setAttribute("data-value",a.$.input.dataValue)):(a.$.input.value=a.$.input.dataValue=o,a.setAttribute("data-value",o)),a._refreshSelectedIndex()):"readonly"===e?(a._setAriaRelations(),a._setInputPurpose()):"theme"===e||"rightToLeft"===e?a.$.scrollView[e]=o:"inputPurpose"===e?a._setInputPurpose():"inverted"===e?o?a.$.scrollView.setAttribute("inverted",""):a.$.scrollView.removeAttribute("inverted"):"disabled"!==e&&"unfocusable"!==e||a._setFocusable()}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const o=e.dataset.property,a=e.value;o&&void 0!==t[o]&&(t[o]=a)}}}detached(){super.detached(),this.close(),this.removeAttribute("focus")}_getDataSourceFromOption(){const e=this;if(e.innerHTML.indexOf("<option")>=0){e.$.optionsContainer.innerHTML=e.innerHTML.trim();const t=e.querySelectorAll("option");let o=[];for(let e=0;e<t.length;e++){const a=t[e],l=a.hasAttribute("selected")||a.hasAttribute("is-selected")&&"false"!==a.getAttribute("is-selected");let r=(""+a.textContent).trim();const i=(""+a.innerHTML).trim(),n=a.hasAttribute("value")?a.getAttribute("value"):r,s=a.hasAttribute("disabled"),u=a.hasAttribute("label")?a.getAttribute("label"):null;u&&(r=u),o.push({label:r,menuLabel:i,value:n,disabled:s,selected:l,className:a.className,dataset:a.dataset}),a.classList.add("smart-hidden")}e.dataSource=o}}render(){const e=this,t=e.dropDownClassList;if(e._getDataSourceFromOption(),e.selectedValues&&e.selectedValues.length){const t=e.selectedValues.join(",");e.value=t}e._createElement&&e._createElement();const o=e.$.scrollView;for(let e=0,a=t.length;e<a;e+=1)o.classList.add(t[e]);e.opened&&(e.opened=!1,e.open());const a=e.$.menu;a&&(a.setAttribute("role","presentation"),o.appendChild(a)),"auto"!==e.dropDownHeight?o.style.setProperty("--smart-input-drop-down-menu-height",e.dropDownHeight+"px"):o.style.setProperty("--smart-input-drop-down-menu-height","auto"),o.classList.add("smart-input-drop-down-menu");for(let t=0;t<e.classList.length;t++){const a=e.classList[t];"smart-element"!==a&&"smart-input"!==a&&o.classList.add(a+"-drop-down-menu")}o.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),o.ownerElement=e;let l=e.dataSource;if("string"==typeof l&&(l=e.$.deserialize(l,"array")),l&&l.length&&Array.isArray(l)){let t=-1;if(l.forEach(((e,o)=>{e.selected&&(t=o)})),t>=0){e.selectedIndex=t;const o=l[t];e.selectedValue="string"==typeof o?l[t]:l[t].value}}e._setAriaRelations(),e._setInputPurpose(),e._setSelection(),e.isInitialized=!0,e.hasAttribute("tabindex")&&(e.readonly||(e.$.input.setAttribute("tabindex",e.getAttribute("tabindex")),e.removeAttribute("tabindex"))),super.render()}_setSelection(e){const t=this;let o=t.dataSource;if("string"==typeof o&&(o=t.$.deserialize(o,"array")),t.selectedIndex>=0&&o&&o.length>0){let a=o[t.selectedIndex];if("number"!=typeof a&&"boolean"!=typeof a||(a=""+a),"string"==typeof a){let o=t.$.input.dataValue,l=t.value;t.set("value",a),t.$.input.dataValue=a,t.$.input.setAttribute("data-value",a),t.selectedValues=[t.$.input.dataValue],t.isInitialized&&!1!==e&&(t.$.fireEvent("change",{value:t.value,label:t.label,oldValue:o,oldLabel:l}),t._updateTargetValue())}else{let o=t.$.input.dataValue,l=t.value;a&&(void 0!==a.value?(t.set("value",void 0!==a.value?a.value+"":""),t.$.input.dataValue=a.value,t.$.input.setAttribute("data-value",a.value),t.selectedValues=[t.$.input.dataValue]):a.label&&(t.selectedValues=[a.value]),a.label&&t.set("value",a.label)),t.isInitialized&&!1!==e&&(t.$.fireEvent("change",{value:t.$.input.dataValue,label:a.value,oldValue:o,oldLabel:l}),t._updateTargetValue())}}}_createElement(){const e=this,t=document.createElement("ul"),o=document.createElement("smart-scroll-viewer");o.rightToLeft=e.rightToLeft,o.theme=e.theme,o.horizontalScrollBarVisibility="hidden",e.inverted?o.setAttribute("inverted",""):o.removeAttribute("inverted"),e.$.scrollView=o,e.$.menu=t,e._setFocusable();const a=e.$.input;e.$.menu.onpointerdown=function(t){const o=t.target.closest("li"),l=e.$.menu.querySelector(".active");l&&o&&(l.classList.remove("active"),o.classList.add("active")),t.stopPropagation(),t.preventDefault(),setTimeout((()=>{e._performSelect(),o&&o.parentNode&&e.$.fireEvent("itemClick",{index:[...o.parentNode.children].indexOf(o),item:o,label:o.getAttribute("aria-label"),value:o.dataValue}),a.focus()}),50)},e.$.menu.onpointerup=function(t){t.stopPropagation(),t.preventDefault(),e.$.scrollView.$.verticalScrollBar.thumbCapture&&(e.$.scrollView.$.verticalScrollBar.thumbCapture=!1)}}_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-activedescendant"),e.$.input.removeAttribute("aria-controls"),e.$.dropDownButton.setAttribute("aria-hidden",!0)):(e.setAttribute("role","combobox"),t&&t===e.placeholder&&e.removeAttribute("aria-label"),e.$.input.setAttribute("role","searchbox"),e.$.input.removeAttribute("aria-hidden",!0),e.$.dropDownButton.removeAttribute("aria-hidden")),e.setAttribute("aria-expanded",e.opened),e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-owns",e.$.scrollView.id),e.$.scrollView.setAttribute("role","listbox")}_setActiveDescendant(e){const t=this;t.readonly||(e?t.setAttribute("aria-activedescendant",e.id):t.removeAttribute("aria-activedescendant"))}_setInputPurpose(){const e=this;e.readonly?e.$.input.removeAttribute("autocomplete"):e.$.input.setAttribute("autocomplete",e.inputPurpose)}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.$.input.setAttribute("tabindex",-1):e.$.input.removeAttribute("tabindex")}});
|
|
105
105
|
|
|
106
106
|
/***/ }),
|
|
107
107
|
|
|
@@ -157,7 +157,7 @@ Smart("smart-table",class extends Smart.ContentElement{static get properties(){r
|
|
|
157
157
|
/***/ 5482:
|
|
158
158
|
/***/ (() => {
|
|
159
159
|
|
|
160
|
-
Smart("smart-tree-item",class extends Smart.MenuItem{static get properties(){return{selected:{value:!1,type:"boolean"}}}ready(){const e=this;Object.defineProperty(e,"hasStyleObserver",{get:function(){return!1}}),super.ready(),e.setAttribute("role","treeitem"),e.setAttribute("aria-label",e.label)}propertyChangedHandler(e,t,r){const n=this,l=n.menu;if(super.propertyChangedHandler(e,t,r),"level"===e)return void(n.level=t);if("disabled"===e||"separator"===e||!l)return;const a=l.context;switch(l.context=l,e){case"label":{const e=l.sorted&&l.autoSort;n.firstElementChild.firstElementChild.firstElementChild.innerHTML=r,e&&(l._unsortItems(l.$.mainContainer),l._applyGrouping(l.$.mainContainer)),l._state.filter&&l._applyFilter(l._state.filter),n.setAttribute("aria-label",r);break}case"selected":n.selected=t,r?l.select(n):l.unselect(n);break;case"shortcut":{let e=n.firstElementChild.children[1];e||(e=document.createElement("div"),e.className="smart-tree-item-shortcut",n.firstElementChild.appendChild(e)),e.innerHTML=r;break}case"value":l.sort&&l.sorted&&l.autoSort&&l._refreshSorting()}l.context=a}_setId(){}}),Smart("smart-tree-items-group",class extends Smart.MenuItemsGroup{static get properties(){return{selected:{value:!1,type:"boolean"}}}ready(){const e=this;Object.defineProperty(e,"hasStyleObserver",{get:function(){return!1}}),super.ready(),e.setAttribute("role","treeitem"),e.removeAttribute("aria-haspopup"),e.setAttribute("aria-label",e.label)}propertyChangedHandler(e,t,r){const n=this,l=n.menu;if(super.propertyChangedHandler(e,t,r),"level"===e)return void(n.level=t);if("disabled"===e||"separator"===e||!l)return;const a=l.context;switch(l.context=l,e){case"expanded":n.expanded=t,r?l.expandItem(n):l.collapseItem(n);break;case"label":{const e=l.sorted&&l.autoSort;n.firstElementChild.firstElementChild.firstElementChild.innerHTML=r,e&&(l._unsortItems(l.$.mainContainer),l._applyGrouping(l.$.mainContainer)),l._state.filter&&l._applyFilter(l._state.filter),n.setAttribute("aria-label",r);break}case"selected":n.selected=t,r?l.select(n):l.unselect(n);break;case"value":l.sort&&l.sorted&&l.autoSort&&l._refreshSorting()}l.context=a}_setId(){}}),Smart("smart-tree",class extends Smart.Menu{static get properties(){return{allowDrag:{value:!1,type:"boolean"},allowDrop:{value:!1,type:"boolean"},autoHideToggleElement:{value:!1,type:"boolean"},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},autoSort:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},dragFeedbackFormatFunction:{value:null,type:"function?"},dragOffset:{value:[10,10],type:"array"},editable:{value:!1,type:"boolean"},expandMode:{value:"multiple",allowedValues:["multiple","single"],type:"string"},filterable:{value:!1,type:"boolean"},filterOnEnter:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterMember:{value:"label",type:"string"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},hasThreeStates:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{value:{en:{noId:"smart-tree: Saving and loading the element's state are not available if the element has no id."}},type:"object",extend:!0},scrollMode:{value:"scrollbar",allowedValues:["scrollbar","scrollButtons"],type:"string"},selectedIndexes:{value:[],type:"array"},selectionDisplayMode:{value:"row",allowedValues:["row","label"],type:"string"},selectionMode:{value:"one",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectionTarget:{value:"all",allowedValues:["all","leaf"],type:"string"},showLines:{value:!1,type:"boolean"},showRootLines:{value:!1,type:"boolean"},sort:{value:null,type:"function?",reflectToAttribute:!1},sortDirection:{value:"asc",allowedValues:["asc","desc"],type:"string"},sorted:{value:!1,type:"boolean"},toggleElementPosition:{value:"near",allowedValues:["near","far"],type:"string"},toggleMode:{value:"dblclick",allowedValues:["click","dblclick","arrow"],type:"string"}}}static get listeners(){return{blur:"_blurHandler",focus:"_focusHandler",keydown:"_keydownHandler",mouseenter:"_mouseenterHandler",mouseleave:"_mouseleaveHandler",resize:"_checkOverflow",styleChanged:"_styleChangedHandler",transitionend:"_overriddenMenuHandler","container.click":"_overriddenMenuHandler","container.mouseout":"_overriddenMenuHandler","container.mouseover":"_overriddenMenuHandler","container.pointerover":"_pointeroverHandler","editInput.blur":"_editInputBlurHandler","filterInput.keydown":"_filterInputKeydownHandler","filterInput.keyup":"_filterInputKeyupHandler","mainContainer.click":"_overriddenMenuHandler","mainContainer.mouseleave":"_overriddenMenuHandler","mainContainer.mouseout":"_overriddenMenuHandler","mainContainer.mouseover":"_overriddenMenuHandler","mainContainer.swipeleft":"_mainContainerSwipeHandler","mainContainer.swiperight":"_mainContainerSwipeHandler","scrollButtonFar.click":"_scrollButtonFarClickHandler","scrollButtonNear.click":"_scrollButtonNearClickHandler","scrollViewer.down":"_scrollViewerDownHandler","scrollViewer.kineticScroll":"_scrollViewerWheelHandler","scrollViewer.touchmove":"_scrollViewerTouchmoveHandler","mainContainer.wheel":"_scrollViewerWheelHandler","document.move":"_moveHandler","document.selectstart":"_selectstartHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}static get styleUrls(){return["smart.scrollbar.css","smart.scrollviewer.css","smart.tree.css"]}template(){return'<div id="container" role="presentation">\n <div class="smart-tree-filter-input-container" role="presentation"><input id="filterInput" class="smart-filter-input" disabled="[[disabled]]" placeholder="[[filterInputPlaceholder]]" type="text" role="searchbox" aria-label="[[filterInputPlaceholder]]" /></div>\n <smart-repeat-button id="scrollButtonNear" class="smart-tree-scroll-button smart-spin-button smart-scroll-button-near smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll up">\n <div id="arrowNear" class="smart-arrow smart-arrow-up"></div>\n </smart-repeat-button>\n <smart-scroll-viewer id="scrollViewer" animation="[[animation]]" horizontal-scroll-bar-visibility="hidden" right-to-left="[[rightToLeft]]">\n <div id="mainContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-tree-main-container" role="presentation">\n <content></content>\n </div>\n <input type="text" id="editInput" class="smart-tree-edit-input smart-hidden" />\n </smart-scroll-viewer>\n <smart-repeat-button id="scrollButtonFar" class="smart-tree-scroll-button smart-spin-button smart-scroll-button-far smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll down">\n <div id="arrowFar" class="smart-arrow smart-arrow-down"></div>\n </smart-repeat-button>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" role="presentation">\n <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n </div>\n </div>'}detached(){const e=this,t=e._dragDetails;if(super.detached(),!t)return;const r=Smart.Tree.hoveredTree,n=Smart.Tree.hoveredItem;delete e._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,e.$.scrollViewer._scrollView.disableSwipeScroll=!1,t.FeedbackShown&&(n.classList.remove("drop-target","top","bottom"),document.body.classList.remove("smart-dragging"),t.Feedback.remove(),r&&clearInterval(r._dragInterval))}addAfter(e,t){void 0!==(t=this.getItem(t))&&this.addTo(e,t.parentItem,t,!0)}addBefore(e,t){void 0!==(t=this.getItem(t))&&this.addTo(e,t.parentItem,t)}addTo(e,t){const r=this;if(!(e instanceof Smart.TreeItem||e instanceof Smart.TreeItemsGroup))if("string"==typeof e){const t=document.createElement("smart-tree-item");t.label=e,e=t}else{if(!e||!e.label)return;{const t=document.createElement("smart-tree-item");t.label=e.label,e=t}}let n,l;if(e.isDirty=!1,void 0===t)n=1,l=t=r.$.mainContainer;else{if((t=r.getItem(t))instanceof Smart.TreeItemsGroup==0){const n=document.createElement("smart-tree-items-group");return n.innerHTML=t.innerHTML,n.appendChild(e),r.addBefore(n,t),void t.remove()}n=t.level+1,l=t.itemContainer}r._createItemHTMLStructure(e,n,t,l.childElementCount,0);const a=r.sorted&&r.autoSort,o=r._state.filter,s=r.selectedIndexes.slice(0);a&&r._unsortItems(r.$.mainContainer),e instanceof Smart.TreeItemsGroup&&(Array.from(e.querySelectorAll("smart-tree-item, smart-tree-items-group")).forEach((e=>e.isDirty=!1)),r._processHTML(e,n+1,!1));let i=arguments[2];i&&arguments[3]&&(i=i.nextElementSibling),i?(l.insertBefore(e,i),r._menuItems={},r._refreshItemPaths(r.$.mainContainer,!0,void 0,r.sorted&&!r.autoSort)):l.appendChild(e),a&&r._applyGrouping(r.$.mainContainer),o&&r._applyFilter(o),r._checkOverflow(),r._expandItemsByDefault(),r.selectedIndexes=[],r._applySelection(!0,s)}getSelectedValues(){const e=this,t=[];for(let r=0;r<e.selectedIndexes.length;r++){const n=e._menuItems[e.selectedIndexes[r]];n.hasAttribute("value")?t.push(n.getAttribute("value")):n.hasAttribute("label")&&t.push(n.getAttribute("label"))}return t}unselectValues(e){const t=this;e&&Object.keys(t._menuItems).forEach((r=>{const n=t._menuItems[r];let l=null;n.hasAttribute("value")?l=n.getAttribute("value"):n.hasAttribute("label")&&(l=n.getAttribute("label")),"string"==typeof e?e===l&&t.unselect(r):e.indexOf(l)>=0&&t.unselect(r)}))}setSelectedValues(e){const t=this;e&&Object.keys(t._menuItems).forEach((r=>{const n=t._menuItems[r];let l=null;n.hasAttribute("value")?l=n.getAttribute("value"):n.hasAttribute("label")&&(l=n.getAttribute("label")),"string"==typeof e?e===l&&t._canItemBeSelected(n)&&t._handleSelection(n,{type:"programmatic"}):e.indexOf(l)>=0&&t._canItemBeSelected(n)&&t._handleSelection(n,{type:"programmatic"})}))}clearSelection(){const e=this,t=e.selectedIndexes.slice(0);e.selectedIndexes=[],e._applySelection(!1,t)}collapseAll(e){const t=this,r=t.animation,n=!1===e&&t.hasAnimation;n&&(t.animation="none"),t._collapseAll(!0),n&&(t.animation=r)}ensureVisible(e){const t=this;if(void 0===(e=t.getItem(e))||e.hidden)return;let r=!1;e.level>1&&!t._isBranchExpanded(e)&&(super.expandItem(e.parentItem,void 0,!0),r=t.hasAnimation,r&&(t._ensureVisibleOnTransitionend=e)),r||t._ensureVisible(e)}expandAll(e){const t=this,r=t.animation,n=!1===e&&t.hasAnimation;let l=1,a=(t.enableShadowDOM?t.shadowRoot:t).querySelectorAll('smart-tree-items-group[level="1"]');for(n&&(t.animation="none");a.length>0;){for(let e=0;e<a.length;e++){const r=a[e];r.expanded||t._menuItemsGroupSelectionHandler(r,{target:r,type:"expand"})}l++,a=(t.enableShadowDOM?t.shadowRoot:t).querySelectorAll('smart-tree-items-group[level="'+l+'"]')}n&&(t.animation=r)}expandItem(e,t){const r=this;if(void 0===(e=r.getItem(e))||e instanceof Smart.TreeItemsGroup==0||e&&e.container&&r._isContainerOpened(e.container.level,e.container))return;void 0!==Smart.Menu.processTimer&&r._lazyInitItems();const n=!1===t&&r.hasAnimation,l=r.animation;n&&(r.animation="none"),r._discardKeyboardHover(),r._menuItemsGroupSelectionHandler(e,{target:e,type:"expand"},arguments[2]),n&&(r.animation=l)}filter(e){const t=this;t.filterable&&(t._applyFilter(e),t.$.filterInput.value=e)}getState(){return JSON.parse(JSON.stringify(this._state))}insert(e,t){const r=this;let n;if(e instanceof Smart.TreeItem||e instanceof Smart.TreeItemsGroup){if(r.contains(e))return;e.isDirty=!1,n=e}else{if("object"!=typeof e||e.constructor!==Object)return;n=function e(t){const n=t[r.itemsMember],l="smart-tree-items-group"===t.tagName||Array.isArray(n)?"smart-tree-items-group":"smart-tree-item",a=document.createElement(l);if(a.isDirty=!1,t.disabled&&(a.disabled=!0),t[r.displayMember]&&(a.label=t[r.displayMember]),t.selected&&(a.selected=!0),t.separator&&(a.separator=!0),t[r.valueMember]&&(a.value=t[r.valueMember]),"smart-tree-items-group"===l){if(t.expanded&&(a.expanded=!0),n)for(let t=0;t<n.length;t++)a.appendChild(e(n[t]))}else t.shortcut&&(a.shortcut=t.shortcut);return a}(e)}if(void 0===t)return void r.addTo(n);if("number"==typeof t)t=t.toString();else if(t instanceof Smart.TreeItem||t instanceof Smart.TreeItemsGroup){if(!r.contains(t))return;t=t.path}else if("string"!=typeof t)return;const l=t.split(".");let a,o;1===l.length?(o=r._menuItems[l[0]],o?r.addBefore(n,o):r.addTo(n)):(o=r._menuItems[t],a=r._menuItems[l.slice(0,l.length-1).join(".")],o?r.addBefore(n,o):a&&a instanceof Smart.TreeItemsGroup&&r.addTo(n,a))}loadState(e){const t=this,r=t.selectedIndexes.slice(0),n=[];if(!e){if(!t.id)return void t.warn(t.localize("noId"));if(!(e=window.localStorage.getItem("smartTree"+t.id)))return}"string"==typeof e&&(e=JSON.parse(e)),e.filter&&!t.filterable&&(e.filter="");let l=e.filter!==t._state.filter;e.sorted!==t.sorted?(t.sorted=e.sorted,t._updateState("sorted",t.sorted),e.sorted?t._applyGrouping(t.$.mainContainer):t._unsortItems(t.$.mainContainer),(e.filter||l)&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter)):l&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter),t._menuItemsGroupsToExpand=[];for(let r=0;r<e.expanded.length;r++){const n=t.getItem(e.expanded[r]);n&&t._menuItemsGroupsToExpand.push(n)}t._expandItemsByDefault(!0);for(let r=0;r<e.selected.length;r++){const l=t.getItem(e.selected[r]);l&&n.push(l.path)}t.selectedIndexes=n,t._applySelection(!1,r)}moveDown(e){const t=this,r=(e=t.getItem(e)).nextElementSibling;void 0!==e&&r&&!t.sorted&&(t._moveTreeItem(e,r,2,[t]),t.filterable&&t._state.filter&&t._applyFilter(t._state.filter))}moveUp(e){const t=this,r=(e=t.getItem(e)).previousElementSibling;void 0!==e&&r&&!t.sorted&&(t._moveTreeItem(e,r,0,[t]),t.filterable&&t._state.filter&&t._applyFilter(t._state.filter))}refresh(){this._checkOverflow()}removeItem(e){const t=this;if(void 0===(e=t.getItem(e)))return;if(e instanceof Smart.TreeItemsGroup){const r=e.container;t._isContainerOpened(r.level,r)&&t._closeSubContainersTreeMode(r.level,r)}const r=t.sorted&&t.autoSort;r&&t._unsortItems(t.$.mainContainer);const n=e.closest("smart-tree-items-group");e.parentElement.removeChild(e),t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,void 0,t.sorted&&!t.autoSort),r&&t._applyGrouping(t.$.mainContainer);const l=t._state.filter,a=t.selectedIndexes.slice(0);if(l&&t._applyFilter(l),t._checkOverflow(),t.selectedIndexes=[],t._applySelection(!0,a),delete t._treeAnimationInProgress,n&&!n.querySelector("smart-tree-item")){const e=document.createElement("smart-tree-item");return e.innerHTML=n.innerHTML,t.addBefore(e,n),void n.remove()}}saveState(){const e=this;return e.id?window.localStorage.setItem("smartTree"+e.id,JSON.stringify(e._state)):e.warn(e.localize("noId")),JSON.parse(JSON.stringify(e._state))}select(e){const t=this;void 0!==(e=t.getItem(e))&&!e.selected&&t._canItemBeSelected(e)&&t._handleSelection(e,{type:"programmatic"})}unselect(e){void 0!==(e=this.getItem(e))&&e.selected&&!e.templateApplied&&this._handleSelection(e,{type:"programmatic"})}updateItem(e,t){if(void 0===(e=this.getItem(e))||void 0===t)return;const r=e instanceof Smart.TreeItem;for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r){if(-1===["disabled","label","level","selected","separator","shortcut","value"].indexOf(n))continue}else if(-1===["disabled","expanded","label","level","selected","separator","value"].indexOf(n))continue;e[n]=t[n]}}propertyChangedHandler(e,t,r){const n=this;switch(super.propertyChangedHandler(e,t,r),e){case"allowDrag":case"allowDrop":case"autoLoadState":case"autoSort":case"editable":case"filterInputPlaceholder":case"loadingIndicatorPlaceholder":case"selectionDisplayMode":case"showLines":case"showRootLines":case"toggleElementPosition":case"toggleMode":break;case"autoHideToggleElement":r?n.$mainContainer.addClass("hidden-arrows"):n.$mainContainer.removeClass("hidden-arrows");break;case"autoSaveState":if(!r)return;if(!n.id)return n.warn(n.localize("noId")),void(n.autoSaveState=!1);window.localStorage.setItem("smartTree"+n.id,JSON.stringify(n._state));break;case"dataSource":{const e=n.selectedIndexes.slice(0);n.selectedIndexes=[],n._menuItems={},n._processDataSource(),n._checkOverflow(),n._expandItemsByDefault(),n._applySelection(!0,e);const t=n._state.filter;t&&n._applyFilter(t);break}case"disabled":n._setFocusable(),n.$.scrollButtonNear.disabled=r,n.$.scrollButtonFar.disabled=r,r||n._updateScrollButtonVisibility();break;case"displayLoadingIndicator":r?(n._discardKeyboardHover(!0),n.$loadingIndicatorContainer.removeClass("smart-hidden")):n.$loadingIndicatorContainer.addClass("smart-hidden");break;case"expandMode":if("single"===r){const e=n._state.expanded.map((e=>Object.values(n._menuItems).find((t=>t.id===e)))),t={};for(let r=0;r<e.length;r++){const l=e[r],a=l.parentItem;if(t[a])continue;t[a]=!0;const o=e.filter((e=>e!==l&&e.parentItem===a));o.length>0&&o.forEach((e=>n.collapseItem(e)))}}break;case"filterable":!1===r&&(n._applyFilter(""),n.$.filterInput.value=""),n._checkOverflow();break;case"filterMode":n.filterable&&n._state.filter&&n._applyFilter(n._state.filter);break;case"hasThreeStates":if("checkBox"!==n.selectionMode)return;if(r)n._applySelection(!1);else{const e=(n.enableShadowDOM?n.shadowRoot:n).querySelectorAll("[indeterminate]");for(let t=0;t<e.length;t++)e[t].removeAttribute("indeterminate")}break;case"innerHTML":n.$.mainContainer.innerHTML=r,n._lazyInitItems();break;case"loadingIndicatorPosition":"center"===r?n.$loadingIndicatorPlaceHolder.addClass("smart-hidden"):n.$loadingIndicatorPlaceHolder.removeClass("smart-hidden");break;case"overflow":if("scrollbar"===n.scrollMode)return"hidden"===r?n.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0):n.$.scrollViewer.$.verticalScrollBar.removeAttribute("aria-hidden"),void(n.$.scrollViewer.verticalScrollBarVisibility="scroll"===r?"visible":"auto");n.$.scrollViewer.scrollTop=0,"hidden"===r?(n.$scrollViewer.removeClass("scroll-buttons-shown"),n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden")):(n.$.scrollButtonNear.disabled=n.disabled,n.$.scrollButtonFar.disabled=n.disabled,"auto"===r?(n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden"),n._checkOverflow()):(n.$scrollViewer.addClass("scroll-buttons-shown"),n.$scrollViewer.removeClass("one-button-shown"),n.$scrollButtonNear.removeClass("smart-hidden"),n.$scrollButtonFar.removeClass("smart-hidden"),n._updateScrollButtonVisibility())),n.$.scrollViewer.refresh();break;case"rightToLeft":{let e,t;r?(e="paddingLeft",t="paddingRight"):(e="paddingRight",t="paddingLeft");for(let r in n._menuItems)if(Object.prototype.hasOwnProperty.call(n._menuItems,r)){const l=n._menuItems[r],a=l.firstElementChild;a.style[e]="",n._setIndentation(a,l.level,t)}break}case"scrollMode":if("hidden"===n.overflow)return;if(n.$.scrollViewer.scrollTop=0,"scrollButtons"===r)return"scroll"===n.overflow&&(n.$scrollViewer.addClass("scroll-buttons-shown"),n.$scrollButtonNear.removeClass("smart-hidden"),n.$scrollButtonFar.removeClass("smart-hidden")),n.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0),n.$.scrollViewer.verticalScrollBarVisibility="auto",void n._checkOverflow();n.$.scrollViewer.$.verticalScrollBar.removeAttribute("aria-hidden"),n.$scrollViewer.removeClass("scroll-buttons-shown"),n.$scrollViewer.removeClass("one-button-shown"),n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden"),"auto"===n.overflow?n.$.scrollViewer.verticalScrollBarVisibility="auto":n.$.scrollViewer.verticalScrollBarVisibility="visible";break;case"selectedIndexes":n._applySelection(!1,t);break;case"selectionMode":if(n.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(r)),void 0===n._menuItems[0])return;if("one"===t&&"none"!==r&&"checkBox"!==r&&"radioButton"!==r||-1!==t.indexOf("oneOrMany")&&-1!==r.indexOf("oneOrMany")||"none"===t&&(-1!==r.indexOf("zero")||"checkBox"===r)||"zeroOrMany"===r&&"checkBox"!==t||"radioButton"===t&&-1!==r.indexOf("Many")||!n.hasThreeStates&&("checkBox"===r||"checkBox"===t&&"zeroOrMany"===r))return n._lastSelectedItem="one"===r||"oneOrManyExtended"===r?n._menuItems[n.selectedIndexes[n.selectedIndexes.length-1]]:void 0,void n._applyAriaSelected();if(n.hasThreeStates&&"checkBox"===t){const e=(n.enableShadowDOM?n.shadowRoot:n).querySelectorAll("[indeterminate]");for(let t=0;t<e.length;t++)e[t].removeAttribute("indeterminate")}n._applySelection(!1);break;case"sort":if(!n.sorted)return;n._refreshSorting();break;case"sortDirection":n.sorted&&!n.sort&&(n._unsortItems(n.$.mainContainer),n._applyGrouping(n.$.mainContainer));break;case"sorted":{if(!r&&!n.autoSort)return n._refreshItemPathsAndSelection(),void n._updateState("sorted",!1);r?n._applyGrouping(n.$.mainContainer):n._unsortItems(n.$.mainContainer);const e=n._state.filter;e&&n._applyFilter(e),n._updateState("sorted",r),n._checkOverflow();break}case"unfocusable":n._setFocusable()}}_addDragFeedback(){const e=this,t=document.createElement("div");return t.className="smart-tree-item-feedback",t.setAttribute("parent-tree-id",e.id),e.theme&&t.setAttribute("theme",e.theme),e.dragFeedbackFormatFunction?t.innerHTML=e.dragFeedbackFormatFunction(e._dragDetails.Items):1===e._dragDetails.Items.length?t.innerHTML=e._dragDetails.Item.label:(t.classList.add("multiple"),t.innerHTML=""),document.body.appendChild(t),t}_applyFilter(e){const t=this;function r(e,t){e?(t.hidden&&t.$.removeClass("smart-hidden"),t.hidden=!1):(t.hidden||t.$.addClass("smart-hidden"),t.hidden=!0)}if(""===e&&!t.hasAttribute("filter-applied"))return;const n=Array.from(t.$.mainContainer.getElementsByClassName("last-filtered-child"));for(let e=0;e<n.length;e++)n[e].$.removeClass("last-filtered-child");!function n(l,a){let o,s=!1,i=0;a=Array.from(a);for(let l=0;l<a.length;l++){const d=a[l];d instanceof Smart.TreeItem?r(t._findItem(d,e),d):n(d,d.itemContainer.children),d.hidden||(i++,o=d),s=s||!d.hidden}if(l!==t.$.mainContainer){const n=t._findItem(l,e);r(s||n,l),s&&null===n?l.$.addClass("filtered-child"):l.$.removeClass("filtered-child"),!s&&a.length>0?(l.hiddenChildren=!0,l.$.addClass("hidden-children"),t.collapseItem(l,void 0,!1)):(l.hiddenChildren=!1,l.$.removeClass("hidden-children"))}""!==e&&i>0&&o.$.addClass("last-filtered-child")}(t.$.mainContainer,t.$.mainContainer.children),""!==e?t.setAttribute("filter-applied",""):t.removeAttribute("filter-applied"),t._updateState("filter",e),t._checkOverflow()}_applyHierarchicalSelection(e,t){const r=this,n=e!==r.$.mainContainer,l=n?e.itemContainer.children:e.children;let a=0,o=0;for(let s=0;s<l.length;s++){const i=l[s];e.selected&&i.set("selected",!0),i instanceof Smart.TreeItemsGroup?r._applyHierarchicalSelection(i,t):i.selected&&t.push(i.path),n&&(i.selected?a++:i.hasAttribute("indeterminate")&&o++)}n&&(r._setThreeStateCheckbox(e,a,o),e.selected&&t.push(e.path))}_applyRadioButtonSelection(e,t,r){const n=this,l=e!==n.$.mainContainer?e.itemContainer.children:e.children,a=[];let o;for(let e=0;e<l.length;e++){const o=l[e];o instanceof Smart.TreeItemsGroup&&n._applyRadioButtonSelection(o,t,r),o.set("selected",!1),-1!==t.indexOf(o.path)&&a.push(o)}o=0===a.length?l[0]:a[a.length-1],o.set("selected",!0),r.push(o.path)}_applySelection(e,t){const r=this;let n=r.selectedIndexes.slice(0);function l(e){const t=Object.values(r._menuItems).filter((t=>t.level===e));if(0!==t.length){for(let e=0;e<t.length;e++)if(r._canItemBeSelected(t[e]))return t[e].path;return l(e+1)}}if(void 0===t&&(t=n.slice(0)),void 0===r._menuItems[0])return r.selectedIndexes=[],r._lastSelectedItem=void 0,void(r.isRendered&&JSON.stringify(t)!==JSON.stringify([])&&r.$.fireEvent("change",{selectedIndexes:r.selectedIndexes,oldSelectedIndexes:t}));const a=r.selectionMode,o=Array.from((r.shadowRoot||r).querySelectorAll("smart-tree-item[selected], smart-tree-items-group[selected]"));for(let e=n.length-1;e>=0;e--){const t=r._menuItems[n[e]];void 0!==t&&r._canItemBeSelected(t)||n.splice(e,1)}if(e)for(let e=0;e<o.length;e++)r._canItemBeSelected(o[e])?-1===n.indexOf(o[e].path)&&n.push(o[e].path):o[e].set("selected",!1);else{for(let e=0;e<o.length;e++)o[e].set("selected",!1);o.length=0}switch(r._sortPathCollection(n),a){case"none":n.length=0;for(let e=0;e<o.length;e++)o[e].set("selected",!1);break;case"one":case"zeroAndOne":case"zeroOrOne":"one"===a&&0===n.length&&n.push(l(1));for(let e=0;e<n.length;e++){const t=r._menuItems[n[e]];if(e===n.length-1){t.set("selected",!0),n=[n[e]];break}-1!==o.indexOf(t)&&t.set("selected",!1)}break;case"oneOrMany":case"oneOrManyExtended":0===n.length&&n.push(l(1));for(let e=0;e<n.length;e++)r._menuItems[n[e]].set("selected",!0);break;case"zeroOrMany":case"checkBox":for(let e=0;e<n.length;e++)r._menuItems[n[e]].set("selected",!0);if("checkBox"===a&&r.hasThreeStates){const e=[];r._applyHierarchicalSelection(r.$.mainContainer,e),r._sortPathCollection(e),n=e}break;case"radioButton":{const e=[];r._applyRadioButtonSelection(r.$.mainContainer,n,e),r._sortPathCollection(e),n=e;break}}r.selectedIndexes=n,r._updateState("selected"),r._lastSelectedItem="one"===a||"oneOrManyExtended"===a?r._menuItems[n[n.length-1]]:void 0,r.isRendered&&!1!==arguments[2]&&JSON.stringify(t)!==JSON.stringify(n)&&r.$.fireEvent("change",{selectedIndexes:r.selectedIndexes,oldSelectedIndexes:t}),r._applyAriaSelected()}_applyAriaSelected(){const e=this,t=e.selectionMode;for(let r in e._menuItems){const n=e._menuItems[r];n.selected?n.setAttribute("aria-selected",!0):e._canItemBeSelected(n)&&-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(t)?n.setAttribute("aria-selected",!1):n.removeAttribute("aria-selected")}}_autoLoadState(e){const t=this,r=[];for(let e=0;e<t._menuItemsGroupsToExpand.length;e++)t._menuItemsGroupsToExpand[e].set("expanded",!1);t._menuItemsGroupsToExpand=[];for(let r=0;r<e.expanded.length;r++){const n=t.getItem(e.expanded[r]);n&&t._menuItemsGroupsToExpand.push(n)}t.filterable&&e.filter&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter);for(let n=0;n<e.selected.length;n++){const l=t.getItem(e.selected[n]);l&&r.push(l.path)}t.selectedIndexes=r}_blurHandler(){this._discardKeyboardHover(!0)}_canItemBeHovered(e){const t=e.level;return!1===e.disabled&&!0!==e.templateApplied&&!0!==e.hidden&&(1===t||t>1&&this._isContainerOpened(t,e.parentElement.container)&&e.getBoundingClientRect().height>0)}_canItemBeSelected(e,t){return!(!0!==t&&"leaf"===this.selectionTarget&&e instanceof Smart.TreeItemsGroup)&&!1===e.disabled&&!0!==e.templateApplied}_checkOverflow(){const e=this,t=e.$.scrollViewer,r=e.overflow;if("scrollbar"===e.scrollMode||"hidden"===r)return void t.refresh();const n=t.scrollTop;"auto"===r&&(t.$.removeClass("scroll-buttons-shown"),t.$.removeClass("one-button-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"));const l=Math.round(t.$.scrollViewerContentContainer.offsetHeight)>Math.round(t.$.scrollViewerContainer.offsetHeight),a=Math.round(t.scrollTop)>0,o=Math.round(t.$.scrollViewerContainer.offsetHeight+t.scrollTop)<Math.round(t.$.scrollViewerContentContainer.offsetHeight);l?"auto"===r?(t.$.addClass("scroll-buttons-shown"),a&&e.$scrollButtonNear.removeClass("smart-hidden"),o&&e.$scrollButtonFar.removeClass("smart-hidden"),!1===(a&&o)&&t.$.addClass("one-button-shown"),e.disabled||(e.$.scrollButtonNear.disabled=!1,e.$.scrollButtonFar.disabled=!1),t.scrollTop=n):(e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.disabled?(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0):(e.$.scrollButtonNear.disabled=!a,e.$.scrollButtonFar.disabled=!o)):"scroll"===r&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),t.refresh()}_createElement(){const e=this,t=window.getComputedStyle(e.$.scrollViewer);if(e.setAttribute("role","tree"),e.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(e.selectionMode)),e.setAttribute("aria-orientation","vertical"),e.$.scrollViewer.onVerticalChange=e._verticalScrollbarHandler,e.isRendered||Object.defineProperty(e,"dataSource",{get:function(){return e.context===e?e.properties.dataSource.value:e._getDataSource()},set(t){e.updateProperty(e,e._properties.dataSource,t)}}),e.id||!e.autoLoadState&&!e.autoSaveState||(e.warn(e.localize("noId")),e.autoLoadState=!1,e.autoSaveState=!1),e.mode="tree",e._element="tree",e._isMobile=Smart.Utilities.Core.isMobile,e._edgeMacFF=!1,e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._scrollViewerPadding=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)||0,e._state={expanded:[],filter:"",selected:[]},e._dblclickObject={numberOfClicks:0},e.autoHideToggleElement&&e.$mainContainer.addClass("hidden-arrows"),e.disabled&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),"scrollbar"===e.scrollMode&&"scroll"===e.overflow&&(e.$.scrollViewer.verticalScrollBarVisibility="visible"),null===e.dataSource&&e.$.mainContainer.firstElementChild instanceof HTMLUListElement&&e._processUList(),e.isRendered)return e._menuItems={},void(null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource());const r=(e.shadowRoot||e).querySelectorAll("smart-tree-item, smart-tree-items-group"),n=function(){let t;e.autoLoadState&&(t=window.localStorage.getItem("smartTree"+e.id),t&&(t=JSON.parse(t),e.sorted=t.sorted)),e._setFocusable(),e._menuItems={},null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource(),"scrollButtons"!==e.scrollMode&&"hidden"!==e.overflow||e.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0),"scrollButtons"===e.scrollMode&&"scroll"===e.overflow&&(e.$scrollViewer.addClass("scroll-buttons-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility()),e._checkOverflow(),t&&e._autoLoadState(t),e._expandItemsByDefault(),e._applySelection(!0),e._updateState("sorted",e.sorted),e.displayLoadingIndicator&&e.$loadingIndicatorContainer.removeClass("smart-hidden"),"center"!==e.loadingIndicatorPosition&&e.$loadingIndicatorPlaceHolder.removeClass("smart-hidden"),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted())};0===r.length||e.enableShadowDOM||e.isInShadowDOM?n():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(r,n))}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.$.mainContainer&&t.$.mainContainer.appendChild(e)}_dblclickHandler(e,t,r){"dblclick"!==this.toggleMode||e instanceof Smart.TreeItem||t||this._menuItemsGroupSelectionHandler(e,r)}_discardKeyboardHover(e,t){const r=this;!t&&r._hoveredViaKeyboard&&(!e&&r._hoveredViaKeyboard instanceof Smart.MenuItemsGroup&&r._isContainerOpened(r._hoveredViaKeyboard.level+1,r._hoveredViaKeyboard.container)||(r._hoveredViaKeyboard.removeAttribute("focus"),r._hoveredViaKeyboard=void 0))}_documentUpHandler(e){if("pointercancel"===e.originalEvent.type)return;const t=this,r=t._downTimeoutInfo,n=t._dragDetails;!r||n&&n.FeedbackShown||(clearTimeout(r.timeout),t.$.scrollViewer.scrollTop!==r.scrollTop&&t.getBoundingClientRect().top===r.top||t._continueSelection(r.target,r.event)),delete t._downTimeoutInfo;const l=t._downItem,a=t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(delete t._downItem,t._editedItem&&!t._editInputDown&&(!t._isMobile&&a!==t.$.editInput||t._isMobile&&t.getRootNode().elementFromPoint(e.clientX,e.clientY)!==t.$.editInput))return void t._endEditing();if(delete t._editInputDown,l){const r=a.closest("smart-tree-item")||a.closest("smart-tree-items-group");!r||!r.selected||r!==l||t._dragDetails&&t._dragDetails.FeedbackShown||r instanceof Smart.TreeItemsGroup&&(a.closest(".smart-tree-items-group-arrow")||a===r.container||a===r.container.firstElementChild)||t._handleSelection(r,e)}if(!n)return;const o=Smart.Tree.hoveredTree,s=Smart.Tree.hoveredItem;if(delete t._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,t.$.scrollViewer._scrollView.disableSwipeScroll=!1,!n.FeedbackShown)return;const i=o||t.getRootNode().elementFromPoint(e.clientX,e.clientY);let d;document.body.classList.remove("smart-dragging"),document.body.removeChild(n.Feedback),o&&clearInterval(o._dragInterval);const c=n.Item,m=n.Items,u=n.ValidItems;if(!i)return;if(!s||c.contains(s))return void t.$.fireEvent("dragEnd",{item:c,items:m,target:i,data:n,previousContainer:t,container:o||i,originalEvent:e});if(!o||!o.allowDrop||o.disabled)return;const p=[o];let h;if(s.classList.remove("drop-target"),s.classList.contains("top")?(s.classList.remove("top"),h="top",d=0):s.classList.contains("bottom")?(s.classList.remove("bottom"),h="bottom",d=2):(h="inside",d=1),n.DropDetails={item:s,position:h},o!==t)p.push(t);else if(n.ValidateOnDrop)for(let e=0;e<u.length;e++)if(u[e].contains(s))return;if(!t.$.fireEvent("dragEnd",{item:c,items:m,target:s,data:n,previousContainer:t,container:o,originalEvent:e}).defaultPrevented){o.sorted&&o.autoSort&&o._unsortItems(o.$.mainContainer);for(let e=0;e<u.length;e++)t._moveTreeItem(u[e],s,d,p);o.sorted&&o.autoSort&&o._applyGrouping(o.$.mainContainer),o!==t&&o._state.filter&&o._applyFilter(o._state.filter)}}_editInputBlurHandler(){this._endEditing()}_endEditing(e){const t=this,r=t._editedItem;if(!r)return;if(delete t._editedItem,t.$editInput.addClass("smart-hidden"),t.focus(),e)return;const n=t.$.editInput.value,l=t.sorted&&t.autoSort,a=t._state.filter;n!==r.label&&(r.set("label",n),r.setAttribute("aria-label",n),r.firstElementChild.firstElementChild.firstElementChild.innerHTML=n,l&&(t._unsortItems(t.$.mainContainer),t._applyGrouping(t.$.mainContainer)),a&&t._applyFilter(a))}_ensureVisible(e){const t=this;t._ensureVisibleTreeMode(e,e.getBoundingClientRect(),t.$.scrollViewer,t.$.scrollViewer.getBoundingClientRect(),t._scrollViewerPadding),t._ensureVisibleCallback&&t._ensureVisibleCallback(e)}_pointeroverHandler(e){const t=(this.isInShadowDOM?e.composedPath()[0]:e.target).closest(".smart-tree-item-label-element>span");if(!t)return;const r=this.$.container.querySelector(".tooltip");r&&(r.classList.remove("tooltip"),r.removeAttribute("title")),t.scrollWidth>t.offsetWidth&&(t.classList.add("tooltip"),t.title=t.innerText)}_filterInputKeyupHandler(e){const t=this;if(t._filterTimer&&clearTimeout(t._filterTimer),t.filterOnEnter){if("Enter"!==e.key)return;{const e=t.context;t.context=t,t._applyFilter(t.$.filterInput.value,t._view),t._checkOverflow(),t.context=e}}t._filterTimer=setTimeout((function(){const e=t.context;t.context=t,t._applyFilter(t.$.filterInput.value,t._view),t._checkOverflow(),t.context=e}),300)}_filterInputKeydownHandler(e){if("PageDown"!==e.key)return void("PageUp"===e.key&&(e.preventDefault(),e.stopPropagation()));const t=this;let r;if(e.preventDefault(),e.stopPropagation(),t.selectedIndexes.length>0){const e=t.selectedIndexes.slice(0);r=t._lastSelectedItem||t._menuItems[t.selectedIndexes[t.selectedIndexes.length-1]],"checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&(t.selectedIndexes=[r.path],t._applySelection(!1,e)),t.focus()}else r=t._getFirstEnabledChild(t.$.mainContainer),t.focus(),r&&t._hoverViaKeyboard(r);t._ensureVisible(r)}_focusHandler(){const e=this;e.selectedIndexes.length>0&&!e._hoveredViaKeyboard&&(e._lastSelectedItem?e._hoverViaKeyboard(e._lastSelectedItem,!1,void 0,!1):e._hoverViaKeyboard(e._menuItems[e.selectedIndexes[e.selectedIndexes.length-1]],!1,void 0,!1))}_getDataSource(){const e=[];return function e(t,r){for(let n=0;n<t.length;n++){const l=t[n],a={label:l.label};l.disabled&&(a.disabled=!0),l.selected&&(a.selected=!0),l.separator&&(a.separator=!0),null!==l.value&&(a.value=l.value),l instanceof Smart.TreeItem?l.shortcut&&(a.shortcut=l.shortcut):(l.expanded&&(a.expanded=!0),a.items=[],l.itemContainer&&l.itemContainer.children&&e(l.itemContainer.children,a.items)),r.push(a)}}(this.$.mainContainer.children,e),e}_handleHierarchicalSelection(e,t){const r=this;let n=e;for(e.selected?(e.set("selected",!1),e.setAttribute("aria-selected",!1)):(e.set("selected",!0),e.setAttribute("aria-selected",!0),e.removeAttribute("indeterminate"));n.parentItem;){const e=n.parentItem,t=e.itemContainer.children;let l=0,a=0;for(let e=0;e<t.length;e++)t[e].selected?l++:t[e].hasAttribute("indeterminate")&&a++;r._setThreeStateCheckbox(e,l,a),n=e}e instanceof Smart.TreeItemsGroup&&function e(t,r){const n=t.itemContainer.children;for(let t=0;t<n.length;t++){const l=n[t];l.set("selected",r),l.setAttribute("aria-selected",r),l.removeAttribute("indeterminate"),l instanceof Smart.TreeItemsGroup&&e(l,r)}}(e,e.selected),t.length=0;const l=Array.from((r.enableShadowDOM?r.shadowRoot:r).querySelectorAll("[selected]"));for(let e=0;e<l.length;e++)t.push(l[e].path);r._sortPathCollection(t)}_handleSelection(e,t){const r=this,n=r.selectionMode;if("none"===n||"programmatic"!==t.type&&!r._canItemBeSelected(e))return;const l=e.selected;if(l&&"down"===t.type)return;const a=r.selectedIndexes.slice(0);let o=a.slice(0);switch(n){case"one":case"zeroAndOne":if(l)return;r._menuItems[o[0]]&&(r._menuItems[o[0]].set("selected",!1),r._menuItems[o[0]].removeAttribute("aria-selected")),r.selectedIndexes=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e;break;case"zeroOrOne":l?(r.selectedIndexes=[],e.set("selected",!1),e.removeAttribute("aria-selected")):(void 0!==o[0]&&(r._menuItems[o[0]].set("selected",!1),r._menuItems[o[0]].removeAttribute("aria-selected")),r.selectedIndexes=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0));break;case"oneOrMany":case"zeroOrMany":if(l){if(1===o.length&&"zeroOrMany"!==n)return;o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)}else o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0);r.selectedIndexes=o;break;case"oneOrManyExtended":{const n=t.ctrlKey||t.metaKey,l=t.shiftKey;if(!n&&!l||l&&e===r._lastSelectedItem){for(let e=0;e<o.length;e++)r._menuItems[o[e]].set("selected",!1),r._menuItems[o[e]].setAttribute("aria-selected",!1);o=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e}else if(n)e.selected&&o.length>1?(o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)):e.selected||(o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e);else if(l){for(let e=0;e<o.length;e++)r._menuItems[o[e]].set("selected",!1),r._menuItems[o[e]].setAttribute("aria-selected",!1);o=r._selectItemRange(r._lastSelectedItem,e)}r.selectedIndexes=o;break}case"checkBox":r.hasThreeStates?r._handleHierarchicalSelection(e,o):l?(o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)):(o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0)),r.selectedIndexes=o;break;case"radioButton":{if(e.selected)return;let t;for(let r=0;r<e.parentElement.children.length;r++){const n=e.parentElement.children[r];if(n.selected){t=n;break}}const n=o.indexOf(t.path);t.set("selected",!1),e.setAttribute("aria-selected",!1),e.set("selected",!0),e.setAttribute("aria-selected",!0),o.splice(n,1),o.push(e.path),r._sortPathCollection(o),r.selectedIndexes=o;break}}if(r._discardKeyboardHover(!0),r._hoverViaKeyboard(e,!1,void 0,!r._treeAnimationInProgress),r._updateState("selected"),JSON.stringify(a)!==JSON.stringify(r.selectedIndexes)){if(r.ownerElement&&!r.ownerElement.isRendered)return;r.$.fireEvent("change",{item:e,selectedIndexes:r.selectedIndexes,oldSelectedIndexes:a})}}_hoverViaKeyboard(e,t,r,n){if(!e)return;const l=this;e.setAttribute("focus",""),l._hoveredViaKeyboard=e,!1!==n&&l._ensureVisible(e),t&&l._handleSelection(e,r),l._hoverViaKeyboardCallback&&l._hoverViaKeyboardCallback(e)}_keydownHandler(e){const t=this,r=e.key;if(t._editedItem)return void("Enter"===r?t._endEditing():"Escape"===r&&t._endEditing(!0));if(t.getRootNode().activeElement!==t||-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","F2","Home","PageDown","PageUp"," "].indexOf(r)||t.disabled||t.displayLoadingIndicator)return;"Enter"!==r&&e.preventDefault();const n=Array.from(t.$.mainContainer.querySelectorAll("smart-tree-item, smart-tree-items-group")),l="one"===t.selectionMode||"oneOrManyExtended"===t.selectionMode&&!e.ctrlKey&&!e.metaKey,a=t.$.mainContainer.querySelector("[focus]");function o(r){for(let o=r;o<n.length;o++){const r=n[o];if(t._canItemBeHovered(r)){if(a){if(a===r)break;a.removeAttribute("focus")}t._hoverViaKeyboard(r,l,e);break}}}function s(r){for(let o=r;o>=0;o--){const r=n[o];if(t._canItemBeHovered(r)){if(a){if(a===r)break;a.removeAttribute("focus")}t._hoverViaKeyboard(r,l,e);break}}}function i(){a.level>1&&t._canItemBeSelected(a.parentItem)&&(a.removeAttribute("focus"),t._hoverViaKeyboard(a.parentItem,l,e))}let d;switch(r){case"ArrowDown":d=a?n.indexOf(a)+1:0,o(d);break;case"ArrowLeft":if(!a)return;if(a instanceof Smart.TreeItem)i();else{if(t._isContainerOpened(a.level+1,a.container))return void t._closeSubContainersTreeMode(a.level+1,a.container,!0,!0);i()}break;case"ArrowRight":if(!a||a instanceof Smart.TreeItem)return;if(t._isContainerOpened(a.level+1,a.container)){const r=t._getFirstEnabledChild(a.itemContainer);r&&(a.removeAttribute("focus"),t._hoverViaKeyboard(r,l,e))}else t._menuItemsGroupSelectionHandler(a,{target:a,type:"keydown"});break;case"ArrowUp":d=a?n.indexOf(a)-1:n.length-1,s(d);break;case"End":s(n.length-1);break;case"Enter":a&&a instanceof Smart.TreeItemsGroup&&t._menuItemsGroupSelectionHandler(a,{target:a,type:"keydown"});break;case"F2":t.editable&&t._startEditing(a);break;case"Home":o(0);break;case"PageDown":t._pageDownHandler(n,a,l,e);break;case"PageUp":t._pageUpHandler(n,a,l,e);break;case" ":a&&t._handleSelection(a,e)}}_mainContainerSwipeHandler(e){Smart.Tree.treeItemDragged&&e.stopPropagation()}_menuItemsGroupSelectionHandler(e,t,r){const n=this,l=n.toggleMode,a=!!t.originalEvent&&t.originalEvent.target.classList.contains("smart-tree-items-group-arrow"),o=e.container;if(n._waitAnimation&&n._treeAnimationInProgress)return;if("down"!==t.type||a||"dblclick"===l&&1!==n._dblclickObject.numberOfClicks||n._handleSelection(e,t),"down"===t.type&&!a&&("dblclick"===l&&2!==n._dblclickObject.numberOfClicks||"click"===l&&n._dblclickObject.numberOfClicks>1||"arrow"===l)||e.hiddenChildren)return;const s=o.level;let i=n.hasAnimation;if("keydown"===t.type&&n._discardKeyboardHover(),n._treeAnimationInProgress&&(o.removeEventListener("transitionend",n._transitionendHandlerExpand),o.removeEventListener("transitionend",n._transitionendHandlerCollapse)),n._isContainerOpened(s,o))n._closeSubContainersTreeMode(s,o,!0,!1!==r);else{if(n.$.fireEvent("expanding",{item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children}).defaultPrevented)return;if(n._handleSingleExpandMode(e),i&&("expand"!==t.type&&(n._ensureVisibleOnTransitionend=e),n._expandSection(o)),o.$.removeClass("smart-visibility-hidden"),"keydown"===t.type&&(e.setAttribute("focus",""),n._hoveredViaKeyboard=e),e.$.addClass("smart-tree-items-group-opened"),e.$.addClass("smart-tree-items-group-expanded"),n._addOpenedContainer(s,o),void 0===t.type&&n._hoverViaKeyboard(n._getFirstEnabledChild(e.itemContainer)),!1!==r){const t={item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children};n.toggleCallback?(t.type="expand",n.toggleCallback(t)):n.$.fireEvent("expand",t)}}i||(n._checkOverflow(),"expand"!==t.type&&n._ensureVisible(e))}_handleSingleExpandMode(e){const t=this;if("single"!==t.expandMode)return;const r=e.parentItem,n=t._state.expanded.map((e=>Object.values(t._menuItems).find((t=>t.id===e)))).filter((e=>e.parentItem===r));n.length>0&&n.forEach((e=>t.collapseItem(e)))}_mouseenterHandler(){const e=this;e.autoHideToggleElement&&e.$mainContainer.removeClass("hidden-arrows"),Smart.Tree.treeItemDragged&&e.allowDrop&&!e.disabled&&(Smart.Tree.hoveredTree=e)}_mouseleaveHandler(){const e=this;if(e.autoHideToggleElement&&e.$mainContainer.addClass("hidden-arrows"),Smart.Tree.treeItemDragged){Smart.Tree.hoveredTree&&(clearInterval(Smart.Tree.hoveredTree._dragInterval),delete Smart.Tree.hoveredTree);const e=Smart.Tree.hoveredItem;e&&(e.classList.remove("drop-target"),e.classList.remove("top"),e.classList.remove("bottom"),delete Smart.Tree.hoveredItem)}}_moveHandler(e){const t=this,r=t._dragDetails;if(!r)return;if(!r.FeedbackShown){if(!(Math.abs(r.StartPosition.left-e.pageX)>5||Math.abs(r.StartPosition.top-e.pageY)>5))return;if(t.$.fireEvent("dragStart",{item:r.Item,items:r.Items,data:r,container:t,previousContainer:t,originalEvent:r.OriginalEvent}).defaultPrevented)return delete t._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,void(t.$.scrollViewer._scrollView.disableSwipeScroll=!1);document.body.classList.add("smart-dragging"),r.Feedback=t._addDragFeedback(),r.FeedbackShown=!0}const n=t.dragOffset;let l,a,o;if(t.$.fireEvent("dragging",{item:r.Item,items:r.Items,data:r,originalEvent:e}),r.Feedback.style.left=e.pageX+n[0]+"px",r.Feedback.style.top=e.pageY+n[1]+"px",t._isMobile){const r=Smart.Tree.hoveredItem;r&&(r.classList.remove("drop-target"),r.classList.remove("top"),r.classList.remove("bottom"),delete Smart.Tree.hoveredItem);const n=t.getRootNode().elementFromPoint(e.clientX,e.clientY);Smart.Tree.hoveredTree&&(clearInterval(Smart.Tree.hoveredTree._dragInterval),delete Smart.Tree.hoveredTree),n&&(l=n.closest("smart-tree"),l&&l.allowDrop&&(Smart.Tree.hoveredTree=l,a=n.closest("smart-tree-item")||n.closest("smart-tree-items-group"),a?o=a:a=n))}if(l=Smart.Tree.hoveredTree,!l)return;const s=l.filterable?l.$.filterInput.offsetHeight+10:0;if(clearInterval(l._dragInterval),l._dragInterval=setInterval((function(){const r=l.getBoundingClientRect();l.$.scrollViewer.scrollHeight>0&&r.left<=e.clientX&&r.left+r.width>=e.clientX?e.clientY>=r.top+s&&e.clientY<=r.top+20+s?(l.$.scrollViewer.scrollTop-=t._autoScrollCoefficient,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility()):e.clientY>=r.top+r.height-20&&e.clientY<=r.top+r.height?(l.$.scrollViewer.scrollTop+=t._autoScrollCoefficient,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility()):clearInterval(l._dragInterval):clearInterval(l._dragInterval)}),1),t._isMobile||(a=e.originalEvent.target,a&&a.enableShadowDOM&&(a=e.originalEvent.composedPath()[0]),a&&a.closest&&(o=a.closest("smart-tree-item")||a.closest("smart-tree-items-group"))),o){if(Smart.Tree.hoveredItem&&o!==Smart.Tree.hoveredItem&&(Smart.Tree.hoveredItem.classList.remove("drop-target"),Smart.Tree.hoveredItem.classList.remove("top"),Smart.Tree.hoveredItem.classList.remove("bottom")),Smart.Tree.hoveredItem=o,r.Item.contains(o))return;const t=o.getBoundingClientRect();o instanceof Smart.TreeItem?e.clientY-t.top<=t.height/2?(o.classList.remove("bottom"),o.classList.add("top")):(o.classList.remove("top"),o.classList.add("bottom")):e.clientY-t.top<=10?(o.classList.remove("bottom"),o.classList.add("top")):!o.expanded&&t.bottom-e.clientY<=10?(o.classList.remove("top"),o.classList.add("bottom")):(o.classList.remove("top"),o.classList.remove("bottom")),o.classList.add("drop-target")}else if(Smart.Tree.hoveredItem&&(Smart.Tree.hoveredItem.classList.remove("drop-target"),Smart.Tree.hoveredItem.classList.remove("top"),Smart.Tree.hoveredItem.classList.remove("bottom")),a===l.$.scrollViewer.$.scrollViewerContainer)if(l._menuItems[0]){let e=l.$.mainContainer.lastElementChild,t=l.$.mainContainer.childElementCount-1;for(;e.hidden&&(t--,e=l.$.mainContainer.children[t],e););if(e){if(r.Item===e)return;Smart.Tree.hoveredItem=e,Smart.Tree.hoveredItem.classList.add("bottom")}else Smart.Tree.hoveredItem=l.$.container;Smart.Tree.hoveredItem.classList.add("drop-target")}else Smart.Tree.hoveredItem=l.$.container,Smart.Tree.hoveredItem.classList.add("drop-target");else delete Smart.Tree.hoveredItem}_moveSubItems(e,t,r){const n=this;for(let l=0;l<e.length;l++){const a=e[l];a.menu=t,a.set("level",a.parentItem.level+1),a.firstElementChild.style.paddingLeft="",a.firstElementChild.style.paddingRight="",n._setIndentation(a.firstElementChild,a.level,r),a.hidden=!1,a.$.removeClass("smart-hidden"),a.$.removeClass("filtered-child"),a.$.removeClass("last-filtered-child"),a instanceof Smart.TreeItemsGroup&&(a.$.removeClass("hidden-children"),a.container.level=a.level+1,n._moveSubItems(a.itemContainer.children,t,r),t!==n&&a.expanded&&(t._menuItemsGroupsToExpand.push(a),n._updateState("expanded",a.id,!1)))}}_moveTreeItem(e,t,r,n){const l=this,a=e.level;if(0===r){if(t.previousElementSibling===e)return;t.parentElement.insertBefore(e,t),e.set("level",t.level),e.parentItem=t.parentItem}else if(2===r){if(t.nextElementSibling===e)return;t.parentElement.insertBefore(e,t.nextElementSibling||null),e.set("level",t.level),e.parentItem=t.parentItem}else if(t===n[0].$.container)n[0].$.mainContainer.appendChild(e),e.set("level",1),e.parentItem=void 0;else{if(t.itemContainer.lastElementChild===e)return;t.itemContainer.appendChild(e),e.set("level",t.level+1),e.parentItem=t}const o=n[0].rightToLeft?"paddingRight":"paddingLeft";if(e.menu=n[0],e.parentItem=e.parentElement.menuItemsGroup,e.firstElementChild.style.paddingLeft="",e.firstElementChild.style.paddingRight="",l._setIndentation(e.firstElementChild,e.level,o),e.hidden=!1,e.$.removeClass("smart-hidden"),e.$.removeClass("filtered-child"),e.$.removeClass("last-filtered-child"),e instanceof Smart.TreeItemsGroup&&(e.$.removeClass("hidden-children"),e.container.level=e.level+1,l._moveSubItems(e.itemContainer.children,n[0],o),e.expanded)){const t=l._openedContainers[a+1].indexOf(e.container);-1!==t&&l._openedContainers[a+1].splice(t,1),n[0]._menuItemsGroupsToExpand.push(e),2===n.length&&l._updateState("expanded",e.id,!1)}for(let e=0;e<n.length;e++){const t=n[e],r=t.context,l=t.selectedIndexes.slice(0);t.context=t,t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,void 0,t.sorted&&!t.autoSort),t.selectedIndexes=[],t._applySelection(!0,l,!1),t._checkOverflow(),t.context=r}n[0]._expandItemsByDefault()}_overriddenMenuHandler(){}_pageDownHandler(e,t,r,n){const l=this,a=l.$.scrollViewer;function o(){for(let t=e.length-1;t>=0;t--){const r=e[t];if(l._canItemBeHovered(r)&&l._getOffsetTop(r)+r.firstElementChild.offsetHeight<=a.scrollTop+a.$.container.offsetHeight)return r}}if(!t)return;let s=o();s&&(t!==s?(t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):a.scrollTop+a.$.container.offsetHeight!==a.$.scrollViewerContentContainer.offsetHeight&&(l.$.scrollViewer.scrollTop+=a.$.container.offsetHeight,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility(),s=o(),t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)))}_pageUpHandler(e,t,r,n){const l=this,a=l.$.scrollViewer;function o(){for(let t=0;t<e.length;t++){const r=e[t];if(l._canItemBeHovered(r)&&l._getOffsetTop(r)>=a.scrollTop)return r}}if(!t)return;let s=o();s&&(t!==s?(t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):0!==a.scrollTop?(l.$.scrollViewer.scrollTop-=a.$.container.offsetHeight,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility(),s=o(),t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):l.filterable&&l.$.filterInput.focus())}_refreshItemPathsAndSelection(){const e=this,t=e.selectedIndexes.slice(0);e._menuItems={},e._refreshItemPaths(e.$.mainContainer,!0),e.selectedIndexes=[],e._applySelection(!0,t)}_refreshSorting(){const e=this;e._unsortItems(e.$.mainContainer),e._applyGrouping(e.$.mainContainer);const t=e._state.filter;t&&e._applyFilter(t),e._checkOverflow()}_scroll(e){const t=this;t.$.scrollViewer.scrollTop=t.$.scrollViewer.scrollTop+10*e,t._updateScrollButtonVisibility(),t.focus()}_scrollButtonFarClickHandler(){this.$.scrollButtonFar.disabled||this._scroll(1)}_scrollButtonNearClickHandler(){this.$.scrollButtonNear.disabled||this._scroll(-1)}_scrollViewerDownHandler(e){const t=this;if(e.target!==t.$.scrollViewer||t.disabled||t.displayLoadingIndicator||!t._isMobile&&1!==e.which)return;const r=e.originalEvent.target;if(r!==t.$.editInput)if(t._isMobile){const n=t.$.scrollViewer.scrollTop,l=t.getBoundingClientRect().top,a=setTimeout((function(){if(!t._dragDetails&&t.$.scrollViewer.scrollTop===n&&t.getBoundingClientRect().top===l){const n=t.context;t.context=t,t._continueSelection(r,e),t.context=n}}),250);t._downTimeoutInfo={target:r,event:e,scrollTop:n,top:l,timeout:a}}else t._continueSelection(r,e);else t._editInputDown=!0}_continueSelection(e,t){const r=this,n=e.closest("smart-tree-item")||e.closest("smart-tree-items-group");if(!(n&&n.parentElement&&r._canItemBeSelected(n,!0)))return;const l=e.closest(".smart-tree-items-group-arrow");let a;if(n instanceof Smart.TreeItem)a="_handleSelection";else{if(e===n.container||e===n.container.firstElementChild)return;a="_menuItemsGroupSelectionHandler"}if(clearTimeout(r._dblclickTimeout),n!==r._dblclickObject.target&&(r._dblclickObject.numberOfClicks=0),r._dblclickObject.target=n,r._dblclickObject.numberOfClicks++,r._dblclickTimeout=setTimeout((function(){r._dblclickObject.numberOfClicks=0}),300),2===r._dblclickObject.numberOfClicks){if(r.editable)return void r._startEditing(n);r._dblclickHandler(n,l,t),r._dblclickObject.numberOfClicks=0}n.selected&&(r._downItem=n),r[a](n,t),r._discardKeyboardHover(!0),r._hoverViaKeyboard(n,!1,void 0,!1),l||r._startDragging(n,t)}_scrollViewerTouchmoveHandler(e){this._dragDetails&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_scrollViewerWheelHandler(){const e=this;"scrollButtons"===e.scrollMode&&"hidden"!==e.overflow&&e._updateScrollButtonVisibility()}_selectItemRange(e,t){const r=this,n=Array.from(r.$.mainContainer.querySelectorAll("smart-tree-item, smart-tree-items-group")),l=n.indexOf(e),a=n.indexOf(t),o=[];for(let e=Math.min(l,a);e<=Math.max(l,a);e++){const t=n[e];r._canItemBeHovered(t)&&(o.push(t.path),t.set("selected",!0))}return o}_selectstartHandler(e){this._dragDetails&&e.preventDefault()}_setFocusable(){super._setFocusable();const e=this;e.disabled||e.unfocusable?e.$.filterInput.tabIndex=-1:e.$.filterInput.removeAttribute("tabindex")}_setIndentation(e,t,r){const n=this;let l=n._paddingSize;void 0===l&&(l=parseFloat(getComputedStyle(n).getPropertyValue("--smart-tree-indent")),isNaN(l)?l=20:l+=4,n._paddingSize=l),e.style[r]=t*l-l/2+"px"}_setThreeStateCheckbox(e,t,r){t===e.itemContainer.childElementCount&&t>0?(e.removeAttribute("indeterminate"),e.set("selected",!0),e.setAttribute("aria-selected",!0)):0===t&&0===r?(e.removeAttribute("indeterminate"),e.set("selected",!1),e.setAttribute("aria-selected",!1)):(e.setAttribute("indeterminate",""),e.set("selected",!1),e.setAttribute("aria-selected",!1))}_sortItems(e){const t=this;if(!t.sorted)return;let r;e instanceof Smart.TreeItemsGroup?r=e.container.firstElementChild:e===t.$.mainContainer&&(r=e);let n=Array.from(r.children);if(t.sort){const r=t.sort(n,e);Array.isArray(r)&&(n=r)}else"asc"===t.sortDirection?n.sort((function(e,t){return e.label.localeCompare(t.label)})):n.sort((function(e,t){return t.label.localeCompare(e.label)}));for(let e=n.length-1;e>=0;e--)r.insertBefore(n[e],r.firstElementChild)}_sortPathCollection(e){e.sort((function(e,t){const r=e.split("."),n=t.split("."),l=Math.max(r.length,n.length);for(let e=0;e<l;e++){const t=parseFloat(r[e]),l=parseFloat(n[e]);if(isNaN(t))return-1;if(isNaN(l))return 1;if(t<l)return-1;if(t>l)return 1}}))}_startDragging(e,t){const r=this,n=r.selectionMode;if(!r.allowDrag||r._editedItem||"none"===n)return;const l=[],a=[];let o;if(-1!==["one","zeroAndOne","zeroOrOne","checkBox","radioButton"].indexOf(n))o=!1,l.push(e),a.push(e);else{o=!0;for(let e=0;e<r.selectedIndexes.length;e++)l.push(r._menuItems[r.selectedIndexes[e]]),a.push(l[e]);for(let e=0;e<l.length;e++){const t=l[e];if(-1!==a.indexOf(t))for(let e=a.length-1;e>=0;e--){const r=a[e];if(r===t)break;t.contains(r)&&a.splice(e,1)}}}r._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:l,ValidItems:a,Item:e,FeedbackShown:!1,ValidateOnDrop:o,OriginalEvent:t,StartTime:new Date,Dragging:!0},Smart.Tree.treeItemDragged=!0,r.$.scrollViewer._scrollView.disableSwipeScroll=!0,r.allowDrop&&(Smart.Tree.hoveredTree=r,Smart.Tree.hoveredItem=e)}_startEditing(e){const t=this,r=t.$.editInput;let n,l;if(!t._canItemBeSelected(e,!0))return;const a=e.firstElementChild,o=a.firstElementChild;t.rightToLeft?(n=function(){return a.offsetWidth-o.offsetLeft-o.offsetWidth},l="paddingRight"):(n=function(){return o.offsetLeft+parseFloat(window.getComputedStyle(a).borderLeftWidth)},l="paddingLeft"),e instanceof Smart.TreeItemsGroup?(r.style[l]=n()+(t.showLines?parseFloat(window.getComputedStyle(o.firstElementChild).paddingLeft):0)-1+"px",r.style.height=a.offsetHeight+"px"):(r.style[l]=e.offsetWidth+parseInt(a.style[l],10)-a.offsetWidth+parseFloat(window.getComputedStyle(o.firstElementChild).paddingLeft)-2+"px",r.style.height=e.offsetHeight+"px"),r.style.top=t._getOffsetTop(e)+"px",t.$editInput.removeClass("smart-hidden"),r.value=e.label,t._editedItem=e,r.setAttribute("aria-label","Edit item "+e.label),setTimeout((function(){r.focus()}),0)}_styleChangedHandler(e){e.detail.styleProperties&&e.detail.styleProperties["font-size"]&&this._checkOverflow()}_updateScrollButtonVisibility(){const e=this,t=e.overflow;if("scrollbar"===e.scrollMode||"hidden"===t)return;let r=!0,n=!0;if(0===Math.round(e.$.scrollViewer.scrollTop)&&(r=!1),Math.round(e.$.scrollViewer.$.scrollViewerContainer.offsetHeight+e.$.scrollViewer.scrollTop)>=Math.round(e.$.scrollViewer.$.scrollViewerContentContainer.offsetHeight)&&(n=!1),"auto"===t){if(r&&n)return e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.$scrollViewer.removeClass("one-button-shown"),void e.$.scrollViewer.refresh();r?e.$scrollButtonNear.removeClass("smart-hidden"):e.$scrollButtonNear.addClass("smart-hidden"),n?e.$scrollButtonFar.removeClass("smart-hidden"):e.$scrollButtonFar.addClass("smart-hidden"),e.$scrollViewer.addClass("one-button-shown"),e.$.scrollViewer.refresh()}else"scroll"!==t||e.disabled||(e.$.scrollButtonNear.disabled=!r,e.$.scrollButtonFar.disabled=!n)}_updateState(e,t,r){const n=this;switch(e){case"expanded":{const e=n._state.expanded.indexOf(t);if(r&&-1===e)n._state.expanded.push(t);else{if(r||-1===e)return;n._state.expanded.splice(e,1)}break}case"filter":n._state.filter=void 0!==t?t:n.$.filterInput.value;break;case"selected":n._state.selected=[];for(let e=0;e<n.selectedIndexes.length;e++){const t=n._menuItems[n.selectedIndexes[e]];n._state.selected.push(t.id)}break;case"sorted":n._state.sorted=t}n.autoSaveState&&window.localStorage.setItem("smartTree"+n.id,JSON.stringify(n._state))}_verticalScrollbarHandler(){const e=this,t=e.$.verticalScrollBar,r=t.value;e.disabled||(t.max!==r?t.min!==r?(delete e._topReached,delete e._bottomReached):e._topReached||(e.$.fireEvent("scrollTopReached"),delete e._bottomReached,e._topReached=!0):e._bottomReached||(e.$.fireEvent("scrollBottomReached"),delete e._topReached,e._bottomReached=!0))}});
|
|
160
|
+
Smart("smart-tree-item",class extends Smart.MenuItem{static get properties(){return{selected:{value:!1,type:"boolean"}}}ready(){const e=this;Object.defineProperty(e,"hasStyleObserver",{get:function(){return!1}}),super.ready(),e.setAttribute("role","treeitem"),e.setAttribute("aria-label",e.label)}propertyChangedHandler(e,t,r){const n=this,l=n.menu;if(super.propertyChangedHandler(e,t,r),"level"===e)return void(n.level=t);if("disabled"===e||"separator"===e||!l)return;const a=l.context;switch(l.context=l,e){case"label":{const e=l.sorted&&l.autoSort;n.firstElementChild.firstElementChild.firstElementChild.innerHTML=r,e&&(l._unsortItems(l.$.mainContainer),l._applyGrouping(l.$.mainContainer)),l._state.filter&&l._applyFilter(l._state.filter),n.setAttribute("aria-label",r);break}case"selected":n.selected=t,r?l.select(n):l.unselect(n);break;case"shortcut":{let e=n.firstElementChild.children[1];e||(e=document.createElement("div"),e.className="smart-tree-item-shortcut",n.firstElementChild.appendChild(e)),e.innerHTML=r;break}case"value":l.sort&&l.sorted&&l.autoSort&&l._refreshSorting()}l.context=a}_setId(){}}),Smart("smart-tree-items-group",class extends Smart.MenuItemsGroup{static get properties(){return{selected:{value:!1,type:"boolean"}}}ready(){const e=this;Object.defineProperty(e,"hasStyleObserver",{get:function(){return!1}}),super.ready(),e.setAttribute("role","treeitem"),e.removeAttribute("aria-haspopup"),e.setAttribute("aria-label",e.label)}propertyChangedHandler(e,t,r){const n=this,l=n.menu;if(super.propertyChangedHandler(e,t,r),"level"===e)return void(n.level=t);if("disabled"===e||"separator"===e||!l)return;const a=l.context;switch(l.context=l,e){case"expanded":n.expanded=t,r?l.expandItem(n):l.collapseItem(n);break;case"label":{const e=l.sorted&&l.autoSort;n.firstElementChild.firstElementChild.firstElementChild.innerHTML=r,e&&(l._unsortItems(l.$.mainContainer),l._applyGrouping(l.$.mainContainer)),l._state.filter&&l._applyFilter(l._state.filter),n.setAttribute("aria-label",r);break}case"selected":n.selected=t,r?l.select(n):l.unselect(n);break;case"value":l.sort&&l.sorted&&l.autoSort&&l._refreshSorting()}l.context=a}_setId(){}}),Smart("smart-tree",class extends Smart.Menu{static get properties(){return{allowDrag:{value:!1,type:"boolean"},allowDrop:{value:!1,type:"boolean"},autoHideToggleElement:{value:!1,type:"boolean"},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},autoSort:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},dragFeedbackFormatFunction:{value:null,type:"function?"},dragOffset:{value:[10,10],type:"array"},editable:{value:!1,type:"boolean"},expandMode:{value:"multiple",allowedValues:["multiple","single"],type:"string"},filterable:{value:!1,type:"boolean"},filterOnEnter:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterMember:{value:"label",type:"string"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},hasThreeStates:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{value:{en:{noId:"smart-tree: Saving and loading the element's state are not available if the element has no id."}},type:"object",extend:!0},scrollMode:{value:"scrollbar",allowedValues:["scrollbar","scrollButtons"],type:"string"},selectedIndexes:{value:[],type:"array"},selectionDisplayMode:{value:"row",allowedValues:["row","label"],type:"string"},selectionMode:{value:"one",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectionTarget:{value:"all",allowedValues:["all","leaf"],type:"string"},showLines:{value:!1,type:"boolean"},showRootLines:{value:!1,type:"boolean"},sort:{value:null,type:"function?",reflectToAttribute:!1},sortDirection:{value:"asc",allowedValues:["asc","desc"],type:"string"},sorted:{value:!1,type:"boolean"},toggleElementPosition:{value:"near",allowedValues:["near","far"],type:"string"},toggleMode:{value:"dblclick",allowedValues:["click","dblclick","arrow"],type:"string"}}}static get listeners(){return{blur:"_blurHandler",focus:"_focusHandler",keydown:"_keydownHandler",mouseenter:"_mouseenterHandler",mouseleave:"_mouseleaveHandler",resize:"_checkOverflow",styleChanged:"_styleChangedHandler",transitionend:"_overriddenMenuHandler","container.click":"_overriddenMenuHandler","container.mouseout":"_overriddenMenuHandler","container.mouseover":"_overriddenMenuHandler","container.pointerover":"_pointeroverHandler","editInput.blur":"_editInputBlurHandler","filterInput.keydown":"_filterInputKeydownHandler","filterInput.keyup":"_filterInputKeyupHandler","mainContainer.click":"_overriddenMenuHandler","mainContainer.mouseleave":"_overriddenMenuHandler","mainContainer.mouseout":"_overriddenMenuHandler","mainContainer.mouseover":"_overriddenMenuHandler","mainContainer.swipeleft":"_mainContainerSwipeHandler","mainContainer.swiperight":"_mainContainerSwipeHandler","scrollButtonFar.click":"_scrollButtonFarClickHandler","scrollButtonNear.click":"_scrollButtonNearClickHandler","scrollViewer.down":"_scrollViewerDownHandler","scrollViewer.kineticScroll":"_scrollViewerWheelHandler","scrollViewer.touchmove":"_scrollViewerTouchmoveHandler","mainContainer.wheel":"_scrollViewerWheelHandler","document.move":"_moveHandler","document.selectstart":"_selectstartHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}static get styleUrls(){return["smart.scrollbar.css","smart.scrollviewer.css","smart.tree.css"]}template(){return'<div id="container" role="presentation">\n <div class="smart-tree-filter-input-container" role="presentation"><input id="filterInput" class="smart-filter-input" disabled="[[disabled]]" placeholder="[[filterInputPlaceholder]]" type="text" role="searchbox" aria-label="[[filterInputPlaceholder]]" /></div>\n <smart-repeat-button id="scrollButtonNear" class="smart-tree-scroll-button smart-spin-button smart-scroll-button-near smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll up">\n <div id="arrowNear" class="smart-arrow smart-arrow-up"></div>\n </smart-repeat-button>\n <smart-scroll-viewer id="scrollViewer" animation="[[animation]]" horizontal-scroll-bar-visibility="hidden" right-to-left="[[rightToLeft]]">\n <div id="mainContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-tree-main-container" role="presentation">\n <content></content>\n </div>\n <input type="text" id="editInput" class="smart-tree-edit-input smart-hidden" />\n </smart-scroll-viewer>\n <smart-repeat-button id="scrollButtonFar" class="smart-tree-scroll-button smart-spin-button smart-scroll-button-far smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll down">\n <div id="arrowFar" class="smart-arrow smart-arrow-down"></div>\n </smart-repeat-button>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" role="presentation">\n <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n </div>\n </div>'}detached(){const e=this,t=e._dragDetails;if(super.detached(),!t)return;const r=Smart.Tree.hoveredTree,n=Smart.Tree.hoveredItem;delete e._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,e.$.scrollViewer._scrollView.disableSwipeScroll=!1,t.FeedbackShown&&(n.classList.remove("drop-target","top","bottom"),document.body.classList.remove("smart-dragging"),t.Feedback.remove(),r&&clearInterval(r._dragInterval))}addAfter(e,t){void 0!==(t=this.getItem(t))&&this.addTo(e,t.parentItem,t,!0)}addBefore(e,t){void 0!==(t=this.getItem(t))&&this.addTo(e,t.parentItem,t)}addTo(e,t){const r=this;if(!(e instanceof Smart.TreeItem||e instanceof Smart.TreeItemsGroup))if("string"==typeof e){const t=document.createElement("smart-tree-item");t.label=e,e=t}else{if(!e||!e.label)return;{const t=document.createElement("smart-tree-item");t.label=e.label,e=t}}let n,l;if(e.isDirty=!1,void 0===t)n=1,l=t=r.$.mainContainer;else{if((t=r.getItem(t))instanceof Smart.TreeItemsGroup==0){const n=document.createElement("smart-tree-items-group");return n.innerHTML=t.innerHTML,n.appendChild(e),r.addBefore(n,t),void t.remove()}n=t.level+1,l=t.itemContainer}r._createItemHTMLStructure(e,n,t,l.childElementCount,0);const a=r.sorted&&r.autoSort,o=r._state.filter,s=r.selectedIndexes.slice(0);a&&r._unsortItems(r.$.mainContainer),e instanceof Smart.TreeItemsGroup&&(Array.from(e.querySelectorAll("smart-tree-item, smart-tree-items-group")).forEach((e=>e.isDirty=!1)),r._processHTML(e,n+1,!1));let i=arguments[2];i&&arguments[3]&&(i=i.nextElementSibling),i?(l.insertBefore(e,i),r._menuItems={},r._refreshItemPaths(r.$.mainContainer,!0,void 0,r.sorted&&!r.autoSort)):l.appendChild(e),a&&r._applyGrouping(r.$.mainContainer),o&&r._applyFilter(o),r._checkOverflow(),r._expandItemsByDefault(),r.selectedIndexes=[],r._applySelection(!0,s)}getSelectedValues(){const e=this,t=[];for(let r=0;r<e.selectedIndexes.length;r++){const n=e._menuItems[e.selectedIndexes[r]];n.hasAttribute("value")?t.push(n.getAttribute("value")):n.hasAttribute("label")&&t.push(n.getAttribute("label"))}return t}unselectValues(e){const t=this;e&&Object.keys(t._menuItems).forEach((r=>{const n=t._menuItems[r];let l=null;n.hasAttribute("value")?l=n.getAttribute("value"):n.hasAttribute("label")&&(l=n.getAttribute("label")),"string"==typeof e?e===l&&t.unselect(r):e.indexOf(l)>=0&&t.unselect(r)}))}setSelectedValues(e){const t=this;e&&Object.keys(t._menuItems).forEach((r=>{const n=t._menuItems[r];let l=null;n.hasAttribute("value")?l=n.getAttribute("value"):n.hasAttribute("label")&&(l=n.getAttribute("label")),"string"==typeof e?e===l&&t._canItemBeSelected(n)&&t._handleSelection(n,{type:"programmatic"}):e.indexOf(l)>=0&&t._canItemBeSelected(n)&&t._handleSelection(n,{type:"programmatic"})}))}clearSelection(){const e=this,t=e.selectedIndexes.slice(0);e.selectedIndexes=[],e._applySelection(!1,t)}collapseAll(e){const t=this,r=t.animation,n=!1===e&&t.hasAnimation;n&&(t.animation="none"),t._collapseAll(!0),n&&(t.animation=r)}ensureVisible(e){const t=this;if(void 0===(e=t.getItem(e))||e.hidden)return;let r=!1;e.level>1&&!t._isBranchExpanded(e)&&(super.expandItem(e.parentItem,void 0,!0),r=t.hasAnimation,r&&(t._ensureVisibleOnTransitionend=e)),r||t._ensureVisible(e)}expandAll(e){const t=this,r=t.animation,n=!1===e&&t.hasAnimation;let l=1,a=(t.enableShadowDOM?t.shadowRoot:t).querySelectorAll('smart-tree-items-group[level="1"]');for(n&&(t.animation="none");a.length>0;){for(let e=0;e<a.length;e++){const r=a[e];r.expanded||t._menuItemsGroupSelectionHandler(r,{target:r,type:"expand"})}l++,a=(t.enableShadowDOM?t.shadowRoot:t).querySelectorAll('smart-tree-items-group[level="'+l+'"]')}n&&(t.animation=r)}expandItem(e,t){const r=this;if(void 0===(e=r.getItem(e))||e instanceof Smart.TreeItemsGroup==0||e&&e.container&&r._isContainerOpened(e.container.level,e.container))return;void 0!==Smart.Menu.processTimer&&r._lazyInitItems();const n=!1===t&&r.hasAnimation,l=r.animation;n&&(r.animation="none"),r._discardKeyboardHover(),r._menuItemsGroupSelectionHandler(e,{target:e,type:"expand"},arguments[2]),n&&(r.animation=l)}filter(e){const t=this;t.filterable&&(t._applyFilter(e),t.$.filterInput.value=e)}getState(){return JSON.parse(JSON.stringify(this._state))}insert(e,t){const r=this;let n;if(e instanceof Smart.TreeItem||e instanceof Smart.TreeItemsGroup){if(r.contains(e))return;e.isDirty=!1,n=e}else{if("object"!=typeof e||e.constructor!==Object)return;n=function e(t){const n=t[r.itemsMember],l="smart-tree-items-group"===t.tagName||Array.isArray(n)?"smart-tree-items-group":"smart-tree-item",a=document.createElement(l);if(a.isDirty=!1,t.disabled&&(a.disabled=!0),t[r.displayMember]&&(a.label=t[r.displayMember]),t.selected&&(a.selected=!0),t.separator&&(a.separator=!0),t[r.valueMember]&&(a.value=t[r.valueMember]),"smart-tree-items-group"===l){if(t.expanded&&(a.expanded=!0),n)for(let t=0;t<n.length;t++)a.appendChild(e(n[t]))}else t.shortcut&&(a.shortcut=t.shortcut);return a}(e)}if(void 0===t)return void r.addTo(n);if("number"==typeof t)t=t.toString();else if(t instanceof Smart.TreeItem||t instanceof Smart.TreeItemsGroup){if(!r.contains(t))return;t=t.path}else if("string"!=typeof t)return;const l=t.split(".");let a,o;1===l.length?(o=r._menuItems[l[0]],o?r.addBefore(n,o):r.addTo(n)):(o=r._menuItems[t],a=r._menuItems[l.slice(0,l.length-1).join(".")],o?r.addBefore(n,o):a&&a instanceof Smart.TreeItemsGroup&&r.addTo(n,a))}loadState(e){const t=this,r=t.selectedIndexes.slice(0),n=[];if(!e){if(!t.id)return void t.warn(t.localize("noId"));if(!(e=window.localStorage.getItem("smartTree"+t.id)))return}"string"==typeof e&&(e=JSON.parse(e)),e.filter&&!t.filterable&&(e.filter="");let l=e.filter!==t._state.filter;e.sorted!==t.sorted?(t.sorted=e.sorted,t._updateState("sorted",t.sorted),e.sorted?t._applyGrouping(t.$.mainContainer):t._unsortItems(t.$.mainContainer),(e.filter||l)&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter)):l&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter),t._menuItemsGroupsToExpand=[];for(let r=0;r<e.expanded.length;r++){const n=t.getItem(e.expanded[r]);n&&t._menuItemsGroupsToExpand.push(n)}t._expandItemsByDefault(!0);for(let r=0;r<e.selected.length;r++){const l=t.getItem(e.selected[r]);l&&n.push(l.path)}t.selectedIndexes=n,t._applySelection(!1,r)}moveDown(e){const t=this,r=(e=t.getItem(e)).nextElementSibling;void 0!==e&&r&&!t.sorted&&(t._moveTreeItem(e,r,2,[t]),t.filterable&&t._state.filter&&t._applyFilter(t._state.filter))}moveUp(e){const t=this,r=(e=t.getItem(e)).previousElementSibling;void 0!==e&&r&&!t.sorted&&(t._moveTreeItem(e,r,0,[t]),t.filterable&&t._state.filter&&t._applyFilter(t._state.filter))}refresh(){this._checkOverflow()}removeItem(e){const t=this;if(void 0===(e=t.getItem(e)))return;if(e instanceof Smart.TreeItemsGroup){const r=e.container;t._isContainerOpened(r.level,r)&&t._closeSubContainersTreeMode(r.level,r)}const r=t.sorted&&t.autoSort;r&&t._unsortItems(t.$.mainContainer);const n=e.closest("smart-tree-items-group");e.parentElement.removeChild(e),t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,void 0,t.sorted&&!t.autoSort),r&&t._applyGrouping(t.$.mainContainer);const l=t._state.filter,a=t.selectedIndexes.slice(0);if(l&&t._applyFilter(l),t._checkOverflow(),t.selectedIndexes=[],t._applySelection(!0,a),delete t._treeAnimationInProgress,n&&!n.querySelector("smart-tree-item")){const e=document.createElement("smart-tree-item");return e.innerHTML=n.innerHTML,t.addBefore(e,n),void n.remove()}}saveState(){const e=this;return e.id?window.localStorage.setItem("smartTree"+e.id,JSON.stringify(e._state)):e.warn(e.localize("noId")),JSON.parse(JSON.stringify(e._state))}select(e){const t=this;void 0!==(e=t.getItem(e))&&!e.selected&&t._canItemBeSelected(e)&&t._handleSelection(e,{type:"programmatic"})}unselect(e){void 0!==(e=this.getItem(e))&&e.selected&&!e.templateApplied&&this._handleSelection(e,{type:"programmatic"})}updateItem(e,t){if(void 0===(e=this.getItem(e))||void 0===t)return;const r=e instanceof Smart.TreeItem;for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r){if(-1===["disabled","label","level","selected","separator","shortcut","value"].indexOf(n))continue}else if(-1===["disabled","expanded","label","level","selected","separator","value"].indexOf(n))continue;e[n]=t[n]}}propertyChangedHandler(e,t,r){const n=this;switch(super.propertyChangedHandler(e,t,r),e){case"allowDrag":case"allowDrop":case"autoLoadState":case"autoSort":case"editable":case"filterInputPlaceholder":case"loadingIndicatorPlaceholder":case"selectionDisplayMode":case"showLines":case"showRootLines":case"toggleElementPosition":case"toggleMode":break;case"autoHideToggleElement":r?n.$mainContainer.addClass("hidden-arrows"):n.$mainContainer.removeClass("hidden-arrows");break;case"autoSaveState":if(!r)return;if(!n.id)return n.warn(n.localize("noId")),void(n.autoSaveState=!1);window.localStorage.setItem("smartTree"+n.id,JSON.stringify(n._state));break;case"dataSource":{const e=n.selectedIndexes.slice(0);n.selectedIndexes=[],n._menuItems={},n._processDataSource(),n._checkOverflow(),n._expandItemsByDefault(),n._applySelection(!0,e);const t=n._state.filter;t&&n._applyFilter(t);break}case"disabled":n._setFocusable(),n.$.scrollButtonNear.disabled=r,n.$.scrollButtonFar.disabled=r,r||n._updateScrollButtonVisibility();break;case"displayLoadingIndicator":r?(n._discardKeyboardHover(!0),n.$loadingIndicatorContainer.removeClass("smart-hidden")):n.$loadingIndicatorContainer.addClass("smart-hidden");break;case"expandMode":if("single"===r){const e=n._state.expanded.map((e=>Object.values(n._menuItems).find((t=>t.id===e)))),t={};for(let r=0;r<e.length;r++){const l=e[r],a=l.parentItem;if(t[a])continue;t[a]=!0;const o=e.filter((e=>e!==l&&e.parentItem===a));o.length>0&&o.forEach((e=>n.collapseItem(e)))}}break;case"filterable":!1===r&&(n._applyFilter(""),n.$.filterInput.value=""),n._checkOverflow();break;case"filterMode":n.filterable&&n._state.filter&&n._applyFilter(n._state.filter);break;case"hasThreeStates":if("checkBox"!==n.selectionMode)return;if(r)n._applySelection(!1);else{const e=(n.enableShadowDOM?n.shadowRoot:n).querySelectorAll("[indeterminate]");for(let t=0;t<e.length;t++)e[t].removeAttribute("indeterminate")}break;case"innerHTML":n.$.mainContainer.innerHTML=r,n._lazyInitItems();break;case"loadingIndicatorPosition":"center"===r?n.$loadingIndicatorPlaceHolder.addClass("smart-hidden"):n.$loadingIndicatorPlaceHolder.removeClass("smart-hidden");break;case"overflow":if("scrollbar"===n.scrollMode)return"hidden"===r?n.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0):n.$.scrollViewer.$.verticalScrollBar.removeAttribute("aria-hidden"),void(n.$.scrollViewer.verticalScrollBarVisibility="scroll"===r?"visible":"auto");n.$.scrollViewer.scrollTop=0,"hidden"===r?(n.$scrollViewer.removeClass("scroll-buttons-shown"),n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden")):(n.$.scrollButtonNear.disabled=n.disabled,n.$.scrollButtonFar.disabled=n.disabled,"auto"===r?(n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden"),n._checkOverflow()):(n.$scrollViewer.addClass("scroll-buttons-shown"),n.$scrollViewer.removeClass("one-button-shown"),n.$scrollButtonNear.removeClass("smart-hidden"),n.$scrollButtonFar.removeClass("smart-hidden"),n._updateScrollButtonVisibility())),n.$.scrollViewer.refresh();break;case"rightToLeft":{let e,t;r?(e="paddingLeft",t="paddingRight"):(e="paddingRight",t="paddingLeft");for(let r in n._menuItems)if(Object.prototype.hasOwnProperty.call(n._menuItems,r)){const l=n._menuItems[r],a=l.firstElementChild;a.style[e]="",n._setIndentation(a,l.level,t)}break}case"scrollMode":if("hidden"===n.overflow)return;if(n.$.scrollViewer.scrollTop=0,"scrollButtons"===r)return"scroll"===n.overflow&&(n.$scrollViewer.addClass("scroll-buttons-shown"),n.$scrollButtonNear.removeClass("smart-hidden"),n.$scrollButtonFar.removeClass("smart-hidden")),n.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0),n.$.scrollViewer.verticalScrollBarVisibility="auto",void n._checkOverflow();n.$.scrollViewer.$.verticalScrollBar.removeAttribute("aria-hidden"),n.$scrollViewer.removeClass("scroll-buttons-shown"),n.$scrollViewer.removeClass("one-button-shown"),n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden"),"auto"===n.overflow?n.$.scrollViewer.verticalScrollBarVisibility="auto":n.$.scrollViewer.verticalScrollBarVisibility="visible";break;case"selectedIndexes":n._applySelection(!1,t);break;case"selectionMode":if(n.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(r)),void 0===n._menuItems[0])return;if("one"===t&&"none"!==r&&"checkBox"!==r&&"radioButton"!==r||-1!==t.indexOf("oneOrMany")&&-1!==r.indexOf("oneOrMany")||"none"===t&&(-1!==r.indexOf("zero")||"checkBox"===r)||"zeroOrMany"===r&&"checkBox"!==t||"radioButton"===t&&-1!==r.indexOf("Many")||!n.hasThreeStates&&("checkBox"===r||"checkBox"===t&&"zeroOrMany"===r))return n._lastSelectedItem="one"===r||"oneOrManyExtended"===r?n._menuItems[n.selectedIndexes[n.selectedIndexes.length-1]]:void 0,void n._applyAriaSelected();if(n.hasThreeStates&&"checkBox"===t){const e=(n.enableShadowDOM?n.shadowRoot:n).querySelectorAll("[indeterminate]");for(let t=0;t<e.length;t++)e[t].removeAttribute("indeterminate")}n._applySelection(!1);break;case"sort":if(!n.sorted)return;n._refreshSorting();break;case"sortDirection":n.sorted&&!n.sort&&(n._unsortItems(n.$.mainContainer),n._applyGrouping(n.$.mainContainer));break;case"sorted":{if(!r&&!n.autoSort)return n._refreshItemPathsAndSelection(),void n._updateState("sorted",!1);r?n._applyGrouping(n.$.mainContainer):n._unsortItems(n.$.mainContainer);const e=n._state.filter;e&&n._applyFilter(e),n._updateState("sorted",r),n._checkOverflow();break}case"unfocusable":n._setFocusable()}}_addDragFeedback(){const e=this,t=document.createElement("div");return t.className="smart-tree-item-feedback",t.setAttribute("parent-tree-id",e.id),e.theme&&t.setAttribute("theme",e.theme),e.dragFeedbackFormatFunction?t.innerHTML=e.dragFeedbackFormatFunction(e._dragDetails.Items):1===e._dragDetails.Items.length?t.innerHTML=e._dragDetails.Item.label:(t.classList.add("multiple"),t.innerHTML=""),document.body.appendChild(t),t}_applyFilter(e){const t=this;function r(e,t){e?(t.hidden&&t.$.removeClass("smart-hidden"),t.hidden=!1):(t.hidden||t.$.addClass("smart-hidden"),t.hidden=!0)}if(""===e&&!t.hasAttribute("filter-applied"))return;const n=Array.from(t.$.mainContainer.getElementsByClassName("last-filtered-child"));for(let e=0;e<n.length;e++)n[e].$.removeClass("last-filtered-child");!function n(l,a){let o,s=!1,i=0;a=Array.from(a);for(let l=0;l<a.length;l++){const d=a[l];d instanceof Smart.TreeItem?r(t._findItem(d,e),d):n(d,d.itemContainer.children),d.hidden||(i++,o=d),s=s||!d.hidden}if(l!==t.$.mainContainer){const n=t._findItem(l,e);r(s||n,l),s&&null===n?l.$.addClass("filtered-child"):l.$.removeClass("filtered-child"),!s&&a.length>0?(l.hiddenChildren=!0,l.$.addClass("hidden-children"),t.collapseItem(l,void 0,!1)):(l.hiddenChildren=!1,l.$.removeClass("hidden-children"))}""!==e&&i>0&&o.$.addClass("last-filtered-child")}(t.$.mainContainer,t.$.mainContainer.children),""!==e?t.setAttribute("filter-applied",""):t.removeAttribute("filter-applied"),t._updateState("filter",e),t._checkOverflow()}_applyHierarchicalSelection(e,t){const r=this,n=e!==r.$.mainContainer,l=n?e.itemContainer.children:e.children;let a=0,o=0;for(let s=0;s<l.length;s++){const i=l[s];e.selected&&i.set("selected",!0),i instanceof Smart.TreeItemsGroup?r._applyHierarchicalSelection(i,t):i.selected&&t.push(i.path),n&&(i.selected?a++:i.hasAttribute("indeterminate")&&o++)}n&&(r._setThreeStateCheckbox(e,a,o),e.selected&&t.push(e.path))}_applyRadioButtonSelection(e,t,r){const n=this,l=e!==n.$.mainContainer?e.itemContainer.children:e.children,a=[];let o;for(let e=0;e<l.length;e++){const o=l[e];o instanceof Smart.TreeItemsGroup&&n._applyRadioButtonSelection(o,t,r),o.set("selected",!1),-1!==t.indexOf(o.path)&&a.push(o)}o=0===a.length?l[0]:a[a.length-1],o.set("selected",!0),r.push(o.path)}_applySelection(e,t){const r=this;let n=r.selectedIndexes.slice(0);function l(e){const t=Object.values(r._menuItems).filter((t=>t.level===e));if(0!==t.length){for(let e=0;e<t.length;e++)if(r._canItemBeSelected(t[e]))return t[e].path;return l(e+1)}}if(void 0===t&&(t=n.slice(0)),void 0===r._menuItems[0])return r.selectedIndexes=[],r._lastSelectedItem=void 0,void(r.isRendered&&JSON.stringify(t)!==JSON.stringify([])&&r.$.fireEvent("change",{selectedIndexes:r.selectedIndexes,oldSelectedIndexes:t}));const a=r.selectionMode,o=Array.from((r.shadowRoot||r).querySelectorAll("smart-tree-item[selected], smart-tree-items-group[selected]"));for(let e=n.length-1;e>=0;e--){const t=r._menuItems[n[e]];void 0!==t&&r._canItemBeSelected(t)||n.splice(e,1)}if(e)for(let e=0;e<o.length;e++)r._canItemBeSelected(o[e])?-1===n.indexOf(o[e].path)&&n.push(o[e].path):o[e].set("selected",!1);else{for(let e=0;e<o.length;e++)o[e].set("selected",!1);o.length=0}switch(r._sortPathCollection(n),a){case"none":n.length=0;for(let e=0;e<o.length;e++)o[e].set("selected",!1);break;case"one":case"zeroAndOne":case"zeroOrOne":"one"===a&&0===n.length&&n.push(l(1));for(let e=0;e<n.length;e++){const t=r._menuItems[n[e]];if(e===n.length-1){t.set("selected",!0),n=[n[e]];break}-1!==o.indexOf(t)&&t.set("selected",!1)}break;case"oneOrMany":case"oneOrManyExtended":0===n.length&&n.push(l(1));for(let e=0;e<n.length;e++)r._menuItems[n[e]].set("selected",!0);break;case"zeroOrMany":case"checkBox":for(let e=0;e<n.length;e++)r._menuItems[n[e]].set("selected",!0);if("checkBox"===a&&r.hasThreeStates){const e=[];r._applyHierarchicalSelection(r.$.mainContainer,e),r._sortPathCollection(e),n=e}break;case"radioButton":{const e=[];r._applyRadioButtonSelection(r.$.mainContainer,n,e),r._sortPathCollection(e),n=e;break}}r.selectedIndexes=n,r._updateState("selected"),r._lastSelectedItem="one"===a||"oneOrManyExtended"===a?r._menuItems[n[n.length-1]]:void 0,r.isRendered&&!1!==arguments[2]&&JSON.stringify(t)!==JSON.stringify(n)&&r.$.fireEvent("change",{selectedIndexes:r.selectedIndexes,oldSelectedIndexes:t}),r._applyAriaSelected()}_applyAriaSelected(){const e=this,t=e.selectionMode;for(let r in e._menuItems){const n=e._menuItems[r];n.selected?n.setAttribute("aria-selected",!0):e._canItemBeSelected(n)&&-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(t)?n.setAttribute("aria-selected",!1):n.removeAttribute("aria-selected")}}_autoLoadState(e){const t=this,r=[];for(let e=0;e<t._menuItemsGroupsToExpand.length;e++)t._menuItemsGroupsToExpand[e].set("expanded",!1);t._menuItemsGroupsToExpand=[];for(let r=0;r<e.expanded.length;r++){const n=t.getItem(e.expanded[r]);n&&t._menuItemsGroupsToExpand.push(n)}t.filterable&&e.filter&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter);for(let n=0;n<e.selected.length;n++){const l=t.getItem(e.selected[n]);l&&r.push(l.path)}t.selectedIndexes=r}_blurHandler(){this._discardKeyboardHover(!0)}_canItemBeHovered(e){const t=e.level;return!1===e.disabled&&!0!==e.templateApplied&&!0!==e.hidden&&(1===t||t>1&&this._isContainerOpened(t,e.parentElement.container)&&e.getBoundingClientRect().height>0)}_canItemBeSelected(e,t){return!(!0!==t&&"leaf"===this.selectionTarget&&e instanceof Smart.TreeItemsGroup)&&!1===e.disabled&&!0!==e.templateApplied}_checkOverflow(){const e=this,t=e.$.scrollViewer,r=e.overflow;if("scrollbar"===e.scrollMode||"hidden"===r)return void t.refresh();const n=t.scrollTop;"auto"===r&&(t.$.removeClass("scroll-buttons-shown"),t.$.removeClass("one-button-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"));const l=Math.round(t.$.scrollViewerContentContainer.offsetHeight)>Math.round(t.$.scrollViewerContainer.offsetHeight),a=Math.round(t.scrollTop)>0,o=Math.round(t.$.scrollViewerContainer.offsetHeight+t.scrollTop)<Math.round(t.$.scrollViewerContentContainer.offsetHeight);l?"auto"===r?(t.$.addClass("scroll-buttons-shown"),a&&e.$scrollButtonNear.removeClass("smart-hidden"),o&&e.$scrollButtonFar.removeClass("smart-hidden"),!1===(a&&o)&&t.$.addClass("one-button-shown"),e.disabled||(e.$.scrollButtonNear.disabled=!1,e.$.scrollButtonFar.disabled=!1),t.scrollTop=n):(e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.disabled?(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0):(e.$.scrollButtonNear.disabled=!a,e.$.scrollButtonFar.disabled=!o)):"scroll"===r&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),t.refresh()}_createElement(){const e=this,t=window.getComputedStyle(e.$.scrollViewer);if(e.setAttribute("role","tree"),e.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(e.selectionMode)),e.setAttribute("aria-orientation","vertical"),e.$.scrollViewer.onVerticalChange=e._verticalScrollbarHandler,e.isRendered||Object.defineProperty(e,"dataSource",{get:function(){return e.context===e?e.properties.dataSource.value:e._getDataSource()},set(t){e.updateProperty(e,e._properties.dataSource,t)}}),e.id||!e.autoLoadState&&!e.autoSaveState||(e.warn(e.localize("noId")),e.autoLoadState=!1,e.autoSaveState=!1),e.mode="tree",e._element="tree",e._isMobile=Smart.Utilities.Core.isMobile,e._edgeMacFF=!1,e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._scrollViewerPadding=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)||0,e._state={expanded:[],filter:"",selected:[]},e._dblclickObject={numberOfClicks:0},e.autoHideToggleElement&&e.$mainContainer.addClass("hidden-arrows"),e.disabled&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),"scrollbar"===e.scrollMode&&"scroll"===e.overflow&&(e.$.scrollViewer.verticalScrollBarVisibility="visible"),null===e.dataSource&&e.$.mainContainer.firstElementChild instanceof HTMLUListElement&&e._processUList(),e.isRendered)return e._menuItems={},void(null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource());const r=(e.shadowRoot||e).querySelectorAll("smart-tree-item, smart-tree-items-group"),n=function(){let t;e.autoLoadState&&(t=window.localStorage.getItem("smartTree"+e.id),t&&(t=JSON.parse(t),e.sorted=t.sorted)),e._setFocusable(),e._menuItems={},null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource(),"scrollButtons"!==e.scrollMode&&"hidden"!==e.overflow||e.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0),"scrollButtons"===e.scrollMode&&"scroll"===e.overflow&&(e.$scrollViewer.addClass("scroll-buttons-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility()),e._checkOverflow(),t&&e._autoLoadState(t),e._expandItemsByDefault(),e._applySelection(!0),e._updateState("sorted",e.sorted),e.displayLoadingIndicator&&e.$loadingIndicatorContainer.removeClass("smart-hidden"),"center"!==e.loadingIndicatorPosition&&e.$loadingIndicatorPlaceHolder.removeClass("smart-hidden"),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted())};0===r.length||e.enableShadowDOM||e.isInShadowDOM?n():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(r,n))}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.$.mainContainer&&t.$.mainContainer.appendChild(e)}_dblclickHandler(e,t,r){"dblclick"!==this.toggleMode||e instanceof Smart.TreeItem||t||this._menuItemsGroupSelectionHandler(e,r)}_discardKeyboardHover(e,t){const r=this;!t&&r._hoveredViaKeyboard&&(!e&&r._hoveredViaKeyboard instanceof Smart.MenuItemsGroup&&r._isContainerOpened(r._hoveredViaKeyboard.level+1,r._hoveredViaKeyboard.container)||(r._hoveredViaKeyboard.removeAttribute("focus"),r._hoveredViaKeyboard=void 0))}_documentUpHandler(e){if("pointercancel"===e.originalEvent.type)return;const t=this,r=t._downTimeoutInfo,n=t._dragDetails;!r||n&&n.FeedbackShown||(clearTimeout(r.timeout),t.$.scrollViewer.scrollTop!==r.scrollTop&&t.getBoundingClientRect().top===r.top||t._continueSelection(r.target,r.event)),delete t._downTimeoutInfo;const l=t._downItem,a=t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(delete t._downItem,t._editedItem&&!t._editInputDown&&(!t._isMobile&&a!==t.$.editInput||t._isMobile&&t.getRootNode().elementFromPoint(e.clientX,e.clientY)!==t.$.editInput))return void t._endEditing();if(delete t._editInputDown,l){const r=a.closest("smart-tree-item")||a.closest("smart-tree-items-group");!r||!r.selected||r!==l||t._dragDetails&&t._dragDetails.FeedbackShown||r instanceof Smart.TreeItemsGroup&&(a.closest(".smart-tree-items-group-arrow")||a===r.container||a===r.container.firstElementChild)||t._handleSelection(r,e)}if(!n)return;const o=Smart.Tree.hoveredTree,s=Smart.Tree.hoveredItem;if(delete t._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,t.$.scrollViewer._scrollView.disableSwipeScroll=!1,!n.FeedbackShown)return;const i=o||t.getRootNode().elementFromPoint(e.clientX,e.clientY);let d;document.body.classList.remove("smart-dragging"),document.body.removeChild(n.Feedback),o&&clearInterval(o._dragInterval);const c=n.Item,m=n.Items,u=n.ValidItems;if(!i)return;if(!s||c.contains(s))return void t.$.fireEvent("dragEnd",{item:c,items:m,target:i,data:n,previousContainer:t,container:o||i,originalEvent:e});if(!o||!o.allowDrop||o.disabled)return;const p=[o];let h;if(s.classList.remove("drop-target"),s.classList.contains("top")?(s.classList.remove("top"),h="top",d=0):s.classList.contains("bottom")?(s.classList.remove("bottom"),h="bottom",d=2):(h="inside",d=1),n.DropDetails={item:s,position:h},o!==t)p.push(t);else if(n.ValidateOnDrop)for(let e=0;e<u.length;e++)if(u[e].contains(s))return;if(!t.$.fireEvent("dragEnd",{item:c,items:m,target:s,data:n,previousContainer:t,container:o,originalEvent:e}).defaultPrevented){o.sorted&&o.autoSort&&o._unsortItems(o.$.mainContainer);for(let e=0;e<u.length;e++)t._moveTreeItem(u[e],s,d,p);o.sorted&&o.autoSort&&o._applyGrouping(o.$.mainContainer),o!==t&&o._state.filter&&o._applyFilter(o._state.filter)}}_editInputBlurHandler(){this._endEditing()}_endEditing(e){const t=this,r=t._editedItem;if(!r)return;if(delete t._editedItem,t.$editInput.addClass("smart-hidden"),t.focus(),e)return;const n=t.$.editInput.value,l=t.sorted&&t.autoSort,a=t._state.filter;n!==r.label&&(r.set("label",n),r.setAttribute("aria-label",n),r.firstElementChild.firstElementChild.firstElementChild.innerHTML=n,l&&(t._unsortItems(t.$.mainContainer),t._applyGrouping(t.$.mainContainer)),a&&t._applyFilter(a))}_ensureVisible(e){const t=this;t._ensureVisibleTreeMode(e,e.getBoundingClientRect(),t.$.scrollViewer,t.$.scrollViewer.getBoundingClientRect(),t._scrollViewerPadding),t._ensureVisibleCallback&&t._ensureVisibleCallback(e)}_pointeroverHandler(e){const t=(this.isInShadowDOM?e.composedPath()[0]:e.target).closest(".smart-tree-item-label-element>span");if(!t)return;const r=this.$.container.querySelector(".tooltip");r&&(r.classList.remove("tooltip"),r.removeAttribute("title")),t.scrollWidth>t.offsetWidth&&(t.classList.add("tooltip"),t.title=t.innerText)}getFilter(){return this.$.filterInput.value}_filterInputKeyupHandler(e){const t=this;if(t._filterTimer&&clearTimeout(t._filterTimer),t.filterOnEnter){if("Enter"!==e.key)return;{const e=t.context;t.context=t,t._applyFilter(t.$.filterInput.value,t._view),t.$.fireEvent("filterChange",{value:t.$.filterInput.value}),t._checkOverflow(),t.context=e}}t._filterTimer=setTimeout((function(){const e=t.context;t.context=t,t._applyFilter(t.$.filterInput.value,t._view),t.$.fireEvent("filterChange",{value:t.$.filterInput.value}),t._checkOverflow(),t.context=e}),300)}_filterInputKeydownHandler(e){if("PageDown"!==e.key)return void("PageUp"===e.key&&(e.preventDefault(),e.stopPropagation()));const t=this;let r;if(e.preventDefault(),e.stopPropagation(),t.selectedIndexes.length>0){const e=t.selectedIndexes.slice(0);r=t._lastSelectedItem||t._menuItems[t.selectedIndexes[t.selectedIndexes.length-1]],"checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&(t.selectedIndexes=[r.path],t._applySelection(!1,e)),t.focus()}else r=t._getFirstEnabledChild(t.$.mainContainer),t.focus(),r&&t._hoverViaKeyboard(r);t._ensureVisible(r)}_focusHandler(){const e=this;e.selectedIndexes.length>0&&!e._hoveredViaKeyboard&&(e._lastSelectedItem?e._hoverViaKeyboard(e._lastSelectedItem,!1,void 0,!1):e._hoverViaKeyboard(e._menuItems[e.selectedIndexes[e.selectedIndexes.length-1]],!1,void 0,!1))}_getDataSource(){const e=[];return function e(t,r){for(let n=0;n<t.length;n++){const l=t[n],a={label:l.label};l.disabled&&(a.disabled=!0),l.selected&&(a.selected=!0),l.separator&&(a.separator=!0),null!==l.value&&(a.value=l.value),l instanceof Smart.TreeItem?l.shortcut&&(a.shortcut=l.shortcut):(l.expanded&&(a.expanded=!0),a.items=[],l.itemContainer&&l.itemContainer.children&&e(l.itemContainer.children,a.items)),r.push(a)}}(this.$.mainContainer.children,e),e}_handleHierarchicalSelection(e,t){const r=this;let n=e;for(e.selected?(e.set("selected",!1),e.setAttribute("aria-selected",!1)):(e.set("selected",!0),e.setAttribute("aria-selected",!0),e.removeAttribute("indeterminate"));n.parentItem;){const e=n.parentItem,t=e.itemContainer.children;let l=0,a=0;for(let e=0;e<t.length;e++)t[e].selected?l++:t[e].hasAttribute("indeterminate")&&a++;r._setThreeStateCheckbox(e,l,a),n=e}e instanceof Smart.TreeItemsGroup&&function e(t,r){const n=t.itemContainer.children;for(let t=0;t<n.length;t++){const l=n[t];l.set("selected",r),l.setAttribute("aria-selected",r),l.removeAttribute("indeterminate"),l instanceof Smart.TreeItemsGroup&&e(l,r)}}(e,e.selected),t.length=0;const l=Array.from((r.enableShadowDOM?r.shadowRoot:r).querySelectorAll("[selected]"));for(let e=0;e<l.length;e++)t.push(l[e].path);r._sortPathCollection(t)}_handleSelection(e,t){const r=this,n=r.selectionMode;if("none"===n||"programmatic"!==t.type&&!r._canItemBeSelected(e))return;const l=e.selected;if(l&&"down"===t.type)return;const a=r.selectedIndexes.slice(0);let o=a.slice(0);switch(n){case"one":case"zeroAndOne":if(l)return;r._menuItems[o[0]]&&(r._menuItems[o[0]].set("selected",!1),r._menuItems[o[0]].removeAttribute("aria-selected")),r.selectedIndexes=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e;break;case"zeroOrOne":l?(r.selectedIndexes=[],e.set("selected",!1),e.removeAttribute("aria-selected")):(void 0!==o[0]&&(r._menuItems[o[0]].set("selected",!1),r._menuItems[o[0]].removeAttribute("aria-selected")),r.selectedIndexes=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0));break;case"oneOrMany":case"zeroOrMany":if(l){if(1===o.length&&"zeroOrMany"!==n)return;o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)}else o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0);r.selectedIndexes=o;break;case"oneOrManyExtended":{const n=t.ctrlKey||t.metaKey,l=t.shiftKey;if(!n&&!l||l&&e===r._lastSelectedItem){for(let e=0;e<o.length;e++)r._menuItems[o[e]].set("selected",!1),r._menuItems[o[e]].setAttribute("aria-selected",!1);o=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e}else if(n)e.selected&&o.length>1?(o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)):e.selected||(o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e);else if(l){for(let e=0;e<o.length;e++)r._menuItems[o[e]].set("selected",!1),r._menuItems[o[e]].setAttribute("aria-selected",!1);o=r._selectItemRange(r._lastSelectedItem,e)}r.selectedIndexes=o;break}case"checkBox":r.hasThreeStates?r._handleHierarchicalSelection(e,o):l?(o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)):(o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0)),r.selectedIndexes=o;break;case"radioButton":{if(e.selected)return;let t;for(let r=0;r<e.parentElement.children.length;r++){const n=e.parentElement.children[r];if(n.selected){t=n;break}}const n=o.indexOf(t.path);t.set("selected",!1),e.setAttribute("aria-selected",!1),e.set("selected",!0),e.setAttribute("aria-selected",!0),o.splice(n,1),o.push(e.path),r._sortPathCollection(o),r.selectedIndexes=o;break}}if(r._discardKeyboardHover(!0),r._hoverViaKeyboard(e,!1,void 0,!r._treeAnimationInProgress),r._updateState("selected"),JSON.stringify(a)!==JSON.stringify(r.selectedIndexes)){if(r.ownerElement&&!r.ownerElement.isRendered)return;r.$.fireEvent("change",{item:e,selectedIndexes:r.selectedIndexes,oldSelectedIndexes:a})}}_hoverViaKeyboard(e,t,r,n){if(!e)return;const l=this;e.setAttribute("focus",""),l._hoveredViaKeyboard=e,!1!==n&&l._ensureVisible(e),t&&l._handleSelection(e,r),l._hoverViaKeyboardCallback&&l._hoverViaKeyboardCallback(e)}_keydownHandler(e){const t=this,r=e.key;if(t._editedItem)return void("Enter"===r?t._endEditing():"Escape"===r&&t._endEditing(!0));if(t.getRootNode().activeElement!==t||-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","F2","Home","PageDown","PageUp"," "].indexOf(r)||t.disabled||t.displayLoadingIndicator)return;"Enter"!==r&&e.preventDefault();const n=Array.from(t.$.mainContainer.querySelectorAll("smart-tree-item, smart-tree-items-group")),l="one"===t.selectionMode||"oneOrManyExtended"===t.selectionMode&&!e.ctrlKey&&!e.metaKey,a=t.$.mainContainer.querySelector("[focus]");function o(r){for(let o=r;o<n.length;o++){const r=n[o];if(t._canItemBeHovered(r)){if(a){if(a===r)break;a.removeAttribute("focus")}t._hoverViaKeyboard(r,l,e);break}}}function s(r){for(let o=r;o>=0;o--){const r=n[o];if(t._canItemBeHovered(r)){if(a){if(a===r)break;a.removeAttribute("focus")}t._hoverViaKeyboard(r,l,e);break}}}function i(){a.level>1&&t._canItemBeSelected(a.parentItem)&&(a.removeAttribute("focus"),t._hoverViaKeyboard(a.parentItem,l,e))}let d;switch(r){case"ArrowDown":d=a?n.indexOf(a)+1:0,o(d);break;case"ArrowLeft":if(!a)return;if(a instanceof Smart.TreeItem)i();else{if(t._isContainerOpened(a.level+1,a.container))return void t._closeSubContainersTreeMode(a.level+1,a.container,!0,!0);i()}break;case"ArrowRight":if(!a||a instanceof Smart.TreeItem)return;if(t._isContainerOpened(a.level+1,a.container)){const r=t._getFirstEnabledChild(a.itemContainer);r&&(a.removeAttribute("focus"),t._hoverViaKeyboard(r,l,e))}else t._menuItemsGroupSelectionHandler(a,{target:a,type:"keydown"});break;case"ArrowUp":d=a?n.indexOf(a)-1:n.length-1,s(d);break;case"End":s(n.length-1);break;case"Enter":a&&a instanceof Smart.TreeItemsGroup&&t._menuItemsGroupSelectionHandler(a,{target:a,type:"keydown"});break;case"F2":t.editable&&t._startEditing(a);break;case"Home":o(0);break;case"PageDown":t._pageDownHandler(n,a,l,e);break;case"PageUp":t._pageUpHandler(n,a,l,e);break;case" ":a&&t._handleSelection(a,e)}}_mainContainerSwipeHandler(e){Smart.Tree.treeItemDragged&&e.stopPropagation()}_menuItemsGroupSelectionHandler(e,t,r){const n=this,l=n.toggleMode,a=!!t.originalEvent&&t.originalEvent.target.classList.contains("smart-tree-items-group-arrow"),o=e.container;if(n._waitAnimation&&n._treeAnimationInProgress)return;if("down"!==t.type||a||"dblclick"===l&&1!==n._dblclickObject.numberOfClicks||n._handleSelection(e,t),"down"===t.type&&!a&&("dblclick"===l&&2!==n._dblclickObject.numberOfClicks||"click"===l&&n._dblclickObject.numberOfClicks>1||"arrow"===l)||e.hiddenChildren)return;const s=o.level;let i=n.hasAnimation;if("keydown"===t.type&&n._discardKeyboardHover(),n._treeAnimationInProgress&&(o.removeEventListener("transitionend",n._transitionendHandlerExpand),o.removeEventListener("transitionend",n._transitionendHandlerCollapse)),n._isContainerOpened(s,o))n._closeSubContainersTreeMode(s,o,!0,!1!==r);else{if(n.$.fireEvent("expanding",{item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children}).defaultPrevented)return;if(n._handleSingleExpandMode(e),i&&("expand"!==t.type&&(n._ensureVisibleOnTransitionend=e),n._expandSection(o)),o.$.removeClass("smart-visibility-hidden"),"keydown"===t.type&&(e.setAttribute("focus",""),n._hoveredViaKeyboard=e),e.$.addClass("smart-tree-items-group-opened"),e.$.addClass("smart-tree-items-group-expanded"),n._addOpenedContainer(s,o),void 0===t.type&&n._hoverViaKeyboard(n._getFirstEnabledChild(e.itemContainer)),!1!==r){const t={item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children};n.toggleCallback?(t.type="expand",n.toggleCallback(t)):n.$.fireEvent("expand",t)}}i||(n._checkOverflow(),"expand"!==t.type&&n._ensureVisible(e))}_handleSingleExpandMode(e){const t=this;if("single"!==t.expandMode)return;const r=e.parentItem,n=t._state.expanded.map((e=>Object.values(t._menuItems).find((t=>t.id===e)))).filter((e=>e.parentItem===r));n.length>0&&n.forEach((e=>t.collapseItem(e)))}_mouseenterHandler(){const e=this;e.autoHideToggleElement&&e.$mainContainer.removeClass("hidden-arrows"),Smart.Tree.treeItemDragged&&e.allowDrop&&!e.disabled&&(Smart.Tree.hoveredTree=e)}_mouseleaveHandler(){const e=this;if(e.autoHideToggleElement&&e.$mainContainer.addClass("hidden-arrows"),Smart.Tree.treeItemDragged){Smart.Tree.hoveredTree&&(clearInterval(Smart.Tree.hoveredTree._dragInterval),delete Smart.Tree.hoveredTree);const e=Smart.Tree.hoveredItem;e&&(e.classList.remove("drop-target"),e.classList.remove("top"),e.classList.remove("bottom"),delete Smart.Tree.hoveredItem)}}_moveHandler(e){const t=this,r=t._dragDetails;if(!r)return;if(!r.FeedbackShown){if(!(Math.abs(r.StartPosition.left-e.pageX)>5||Math.abs(r.StartPosition.top-e.pageY)>5))return;if(t.$.fireEvent("dragStart",{item:r.Item,items:r.Items,data:r,container:t,previousContainer:t,originalEvent:r.OriginalEvent}).defaultPrevented)return delete t._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,void(t.$.scrollViewer._scrollView.disableSwipeScroll=!1);document.body.classList.add("smart-dragging"),r.Feedback=t._addDragFeedback(),r.FeedbackShown=!0}const n=t.dragOffset;let l,a,o;if(t.$.fireEvent("dragging",{item:r.Item,items:r.Items,data:r,originalEvent:e}),r.Feedback.style.left=e.pageX+n[0]+"px",r.Feedback.style.top=e.pageY+n[1]+"px",t._isMobile){const r=Smart.Tree.hoveredItem;r&&(r.classList.remove("drop-target"),r.classList.remove("top"),r.classList.remove("bottom"),delete Smart.Tree.hoveredItem);const n=t.getRootNode().elementFromPoint(e.clientX,e.clientY);Smart.Tree.hoveredTree&&(clearInterval(Smart.Tree.hoveredTree._dragInterval),delete Smart.Tree.hoveredTree),n&&(l=n.closest("smart-tree"),l&&l.allowDrop&&(Smart.Tree.hoveredTree=l,a=n.closest("smart-tree-item")||n.closest("smart-tree-items-group"),a?o=a:a=n))}if(l=Smart.Tree.hoveredTree,!l)return;const s=l.filterable?l.$.filterInput.offsetHeight+10:0;if(clearInterval(l._dragInterval),l._dragInterval=setInterval((function(){const r=l.getBoundingClientRect();l.$.scrollViewer.scrollHeight>0&&r.left<=e.clientX&&r.left+r.width>=e.clientX?e.clientY>=r.top+s&&e.clientY<=r.top+20+s?(l.$.scrollViewer.scrollTop-=t._autoScrollCoefficient,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility()):e.clientY>=r.top+r.height-20&&e.clientY<=r.top+r.height?(l.$.scrollViewer.scrollTop+=t._autoScrollCoefficient,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility()):clearInterval(l._dragInterval):clearInterval(l._dragInterval)}),1),t._isMobile||(a=e.originalEvent.target,a&&a.enableShadowDOM&&(a=e.originalEvent.composedPath()[0]),a&&a.closest&&(o=a.closest("smart-tree-item")||a.closest("smart-tree-items-group"))),o){if(Smart.Tree.hoveredItem&&o!==Smart.Tree.hoveredItem&&(Smart.Tree.hoveredItem.classList.remove("drop-target"),Smart.Tree.hoveredItem.classList.remove("top"),Smart.Tree.hoveredItem.classList.remove("bottom")),Smart.Tree.hoveredItem=o,r.Item.contains(o))return;const t=o.getBoundingClientRect();o instanceof Smart.TreeItem?e.clientY-t.top<=t.height/2?(o.classList.remove("bottom"),o.classList.add("top")):(o.classList.remove("top"),o.classList.add("bottom")):e.clientY-t.top<=10?(o.classList.remove("bottom"),o.classList.add("top")):!o.expanded&&t.bottom-e.clientY<=10?(o.classList.remove("top"),o.classList.add("bottom")):(o.classList.remove("top"),o.classList.remove("bottom")),o.classList.add("drop-target")}else if(Smart.Tree.hoveredItem&&(Smart.Tree.hoveredItem.classList.remove("drop-target"),Smart.Tree.hoveredItem.classList.remove("top"),Smart.Tree.hoveredItem.classList.remove("bottom")),a===l.$.scrollViewer.$.scrollViewerContainer)if(l._menuItems[0]){let e=l.$.mainContainer.lastElementChild,t=l.$.mainContainer.childElementCount-1;for(;e.hidden&&(t--,e=l.$.mainContainer.children[t],e););if(e){if(r.Item===e)return;Smart.Tree.hoveredItem=e,Smart.Tree.hoveredItem.classList.add("bottom")}else Smart.Tree.hoveredItem=l.$.container;Smart.Tree.hoveredItem.classList.add("drop-target")}else Smart.Tree.hoveredItem=l.$.container,Smart.Tree.hoveredItem.classList.add("drop-target");else delete Smart.Tree.hoveredItem}_moveSubItems(e,t,r){const n=this;for(let l=0;l<e.length;l++){const a=e[l];a.menu=t,a.set("level",a.parentItem.level+1),a.firstElementChild.style.paddingLeft="",a.firstElementChild.style.paddingRight="",n._setIndentation(a.firstElementChild,a.level,r),a.hidden=!1,a.$.removeClass("smart-hidden"),a.$.removeClass("filtered-child"),a.$.removeClass("last-filtered-child"),a instanceof Smart.TreeItemsGroup&&(a.$.removeClass("hidden-children"),a.container.level=a.level+1,n._moveSubItems(a.itemContainer.children,t,r),t!==n&&a.expanded&&(t._menuItemsGroupsToExpand.push(a),n._updateState("expanded",a.id,!1)))}}_moveTreeItem(e,t,r,n){const l=this,a=e.level;if(0===r){if(t.previousElementSibling===e)return;t.parentElement.insertBefore(e,t),e.set("level",t.level),e.parentItem=t.parentItem}else if(2===r){if(t.nextElementSibling===e)return;t.parentElement.insertBefore(e,t.nextElementSibling||null),e.set("level",t.level),e.parentItem=t.parentItem}else if(t===n[0].$.container)n[0].$.mainContainer.appendChild(e),e.set("level",1),e.parentItem=void 0;else{if(t.itemContainer.lastElementChild===e)return;t.itemContainer.appendChild(e),e.set("level",t.level+1),e.parentItem=t}const o=n[0].rightToLeft?"paddingRight":"paddingLeft";if(e.menu=n[0],e.parentItem=e.parentElement.menuItemsGroup,e.firstElementChild.style.paddingLeft="",e.firstElementChild.style.paddingRight="",l._setIndentation(e.firstElementChild,e.level,o),e.hidden=!1,e.$.removeClass("smart-hidden"),e.$.removeClass("filtered-child"),e.$.removeClass("last-filtered-child"),e instanceof Smart.TreeItemsGroup&&(e.$.removeClass("hidden-children"),e.container.level=e.level+1,l._moveSubItems(e.itemContainer.children,n[0],o),e.expanded)){const t=l._openedContainers[a+1].indexOf(e.container);-1!==t&&l._openedContainers[a+1].splice(t,1),n[0]._menuItemsGroupsToExpand.push(e),2===n.length&&l._updateState("expanded",e.id,!1)}for(let e=0;e<n.length;e++){const t=n[e],r=t.context,l=t.selectedIndexes.slice(0);t.context=t,t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,void 0,t.sorted&&!t.autoSort),t.selectedIndexes=[],t._applySelection(!0,l,!1),t._checkOverflow(),t.context=r}n[0]._expandItemsByDefault()}_overriddenMenuHandler(){}_pageDownHandler(e,t,r,n){const l=this,a=l.$.scrollViewer;function o(){for(let t=e.length-1;t>=0;t--){const r=e[t];if(l._canItemBeHovered(r)&&l._getOffsetTop(r)+r.firstElementChild.offsetHeight<=a.scrollTop+a.$.container.offsetHeight)return r}}if(!t)return;let s=o();s&&(t!==s?(t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):a.scrollTop+a.$.container.offsetHeight!==a.$.scrollViewerContentContainer.offsetHeight&&(l.$.scrollViewer.scrollTop+=a.$.container.offsetHeight,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility(),s=o(),t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)))}_pageUpHandler(e,t,r,n){const l=this,a=l.$.scrollViewer;function o(){for(let t=0;t<e.length;t++){const r=e[t];if(l._canItemBeHovered(r)&&l._getOffsetTop(r)>=a.scrollTop)return r}}if(!t)return;let s=o();s&&(t!==s?(t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):0!==a.scrollTop?(l.$.scrollViewer.scrollTop-=a.$.container.offsetHeight,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility(),s=o(),t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):l.filterable&&l.$.filterInput.focus())}_refreshItemPathsAndSelection(){const e=this,t=e.selectedIndexes.slice(0);e._menuItems={},e._refreshItemPaths(e.$.mainContainer,!0),e.selectedIndexes=[],e._applySelection(!0,t)}_refreshSorting(){const e=this;e._unsortItems(e.$.mainContainer),e._applyGrouping(e.$.mainContainer);const t=e._state.filter;t&&e._applyFilter(t),e._checkOverflow()}_scroll(e){const t=this;t.$.scrollViewer.scrollTop=t.$.scrollViewer.scrollTop+10*e,t._updateScrollButtonVisibility(),t.focus()}_scrollButtonFarClickHandler(){this.$.scrollButtonFar.disabled||this._scroll(1)}_scrollButtonNearClickHandler(){this.$.scrollButtonNear.disabled||this._scroll(-1)}_scrollViewerDownHandler(e){const t=this;if(e.target!==t.$.scrollViewer||t.disabled||t.displayLoadingIndicator||!t._isMobile&&1!==e.which)return;const r=e.originalEvent.target;if(r!==t.$.editInput)if(t._isMobile){const n=t.$.scrollViewer.scrollTop,l=t.getBoundingClientRect().top,a=setTimeout((function(){if(!t._dragDetails&&t.$.scrollViewer.scrollTop===n&&t.getBoundingClientRect().top===l){const n=t.context;t.context=t,t._continueSelection(r,e),t.context=n}}),250);t._downTimeoutInfo={target:r,event:e,scrollTop:n,top:l,timeout:a}}else t._continueSelection(r,e);else t._editInputDown=!0}_continueSelection(e,t){const r=this,n=e.closest("smart-tree-item")||e.closest("smart-tree-items-group");if(!(n&&n.parentElement&&r._canItemBeSelected(n,!0)))return;const l=e.closest(".smart-tree-items-group-arrow");let a;if(n instanceof Smart.TreeItem)a="_handleSelection";else{if(e===n.container||e===n.container.firstElementChild)return;a="_menuItemsGroupSelectionHandler"}if(clearTimeout(r._dblclickTimeout),n!==r._dblclickObject.target&&(r._dblclickObject.numberOfClicks=0),r._dblclickObject.target=n,r._dblclickObject.numberOfClicks++,r._dblclickTimeout=setTimeout((function(){r._dblclickObject.numberOfClicks=0}),300),2===r._dblclickObject.numberOfClicks){if(r.editable)return void r._startEditing(n);r._dblclickHandler(n,l,t),r._dblclickObject.numberOfClicks=0}n.selected&&(r._downItem=n),r[a](n,t),r._discardKeyboardHover(!0),r._hoverViaKeyboard(n,!1,void 0,!1),l||r._startDragging(n,t)}_scrollViewerTouchmoveHandler(e){this._dragDetails&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_scrollViewerWheelHandler(){const e=this;"scrollButtons"===e.scrollMode&&"hidden"!==e.overflow&&e._updateScrollButtonVisibility()}_selectItemRange(e,t){const r=this,n=Array.from(r.$.mainContainer.querySelectorAll("smart-tree-item, smart-tree-items-group")),l=n.indexOf(e),a=n.indexOf(t),o=[];for(let e=Math.min(l,a);e<=Math.max(l,a);e++){const t=n[e];r._canItemBeHovered(t)&&(o.push(t.path),t.set("selected",!0))}return o}_selectstartHandler(e){this._dragDetails&&e.preventDefault()}_setFocusable(){super._setFocusable();const e=this;e.disabled||e.unfocusable?e.$.filterInput.tabIndex=-1:e.$.filterInput.removeAttribute("tabindex")}_setIndentation(e,t,r){const n=this;let l=n._paddingSize;void 0===l&&(l=parseFloat(getComputedStyle(n).getPropertyValue("--smart-tree-indent")),isNaN(l)?l=20:l+=4,n._paddingSize=l),e.style[r]=t*l-l/2+"px"}_setThreeStateCheckbox(e,t,r){t===e.itemContainer.childElementCount&&t>0?(e.removeAttribute("indeterminate"),e.set("selected",!0),e.setAttribute("aria-selected",!0)):0===t&&0===r?(e.removeAttribute("indeterminate"),e.set("selected",!1),e.setAttribute("aria-selected",!1)):(e.setAttribute("indeterminate",""),e.set("selected",!1),e.setAttribute("aria-selected",!1))}_sortItems(e){const t=this;if(!t.sorted)return;let r;e instanceof Smart.TreeItemsGroup?r=e.container.firstElementChild:e===t.$.mainContainer&&(r=e);let n=Array.from(r.children);if(t.sort){const r=t.sort(n,e);Array.isArray(r)&&(n=r)}else"asc"===t.sortDirection?n.sort((function(e,t){return e.label.localeCompare(t.label)})):n.sort((function(e,t){return t.label.localeCompare(e.label)}));for(let e=n.length-1;e>=0;e--)r.insertBefore(n[e],r.firstElementChild)}_sortPathCollection(e){e.sort((function(e,t){const r=e.split("."),n=t.split("."),l=Math.max(r.length,n.length);for(let e=0;e<l;e++){const t=parseFloat(r[e]),l=parseFloat(n[e]);if(isNaN(t))return-1;if(isNaN(l))return 1;if(t<l)return-1;if(t>l)return 1}}))}_startDragging(e,t){const r=this,n=r.selectionMode;if(!r.allowDrag||r._editedItem||"none"===n)return;const l=[],a=[];let o;if(-1!==["one","zeroAndOne","zeroOrOne","checkBox","radioButton"].indexOf(n))o=!1,l.push(e),a.push(e);else{o=!0;for(let e=0;e<r.selectedIndexes.length;e++)l.push(r._menuItems[r.selectedIndexes[e]]),a.push(l[e]);for(let e=0;e<l.length;e++){const t=l[e];if(-1!==a.indexOf(t))for(let e=a.length-1;e>=0;e--){const r=a[e];if(r===t)break;t.contains(r)&&a.splice(e,1)}}}r._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:l,ValidItems:a,Item:e,FeedbackShown:!1,ValidateOnDrop:o,OriginalEvent:t,StartTime:new Date,Dragging:!0},Smart.Tree.treeItemDragged=!0,r.$.scrollViewer._scrollView.disableSwipeScroll=!0,r.allowDrop&&(Smart.Tree.hoveredTree=r,Smart.Tree.hoveredItem=e)}_startEditing(e){const t=this,r=t.$.editInput;let n,l;if(!t._canItemBeSelected(e,!0))return;const a=e.firstElementChild,o=a.firstElementChild;t.rightToLeft?(n=function(){return a.offsetWidth-o.offsetLeft-o.offsetWidth},l="paddingRight"):(n=function(){return o.offsetLeft+parseFloat(window.getComputedStyle(a).borderLeftWidth)},l="paddingLeft"),e instanceof Smart.TreeItemsGroup?(r.style[l]=n()+(t.showLines?parseFloat(window.getComputedStyle(o.firstElementChild).paddingLeft):0)-1+"px",r.style.height=a.offsetHeight+"px"):(r.style[l]=e.offsetWidth+parseInt(a.style[l],10)-a.offsetWidth+parseFloat(window.getComputedStyle(o.firstElementChild).paddingLeft)-2+"px",r.style.height=e.offsetHeight+"px"),r.style.top=t._getOffsetTop(e)+"px",t.$editInput.removeClass("smart-hidden"),r.value=e.label,t._editedItem=e,r.setAttribute("aria-label","Edit item "+e.label),setTimeout((function(){r.focus()}),0)}_styleChangedHandler(e){e.detail.styleProperties&&e.detail.styleProperties["font-size"]&&this._checkOverflow()}_updateScrollButtonVisibility(){const e=this,t=e.overflow;if("scrollbar"===e.scrollMode||"hidden"===t)return;let r=!0,n=!0;if(0===Math.round(e.$.scrollViewer.scrollTop)&&(r=!1),Math.round(e.$.scrollViewer.$.scrollViewerContainer.offsetHeight+e.$.scrollViewer.scrollTop)>=Math.round(e.$.scrollViewer.$.scrollViewerContentContainer.offsetHeight)&&(n=!1),"auto"===t){if(r&&n)return e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.$scrollViewer.removeClass("one-button-shown"),void e.$.scrollViewer.refresh();r?e.$scrollButtonNear.removeClass("smart-hidden"):e.$scrollButtonNear.addClass("smart-hidden"),n?e.$scrollButtonFar.removeClass("smart-hidden"):e.$scrollButtonFar.addClass("smart-hidden"),e.$scrollViewer.addClass("one-button-shown"),e.$.scrollViewer.refresh()}else"scroll"!==t||e.disabled||(e.$.scrollButtonNear.disabled=!r,e.$.scrollButtonFar.disabled=!n)}_updateState(e,t,r){const n=this;switch(e){case"expanded":{const e=n._state.expanded.indexOf(t);if(r&&-1===e)n._state.expanded.push(t);else{if(r||-1===e)return;n._state.expanded.splice(e,1)}break}case"filter":n._state.filter=void 0!==t?t:n.$.filterInput.value;break;case"selected":n._state.selected=[];for(let e=0;e<n.selectedIndexes.length;e++){const t=n._menuItems[n.selectedIndexes[e]];n._state.selected.push(t.id)}break;case"sorted":n._state.sorted=t}n.autoSaveState&&window.localStorage.setItem("smartTree"+n.id,JSON.stringify(n._state))}_verticalScrollbarHandler(){const e=this,t=e.$.verticalScrollBar,r=t.value;e.disabled||(t.max!==r?t.min!==r?(delete e._topReached,delete e._bottomReached):e._topReached||(e.$.fireEvent("scrollTopReached"),delete e._bottomReached,e._topReached=!0):e._bottomReached||(e.$.fireEvent("scrollBottomReached"),delete e._topReached,e._bottomReached=!0))}});
|
|
161
161
|
|
|
162
162
|
/***/ }),
|
|
163
163
|
|
|
@@ -277,7 +277,7 @@ var __webpack_exports__ = {};
|
|
|
277
277
|
/* harmony import */ var _smart_pivottable_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(6885);
|
|
278
278
|
/* harmony import */ var _smart_pivottable_js__WEBPACK_IMPORTED_MODULE_22___default = /*#__PURE__*/__webpack_require__.n(_smart_pivottable_js__WEBPACK_IMPORTED_MODULE_22__);
|
|
279
279
|
|
|
280
|
-
/* Smart UI v18.0.
|
|
280
|
+
/* Smart UI v18.0.11 (2024-02-10)
|
|
281
281
|
Copyright (c) 2011-2024 jQWidgets.
|
|
282
282
|
License: https://htmlelements.com/license/ */ //
|
|
283
283
|
|