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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI v18.0.
|
|
2
|
+
/* Smart UI v18.0.11 (2024-02-10)
|
|
3
3
|
Copyright (c) 2011-2023 jQWidgets.
|
|
4
4
|
License: https://htmlelements.com/license/ */ //
|
|
5
5
|
|
|
6
|
-
Smart.Utilities.Assign("Grid.Dialog",class{_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}updateRelation(e,t){const a=this;for(let l=0;l<a.dataSourceSettings.relations.length;){const i=a.dataSourceSettings.relations[l];if(i.id===e){t.label&&(i.label=t.label),t.label&&(i.label=t.label),t.columns&&(i.columns=t.columns),t.dataSource&&(i.dataSource=t.dataSource);for(let t=0;t<a.columns.length;t++){const l=a.columns[t];if(l.relationField&&l.relationId&&l.relationId===e){const e=a._getRelationData(l.relationId,l.relationField);l.editor?(l.editor.isDirty=!0,l.editor.dataSource=e):l.editor={template:"multiComboInput",readonly:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,relationId:l.relationId,relationField:l.relationField,pills:!0,singleSelect:!0,dataSource:e}}}a._recycle();break}}}_dragDialog(e,t){const a=this,l=a._dialogDragDetails.dialog;if(!e||l.pinned||l.maximized)return;if(!a._dialogDragDetails.started)return;let i,n;i=e.pageX-a._dialogDragDetails.x,n=e.pageY-a._dialogDragDetails.y;const o=Math.max(a._windowParent.element.clientHeight,a._windowParent.scrollElement.scrollHeight),r=Math.max(a._windowParent.element.clientWidth,a._windowParent.scrollElement.scrollWidth);switch(t){case"horizontal":a._dialogDragDetails.windowX=Math.max(0,Math.min(a._dialogDragDetails.windowX+i,r-l.offsetWidth)),l.style.left=a._dialogDragDetails.windowX+"px";break;case"vertical":a._dialogDragDetails.windowY=Math.max(0,Math.min(a._dialogDragDetails.windowY+n,o-l.offsetHeight)),l.style.top=a._dialogDragDetails.windowY+"px";break;case"both":a._dialogDragDetails.windowX=Math.max(0,Math.min(a._dialogDragDetails.windowX+i,r-l.offsetWidth)),a._dialogDragDetails.windowY=Math.max(0,Math.min(a._dialogDragDetails.windowY+n,o-l.offsetHeight)),l.style.left=a._dialogDragDetails.windowX+"px",l.style.top=a._dialogDragDetails.windowY+"px"}a._dialogDragDetails.top=l.offsetTop,a._dialogDragDetails.left=l.offsetLeft,a._dialogDragDetails.x=Math.max(a._windowParent.offsetLeft+a._dialogDragDetails.offsetX-a._windowParent.scrollElement.scrollLeft,Math.min(a._windowParent.offsetLeft+a._windowParent.element.offsetWidth-(a._windowParent.element.offsetWidth-l.offsetLeft)+a._dialogDragDetails.offsetX,e.pageX)),a._dialogDragDetails.y=Math.max(a._windowParent.offsetTop+a._dialogDragDetails.offsetY-a._windowParent.scrollElement.scrollTop,Math.min(a._windowParent.offsetTop+a._windowParent.element.offsetHeight-(a._windowParent.element.offsetHeight-l.offsetTop)+a._dialogDragDetails.offsetY,e.pageY))}_updateDialogDragDetails(e,t,a){const l=this;if(l._windowParent={initialParent:t.parentElement,element:document.documentElement,scrollElement:document.scrollingElement},l._dialogDragDetails||(l._dialogDragDetails={}),void 0===l._dialogDragDetails.minWidth||void 0===l._dialogDragDetails.minHeight||void 0===l._dialogDragDetails.maxWidth||void 0===l._dialogDragDetails.maxHeight){const e=getComputedStyle(t);l._dialogDragDetails.minWidth=parseFloat(e.getPropertyValue("min-width"))||0,l._dialogDragDetails.minHeight=parseFloat(e.getPropertyValue("min-height"))||0,l._dialogDragDetails.maxWidth=parseFloat(e.getPropertyValue("max-width"))||0,l._dialogDragDetails.maxHeight=parseFloat(e.getPropertyValue("max-height"))||0}l._dialogDragDetails.dialog=t,l._dialogDragDetails.windowX=t.offsetLeft,l._dialogDragDetails.windowY=t.offsetTop;const i=t.getBoundingClientRect(),n=t.parentElement===document.body?document.documentElement.getBoundingClientRect():t.parentElement?t.parentElement.getBoundingClientRect():document.documentElement.getBoundingClientRect(),o=window.scrollX||window.pageXOffset,r=window.scrollY||window.pageYOffset;l._windowParent.offsetLeft=n.left+o,l._windowParent.offsetTop=n.top+r,a&&"object"==typeof a&&(l._dialogDragDetails.offsetX=a.clientX-i.left,l._dialogDragDetails.offsetY=a.clientY-i.top),t.collapsed||(l.hasAnimation&&"minimize"===e?(l._dialogDragDetails.width=l._dialogDragDetails.width?l._dialogDragDetails.width:t.offsetWidth,l._dialogDragDetails.height=l._dialogDragDetails.height?l._dialogDragDetails.height:t.offsetHeight):(l._dialogDragDetails.width=t.offsetWidth,l._dialogDragDetails.height=t.offsetHeight),(t.style.width||t.style.height)&&(l._dialogDragDetails.resized=!0)),"minimize"!==e&&e&&(l._dialogDragDetails.type=e,l._dialogDragDetails.started=!0,l._dialogDragDetails.snapWindowWidth=t.offsetWidth,l._dialogDragDetails.snapWindowHeight=t.offsetHeight,a&&"object"==typeof a?(l._dialogDragDetails.x=a.pageX,l._dialogDragDetails.y=a.pageY):(l._dialogDragDetails.x=t.offsetLeft,l._dialogDragDetails.y=t.offsetTop))}_createDialog(e){const t=this;let a=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(a.modal=e.modal),void 0!==e.screenModal&&(a.screenModal=e.screenModal),a.setAttribute("animation","none"),a.classList.add("smart-window","smart-grid-dialog"),a.style.width="auto"===e.width?e.width:e.width+"px",a.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(a.style.width=e.width),e.height&&"string"==typeof e.height&&(a.style.height=e.height),a.style.left="",a.style.top="",a.innerHTML=`<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div id="headerSection" class="smart-header-section">\n <div class="smart-header">\n </div>\n <div class="smart-buttons-container">\n <button title="${t.localize("contextMenuItemDelete")}" tabindex=-1 class="smart-visibility-hidden smart-hidden smart-delete-button smart-grid-icon smart-icon-delete show smart-button smart-element" aria-label="Delete Row" smart-id="deleteButton"></button>\n <button title="${t.localize("copyURL")}" tabindex=-1 class="smart-visibility-hidden smart-hidden smart-copy-row-button smart-grid-icon smart-icon-link show smart-button smart-element" aria-label="Copy URL" smart-id="urlButton"></button>\n <button title="${t.localize("dialogEditHeaderMenu")}" tabindex=-1 class ="smart-visibility-hidden smart-hidden checked smart-comments-button smart-grid-icon smart-icon-menu show smart-button smart-element" aria-label="Comments" smart-id="commentsButton"></button>\n <button title="${t.localize("close")}" class ="smart-button smart-element smart-close-button" aria-label="Close" smart-id="closeButton"></button>\n </div>\n </div>\n <div class="smart-content"><div class="smart-content-container"></div></div>\n <div class ="smart-footer">\n \n <div class ="smart-stack-layout right spacing">\n <smart-button class ="smart-confirm-button item primary">Ok</smart-button>\n <smart-button class ="smart-cancel-button item">Cancel</smart-button>\n </div>\n </div>\n </div>\n </div>\n `,a.querySelector&&a.querySelector(".smart-content")&&(a.content=a.querySelector(".smart-content").firstChild),a.footer=a.querySelector(".smart-footer"),a.header=a.querySelector(".smart-header"),a.btnConfirm=a.querySelector(".smart-confirm-button"),a.btnCancel=a.querySelector(".smart-cancel-button"),a.btnDelete=a.querySelector(".smart-delete-button"),a.btnClose=a.querySelector(".smart-close-button"),a.btnComments=a.querySelector(".smart-comments-button"),a.btnLink=a.querySelector(".smart-copy-row-button"),a.headerSection=a.querySelector(".smart-header-section"),a.btnLink.onclick=()=>{let e=document.createElement("input"),t=window.location.href+"#activeRows="+a.row.id;navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(t).then((()=>{})):(document.body.appendChild(e),e.value=t,e.select(),document.execCommand("copy"),document.body.removeChild(e))},a.btnDelete.onclick=()=>{const e=a.row.id,l=t.editing.deleteDialog.enabled;t.editing.deleteDialog.enabled=!0,t.cancelEdit(),a.close(),t._openDeleteRowDialog(e,(function(e){t._endToolbarEdit&&t._endToolbarEdit(),t.deleteRow(e)})),t.editing.deleteDialog.enabled=l,a.close()},a.btnComments.onclick=()=>{const e=a.querySelector(".smart-grid-edit-dialog-layout");e&&e.classList.toggle("hide-activity"),a.btnComments.classList.toggle("checked")},!1!==a.allowDrag&&(a.headerSection.onpointerdown=e=>{t._updateDialogDragDetails("drag",a,e)},a.headerSection.onpointerup=()=>{t._dialogDragDetails&&(t._dialogDragDetails.started=!1)});const l=document.createElement("div");return l.classList.add("smart-grid-dialog-overlay"),l.onclick=function(){a.overlayClick&&a.overlayClick()},a.overlay=l,a.remove=function(){a.parentNode&&a.parentNode.removeChild(a)},a.close=function(){a.classList.contains("open")&&(a.classList.remove("open"),delete t._resizeHandling,a.addEventListener("transitionend",a.remove),a.addEventListener("transitioncancel",a.remove),a.modal&&a.overlay.parentNode&&a.overlay.parentNode.removeChild(a.overlay),t.layout.isDirty&&"grid"===t.view&&(t._resetCachedLayout(),t._refreshLayout(),t.refresh()),a.onClose&&a.onClose())},a.open=function(l,i){a.removeEventListener("transitionend",a.remove),a.removeEventListener("transitioncancel",a.remove),t.isInShadowDOM?t.getRootNode().appendChild(a):document.body.appendChild(a),t._resizeHandling=!1,void 0===l&&(l=e.left),void 0===i&&(i=e.top),requestAnimationFrame((function(){a.classList.add("open");const e=a.querySelector('[bind="name"]');if(e){const a=e.querySelector("smart-input");a&&t.editing.enabled&&a.focus()}const n=function(e,l){const i=t.offset(t);switch("center"===e&&"horizontal"===l&&(e="middle"),e){case"top":return i.top;case"bottom":return Math.max(i.top,i.top+t.offsetHeight-a.offsetHeight);case"center":return Math.max(i.top,i.top+t.offsetHeight/2-a.offsetHeight/2);case"left":return i.left;case"middle":return i.left+t.offsetWidth/2-a.offsetWidth/2;case"right":return i.left+t.offsetWidth-a.offsetWidth}return"horizontal"===l?parseInt(e)+i.left:"vertical"===l?parseInt(e)+i.top:"number"==typeof e?e:parseInt(e)};a.style.left=n(l,"horizontal")+"px",a.style.top=n(i,"vertical")+"px",a.setPosition=(e,t)=>{t?a.style.left=n(e,"horizontal")+"px":a.style.top=n(e,"vertical")+"px"},"center"===l&&parseInt(a.style.left)<0&&(a.style.left="5%",a.style.maxWidth="90%"),"screenMiddle"===l&&(a.style.left="calc(50% - "+a.offsetWidth/2+"px)"),"screenCenter"===i&&(a.style.top="calc(50% - "+a.offsetHeight/2+"px)")})),a.modal&&(a.screenModal?t.isInShadowDOM?t.getRootNode().appendChild(a.overlay):document.body.appendChild(a.overlay):t.appendChild(a.overlay)),a.onOpen&&a.onOpen()},a}_openAddRowDialog(e,t){const a=this;if(!a.editing.addDialog.enabled)return!1;const l=a._dialogAddRow||a._createDialog(),i="{{message}}"===a.editing.dialog.header?a.localize("dialogAddHeader"):a.editing.dialog.header,n=l.content;l.header.innerHTML=i,e.grid=a,void 0===e.index&&(e.index=a.rows.length,a._rowsAdded&&(e.index+=a._rowsAdded.length));const o=e.cells;let r=null,s=0;if(a._cellEditors||(a._cellEditors=[]),!a._dialogAddRow){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogAddButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogAddButtonCancel"),l.onOpen=function(){a.editing.dialog.visible=!0},l.onClose=function(){a.editing.dialog.visible=!1},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){const e={};for(let t=0;t<o.length;t++){const l=o[t],i=a._getEditorValue(l),n=a._getEditorId(l),r=a._cellEditors[n];r&&(i&&i.error?(e[l.column.dataField]=i.value,r.detach()):(e[l.column.dataField]=i,r.detach()))}const i=a._rowsAdded?a._rowsAdded.length:0,n=new Smart.Grid.Row({index:a.rows.length+i,id:Smart.Utilities.Core.createGUID(),grid:a,data:e});l.close(),t(n,0===l.index)},l.onkeydown=function(e){const t=e.key;"Enter"===t?l.btnConfirm.onclick():"Escape"===t&&l.close()},n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;s%2==0&&(r=document.createElement("div"),r.classList.add("smart-grid-edit-dialog-row"),n.appendChild(r));const l=document.createElement("div");l.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const o=document.createElement("label");o.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),l.appendChild(i),r.appendChild(l),i.appendChild(o),i.appendChild(d),s++}}l.open(),l.index=e.index;let d=0;for(let e=0;e<o.length;e++){const t=o[e],i=t.column,n=i.dataField,r=l.querySelector("[editor="+n+"]");if(!r)continue;r.innerHTML="";let s="";void 0!==t.value&&(s=t.value),"int64"!==i.dataType&&"number"!==i.dataType&&"int"!==i.dataType&&"float"!==i.dataType||(s=0),"date"===i.dataType&&(s=new Date),"bool"!==i.dataType&&"boolean"!==i.dataType||(s=!1);let c=null;switch(t.editor.template){default:case"custom":c=a._getCustomCellEditor(t);break;case"image":c=a._getImageCellEditor(t);break;case"checkBox":c=a._getCheckBoxCellEditor(t);break;case"autoComplete":c=a._getAutoCompleteCellEditor(t);break;case"dropDownList":c=a._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=a._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=a._getMaskCellEditor(t);break;case"checkInput":c=a._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=a._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=a._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=a._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=a._getDateInputCellEditor(t);break;case"dateRangeInput":c=a._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=a._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=a._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?a._getNumberInputCellEditor(t):a._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(s),0===d&&setTimeout((()=>{a.editing.enabled&&c.focus()}),100),!t.editor.isInitialized&&(t.editor.isInitialized=!0,t.editor.onInit)){const e=t.editor.onInit(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)l[e]=a[e]}}if(t.editor.onRender){const e=t.editor.onRender(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)l[e]=a[e]}}r.appendChild(c.element),c.element.onfocus=()=>{r.setAttribute("focus","")},c.element.onblur=()=>{r.removeAttribute("focus")},d++}a._dialogAddRow=l}_openEditDialog(e,t){const a=this;if(!a.editing.dialog.enabled)return!1;const l=a._dialogEdit||a._createDialog();let i="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeader",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header;const n=l.content;!1===a.editing.enabled?(l.classList.add("disable-edit"),i="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeaderDisabled",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header):l.classList.remove("disable-edit"),l.header.innerHTML=i,l.footer.classList.add("smart-hidden"),l.row=a.editing.editRow;const o=l.row.canNotify;l.row.canNotify=!1,l.row.showDetail=!1,l.row.canNotify=o,l.overlayClick=()=>{l.btnConfirm.click()};let r,s,d=null,c=0;if(void 0!==a._settingsDialogRowId){const e=`<div class="smart-buttons-container">\n <button title="${a.localize("pagerPreviousButton")}" tabindex=-1 class =" smart-button smart-element smart-prev-button" aria-label="Previous Record" smart-id="prevButton"></button>\n <button title="${a.localize("pagerNextButton")}" tabindex=-1 class =" smart-button smart-element smart-next-button" aria-label="Next Record" smart-id="nextButton"></button>\n </div>`;l.header.innerHTML=e+"<span>"+i+"</span>",l.btnPrev=l.querySelector(".smart-prev-button"),l.btnNext=l.querySelector(".smart-next-button"),l.header.style.display="flex",l.header.style.alignItems="center",a.editing.enabled?(l.btnDelete.classList.remove("smart-hidden"),l.btnComments.classList.remove("smart-hidden"),l.btnLink.classList.remove("smart-hidden"),l.btnDelete.classList.remove("smart-visibility-hidden"),l.btnComments.classList.remove("smart-visibility-hidden"),l.btnLink.classList.remove("smart-visibility-hidden"),0===a.users.length||a.users.length&&"guest"===a._currentUser.info?(l.btnLink.classList.add("smart-visibility-hidden"),l.btnDelete.classList.add("smart-visibility-hidden"),l.btnComments.classList.add("smart-visibility-hidden")):(l.btnLink.classList.remove("smart-visibility-hidden"),l.btnDelete.classList.remove("smart-visibility-hidden"),l.btnComments.classList.remove("smart-visibility-hidden"))):l.btnLink.style.width=l.btnDelete.style.width=l.btnComments.style.width="0px";const t=e=>{const t=a.editing.editRow,i=a._recyclingRows.indexOf(t);let o=e?a._recyclingRows[i+1]:a._recyclingRows[i-1];if(a.grouping.enabled&&a.dataSource.groupBy&&a.dataSource.groupBy.length>0){let t=1;for(;o&&!o.leaf;)o=e?a._recyclingRows[i+t]:a._recyclingRows[i-t],t++}const r=t;if(void 0!==a._settingsDialogRowId&&a.editing.dialog.autoSave){const e=a.rowById[a._settingsDialogRowId];e&&(l.saveRowData(e,!1),a._disableEndEdit=!0,a._recycle(!1,!0),a._disableEndEdit=!1)}if(o){if(a.editing.recordNavigation=!0,a.editing.editRow=o,a._settingsDialogRowId=o.id,r.isEditing=!1,r.element.removeAttribute("edit"),"gallery"===a.view){const e=a.querySelector('.smart-card[row-id="'+l.row.id+'"]');e&&e.removeAttribute("edit");const t=a.querySelector('.smart-card[row-id="'+o.id+'"]');t&&t.setAttribute("edit","")}const e=o,t=r.cells,i=e.cells;"kanban"===a.view&&a._kanban&&a._kanban.selectTask(e.id),l.row=o,l.header.querySelector("span").innerHTML=a.localize("dialogEditHeader",{value:a.editing.editRow.visibleIndex+1}),"gallery"!==a.view&&e.element.row.data.$.id===e.data.$.id&&e.element.setAttribute("edit","");for(let a=0;a<i.length;a++){const l=i[a],n=l.column;if(!n.allowEdit||!1===n._visible)continue;l.isEditing=!0,t[a].isEditing=!1;const o=e.data[n.dataField];l.editor&&l.editor.instance&&l.editor.instance.setValue(o)}a._applySettingsDialogLayout(l,n,a.editing.editRow,!0),a.editing.enabled&&setTimeout((()=>{const e=l.querySelector(".smart-grid-dialog-editor input");e&&e.focus()}),100)}};l.btnNext.onmousedown=e=>{t(!0),e.preventDefault(),e.stopPropagation()},l.btnPrev.onmousedown=e=>{t(!1),e.preventDefault(),e.stopPropagation()}}if(!a._dialogEdit){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),l.onOpen=function(){a.editing.dialog.visible||(a.editing.dialog.visible=!0,void 0!==a._settingsDialogRowId&&l.editorsContent&&l.editorsContent.offsetHeight&&(l.editorsContent.style.maxHeight=l.editorsContent.offsetHeight+40+"px",l.editorsContent.offsetWidth>a.offsetWidth||l.editorsContent.offsetHeight>window.innerHeight||l.editorsContent.offsetWidth>window.innerWidth?setTimeout((()=>{const e=a.offset(a);l.style.left=e.left+"px",l.style.top=e.top+"px",l.style.width=l.style.minWidth=a.offsetWidth+"px",l.style.height=l.style.minHeight=a.offsetHeight+"px",l.editorsContent.style.maxHeight=""})):(l.style.width=l.style.minWidth="",l.style.height=l.style.minHeight="","gallery"===a.view&&setTimeout((()=>{a.querySelector('.smart-card[row-id="'+l.row.id+'"]')}))),a.editing.enabled&&setTimeout((()=>{const e=l.querySelector(".smart-grid-dialog-editor input");e&&e.focus()}),100)))},l.onClose=function(){a.editing.dialog.visible=!1,l.row&&(l.row.showDetail=!1)},l.btnCancel.onclick=function(){a.editing.isEditing=!0,a.cancelEdit()},l.btnClose.onclick=function(){a.editing.isEditing=!0,a.cancelEdit()};const t=(e,t=!0)=>{if(!e)return!1;const i=e.cells;let n={};e.element.removeAttribute("error");for(let e=0;e<i.length;e++){const t=i[e],l=a._getEditorValue(t);n[t.column.dataField]=l}const o=a.validateRow(e.id,n);if(Object.keys(o).length>0){let e=!0;for(let t=0;t<i.length;t++){const n=i[t],r=o[n.column.dataField],s=l.querySelector(`[label-for="${n.column.dataField}"]`);if(s&&(s.innerHTML=""),r)for(let t in r){const l=r[t];let i="";if(!l)continue;let o=l[t];"minLength"!==t&&"maxLength"!==t||(o=l[t.toLowerCase()]),i=l.message?l.message:"required"===t||"valueMissing"===t?a.localize("requiredValue",{value:n.column.label}):"min"===t?a.localize("invalidMinValue",{value:n.column.label,min:o.min}):"max"===t?a.localize("invalidMaxValue",{value:n.column.label,max:o.max}):"minLength"===t?a.localize("invalidMinLengthValue",{value:n.column.label,min:o.requiredLength}):"maxLength"===t?a.localize("invalidMaxLengthValue",{value:n.column.label,max:o.requiredLength}):a.localize("invalidValue"),e=!1,s&&(s.innerHTML=i)}}if(!e)return!1}const r=e.style;e.updatedDate=new Date,e.updatedBy=a.currentUser,e.style=l._rowStyle,e.comments=l._rowComments;const s=a.dataSource.dataItemById[e.id];if(s){const t=s.$.index;a.dataSource&&e.comments!==a.dataSource.boundSource[t].comments&&(a._sortedColumns&&a._sortedColumns.length>0?s.comments=e.comments:a.dataSource.boundSource[t].comments=e.comments)}if(e.style=l._rowStyle,a.onRowStyle&&r!==e.style&&(null===r?a.onRowStyle(e.index,e,e.style):r.background===e.style.background&&r.color===e.style.color&&r.fontSize===e.style.fontSize&&r.fontStyle===e.style.fontStyle&&r.fontFamily===e.style.fontFamily&&r.fontWeight===e.style.fontWeight&&r.status===e.style.status&&r.textDecoration===e.style.textDecoration||a.onRowStyle(e.index,e,e.style)),!t){for(let t=0;t<i.length;t++){const l=i[t],n=a._getEditorValue(l),o=l.column.dataField;if(e.canNotify=!1,e.data.canNotify=!1,e.data[o]=n,s){const e=s.$.index;a.dataSource&&(a._sortedColumns&&a._sortedColumns.length>0?s[o]=n:a.dataSource.boundSource[e][o]=n)}e.canNotify=!0,e.data.canNotify=!0}a._onSaveRowData&&a._onSaveRowData(e)}return!0};if(l.saveRowData=t,l.btnConfirm.onclick=function(){if(void 0!==a._settingsDialogRowId){const e=a.rowById[a._settingsDialogRowId];let i=!0;if(e&&(i=t(e)),!i)return;if(l.columnVisibility){let e=!1;const t=a.columns.canNotify;a.columns.canNotify=!1;for(let t in l.columnVisibility){const i=a.columnByDataField[t];i.visible!==l.columnVisibility[t]&&(i.visible=l.columnVisibility[t],e=!0)}if(a.columns.canNotify=t,e)return a.endEdit(),a.refresh(!1),void(a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh()))}}a.endEdit(),a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh())},l.onkeydown=function(e){const t=e.key,l=a.editing.commandKeys;for(let e in l){const i=l[e];if(t===i.key){a._applyCommand(i.command);break}}},a.editing.editRow)if(void 0!==a._settingsDialogRowId)a._applySettingsDialogLayout(l,n,a.editing.editRow);else{n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;c%2==0&&(d=document.createElement("div"),d.classList.add("smart-grid-edit-dialog-row"),n.appendChild(d));const l=document.createElement("div");l.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const o=a._settingsDialogRowId?document.createElement("div"):document.createElement("label");o.innerHTML=a.columns[e].label;const r=document.createElement("div");r.classList.add("smart-grid-dialog-editor"),r.setAttribute("editor",t.dataField),r.setAttribute("template",t.editor.template),l.appendChild(i),d.appendChild(l),i.appendChild(o),i.appendChild(r),c++}}else{const t=e.column,a=document.createElement("div");a.classList.add("smart-grid-dialog-editor"),a.setAttribute("editor",""),a.setAttribute("template",t.editor.template),n.appendChild(a)}}if(a._dialogEditPosition){const e=a.offset(a);r=parseInt(a._dialogEditPosition.left)-e.left,s=parseInt(a._dialogEditPosition.top)-e.top}if(a.editing.dialog.visible||l.open(r,s),a.editing.editRow){const a=l.querySelector("[editor="+e.column.dataField+"]");a&&(a.innerHTML="",a.appendChild(t.element),a.editor=t,a.editorValue=t.getValue(),t.element.onfocus=()=>{a.setAttribute("focus",""),a.setAttribute("touched",""),a.editorValue=t.getValue()},t.element.onblur=()=>{a.removeAttribute("focus"),a.editorValue!==t.getValue()&&a.setAttribute("pending","")})}else{const a=e.column,i=l.querySelector("[editor]");i.innerHTML="",i.setAttribute("template",a.editor.template),i.appendChild(t.element),i.editor=t,i.editorValue=t.getValue(),t.element.onfocus=()=>{i.setAttribute("focus",""),i.setAttribute("touched",""),i.editorValue=t.getValue()},t.element.onblur=()=>{i.removeAttribute("focus"),i.editorValue!==t.getValue()&&i.setAttribute("pending","")}}a._dialogEdit=l}_refreshCurrentUser(){const e=this,t=e.users;let a=e.currentUser,l=!0,i=!0,n=e.editing.enabled,o=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(l=!1!==a.allowAdd,i=!1!==a.allowComment,n=n&&!1!==a.allowEdit,o=!1!==a.allowRemove)),t&&t.length&&(null!==e.currentUser&&!1!==e.currentUser||(l=!1,i=!1,n=!1,o=!1,a="guest")),e._currentUser={allowAdd:l,allowComment:i,allowEdit:n,allowRemove:o,info:a}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-grid-color-input")},e}_applySettingsDialogLayout(e,t,a,l){const i=this;e.classList.add("smart-grid-dialog-expand-row");const n=e._rowStyle=JSON.parse(JSON.stringify(a._style)),o=e._rowComments=JSON.parse(JSON.stringify(a.comments));l&&e.activityContent.remove();const r=[];e.columnVisibility=r;let s=document.createElement("div"),d=document.createElement("div"),c=document.createElement("div"),u=document.createElement("div");l?(s=e.editorsContent,c=e.layoutContent,c.appendChild(d)):(c.appendChild(s),c.appendChild(u),c.appendChild(d),t.appendChild(c)),c.classList.add("smart-grid-edit-dialog-layout"),s.classList.add("smart-grid-edit-dialog-editors-container"),d.classList.add("smart-grid-edit-dialog-activity-container"),u.classList.add("smart-footer"),Smart.Utilities.Core.isMobile&&(c.classList.add("hide-activity"),e.btnComments.classList.remove("checked")),(0===i.users.length||i.users.length&&"guest"===i._currentUser.info)&&(d.classList.add("smart-hidden"),e.btnComments.classList.add("smart-hidden"),c.classList.add("hide-activity"),e.btnComments.classList.remove("checked"),e.btnComments.classList.add("smart-hidden"),e.btnLink.classList.add("smart-hidden"));const m=document.createElement("smart-button");m.innerHTML=`<span>${i.localize("dialogEditButtonSave")}</span>`,m.classList.add("primary");const p=document.createElement("smart-button");p.innerHTML=`<span>${i.localize("dialogEditButtonCancel")}</span>`;const g=document.createElement("div");g.classList.add("smart-flex"),g.style.flexDirection="row-reverse",g.appendChild(m),g.appendChild(p),u.appendChild(g);const b=document.createElement("div");b.classList.add("smart-flex"),b.style.alignItems="center",b.innerHTML=`<label style="margin-right: 5px;">${i.localize("dialogEditButtonAutoSave")}</label>\n <label title="${i.localize("dialogEditButtonAutoSave")}" class="smart-switch">\n <input type="checkbox">\n <span class="slider round"></span>\n </label>`,u.appendChild(b),i.users&&i.users.length&&(!1!==i.currentUser&&null!==i.currentUser&&void 0!==i.currentUser||u.classList.add("smart-hidden"));const f=b.querySelector("input");f.onchange=()=>{i.editing.dialog.autoSave=f.checked},i._currentUser.info&&!i._currentUser.allowEdit&&(u.classList.add("smart-hidden"),e.btnComments.classList.add("smart-hidden"),e.btnLink.classList.add("smart-hidden"),e.btnDelete.classList.add("smart-hidden")),!0===i.editing.dialog.autoSave&&(f.checked=!0),p.onclick=()=>{e.btnCancel.click()},m.onclick=()=>{e.btnConfirm.click()},Smart.Utilities.Core.isMobile&&(c.setAttribute("mobile",""),e.setAttribute("mobile",""));let h=0;for(let e=0;e<i.columns.length;e++){const t=i.columns[e];t.allowEdit&&!1!==t._visible&&h++}h>=8?s.classList.add("many"):s.classList.remove("many"),e.editorsContent=s,e.activityContent=d,e.layoutContent=c,e.footerContent=u,setTimeout((()=>{e.editorsContent.scrollHeight>e.editorsContent.offsetHeight?(u.style.setProperty("--smart-background","var(--smart-surface)"),u.style.borderTopStyle="solid",u.style.borderTopColor="var(--smart-border)",u.style.borderTopWidth="1px",p.classList.add("flat")):(u.style.setProperty("--smart-background",""),u.style.borderTopStyle="",u.style.borderTopColor="",u.style.borderTopWidth="",p.classList.remove("flat"))}),200);const y=document.createElement("div"),v=document.createElement("div");d.appendChild(y),d.appendChild(v);let C=o&&o.length?" ("+o.length+")":"";y.innerHTML=`\n <div class="tabs">\n <div view="comments" class="active tab"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-comment show"></span><span>${i.localize("commentsTab")}<span>${C}</span></span></div></div>\n <div view="history" class="tab smart-hidden"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-history show"></span>${i.localize("historyTab")}</div></div>\n <div view="details" class="tab"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-font show"></span>${i.localize("detailsTab")}</div></div>\n </div>\n <div class="smart-hidden details-tab">\n <div class="smart-grid-edit-dialog-row"><div class="column"><div class="header smart-grid-edit-dialog-column-info">${i.localize("format").replace(":","")}\n <span title="${i.localize("resetFormat")}" class="reset-format smart-grid-icon smart-icon-reload show"></span>\n </div>\n </div>\n <div class="format-layout">\n <div title="${i.localize("background")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-color-background show"></span><div class="background"></div>\n </div>\n <div title="${i.localize("color")}" class="format smart-grid-edit-dialog-column-info">\n <span style="border-bottom: 2px solid #46CA78;" color="#46CA78" class="format smart-grid-icon smart-icon-font show"></span><div class="color"></div>\n </div>\n <div class="format-layout button-group">\n <span title="${i.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${i.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${i.localize("underline")}" class="formatbtn underline smart-grid-icon smart-icon-underline show"></span>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("fontFamily").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-font show"></span><div class="font-family"></div>\n </div>\n <div title="${i.localize("fontSize").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-fontsize show"></span><div class="font-size"></div>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("status").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span color="#F1C58B" class="smart-grid-icon smart-icon-star show"></span><div class="status"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="comments-tab">\n <div class="column smart-hidden"><div class="smart-hidden comments-header smart-grid-edit-dialog-column-info">${i.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments"><span>${i.localize("noComments")}</span></span></div>\n <div class="footer">\n <smart-text-area hint="${i.localize("comment")}" placeholder="${i.localize("commentPlaceholder")}" class="smart-text-area success underlined"></smart-text-area>\n <smart-button class="success">${i.localize("send")}</smart-button>\n </div>\n </div>\n </div>\n <div class="history-tab smart-hidden">\n <div class="history-layout">\n <div class="history"></div>\n </div>\n </div>\n `;const S=y.querySelectorAll(".tab");i.storeHistory&&(!i._currentUser||i._currentUser&&!i._currentUser.info?S[S.length-1].classList.add("smart-hidden"):S[S.length-1].classList.remove("smart-hidden")),!i.users||i.users&&0===i.users.length||!i._currentUser||i._currentUser&&!i._currentUser.info?S[S.length-2].classList.add("smart-hidden"):S[S.length-2].classList.remove("smart-hidden"),y.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),a=y.querySelector(".details-tab"),l=y.querySelector(".comments-tab"),n=y.querySelector(".history-tab");a.classList.add("smart-hidden"),l.classList.add("smart-hidden"),n.classList.add("smart-hidden");for(let e=0;e<S.length;e++)S[e].classList.remove("active");switch(t.classList.add("active"),e){case"details":a.classList.remove("smart-hidden");break;case"comments":l.classList.remove("smart-hidden");break;case"history":n.classList.remove("smart-hidden"),i._refreshHistory()}}};const w=i._getColorInput();y.querySelector(".background").appendChild(w),w.onchange=()=>{n.background=w.value},n.background&&(w.value=n.background);const _=i._getColorInput();y.querySelector(".color").appendChild(_),_.onchange=()=>{n.color=_.value},n.color&&(_.value=n.color);const D=i._getColorInput();y.querySelector(".status").appendChild(D),D.onchange=()=>{n.status=D.value},n.status&&(D.value=n.status);const L=document.createElement("smart-input");L.style.width="auto",L.classList.add("underlined"),L.dropDownButtonPosition="right",L.readonly=!0,L.dropDownHeight="auto",L.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],L.onchange=()=>{n.fontFamily=L.value},n.fontFamily?L.value=n.fontFamily:L.selectedIndex=0,y.querySelector(".font-family").appendChild(L);const x=document.createElement("smart-input");x.style.width="auto",x.classList.add("underlined"),x.dropDownButtonPosition="right",x.readonly=!0,x.dropDownHeight="auto",x.dataSource=["-","8px","10px","12px","14px","18px","24px","36px"],x.onchange=()=>{n.fontSize=x.value},n.fontSize?x.value=n.fontSize:x.selectedIndex=0,y.querySelector(".font-size").appendChild(x);const k=y.querySelector(".button-group");k.onclick=e=>{const t=e.target.closest(".formatbtn");let a;t.classList.contains("checked")?(t.classList.remove("checked"),a=!1):(t.classList.add("checked"),a=!0),t.classList.contains("bold")?n.fontWeight=a?"bold":null:t.classList.contains("italic")?n.fontStyle=a?"italic":null:t.classList.contains("underline")&&(n.textDecoration=a?"underline":null)},n.fontWeight?k.children[0].classList.add("checked"):k.children[0].classList.remove("checked"),n.fontStyle?k.children[1].classList.add("checked"):k.children[1].classList.remove("checked"),n.textDecoration?k.children[2].classList.add("checked"):k.children[2].classList.remove("checked"),y.querySelector(".reset-format").onclick=()=>{for(let e=0;e<k.children.length;e++)k.children[e].classList.remove("checked");L.selectedIndex=0,x.selectedIndex=0,_.value="",w.value="",D.value="",n.fontWeight=null,n.fontStyle=null,n.textDecoration=null,n.fontSize=null,n.fontFamily=null};const A=y.querySelector(".comments-header"),F=y.querySelector('[view="comments"]'),T=y.querySelector(".comments-layout smart-text-area"),z=y.querySelector(".comments-layout smart-button"),I=y.querySelector(".comments-layout .footer"),E=y.querySelector(".comments-layout .comments");T.users=i.users,z.disabled=!0,E.innerHTML=`<span class="no-comments"><span>${i.localize("noComments")}</span></span>`;const M=()=>{const e=E.querySelector(".no-comments");0===o.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},H=()=>{i._commentEditing&&(i._commentEditing.parentNode&&i._commentEditing.parentNode.removeChild(i._commentEditing),delete i._commentEditing)};H();const R=e=>{const t=e.querySelector(".remove-button");H(),t.onclick=e=>{const t=e.target,l=o.indexOf(t.comment);if(H(),l>-1){const e=o[l];o.splice(l,1),i.$.fireEvent("commentRemove",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,o),t.element.remove();const n=o.length?"("+o.length+")":"";A.innerHTML=F.lastElementChild.lastElementChild.innerHTML=`${i.localize("comments").replace(":","")} <span>${n}</span>`,M()}}},B=e=>{const t=e.querySelector(".edit-button");H();const a=e.querySelector(".comment-body");t.onclick=t=>{H();const a=t.target,l=o.indexOf(a.comment);if(!i._commentEditing&&l>-1){const t=o[l];let n=!1;if(i._currentUser.info&&t.userId===i._currentUser.info.id&&i._currentUser.allowComment&&(n=!0),!n)return;const r=document.createElement("smart-text-area");r.users=i.users;const s=e.querySelector(".comment-body");s.appendChild(r),s.style.position="relative",s.classList.add("edit"),r.style.width="100%",r.style.height="100%",r.style.minHeight="50px",r.style.minWidth="150px",r.style.left=r.style.top="0px",r.style.position="absolute",r.value=t.text,r.style.zIndex=5,r.style.boxShadow="var(--smart-elevation-2)",r.onkeydown=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),r.onblur=r.onchange=null,s.classList.remove("edit"),H())},r.onchange=r.onblur=()=>{if(t.text=r.value,""===r.value)return void e.querySelector(".remove-button").click();const l=i._createComment(t);a.element.parentNode===E&&(E.insertBefore(l,a.element),a.element.parentNode.removeChild(a.element),delete i._commentEditing),R(l),B(l)},r.focus(),i._commentEditing=r}},a.ondblclick=e=>{t.click()}};for(let e=0;e<o.length;e++){const t=o[e],a=i._createComment(t);R(a),B(a),E.appendChild(a)}if(setTimeout((()=>{E.scrollTop=E.scrollHeight}),200),i._commentUpdateInterval=setInterval((()=>{e.classList.contains("open")?i._commentEditing:clearInterval(i._commentUpdateInterval)}),5e3),A.innerHTML=`${i.localize("comments").replace(":","")} ${C}`,M(),T.onfocus=()=>{I.classList.add("focus")},T.onblur=()=>{I.classList.remove("focus")},T.onkeyup=()=>{z.disabled=""===T.value},z.onclick=t=>{if(""===T.value)return;i._refreshCurrentUser();const l={text:T.value,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:i._currentUser.info?i._currentUser.info.id:-1,time:new Date},n=i._createComment(l);if(!n)return t.preventDefault(),void t.stopPropagation();R(n),B(n),o.push(l),i.$.fireEvent("commentAdd",{id:a.id,value:l}),i.onComment&&i.onComment(a.id,o),T.value="",z.disabled=!0,M(),E.appendChild(n),(()=>{const t=e._rowComments;if(H(),E.innerHTML=`<span class="no-comments"><span>${i.localize("noComments")}</span></span>`,M(),e.classList.contains("open"))for(let e=0;e<t.length;e++){const a=t[e],l=i._createComment(a);R(l),B(l),E.appendChild(l)}else clearInterval(i._commentUpdateInterval)})(),T.focus();const r=o.length?"("+o.length+")":"";A.innerHTML=F.lastElementChild.lastElementChild.innerHTML=`${i.localize("comments").replace(":","")} <span>${r}</span>`,E.scrollTop=E.scrollHeight,t.preventDefault(),t.stopPropagation()},!l)for(let e=0;e<i.columns.length;e++){const t=i.columns[e];if(!t.allowEdit||!1===t._visible)continue;const a=document.createElement("div");a.classList.add("smart-grid-edit-dialog-row"),s.appendChild(a),"textarea"!==t.editor.template&&"input"!==t.editor.template||(a.style.gridColumn="span 2",a.previousElementSibling&&!a.previousElementSibling.style.gridColumn&&e<i.columns.length&&(a.previousElementSibling.style.gridColumn="span 2",a.previousElementSibling.previousElementSibling&&!a.previousElementSibling.previousElementSibling.style.gridColumn&&e<i.columns.length-1&&(a.previousElementSibling.previousElementSibling.style.gridColumn="span 2")));const l=document.createElement("div"),n=i._settingsDialogRowId?document.createElement("div"):document.createElement("label"),o=t.validationRules&&t.validationRules.length>0?"*":"";n.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${i.columns[e].icon} show"></span><label>`+i.columns[e].label+o+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template);const c=n.querySelector("[toggle]");c.column=t,r[t.dataField]=t.visible,c.title=i.localize("columnMenuItemHide"),!1===i.editing.enabled&&c.classList.add("smart-visibility-hidden"),c.onclick=()=>{r[c.column.dataField]=!c.column.visible,c.classList.contains("smart-icon-visibility-on")?(c.classList.remove("smart-icon-visibility-on"),c.classList.add("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemShow")):(c.classList.add("smart-icon-visibility-on"),c.classList.remove("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemHide"))},t.visible||(c.classList.remove("smart-icon-visibility-on"),c.title=i.localize("columnMenuItemShow")),t.visible?c.classList.add("smart-icon-visibility-on"):c.classList.add("smart-icon-visibility-off"),l.appendChild(n),l.appendChild(d);const u=document.createElement("label");u.classList.add("smart-field-editor-error-label"),u.setAttribute("label-for",t.dataField),l.appendChild(u),a.appendChild(l)}}_getDateFormat(e){const t=new Smart.Utilities.DateTime(e),a=((new Date).getTime()-e.getTime())/1e3,l=Math.floor(Math.abs(a));if(""===this.locale||"en"===this.locale)return 0===l?"now":l<60?l+"s ago":l<3600?Math.floor(l/60)+"m ago":l<86400?Math.floor(l/3600)+"h ago":t.toString("dd/MM/yyyy hh:mm");t.toString("dd/MM/yyyy hh:mm")}_refreshHistory(){const e=this,t=e._dialogEdit;if(!t)return;const a=t.querySelector(".history");if(!e.storeHistory)return void a.classList.add("smart-hidden");if(!e._currentUser||e._currentUser&&!e._currentUser.info)return void a.classList.add("smart-hidden");a.classList.remove("smart-hidden");const l=t.row.history;if(!l)return;let i="\n ";for(let t=0;t<l.length;t++){const a=l[t];let n="";if(e._kanban)n=e._kanban._getHistoryItemLabel(a);else if("created"===a.action)n=e.localize("rowCreated",{value:a.action});else{const t=e.columnByDataField[a.action];n=e.localize("propertyUpdated",{value:t?"<strong>"+t.label+"</strong>":"<strong>"+a.action+"</strong>"})}i+='<div class="history-row">';const o=t=>{const a=t?t.image:null;let l=t?t.name||t.id:e.localize("guestUser");const i=a?"image":"",n=a?`background-image: url('${a}');`:"";return e._currentUser.info&&t.id===e._currentUser.info.id&&(""!==e.locale&&"en"!==e.locale||(l="You")),{image:n,label:l,cssClass:i}};let r="";if(void 0!==a.user){const t=o(e.users.find((e=>e.id===a.user)));i+=`<div class="history-indent"><div class="user-icon smart-icon ${t.cssClass}" style="${t.image}"></div></div>`,r=`<div class="history-header"><div class="user-name">${t.label}</div><div class="time">${e._getDateFormat(new Smart.Utilities.DateTime(a.date).toDate())}</div></div>`}else i+='<div class="history-indent"><div class="user-icon smart-icon"></div></div>',r='<div class="history-header"><div class="user-name"></div><div class="time"></div></div>';if(i+='<div class="history-main">',i+=r,i+=`<div class="history-body"><div class="title">${n}</div>`,"created"!==a.action){let t=a.details.oldValue,l=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t||e.id===parseFloat(t))),i=e.users.find((e=>e.id===l||e.id===parseFloat(l)));a?t=a.name:(t="",t||(t=e.localize("unassigned"))),i?l=i.name:(l="",l||(l=e.localize("unassigned")))}if("subtasks"===a.action){let t=[];"string"==typeof a.details.value?a.details.value.split(",").forEach((e=>{e.indexOf(": Y")>=0&&t.push(e)})):t=a.details.value.filter((e=>e.completed)),e._kanban?i+=`<span class="detail">${e._kanban.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span>`:i+=`<span class="detail">${e.localize("completed",{value:t.length})}</span>`}else{t&&"object"==typeof t&&t instanceof Date&&(t=e._getDateFormat(t)),l&&"object"==typeof l&&l instanceof Date&&(l=e._getDateFormat(l));let n=e.columnByDataField[a.action];if(n||(n=e.columnByDataField["task"+a.action.substring(0,1).toUpperCase()+a.action.substring(1)]),"user"===a.action&&(n=e.columnByDataField.taskUserId),n&&n.editor&&n.editor.dataSource){for(let e=0;e<n.editor.dataSource.length;e++){const a=n.editor.dataSource[e];a.value===t&&(t=a.label),a.value===l&&(l=a.label)}t||(t=e.localize("unassigned")),l||(l=e.localize("unassigned"))}let o="";n&&n.label&&(o="<strong>"+n.label+"</strong>"),n&&"date"===n.dataType?(t&&"string"==typeof t&&(t=e._getDateFormat(new Date(t))),l&&"string"==typeof l&&(l=e._getDateFormat(new Date(l)))):(t&&"string"==typeof t&&(t=e._fromHTMLEntities(t)),l&&"string"==typeof l&&(l=e._fromHTMLEntities(l))),i+=t?`<div class="detail">${e.localize("range",{column:o,oldValue:"<i>"+t+"</i>",newValue:"<i>"+l+"</i>"})}</div>`:`<div class="detail">${e.localize("nullRange",{column:o,oldValue:"<i>"+t+"</i>",newValue:"<i>"+l+"</i>"})}</div>`}}else i+=`<div>${a.details.value}</div>`;i+="",i+="</div>",i+="</div>\n </div>"}i+="",a.innerHTML=i,setTimeout((()=>{a.scrollTop=a.scrollHeight}))}_createComment(e){const t=this,a=t.users.find((t=>t.id===e.userId));if(!a)return;const l=document.createElement("div"),i=a?a.name||a.id:t.localize("guestUser"),n=a.image?a.image:"";let o=a?a.name:t.localize("guestUser");t._currentUser.info&&a.id===t._currentUser.info.id&&(""!==t.locale&&"en"!==t.locale||(o="You")),e.text&&/<.+?>/.test(e.text)&&e.text.replace&&("all"===t.dataSourceSettings.sanitizeHTML?e.text=e.text.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===t.dataSourceSettings.sanitizeHTML&&(e.text=window.Smart.Utilities.Core.escapeHTML(e.text)));let r=e.text;if(r.indexOf("@")>=0)for(let e=0;e<t.users.length;e++){const a=t.users[e];if(r.indexOf("@"+a.name)>=0){let e=`<div style="border:1px solid var(--smart-border); position:relative; top: -3px; border-radius: 15px; padding-right: 6px; background: var(--smart-surface); align-items: center; display: inline-flex;"><div class="user-icon smart-icon" role="img" aria-label="Icon of user ${a.name}"></div><span>${a.name}</span></div>`;a.image&&(e=`<div style="border:1px solid var(--smart-border); position:relative; top: -3px; border-radius: 15px; padding-right: 6px; background: var(--smart-surface); align-items: center; display: inline-flex;"><div style="width: 24px; height: 24px; background-image: url('${a.image}');" class="image user-icon smart-icon" role="img" aria-label="Icon of user ${a.name}"></div><span>${a.name}</span></div>`),r=r.replaceAll("@"+a.name,e)}}l.className="comment",l.setAttribute("role","listitem");let s=e.time?e.time:"";if(""!==s){s=new Smart.Utilities.DateTime(e.time);const a=((new Date).getTime()-s.toDate().getTime())/1e3,l=Math.floor(Math.abs(a));s=""!==t.locale&&"en"!==t.locale?s.toString("dd/MM/yyyy hh:mm"):0===l?"now":l<60?l+"s ago":l<3600?Math.floor(l/60)+"m ago":l<86400?Math.floor(l/3600)+"h ago":s.toString("dd/MM/yyyy hh:mm")}if(l.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${i}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${o}</div>\n <div class="edit-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n <div class="remove-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n <div class="time" aria-label="Comment time">${s}</div>\n</div>\n<div class="comment-body" aria-label="Comment text">${r||""}</div >\n</div>`,n){const e=l.querySelector(".user-icon");e.style.backgroundImage=`url('${n}')`,e.classList.add("image")}l.comment=e;const d=l.querySelector(".remove-button");d.comment=e,d.element=l,e.userId!==t._currentUser.info.id&&d.classList.add("smart-visibility-hidden");const c=l.querySelector(".edit-button");return c.comment=e,c.element=l,e.userId!==t._currentUser.info.id&&c.classList.add("smart-visibility-hidden"),l}_openSummaryRowDialog(e){const t=this,a=t._summaryRowDialog||t._createDialog(),l="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(a.header.innerHTML=l,!a.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",a.content.innerHTML="",a.listBox=e}const i=a.listBox;a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser");const n=e.element.querySelector(".summary-value");if(!n)return;n.classList.add("summary-chooser"),a.summaryValueElement=n;let o=[];a.dataField=e.column.dataField,"string"===e.column.dataType?(o=[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}],e.column.editor&&e.column.editor.dataSource&&e.column.editor.singleSelect&&o.push({label:t.localize("statusSummary"),value:"status"})):o="boolean"===e.column.dataType||"any"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"}]:"date"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:[{label:t.localize("countSummary"),value:"count"},{label:t.localize("minSummary"),value:"min"},{label:t.localize("maxSummary"),value:"max"},{label:t.localize("sumSummary"),value:"sum"},{label:t.localize("avgSummary"),value:"avg"}],i.dataSource=o,i.style.position="absolute",i.style.visibility="hidden",i.style.height="auto",t.isInShadowDOM?t.getRootNode().appendChild(i):document.body.appendChild(i);const r=e.column;r.summary&&r.summary.forEach((e=>{i.select(e)}));const s=i.offsetHeight;a.column=r,a.content.appendChild(i),a.classList.add("smart-grid-dialog-summary"),a.header.parentElement.classList.add("smart-hidden"),a.footer.classList.add("smart-hidden"),i.style.visibility="",i.style.position="",i.style.width="100%",t._summaryRowDialog||(a.btnConfirm.innerHTML=t.localize("apply"),a.btnCancel.innerHTML=t.localize("cancel"),a.style.width=a.style.minWidth="120px",a.onOpen=function(){t.editing.dialog.visible=!0},a.onClose=function(){t.editing.dialog.visible=!1,a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser")},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e=a.column.summary;a.column.summary=i.selectedValues,t.$.fireEvent("columnSummaryChange",{column:a.column,dataField:r.dataField,oldSummary:[...e],summary:[...a.column.summary]}),a.close(),t._calculateSummary(),t._recycle(!1)},a.confirm=function(){a.btnConfirm.click()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},t._summaryRowDialog=a);const d=e.element,c=t.offset(d),u=t.offset(t);let m=d.offsetWidth+c.left-u.left-120;m<0&&(m=c.left-u.left),a.open(m,c.top-u.top-s-0),setTimeout((function(){a.btnConfirm.focus()}),100)}_openTextAreaDialog(e,t,a){const l=this;delete l._dialogTextArea;const i=l._dialogTextArea||l._createDialog();if(i.header.innerHTML=e.label,i.column=e,i.classList.add("smart-grid-textarea-dialog"),i.style.minWidth="250px",i.style.minHeight="250px",i.style.zIndex=99999,i.textarea=t,"richText"!==e.template?i.initialValue=t.value:i.initialValue=t.getHTML(),i.cell=a,!l._dialogTextArea){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonSave"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i.onOpen=function(){const t=i.querySelector("smart-text-area");t.value=i.textarea.value,t.onchange=t.oninput=()=>{setTimeout((()=>{"richText"===e.template?i.textarea.setHTML(t.getHTML()):i.textarea.value=t.value}))},l.editing.enabled&&setTimeout((()=>{t.focus()}),250)},i.onClose=function(){};const t=()=>{const e=document.querySelector(".smart-grid-text-area-dialog");e&&e.remove()};i.btnCancel.onclick=function(){if(i.close(),l.editing.dialog.enabled)return i.textarea.value=i.initialValue,void t();l.cancelEdit(),t()},i.btnClose.onclick=function(){if(i.close(),l.editing.dialog.enabled)return i.textarea.value=i.initialValue,void t();l.cancelEdit(),t()},i.btnConfirm.onclick=function(){if(i.close(),l.editing.dialog.enabled)return t(),void i.cell.editor.instance.setValue(i.textarea.value);i.cell.editor.instance.setValue(i.textarea.value),t(),l.endEdit()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},l._dialogTextArea=i;const a=document.createElement("smart-text-area");a.classList.add("smart-text-area"),a.resize="both","richText"===e.template&&(a.richText=!0),a.users=l.users,a.style.resize="both",a.minWidth=350,a.style.minWidth="350px",a.style.minHeight="250px",a.style.width="450px",a.style.height="400px",a.minHeight=250,i.input=a,i.content.appendChild(a)}const n=l.offset(t),o=l.offset(l);i.open(n.left-o.left+e.computedWidth,n.top-o.top),setTimeout((function(){if("auto"!==i.style.height){const e=i.input;e.style.width="450px",e.style.height="400px",i.style.height="auto",i.style.width="auto",e.resize="both"}if(i.offsetHeight+n.top-o.top>window.innerHeight&&(i.style.top=o.top+"px",i.style.left=o.left+"px",i.style.width=l.offsetWidth+"px",i.style.height=l.offsetHeight+"px",i.input.style.width=l.offsetWidth-20+"px",i.input.style.height=l.offsetHeight-20+"px",i.input.resize="none"),n.left-o.left+e.computedWidth+i.offsetWidth>window.innerWidth){let t=n.left-o.left+e.computedWidth-i.offsetWidth;i.style.left=Math.max(t,0)+"px"}i.btnConfirm.focus()}),100)}_openDescriptionDialog(e,t){const a=this,l=a._dialogDescription||a._createDialog(),i=a.localize("dialogDescriptionHeader",{value:e.label});if(l.header.innerHTML=i,l.column=e,l.command=t,l.classList.add("smart-grid-dialog-add-column"),!a._dialogDescription){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),l.onOpen=function(){const e=l.querySelector("smart-input");"duplicate"!==t&&setTimeout((()=>{e.select()}),250)},l.onClose=function(){},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){const e=l.querySelector("smart-input");switch(l.command){case"duplicate":0===e.selectedIndex?a.duplicateCommand(l.column,null,!0):a.duplicateCommand(l.column,null,!1);break;case"rename":l.column.label=e.value;break;case"editDescription":l.column.description=e.value}l.close()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogDescription=l;const e=document.createElement("smart-input");e.classList.add("underlined"),e.dataSource="duplicate"!==t?[]:[{label:a.localize("duplicateCells"),value:"cells"},{label:a.localize("duplicateSettings"),value:"settings"}],l.content.appendChild(e)}const n=e.element,o=a.offset(n),r=a.offset(a);l.open(o.left-r.left,o.top+n.offsetHeight-r.top);const s=l.querySelector("smart-input");switch(s.selectedIndex=0,s.readonly=!0,s.dropDownButtonPosition="right",t){case"rename":s.value=e.label;break;case"editDescription":s.value=e.description}setTimeout((function(){l.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const a=this;if(!a.editing.deleteDialog.enabled)return!1;const l=a._dialogDelete||a._createDialog(),i="{{message}}"===a.editing.dialog.header?a.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):a.editing.dialog.header;l.header.innerHTML=i,l.content.innerHTML=a.localize("dialogDeleteContent"),l.row=e,a._dialogDelete||(l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogDeleteButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogDeleteButtonCancel"),l.onOpen=function(){a.editing.dialog.visible=!0},l.onClose=function(){a.editing.dialog.visible=!1},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){t(l.row),l.close()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogDelete=l),l.open(),setTimeout((function(){l.btnConfirm.focus()}),100)}_getTypesList(){const e=this,t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"image",prefix:'<span class="smart-grid-icon visible smart-icon-image"></span>',label:e.localize("dialogAddColumnTypeImage")},{value:"number",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeNumber")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")},{value:"boolean",prefix:'<span class="smart-grid-icon visible smart-icon-check-squared"></span>',label:e.localize("dialogAddColumnTypeCheckBox")},{value:"attachment",prefix:'<span class="smart-grid-icon visible smart-icon-docs"></span>',label:e.localize("dialogAddColumnTypeAttachment")},{value:"date",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDate")},{value:"duration",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDuration")},{value:"time",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeTime")},{value:"createdTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeCreatedTime")},{value:"updatedTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedTime")},{value:"createdBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCreatedBy")},{value:"updatedBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedBy")},{value:"collaborator",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCollaborator")},{value:"slider",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeSlider")},{value:"formula",prefix:'<span class="smart-grid-icon visible smart-icon-math"></span>',label:e.localize("dialogAddColumnTypeFormula")},{value:"autoNumber",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeAutoNumber")},{value:"url",prefix:'<span class="smart-grid-icon visible smart-icon-link"></span>',label:e.localize("dialogAddColumnTypeURL")},{value:"email",prefix:'<span class="smart-grid-icon visible smart-icon-mail"></span>',label:e.localize("dialogAddColumnTypeEmail")},{value:"phone",prefix:'<span class="smart-grid-icon visible smart-icon-phone"></span>',label:e.localize("dialogAddColumnTypePhone")},{value:"password",prefix:'<span class="smart-grid-icon visible smart-icon-lock"></span>',label:e.localize("dialogAddColumnTypePassword")},{value:"rating",prefix:'<span class="smart-grid-icon visible smart-icon-star"></span>',label:e.localize("dialogAddColumnTypeRating")}];if(e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length&&t.splice(17,0,{value:"relationId",prefix:'<span class="smart-grid-icon visible smart-icon-table-alt"></span>',label:e.localize("dialogAddColumnTypeRowLink")}),e.header.visible&&e.header.buttons.indexOf("views")>=0){const a={value:"progress",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeProgress")},l={value:"priority",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypePriority")},i={value:"status",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("status")},n={value:"tags",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeTags")},o={value:"checklist",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeChecklist")},r={value:"color",prefix:'<span class="smart-grid-icon visible smart-icon-color-background"></span>',label:e.localize("dialogAddColumnTypeColor")};t.push(a),t.push(l),t.push(n),t.push(o),t.push(r),t.push(i)}return t}_getAddStackColumnDialogTemplate(){const e=this,t=[];let a=!1,l="";for(let i=0;i<e.columns.length;i++){const n=e.columns[i];(n.statusColumn||"taskStatus"===n.dataField||"taskStatus"===n._dataField||n.editor&&n.editor.dataSource&&n.editor.dataSource.length&&n.editor.singleSelect)&&(t.push({label:n.label,value:n.dataField}),e._stackedBy===n.dataField&&(t[t.length-1].checked=!0,a=!0,l=t[t.length-1].label))}const i=t.concat([{value:"blank",label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]);return a||(i[0].checked=!0,l=i[0].label),[{bind:"kanban",name:"kanban",type:"radio",label:2===i.length?e.localize("kanbanNoneDescription"):e.localize("kanbanDescription",{column:l}),filter:"kanban",options:i},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""}]}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),a=new Date(t,6,30);return[{bind:"kanban",name:"kanban",type:"radio",label:e.localize("kanbanNoneDescription"),filter:"kanban",options:[{value:"blank",checked:!0,label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"description",type:"input",label:e.localize("dialogAddColumnDescription"),filter:"any",placeholder:e.localize("dialogAddColumnDescriptionPlaceholder"),info:e.localize("dialogAddColumnDescriptionInfo")},{bind:"type",name:"typeslist",type:"dropDownList",filter:"any",label:e.localize("dialogAddColumnType"),icon:"smart-icon-font",options:e._getTypesList(),info:e.localize("dialogAddColumnTypeInfo")},{bind:"dateFormat",name:"dateformat",type:"dropDownList",label:e.localize("dialogAddColumnDateFormat"),options:[{value:"M/d/yyyy",label:e.localize("dialogAddColumnDateFormatShort")+" ("+new Smart.Utilities.DateTime(a).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(a).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(a).toString("ISO8601")+")"},{value:"d/M/yyyy",label:e.localize("dialogAddColumnDateFormatEU")+" (30/7/"+t+")"},{value:"yyyy-MM-dd",label:e.localize("dialogAddColumnDateFormatAS")+" ("+t+"-30-07)"},{value:"MMMM, dd, yyyy",label:e.localize("dialogAddColumnDateFormatFull")+" (July, 30, "+t+")"}],filter:"date",info:e.localize("dialogAddColumnDateFormatInfo")},{bind:"timeFormat",name:"timeformat",type:"dropDownList",label:e.localize("dialogAddColumnTimeFormat"),filter:"time",width:"50%",options:[{value:"hh:mm tt",label:"12 "+e.localize("dialogAddColumnTimeFormatHour")},{value:"HH:mm",label:"24 "+e.localize("dialogAddColumnTimeFormatHour")}],info:e.localize("dialogAddColumnTimeFormatInfo")},{bind:"allowTimeFormat",type:"boolean",label:e.localize("dialogAddColumnAllowTimeFormat"),filter:"date",width:"50%",value:!1,info:""},{bind:"allowCustomDateSeparator",type:"boolean",label:e.localize("dialogAddColumnCustomDateSeparator"),filter:"date",width:"50%",value:!1,info:""},{bind:"dateFormatSeparator",name:"dateFormatSeparator",type:"radio",label:"",filter:"date",width:"100%",columns:3,options:[{value:"/",label:e.localize("dialogAddColumnDateFormatSlash")+" (/)"},{value:"-",label:e.localize("dialogAddColumnDateFormatHyphen")+" (-)"},{value:".",label:e.localize("dialogAddColumnDateFormatDot")+" (.)"}]},{bind:"numberFormat",name:"numberFormat",type:"dropDownList",label:e.localize("dialogAddColumnNumberFormat"),filter:"number",options:[{value:{style:"decimal",maximumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatInteger")+" 1,000"},{value:{style:"decimal",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatNumber")+" 1,000.12"},{value:{style:"percent",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatPercent")+" 10.12%"},{value:{style:"percent",maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatPercentRounded")+" 10%"},{value:{style:"decimal",notation:"scientific"},label:e.localize("dialogAddColumnNumberFormatScientific")+" 1.01E+03"},{value:{style:"decimal",notation:"engineering"},label:e.localize("dialogAddColumnNumberFormatEngineering")+" 34.284 x 10^9"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,currencySign:"accounting"},label:e.localize("dialogAddColumnNumberFormatAccounting")+" $(1,000.12)"},{value:{style:"unit",unit:"kilogram"},label:e.localize("dialogAddColumnNumberFormatUnit")+" 10.12 kg"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency},label:e.localize("dialogAddColumnNumberFormatCurrency")+" $1,000.12"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatCurrencyRounded")+" $1,000"}],required:!1,info:e.localize("dialogAddColumnNumberFormatInfo")},{bind:"currency",name:"currency",type:"dropDownList",filter:"number",required:!1,options:e._getCurrencies(),label:e.localize("dialogAddColumnNumberFormatCurrency"),info:e.localize("dialogAddColumnNumberFormatCurrencyInfo")},{bind:"unit",name:"unit",type:"dropDownList",filter:"number",required:!1,options:[{value:"acre",label:e.localize("dialogAddColumnNumberFormatUnitAcre")},{value:"percent",label:e.localize("dialogAddColumnNumberFormatUnitPercent")},{value:"degree",label:e.localize("dialogAddColumnNumberFormatUnitDegree")},{value:"megabyte",label:e.localize("dialogAddColumnNumberFormatUnitMegaByte")},{value:"centimeter",label:e.localize("dialogAddColumnNumberFormatUnitCentimeter")},{value:"meter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")},{value:"squaremeter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")+"²"},{value:"cubicmeter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")+"³"},{value:"kilometer",label:e.localize("dialogAddColumnNumberFormatUnitKilometer")},{value:"mile",label:e.localize("dialogAddColumnNumberFormatUnitMile")},{value:"celsius",label:e.localize("dialogAddColumnNumberFormatUnitCelsius")},{value:"fahrenheit",label:e.localize("dialogAddColumnNumberFormatUnitFahrenheit")},{value:"kilogram",label:e.localize("dialogAddColumnNumberFormatUnitKilogram")},{value:"pound",label:e.localize("dialogAddColumnNumberFormatUnitPound")},{value:"liter",label:e.localize("dialogAddColumnNumberFormatUnitLiter")},{value:"gallon",label:e.localize("dialogAddColumnNumberFormatUnitGallon")},{value:"second",label:e.localize("dialogAddColumnNumberFormatUnitSecond")},{value:"minute",label:e.localize("dialogAddColumnNumberFormatUnitMinute")},{value:"hour",label:e.localize("dialogAddColumnNumberFormatUnitHour")},{value:"day",label:e.localize("dialogAddColumnNumberFormatUnitDay")},{value:"week",label:e.localize("dialogAddColumnNumberFormatUnitWeek")},{value:"month",label:e.localize("dialogAddColumnNumberFormatUnitMonth")},{value:"year",label:e.localize("dialogAddColumnNumberFormatUnitYear")}],label:e.localize("dialogAddColumnNumberFormatUnit"),info:e.localize("dialogAddColumnNumberFormatUnitInfo")},{bind:"allowThousandsSeparator",name:"allowThousandsSeparator",type:"boolean",label:e.localize("dialogAddColumnNumberFormatSeparator"),filter:"number",value:!0,info:""},{bind:"minLength",name:"minlength",width:"50%",type:"number",filter:"text",required:!1,label:e.localize("dialogAddColumnMinLength"),info:e.localize("dialogAddColumnMinLengthInfo")},{bind:"maxLength",name:"maxlength",width:"50%",filter:"text",type:"number",required:!1,label:e.localize("dialogAddColumnMaxLength"),info:e.localize("dialogAddColumnMaxLengthInfo")},{bind:"minValue",name:"minvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMinValue"),info:e.localize("dialogAddColumnMinValueInfo")},{bind:"maxValue",name:"maxvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMaxValue"),info:e.localize("dialogAddColumnMaxValueInfo")},{bind:"minDateTime",name:"mindatetime",type:"datetime",filter:"date",width:"50%",label:e.localize("dialogAddColumnMinDate"),info:e.localize("dialogAddColumnMinDateInfo")},{bind:"maxDateTime",name:"maxdatetime",type:"datetime",width:"50%",filter:"date",label:e.localize("dialogAddColumnMaxDate"),info:e.localize("dialogAddColumnMaxDateInfo")},{bind:"deadline",name:"deadline",type:"dropDownList",label:e.localize("dialogAddColumnTypeDueDateSettings"),info:e.localize("dialogAddColumnTypeDueDateSettingsInfo"),filter:"date",options:[{value:"",label:e.localize("dialogAddColumnTypeNone")},{value:"dueDate",label:e.localize("dialogAddColumnTypeDueDate")},{value:"startDate",label:e.localize("dialogAddColumnTypeStartDate")}]},{bind:"deadlineStatus",name:"deadlineStatus",type:"dropDownList",label:e.localize("dialogAddColumnTypeStatus"),info:e.localize("dialogAddColumnTypeStatusInfo"),filter:"date",options:[]},{bind:"deadlineDueDate",name:"deadlineDueDate",type:"dropDownList",label:e.localize("dialogAddColumnTypeDueDate"),info:"",filter:"date",options:[]},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"allowCheckItems",type:"boolean",filter:"hidden",value:!1,label:e.localize("dialogAddColumnCheckItems"),info:""},{bind:"allowMultipleCollaborators",type:"boolean",filter:"collaborator",value:!1,label:e.localize("dialogAddColumnMultipleCollaborators"),info:e.localize("dialogAddColumnMultipleCollaboratorsInfo")},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""},{bind:"users",name:"users",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"collaborator",info:""},{bind:"formula",type:"formula",filter:"formula",info:e.localize("dialogAddColumnFormulaInfo"),label:e.localize("dialogAddColumnFormula")},{bind:"relationMultiField",name:"relationMultiField",type:"boolean",value:!1,filter:"relationId",label:e.localize("dialogAddColumnLinkSelect")},{bind:"relationId",name:"relationId",type:"relationId",label:e.localize("dialogAddColumnLinkListItems"),filter:"relationId",info:""},{name:"align",bind:"cellsAlign",type:"dropDownList",label:e.localize("dialogAddColumnAlign"),required:!1,options:[{value:"left",label:e.localize("dialogAddColumnAlignLeft")},{value:"right",label:e.localize("dialogAddColumnAlignRight")},{value:"center",label:e.localize("dialogAddColumnAlignCenter")}],filter:"any",info:e.localize("dialogAddColumnAlignInfo")},{bind:"defaultString",name:"defaultString",type:"input",filter:"text",required:!1,label:e.localize("dialogAddColumnDefault")},{bind:"defaultNumber",name:"defaultNumber",type:"number",filter:"number",required:!1,label:e.localize("dialogAddColumnDefault")},{bind:"defaultDate",name:"defaultDate",type:"dropDownList",label:e.localize("dialogAddColumnDefault"),filter:"date",options:[{value:"current",label:e.localize("dialogAddColumnDefaultDateCurrent")},{value:"specific",label:e.localize("dialogAddColumnDefaultDateSpecific")}]},{bind:"defaultDateValue",name:"defaultDateValue",type:"datetime",filter:"date",label:e.localize("placeholderValue")},{bind:"setDefaultValue",type:"boolean",label:e.localize("dialogAddColumnDefault"),width:"50%",filter:"any",value:!1,info:""},{bind:"allowResize",type:"boolean",filter:"any",width:"50%",label:e.localize("dialogAddColumnResizable"),info:e.localize("dialogAddColumnResizableInfo")},{bind:"allowRichText",type:"boolean",filter:"multiText",width:"50%",value:!1,label:e.localize("dialogAddColumnFormatting"),info:""},{bind:"required",type:"boolean",width:"50%",filter:"any",value:!1,label:e.localize("dialogAddColumnRequired"),info:e.localize("dialogAddColumnRequiredInfo")},{bind:"allowSort",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnSortable"),info:e.localize("dialogAddColumnSortableInfo")},{bind:"allowFilter",type:"boolean",align:"left",width:"50%",filter:"any",label:e.localize("dialogAddColumnFilterable"),info:e.localize("dialogAddColumnFilterableInfo")},{bind:"allowEdit",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnEditable"),info:e.localize("dialogAddColumnEditableInfo")}]}_getKanbanFields(){return["startDate","dueDate","progress","checklist","priority","tags","name","color","description","status"]}_addColumnDialogShowHideEditors(e){const t=this,a=e.editColumn,l=e.querySelector('[bind="type"]'),i=l?l.querySelector("smart-input"):null,n=l?i.getSelectedItem().value:"kanban",o=e.querySelectorAll(".smart-grid-dialog-editor"),r=t._getKanbanFields(),s=e.querySelector('[field-name="kanbanNotes"]');s&&("kanban"!==t.view?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"));const d=t=>{const a=e.querySelector('[field-name="defaultDate"]'),l=e.querySelector('[field-name="defaultDateValue"]');if(!t)return a.classList.add("smart-hidden"),void l.classList.add("smart-hidden");a.classList.remove("smart-hidden"),"specific"===t?(l.classList.remove("smart-hidden"),l.style.width="50%",l.style.float="left",a.style.width="50%",a.style.float="left",a.style.clear="both"):(l.classList.add("smart-hidden"),l.style.width="",l.style.float="",a.style.width="",a.style.float="")};let c=!!a;if(a){switch(e.columnType||n){case"createdTime":case"updatedTime":case"createdBy":case"updatedBy":case"autoNumber":case"image":case"progress":case"color":case"collaborator":case"attachment":c=!0;break;default:c=!1}"checklist"!==a.template&&"color"!==a.template||(c=!0),!1===a.allowTypeChange&&(c=!0)}for(let l=0;l<o.length;l++){const i=o[l],s=i.getAttribute("filter"),u=i.getAttribute("bind"),m=i.parentNode;if("deadlineStatus"!==u&&"deadlineDueDate"!==u)if(m.classList.add("smart-hidden"),"cellsAlign"===u&&("boolean"===n||"attachment"===n||"image"===n||"email"===n||"url"===n||"collaborator"===n||"createdBy"===n||"password"===n||"phone"===n||"createdTime"===n||"rating"===n||"updatedBy"===n||"updatedTime"===n||r.indexOf(n)>=0))m.classList.add("smart-hidden");else if("type"===u&&c)m.classList.add("smart-hidden");else if("allowEdit"!==u||!1!==t.editing.enabled&&"autoNumber"!==n&&"createdBy"!==n&&"updatedBy"!==n&&"createdTime"!==n&&"updatedTime"!==n)if("allowResize"!==u||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==u||!1!==t.filtering.enabled)if("allowSort"!==u||!1!==t.sorting.enabled)if("required"!==u||!1!==t.editing.enabled&&("string"===n||"multiText"===n||"name"===n||"description"===n||"select"===n||"collaborator"===n||"multiSelect"===n||"select"===n||"priority"===n))if(a&&a.disabledDialogOptions&&a.disabledDialogOptions.length>0&&a.disabledDialogOptions.indexOf(u)>=0)m.classList.add("smart-hidden");else{if(a&&"kanban"===t.view){switch(u){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":m.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===s&&m.classList.remove("smart-hidden")}if("deadline"!==u)if("setDefaultValue"!==u){if(a&&a.editor&&a.editor.collaborator)switch(u){case"options":m.classList.add("smart-hidden");continue;case"users":m.classList.remove("smart-hidden");continue}if("name"!==u||"kanban"!==t.view)if("any"!==s)switch(n){default:case"text":"text"!==s&&"multiText"!==s||("multiText"===s&&"string"===n?m.classList.add("smart-hidden"):m.classList.remove("smart-hidden")),a&&"any"===a.dataType&&m.classList.add("smart-hidden");break;case"slider":case"number":if("number"===s&&m.classList.remove("smart-hidden"),"unit"===u||"currency"===u||"allowThousandsSeparator"===u){m.classList.add("smart-hidden");const t=e.querySelector('[field-name="allowThousandsSeparator"]'),a=e.querySelector('[field-name="numberFormat"]'),l=e.querySelector('[field-name="unit"]'),i=e.querySelector('[field-name="currency"]'),n=a.querySelector("smart-input"),o=()=>{const e=n.getSelectedItem();i.classList.add("smart-hidden"),t.classList.add("smart-hidden"),e&&"decimal"===e.value.style&&!e.value.notation&&t.classList.remove("smart-hidden"),e&&"unit"===e.value.style?l.classList.remove("smart-hidden"):e&&"currency"===e.value.style?i.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};a.onchange=()=>{o()},o()}break;case"select":case"multiSelect":s.indexOf("list")>=0&&m.classList.remove("smart-hidden");break;case"collaborator":s.indexOf("collaborator")>=0&&m.classList.remove("smart-hidden");break;case"createdBy":case"updatedBy":case"autoNumber":case"createdTime":case"updatedTime":case"url":case"email":case"image":case"attachment":case"phone":case"password":case"progress":case"rating":case"checklist":case"priority":case"tags":case"name":case"description":case"assigned":case"status":case"color":case"boolean":if("status"===n||"priority"===n||"tags"===n){s.indexOf("list")>=0&&m.classList.remove("smart-hidden");break}break;case"time":{const t=e.querySelector('[field-filter="time"]');t.classList.remove("smart-hidden"),t.style.width="",t.style.float="";break}case"formula":"formula"===u&&m.classList.remove("smart-hidden");break;case"relationId":"relationId"!==u&&"relationMultiField"!==u||m.classList.remove("smart-hidden");break;case"duration":break;case"dueDate":case"startDate":case"date":{const t=e.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;if("defaultDate"===u||"defaultDateValue"===u){const t=e.querySelector('[field-name="defaultDate"]'),l=e.querySelector('[field-name="defaultDateValue"]'),i=t.querySelector(".smart-input"),n=l.querySelector(".smart-input");a&&a.defaultValue?"today"===a.defaultValue?(i.selectedValues=["current"],n.value=null):(i.selectedValues=["specific"],n.value=a.defaultValue):(i.selectedValues=["current"],n.value=null),d(i.selectedValue)}"date"===s&&m.classList.remove("smart-hidden");const l=t=>{const a=e.querySelector('[field-filter="time"]'),l=e.querySelector('[field-name="dateFormat"]');t?(a.classList.remove("smart-hidden"),l.style.width="50%",l.style.float="left"):(a.classList.add("smart-hidden"),l.style.width="",l.style.float="")},n=t=>{const a=e.querySelector('[field-name="allowTimeFormat"]'),l=a.querySelector(".smart-grid-dialog-editor");t.indexOf("T")>=0?(a.classList.add("smart-hidden"),l.uncheck()):a.classList.remove("smart-hidden")},o=t=>{const a=e.querySelector('[field-name="dateFormatSeparator"]');t?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};if("allowTimeFormat"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{l(e)},l(e)}if("dateFormat"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{n(e.detail.value)},n(e)}if("defaultDate"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{d(e.detail.value)},d(e)}if("dateFormatSeparator"===u){const t=e.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;o(t)}if("allowCustomDateSeparator"===u){t.indexOf("T")>=0&&t.indexOf("-")>0&&i.uncheck();const e=i.querySelector(".smart-input").value;i.onchange=e=>{o(e)},o(e)}n(t);break}}else m.classList.remove("smart-hidden");else{const e=t._getAddStackColumnDialogTemplate().find((e=>{if("kanban"===e.bind)return e}));e.options[e.options.length-1].checked||e.options[e.options.length-2].checked?i.classList.remove("smart-hidden"):i.classList.add("smart-hidden")}}else{switch(a&&a.defaultValue&&m.classList.remove("smart-hidden"),n){case"string":case"multiText":case"name":case"description":case"multiSelect":case"boolean":case"date":case"dueDate":case"startDate":case"collaborator":case"number":case"priority":case"status":case"select":m.classList.remove("smart-hidden");break;default:m.classList.add("smart-hidden")}const t=t=>{const a=e.querySelector('[bind="type"]'),l=a?a.querySelector("smart-input"):null,i=a?l.getSelectedItem().value:"kanban",n=e.querySelector('[field-name="defaultDate"]'),o=e.querySelector('[field-name="defaultNumber"]'),r=e.querySelector('[field-name="defaultString"]'),s=e.querySelector('[field-name="defaultDateValue"]'),c=e.querySelectorAll(".smart-default-item-container");n&&(n.classList.add("smart-hidden"),s.classList.add("smart-hidden")),o&&o.classList.add("smart-hidden"),r&&r.classList.add("smart-hidden");for(let e=0;e<c.length;e++)c[e].classList.add("smart-hidden");if(t)if("date"===i||"dueDate"===i||"startDate"===i){if(n){n.classList.remove("smart-hidden"),s.classList.remove("smart-hidden");const e=n.querySelector("smart-input").selectedValues;d(e&&e.length?e[0]:"current")}}else if("number"===i||"slider"===i)o&&o.classList.remove("smart-hidden");else if("string"===i||"multiText"===i||"name"===i||"description"===i)r&&r.classList.remove("smart-hidden");else for(let e=0;e<c.length;e++)c[e].classList.remove("smart-hidden")};i.onchange=e=>{t(e)};const l=e.querySelector('[field-name="setDefaultValue"]'),o=!(!a||null===a.defaultValue||void 0===a.defaultValue)||l.value;t(o)}else m.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("views")>=0&&"date"===n&&m.classList.remove("smart-hidden")}else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden")}}_addColumnDialogInitEditors(e,t,a){const l=this,i=e.editColumn,n=()=>{const e=a.deadline.parentElement.querySelector(".smart-input"),t=a.deadlineStatus.parentElement,l=a.deadlineDueDate.parentElement,i=t.querySelector("smart-input"),n=l.querySelector("smart-input");t.classList.add("smart-hidden"),l.classList.add("smart-hidden"),2===e.selectedIndex?l.classList.remove("smart-hidden"):1===e.selectedIndex&&t.classList.remove("smart-hidden"),i.dataSource&&0===i.dataSource.length&&t.classList.add("smart-hidden"),n.dataSource&&0===n.dataSource.length&&l.classList.add("smart-hidden")};for(let o in a){const r=a[o],s=r.querySelector("input"),d=r.querySelector("smart-input");switch(o){case"allowTimeFormat":{const e=r.querySelector(".smart-input");i&&i.editor?"dateInput"===i.editor.template?(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowRichText":{const e=r.querySelector(".smart-input");i&&"richText"===i.template?(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowCustomDateSeparator":{const e=r.querySelector(".smart-input");e.value=!1,e.removeAttribute("checked");let t=0;i&&i.cellsFormat&&(i.cellsFormat.indexOf(".")>=0?(e.value=!0,e.setAttribute("checked",""),t=2):(i.cellsFormat.indexOf("M-d-yyyy")>=0||i.cellsFormat.indexOf("d-M-yyyy")>=0||i.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(e.value=!0,e.setAttribute("checked",""),t=1));const l=a.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");l.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),l[t].setAttribute("checked",""),l[t].click(),l[t].value=!0;break}case"kanban":{const t=r.querySelectorAll(".smart-grid-dialog-boolean-field");for(let a=0;a<t.length;a++){const i=t[a];i.onchange=a=>{const n=[...a.parentElement.children].indexOf(a),o=a.parentElement.parentElement.previousElementSibling,r=e.querySelector('[field-name="options"]'),s=e.querySelector('[field-name="allowColorItems"]'),d=e.querySelector('[field-name="name"]'),c=()=>{const t=r.querySelector("smart-sortable");t&&(t._validate(),e&&e.offsetHeight&&e.setPosition("center"))};n===t.length-1?(o.innerHTML=l.localize("kanbanBasicDescription"),s.classList.remove("smart-hidden"),r.classList.remove("smart-hidden"),d.classList.remove("smart-hidden"),d.querySelector(".smart-grid-dialog-editor ").classList.remove("smart-hidden"),d.querySelector("smart-input").value=l.localize("dialogNewColumn"),c()):n===t.length-2?(o.innerHTML=l.localize("kanbanNoneDescription"),s.classList.add("smart-hidden"),r.classList.add("smart-hidden"),d.classList.remove("smart-hidden"),d.querySelector(".smart-grid-dialog-editor ").classList.remove("smart-hidden"),d.querySelector("smart-input").value=l.localize("dialogNewColumn"),c()):(o.innerHTML=l.localize("kanbanDescription",{column:i.label.innerHTML}),s.classList.add("smart-hidden"),r.classList.remove("smart-hidden"),r.classList.add("smart-hidden"),d.classList.add("smart-hidden"),d.querySelector("smart-input").value=i.label.innerHTML,d.querySelector(".smart-grid-dialog-editor").classList.add("smart-hidden"),c())}}break}case"dateFormat":i&&i.cellsFormat?i.cellsFormat.indexOf("M/d/yyyy")>=0?d.selectedIndex=0:i.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?d.selectedIndex=1:i.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?d.selectedIndex=2:i.cellsFormat.indexOf("d/M/yyyy")>=0?d.selectedIndex=3:i.cellsFormat.indexOf("yyyy-MM-dd")>=0?d.selectedIndex=4:i.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(d.selectedIndex=5):d.selectedIndex=0;break;case"timeFormat":i&&i.cellsFormat&&i.cellsFormat.indexOf("HH")>=0&&-1===i.cellsFormat.indexOf("T")?d.selectedIndex=1:d.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!1;i&&i.editor&&i.editor.singleSelect&&(e=!1);const t=r.querySelector(".smart-input");i&&e?(t.value=!0,t.setAttribute("checked","")):(t.value=!1,t.removeAttribute("checked"));break}case"allowThousandsSeparator":{const e=r.querySelector(".smart-input");i&&i.editor&&"numberInput"===i.editor.template&&"progress"!==i.template&&"rating"!==i.template?(e.value=!0,e.setAttribute("checked",""),i.editor.numberFormat&&("decimal"!==i.editor.numberFormat.style||i.editor.numberFormat.notation||i.editor.numberFormat.useGrouping||(e.value=!1,e.removeAttribute("checked")))):(e.value=!0,e.setAttribute("checked",""));break}case"numberFormat":if(i&&"numberInput"===i.editor.template&&i.editor.numberFormat)if("decimal"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits)d.selectedIndex=0;else if("decimal"===i.editor.numberFormat.style&&2===i.editor.numberFormat.minimumFractionDigits)d.selectedIndex=1;else if("percent"===i.editor.numberFormat.style&&2===i.editor.numberFormat.minimumFractionDigits)d.selectedIndex=2;else if("percent"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits)d.selectedIndex=3;else if("decimal"===i.editor.numberFormat.style&&"scientific"===i.editor.numberFormat.notation)d.selectedIndex=4;else if("decimal"===i.editor.numberFormat.style&&"engineering"===i.editor.numberFormat.notation)d.selectedIndex=5;else if("currency"===i.editor.numberFormat.style&&"accounting"===i.editor.numberFormat.currencySign)d.selectedIndex=6;else if("unit"===i.editor.numberFormat.style){d.selectedIndex=7;const e=i.editor.numberFormat.unit,t=a.unit.querySelector("smart-input");t.dataSource.forEach(((a,l)=>{if(a.value===e)return t.selectedIndex=l,!0}))}else"currency"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits&&0===i.editor.numberFormat.minimumFractionDigits?d.selectedIndex=9:"currency"===i.editor.numberFormat.style&&(d.selectedIndex=8);else d.selectedIndex=0;break;case"currency":if(i&&"numberInput"===i.editor.template&&i.editor.numberFormat){if("currency"===i.editor.numberFormat.style){const e=l._getCurrencies().findIndex((e=>e.value===i.editor.numberFormat.currency));e>=0&&(d.selectedIndex=e)}}else d.selectedIndex=0;break;case"allowCheckItems":{const e=r.querySelector(".smart-input");i?i.editor&&!i.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowColorItems":{const e=r.querySelector(".smart-input");i?i.editor&&i.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"setDefaultValue":{const e=r.querySelector(".smart-input");i?(e.value=!1,e.removeAttribute("checked"),i&&void 0!==i.defaultValue&&(e.value=!0,e.setAttribute("checked",""))):(e.value=!1,e.removeAttribute("checked"));break}case"defaultString":{const e=r.querySelector("smart-input");i&&void 0!==i.defaultValue&&null!==i.defaultValue?e.value=i.defaultValue:e.value="";break}case"defaultNumber":{const e=r.querySelector("smart-number-input");i&&void 0!==i.defaultValue&&null!==i.defaultValue?e.value=i.defaultValue:e.value=0;break}case"deadline":{const e=r.querySelector(".smart-input");e.selectedIndex=0,e.onchange=()=>{n()},i&&i.editor&&(e.selectedIndex=0,i.editor.onValidate&&"dueDate"!==i.template&&(e.selectedIndex=2),"dueDate"===i.template&&(e.selectedIndex=1)),n();break}case"deadlineStatus":{const t=r.querySelector(".smart-input"),a=[];for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t&&t.editor&&t.editor.dataSource&&t.editor.singleSelect&&a.push({label:t.label,value:t.dataField})}a.length?t.dataSource=[{label:l.localize("dialogAddColumnTypeNone"),value:"none"}].concat(a):t.dataSource=a,e.editColumn&&(t.selectedValue="",e.editColumn&&e.editColumn.editor.boundDataField&&(t.selectedValue=e.editColumn.editor.boundDataField)),a.length||r.parentElement.classList.add("smart-hidden"),n();break}case"deadlineDueDate":{const t=r.querySelector(".smart-input"),a=[];for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t&&"dueDate"===t.template&&a.push({label:t.label,value:t.dataField})}t.dataSource=a,e.editColumn&&(t.selectedValue="",e.editColumn&&e.editColumn.editor.boundDataField&&(t.selectedValue=e.editColumn.editor.boundDataField)),a.length||r.parentElement.classList.add("smart-hidden"),n();break}case"formula":{const t=r.querySelector(".smart-input");t.clearValue(),e.editColumn&&e.editColumn.formula&&(t.value=e.editColumn.formula);break}case"relationId":{const e=r.querySelector(".smart-input");e.dataSource=l._getRelations(),e.clearValue(),e.selectedValue=i?i.relationId:"";const t=r.querySelector(".field-input");t.dataSource=l._getRelationFieldsData(i?i.relationId:-1),t.clearValue(),i&&i.relationField&&(t.selectedValue=i.relationField);break}case"allowResize":case"allowSort":case"allowEdit":case"allowFilter":case"required":{const e=r.querySelector(".smart-input"),a=t.find((e=>{if(e.bind===o)return e}));i?i[o]?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,a&&void 0!==a.value&&(e.value=a.value),e.value&&e.setAttribute("checked",""));break}}if(!i||"options"!==o&&"users"!==o){const e=r.querySelector("smart-sortable");if(e&&e._init)if("users"===o){let t=[];for(let e=0;e<l.users.length;e++)t.push({color:l.users[e].color,label:l.users[e].name,id:l.users[e].id,value:l.users[e].id,image:l.users[e].image});e._init(t)}else e._init()}else{const e=r.querySelector("smart-sortable");if(e&&e._init)if(i.editor.singleSelect){const t=i.editor.dataSource.filter((e=>""!==e));e._init(t)}else if("multiComboInput"===i.editor.template)if("users"===o){let t=[];for(let e=0;e<l.users.length;e++)t.push({color:l.users[e].color,label:l.users[e].name,id:l.users[e].id,value:l.users[e].id,image:l.users[e].image});e._init(t)}else e._init(JSON.parse(JSON.stringify(i.editor.dataSource)))}if(i&&"type"===o?(d.dataSource=l._getTypesList(),"number"===i.dataType||"int"===i.dataType?d.dataSource.length>3&&(d.selectedIndex=3):"date"===i.dataType?d.dataSource.length>3&&(d.selectedIndex=7):"bool"!==i.dataType&&"boolean"!==i.dataType||d.dataSource.length>3&&(d.selectedIndex=6),i.editor&&i.editor.template&&d.dataSource.forEach(((e,t)=>{switch(e.value){case"string":"input"===i.editor.template&&(d.selectedIndex=t);break;case"number":"numberInput"===i.editor.template&&"progress"!==i.template&&"rating"!==i.template&&(d.selectedIndex=t);break;case"select":"multiComboInput"===i.editor.template&&i.editor.singleSelect&&"tags"===i.template&&!i.relationId&&(d.selectedIndex=t);break;case"multiSelect":"multiComboInput"!==i.editor.template||i.editor.singleSelect||"tags"!==i.template||i.relationId||(d.selectedIndex=t);break;case"multiText":"textarea"===i.editor.template&&(d.selectedIndex=t);break;case"date":"dateInput"!==i.editor.template&&"dateTimePicker"!==i.editor.template||(d.selectedIndex=t);break;case"duration":"dateRangeInput"===i.editor.template&&(d.selectedIndex=t);break;case"time":"timeInput"===i.editor.template&&(d.selectedIndex=t);break;case"checkBox":"checkBox"===i.editor.template&&(d.selectedIndex=t);break;case"slider":"slider"===i.editor.template&&(d.selectedIndex=t);break;case"image":"image"===i.editor.template&&(d.selectedIndex=t);break;case"attachment":"attachment"===i.editor.template&&(d.selectedIndex=t);break;case"updatedTime":"updatedTime"===i.template&&(d.selectedIndex=t);break;case"createdTime":"createdTime"===i.template&&(d.selectedIndex=t);break;case"createdBy":"createdBy"===i.template&&(d.selectedIndex=t);break;case"updatedBy":"updatedBy"===i.template&&(d.selectedIndex=t);break;case"collaborator":("collaborator"===i.template&&i.editor&&i.editor.collaborator||"tags"===i.template&&i.editor&&i.editor.collaborator)&&(d.selectedIndex=t);break;case"autoNumber":"autoNumber"===i.template&&(d.selectedIndex=t);break;case"phone":"phone"===i.template&&(d.selectedIndex=t);break;case"password":"password"===i.template&&(d.selectedIndex=t);break;case"url":"url"===i.template&&(d.selectedIndex=t);break;case"email":"email"===i.template&&(d.selectedIndex=t);break;case"dueDate":"dueDate"===i.template&&(d.selectedIndex=t);break;case"rating":"rating"===i.template&&(d.selectedIndex=t);break;case"progress":"progress"===i.template&&(d.selectedIndex=t);break;case"color":"color"===i.template&&(d.selectedIndex=t);break;case"formula":i.formula&&(d.selectedIndex=t);break;case"relationId":i.relationId&&(d.selectedIndex=t)}}))):"type"===o&&(d.selectedIndex=0,d.dropDownOpenPosition="auto",d.dataSource=l._getTypesList()),"cellsAlign"===o&&i&&("center"===i.cellsAlign||"middle"===i.cellsAlign?d.selectedIndex=2:"right"===i.cellsAlign&&(d.selectedIndex=1)),!s)continue;if("dataField"!==o&&"type"!==o&&"deadline"!==o&&"timeFormat"!==o&&"dateFormat"!==o&&"deadlineStatus"!==o&&"deadlineDueDate"!==o&&"relationId"!==o&&"formula"!==o&&"numberFormat"!==o&&"currency"!==o&&"unit"!==o&&"cellsAlign"!==o&&d&&(d.selectedIndex=0),"name"===o){if(i){const e=i.label;d.value=l._unescapeString(e)}else d.value="";d.placeholder=t.find((e=>{if(e.bind===o)return e})).placeholder}"description"===o&&(d.value=i?l._unescapeString(i.description):"",d.placeholder=t.find((e=>{if(e.bind===o)return e})).placeholder);const c=(e,t)=>{i&&i.validationRules.forEach((a=>"minDate"===a.type&&"minDateTime"===e||"maxDate"===a.type&&"maxDateTime"===e||"min"===a.type&&"minValue"===e||"max"===a.type&&"maxValue"===e||a.type===e?(t.value=a.value,!0):void 0))};if("minValue"===o?(s.value=-9999999,c(o,s)):"maxValue"===o?(s.value=9999999,c(o,s)):"minLength"===o?(s.value=0,c(o,s)):"maxLength"===o&&(s.value=500,c(o,s)),"minDateTime"===o){const e=r.querySelector("smart-date-input");e.value=new Date(1900,0,1),c(o,e)}else if("maxDateTime"===o){const e=r.querySelector("smart-date-input");e.value=new Date(2100,0,1),c(o,e)}}}_createColumnBooleanEditor(e,t,a,l,i){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const n=document.createElement("div");return n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),n.setAttribute("checked",""),n.value=!0,t.width&&(a.style.width=t.width,a.style.float="left"),!1===t.value&&(n.value=!1,n.removeAttribute("checked")),e.appendChild(n),e.getValue=function(){return n.value},e.check=function(){n.setAttribute("checked",""),n.value=!0,e.onchange&&e.onchange(n.value)},e.uncheck=function(){n.removeAttribute("checked"),n.value=!1,e.onchange&&e.onchange(n.value)},e.toggle=function(){!0!==n.value&&!1!==n.value&&null!==n.value&&(n.value=!1),null===n.value?n.value=!1:n.value=!n.value,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),e.onchange&&e.onchange(n.value)},e.onclick=i.onclick=()=>{e.toggle()},l.appendChild(a),a.classList.add("smart-grid-dialog-boolean-field"),a.appendChild(e),a.appendChild(i),e}_getColumnTemplateByType(e,t){switch(e){case"boolean":case"bool":return"checkBox";case"image":return"image";case"rating":return"rating";case"attachment":return"attachment";case"createdBy":case"updatedBy":return e;case"collaborator":return"collaborator";case"relationId":return"tags";case"select":case"multiSelect":return"tags";case"url":return"url";case"email":return"email";case"autoNumber":return"autoNumber";case"password":return"password";case"createdTime":return"createdTime";case"updatedTime":return"updatedTime";case"dueDate":return"dueDate";case"duration":return"duration";case"multiText":return t.allowRichText?"richText":"";default:return""}}_getRelations(){const e=this;let t=[];t.push({label:"",menuLabel:" ",value:""});for(let a=0;a<e.dataSourceSettings.relations.length;a++){const l=e.dataSourceSettings.relations[a];t.push({value:l.id,label:l.label})}return t}_getRelationFieldsData(e){const t=this;let a={};for(let e=0;e<t.dataSourceSettings.relations.length;e++){const l=t.dataSourceSettings.relations[e];a[l.id]=l}const l=a[e];return l?("string"==typeof l.columns?JSON.parse(l.columns):l.columns).filter((e=>!e.template||"tags"===e.template||"collaborator"===e.template||"dropdownlist"===e.template||"list"===e.template)).map((e=>({label:e.label,value:e.dataField}))):[]}_getRelationData(e,t){const a=this,l=[];if(!a.dataSourceSettings.relations||!a.dataSourceSettings.relations.length)return;let i=0;const n=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161"];for(let i=0;i<a.dataSourceSettings.relations.length;i++){const n=a.dataSourceSettings.relations[i];if(n.id===e){const e=t,a=[];if(n.dataSource)for(let t=0;t<n.dataSource.length;t++){const i=n.dataSource[t][e];a[i]||(a[i]=!0,l.push({value:i,label:i}))}break}}l.length&&l.sort(((e,t)=>e.label<t.label?-1:e.label>t.label?1:0));for(let e=0;e<l.length;e++)l[e].color=n[i],i++,i>=n.length-1&&(i=0);return l}_confirmAddColumnDialog(e){const t=this,a=e.querySelectorAll(".smart-grid-dialog-editor"),l=[];let i,n,o={};e===t._dialogAddStackColumn&&(o.type="select");for(let e=0;e<a.length;e++){const l=a[e],i=l.querySelector(".smart-input"),n=l.getAttribute("bind"),r=l.parentElement;if("kanban"!==n)if("name"!==n&&"description"!==n)if("minLength"!==n&&"maxLength"!==n&&"minValue"!==n&&"maxValue"!==n&&"minDateTime"!==n&&"maxDateTime"!==n)if("options"!==n&&"users"!==n){if("relationId"===n)o.relationIdLabel=i.value,o.relationField=l.querySelector(".field-input").selectedValue,o.relationFieldLabel=l.querySelector(".field-input").value;else if("formula"===n){if("formula"!==o.type)continue;o.formula=i.value}else if("allowEdit"===n&&r.classList.contains("smart-hidden"))i.value=!1;else if("required"===n&&r.classList.contains("smart-hidden"))i.value=!1;else if("dateFormatSeparator"===n){const e=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.dateFormatSeparatorType="/";break;case 1:o.dateFormatSeparatorType="-";break;case 2:o.dateFormatSeparatorType="."}break}}i&&(i.getSelectedItem?o[n]=i.getSelectedItem().value:o[n]=i.value)}else{const e=[],a=l.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),i=l.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let t=0;t<a.length;t++){const l=a[t],n={label:l.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\\/g,""),value:l.getAttribute("data-item-value").replace(/\\/g,""),id:parseInt(l.getAttribute("data-id")),color:i[t].value};n.color=i[t].value,e.push(n)}if("users"===n&&"collaborator"===o.type){t.users||(t.users=[]);for(let a=0;a<e.length;a++){const l=e[a],i=t.users.find((e=>e.id===l.id));i&&(i.name=l.label,i.color=l.color)}}o[n]=e;const r=l.querySelector(".smart-default-item");o["default_"+n]=r.selectedValues?r.selectedValues[0]:null}else o[n]=i.getValue();else o[n]=i.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""");else{const e=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++){const a=e[t];if(a.querySelector("[checked]")){o.kanban=a.name;break}}}}e.data=o;let r={},s={},d="";if(i=o.minDateTime,n=o.maxDateTime,"date"===o.type||"dueDate"===o.type||"startDate"===o.type){r={template:"dateInput",min:i,max:n};let e=!1;o.deadlineStatus&&(r.boundDataField=o.deadlineStatus),"-"!==o.dateFormat&&(d=o.dateFormat,o.allowCustomDateSeparator&&(d.indexOf("/")>=0?d=d.replaceAll("/",o.dateFormatSeparatorType):d.indexOf("-")>=0?d=d.replaceAll("-",o.dateFormatSeparatorType):d.indexOf(".")>=0&&(d=d.replaceAll(".",o.dateFormatSeparatorType))),o.dateFormat.indexOf("T")>=0&&(r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),e=!0),r.autoOpen=!0,o.allowTimeFormat&&"-"!==o.timeFormat&&(e&&(d+=" "),d+=o.timeFormat,r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),o.cellsFormat=d,l.push({type:"minDate",value:i}),l.push({type:"maxDate",value:n})}else if("time"===o.type)r={template:"timeInput",hour12:!0},o.timeFormat.indexOf("HH")>=0&&(r.hour12=!1),r.autoOpen=!0,d=o.timeFormat,o.cellsFormat=d;else if("duration"===o.type)r={template:"dateRangeInput"},d="MM/dd/yyyy hh:mm",o.cellsFormat=d;else if("number"===o.type||"slider"===o.type){i=parseInt(o.minValue),n=parseInt(o.maxValue),o.numberFormat=JSON.parse(JSON.stringify(o.numberFormat)),"unit"===o.numberFormat.style&&(o.numberFormat.unit=o.unit);let e=null,a=null;"currency"===o.numberFormat.style&&(o.numberFormat.currency=o.currency,o.numberFormat.locale=t._getLocaleByCurrency(o.currency)),"decimal"!==o.numberFormat.style||o.numberFormat.notation||(o.numberFormat.useGrouping=o.allowThousandsSeparator),"squaremeter"===o.numberFormat.unit&&(o.numberFormat={type:"squaremeter",style:"decimal",maximumFractionDigits:0}),"cubicmeter"===o.numberFormat.unit&&(o.numberFormat={type:"cubicmeter",style:"decimal",maximumFractionDigits:0}),r={template:"number"===o.type?"numberInput":"slider",min:i,max:n,numberFormat:o.numberFormat},s={Intl:{NumberFormat:o.numberFormat}},a&&(s=a),d="d",e&&(d=e),l.push({type:"min",value:i}),l.push({type:"max",value:n})}else if("rating"===o.type)r={template:"rating"};else if("boolean"===o.type)r={template:"checkBox"};else if("image"===o.type)r={template:"image"};else if("attachment"===o.type)r={template:"attachment"};else if("relationId"===o.type){const e=t._getRelationData(o.relationId,o.relationField);r={template:"multiComboInput",readonly:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,relationId:o.relationId,relationField:o.relationField,pills:!0,singleSelect:!o.relationMultiField,dataSource:e}}else if("select"===o.type||"multiSelect"===o.type||"tags"===o.type){let a=o.options,l=!1;if("select"===o.type)if(e.editColumn&&!e.editColumn.editor.allowEmptyItem){a=o.options;const i=[];for(let e=0;e<o.options.length;e++)if(""===o.options[e].label)o.options[e].value="";else if(""===o.options[e].value){const t=o.options[e].label.trim();if(i[t])continue;o.options[e].value=t,i.push(t)}else if(!isNaN(parseInt(o.options[e].value))){const t=o.options[e].label.trim();if(i[t])continue;o.options[e].value=t,i.push(t)}if(e.editColumn._dataField&&"taskStatus"===e.editColumn._dataField||e===t._dialogAddStackColumn)for(let e=0;e<o.options.length;e++){const t=o.options[e];isNaN(parseInt(t.value))||(t.value=t.label.replaceAll(" ",""))}a=o.options;let n=!1;for(let e=0;e<o.options.length;e++)if(""===o.options[e].label){n=!0,l=!0,o.options[e].value="";break}a=n?o.options:[{color:"#F47A54",value:"",label:""}].concat(o.options)}else{const e=[];let t=!1;for(let a=0;a<o.options.length;a++)if(""===o.options[a].label)t=!0,l=!0,o.options[a].value="";else if(""===o.options[a].value){const t=o.options[a].label.trim();if(e[t])continue;o.options[a].value=t,e.push(t)}else if(!isNaN(parseInt(o.options[a].value))){const t=o.options[a].label.trim();if(e[t])continue;o.options[a].value=t,e.push(t)}a=t?o.options:[{color:"#F4511E",value:"",label:""}].concat(o.options)}else if("multiSelect"===o.type){const e=[];for(let t=0;t<o.options.length;t++)if(""===o.options[t].label)o.options[t].value="";else if(""===o.options[t].value){const a=o.options[t].label.trim();if(e[a])continue;o.options[t].value=a,e.push(a)}else if(!isNaN(parseInt(o.options[t].value))){const a=o.options[t].label.trim();if(e[a])continue;o.options[t].value=a,e.push(a)}a=o.options}a.length&&""===a[0]&&!l&&o.required&&(a=a.splice(1)),r={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:o.allowColorItems,autoOpen:!0,pills:!0,singleSelect:"select"===o.type,dataSource:a}}else if("collaborator"===o.type){let e=o.users;o.allowMultipleCollaborators||e&&e.length&&""!==e[0].value&&(e=[{label:"",value:"",color:"#F47A54"}].concat(o.users));for(let a=0;a<t.users.length;a++)e.forEach((e=>{e.value!==t.users[a].id&&e.value!==""+t.users[a].id||(e.image=t.users[a].image,e.id=t.users[a].id)}));r={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:o.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!o.allowMultipleCollaborators,dataSource:e}}else"multiText"===o.type?(i=o.minLength,n=o.maxLength,r={template:"textarea",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n})):"password"===o.type?(i=o.minLength,n=o.maxLength,r={template:"password",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n})):"phone"===o.type?r={template:"phone",required:o.required}:(i=o.minLength,n=o.maxLength,r={template:"input",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n}));let c="string";switch(o.type){case"boolean":case"bool":c="boolean";break;case"createdTime":case"updatedTime":case"duration":case"date":case"time":c="date";break;case"autoNumber":case"slider":case"rating":case"number":c="number"}const u=e=>{if(o.setDefaultValue)switch(o.type){case"string":case"multiText":case"description":case"name":e.defaultValue=o.defaultString;break;case"number":case"slider":e.defaultValue=o.defaultNumber;break;case"date":case"dueDate":case"startDate":e.defaultValue="current"===o.defaultDate?"today":o.defaultDateValue;break;case"collaborator":void 0!==o.default_users?e.defaultValue=o.default_users:e.defaultValue=null;break;case"select":case"multiSelect":case"status":case"priority":o.default_options?e.defaultValue=o.default_options:e.defaultValue=null}else e.defaultValue=null};if(e.editColumn){const a=e.editColumn;a.canNotify=!1,a.label=o.name,void 0!==o.description&&(a.description=o.description),a.showDescriptionButton=!0,void 0!==o.allowResize&&(a.allowResize=o.allowResize),void 0!==o.allowSort&&(a.allowSort=o.allowSort),void 0!==o.allowFilter&&(a.allowFilter=o.allowFilter),void 0!==o.allowEdit&&(a.allowEdit=o.allowEdit),void 0!==o.cellsAlign&&(a.align=a.cellsAlign=o.cellsAlign),void 0!==o.cellsFormat&&(a.cellsFormat=d),void 0!==o.formula?a.formula=o.formula:a.formula="";const i=a._editorId?a._editorId:"",n=r.template+"_"+a.dataField+i;t._cellEditors[n]&&delete t._cellEditors[n];let m=!0;"list"!==a.template&&"dropDownList"!==a.template||(m=!1),"autoNumber"!==a.template&&"createdBy"!==a.template&&"updatedBy"!==a.template&&"createdTime"!==a.template&&"progress"!==a.template&&"updatedTime"!==a.template&&"checklist"!==a.template&&"color"!==a.template||(m=!1),a.editor&&a.editor.template.indexOf("custom")>=0&&(m=!1),a.editor&&a.editor.disabledDialogOptions&&(m=!1),u(a),m&&(a.editor=JSON.parse(JSON.stringify(r)),a.template=t._getColumnTemplateByType(o.type,o),a._cellsCachedValues=[]),"date"===o.type&&("dueDate"===o.deadline?(r=t._getKanbanTaskField("dueDate").editor,o.deadlineStatus&&(r.boundDataField=o.deadlineStatus),a.template="dueDate"):"startDate"===o.deadline?(r=t._getKanbanTaskField("startDate").editor,o.deadlineDueDate&&(r.boundDataField=o.deadlineDueDate),a.template="startDate"):(a.template="",r.template="dateInput",r.onValidate=null)),"relationId"===o.type&&(a.relationId=o.relationId,a.relationField=o.relationField),a.formatSettings=s,o.type!==e.columnType&&e.columnType&&(a.dataType=c),a.icon=t._getIconByType(o.type),a._isDirty=!0,o.required&&l.push({type:"required"}),a.validationRules=l,a._state&&["label","description","defaultValue","showDescriptionButton","dataType","editor","formatSettings","template","summary","validationRules","allowResize","allowSort","allowFilter","allowEdit","align","cellsAlign","cellsFormat"].forEach((e=>{a._state[e]=a[e]})),a.canNotify=!0,t.$.fireEvent("closeColumnDialog",{dataField:a.dataField}),t.onColumnUpdated&&t.onColumnUpdated(t.columns.indexOf(a),a),t._onColumnUpdated&&t._onColumnUpdated(a,o),t._recycle(!0),a.refresh(),a._isDirty=!1}else{let e=[];"number"===c&&(e=["sum"]);const a=t._getColumnLabel(o),i=new Smart.Grid.Column({label:a,description:o.description,dataField:o.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:o.allowResize,allowSort:o.allowSort,allowFilter:o.allowFilter,allowEdit:o.allowEdit,showDescriptionButton:!0,dataType:c,editor:r,summary:e,template:t._getColumnTemplateByType(o.type,o),formatSettings:s,cellsAlign:o.cellsAlign,align:o.cellsAlign,cellsFormat:d,visibleIndex:t.columns.length-1,formula:o.formula,relationId:o.relationId,relationField:o.relationField,grid:t});if("autoNumber"===i.template&&(i.autoGenerated=!0,e=[]),u(i),o.required&&(l.push({type:"required"}),i.validationRules=l),"date"===o.type&&("dueDate"===o.deadline?o.type="dueDate":"startDate"===o.deadline&&(o.type="startDate")),"collaborator"===o.type){let e=!1;for(let a=0;a<t.columns.length;a++)if("taskUserId"===t.columns[a]._dataField){e=!0;break}e||(i._dataField="taskUserId")}if(t._getKanbanFields().indexOf(o.type)>=0){const e=t._getKanbanTaskField(o.type);switch(u(e),"startDate"===o.type&&o.deadlineDueDate&&(e.editor.boundDataField=o.deadlineDueDate),"dueDate"===o.type&&o.deadlineStatus&&(e.editor.boundDataField=o.deadlineStatus),delete e._state,o.description&&(e.description=o.description),o.name&&(e.label=o.name),e.allowFilter=o.allowFilter,e.allowResize=o.allowResize,e.allowSort=o.allowSort,o.type){case"priority":case"status":case"tags":e.editor.dataSource=JSON.parse(JSON.stringify(o.options))}let a=t.columnByDataField[e.dataField];if("status"===o.type||"name"===o.type||"description"===o.type)for(let e=0;e<t.columns.length;e++){const l=t.columns[e];if(l._dataField&&!t.columnByDataField[l._dataField]&&(t.columnByDataField[l._dataField]=l),l.statusColumn||"taskStatus"===l._dataField){a=l;break}}a&&!1===a._visible?(a.visible=!0,delete a._visible):(a&&(e.dataField=e.displayField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),"object"==typeof e.editor&&e.editor.dataSource&&(e.editor.dataSource=JSON.parse(JSON.stringify(e.editor.dataSource))),o.name||(e.label=e.label+" "+t.localize("copy"))),t.columns.push(e))}else t.columns.push(i);t._refreshHeaderBar(),t.$.fireEvent("closeColumnDialog",{dataField:i.dataField})}}_getColumnLabel(e){const t=this;let a=e.name;if(!a){let a="";switch(e.type){case"string":a=t.localize("dialogAddColumnTypeText");break;case"multiText":a=t.localize("dialogAddColumnTypeMultilineText");break;case"image":a=t.localize("dialogAddColumnTypeImage");break;case"attachment":a=t.localize("dialogAddColumnTypeAttachment");break;case"number":a=t.localize("dialogAddColumnTypeNumber");break;case"select":a=t.localize("dialogAddColumnTypeSelect");break;case"multiSelect":a=t.localize("dialogAddColumnTypeMultipleSelect");break;case"boolean":a=t.localize("dialogAddColumnTypeCheckBox");break;case"date":a=t.localize("dialogAddColumnTypeDate");break;case"time":a=t.localize("dialogAddColumnTypeTime");break;case"duration":a=t.localize("dialogAddColumnTypeDuration");break;case"createdTime":a=t.localize("dialogAddColumnTypeCreatedTime");break;case"updatedTime":a=t.localize("dialogAddColumnTypeLastUpdatedTime");break;case"createdBy":a=t.localize("dialogAddColumnTypeCreatedBy");break;case"updatedBy":a=t.localize("dialogAddColumnTypeLastUpdatedBy");break;case"collaborator":a=t.localize("dialogAddColumnTypeCollaborator");break;case"slider":a=t.localize("dialogAddColumnTypeSlider");break;case"autoNumber":a=t.localize("dialogAddColumnTypeAutoNumber");break;case"url":a=t.localize("dialogAddColumnTypeURL");break;case"relationId":a=t.localize("dialogAddColumnTypeLink"),e.relationFieldLabel&&e.relationIdLabel&&(a=e.relationFieldLabel+" ("+e.relationIdLabel+")");break;case"formula":a=t.localize("dialogAddColumnTypeFormula");break;case"email":a=t.localize("dialogAddColumnTypeEmail");break;case"phone":a=t.localize("dialogAddColumnTypePhone");break;case"password":a=t.localize("dialogAddColumnTypePassword");break;case"rating":a=t.localize("dialogAddColumnTypeRating")}let l=1;for(let e=0;e<t.columns.length;e++)t.columns[e].label.indexOf(a)>=0&&l++;return 1===l?a:a+" "+l}return a}_openAddColumnDialog(e,t,a){const l=this,i=l._dialogAddColumn||l._createDialog(l.editing.addColumnDialog),n=e?l.localize("dialogEditColumn",{value:e.label}):l.localize("dialogAddColumn"),o=i.querySelector(".smart-footer").querySelector(".smart-stack-layout");i.classList.add("smart-grid-dialog-add-column"),i.type=e?"customize":"add",i.editColumn=e||null,delete i._randomOptionIndex,e&&e.element?e.element.setAttribute("focus",""):l._addNewColumn&&l._addNewColumn.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),l._cellEditors||(l._cellEditors=[]);const r=l._getAddColumnDialogTemplate();if(i.header.innerHTML=n,i.header.parentElement.classList.add("smart-hidden"),i.callback=a,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===l.view?(i.header.innerHTML=l.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),i.classList.add("view")):i.classList.remove("kanban")),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),"kanban"===l.view?i.btnCancel.classList.add("smart-hidden"):i.btnCancel.classList.remove("smart-hidden"),l.cancelEdit(),!l._dialogAddColumn){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i._refreshPosition=()=>{const e=l.offset(l.$.columnHeader),t=l.$.columnHeader.offsetHeight,a=l.offset(l);if(i.style.maxHeight="",i.style.minHeight="",e.top+t+i.offsetHeight>window.innerHeight-a.top){const l=t+e.top+i.offsetHeight-window.innerHeight+a.top;i.style.maxHeight=Math.max(250,i.offsetHeight-l)+"px",i.style.minHeight="250px"}else i.style.maxHeight="",i.style.minHeight=""},i.onOpen=function(){const e=l._dialogAddColumn,t=l._getAddColumnDialogTemplate(),a=l._addColumnDialogEditors;if(delete e.columnType,l._addColumnDialogInitEditors(e,t,a),l._addColumnDialogShowHideEditors(e),e.editColumn){const t=e.querySelector('[bind="type"]'),a=t?t.querySelector("smart-input"):null,l=t?a.getSelectedItem().value:"kanban";e.columnType=l}else delete e.columnType;l._filterColumnTypes(),l.$.fireEvent("openColumnDialog",{dataField:e.editColumn?e.editColumn.dataField:null}),e._refreshPosition()},i.onClose=function(){i.editColumn&&i.editColumn.element&&i.editColumn.element.removeAttribute("focus"),l._addNewColumn&&l._addNewColumn.element.removeAttribute("focus"),i.classList.remove("view"),i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){l._confirmAddColumnDialog(i),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&"kanban"!==l.view&&(i.result=!1,i.close())},l._dialogAddColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e),l._addColumnDialogEditors=[];const t=l._addColumnDialogEditors;l._initAddColumnDialogEditors(t,r,i,e)}const s=()=>{const t=parseInt(i.style.width),a=l.offset(l);if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=l.offsetWidth+"px",void(i.style.height=l.offsetHeight+"px");{const e=l.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const n=e.element;if(n){const e=l.offset(n),o=e.left-a.left,r=a.left,s=Math.max(r,o);if(s+t+n.offsetWidth>a.left+l.offsetWidth){const l=s-t+n.offsetWidth;l<0?i.open("center",e.top+n.offsetHeight-a.top):i.open(Math.max(r,l),e.top+n.offsetHeight-a.top)}else i.open(s,e.top+n.offsetHeight-a.top)}else i.classList.add("center"),i.open("center","center")}else if(l._addNewColumn){let e=l._addNewColumn.element,n=l.offset(e),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o);l.editing.addNewColumn._addButton&&l.editing.addNewColumn._addButton.classList.contains("show")&&(e=l.editing.addNewColumn._addButton,n=l.offset(l.editing.addNewColumn._addButton),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o)),i.open(s,n.top+e.offsetHeight-a.top)}else i.open("center","center"),i.classList.add("center")};s(),i.refresh=()=>{s()}}_filterColumnTypes(){const e=this,t=e._dialogAddColumn;if(!t)return;const a=e._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input");if(t.columnType){const l=e._getTypesList().find((e=>{if(e.value===t.columnType)return e}));if(l)if("string"===t.columnType||"multiText"===t.columnType)a.dataSource=e._getTypesList().filter((e=>!(["createdTime","updatedTime","createdBy","updatedBy","autoNumber","image","color","checklist","progress","collaborator","attachment"].indexOf(e.value)>=0)));else if("select"===t.columnType||"multiSelect"===t.columnType){const t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")}];a.dataSource=t}else{const t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")}].concat(l);a.dataSource=t}else a.dataSource=e._getTypesList()}else t.editColumn||(a.dataSource=e._getTypesList(),a.selectedIndex=0)}_getIconByType(e){let t="smart-icon-font";switch(e){case"multiText":t="smart-icon-fontsize";break;case"image":t="smart-icon-image";break;case"attachment":t="smart-icon-docs";break;case"number":case"progress":t="smart-icon-number";break;case"priority":case"status":case"select":t="smart-icon-sort-down";break;case"multiSelect":t="smart-icon-list-unordered";break;case"boolean":t="smart-icon-check-squared";break;case"date":case"startDate":case"duration":case"dueDate":t="smart-icon-calendar";break;case"time":case"createdTime":case"updatedTime":t="smart-icon-clock";break;case"createdBy":case"updatedBy":case"collaborator":t="smart-icon-user";break;case"slider":t="smart-icon-number";break;case"autoNumber":case"checklist":t="smart-icon-list-ordered";break;case"url":t="smart-icon-link";break;case"email":t="smart-icon-mail";break;case"password":t="smart-icon-lock";break;case"phone":t="smart-icon-phone";break;case"name":t="smart-icon-font";break;case"description":t="smart-icon-fontsize";break;case"tags":t="smart-icon-list-ordered";break;case"color":t="smart-icon-color-background";break;case"assigned":t="smart-icon-user";break;case"rating":t="smart-icon-star";break;case"relationId":t="smart-icon-table-alt";break;case"formula":t="smart-icon-math"}return t}_initAddColumnDialogEditors(e,t,a,l){const i=this;for(let n=0;n<t.length;n++){const o=t[n],r=document.createElement("div"),s=document.createElement("label");s.innerHTML=o.label;const d=document.createElement("div");if(d.classList.add("smart-grid-dialog-editor","add-column"),d.innerHTML="",d.setAttribute("filter",o.filter),d.setAttribute("bind",o.bind),r.setAttribute("field-name",o.bind),r.setAttribute("field-filter",o.filter),e[o.bind]=d,"type"===o.bind&&d.addEventListener("change",(()=>{i._addColumnDialogShowHideEditors(a),a.editColumn&&i._filterColumnTypes();const t=i._dialogAddColumn.querySelector('[bind="type"]'),l=t.querySelector("smart-input"),n=l.getSelectedItem().value,o=i._getIconByType(n);if(e.type.icon=o,e.name.querySelector("input").setAttribute("data-label",l.value),t.firstElementChild.className="smart-grid-icon show smart-description-button "+o,"select"===n||"multiSelect"===n){const t=e.options.querySelector("smart-sortable");if(t&&t._validate){if(a.editColumn)if(a.editColumn.editor.dataSource)t._init([...a.editColumn.editor.dataSource]);else{const e=[];for(let t=0;t<i.rows.length;t++){const l=i.rows[t].data[a.editColumn.dataField];if(l&&l.indexOf(",")>=0){const t=l.split(",");for(let a=0;a<t.length;a++)-1===e.indexOf(t[a].trim())&&e.push(t[a].trim())}else if(-1===e.indexOf(l)&&void 0!==l){if(""===l&&"multiSelect"===n)continue;e.push(l)}}e.length?t._init(e.map((e=>({value:e,label:e})))):t._init()}else t._init();t._validate()}}else if("priority"===n||"status"===n||"tags"===n){const t=e.options.querySelector("smart-sortable"),a=i._getKanbanTaskField(n);t&&t._validate&&(t._init([...a.editor.dataSource]),t._validate())}else a.btnConfirm.disabled=!1})),"boolean"===o.type)i._createColumnBooleanEditor(d,o,r,l,s);else{if("label"===o.type){l.appendChild(r),r.classList.add("smart-grid-dialog-field"),r.appendChild(s);const e=document.createElement("div");e.style.height="10px",r.appendChild(e);continue}if("relationId"===o.type){let e=document.createElement("smart-input");e.classList.add("underlined","edit-column-input"),e.style.width="calc(100% - 25px)",e.style.height="30px",o.width&&(r.style.width=o.width,r.style.float="left"),e.readonly=!0,e.dropDownButtonPosition="right",e.dropDownHeight="auto";let a=i._getRelations(),c={};for(let e=0;e<i.dataSourceSettings.relations.length;e++){const t=i.dataSourceSettings.relations[e];c[t.id]=t}let u=document.createElement("smart-input");u.classList.add("underlined","smart-hidden","edit-column-input","field-input"),u.style.width="calc(100% - 25px)",u.style.height="30px",u.readonly=!0,u.dropDownButtonPosition="right",u.dropDownHeight="auto";const m=document.createElement("div"),p=document.createElement("div");if(p.style.marginTop="5px",p.innerHTML=i.localize("dialogAddColumnLinkField"),p.classList.add("smart-hidden"),e.dataSource=a,e.onchange=()=>{if(u.dataSource=null,u.clearValue(),""===e.value)u.classList.add("smart-hidden"),p.classList.add("smart-hidden");else{p.classList.remove("smart-hidden"),u.classList.remove("smart-hidden");const t=c[e.selectedValue];t&&(u.dataSource=i._getRelationFieldsData(t.id))}},o.width&&(r.style.width=o.width,r.style.float="left"),d.style.height="auto",m.classList.add("smart-flex"),m.style.width="100%",m.style.flexDirection="column",m.appendChild(e),m.appendChild(p),m.appendChild(u),d.appendChild(m),l.appendChild(r),r.classList.add("smart-grid-dialog-field"),r.appendChild(s),r.appendChild(d),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}else if("formula"===o.type){let e=document.createElement("smart-input");e.classList.add("underlined","edit-column-input"),e.style.width="100%",o.width&&(r.style.width=o.width,r.style.float="left"),d.appendChild(e),l.appendChild(r),r.classList.add("smart-grid-dialog-field"),r.appendChild(s),r.appendChild(d);const a=document.createElement("div");if(a.innerHTML=i.localize("dialogAddColumnTypeFormulaInfo"),a.style.color="var(--smart-primary)",a.style.fontSize="12px",a.style.marginBottom="10px",r.appendChild(a),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}else{let c=document.createElement("smart-input");if(c.classList.add("underlined","edit-column-input"),c.style.width="100%",c.style.height="30px",o.width&&(r.style.width=o.width,r.style.float="left"),"items"===o.type){const t=document.createElement("smart-button");t.classList.add("primary"),t.innerHTML='<div style="align-items: center; white-space: nowrap; display: flex;"><span class="smart-grid-icon show smart-icon-plus"></span><span>'+i.localize("commandBarAddRow")+"</span></div>";const l=document.createElement("div");l.classList.add("smart-grid-add-column-dialog-color-panel");const n=document.createElement("smart-sortable");n.disableMode="manual",n.dragMode="handle",n.handlePosition="left",n.handleVisibility="visible";const r=()=>{if(a.btnConfirm.disabled=!1,0===l.offsetHeight)return;let e=0;l.querySelectorAll(".edit-column-input").forEach((t=>{""===t.value&&e++;const l=a.querySelector('[field-name="type"]');l&&("multiSelect"===l.querySelector("smart-input").selectedValues[0]&&e>=1&&(a.btnConfirm.disabled=!0),e>1&&(a.btnConfirm.disabled=!0))})),n._updateDefaultInput()},s=(l,s,d,c)=>{const u=document.createElement("div"),m=i._getColorInput(),p=document.createElement("div"),g=document.createElement("smart-input"),b=e.allowColorItems;if(void 0!==d)g.setAttribute("data-id",d),g.setAttribute("data-item-value",d);else{const e=n.querySelectorAll(".smart-sortable-item").length;g.setAttribute("data-id",e),g.setAttribute("data-item-value",e)}if(void 0!==c&&g.setAttribute("data-item-value",c),m.disabled=!b.querySelector(".smart-input").value,p.className="smart-grid-icon smart-icon-close show",p.setAttribute("role","button"),p.setAttribute("aria-label","button"),g.classList.add("underlined","edit-column-input"),g.style.width="100%",g.style.height="30px",g.required=!0,(a.editColumn&&"collaborator"===a.editColumn.template||"users"===o.bind)&&(g.disabled=!0),l&&(g.value=i._unescapeString(l)),s)m.value=s;else if(!m.disabled){void 0!==a._randomOptionIndex?a._randomOptionIndex++:a._randomOptionIndex=2;const e=a._randomOptionIndex;e>=m.dataSource.length-1&&delete a._randomOptionIndex;const t=m.dataSource[e];m.value=t}if(g.onkeyup=g.onchange=g.onblur=e=>{r(),"Enter"===e.key&&(g.parentElement.nextElementSibling||(t.click(),r()))},m.onchange=()=>{n._updateDefaultInput()},u.appendChild(m),u.appendChild(g),"users"!==o.bind&&u.appendChild(p),p.onmouseenter=()=>{if(i._dialogAddColumn&&i._dialogAddColumn.editColumn){if(p.title="",p.classList.remove("smart-quiet"),!c)return;const e=i._dialogAddColumn.editColumn;if(e)for(let t=0;t<i.rows.length;t++)if(i.rows[t].data[e.dataField]===c){p.title=i.localize("dialogAddColumnListItemsError"),p.classList.add("smart-quiet");break}}},c&&i._dialogAddColumn){const e=i._dialogAddColumn.editColumn;if(e)for(let t=0;t<i.rows.length;t++)if(i.rows[t].data[e.dataField]===c){p.title=i.localize("dialogAddColumnListItemsError"),p.classList.add("smart-quiet");break}}return p.onclick=()=>{p.title||(u.remove(),n.updateItems(),r())},u.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),"users"===o.bind&&u.setAttribute("disable-drag",""),u};n._getOptions=e=>{const t=[],a=l.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),n=l.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<a.length;e++){const l=a[e],i={label:l.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\\/g,""),value:l.getAttribute("data-item-value").replace(/\\/g,""),id:parseInt(l.getAttribute("data-id")),color:n[e].value};i.color=n[e].value;const o=parseInt(i.value);if(!isNaN(o)){const e=i.label.trim();i.value=e}t.push(i)}if("users"===e.bind){i.users||(i.users=[]);for(let e=0;e<t.length;e++){const a=t[e],l=i.users.find((e=>e.id===a.id));l&&(l.name=a.label,l.color=a.color)}}return t},n._updateDefaultInput=e=>{e||(e=n._getOptions(o)),n._defaultInput&&(n._defaultInput.dataSource=e,n._defaultInput.selectedValues=[],!e||e&&!e.length||"kanban"===i.view?(n._defaultInput.classList.add("smart-hidden"),n._defaultOption.classList.add("smart-hidden")):(a.editColumn&&a.editColumn.defaultValue&&(n._defaultInput.selectedValues=[a.editColumn.defaultValue]),n._defaultInput.classList.remove("smart-hidden"),n._defaultOption.classList.remove("smart-hidden")))},n._init=e=>{n.clearContent(),"users"===o.bind?(n.handleVisibility="none",n.handlePosition="none"):(n.handleVisibility="visible",n.handlePosition="left"),e&&(e.forEach(((e,t)=>{const a=void 0!==e.id?e.id:t,l=s(e.label,e.color,a,e.value,t);n.$.container.appendChild(l)})),n.updateItems()),n._updateDefaultInput(e)},n._validate=r,e.allowColorItems.onchange=t=>{let a=e.allowColorItems.parentElement.nextElementSibling,l=null;for(;a;){if("options"===a.getAttribute("field-name")){if(l=a,l&&l.classList.contains("smart-hidden")){a=a.nextElementSibling;continue}break}if("users"===a.getAttribute("field-name")){if(l=a,l&&l.classList.contains("smart-hidden")){a=a.nextElementSibling;continue}break}a=a.nextElementSibling}l&&l.querySelectorAll("smart-color-input").forEach((e=>{e.disabled=!t}))},l.appendChild(n),"users"!==o.bind&&(l.appendChild(t),t.onclick=e=>{const t=s();n.$.container.appendChild(t),n.updateItems(),t.querySelector(".edit-column-input").focus(),a.btnConfirm.disabled=!0,a._refreshPosition(),e.preventDefault()});const u=document.createElement("div");u.innerHTML=i.localize("dialogAddColumnDefault");const m=document.createElement("smart-multi-combo-input");m.singleSelect=!0,m.readonly=!0,m.dropDownButtonPosition="right",m.colorItems=!0,m.autoOpen=!0,m.pills=!0,m.style.setProperty("--smart-surface","--smart-background"),m.style.width="100%",m.classList.add("smart-default-item","underlined");const p=document.createElement("div");p.style.display="flex",p.style.flexDirection="column",p.style.marginTop="5px",p.classList.add("smart-default-item-container"),p.appendChild(u),p.appendChild(m),l.appendChild(p),n._defaultInput=m,n._defaultOption=u,c=l,d.style.height="auto"}else if("number"===o.type)c=document.createElement("smart-number-input"),c.classList.add("underlined"),c.style.width="100%",c.style.height="30px","minValue"===o.bind?(c.value=0,c.min=-9999999,c.max=9999999):"maxValue"===o.bind?(c.value=1e6,c.min=-9999999,c.max=9999999):"minLength"===o.bind?c.value=0:"maxLength"===o.bind&&(c.value=500);else if("datetime"===o.type)c=document.createElement("smart-date-input"),c.classList.add("underlined"),c.style.width="100%",c.style.height="30px","minDateTime"===o.bind?c.value=new Date(1900,0,1):"maxDateTime"===o.bind&&(c.value=new Date(2100,0,1));else if("radio"===o.type){const e=(e,t,a)=>{const l=document.createElement("div"),i=document.createElement("label"),n=document.createElement("div");return i.innerHTML=e,n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),t&&n.setAttribute("checked",""),n.value=void 0!==t&&t,d.appendChild(n),l.onclick=function(){if(n.value=!0,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),l.onchange&&l.onchange(l),n.value){const e=n.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n.value=!0,n.setAttribute("checked",n.value?"":"indeterminate"),e.value=a}},l.appendChild(n),l.appendChild(i),l.classList.add("smart-grid-dialog-boolean-field"),l.setAttribute("template","checkBox"),l.setAttribute("editor",""),l.label=i,l.value=t,l.name=a,l},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),d.classList.add("radio-group");for(let a=0;a<o.options.length;a++){const l=o.options[a],i=e(l.label,l.checked,l.value);if(o.columns){const e=100/o.columns;i.style.width=e+"%",i.style.float="left"}t.appendChild(i),l.checked&&(d.value=l.value)}const a=document.createElement("div");a.style.clear="both",t.appendChild(a),c=t}if(o.options){c.readonly=!0;let e=o.options;"type"===o.bind&&(void 0!==i.currentUser&&null!==i.currentUser||(e=e.filter((e=>"updatedBy"!==e.value&&"createdBy"!==e.value))),(void 0===i.users||null===i.users||i.users&&0===i.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),c.dataSource=e,c.dropDownButtonPosition="right","dataField"!==o.bind&&(c.selectedIndex=0),o.options.length<15?c.dropDownHeight="auto":c.dropDownHeight=300}if(o.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",o.icon,"show","smart-description-button"),d.appendChild(e),c.style.width="calc(100% - 25px)"}if(d.appendChild(c),o.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=o.info,d.appendChild(e),c.style.width="calc(100% - 25px)"}if(l.appendChild(r),r.classList.add("smart-grid-dialog-field"),r.appendChild(s),r.appendChild(d),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}}}}_getDefaultLocales(){return{AED:"ar_AE",AFN:"fa_AF",ALL:"sq",AMD:"hy",ANG:"nl",AOA:"pt_AO",ARS:"es_AR",AUD:"en",AWG:"nl_AW",AZN:"az",BAM:"bs",BBD:"en_BB",BDT:"bn_BD",BGN:"bg",BHD:"ar_BH",BIF:"fr_BI",BMD:"en_BM",BND:"ms_BN",BOB:"es_BO",BRL:"pt_BR",BSD:"en_BS",BTN:"dz",BWP:"en_BW",BYN:"be",BYR:"be",BZD:"en_BZ",CAD:"en_CA",CDF:"fr_CD",CHF:"de_CH",CLP:"es_CL",CNY:"zh_Hans_CN",COP:"es_CO",CRC:"es_CR",CUP:"es_CU",CVE:"pt_CV",CZK:"cs",DJF:"fr_DJ",DKK:"da_DK",DOP:"es_DO",DZD:"ar_DZ",EGP:"ar_EG",ERN:"ti_ER",ETB:"am",EUR:"de",FJD:"en_FJ",FKP:"en_FK",GBP:"en",GEL:"ka",GHS:"en_GH",GIP:"en_GI",GMD:"en_GM",GNF:"fr_GN",GTQ:"es_GT",GYD:"en_GY",HKD:"zh_Hans_HK",HNL:"es_HN",HRK:"hr_HR",HTG:"en",HUF:"hu_HU",IDR:"id",ILS:"he",INR:"en_IN",IQD:"ar_IQ",IRR:"fa_IR",ISK:"is",JMD:"en_JM",JOD:"ar_JO",JPY:"ja",KES:"en_KE",KGS:"ky",KHR:"km",KMF:"ar",KPW:"ko_KP",KRW:"ko_KR",KWD:"ar_KW",KYD:"en_KY",KZT:"kk",LAK:"lo",LBP:"ar_LB",LKR:"si",LRD:"en_LR",LSL:"en_LS",LYD:"ar_LY",MAD:"ar",MDL:"ro",MGA:"fr_MG",MKD:"mk",MMK:"my",MNT:"mn",MOP:"zh",MRO:"ar_MR",MRU:"ar_MR",MUR:"en_MU",MVR:"en",MWK:"en",MXN:"es_MX",MYR:"ms_MY",MZN:"pt_MZ",NAD:"en_NA",NGN:"en_NG",NIO:"es_NI",NOK:"nb_NO",NPR:"ne",NZD:"en_NZ",OMR:"ar_OM",PAB:"es_PA",PEN:"es_PE",PGK:"en_PG",PHP:"fil",PKR:"ur_PK",PLN:"pl",PYG:"es_PY",QAR:"ar_QA",RON:"ro",RSD:"sr",RUB:"ru",RWF:"rw",SAR:"ar_SA",SBD:"en_SB",SCR:"en_SC",SDG:"ar_SD",SEK:"sv_SE",SGD:"en_SG",SHP:"en_SH",SLL:"en_SL",SOS:"so_SO",SRD:"nl_SR",SSP:"en",STD:"pt_ST",STN:"pt_ST",SYP:"ar_SY",SZL:"en_SZ",THB:"th",TJS:"en",TMT:"tk",TND:"ar_TN",TOP:"to",TRY:"tr_TR",TTD:"en_TT",TWD:"zh_Hant_TW",TZS:"sw_TZ",UAH:"uk",UGX:"en_UG",USD:"en_US",UYU:"es_UY",UZS:"uz",VEF:"es_VE",VND:"vi",VUV:"en_BI",WST:"en_AS",XAF:"fr",XCD:"en",XOF:"fr",XPF:"fr_PF",YER:"ar_YE",ZAR:"zu",ZMW:"en_ZM",ZWL:"en_ZW"}}_getLocaleByCurrency(e){const t=this._getDefaultLocales();return t[e]?t[e].replace("_","-"):"en-US"}_getCurrencyByLocale(e){const t=this;if(t._currencyByLocale||(t._currencyByLocale={}),t._currencyByLocale[e])return t._currencyByLocale[e];const a=t._getCurrencies(),l=t._getDefaultLocales(),i=Object.keys(l);for(let n of i)if(l[n].replace("_","-")===e){const l=n;for(let i=0;i<a.length;i++)if(a[i].abbreviation===l){t._currencyByLocale[e]=a[i].sign;break}}return t._currencyByLocale[e]?t._currencyByLocale[e]:null}_getCurrencies(){return[{currency:"US Dollar",sign:"$",abbreviation:"USD"},{currency:"Euro",sign:"€",abbreviation:"EUR"},{currency:"Afghan Afghani",sign:"Af.",abbreviation:"AFN"},{currency:"Albanian Lek",sign:"Lek",abbreviation:"ALL"},{currency:"Algerian Dinar",sign:"din",abbreviation:"DZD"},{currency:"Angolan Kwanza",sign:"Kz",abbreviation:"AOA"},{currency:"Argentine Peso",sign:"$",abbreviation:"ARS"},{currency:"Armenian Dram",sign:"Dram",abbreviation:"AMD"},{currency:"Aruban Florin",sign:"Afl.",abbreviation:"AWG"},{currency:"Australian Dollar",sign:"$",abbreviation:"AUD"},{currency:"Azerbaijani Manat",sign:"₼",abbreviation:"AZN"},{currency:"Bahamian Dollar",sign:"$",abbreviation:"BSD"},{currency:"Bahraini Dinar",sign:"din",abbreviation:"BHD"},{currency:"Bangladeshi Taka",sign:"৳",abbreviation:"BDT"},{currency:"Barbadian Dollar",sign:"$",abbreviation:"BBD"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYN"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYR"},{currency:"Belize Dollar",sign:"$",abbreviation:"BZD"},{currency:"Bermudan Dollar",sign:"$",abbreviation:"BMD"},{currency:"Bhutanese Ngultrum",sign:"Nu.",abbreviation:"BTN"},{currency:"Bolivian Boliviano",sign:"Bs",abbreviation:"BOB"},{currency:"Bosnia-Herzegovina Convertible Mark",sign:"KM",abbreviation:"BAM"},{currency:"Botswanan Pula",sign:"P",abbreviation:"BWP"},{currency:"Brazilian Real",sign:"R$",abbreviation:"BRL"},{currency:"British Pound Sterling",sign:"£",abbreviation:"GBP"},{currency:"Brunei Dollar",sign:"$",abbreviation:"BND"},{currency:"Bulgarian Lev",sign:"лв.",abbreviation:"BGN"},{currency:"Burundian Franc",sign:"FBu",abbreviation:"BIF"},{currency:"Cambodian Riel",sign:"Riel",abbreviation:"KHR"},{currency:"Canadian Dollar",sign:"$",abbreviation:"CAD"},{currency:"Cape Verdean Escudo",sign:"CVE",abbreviation:"CVE"},{currency:"Cayman Islands Dollar",sign:"$",abbreviation:"KYD"},{currency:"CFA Franc BCEAO",sign:"CFA",abbreviation:"XOF"},{currency:"CFA Franc BEAC",sign:"FCFA",abbreviation:"XAF"},{currency:"CFP Franc",sign:"FCFP",abbreviation:"XPF"},{currency:"Chilean Peso",sign:"$",abbreviation:"CLP"},{currency:"Chinese Yuan",sign:"¥",abbreviation:"CNY"},{currency:"Chinese Yuan (offshore)",sign:"¥",abbreviation:"RMB"},{currency:"Colombian Peso",sign:"$",abbreviation:"COP"},{currency:"Comorian Franc",sign:"CF",abbreviation:"KMF"},{currency:"Congolese Franc",sign:"FrCD",abbreviation:"CDF"},{currency:"Costa Rican Colon",sign:"₡",abbreviation:"CRC"},{currency:"Croatian Kuna",sign:"kn",abbreviation:"HRK"},{currency:"Cuban Convertible Peso",sign:"$",abbreviation:"CUC"},{currency:"Cuban Peso",sign:"$",abbreviation:"CUP"},{currency:"Czech Republic Koruna",sign:"Kč",abbreviation:"CZK"},{currency:"Danish Krone",sign:"kr.",abbreviation:"DKK"},{currency:"Djiboutian Franc",sign:"Fdj",abbreviation:"DJF"},{currency:"Dominican Peso",sign:"RD$",abbreviation:"DOP"},{currency:"East Caribbean Dollar",sign:"$",abbreviation:"XCD"},{currency:"Egyptian Pound",sign:"£",abbreviation:"EGP"},{currency:"Eritrean Nakfa",sign:"Nfk",abbreviation:"ERN"},{currency:"Ethiopian Birr",sign:"Birr",abbreviation:"ETB"},{currency:"Falkland Islands Pound",sign:"£",abbreviation:"FKP"},{currency:"Fijian Dollar",sign:"$",abbreviation:"FJD"},{currency:"Gambian Dalasi",sign:"GMD",abbreviation:"GMD"},{currency:"Georgian Lari",sign:"GEL",abbreviation:"GEL"},{currency:"Ghanaian Cedi",sign:"GHS",abbreviation:"GHS"},{currency:"Gibraltar Pound",sign:"£",abbreviation:"GIP"},{currency:"Guatemalan Quetzal",sign:"Q",abbreviation:"GTQ"},{currency:"Guinean Franc",sign:"FG",abbreviation:"GNF"},{currency:"Guyanaese Dollar",sign:"$",abbreviation:"GYD"},{currency:"Haitian Gourde",sign:"HTG",abbreviation:"HTG"},{currency:"Honduran Lempira",sign:"L",abbreviation:"HNL"},{currency:"Hong Kong Dollar",sign:"$",abbreviation:"HKD"},{currency:"Hungarian Forint",sign:"Ft",abbreviation:"HUF"},{currency:"Icelandic Krona",sign:"kr",abbreviation:"ISK"},{currency:"Indian Rupee",sign:"₹",abbreviation:"INR"},{currency:"Indonesian Rupiah",sign:"Rp",abbreviation:"IDR"},{currency:"Iranian Rial",sign:"Rial",abbreviation:"IRR"},{currency:"Iraqi Dinar",sign:"din",abbreviation:""},{currency:"Israeli New Sheqel",sign:" ₪",abbreviation:"ILS"},{currency:"Jamaican Dollar",sign:"$",abbreviation:"JMD"},{currency:"Japanese Yen",sign:"¥",abbreviation:"JPY"},{currency:"Jordanian Dinar",sign:"din",abbreviation:"JOD"},{currency:"Kazakhstani Tenge",sign:"₸",abbreviation:"KZT"},{currency:"Kenyan Shilling",sign:"Ksh",abbreviation:"KES"},{currency:"Kuwaiti Dinar",sign:"din",abbreviation:"KWD"},{currency:"Kyrgystani Som",sign:"KGS",abbreviation:"KGS"},{currency:"Laotian Kip",sign:"₭",abbreviation:"LAK"},{currency:"Lebanese Pound",sign:"L£",abbreviation:"LBP"},{currency:"Lesotho Loti",sign:"LSL",abbreviation:"LSL"},{currency:"Liberian Dollar",sign:"$",abbreviation:"LRD"},{currency:"Libyan Dinar",sign:"din",abbreviation:"LYD"},{currency:"Lithuanian Litas",sign:"Lt",abbreviation:"LTL"},{currency:"Macanese Pataca",sign:"MOP",abbreviation:"MOP"},{currency:"Macedonian Denar",sign:"din",abbreviation:"MKD"},{currency:"Malagasy Ariary",sign:"Ar",abbreviation:"MGA"},{currency:"Malawian Kwacha",sign:"MWK",abbreviation:"MWK"},{currency:"Malaysian Ringgit",sign:"RM",abbreviation:"MYR"},{currency:"Maldivian Rufiyaa",sign:"Rf",abbreviation:"MVR"},{currency:"Mauritanian Ouguiya",sign:"MRO",abbreviation:"MRO"},{currency:"Mauritian Rupee",sign:"MURs",abbreviation:"MUR"},{currency:"Mexican Peso",sign:"$",abbreviation:"MXN"},{currency:"Moldovan Leu",sign:"MDL",abbreviation:"MDL"},{currency:"Mongolian Tugrik",sign:"₮",abbreviation:"MNT"},{currency:"Moroccan Dirham",sign:"dh",abbreviation:"MAD"},{currency:"Mozambican Metical",sign:"MTn",abbreviation:"MZN"},{currency:"Myanma Kyat",sign:"K",abbreviation:"MMK"},{currency:"Namibian Dollar",sign:"$",abbreviation:"NAD"},{currency:"Nepalese Rupee",sign:"Rs",abbreviation:"NPR"},{currency:"Netherlands Antillean Guilder",sign:"NAf.",abbreviation:"ANG"},{currency:"New Taiwan Dollar",sign:"NT$",abbreviation:"TWD"},{currency:"New Zealand Dollar",sign:"$",abbreviation:"NZD"},{currency:"Nicaraguan Cordoba",sign:"C$",abbreviation:"NIO"},{currency:"Nigerian Naira",sign:"₦",abbreviation:"NGN"},{currency:"North Korean Won",sign:"₩KP",abbreviation:"KPW"},{currency:"Norwegian Krone",sign:"kr",abbreviation:"NOK"},{currency:"Omani Rial",sign:"Rial",abbreviation:"OMR"},{currency:"Pakistani Rupee",sign:"Rs",abbreviation:"PKR"},{currency:"Panamanian Balboa",sign:"B/.",abbreviation:"PAB"},{currency:"Papua New Guinean Kina",sign:"PGK",abbreviation:"PGK"},{currency:"Paraguayan Guarani",sign:"Gs.",abbreviation:"PYG"},{currency:"Peruvian Nuevo Sol",sign:"S/.",abbreviation:"PEN"},{currency:"Philippine Peso",sign:"₱",abbreviation:"PHP"},{currency:"Polish Zloty",sign:"zł",abbreviation:"PLN"},{currency:"Qatari Rial",sign:"Rial",abbreviation:"QAR"},{currency:"Romanian Leu",sign:"RON",abbreviation:"RON"},{currency:"Russian Ruble",sign:"₽",abbreviation:"RUB"},{currency:"Rwandan Franc",sign:"RF",abbreviation:"RWF"},{currency:"Saint Helena Pound",sign:"£",abbreviation:"SHP"},{currency:"Samoan Tala",sign:"WST",abbreviation:"WST"},{currency:"Sao Tomean Dobra",sign:"Db",abbreviation:"STD"},{currency:"Saudi Riyal",sign:"Rial",abbreviation:"SAR"},{currency:"Serbian Dinar",sign:"din",abbreviation:"RSD"},{currency:"Seychellois Rupee",sign:"SCR",abbreviation:"SCR"},{currency:"Sierra Leonean Leone",sign:"SLL",abbreviation:"SLL"},{currency:"Singapore Dollar",sign:"$",abbreviation:"SGD"},{currency:"Solomon Islands Dollar",sign:"$",abbreviation:"SBD"},{currency:"Somali Shilling",sign:"SOS",abbreviation:"SOS"},{currency:"South African Rand",sign:"R",abbreviation:"ZAR"},{currency:"South Korean Won",sign:"₩",abbreviation:"KRW"},{currency:"South Sudanese Pound",sign:"£",abbreviation:"SSP"},{currency:"Sri Lankan Rupee",sign:"Rs",abbreviation:"LKR"},{currency:"Sudanese Pound",sign:"SDG",abbreviation:"SDG"},{currency:"Surinamese Dollar",sign:"$",abbreviation:"SRD"},{currency:"Swazi Lilangeni",sign:"SZL",abbreviation:"SZL"},{currency:"Swedish Krona",sign:"kr",abbreviation:"SEK"},{currency:"Swiss Franc",sign:"CHF",abbreviation:"CHF"},{currency:"Syrian Pound",sign:"£",abbreviation:"SYP"},{currency:"Tajikistani Somoni",sign:"Som",abbreviation:"TJS"},{currency:"Tanzanian Shilling",sign:"TSh",abbreviation:"TZS"},{currency:"Thai Baht",sign:"฿",abbreviation:"THB"},{currency:"Tongan Pa'anga",sign:"T$",abbreviation:"TOP"},{currency:"Trinidad and Tobago Dollar",sign:"$",abbreviation:"TTD"},{currency:"Tunisian Dinar",sign:"din",abbreviation:"TND"},{currency:"Turkish Lira",sign:"₺",abbreviation:"TRY"},{currency:"Turkmenistani Manat",sign:"m",abbreviation:"TMT"},{currency:"Ugandan Shilling",sign:"UGX",abbreviation:"UGX"},{currency:"Ukrainian Hryvnia",sign:"грн.",abbreviation:"UAH"},{currency:"United Arab Emirates Dirham",sign:"dh",abbreviation:"AED"},{currency:"Uruguayan Peso",sign:"$",abbreviation:"UYU"},{currency:"Uzbekistan Som",sign:"soʼm",abbreviation:"UZS"},{currency:"Vanuatu Vatu",sign:"VUV",abbreviation:"VUV"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VEF"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VES"},{currency:"Vietnamese Dong",sign:"₫",abbreviation:"VND"},{currency:"Yemeni Rial",sign:"Rial",abbreviation:"YER"},{currency:"Zambian Kwacha",sign:"ZMW",abbreviation:"ZMW"},{currency:"Zimbabwean Dollar",sign:"$",abbreviation:"ZWD"}].map((e=>(e.label=e.currency,e.menuLabel='<div style="display: flex; justify-content: space-between;"><span>'+e.currency+'</span><span style="opacity: 0.7;">'+e.sign+" 1,000.00</span></div>",e.value=e.abbreviation,e)))}_openAddStackColumnDialog(e,t,a){const l=this,i=l._dialogAddStackColumn||l._createDialog(l.editing.addColumnDialog),n=e?l.localize("dialogEditColumn",{value:e.label}):l.localize("dialogAddColumn"),o=i.querySelector(".smart-footer").querySelector(".smart-stack-layout"),r=l._getAddStackColumnDialogTemplate();i.classList.add("smart-grid-dialog-add-column"),i.type="add",i.editColumn=e||null,e&&e.element&&e.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),l._cellEditors||(l._cellEditors=[]),i.header.innerHTML=n,i.header.parentElement.classList.add("smart-hidden"),i.callback=a,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===l.view?(i.header.innerHTML=l.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),i.classList.add("view")):i.classList.remove("kanban")),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),l.cancelEdit(),i.content&&(i.content.innerHTML="");const s=document.createElement("div");s.classList.add("smart-content-layout-container"),i.content.appendChild(s),l._addStackColumnDialogEditors=[];const d=l._addStackColumnDialogEditors;if(l._initAddColumnDialogEditors(d,r,i,s),!l._dialogAddStackColumn){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i.onOpen=function(){const e=l._dialogAddStackColumn,t=l._getAddStackColumnDialogTemplate(),a=l._addStackColumnDialogEditors;l._addColumnDialogInitEditors(e,t,a),l._addColumnDialogShowHideEditors(e);const i=l.offset(l.$.columnHeader),n=l.$.columnHeader.offsetHeight,o=l.offset(l);if(e.style.maxHeight="",e.style.minHeight="",i.top+n+e.offsetHeight>window.innerHeight-o.top){const t=n+i.top+e.offsetHeight-window.innerHeight+o.top;e.style.maxHeight=Math.max(250,e.offsetHeight-t)+"px",e.style.minHeight="250px"}else e.style.maxHeight="",e.style.minHeight=""},i.onClose=function(){i.editColumn&&i.editColumn.element&&i.editColumn.element.removeAttribute("focus"),i.classList.remove("view"),i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){l._confirmAddColumnDialog(i),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&"kanban"!==l.view&&(i.result=!1,i.close())},l._dialogAddStackColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e)}const c=()=>{if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=l.offsetWidth+"px",void(i.style.height=l.offsetHeight+"px");{const e=l.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}i.open("center","center"),i.classList.add("center")};c(),i.refresh=()=>{c()}}_openImagePreviewDialog(e){const t=this,a=e?[...e.parentNode.parentNode.querySelectorAll("img")]:[];let l=e.hasAttribute("data-url")?e.getAttribute("data-url"):e.src;if((e=e.cloneNode()).src=l,!t._dialogImagePreview){t._dialogImagePreview=t._createDialog({modal:!0,screenModal:!0,left:"screenMiddle",top:"screenCenter",width:"80%",height:"80%"}),t._dialogImagePreview.content.innerHTML='<div style="width: 100%; height: 100%;"><div class="images-container"></div><div class="image-preview"></div></div>';const e=t._dialogImagePreview.content.firstElementChild;e.style.display="grid",e.style.gridTemplateColumns="50px 1fr"}const i=t._dialogImagePreview.querySelector(".images-container");i.innerHTML="";const n=(e,a)=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const l=150+Math.min(850,e.naturalWidth),i=150+Math.min(650,e.naturalHeight);t._dialogImagePreview.style.width=l+"px",t._dialogImagePreview.style.height=i+"px",!1!==a&&(t._dialogImagePreview.style.left="calc(50% - "+Math.min(850,t._dialogImagePreview.offsetWidth/2)+"px)",t._dialogImagePreview.style.top="calc(50% - "+Math.min(650,t._dialogImagePreview.offsetHeight/2)+"px)");const n=getComputedStyle(t._dialogImagePreview),o=parseInt(n.top),r=parseInt(n.left);if((window.offsetWidth<l||window.offsetHeight<i||o<0||r<0)&&(t._dialogImagePreview.style.left="0px",t._dialogImagePreview.style.top="0px",t._dialogImagePreview.style.width="100%",t._dialogImagePreview.style.height="100%"),o+i>window.innerHeight){const e=o+i-window.innerHeight;t._dialogImagePreview.style.height=i-e-20+"px"}e.style.maxWidth="100%",e.style.objectFit="contain",e.style.width="100%",e.style.height="calc(100% - 10px)"},o=()=>{const e=t._dialogImagePreview.querySelector(".images-container");let a=-1;return e.querySelectorAll("img").forEach(((e,t)=>{if(e.hasAttribute("active"))return a=t,!0})),a},r=e=>{const a=t._dialogImagePreview.querySelector(".images-container");e&&(e.hasAttribute("active")||a.querySelectorAll("img").forEach((t=>{t.style.borderColor="transparent",t.removeAttribute("active");let a=t.hasAttribute("data-url")?t.getAttribute("data-url").replaceAll("\\","/"):"";if(t.src===e.src||a===e.src){t.style.borderColor="var(--smart-primary)",t.setAttribute("active","");let e=t.src;t.hasAttribute("data-url")&&(e=t.getAttribute("data-url")),s.innerHTML=`<img src="${e}"/>`;const a=s.querySelector("img");a.onload=()=>{n(a,!1)}}})))};if(a.length>1)for(let t=0;t<a.length;t++){const l=a[t].cloneNode();l.style.width="40px",l.style.height="40px",l.style.cursor="pointer",l.style.borderStyle="solid",l.style.borderWidth="1px",l.style.borderColor="transparent",l.style.borderRadius="var(--smart-border)",l.style.marginTop="10px",l.title=a[t].title||a[t].parentNode.title,a[t].src===e.src&&(l.style.borderColor="var(--smart-primary)",l.setAttribute("active","")),i.appendChild(l),l.onmouseenter=()=>{l.style.borderColor="var(--smart-primary)"},l.onmouseleave=()=>{l.hasAttribute("active")||(l.style.borderColor="transparent")},l.onclick=()=>{r(l)}}const s=t._dialogImagePreview.content.querySelector(".image-preview");s.innerHTML="",s.style.overflow="auto",s.appendChild(e),t._dialogImagePreview.btnClose.onclick=e=>{t._dialogImagePreview.close(),e.preventDefault(),e.stopPropagation()},e.style.marginLeft="auto",e.style.marginRight="auto",e.style.maxWidth="",e.style.width="",e.style.height="",e.onload=()=>{n(e)},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){if("Escape"===e.key&&t._dialogImagePreview.close(),"ArrowUp"===e.key||"ArrowLeft"===e.key){const t=o();r(a[t-1]),e.stopPropagation(),e.preventDefault()}else if("ArrowDown"===e.key||"ArrowRight"===e.key){const t=o();r(a[t+1]),e.stopPropagation(),e.preventDefault()}},t._dialogImagePreview.btnClose.tabIndex=0,t._dialogImagePreview.onOpen=()=>{setTimeout((()=>{t._dialogImagePreview.btnClose.focus()}),100)},t._dialogImagePreview.footer.remove(),t._dialogImagePreview.header.parentNode.style.backgroundColor="var(--smart-background)",t._dialogImagePreview.open(),e&&r(e)}_getFileFromBase64(e,t){let a=e.split(","),l=a[0].match(/:(.*?);/)[1],i=atob(a[1]),n=i.length,o=new Uint8Array(n);for(;n--;)o[n]=i.charCodeAt(n);return new File([o],t,{type:l})}_getBase64(e,t){var a=new FileReader;a.readAsDataURL(e),a.onload=function(){t(a.result)},a.onerror=function(){t("error")}}_findIsFile(e){return"string"==typeof e&&(e.indexOf("http")>=0||e.indexOf("base64")>=0||e.indexOf('[{"value":"/')>=0)}_findUserFile(e){const t=this;if(e&&e.value.startsWith("/"))return!0;if(t.uploadSettings.userFiles)for(let a=0;a<t.uploadSettings.userFiles.length;a++){const l=t.uploadSettings.userFiles[a];if(l){let t=e.name||e.label;if(!t&&!e.label&&e.value){const a=e.value.split("/");t=a[a.length-1]}if(l.label===t)return l;if(l.label.indexOf("_")>=0&&(l.label.substring(0,l.label.lastIndexOf("_"))+l.label.substring(l.label.indexOf("."))).indexOf(t)>=0)return l;const a=l.value.replaceAll("\\","/");if(a===e.value||a===e.url)return l}}return null}_removeFiles(){const e=this,t=e._dialogFile,a=(t.preview.querySelectorAll(".item"),t.fileUpload),l=t.cell.value&&t.cell.value.indexOf("[{")>=0?JSON.parse(t.cell.value):[];if(e.uploadSettings.removeUrl){let i=new FormData,n=new XMLHttpRequest;for(let n=0;n<a.files.length;n++){let o=l[n]?l[n]:e.uploadSettings.url+"/"+a.files[n].name;if(t&&t.cell&&t.cell.value&&t.cell.value.indexOf("[")>=0){const e=JSON.parse(t.cell.value);for(let t=0;t<e.length;t++)if(e[t].label===a.files[n].name){o=e[t].value;break}}e._findUserFile(a.files[n])||i.append(e.uploadSettings.name,a.files[n])}for(let a=0;a<t.uploadedWithLink.length;a++){const l=t.uploadedWithLink[a];e._findUserFile(l)||i.append(e.uploadSettings.name,l)}n.open("POST",e.uploadSettings.removeUrl),n.send(i)}if(e.uploadSettings.onUploadRemove){const l=t.cell.value&&t.cell.value.indexOf("[{")>=0?JSON.parse(t.cell.value):[];for(let t=0;t<a.files.length;t++)l&&l[t]?e.uploadSettings.onUploadRemove(l[t]):e.uploadSettings.removeUrl&&e.uploadSettings.onUploadRemove(e.uploadSettings.removeUrl+"/"+a.files[t].name)}t.uploadedWithLink=[],a.value="",t.input.value="",e._updateFilePreview(),t.tabs[2].classList.contains("active")&&t.tabs[2].click()}_removeFile(e){const t=this,a=t._dialogFile,l=a.preview.querySelectorAll(".item"),i=e.name||e.label,n=a.fileUpload,o=new DataTransfer;l.forEach((e=>{let t=!0;e.file.name!==i&&e.file.label!==i||(t=!1),e.file.value&&(t=!1),t&&o.items.add(e.file)})),n.files=o.files,a.clearButton&&0===l.length&&a.clearButton.classList.remove("show");let r=t.uploadSettings.url+"/"+i;if(a&&a.cell&&a.cell.value&&a.cell.value.indexOf("[")>=0){const e=JSON.parse(a.cell.value);for(let t=0;t<e.length;t++)if(e[t].label===i){r=e[t].value;break}}let s=-1;for(let e=0;e<a.uploadedWithLink.length;e++){const t=a.uploadedWithLink[e];if(t&&t.label===i){s=e;break}}if(s>=0&&a.uploadedWithLink.splice(s,1),t.uploadSettings.userFiles)for(let e=0;e<t.uploadSettings.userFiles.length;e++){const l=t.uploadSettings.userFiles[e];if(l&&l.label===i)return void(a.tabs[2].classList.contains("active")&&a.tabs[2].click())}if(t.uploadSettings.onUploadRemove){let e=r;t.uploadSettings.onUploadRemove(e)}if(t.uploadSettings.removeUrl){let e=new FormData,a=new XMLHttpRequest;e.append(t.uploadSettings.name,r),a.open("POST",t.uploadSettings.removeUrl),a.send(e)}}getFileTypes(e){return e?["image/apng","image/bmp","image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon","video/x-msvideo","text/csv","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-fontobject","image/gif","application/json","text/plain","application/xml","application/zip","application/gzip","application/pdf","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/x-7z-compressed","application/vnd.rar","application/rtf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/x-zip-compressed"]:["image/apng","image/bmp","image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon"]}_getFileSize(e){return"string"==typeof e?e:e<1024?e+"bytes":e>=1024&&e<1048576?((e/1024).toFixed(1)+"KB").replace(".0",""):e>=1048576?(e/1048576).toFixed(1)+"MB":void 0}_getFileListItem(e){const t=this,a=t._dialogFile,l=a.acceptFiles,i=document.createElement("div");e.name||(e.name=e.label);const n=e.size||0;i.classList.add("item"),i.onpointerdown=n=>{const o=i.getBoundingClientRect();if(a.input.value="",n.clientY>=o.bottom-12)n.clientX>o.left+o.width/2-13&&n.clientX<o.left+o.width/2+13&&(i.remove(),t._removeFile(i.file));else if(l){if(e.value){const t=document.createElement("a");return t.href=e.value,t.target="_blank",void t.click()}const t=URL.createObjectURL(e),a=document.createElement("a");a.download=e.name,a.href=t,a.click()}else t._openImagePreviewDialog(i.querySelector("img"))};const o=document.createElement("div"),r=n?`, ${t._getFileSize(e.size)}.`:"";let s;return o.textContent=o.textContentTitle=`${e.name}${r}`,o.textContent.length>20&&(o.textContent=`${e.name.substring(0,5)}...${e.name.substring(e.name.length-4)} ${r}`),a.objectURL||(a.objectURL=[]),a.objectURL[e.name+"_"+n]||(e.small?a.objectURL[e.name+"_"+n]=e.small?e.small:URL.createObjectURL(e):e.medium?a.objectURL[e.name+"_"+n]=e.medium?e.medium:URL.createObjectURL(e):a.objectURL[e.name+"_"+n]=e.value?e.value:URL.createObjectURL(e)),l?(s=document.createElement("div"),s.classList.add("attachment","smart-grid-icon","show"),e.name.indexOf(".pdf")>=0?s.classList.add("smart-icon-pdf"):e.name.indexOf(".png")>=0||e.name.indexOf(".jpg")>=0||e.name.indexOf(".jpeg")>=0||e.name.indexOf(".gif")>=0?s.classList.add("smart-icon-image"):e.name.indexOf(".tsv")>=0||e.name.indexOf(".txt")>=0||e.name.indexOf(".csv")>=0?s.classList.add("smart-icon-text"):e.name.indexOf(".xls")>=0||e.name.indexOf(".xlsx")>=0?s.classList.add("smart-icon-excel"):e.name.indexOf(".ppt")>=0?s.classList.add("smart-icon-powerpoint"):e.name.indexOf(".zip")>=0||e.name.indexOf(".rar")>=0||e.name.indexOf(".7z")>=0?s.classList.add("smart-icon-archive"):e.name.indexOf(".doc")>=0||e.name.indexOf(".docx")>=0?s.classList.add("smart-icon-word"):s.classList.add("smart-icon-file")):(s=document.createElement("img"),s.loading="lazy",s.src=a.objectURL[e.name+"_"+n],s.onerror=()=>{if(i.style.display="none",a.uploadedWithLink.length){const t=a.uploadedWithLink.indexOf(e);t>=0&&a.uploadedWithLink.splice(t,1)}}),i.file=e,i.title=o.textContentTitle||o.textContent,i.appendChild(s),i.appendChild(o),i}_updateFilePreview(){const e=this,t=e._dialogFile,a=t.preview,l=t.fileUpload;for(;a.firstChild;)a.removeChild(a.firstChild);const i=()=>{const l=document.createElement("div");l.classList.add("list");const i=document.createElement("div");i.classList.add("smart-grid-icon","show","smart-icon-delete"),i.title=e.localize("clear"),a.appendChild(i),i.onclick=()=>{e._removeFiles()},t.clearButton=i,a.appendChild(l)},n=l.files;if(0===n.length)if(0===t.uploadedWithLink.length){const t=document.createElement("p");t.textContent=e.localize("dialogFileFileUpload"),a.appendChild(t)}else i();else{i();const o=new DataTransfer,r=t.column.editor.maxImages||e.uploadSettings.uploadMaxCount||5,s=t.column.editor.maxImageSize||e.uploadSettings.uploadMaxSize||524288;let d=0,c=[];for(const l of n){if(!e._validateFileType(l))continue;const i=e._getFileListItem(l);if(d>=r)c.push(l.name);else if(l.size>s){const t=document.createElement("p");t.textContent=t.textContentTitle=e.localize("dialogFileSize",{value:l.name,fileSize:e._getFileSize(s)}),a.appendChild(t)}else o.items.add(l),t.preview.querySelector(".list").appendChild(i),d++}if(c.length>0){const t=document.createElement("p");t.textContent=e.localize("dialogFileCount",{files:c.toString(),fileCount:r}),a.appendChild(t)}l.files=o.files}if(t.uploadedWithLink&&t.uploadedWithLink.length)for(let a=0;a<t.uploadedWithLink.length;a++){const l=t.uploadedWithLink[a];if(l){const a=e._getFileListItem(l);l.name=l.label,a.file=l,t.preview.lastChild.appendChild(a)}}}_validateFileType(e){return this.getFileTypes(this._dialogFile.acceptFiles).includes(e.type)}_getFileIndex(e){const t=this._dialogFile;let a=-1;for(let l=0;l<t.uploadedWithLink.length;l++){const i=t.uploadedWithLink[l];if(i.label===e.name||i.label===e.label&&(void 0!==i.label||void 0!==e.label)){a=l;break}if(i.name===e.name||i.name===e.label){a=l;break}if(e.label.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}}for(let l=0;l<t.fileUpload.files.length;l++){const i=t.fileUpload.files[l];if(i.label===e.name||i.label===e.label&&(void 0!==i.label||void 0!==e.label)){a=l;break}if(i.name===e.name||i.name===e.label){a=l;break}if(e.label&&e.label.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}if(e.name&&e.name.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}}return a}_openFileDialog(e,t=!1){const a=this,l=a._dialogFile||a._createDialog(),i='<span class="smart-grid-icon '+(!1===t?"smart-icon-image":"smart-icon-docs")+' show"></span>'+(!1===t?a.localize("dialogImageFileHeader"):a.localize("dialogFileHeader"));if(l.cell=e,l.header.innerHTML=i,l.column=e.column,l.acceptFiles=t,l.classList.add("smart-grid-image-dialog"),!a._dialogFile){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel");const e=()=>{l.loader&&l.loader.classList.add("smart-hidden"),l.close()};l.onOpen=function(){l.fileUpload.value="",l.input.value="",l.uploadedWithLink=[];let e=l.cell.editor.instance.getValue();if("[]"===e)return void l.tabs[0].click();l.tabs[0].click();let t=!0;const i=new DataTransfer;if(("string"==typeof e&&e.indexOf("base64")>=0||"string"==typeof e&&e.indexOf("[{")>=0)&&(e=JSON.parse(e)),Array.isArray(e)){let n=0;e.forEach((async o=>{if(t=!1,"string"==typeof o.value&&o.value.indexOf("base64")>=0&&(t=!0),t)i.items.add(a._getFileFromBase64(o.value,o.label));else{const t=(t,i)=>{a.uploadSettings.url&&(a._findUserFile(t)?(l.uploadedWithLink.push(t),n++,n===e.length&&a._updateFilePreview()):i("error"))};o.value.indexOf(window.location.host)>=0?t(o,(t=>{"error"!==t&&i.items.add(t),n++,n===e.length&&(l.fileUpload.files=i.files,a._updateFilePreview())})):(l.uploadedWithLink.push(o),n++,n===e.length&&a._updateFilePreview())}})),l.fileUpload.files=i.files,a._updateFilePreview()}else a._updateFilePreview()},l.onClose=function(){},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){let i=[],n=[...l.fileUpload.files];l.loader?l.loader.classList.remove("smart-hidden"):(l.loader=document.createElement("div"),l.loader.classList.add("smart-grid-loader"),l.loader.style.width=l.loader.style.height="24px",l.btnConfirm.parentNode.insertBefore(l.loader,l.btnConfirm)),l.uploadedWithLink&&l.uploadedWithLink&&l.uploadedWithLink.length&&(i=i.concat(l.uploadedWithLink)),(()=>{if(l.cell.value&&"string"==typeof l.cell.value){const e=JSON.parse(l.cell.value);e&&e.length&&(n=n.filter((t=>{let a=!0;return e.forEach((e=>{if(e.label===t.name&&(a=!1,!a)){const t={value:e.value,label:e.label};e.small&&(t.small=e.small),e.medium&&(t.medium=e.medium),e.large&&(t.large=e.large),i.push(t)}})),a})))}})();const o=()=>{const t=l.cell.value;l.cell.editor.instance.setValue(i),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&(a._endCellEdit(l.cell),a._handleFileColumnHistory(l.cell.row,l.cell.column.dataField,t,i)),e()};if(a.uploadSettings.url){const r=(t,i)=>{const n=t.filter((e=>-1!==e.value.indexOf(window.location.host)));if(i&&i[0]&&"error"===i[0].response&&(a.cancelEdit(),e()),n.length===l.fileUpload.files.length+l.uploadedWithLink.length){(i.files||i[0])&&a.uploadSettings.onUploadCompleted&&a.uploadSettings.onUploadCompleted({files:l.fileUpload.files,status:200,serverResponse:i});const t=l.cell.column.dataField;let o=l.cell.value;l.cell.editor.instance.setValue(n),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&(a._endCellEdit(l.cell),a._handleFileColumnHistory(l.cell.row,t,o,n)),e()}};if(0===n.length&&0===l.uploadedWithLink.length)l.cell.editor.instance.setValue(i),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&a._endCellEdit(l.cell),e();else if(a.uploadSettings.singleFilePost){let e=!1;for(let o=0;o<n.length;o++){const s=[];s.push(n[o]),a._handleFileUpload(l,s,i,t?"file":"image",r),e=!0}for(let t=0;t<l.uploadedWithLink.length;t++){const n=[];a._findUserFile(l.uploadedWithLink[t])||(n.push(l.uploadedWithLink[t].value),a._handleFileUpload(l,n,i,"url",r),e=!0)}e||o()}else if(n.length&&a._handleFileUpload(l,n,i,t?"file":"image",r),l.uploadedWithLink.length){const e=l.uploadedWithLink.filter((e=>!a._findUserFile(e)));if(e.length){const t=e.map((e=>e.value));a._handleFileUpload(l,t,i,"url",r)}else i.length===l.fileUpload.files.length+l.uploadedWithLink.length&&o()}}else{let e=0;for(let t=0;t<n.length;t++){const l=n[t];a._getBase64(l,(t=>{"error"===t&&console.log("Image load error"),e++,i.push({value:t,label:l.name}),e===n.length&&o()}))}0===n.length&&o()}},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogFile=l,l.content.innerHTML=`\n <div>\n <div>\n <div class="tabs">\n <div class="active tab">\n <span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogFileDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${a.localize("dialogFileLink")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-cloud show"></span><label>${a.localize("dialogMyFiles")}</label>\n </div>\n </div>\n </div>\n <div class="smart-grid-drop-zone">\n <div>\n <div class="title"><span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogFileUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${a.localize("dialogFileDrop")}</label></div>\n </div> \n <input accept=".jpg, .jpeg, .png" type="file" multiple="multiple" style="display: none;">\n </div>\n <div class="smart-hidden url-zone">\n <div class="url-title">\n ${a.localize("dialogFileURL")}\n </div>\n <div class="upload">\n <smart-input placeholder="https://example.com/image.png" class="underlined"></smart-input>\n <br/>\n <smart-button disabled class="success">${a.localize("dialogFileURLUpload")}</smart-button>\n </div>\n </div>\n <div class="smart-hidden smart-grid-file-zone">\n \n <div class="files">\n </div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-attention-circled show"></span><label>${a.localize("dialogMyFilesTitle")}</label></div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,l.input=l.querySelector("smart-input"),l.dropZone=l.querySelector(".smart-grid-drop-zone"),l.upload=l.querySelector(".title"),l.fileUpload=l.querySelector("input"),l.preview=l.querySelector(".preview"),l.tabs=l.querySelectorAll(".tab"),l.urlZone=l.querySelector(".url-zone"),l.fileZone=l.querySelector(".smart-grid-file-zone"),l.files=l.querySelector(".smart-grid-file-zone .files"),l.uploadButton=l.querySelector("smart-button"),l.input.accept=t?".jpg, .jpeg, .png, .pdf, .xls, .xlsx, .doc, .docx, .gif, .csv, .txt, .xml, .zip, .rtf, .ppt, .pptx, .avi, .html, .htm":".jpg, .jpeg, .png, .gif",l.dropZone.ondrop=l.dropZone.dropHere=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;const i=l.column.editor.maxImages||5;for(let l=0;l<e.dataTransfer.items.length;l++)if("file"===e.dataTransfer.items[l].kind){const i=e.dataTransfer.items[l].getAsFile();a._validateFileType(i)&&t++}if(t===e.dataTransfer.files.length||t===i){const t=new DataTransfer;let n=[...e.dataTransfer.files],o=[...l.fileUpload.files];n.length>i&&(n=n.slice(0,5)),o.length>i&&(o=o.slice(0,5)),o.forEach(((e,a)=>{a<i&&t.items.add(e)})),n.forEach(((e,a)=>{a<i&&t.items.add(e)})),l.fileUpload.files=t.files,a._updateFilePreview()}}else l.fileUpload.files=e.dataTransfer.files,a._updateFilePreview()},l.dropZone.ondragover=e=>{e.preventDefault()},l.tabs[0].onclick=()=>{l.tabs[0].classList.add("active"),l.tabs[1].classList.remove("active"),l.tabs[2].classList.remove("active"),l.dropZone.classList.remove("smart-hidden"),l.fileZone.classList.add("smart-hidden"),l.urlZone.classList.add("smart-hidden")},l.tabs[1].onclick=()=>{l.tabs[0].classList.remove("active"),l.tabs[1].classList.add("active"),l.tabs[2].classList.remove("active"),l.dropZone.classList.add("smart-hidden"),l.fileZone.classList.add("smart-hidden"),l.urlZone.classList.remove("smart-hidden")},l.tabs[2].onclick=()=>{if(l.tabs[0].classList.remove("active"),l.tabs[1].classList.remove("active"),l.tabs[2].classList.add("active"),l.dropZone.classList.add("smart-hidden"),l.urlZone.classList.add("smart-hidden"),l.fileZone.classList.remove("smart-hidden"),l.files.innerHTML="",a.uploadSettings.userFiles&&a.uploadSettings.userFiles.length){const e=document.createDocumentFragment();a.uploadSettings.userFiles.forEach((t=>{Array.isArray(t)&&(t=t[0]);let i=t;"string"==typeof t.value&&t.value.indexOf("base64")>=0&&(t=a._getFileFromBase64(t.value,t.label)),t.type||(t.type="unknown");const n=a._getFileListItem(t);a._validateFileType(t)&&(a._getFileIndex(t)>=0&&n.classList.add("active"),n.onpointerdown=()=>{n.classList.toggle("active");let e=a._getFileIndex(t);n.classList.contains("active")?e<0&&l.uploadedWithLink.push({label:i.name||i.label,value:i.value}):a._removeFile(i),a._updateFilePreview()},e.appendChild(n))})),l.files.appendChild(e)}},l.uploadButton.onclick=()=>{const e=this,t=l.input.value,a=t.split("/"),i=a[a.length-1];if(l.column&&l.column.editor&&e.uploadSettings.url){const a={value:t,label:i},n=e._findUserFile(a);for(let e=0;e<l.uploadedWithLink.length;e++){if(l.uploadedWithLink[e].label===i)return;if(n&&l.uploadedWithLink[e].label===n.label)return}l.uploadedWithLink.push(n||a),e._updateFilePreview()}else{const a={value:t,label:i};for(let e=0;e<l.uploadedWithLink.length;e++)if(l.uploadedWithLink[e].label===i)return;l.uploadedWithLink.push(a),e._updateFilePreview()}l.input.value="",l.uploadButton.disabled=!0},l.fileUpload.onchange=()=>{if(0===l.fileUpload.files.length&&l._tempFiles)l.fileUpload.files=l._tempFiles;else if(l._tempFiles){const e=new DataTransfer,t=[...l.fileUpload.files],i=[...l._tempFiles];i.forEach((t=>{e.items.add(t)})),t.forEach((t=>{let l=!0;a._validateFileType(t)||(l=!1),i.forEach((e=>{e.name===t.name&&e.size===t.size&&e.lastModified===t.lastModified&&(l=!1)})),l&&e.items.add(t)})),l.fileUpload.files=e.files}a._updateFilePreview()},l.input.onchange=l.input.onblur=l.input.onkeyup=()=>{l.uploadButton.disabled=!l.input.value||!l.input.value.startsWith("https://");const e=l.input.value,t=e.split("/"),i=t[t.length-1];if(l.column&&l.column.editor&&a.uploadSettings.url){const t={value:e,label:i},n=a._findUserFile(t);for(let e=0;e<l.uploadedWithLink.length;e++)l.uploadedWithLink[e].label===i&&(l.uploadButton.disabled=!0),n&&l.uploadedWithLink[e].label===n.label&&(l.uploadButton.disabled=!0)}},l.upload.onclick=()=>{l._tempFiles=[];const e=new DataTransfer;[...l.fileUpload.files].forEach((t=>{e.items.add(t)})),l._tempFiles=e.files,l.fileUpload.click()}}l.fileUpload.accept=t?".jpg, .jpeg, .png, .pdf, .xls, .xlsx, .doc, .docx, .gif, .csv, .txt, .xml, .zip, .rtf, .ppt, .pptx, .avi, .html, .htm":".jpg, .jpeg, .png, .gif",l.open(),setTimeout((function(){l.btnConfirm.focus()}),100)}_handleFileUpload(e,t,a,l,i){const n=this;if(l||(l="image"),e.column&&e.column.editor&&n.uploadSettings.url){const o=new FormData,r=n.uploadSettings.url;let s=!1;const d=t[0],c=n.uploadSettings.data;c&&""!==c&&("string"==typeof c?o.append("postData",c):o.append("postData",JSON.stringify(c))),o.append("fileType",l);for(let e=0;e<t.length;e++)o.append(n.uploadSettings.name,t[e]),s=!0;let u=new XMLHttpRequest;u.open("POST",r),n.uploadSettings.onSetHeaders&&"function"==typeof n.uploadSettings.onSetHeaders&&n.uploadSettings.onSetHeaders(u,d),s&&n.$.fireEvent("uploadStarted",{files:t,size:d.size}),n.uploadSettings.onUploadStarted&&n.uploadSettings.onUploadStarted({files:t,status:u.status}),u.upload.onprogress=function(e){n.uploadSettings.onProgress&&n.uploadSettings.onProgress(e)},u.onabort=function(e){n.uploadSettings.onAbort&&n.uploadSettings.onAbort(e)},u.onerror=function(e){n.uploadSettings.onError&&n.uploadSettings.onError(e)},u.onload=function(){let e=!1;if(u.response&&("string"==typeof u.response?(e=u.response,e.indexOf("[{")>=0&&(e=JSON.parse(u.response))):e=JSON.parse(u.response)),u.status>=200&&u.status<=299){const o=(e,t)=>{if(e.response&&e.response.response&&"success"!==e.response.response)return null;let a=!1;u.fileURL&&(a=u.file_url);let l={};e&&e.file_url?a=e.file_url:e&&e[0]&&e[0].file_url&&(a=e[0].file_url);let i=!1;e&&e.file_url_small?i=e.file_url_small:e&&e[0]&&e[0].file_url_small&&(i=e[0].file_url_small);let n=!1;e&&e.file_url_medium?n=e.file_url_medium:e&&e[0]&&e[0].file_url_medium&&(n=e[0].file_url_medium);let o=!1;return e&&e.file_url_large?o=e.file_url_large:e&&e[0]&&e[0].file_url_large&&(o=e[0].file_url_large),a&&(l.value=a),i&&(l.small=i),n&&(l.medium=n),o&&(l.large=o),l.label=t,l};for(let i=0;i<t.length;i++){const r=t[i].name?[]:t[i].split("/"),s="url"===l?r[r.length-1]:t[i].name;n.uploadSettings.url;const d=o((e.files||e[0]&&e[0].files||[e[0]])[i],s);d&&a.push(d)}i(a,e)}else i(a,e),n.uploadSettings.onUploadError&&n.uploadSettings.onUploadError({files:t,status:u.status,serverResponse:e})},u.onreadystatechange=function(){e.column.editor.responseHandler&&"function"==typeof e.column.editor.responseHandler&&e.column.editor.responseHandler(u)},s&&u.send(o),n.uploadSettings.onChange&&n.uploadSettings.onChange(t)}}_handleFileColumnHistory(e,t,a,l){const i=this;if(i.storeHistory){a&&"string"==typeof a&&(a=(a=(a=JSON.parse(a)).map((e=>e.label))).toString()),a&&(Array.isArray(a)&&(a=a.map((e=>e.label))),a=a.toString()),null==a&&(a=""),l&&"string"==typeof l&&(l=(l=(l=JSON.parse(l)).map((e=>e.label))).toString()),null==l&&(l=""),l&&(Array.isArray(l)&&(l=l.map((e=>e.label))),l=l.toString());const n={user:i._currentUser.info.id,date:e.updatedDate};n.action=t,n.details={oldValue:a,value:l},e.addHistory(n)}}});
|
|
6
|
+
Smart.Utilities.Assign("Grid.Dialog",class{_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}updateRelation(e,t){const a=this;for(let l=0;l<a.dataSourceSettings.relations.length;){const i=a.dataSourceSettings.relations[l];if(i.id===e){t.label&&(i.label=t.label),t.label&&(i.label=t.label),t.columns&&(i.columns=t.columns),t.dataSource&&(i.dataSource=t.dataSource);for(let t=0;t<a.columns.length;t++){const l=a.columns[t];if(l.relationField&&l.relationId&&l.relationId===e){const e=a._getRelationData(l.relationId,l.relationField);l.editor?(l.editor.isDirty=!0,l.editor.dataSource=e):l.editor={template:"multiComboInput",readonly:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,relationId:l.relationId,relationField:l.relationField,pills:!0,singleSelect:!0,dataSource:e}}}a._recycle();break}}}_dragDialog(e,t){const a=this,l=a._dialogDragDetails.dialog;if(!e||l.pinned||l.maximized)return;if(!a._dialogDragDetails.started)return;let i,n;i=e.pageX-a._dialogDragDetails.x,n=e.pageY-a._dialogDragDetails.y;const o=Math.max(a._windowParent.element.clientHeight,a._windowParent.scrollElement.scrollHeight),r=Math.max(a._windowParent.element.clientWidth,a._windowParent.scrollElement.scrollWidth);switch(t){case"horizontal":a._dialogDragDetails.windowX=Math.max(0,Math.min(a._dialogDragDetails.windowX+i,r-l.offsetWidth)),l.style.left=a._dialogDragDetails.windowX+"px";break;case"vertical":a._dialogDragDetails.windowY=Math.max(0,Math.min(a._dialogDragDetails.windowY+n,o-l.offsetHeight)),l.style.top=a._dialogDragDetails.windowY+"px";break;case"both":a._dialogDragDetails.windowX=Math.max(0,Math.min(a._dialogDragDetails.windowX+i,r-l.offsetWidth)),a._dialogDragDetails.windowY=Math.max(0,Math.min(a._dialogDragDetails.windowY+n,o-l.offsetHeight)),l.style.left=a._dialogDragDetails.windowX+"px",l.style.top=a._dialogDragDetails.windowY+"px"}a._dialogDragDetails.top=l.offsetTop,a._dialogDragDetails.left=l.offsetLeft,a._dialogDragDetails.x=Math.max(a._windowParent.offsetLeft+a._dialogDragDetails.offsetX-a._windowParent.scrollElement.scrollLeft,Math.min(a._windowParent.offsetLeft+a._windowParent.element.offsetWidth-(a._windowParent.element.offsetWidth-l.offsetLeft)+a._dialogDragDetails.offsetX,e.pageX)),a._dialogDragDetails.y=Math.max(a._windowParent.offsetTop+a._dialogDragDetails.offsetY-a._windowParent.scrollElement.scrollTop,Math.min(a._windowParent.offsetTop+a._windowParent.element.offsetHeight-(a._windowParent.element.offsetHeight-l.offsetTop)+a._dialogDragDetails.offsetY,e.pageY))}_updateDialogDragDetails(e,t,a){const l=this;if(l._windowParent={initialParent:t.parentElement,element:document.documentElement,scrollElement:document.scrollingElement},l._dialogDragDetails||(l._dialogDragDetails={}),void 0===l._dialogDragDetails.minWidth||void 0===l._dialogDragDetails.minHeight||void 0===l._dialogDragDetails.maxWidth||void 0===l._dialogDragDetails.maxHeight){const e=getComputedStyle(t);l._dialogDragDetails.minWidth=parseFloat(e.getPropertyValue("min-width"))||0,l._dialogDragDetails.minHeight=parseFloat(e.getPropertyValue("min-height"))||0,l._dialogDragDetails.maxWidth=parseFloat(e.getPropertyValue("max-width"))||0,l._dialogDragDetails.maxHeight=parseFloat(e.getPropertyValue("max-height"))||0}l._dialogDragDetails.dialog=t,l._dialogDragDetails.windowX=t.offsetLeft,l._dialogDragDetails.windowY=t.offsetTop;const i=t.getBoundingClientRect(),n=t.parentElement===document.body?document.documentElement.getBoundingClientRect():t.parentElement?t.parentElement.getBoundingClientRect():document.documentElement.getBoundingClientRect(),o=window.scrollX||window.pageXOffset,r=window.scrollY||window.pageYOffset;l._windowParent.offsetLeft=n.left+o,l._windowParent.offsetTop=n.top+r,a&&"object"==typeof a&&(l._dialogDragDetails.offsetX=a.clientX-i.left,l._dialogDragDetails.offsetY=a.clientY-i.top),t.collapsed||(l.hasAnimation&&"minimize"===e?(l._dialogDragDetails.width=l._dialogDragDetails.width?l._dialogDragDetails.width:t.offsetWidth,l._dialogDragDetails.height=l._dialogDragDetails.height?l._dialogDragDetails.height:t.offsetHeight):(l._dialogDragDetails.width=t.offsetWidth,l._dialogDragDetails.height=t.offsetHeight),(t.style.width||t.style.height)&&(l._dialogDragDetails.resized=!0)),"minimize"!==e&&e&&(l._dialogDragDetails.type=e,l._dialogDragDetails.started=!0,l._dialogDragDetails.snapWindowWidth=t.offsetWidth,l._dialogDragDetails.snapWindowHeight=t.offsetHeight,a&&"object"==typeof a?(l._dialogDragDetails.x=a.pageX,l._dialogDragDetails.y=a.pageY):(l._dialogDragDetails.x=t.offsetLeft,l._dialogDragDetails.y=t.offsetTop))}_createDialog(e){const t=this;let a=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(a.modal=e.modal),void 0!==e.screenModal&&(a.screenModal=e.screenModal),a.setAttribute("animation","none"),a.classList.add("smart-window","smart-grid-dialog"),a.style.width="auto"===e.width?e.width:e.width+"px",a.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(a.style.width=e.width),e.height&&"string"==typeof e.height&&(a.style.height=e.height),a.style.left="",a.style.top="",a.innerHTML=`<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div id="headerSection" class="smart-header-section">\n <div class="smart-header">\n </div>\n <div class="smart-buttons-container">\n <button title="${t.localize("contextMenuItemDelete")}" tabindex=-1 class="smart-visibility-hidden smart-hidden smart-delete-button smart-grid-icon smart-icon-delete show smart-button smart-element" aria-label="Delete Row" smart-id="deleteButton"></button>\n <button title="${t.localize("copyURL")}" tabindex=-1 class="smart-visibility-hidden smart-hidden smart-copy-row-button smart-grid-icon smart-icon-link show smart-button smart-element" aria-label="Copy URL" smart-id="urlButton"></button>\n <button title="${t.localize("dialogEditHeaderMenu")}" tabindex=-1 class ="smart-visibility-hidden smart-hidden checked smart-comments-button smart-grid-icon smart-icon-menu show smart-button smart-element" aria-label="Comments" smart-id="commentsButton"></button>\n <button title="${t.localize("close")}" class ="smart-button smart-element smart-close-button" aria-label="Close" smart-id="closeButton"></button>\n </div>\n </div>\n <div class="smart-content"><div class="smart-content-container"></div></div>\n <div class ="smart-footer">\n \n <div class ="smart-stack-layout right spacing">\n <smart-button class ="smart-confirm-button item primary">Ok</smart-button>\n <smart-button class ="smart-cancel-button item">Cancel</smart-button>\n </div>\n </div>\n </div>\n </div>\n `,a.querySelector&&a.querySelector(".smart-content")&&(a.content=a.querySelector(".smart-content").firstChild),a.footer=a.querySelector(".smart-footer"),a.header=a.querySelector(".smart-header"),a.btnConfirm=a.querySelector(".smart-confirm-button"),a.btnCancel=a.querySelector(".smart-cancel-button"),a.btnDelete=a.querySelector(".smart-delete-button"),a.btnClose=a.querySelector(".smart-close-button"),a.btnComments=a.querySelector(".smart-comments-button"),a.btnLink=a.querySelector(".smart-copy-row-button"),a.headerSection=a.querySelector(".smart-header-section"),a.btnLink.onclick=()=>{let e=document.createElement("input"),t=window.location.href+"#activeRows="+a.row.id;navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(t).then((()=>{})):(document.body.appendChild(e),e.value=t,e.select(),document.execCommand("copy"),document.body.removeChild(e))},a.btnDelete.onclick=()=>{const e=a.row.id,l=t.editing.deleteDialog.enabled;t.editing.deleteDialog.enabled=!0,t.cancelEdit(),a.close(),t._openDeleteRowDialog(e,(function(e){t._endToolbarEdit&&t._endToolbarEdit(),t.deleteRow(e)})),t.editing.deleteDialog.enabled=l,a.close()},a.btnComments.onclick=()=>{const e=a.querySelector(".smart-grid-edit-dialog-layout");e&&e.classList.toggle("hide-activity"),a.btnComments.classList.toggle("checked")},!1!==a.allowDrag&&(a.headerSection.onpointerdown=e=>{t._updateDialogDragDetails("drag",a,e)},a.headerSection.onpointerup=()=>{t._dialogDragDetails&&(t._dialogDragDetails.started=!1)});const l=document.createElement("div");return l.classList.add("smart-grid-dialog-overlay"),l.onclick=function(){a.overlayClick&&a.overlayClick()},a.overlay=l,a.remove=function(){a.parentNode&&a.parentNode.removeChild(a)},a.close=function(){a.classList.contains("open")&&(a.classList.remove("open"),delete t._resizeHandling,a.addEventListener("transitionend",a.remove),a.addEventListener("transitioncancel",a.remove),a.modal&&a.overlay.parentNode&&a.overlay.parentNode.removeChild(a.overlay),t.layout.isDirty&&"grid"===t.view&&(t._resetCachedLayout(),t._refreshLayout(),t.refresh()),a.onClose&&a.onClose())},a.open=function(l,i){a.removeEventListener("transitionend",a.remove),a.removeEventListener("transitioncancel",a.remove),t.isInShadowDOM?t.getRootNode().appendChild(a):document.body.appendChild(a),t._resizeHandling=!1,void 0===l&&(l=e.left),void 0===i&&(i=e.top),requestAnimationFrame((function(){a.classList.add("open");const e=a.querySelector('[bind="name"]');if(e){const a=e.querySelector("smart-input");a&&t.editing.enabled&&a.focus()}const n=function(e,l){const i=t.offset(t);switch("center"===e&&"horizontal"===l&&(e="middle"),e){case"top":return i.top;case"bottom":return Math.max(i.top,i.top+t.offsetHeight-a.offsetHeight);case"center":return Math.max(i.top,i.top+t.offsetHeight/2-a.offsetHeight/2);case"left":return i.left;case"middle":return i.left+t.offsetWidth/2-a.offsetWidth/2;case"right":return i.left+t.offsetWidth-a.offsetWidth}return"horizontal"===l?parseInt(e)+i.left:"vertical"===l?parseInt(e)+i.top:"number"==typeof e?e:parseInt(e)};a.style.left=n(l,"horizontal")+"px",a.style.top=n(i,"vertical")+"px",a.setPosition=(e,t)=>{t?a.style.left=n(e,"horizontal")+"px":a.style.top=n(e,"vertical")+"px"},"center"===l&&parseInt(a.style.left)<0&&(a.style.left="5%",a.style.maxWidth="90%"),"screenMiddle"===l&&(a.style.left="calc(50% - "+a.offsetWidth/2+"px)"),"screenCenter"===i&&(a.style.top="calc(50% - "+a.offsetHeight/2+"px)")})),a.modal&&(a.screenModal?t.isInShadowDOM?t.getRootNode().appendChild(a.overlay):document.body.appendChild(a.overlay):t.appendChild(a.overlay)),a.onOpen&&a.onOpen()},a}_openAddRowDialog(e,t){const a=this;if(!a.editing.addDialog.enabled)return!1;const l=a._dialogAddRow||a._createDialog(),i="{{message}}"===a.editing.dialog.header?a.localize("dialogAddHeader"):a.editing.dialog.header,n=l.content;l.header.innerHTML=i,e.grid=a,void 0===e.index&&(e.index=a.rows.length,a._rowsAdded&&(e.index+=a._rowsAdded.length));const o=e.cells;let r=null,s=0;if(a._cellEditors||(a._cellEditors=[]),!a._dialogAddRow){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogAddButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogAddButtonCancel"),l.onOpen=function(){a.editing.dialog.visible=!0},l.onClose=function(){a.editing.dialog.visible=!1},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){const e={};for(let t=0;t<o.length;t++){const l=o[t],i=a._getEditorValue(l),n=a._getEditorId(l),r=a._cellEditors[n];r&&(i&&i.error?(e[l.column.dataField]=i.value,r.detach()):(e[l.column.dataField]=i,r.detach()))}const i=a._rowsAdded?a._rowsAdded.length:0,n=new Smart.Grid.Row({index:a.rows.length+i,id:Smart.Utilities.Core.createGUID(),grid:a,data:e});l.close(),t(n,0===l.index)},l.onkeydown=function(e){const t=e.key;"Enter"===t?l.btnConfirm.onclick():"Escape"===t&&l.close()},n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;s%2==0&&(r=document.createElement("div"),r.classList.add("smart-grid-edit-dialog-row"),n.appendChild(r));const l=document.createElement("div");l.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const o=document.createElement("label");o.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),l.appendChild(i),r.appendChild(l),i.appendChild(o),i.appendChild(d),s++}}l.open(),l.index=e.index;let d=0;for(let e=0;e<o.length;e++){const t=o[e],i=t.column,n=i.dataField,r=l.querySelector("[editor="+n+"]");if(!r)continue;r.innerHTML="";let s="";void 0!==t.value&&(s=t.value),"int64"!==i.dataType&&"number"!==i.dataType&&"int"!==i.dataType&&"float"!==i.dataType||(s=0),"date"===i.dataType&&(s=new Date),"bool"!==i.dataType&&"boolean"!==i.dataType||(s=!1);let c=null;switch(t.editor.template){default:case"custom":c=a._getCustomCellEditor(t);break;case"image":c=a._getImageCellEditor(t);break;case"checkBox":c=a._getCheckBoxCellEditor(t);break;case"autoComplete":c=a._getAutoCompleteCellEditor(t);break;case"dropDownList":c=a._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=a._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=a._getMaskCellEditor(t);break;case"checkInput":c=a._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=a._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=a._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=a._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=a._getDateInputCellEditor(t);break;case"dateRangeInput":c=a._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=a._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=a._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?a._getNumberInputCellEditor(t):a._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(s),0===d&&setTimeout((()=>{a.editing.enabled&&c.focus()}),100),!t.editor.isInitialized&&(t.editor.isInitialized=!0,t.editor.onInit)){const e=t.editor.onInit(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)l[e]=a[e]}}if(t.editor.onRender){const e=t.editor.onRender(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)l[e]=a[e]}}r.appendChild(c.element),c.element.onfocus=()=>{r.setAttribute("focus","")},c.element.onblur=()=>{r.removeAttribute("focus")},d++}a._dialogAddRow=l}_openEditDialog(e,t){const a=this;if(!a.editing.dialog.enabled)return!1;const l=a._dialogEdit||a._createDialog();let i="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeader",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header;const n=l.content;!1===a.editing.enabled?(l.classList.add("disable-edit"),i="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeaderDisabled",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header):l.classList.remove("disable-edit"),l.header.innerHTML=i,l.footer.classList.add("smart-hidden"),l.row=a.editing.editRow;const o=l.row.canNotify;l.row.canNotify=!1,l.row.showDetail=!1,l.row.canNotify=o,l.overlayClick=()=>{l.btnConfirm.click()};let r,s,d=null,c=0;if(void 0!==a._settingsDialogRowId){const e=`<div class="smart-buttons-container">\n <button title="${a.localize("pagerPreviousButton")}" tabindex=-1 class =" smart-button smart-element smart-prev-button" aria-label="Previous Record" smart-id="prevButton"></button>\n <button title="${a.localize("pagerNextButton")}" tabindex=-1 class =" smart-button smart-element smart-next-button" aria-label="Next Record" smart-id="nextButton"></button>\n </div>`;l.header.innerHTML=e+"<span>"+i+"</span>",l.btnPrev=l.querySelector(".smart-prev-button"),l.btnNext=l.querySelector(".smart-next-button"),l.header.style.display="flex",l.header.style.alignItems="center",a.editing.enabled?(l.btnDelete.classList.remove("smart-hidden"),l.btnComments.classList.remove("smart-hidden"),l.btnLink.classList.remove("smart-hidden"),l.btnDelete.classList.remove("smart-visibility-hidden"),l.btnComments.classList.remove("smart-visibility-hidden"),l.btnLink.classList.remove("smart-visibility-hidden"),0===a.users.length||a.users.length&&"guest"===a._currentUser.info?(l.btnLink.classList.add("smart-visibility-hidden"),l.btnDelete.classList.add("smart-visibility-hidden"),l.btnComments.classList.add("smart-visibility-hidden")):(l.btnLink.classList.remove("smart-visibility-hidden"),l.btnDelete.classList.remove("smart-visibility-hidden"),l.btnComments.classList.remove("smart-visibility-hidden"))):l.btnLink.style.width=l.btnDelete.style.width=l.btnComments.style.width="0px";const t=e=>{const t=a.editing.editRow,i=a._recyclingRows.indexOf(t);let o=e?a._recyclingRows[i+1]:a._recyclingRows[i-1];if(a.grouping.enabled&&a.dataSource.groupBy&&a.dataSource.groupBy.length>0){let t=1;for(;o&&!o.leaf;)o=e?a._recyclingRows[i+t]:a._recyclingRows[i-t],t++}const r=t;if(void 0!==a._settingsDialogRowId&&a.editing.dialog.autoSave){const e=a.rowById[a._settingsDialogRowId];e&&(l.saveRowData(e,!1),a._disableEndEdit=!0,a._recycle(!1,!0),a._disableEndEdit=!1)}if(o){if(a.editing.recordNavigation=!0,a.editing.editRow=o,a._settingsDialogRowId=o.id,r.isEditing=!1,r.element.removeAttribute("edit"),"gallery"===a.view){const e=a.querySelector('.smart-card[row-id="'+l.row.id+'"]');e&&e.removeAttribute("edit");const t=a.querySelector('.smart-card[row-id="'+o.id+'"]');t&&t.setAttribute("edit","")}const e=o,t=r.cells,i=e.cells;"kanban"===a.view&&a._kanban&&a._kanban.selectTask(e.id),l.row=o,l.header.querySelector("span").innerHTML=a.localize("dialogEditHeader",{value:a.editing.editRow.visibleIndex+1}),"gallery"!==a.view&&e.element.row.data.$.id===e.data.$.id&&e.element.setAttribute("edit","");for(let a=0;a<i.length;a++){const l=i[a],n=l.column;if(!n.allowEdit||!1===n._visible)continue;l.isEditing=!0,t[a].isEditing=!1;const o=e.data[n.dataField];l.editor&&l.editor.instance&&l.editor.instance.setValue(o)}a._applySettingsDialogLayout(l,n,a.editing.editRow,!0),a.editing.enabled&&setTimeout((()=>{const e=l.querySelector(".smart-grid-dialog-editor input");e&&e.focus()}),100)}};l.btnNext.onmousedown=e=>{t(!0),e.preventDefault(),e.stopPropagation()},l.btnPrev.onmousedown=e=>{t(!1),e.preventDefault(),e.stopPropagation()}}if(!a._dialogEdit){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),l.onOpen=function(){a.editing.dialog.visible||(a.editing.dialog.visible=!0,void 0!==a._settingsDialogRowId&&l.editorsContent&&l.editorsContent.offsetHeight&&(l.editorsContent.style.maxHeight=l.editorsContent.offsetHeight+40+"px",l.editorsContent.offsetWidth>a.offsetWidth||l.editorsContent.offsetHeight>window.innerHeight||l.editorsContent.offsetWidth>window.innerWidth?setTimeout((()=>{const e=a.offset(a);l.style.left=e.left+"px",l.style.top=e.top+"px",l.style.width=l.style.minWidth=a.offsetWidth+"px",l.style.height=l.style.minHeight=a.offsetHeight+"px",l.editorsContent.style.maxHeight=""})):(l.style.width=l.style.minWidth="",l.style.height=l.style.minHeight="",400!==a.editing.dialog.height&&(l.style.height=l.style.minHeight=a.editing.dialog.height+"px",l.editorsContent.style.maxHeight=l.editorsContent.offsetHeight+40+"px"),400!==a.editing.dialog.width&&(l.style.width=l.style.minWidth=a.editing.dialog.width+"px"),"gallery"===a.view&&setTimeout((()=>{a.querySelector('.smart-card[row-id="'+l.row.id+'"]')}))),a.editing.enabled&&setTimeout((()=>{const e=l.querySelector(".smart-grid-dialog-editor input");e&&e.focus()}),100)))},l.onClose=function(){a.editing.dialog.visible=!1,l.row&&(l.row.showDetail=!1)},l.btnCancel.onclick=function(){a.editing.isEditing=!0,a.cancelEdit()},l.btnClose.onclick=function(){a.editing.isEditing=!0,a.cancelEdit()};const t=(e,t=!0)=>{if(!e)return!1;const i=e.cells;let n={};e.element.removeAttribute("error");for(let e=0;e<i.length;e++){const t=i[e],l=a._getEditorValue(t);n[t.column.dataField]=l}const o=a.validateRow(e.id,n);if(Object.keys(o).length>0){let e=!0;for(let t=0;t<i.length;t++){const n=i[t],r=o[n.column.dataField],s=l.querySelector(`[label-for="${n.column.dataField}"]`);if(s&&(s.innerHTML=""),r)for(let t in r){const l=r[t];let i="";if(!l)continue;let o=l[t];"minLength"!==t&&"maxLength"!==t||(o=l[t.toLowerCase()]),i=l.message?l.message:"required"===t||"valueMissing"===t?a.localize("requiredValue",{value:n.column.label}):"min"===t?a.localize("invalidMinValue",{value:n.column.label,min:o.min}):"max"===t?a.localize("invalidMaxValue",{value:n.column.label,max:o.max}):"minLength"===t?a.localize("invalidMinLengthValue",{value:n.column.label,min:o.requiredLength}):"maxLength"===t?a.localize("invalidMaxLengthValue",{value:n.column.label,max:o.requiredLength}):a.localize("invalidValue"),e=!1,s&&(s.innerHTML=i)}}if(!e)return!1}const r=e.style;e.updatedDate=new Date,e.updatedBy=a.currentUser,e.style=l._rowStyle,e.comments=l._rowComments;const s=a.dataSource.dataItemById[e.id];if(s){const t=s.$.index;a.dataSource&&e.comments!==a.dataSource.boundSource[t].comments&&(a._sortedColumns&&a._sortedColumns.length>0?s.comments=e.comments:a.dataSource.boundSource[t].comments=e.comments)}if(e.style=l._rowStyle,a.onRowStyle&&r!==e.style&&(null===r?a.onRowStyle(e.index,e,e.style):r.background===e.style.background&&r.color===e.style.color&&r.fontSize===e.style.fontSize&&r.fontStyle===e.style.fontStyle&&r.fontFamily===e.style.fontFamily&&r.fontWeight===e.style.fontWeight&&r.status===e.style.status&&r.textDecoration===e.style.textDecoration||a.onRowStyle(e.index,e,e.style)),!t){for(let t=0;t<i.length;t++){const l=i[t],n=a._getEditorValue(l),o=l.column.dataField;if(e.canNotify=!1,e.data.canNotify=!1,e.data[o]=n,s){const e=s.$.index;a.dataSource&&(a._sortedColumns&&a._sortedColumns.length>0?s[o]=n:a.dataSource.boundSource[e][o]=n)}e.canNotify=!0,e.data.canNotify=!0}a._onSaveRowData&&a._onSaveRowData(e)}return!0};if(l.saveRowData=t,l.btnConfirm.onclick=function(){if(void 0!==a._settingsDialogRowId){const e=a.rowById[a._settingsDialogRowId];let i=!0;if(e&&(i=t(e)),!i)return;if(l.columnVisibility){let e=!1;const t=a.columns.canNotify;a.columns.canNotify=!1;for(let t in l.columnVisibility){const i=a.columnByDataField[t];i.visible!==l.columnVisibility[t]&&(i.visible=l.columnVisibility[t],e=!0)}if(a.columns.canNotify=t,e)return a.endEdit(),a.refresh(!1),void(a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh()))}}a.endEdit(),a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh())},l.onkeydown=function(e){const t=e.key,l=a.editing.commandKeys;for(let e in l){const i=l[e];if(t===i.key){a._applyCommand(i.command);break}}},a.editing.editRow)if(void 0!==a._settingsDialogRowId)a._applySettingsDialogLayout(l,n,a.editing.editRow);else{n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;c%2==0&&(d=document.createElement("div"),d.classList.add("smart-grid-edit-dialog-row"),n.appendChild(d));const l=document.createElement("div");l.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const o=a._settingsDialogRowId?document.createElement("div"):document.createElement("label");o.innerHTML=a.columns[e].label;const r=document.createElement("div");r.classList.add("smart-grid-dialog-editor"),r.setAttribute("editor",t.dataField),r.setAttribute("template",t.editor.template),l.appendChild(i),d.appendChild(l),i.appendChild(o),i.appendChild(r),c++}}else{const t=e.column,a=document.createElement("div");a.classList.add("smart-grid-dialog-editor"),a.setAttribute("editor",""),a.setAttribute("template",t.editor.template),n.appendChild(a)}}if(a._dialogEditPosition){const e=a.offset(a);r=parseInt(a._dialogEditPosition.left)-e.left,s=parseInt(a._dialogEditPosition.top)-e.top}if(a.editing.dialog.visible||l.open(r,s),a.editing.editRow){const a=l.querySelector("[editor="+e.column.dataField+"]");a&&(a.innerHTML="",a.appendChild(t.element),a.editor=t,a.editorValue=t.getValue(),t.element.onfocus=()=>{a.setAttribute("focus",""),a.setAttribute("touched",""),a.editorValue=t.getValue()},t.element.onblur=()=>{a.removeAttribute("focus"),a.editorValue!==t.getValue()&&a.setAttribute("pending","")})}else{const a=e.column,i=l.querySelector("[editor]");i.innerHTML="",i.setAttribute("template",a.editor.template),i.appendChild(t.element),i.editor=t,i.editorValue=t.getValue(),t.element.onfocus=()=>{i.setAttribute("focus",""),i.setAttribute("touched",""),i.editorValue=t.getValue()},t.element.onblur=()=>{i.removeAttribute("focus"),i.editorValue!==t.getValue()&&i.setAttribute("pending","")}}a._dialogEdit=l}_refreshCurrentUser(){const e=this,t=e.users;let a=e.currentUser,l=!0,i=!0,n=e.editing.enabled,o=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(l=!1!==a.allowAdd,i=!1!==a.allowComment,n=n&&!1!==a.allowEdit,o=!1!==a.allowRemove)),t&&t.length&&(null!==e.currentUser&&!1!==e.currentUser||(l=!1,i=!1,n=!1,o=!1,a="guest")),e._currentUser={allowAdd:l,allowComment:i,allowEdit:n,allowRemove:o,info:a}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-grid-color-input")},e}_applySettingsDialogLayout(e,t,a,l){const i=this;e.classList.add("smart-grid-dialog-expand-row");const n=e._rowStyle=JSON.parse(JSON.stringify(a._style)),o=e._rowComments=JSON.parse(JSON.stringify(a.comments));l&&e.activityContent.remove();const r=[];e.columnVisibility=r;let s=document.createElement("div"),d=document.createElement("div"),c=document.createElement("div"),u=document.createElement("div");l?(s=e.editorsContent,c=e.layoutContent,c.appendChild(d)):(c.appendChild(s),c.appendChild(u),c.appendChild(d),t.appendChild(c)),c.classList.add("smart-grid-edit-dialog-layout"),s.classList.add("smart-grid-edit-dialog-editors-container"),d.classList.add("smart-grid-edit-dialog-activity-container"),u.classList.add("smart-footer"),Smart.Utilities.Core.isMobile&&(c.classList.add("hide-activity"),e.btnComments.classList.remove("checked")),(0===i.users.length||i.users.length&&"guest"===i._currentUser.info)&&(d.classList.add("smart-hidden"),e.btnComments.classList.add("smart-hidden"),c.classList.add("hide-activity"),e.btnComments.classList.remove("checked"),e.btnComments.classList.add("smart-hidden"),e.btnLink.classList.add("smart-hidden"));const m=document.createElement("smart-button");m.innerHTML=`<span>${i.localize("dialogEditButtonSave")}</span>`,m.classList.add("primary");const p=document.createElement("smart-button");p.innerHTML=`<span>${i.localize("dialogEditButtonCancel")}</span>`;const g=document.createElement("div");g.classList.add("smart-flex"),g.style.flexDirection="row-reverse",g.appendChild(m),g.appendChild(p),u.appendChild(g);const b=document.createElement("div");b.classList.add("smart-flex"),b.style.alignItems="center",b.innerHTML=`<label style="margin-right: 5px;">${i.localize("dialogEditButtonAutoSave")}</label>\n <label title="${i.localize("dialogEditButtonAutoSave")}" class="smart-switch">\n <input type="checkbox">\n <span class="slider round"></span>\n </label>`,u.appendChild(b),i.users&&i.users.length&&(!1!==i.currentUser&&null!==i.currentUser&&void 0!==i.currentUser||u.classList.add("smart-hidden"));const f=b.querySelector("input");f.onchange=()=>{i.editing.dialog.autoSave=f.checked},i._currentUser.info&&!i._currentUser.allowEdit&&(u.classList.add("smart-hidden"),e.btnComments.classList.add("smart-hidden"),e.btnLink.classList.add("smart-hidden"),e.btnDelete.classList.add("smart-hidden")),!0===i.editing.dialog.autoSave&&(f.checked=!0),p.onclick=()=>{e.btnCancel.click()},m.onclick=()=>{e.btnConfirm.click()},Smart.Utilities.Core.isMobile&&(c.setAttribute("mobile",""),e.setAttribute("mobile",""));let h=0;for(let e=0;e<i.columns.length;e++){const t=i.columns[e];t.allowEdit&&!1!==t._visible&&h++}h>=8?s.classList.add("many"):s.classList.remove("many"),e.editorsContent=s,e.activityContent=d,e.layoutContent=c,e.footerContent=u,setTimeout((()=>{e.editorsContent.scrollHeight>e.editorsContent.offsetHeight?(u.style.setProperty("--smart-background","var(--smart-surface)"),u.style.borderTopStyle="solid",u.style.borderTopColor="var(--smart-border)",u.style.borderTopWidth="1px",p.classList.add("flat")):(u.style.setProperty("--smart-background",""),u.style.borderTopStyle="",u.style.borderTopColor="",u.style.borderTopWidth="",p.classList.remove("flat"))}),200);const y=document.createElement("div"),v=document.createElement("div");d.appendChild(y),d.appendChild(v);let C=o&&o.length?" ("+o.length+")":"";y.innerHTML=`\n <div class="tabs">\n <div view="comments" class="active tab"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-comment show"></span><span>${i.localize("commentsTab")}<span>${C}</span></span></div></div>\n <div view="history" class="tab smart-hidden"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-history show"></span>${i.localize("historyTab")}</div></div>\n <div view="details" class="tab"><div class="smart-flex tab-label"><span class="smart-grid-icon smart-icon-font show"></span>${i.localize("detailsTab")}</div></div>\n </div>\n <div class="smart-hidden details-tab">\n <div class="smart-grid-edit-dialog-row"><div class="column"><div class="header smart-grid-edit-dialog-column-info">${i.localize("format").replace(":","")}\n <span title="${i.localize("resetFormat")}" class="reset-format smart-grid-icon smart-icon-reload show"></span>\n </div>\n </div>\n <div class="format-layout">\n <div title="${i.localize("background")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-color-background show"></span><div class="background"></div>\n </div>\n <div title="${i.localize("color")}" class="format smart-grid-edit-dialog-column-info">\n <span style="border-bottom: 2px solid #46CA78;" color="#46CA78" class="format smart-grid-icon smart-icon-font show"></span><div class="color"></div>\n </div>\n <div class="format-layout button-group">\n <span title="${i.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${i.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${i.localize("underline")}" class="formatbtn underline smart-grid-icon smart-icon-underline show"></span>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("fontFamily").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-font show"></span><div class="font-family"></div>\n </div>\n <div title="${i.localize("fontSize").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-fontsize show"></span><div class="font-size"></div>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("status").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span color="#F1C58B" class="smart-grid-icon smart-icon-star show"></span><div class="status"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="comments-tab">\n <div class="column smart-hidden"><div class="smart-hidden comments-header smart-grid-edit-dialog-column-info">${i.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments"><span>${i.localize("noComments")}</span></span></div>\n <div class="footer">\n <smart-text-area hint="${i.localize("comment")}" placeholder="${i.localize("commentPlaceholder")}" class="smart-text-area success underlined"></smart-text-area>\n <smart-button class="success">${i.localize("send")}</smart-button>\n </div>\n </div>\n </div>\n <div class="history-tab smart-hidden">\n <div class="history-layout">\n <div class="history"></div>\n </div>\n </div>\n `;const S=y.querySelectorAll(".tab");i.storeHistory&&(!i._currentUser||i._currentUser&&!i._currentUser.info?S[S.length-1].classList.add("smart-hidden"):S[S.length-1].classList.remove("smart-hidden")),!i.users||i.users&&0===i.users.length||!i._currentUser||i._currentUser&&!i._currentUser.info?S[S.length-2].classList.add("smart-hidden"):S[S.length-2].classList.remove("smart-hidden"),y.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),a=y.querySelector(".details-tab"),l=y.querySelector(".comments-tab"),n=y.querySelector(".history-tab");a.classList.add("smart-hidden"),l.classList.add("smart-hidden"),n.classList.add("smart-hidden");for(let e=0;e<S.length;e++)S[e].classList.remove("active");switch(t.classList.add("active"),e){case"details":a.classList.remove("smart-hidden");break;case"comments":l.classList.remove("smart-hidden");break;case"history":n.classList.remove("smart-hidden"),i._refreshHistory()}}};const w=i._getColorInput();y.querySelector(".background").appendChild(w),w.onchange=()=>{n.background=w.value},n.background&&(w.value=n.background);const _=i._getColorInput();y.querySelector(".color").appendChild(_),_.onchange=()=>{n.color=_.value},n.color&&(_.value=n.color);const D=i._getColorInput();y.querySelector(".status").appendChild(D),D.onchange=()=>{n.status=D.value},n.status&&(D.value=n.status);const L=document.createElement("smart-input");L.style.width="auto",L.classList.add("underlined"),L.dropDownButtonPosition="right",L.readonly=!0,L.dropDownHeight="auto",L.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],L.onchange=()=>{n.fontFamily=L.value},n.fontFamily?L.value=n.fontFamily:L.selectedIndex=0,y.querySelector(".font-family").appendChild(L);const x=document.createElement("smart-input");x.style.width="auto",x.classList.add("underlined"),x.dropDownButtonPosition="right",x.readonly=!0,x.dropDownHeight="auto",x.dataSource=["-","8px","10px","12px","14px","18px","24px","36px"],x.onchange=()=>{n.fontSize=x.value},n.fontSize?x.value=n.fontSize:x.selectedIndex=0,y.querySelector(".font-size").appendChild(x);const k=y.querySelector(".button-group");k.onclick=e=>{const t=e.target.closest(".formatbtn");let a;t.classList.contains("checked")?(t.classList.remove("checked"),a=!1):(t.classList.add("checked"),a=!0),t.classList.contains("bold")?n.fontWeight=a?"bold":null:t.classList.contains("italic")?n.fontStyle=a?"italic":null:t.classList.contains("underline")&&(n.textDecoration=a?"underline":null)},n.fontWeight?k.children[0].classList.add("checked"):k.children[0].classList.remove("checked"),n.fontStyle?k.children[1].classList.add("checked"):k.children[1].classList.remove("checked"),n.textDecoration?k.children[2].classList.add("checked"):k.children[2].classList.remove("checked"),y.querySelector(".reset-format").onclick=()=>{for(let e=0;e<k.children.length;e++)k.children[e].classList.remove("checked");L.selectedIndex=0,x.selectedIndex=0,_.value="",w.value="",D.value="",n.fontWeight=null,n.fontStyle=null,n.textDecoration=null,n.fontSize=null,n.fontFamily=null};const A=y.querySelector(".comments-header"),F=y.querySelector('[view="comments"]'),T=y.querySelector(".comments-layout smart-text-area"),z=y.querySelector(".comments-layout smart-button"),I=y.querySelector(".comments-layout .footer"),E=y.querySelector(".comments-layout .comments");T.users=i.users,z.disabled=!0,E.innerHTML=`<span class="no-comments"><span>${i.localize("noComments")}</span></span>`;const M=()=>{const e=E.querySelector(".no-comments");0===o.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},H=()=>{i._commentEditing&&(i._commentEditing.parentNode&&i._commentEditing.parentNode.removeChild(i._commentEditing),delete i._commentEditing)};H();const R=e=>{const t=e.querySelector(".remove-button");H(),t.onclick=e=>{const t=e.target,l=o.indexOf(t.comment);if(H(),l>-1){const e=o[l];o.splice(l,1),i.$.fireEvent("commentRemove",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,o),t.element.remove();const n=o.length?"("+o.length+")":"";A.innerHTML=F.lastElementChild.lastElementChild.innerHTML=`${i.localize("comments").replace(":","")} <span>${n}</span>`,M()}}},B=e=>{const t=e.querySelector(".edit-button");H();const a=e.querySelector(".comment-body");t.onclick=t=>{H();const a=t.target,l=o.indexOf(a.comment);if(!i._commentEditing&&l>-1){const t=o[l];let n=!1;if(i._currentUser.info&&t.userId===i._currentUser.info.id&&i._currentUser.allowComment&&(n=!0),!n)return;const r=document.createElement("smart-text-area");r.users=i.users;const s=e.querySelector(".comment-body");s.appendChild(r),s.style.position="relative",s.classList.add("edit"),r.style.width="100%",r.style.height="100%",r.style.minHeight="50px",r.style.minWidth="150px",r.style.left=r.style.top="0px",r.style.position="absolute",r.value=t.text,r.style.zIndex=5,r.style.boxShadow="var(--smart-elevation-2)",r.onkeydown=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),r.onblur=r.onchange=null,s.classList.remove("edit"),H())},r.onchange=r.onblur=()=>{if(t.text=r.value,""===r.value)return void e.querySelector(".remove-button").click();const l=i._createComment(t);a.element.parentNode===E&&(E.insertBefore(l,a.element),a.element.parentNode.removeChild(a.element),delete i._commentEditing),R(l),B(l)},r.focus(),i._commentEditing=r}},a.ondblclick=e=>{t.click()}};for(let e=0;e<o.length;e++){const t=o[e],a=i._createComment(t);R(a),B(a),E.appendChild(a)}if(setTimeout((()=>{E.scrollTop=E.scrollHeight}),200),i._commentUpdateInterval=setInterval((()=>{e.classList.contains("open")?i._commentEditing:clearInterval(i._commentUpdateInterval)}),5e3),A.innerHTML=`${i.localize("comments").replace(":","")} ${C}`,M(),T.onfocus=()=>{I.classList.add("focus")},T.onblur=()=>{I.classList.remove("focus")},T.onkeyup=()=>{z.disabled=""===T.value},z.onclick=t=>{if(""===T.value)return;i._refreshCurrentUser();const l={text:T.value,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:i._currentUser.info?i._currentUser.info.id:-1,time:new Date},n=i._createComment(l);if(!n)return t.preventDefault(),void t.stopPropagation();R(n),B(n),o.push(l),i.$.fireEvent("commentAdd",{id:a.id,value:l}),i.onComment&&i.onComment(a.id,o),T.value="",z.disabled=!0,M(),E.appendChild(n),(()=>{const t=e._rowComments;if(H(),E.innerHTML=`<span class="no-comments"><span>${i.localize("noComments")}</span></span>`,M(),e.classList.contains("open"))for(let e=0;e<t.length;e++){const a=t[e],l=i._createComment(a);R(l),B(l),E.appendChild(l)}else clearInterval(i._commentUpdateInterval)})(),T.focus();const r=o.length?"("+o.length+")":"";A.innerHTML=F.lastElementChild.lastElementChild.innerHTML=`${i.localize("comments").replace(":","")} <span>${r}</span>`,E.scrollTop=E.scrollHeight,t.preventDefault(),t.stopPropagation()},!l)for(let e=0;e<i.columns.length;e++){const t=i.columns[e];if(!t.allowEdit||!1===t._visible)continue;const a=document.createElement("div");a.classList.add("smart-grid-edit-dialog-row"),s.appendChild(a),"textarea"!==t.editor.template&&"input"!==t.editor.template||(a.style.gridColumn="span 2",a.previousElementSibling&&!a.previousElementSibling.style.gridColumn&&e<i.columns.length&&(a.previousElementSibling.style.gridColumn="span 2",a.previousElementSibling.previousElementSibling&&!a.previousElementSibling.previousElementSibling.style.gridColumn&&e<i.columns.length-1&&(a.previousElementSibling.previousElementSibling.style.gridColumn="span 2")));const l=document.createElement("div"),n=i._settingsDialogRowId?document.createElement("div"):document.createElement("label"),o=t.validationRules&&t.validationRules.length>0?"*":"";n.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${i.columns[e].icon} show"></span><label>`+i.columns[e].label+o+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template);const c=n.querySelector("[toggle]");c.column=t,r[t.dataField]=t.visible,c.title=i.localize("columnMenuItemHide"),!1===i.editing.enabled&&c.classList.add("smart-visibility-hidden"),c.onclick=()=>{r[c.column.dataField]=!c.column.visible,c.classList.contains("smart-icon-visibility-on")?(c.classList.remove("smart-icon-visibility-on"),c.classList.add("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemShow")):(c.classList.add("smart-icon-visibility-on"),c.classList.remove("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemHide"))},t.visible||(c.classList.remove("smart-icon-visibility-on"),c.title=i.localize("columnMenuItemShow")),t.visible?c.classList.add("smart-icon-visibility-on"):c.classList.add("smart-icon-visibility-off"),l.appendChild(n),l.appendChild(d);const u=document.createElement("label");u.classList.add("smart-field-editor-error-label"),u.setAttribute("label-for",t.dataField),l.appendChild(u),a.appendChild(l)}}_getDateFormat(e){const t=new Smart.Utilities.DateTime(e),a=((new Date).getTime()-e.getTime())/1e3,l=Math.floor(Math.abs(a));if(""===this.locale||"en"===this.locale)return 0===l?"now":l<60?l+"s ago":l<3600?Math.floor(l/60)+"m ago":l<86400?Math.floor(l/3600)+"h ago":t.toString("dd/MM/yyyy hh:mm");t.toString("dd/MM/yyyy hh:mm")}_refreshHistory(){const e=this,t=e._dialogEdit;if(!t)return;const a=t.querySelector(".history");if(!e.storeHistory)return void a.classList.add("smart-hidden");if(!e._currentUser||e._currentUser&&!e._currentUser.info)return void a.classList.add("smart-hidden");a.classList.remove("smart-hidden");const l=t.row.history;if(!l)return;let i="\n ";for(let t=0;t<l.length;t++){const a=l[t];let n="";if(e._kanban)n=e._kanban._getHistoryItemLabel(a);else if("created"===a.action)n=e.localize("rowCreated",{value:a.action});else{const t=e.columnByDataField[a.action];n=e.localize("propertyUpdated",{value:t?"<strong>"+t.label+"</strong>":"<strong>"+a.action+"</strong>"})}i+='<div class="history-row">';const o=t=>{const a=t?t.image:null;let l=t?t.name||t.id:e.localize("guestUser");const i=a?"image":"",n=a?`background-image: url('${a}');`:"";return e._currentUser.info&&t.id===e._currentUser.info.id&&(""!==e.locale&&"en"!==e.locale||(l="You")),{image:n,label:l,cssClass:i}};let r="";if(void 0!==a.user){const t=o(e.users.find((e=>e.id===a.user)));i+=`<div class="history-indent"><div class="user-icon smart-icon ${t.cssClass}" style="${t.image}"></div></div>`,r=`<div class="history-header"><div class="user-name">${t.label}</div><div class="time">${e._getDateFormat(new Smart.Utilities.DateTime(a.date).toDate())}</div></div>`}else i+='<div class="history-indent"><div class="user-icon smart-icon"></div></div>',r='<div class="history-header"><div class="user-name"></div><div class="time"></div></div>';if(i+='<div class="history-main">',i+=r,i+=`<div class="history-body"><div class="title">${n}</div>`,"created"!==a.action){let t=a.details.oldValue,l=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t||e.id===parseFloat(t))),i=e.users.find((e=>e.id===l||e.id===parseFloat(l)));a?t=a.name:(t="",t||(t=e.localize("unassigned"))),i?l=i.name:(l="",l||(l=e.localize("unassigned")))}if("subtasks"===a.action){let t=[];"string"==typeof a.details.value?a.details.value.split(",").forEach((e=>{e.indexOf(": Y")>=0&&t.push(e)})):t=a.details.value.filter((e=>e.completed)),e._kanban?i+=`<span class="detail">${e._kanban.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span>`:i+=`<span class="detail">${e.localize("completed",{value:t.length})}</span>`}else{t&&"object"==typeof t&&t instanceof Date&&(t=e._getDateFormat(t)),l&&"object"==typeof l&&l instanceof Date&&(l=e._getDateFormat(l));let n=e.columnByDataField[a.action];if(n||(n=e.columnByDataField["task"+a.action.substring(0,1).toUpperCase()+a.action.substring(1)]),"user"===a.action&&(n=e.columnByDataField.taskUserId),n&&n.editor&&n.editor.dataSource){for(let e=0;e<n.editor.dataSource.length;e++){const a=n.editor.dataSource[e];a.value===t&&(t=a.label),a.value===l&&(l=a.label)}t||(t=e.localize("unassigned")),l||(l=e.localize("unassigned"))}let o="";n&&n.label&&(o="<strong>"+n.label+"</strong>"),n&&"date"===n.dataType?(t&&"string"==typeof t&&(t=e._getDateFormat(new Date(t))),l&&"string"==typeof l&&(l=e._getDateFormat(new Date(l)))):(t&&"string"==typeof t&&(t=e._fromHTMLEntities(t)),l&&"string"==typeof l&&(l=e._fromHTMLEntities(l))),i+=t?`<div class="detail">${e.localize("range",{column:o,oldValue:"<i>"+t+"</i>",newValue:"<i>"+l+"</i>"})}</div>`:`<div class="detail">${e.localize("nullRange",{column:o,oldValue:"<i>"+t+"</i>",newValue:"<i>"+l+"</i>"})}</div>`}}else i+=`<div>${a.details.value}</div>`;i+="",i+="</div>",i+="</div>\n </div>"}i+="",a.innerHTML=i,setTimeout((()=>{a.scrollTop=a.scrollHeight}))}_createComment(e){const t=this,a=t.users.find((t=>t.id===e.userId));if(!a)return;const l=document.createElement("div"),i=a?a.name||a.id:t.localize("guestUser"),n=a.image?a.image:"";let o=a?a.name:t.localize("guestUser");t._currentUser.info&&a.id===t._currentUser.info.id&&(""!==t.locale&&"en"!==t.locale||(o="You")),e.text&&/<.+?>/.test(e.text)&&e.text.replace&&("all"===t.dataSourceSettings.sanitizeHTML?e.text=e.text.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===t.dataSourceSettings.sanitizeHTML&&(e.text=window.Smart.Utilities.Core.escapeHTML(e.text)));let r=e.text;if(r.indexOf("@")>=0)for(let e=0;e<t.users.length;e++){const a=t.users[e];if(r.indexOf("@"+a.name)>=0){let e=`<div style="border:1px solid var(--smart-border); position:relative; top: -3px; border-radius: 15px; padding-right: 6px; background: var(--smart-surface); align-items: center; display: inline-flex;"><div class="user-icon smart-icon" role="img" aria-label="Icon of user ${a.name}"></div><span>${a.name}</span></div>`;a.image&&(e=`<div style="border:1px solid var(--smart-border); position:relative; top: -3px; border-radius: 15px; padding-right: 6px; background: var(--smart-surface); align-items: center; display: inline-flex;"><div style="width: 24px; height: 24px; background-image: url('${a.image}');" class="image user-icon smart-icon" role="img" aria-label="Icon of user ${a.name}"></div><span>${a.name}</span></div>`),r=r.replaceAll("@"+a.name,e)}}l.className="comment",l.setAttribute("role","listitem");let s=e.time?e.time:"";if(""!==s){s=new Smart.Utilities.DateTime(e.time);const a=((new Date).getTime()-s.toDate().getTime())/1e3,l=Math.floor(Math.abs(a));s=""!==t.locale&&"en"!==t.locale?s.toString("dd/MM/yyyy hh:mm"):0===l?"now":l<60?l+"s ago":l<3600?Math.floor(l/60)+"m ago":l<86400?Math.floor(l/3600)+"h ago":s.toString("dd/MM/yyyy hh:mm")}if(l.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${i}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${o}</div>\n <div class="edit-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n <div class="remove-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n <div class="time" aria-label="Comment time">${s}</div>\n</div>\n<div class="comment-body" aria-label="Comment text">${r||""}</div >\n</div>`,n){const e=l.querySelector(".user-icon");e.style.backgroundImage=`url('${n}')`,e.classList.add("image")}l.comment=e;const d=l.querySelector(".remove-button");d.comment=e,d.element=l,e.userId!==t._currentUser.info.id&&d.classList.add("smart-visibility-hidden");const c=l.querySelector(".edit-button");return c.comment=e,c.element=l,e.userId!==t._currentUser.info.id&&c.classList.add("smart-visibility-hidden"),l}_openSummaryRowDialog(e){const t=this,a=t._summaryRowDialog||t._createDialog(),l="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(a.header.innerHTML=l,!a.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",a.content.innerHTML="",a.listBox=e}const i=a.listBox;a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser");const n=e.element.querySelector(".summary-value");if(!n)return;n.classList.add("summary-chooser"),a.summaryValueElement=n;let o=[];a.dataField=e.column.dataField,"string"===e.column.dataType?(o=[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}],e.column.editor&&e.column.editor.dataSource&&e.column.editor.singleSelect&&o.push({label:t.localize("statusSummary"),value:"status"})):o="boolean"===e.column.dataType||"any"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"}]:"date"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:[{label:t.localize("countSummary"),value:"count"},{label:t.localize("minSummary"),value:"min"},{label:t.localize("maxSummary"),value:"max"},{label:t.localize("sumSummary"),value:"sum"},{label:t.localize("avgSummary"),value:"avg"}],i.dataSource=o,i.style.position="absolute",i.style.visibility="hidden",i.style.height="auto",t.isInShadowDOM?t.getRootNode().appendChild(i):document.body.appendChild(i);const r=e.column;r.summary&&r.summary.forEach((e=>{i.select(e)}));const s=i.offsetHeight;a.column=r,a.content.appendChild(i),a.classList.add("smart-grid-dialog-summary"),a.header.parentElement.classList.add("smart-hidden"),a.footer.classList.add("smart-hidden"),i.style.visibility="",i.style.position="",i.style.width="100%",t._summaryRowDialog||(a.btnConfirm.innerHTML=t.localize("apply"),a.btnCancel.innerHTML=t.localize("cancel"),a.style.width=a.style.minWidth="120px",a.onOpen=function(){t.editing.dialog.visible=!0},a.onClose=function(){t.editing.dialog.visible=!1,a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser")},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e=a.column.summary;a.column.summary=i.selectedValues,t.$.fireEvent("columnSummaryChange",{column:a.column,dataField:r.dataField,oldSummary:[...e],summary:[...a.column.summary]}),a.close(),t._calculateSummary(),t._recycle(!1)},a.confirm=function(){a.btnConfirm.click()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},t._summaryRowDialog=a);const d=e.element,c=t.offset(d),u=t.offset(t);let m=d.offsetWidth+c.left-u.left-120;m<0&&(m=c.left-u.left),a.open(m,c.top-u.top-s-0),setTimeout((function(){a.btnConfirm.focus()}),100)}_openTextAreaDialog(e,t,a){const l=this;delete l._dialogTextArea;const i=l._dialogTextArea||l._createDialog();if(i.header.innerHTML=e.label,i.column=e,i.classList.add("smart-grid-textarea-dialog"),i.style.minWidth="250px",i.style.minHeight="250px",i.style.zIndex=99999,i.textarea=t,"richText"!==e.template?i.initialValue=t.value:i.initialValue=t.getHTML(),i.cell=a,!l._dialogTextArea){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonSave"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i.onOpen=function(){const t=i.querySelector("smart-text-area");t.value=i.textarea.value,t.onchange=t.oninput=()=>{setTimeout((()=>{"richText"===e.template?i.textarea.setHTML(t.getHTML()):i.textarea.value=t.value}))},l.editing.enabled&&setTimeout((()=>{t.focus()}),250)},i.onClose=function(){};const t=()=>{const e=document.querySelector(".smart-grid-text-area-dialog");e&&e.remove()};i.btnCancel.onclick=function(){if(i.close(),l.editing.dialog.enabled)return i.textarea.value=i.initialValue,void t();l.cancelEdit(),t()},i.btnClose.onclick=function(){if(i.close(),l.editing.dialog.enabled)return i.textarea.value=i.initialValue,void t();l.cancelEdit(),t()},i.btnConfirm.onclick=function(){if(i.close(),l.editing.dialog.enabled)return t(),void i.cell.editor.instance.setValue(i.textarea.value);i.cell.editor.instance.setValue(i.textarea.value),t(),l.endEdit()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},l._dialogTextArea=i;const a=document.createElement("smart-text-area");a.classList.add("smart-text-area"),a.resize="both","richText"===e.template&&(a.richText=!0),a.users=l.users,a.style.resize="both",a.minWidth=350,a.style.minWidth="350px",a.style.minHeight="250px",a.style.width="450px",a.style.height="400px",a.minHeight=250,i.input=a,i.content.appendChild(a)}const n=l.offset(t),o=l.offset(l);i.open(n.left-o.left+e.computedWidth,n.top-o.top),setTimeout((function(){if("auto"!==i.style.height){const e=i.input;e.style.width="450px",e.style.height="400px",i.style.height="auto",i.style.width="auto",e.resize="both"}if(i.offsetHeight+n.top-o.top>window.innerHeight&&(i.style.top=o.top+"px",i.style.left=o.left+"px",i.style.width=l.offsetWidth+"px",i.style.height=l.offsetHeight+"px",i.input.style.width=l.offsetWidth-20+"px",i.input.style.height=l.offsetHeight-20+"px",i.input.resize="none"),n.left-o.left+e.computedWidth+i.offsetWidth>window.innerWidth){let t=n.left-o.left+e.computedWidth-i.offsetWidth;i.style.left=Math.max(t,0)+"px"}i.btnConfirm.focus()}),100)}_openDescriptionDialog(e,t){const a=this,l=a._dialogDescription||a._createDialog(),i=a.localize("dialogDescriptionHeader",{value:e.label});if(l.header.innerHTML=i,l.column=e,l.command=t,l.classList.add("smart-grid-dialog-add-column"),!a._dialogDescription){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),l.onOpen=function(){const e=l.querySelector("smart-input");"duplicate"!==t&&setTimeout((()=>{e.select()}),250)},l.onClose=function(){},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){const e=l.querySelector("smart-input");switch(l.command){case"duplicate":0===e.selectedIndex?a.duplicateCommand(l.column,null,!0):a.duplicateCommand(l.column,null,!1);break;case"rename":l.column.label=e.value;break;case"editDescription":l.column.description=e.value}l.close()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogDescription=l;const e=document.createElement("smart-input");e.classList.add("underlined"),e.dataSource="duplicate"!==t?[]:[{label:a.localize("duplicateCells"),value:"cells"},{label:a.localize("duplicateSettings"),value:"settings"}],l.content.appendChild(e)}const n=e.element,o=a.offset(n),r=a.offset(a);l.open(o.left-r.left,o.top+n.offsetHeight-r.top);const s=l.querySelector("smart-input");switch(s.selectedIndex=0,s.readonly=!0,s.dropDownButtonPosition="right",t){case"rename":s.value=e.label;break;case"editDescription":s.value=e.description}setTimeout((function(){l.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const a=this;if(!a.editing.deleteDialog.enabled)return!1;const l=a._dialogDelete||a._createDialog(),i="{{message}}"===a.editing.dialog.header?a.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):a.editing.dialog.header;l.header.innerHTML=i,l.content.innerHTML=a.localize("dialogDeleteContent"),l.row=e,a._dialogDelete||(l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogDeleteButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogDeleteButtonCancel"),l.onOpen=function(){a.editing.dialog.visible=!0},l.onClose=function(){a.editing.dialog.visible=!1},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){t(l.row),l.close()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogDelete=l),l.open(),setTimeout((function(){l.btnConfirm.focus()}),100)}_getTypesList(){const e=this,t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"image",prefix:'<span class="smart-grid-icon visible smart-icon-image"></span>',label:e.localize("dialogAddColumnTypeImage")},{value:"number",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeNumber")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")},{value:"boolean",prefix:'<span class="smart-grid-icon visible smart-icon-check-squared"></span>',label:e.localize("dialogAddColumnTypeCheckBox")},{value:"attachment",prefix:'<span class="smart-grid-icon visible smart-icon-docs"></span>',label:e.localize("dialogAddColumnTypeAttachment")},{value:"date",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDate")},{value:"duration",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDuration")},{value:"time",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeTime")},{value:"createdTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeCreatedTime")},{value:"updatedTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedTime")},{value:"createdBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCreatedBy")},{value:"updatedBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedBy")},{value:"collaborator",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCollaborator")},{value:"slider",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeSlider")},{value:"formula",prefix:'<span class="smart-grid-icon visible smart-icon-math"></span>',label:e.localize("dialogAddColumnTypeFormula")},{value:"autoNumber",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeAutoNumber")},{value:"url",prefix:'<span class="smart-grid-icon visible smart-icon-link"></span>',label:e.localize("dialogAddColumnTypeURL")},{value:"email",prefix:'<span class="smart-grid-icon visible smart-icon-mail"></span>',label:e.localize("dialogAddColumnTypeEmail")},{value:"phone",prefix:'<span class="smart-grid-icon visible smart-icon-phone"></span>',label:e.localize("dialogAddColumnTypePhone")},{value:"password",prefix:'<span class="smart-grid-icon visible smart-icon-lock"></span>',label:e.localize("dialogAddColumnTypePassword")},{value:"rating",prefix:'<span class="smart-grid-icon visible smart-icon-star"></span>',label:e.localize("dialogAddColumnTypeRating")}];if(e.dataSourceSettings.relations&&e.dataSourceSettings.relations.length&&t.splice(17,0,{value:"relationId",prefix:'<span class="smart-grid-icon visible smart-icon-table-alt"></span>',label:e.localize("dialogAddColumnTypeRowLink")}),e.header.visible&&e.header.buttons.indexOf("views")>=0){const a={value:"progress",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeProgress")},l={value:"priority",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypePriority")},i={value:"status",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("status")},n={value:"tags",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeTags")},o={value:"checklist",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeChecklist")},r={value:"color",prefix:'<span class="smart-grid-icon visible smart-icon-color-background"></span>',label:e.localize("dialogAddColumnTypeColor")};t.push(a),t.push(l),t.push(n),t.push(o),t.push(r),t.push(i)}return t}_getAddStackColumnDialogTemplate(){const e=this,t=[];let a=!1,l="";for(let i=0;i<e.columns.length;i++){const n=e.columns[i];(n.statusColumn||"taskStatus"===n.dataField||"taskStatus"===n._dataField||n.editor&&n.editor.dataSource&&n.editor.dataSource.length&&n.editor.singleSelect)&&(t.push({label:n.label,value:n.dataField}),e._stackedBy===n.dataField&&(t[t.length-1].checked=!0,a=!0,l=t[t.length-1].label))}const i=t.concat([{value:"blank",label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]);return a||(i[0].checked=!0,l=i[0].label),[{bind:"kanban",name:"kanban",type:"radio",label:2===i.length?e.localize("kanbanNoneDescription"):e.localize("kanbanDescription",{column:l}),filter:"kanban",options:i},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""}]}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),a=new Date(t,6,30);return[{bind:"kanban",name:"kanban",type:"radio",label:e.localize("kanbanNoneDescription"),filter:"kanban",options:[{value:"blank",checked:!0,label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"description",type:"input",label:e.localize("dialogAddColumnDescription"),filter:"any",placeholder:e.localize("dialogAddColumnDescriptionPlaceholder"),info:e.localize("dialogAddColumnDescriptionInfo")},{bind:"type",name:"typeslist",type:"dropDownList",filter:"any",label:e.localize("dialogAddColumnType"),icon:"smart-icon-font",options:e._getTypesList(),info:e.localize("dialogAddColumnTypeInfo")},{bind:"dateFormat",name:"dateformat",type:"dropDownList",label:e.localize("dialogAddColumnDateFormat"),options:[{value:"M/d/yyyy",label:e.localize("dialogAddColumnDateFormatShort")+" ("+new Smart.Utilities.DateTime(a).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(a).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(a).toString("ISO8601")+")"},{value:"d/M/yyyy",label:e.localize("dialogAddColumnDateFormatEU")+" (30/7/"+t+")"},{value:"yyyy-MM-dd",label:e.localize("dialogAddColumnDateFormatAS")+" ("+t+"-30-07)"},{value:"MMMM, dd, yyyy",label:e.localize("dialogAddColumnDateFormatFull")+" (July, 30, "+t+")"}],filter:"date",info:e.localize("dialogAddColumnDateFormatInfo")},{bind:"timeFormat",name:"timeformat",type:"dropDownList",label:e.localize("dialogAddColumnTimeFormat"),filter:"time",width:"50%",options:[{value:"hh:mm tt",label:"12 "+e.localize("dialogAddColumnTimeFormatHour")},{value:"HH:mm",label:"24 "+e.localize("dialogAddColumnTimeFormatHour")}],info:e.localize("dialogAddColumnTimeFormatInfo")},{bind:"allowTimeFormat",type:"boolean",label:e.localize("dialogAddColumnAllowTimeFormat"),filter:"date",width:"50%",value:!1,info:""},{bind:"allowCustomDateSeparator",type:"boolean",label:e.localize("dialogAddColumnCustomDateSeparator"),filter:"date",width:"50%",value:!1,info:""},{bind:"dateFormatSeparator",name:"dateFormatSeparator",type:"radio",label:"",filter:"date",width:"100%",columns:3,options:[{value:"/",label:e.localize("dialogAddColumnDateFormatSlash")+" (/)"},{value:"-",label:e.localize("dialogAddColumnDateFormatHyphen")+" (-)"},{value:".",label:e.localize("dialogAddColumnDateFormatDot")+" (.)"}]},{bind:"numberFormat",name:"numberFormat",type:"dropDownList",label:e.localize("dialogAddColumnNumberFormat"),filter:"number",options:[{value:{style:"decimal",maximumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatInteger")+" 1,000"},{value:{style:"decimal",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatNumber")+" 1,000.12"},{value:{style:"percent",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatPercent")+" 10.12%"},{value:{style:"percent",maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatPercentRounded")+" 10%"},{value:{style:"decimal",notation:"scientific"},label:e.localize("dialogAddColumnNumberFormatScientific")+" 1.01E+03"},{value:{style:"decimal",notation:"engineering"},label:e.localize("dialogAddColumnNumberFormatEngineering")+" 34.284 x 10^9"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,currencySign:"accounting"},label:e.localize("dialogAddColumnNumberFormatAccounting")+" $(1,000.12)"},{value:{style:"unit",unit:"kilogram"},label:e.localize("dialogAddColumnNumberFormatUnit")+" 10.12 kg"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency},label:e.localize("dialogAddColumnNumberFormatCurrency")+" $1,000.12"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatCurrencyRounded")+" $1,000"}],required:!1,info:e.localize("dialogAddColumnNumberFormatInfo")},{bind:"currency",name:"currency",type:"dropDownList",filter:"number",required:!1,options:e._getCurrencies(),label:e.localize("dialogAddColumnNumberFormatCurrency"),info:e.localize("dialogAddColumnNumberFormatCurrencyInfo")},{bind:"unit",name:"unit",type:"dropDownList",filter:"number",required:!1,options:[{value:"acre",label:e.localize("dialogAddColumnNumberFormatUnitAcre")},{value:"percent",label:e.localize("dialogAddColumnNumberFormatUnitPercent")},{value:"degree",label:e.localize("dialogAddColumnNumberFormatUnitDegree")},{value:"megabyte",label:e.localize("dialogAddColumnNumberFormatUnitMegaByte")},{value:"centimeter",label:e.localize("dialogAddColumnNumberFormatUnitCentimeter")},{value:"meter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")},{value:"squaremeter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")+"²"},{value:"cubicmeter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")+"³"},{value:"kilometer",label:e.localize("dialogAddColumnNumberFormatUnitKilometer")},{value:"mile",label:e.localize("dialogAddColumnNumberFormatUnitMile")},{value:"celsius",label:e.localize("dialogAddColumnNumberFormatUnitCelsius")},{value:"fahrenheit",label:e.localize("dialogAddColumnNumberFormatUnitFahrenheit")},{value:"kilogram",label:e.localize("dialogAddColumnNumberFormatUnitKilogram")},{value:"pound",label:e.localize("dialogAddColumnNumberFormatUnitPound")},{value:"liter",label:e.localize("dialogAddColumnNumberFormatUnitLiter")},{value:"gallon",label:e.localize("dialogAddColumnNumberFormatUnitGallon")},{value:"second",label:e.localize("dialogAddColumnNumberFormatUnitSecond")},{value:"minute",label:e.localize("dialogAddColumnNumberFormatUnitMinute")},{value:"hour",label:e.localize("dialogAddColumnNumberFormatUnitHour")},{value:"day",label:e.localize("dialogAddColumnNumberFormatUnitDay")},{value:"week",label:e.localize("dialogAddColumnNumberFormatUnitWeek")},{value:"month",label:e.localize("dialogAddColumnNumberFormatUnitMonth")},{value:"year",label:e.localize("dialogAddColumnNumberFormatUnitYear")}],label:e.localize("dialogAddColumnNumberFormatUnit"),info:e.localize("dialogAddColumnNumberFormatUnitInfo")},{bind:"allowThousandsSeparator",name:"allowThousandsSeparator",type:"boolean",label:e.localize("dialogAddColumnNumberFormatSeparator"),filter:"number",value:!0,info:""},{bind:"minLength",name:"minlength",width:"50%",type:"number",filter:"text",required:!1,label:e.localize("dialogAddColumnMinLength"),info:e.localize("dialogAddColumnMinLengthInfo")},{bind:"maxLength",name:"maxlength",width:"50%",filter:"text",type:"number",required:!1,label:e.localize("dialogAddColumnMaxLength"),info:e.localize("dialogAddColumnMaxLengthInfo")},{bind:"minValue",name:"minvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMinValue"),info:e.localize("dialogAddColumnMinValueInfo")},{bind:"maxValue",name:"maxvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMaxValue"),info:e.localize("dialogAddColumnMaxValueInfo")},{bind:"minDateTime",name:"mindatetime",type:"datetime",filter:"date",width:"50%",label:e.localize("dialogAddColumnMinDate"),info:e.localize("dialogAddColumnMinDateInfo")},{bind:"maxDateTime",name:"maxdatetime",type:"datetime",width:"50%",filter:"date",label:e.localize("dialogAddColumnMaxDate"),info:e.localize("dialogAddColumnMaxDateInfo")},{bind:"deadline",name:"deadline",type:"dropDownList",label:e.localize("dialogAddColumnTypeDueDateSettings"),info:e.localize("dialogAddColumnTypeDueDateSettingsInfo"),filter:"date",options:[{value:"",label:e.localize("dialogAddColumnTypeNone")},{value:"dueDate",label:e.localize("dialogAddColumnTypeDueDate")},{value:"startDate",label:e.localize("dialogAddColumnTypeStartDate")}]},{bind:"deadlineStatus",name:"deadlineStatus",type:"dropDownList",label:e.localize("dialogAddColumnTypeStatus"),info:e.localize("dialogAddColumnTypeStatusInfo"),filter:"date",options:[]},{bind:"deadlineDueDate",name:"deadlineDueDate",type:"dropDownList",label:e.localize("dialogAddColumnTypeDueDate"),info:"",filter:"date",options:[]},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"allowCheckItems",type:"boolean",filter:"hidden",value:!1,label:e.localize("dialogAddColumnCheckItems"),info:""},{bind:"allowMultipleCollaborators",type:"boolean",filter:"collaborator",value:!1,label:e.localize("dialogAddColumnMultipleCollaborators"),info:e.localize("dialogAddColumnMultipleCollaboratorsInfo")},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""},{bind:"users",name:"users",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"collaborator",info:""},{bind:"formula",type:"formula",filter:"formula",info:e.localize("dialogAddColumnFormulaInfo"),label:e.localize("dialogAddColumnFormula")},{bind:"relationMultiField",name:"relationMultiField",type:"boolean",value:!1,filter:"relationId",label:e.localize("dialogAddColumnLinkSelect")},{bind:"relationId",name:"relationId",type:"relationId",label:e.localize("dialogAddColumnLinkListItems"),filter:"relationId",info:""},{name:"align",bind:"cellsAlign",type:"dropDownList",label:e.localize("dialogAddColumnAlign"),required:!1,options:[{value:"left",label:e.localize("dialogAddColumnAlignLeft")},{value:"right",label:e.localize("dialogAddColumnAlignRight")},{value:"center",label:e.localize("dialogAddColumnAlignCenter")}],filter:"any",info:e.localize("dialogAddColumnAlignInfo")},{bind:"defaultString",name:"defaultString",type:"input",filter:"text",required:!1,label:e.localize("dialogAddColumnDefault")},{bind:"defaultNumber",name:"defaultNumber",type:"number",filter:"number",required:!1,label:e.localize("dialogAddColumnDefault")},{bind:"defaultDate",name:"defaultDate",type:"dropDownList",label:e.localize("dialogAddColumnDefault"),filter:"date",options:[{value:"current",label:e.localize("dialogAddColumnDefaultDateCurrent")},{value:"specific",label:e.localize("dialogAddColumnDefaultDateSpecific")}]},{bind:"defaultDateValue",name:"defaultDateValue",type:"datetime",filter:"date",label:e.localize("placeholderValue")},{bind:"setDefaultValue",type:"boolean",label:e.localize("dialogAddColumnDefault"),width:"50%",filter:"any",value:!1,info:""},{bind:"allowResize",type:"boolean",filter:"any",width:"50%",label:e.localize("dialogAddColumnResizable"),info:e.localize("dialogAddColumnResizableInfo")},{bind:"allowRichText",type:"boolean",filter:"multiText",width:"50%",value:!1,label:e.localize("dialogAddColumnFormatting"),info:""},{bind:"required",type:"boolean",width:"50%",filter:"any",value:!1,label:e.localize("dialogAddColumnRequired"),info:e.localize("dialogAddColumnRequiredInfo")},{bind:"allowSort",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnSortable"),info:e.localize("dialogAddColumnSortableInfo")},{bind:"allowFilter",type:"boolean",align:"left",width:"50%",filter:"any",label:e.localize("dialogAddColumnFilterable"),info:e.localize("dialogAddColumnFilterableInfo")},{bind:"allowEdit",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnEditable"),info:e.localize("dialogAddColumnEditableInfo")}]}_getKanbanFields(){return["startDate","dueDate","progress","checklist","priority","tags","name","color","description","status"]}_addColumnDialogShowHideEditors(e){const t=this,a=e.editColumn,l=e.querySelector('[bind="type"]'),i=l?l.querySelector("smart-input"):null,n=l?i.getSelectedItem().value:"kanban",o=e.querySelectorAll(".smart-grid-dialog-editor"),r=t._getKanbanFields(),s=e.querySelector('[field-name="kanbanNotes"]');s&&("kanban"!==t.view?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"));const d=t=>{const a=e.querySelector('[field-name="defaultDate"]'),l=e.querySelector('[field-name="defaultDateValue"]');if(!t)return a.classList.add("smart-hidden"),void l.classList.add("smart-hidden");a.classList.remove("smart-hidden"),"specific"===t?(l.classList.remove("smart-hidden"),l.style.width="50%",l.style.float="left",a.style.width="50%",a.style.float="left",a.style.clear="both"):(l.classList.add("smart-hidden"),l.style.width="",l.style.float="",a.style.width="",a.style.float="")};let c=!!a;if(a){switch(e.columnType||n){case"createdTime":case"updatedTime":case"createdBy":case"updatedBy":case"autoNumber":case"image":case"progress":case"color":case"collaborator":case"attachment":c=!0;break;default:c=!1}"checklist"!==a.template&&"color"!==a.template||(c=!0),!1===a.allowTypeChange&&(c=!0)}for(let l=0;l<o.length;l++){const i=o[l],s=i.getAttribute("filter"),u=i.getAttribute("bind"),m=i.parentNode;if("deadlineStatus"!==u&&"deadlineDueDate"!==u)if(m.classList.add("smart-hidden"),"cellsAlign"===u&&("boolean"===n||"attachment"===n||"image"===n||"email"===n||"url"===n||"collaborator"===n||"createdBy"===n||"password"===n||"phone"===n||"createdTime"===n||"rating"===n||"updatedBy"===n||"updatedTime"===n||r.indexOf(n)>=0))m.classList.add("smart-hidden");else if("type"===u&&c)m.classList.add("smart-hidden");else if("allowEdit"!==u||!1!==t.editing.enabled&&"autoNumber"!==n&&"createdBy"!==n&&"updatedBy"!==n&&"createdTime"!==n&&"updatedTime"!==n)if("allowResize"!==u||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==u||!1!==t.filtering.enabled)if("allowSort"!==u||!1!==t.sorting.enabled)if("required"!==u||!1!==t.editing.enabled&&("string"===n||"multiText"===n||"name"===n||"description"===n||"select"===n||"collaborator"===n||"multiSelect"===n||"select"===n||"priority"===n))if(a&&a.disabledDialogOptions&&a.disabledDialogOptions.length>0&&a.disabledDialogOptions.indexOf(u)>=0)m.classList.add("smart-hidden");else{if(a&&"kanban"===t.view){switch(u){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":m.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===s&&m.classList.remove("smart-hidden")}if("deadline"!==u)if("setDefaultValue"!==u){if(a&&a.editor&&a.editor.collaborator)switch(u){case"options":m.classList.add("smart-hidden");continue;case"users":m.classList.remove("smart-hidden");continue}if("name"!==u||"kanban"!==t.view)if("any"!==s)switch(n){default:case"text":"text"!==s&&"multiText"!==s||("multiText"===s&&"string"===n?m.classList.add("smart-hidden"):m.classList.remove("smart-hidden")),a&&"any"===a.dataType&&m.classList.add("smart-hidden");break;case"slider":case"number":if("number"===s&&m.classList.remove("smart-hidden"),"unit"===u||"currency"===u||"allowThousandsSeparator"===u){m.classList.add("smart-hidden");const t=e.querySelector('[field-name="allowThousandsSeparator"]'),a=e.querySelector('[field-name="numberFormat"]'),l=e.querySelector('[field-name="unit"]'),i=e.querySelector('[field-name="currency"]'),n=a.querySelector("smart-input"),o=()=>{const e=n.getSelectedItem();i.classList.add("smart-hidden"),t.classList.add("smart-hidden"),e&&"decimal"===e.value.style&&!e.value.notation&&t.classList.remove("smart-hidden"),e&&"unit"===e.value.style?l.classList.remove("smart-hidden"):e&&"currency"===e.value.style?i.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};a.onchange=()=>{o()},o()}break;case"select":case"multiSelect":s.indexOf("list")>=0&&m.classList.remove("smart-hidden");break;case"collaborator":s.indexOf("collaborator")>=0&&m.classList.remove("smart-hidden");break;case"createdBy":case"updatedBy":case"autoNumber":case"createdTime":case"updatedTime":case"url":case"email":case"image":case"attachment":case"phone":case"password":case"progress":case"rating":case"checklist":case"priority":case"tags":case"name":case"description":case"assigned":case"status":case"color":case"boolean":if("status"===n||"priority"===n||"tags"===n){s.indexOf("list")>=0&&m.classList.remove("smart-hidden");break}break;case"time":{const t=e.querySelector('[field-filter="time"]');t.classList.remove("smart-hidden"),t.style.width="",t.style.float="";break}case"formula":"formula"===u&&m.classList.remove("smart-hidden");break;case"relationId":"relationId"!==u&&"relationMultiField"!==u||m.classList.remove("smart-hidden");break;case"duration":break;case"dueDate":case"startDate":case"date":{const t=e.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;if("defaultDate"===u||"defaultDateValue"===u){const t=e.querySelector('[field-name="defaultDate"]'),l=e.querySelector('[field-name="defaultDateValue"]'),i=t.querySelector(".smart-input"),n=l.querySelector(".smart-input");a&&a.defaultValue?"today"===a.defaultValue?(i.selectedValues=["current"],n.value=null):(i.selectedValues=["specific"],n.value=a.defaultValue):(i.selectedValues=["current"],n.value=null),d(i.selectedValue)}"date"===s&&m.classList.remove("smart-hidden");const l=t=>{const a=e.querySelector('[field-filter="time"]'),l=e.querySelector('[field-name="dateFormat"]');t?(a.classList.remove("smart-hidden"),l.style.width="50%",l.style.float="left"):(a.classList.add("smart-hidden"),l.style.width="",l.style.float="")},n=t=>{const a=e.querySelector('[field-name="allowTimeFormat"]'),l=a.querySelector(".smart-grid-dialog-editor");t.indexOf("T")>=0?(a.classList.add("smart-hidden"),l.uncheck()):a.classList.remove("smart-hidden")},o=t=>{const a=e.querySelector('[field-name="dateFormatSeparator"]');t?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};if("allowTimeFormat"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{l(e)},l(e)}if("dateFormat"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{n(e.detail.value)},n(e)}if("defaultDate"===u){const e=i.querySelector(".smart-input").value;i.onchange=e=>{d(e.detail.value)},d(e)}if("dateFormatSeparator"===u){const t=e.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;o(t)}if("allowCustomDateSeparator"===u){t.indexOf("T")>=0&&t.indexOf("-")>0&&i.uncheck();const e=i.querySelector(".smart-input").value;i.onchange=e=>{o(e)},o(e)}n(t);break}}else m.classList.remove("smart-hidden");else{const e=t._getAddStackColumnDialogTemplate().find((e=>{if("kanban"===e.bind)return e}));e.options[e.options.length-1].checked||e.options[e.options.length-2].checked?i.classList.remove("smart-hidden"):i.classList.add("smart-hidden")}}else{switch(a&&a.defaultValue&&m.classList.remove("smart-hidden"),n){case"string":case"multiText":case"name":case"description":case"multiSelect":case"boolean":case"date":case"dueDate":case"startDate":case"collaborator":case"number":case"priority":case"status":case"select":m.classList.remove("smart-hidden");break;default:m.classList.add("smart-hidden")}const t=t=>{const a=e.querySelector('[bind="type"]'),l=a?a.querySelector("smart-input"):null,i=a?l.getSelectedItem().value:"kanban",n=e.querySelector('[field-name="defaultDate"]'),o=e.querySelector('[field-name="defaultNumber"]'),r=e.querySelector('[field-name="defaultString"]'),s=e.querySelector('[field-name="defaultDateValue"]'),c=e.querySelectorAll(".smart-default-item-container");n&&(n.classList.add("smart-hidden"),s.classList.add("smart-hidden")),o&&o.classList.add("smart-hidden"),r&&r.classList.add("smart-hidden");for(let e=0;e<c.length;e++)c[e].classList.add("smart-hidden");if(t)if("date"===i||"dueDate"===i||"startDate"===i){if(n){n.classList.remove("smart-hidden"),s.classList.remove("smart-hidden");const e=n.querySelector("smart-input").selectedValues;d(e&&e.length?e[0]:"current")}}else if("number"===i||"slider"===i)o&&o.classList.remove("smart-hidden");else if("string"===i||"multiText"===i||"name"===i||"description"===i)r&&r.classList.remove("smart-hidden");else for(let e=0;e<c.length;e++)c[e].classList.remove("smart-hidden")};i.onchange=e=>{t(e)};const l=e.querySelector('[field-name="setDefaultValue"]'),o=!(!a||null===a.defaultValue||void 0===a.defaultValue)||l.value;t(o)}else m.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("views")>=0&&"date"===n&&m.classList.remove("smart-hidden")}else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden");else m.classList.add("smart-hidden")}}_addColumnDialogInitEditors(e,t,a){const l=this,i=e.editColumn,n=()=>{const e=a.deadline.parentElement.querySelector(".smart-input"),t=a.deadlineStatus.parentElement,l=a.deadlineDueDate.parentElement,i=t.querySelector("smart-input"),n=l.querySelector("smart-input");t.classList.add("smart-hidden"),l.classList.add("smart-hidden"),2===e.selectedIndex?l.classList.remove("smart-hidden"):1===e.selectedIndex&&t.classList.remove("smart-hidden"),i.dataSource&&0===i.dataSource.length&&t.classList.add("smart-hidden"),n.dataSource&&0===n.dataSource.length&&l.classList.add("smart-hidden")};for(let o in a){const r=a[o],s=r.querySelector("input"),d=r.querySelector("smart-input");switch(o){case"allowTimeFormat":{const e=r.querySelector(".smart-input");i&&i.editor?"dateInput"===i.editor.template?(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowRichText":{const e=r.querySelector(".smart-input");i&&"richText"===i.template?(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowCustomDateSeparator":{const e=r.querySelector(".smart-input");e.value=!1,e.removeAttribute("checked");let t=0;i&&i.cellsFormat&&(i.cellsFormat.indexOf(".")>=0?(e.value=!0,e.setAttribute("checked",""),t=2):(i.cellsFormat.indexOf("M-d-yyyy")>=0||i.cellsFormat.indexOf("d-M-yyyy")>=0||i.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(e.value=!0,e.setAttribute("checked",""),t=1));const l=a.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");l.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),l[t].setAttribute("checked",""),l[t].click(),l[t].value=!0;break}case"kanban":{const t=r.querySelectorAll(".smart-grid-dialog-boolean-field");for(let a=0;a<t.length;a++){const i=t[a];i.onchange=a=>{const n=[...a.parentElement.children].indexOf(a),o=a.parentElement.parentElement.previousElementSibling,r=e.querySelector('[field-name="options"]'),s=e.querySelector('[field-name="allowColorItems"]'),d=e.querySelector('[field-name="name"]'),c=()=>{const t=r.querySelector("smart-sortable");t&&(t._validate(),e&&e.offsetHeight&&e.setPosition("center"))};n===t.length-1?(o.innerHTML=l.localize("kanbanBasicDescription"),s.classList.remove("smart-hidden"),r.classList.remove("smart-hidden"),d.classList.remove("smart-hidden"),d.querySelector(".smart-grid-dialog-editor ").classList.remove("smart-hidden"),d.querySelector("smart-input").value=l.localize("dialogNewColumn"),c()):n===t.length-2?(o.innerHTML=l.localize("kanbanNoneDescription"),s.classList.add("smart-hidden"),r.classList.add("smart-hidden"),d.classList.remove("smart-hidden"),d.querySelector(".smart-grid-dialog-editor ").classList.remove("smart-hidden"),d.querySelector("smart-input").value=l.localize("dialogNewColumn"),c()):(o.innerHTML=l.localize("kanbanDescription",{column:i.label.innerHTML}),s.classList.add("smart-hidden"),r.classList.remove("smart-hidden"),r.classList.add("smart-hidden"),d.classList.add("smart-hidden"),d.querySelector("smart-input").value=i.label.innerHTML,d.querySelector(".smart-grid-dialog-editor").classList.add("smart-hidden"),c())}}break}case"dateFormat":i&&i.cellsFormat?i.cellsFormat.indexOf("M/d/yyyy")>=0?d.selectedIndex=0:i.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?d.selectedIndex=1:i.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?d.selectedIndex=2:i.cellsFormat.indexOf("d/M/yyyy")>=0?d.selectedIndex=3:i.cellsFormat.indexOf("yyyy-MM-dd")>=0?d.selectedIndex=4:i.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(d.selectedIndex=5):d.selectedIndex=0;break;case"timeFormat":i&&i.cellsFormat&&i.cellsFormat.indexOf("HH")>=0&&-1===i.cellsFormat.indexOf("T")?d.selectedIndex=1:d.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!1;i&&i.editor&&i.editor.singleSelect&&(e=!1);const t=r.querySelector(".smart-input");i&&e?(t.value=!0,t.setAttribute("checked","")):(t.value=!1,t.removeAttribute("checked"));break}case"allowThousandsSeparator":{const e=r.querySelector(".smart-input");i&&i.editor&&"numberInput"===i.editor.template&&"progress"!==i.template&&"rating"!==i.template?(e.value=!0,e.setAttribute("checked",""),i.editor.numberFormat&&("decimal"!==i.editor.numberFormat.style||i.editor.numberFormat.notation||i.editor.numberFormat.useGrouping||(e.value=!1,e.removeAttribute("checked")))):(e.value=!0,e.setAttribute("checked",""));break}case"numberFormat":if(i&&"numberInput"===i.editor.template&&i.editor.numberFormat)if("decimal"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits)d.selectedIndex=0;else if("decimal"===i.editor.numberFormat.style&&2===i.editor.numberFormat.minimumFractionDigits)d.selectedIndex=1;else if("percent"===i.editor.numberFormat.style&&2===i.editor.numberFormat.minimumFractionDigits)d.selectedIndex=2;else if("percent"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits)d.selectedIndex=3;else if("decimal"===i.editor.numberFormat.style&&"scientific"===i.editor.numberFormat.notation)d.selectedIndex=4;else if("decimal"===i.editor.numberFormat.style&&"engineering"===i.editor.numberFormat.notation)d.selectedIndex=5;else if("currency"===i.editor.numberFormat.style&&"accounting"===i.editor.numberFormat.currencySign)d.selectedIndex=6;else if("unit"===i.editor.numberFormat.style){d.selectedIndex=7;const e=i.editor.numberFormat.unit,t=a.unit.querySelector("smart-input");t.dataSource.forEach(((a,l)=>{if(a.value===e)return t.selectedIndex=l,!0}))}else"currency"===i.editor.numberFormat.style&&0===i.editor.numberFormat.maximumFractionDigits&&0===i.editor.numberFormat.minimumFractionDigits?d.selectedIndex=9:"currency"===i.editor.numberFormat.style&&(d.selectedIndex=8);else d.selectedIndex=0;break;case"currency":if(i&&"numberInput"===i.editor.template&&i.editor.numberFormat){if("currency"===i.editor.numberFormat.style){const e=l._getCurrencies().findIndex((e=>e.value===i.editor.numberFormat.currency));e>=0&&(d.selectedIndex=e)}}else d.selectedIndex=0;break;case"allowCheckItems":{const e=r.querySelector(".smart-input");i?i.editor&&!i.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowColorItems":{const e=r.querySelector(".smart-input");i?i.editor&&i.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"setDefaultValue":{const e=r.querySelector(".smart-input");i?(e.value=!1,e.removeAttribute("checked"),i&&void 0!==i.defaultValue&&(e.value=!0,e.setAttribute("checked",""))):(e.value=!1,e.removeAttribute("checked"));break}case"defaultString":{const e=r.querySelector("smart-input");i&&void 0!==i.defaultValue&&null!==i.defaultValue?e.value=i.defaultValue:e.value="";break}case"defaultNumber":{const e=r.querySelector("smart-number-input");i&&void 0!==i.defaultValue&&null!==i.defaultValue?e.value=i.defaultValue:e.value=0;break}case"deadline":{const e=r.querySelector(".smart-input");e.selectedIndex=0,e.onchange=()=>{n()},i&&i.editor&&(e.selectedIndex=0,i.editor.onValidate&&"dueDate"!==i.template&&(e.selectedIndex=2),"dueDate"===i.template&&(e.selectedIndex=1)),n();break}case"deadlineStatus":{const t=r.querySelector(".smart-input"),a=[];for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t&&t.editor&&t.editor.dataSource&&t.editor.singleSelect&&a.push({label:t.label,value:t.dataField})}a.length?t.dataSource=[{label:l.localize("dialogAddColumnTypeNone"),value:"none"}].concat(a):t.dataSource=a,e.editColumn&&(t.selectedValue="",e.editColumn&&e.editColumn.editor.boundDataField&&(t.selectedValue=e.editColumn.editor.boundDataField)),a.length||r.parentElement.classList.add("smart-hidden"),n();break}case"deadlineDueDate":{const t=r.querySelector(".smart-input"),a=[];for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t&&"dueDate"===t.template&&a.push({label:t.label,value:t.dataField})}t.dataSource=a,e.editColumn&&(t.selectedValue="",e.editColumn&&e.editColumn.editor.boundDataField&&(t.selectedValue=e.editColumn.editor.boundDataField)),a.length||r.parentElement.classList.add("smart-hidden"),n();break}case"formula":{const t=r.querySelector(".smart-input");t.clearValue(),e.editColumn&&e.editColumn.formula&&(t.value=e.editColumn.formula);break}case"relationId":{const e=r.querySelector(".smart-input");e.dataSource=l._getRelations(),e.clearValue(),e.selectedValue=i?i.relationId:"";const t=r.querySelector(".field-input");t.dataSource=l._getRelationFieldsData(i?i.relationId:-1),t.clearValue(),i&&i.relationField&&(t.selectedValue=i.relationField);break}case"allowResize":case"allowSort":case"allowEdit":case"allowFilter":case"required":{const e=r.querySelector(".smart-input"),a=t.find((e=>{if(e.bind===o)return e}));i?i[o]?(e.value=!0,e.setAttribute("checked","")):!1===i[o]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,a&&void 0!==a.value&&(e.value=a.value),e.value&&e.setAttribute("checked",""));break}}if(!i||"options"!==o&&"users"!==o){const e=r.querySelector("smart-sortable");if(e&&e._init)if("users"===o){let t=[];for(let e=0;e<l.users.length;e++)t.push({color:l.users[e].color,label:l.users[e].name,id:l.users[e].id,value:l.users[e].id,image:l.users[e].image});e._init(t)}else e._init()}else{const e=r.querySelector("smart-sortable");if(e&&e._init)if(i.editor.singleSelect){const t=i.editor.dataSource.filter((e=>""!==e));e._init(t)}else if("multiComboInput"===i.editor.template)if("users"===o){let t=[];for(let e=0;e<l.users.length;e++)t.push({color:l.users[e].color,label:l.users[e].name,id:l.users[e].id,value:l.users[e].id,image:l.users[e].image});e._init(t)}else e._init(JSON.parse(JSON.stringify(i.editor.dataSource)))}if(i&&"type"===o?(d.dataSource=l._getTypesList(),"number"===i.dataType||"int"===i.dataType?d.dataSource.length>3&&(d.selectedIndex=3):"date"===i.dataType?d.dataSource.length>3&&(d.selectedIndex=7):"bool"!==i.dataType&&"boolean"!==i.dataType||d.dataSource.length>3&&(d.selectedIndex=6),i.editor&&i.editor.template&&d.dataSource.forEach(((e,t)=>{switch(e.value){case"string":"input"===i.editor.template&&(d.selectedIndex=t);break;case"number":"numberInput"===i.editor.template&&"progress"!==i.template&&"rating"!==i.template&&(d.selectedIndex=t);break;case"select":"multiComboInput"===i.editor.template&&i.editor.singleSelect&&"tags"===i.template&&!i.relationId&&(d.selectedIndex=t);break;case"multiSelect":"multiComboInput"!==i.editor.template||i.editor.singleSelect||"tags"!==i.template||i.relationId||(d.selectedIndex=t);break;case"multiText":"textarea"===i.editor.template&&(d.selectedIndex=t);break;case"date":"dateInput"!==i.editor.template&&"dateTimePicker"!==i.editor.template||(d.selectedIndex=t);break;case"duration":"dateRangeInput"===i.editor.template&&(d.selectedIndex=t);break;case"time":"timeInput"===i.editor.template&&(d.selectedIndex=t);break;case"checkBox":"checkBox"===i.editor.template&&(d.selectedIndex=t);break;case"slider":"slider"===i.editor.template&&(d.selectedIndex=t);break;case"image":"image"===i.editor.template&&(d.selectedIndex=t);break;case"attachment":"attachment"===i.editor.template&&(d.selectedIndex=t);break;case"updatedTime":"updatedTime"===i.template&&(d.selectedIndex=t);break;case"createdTime":"createdTime"===i.template&&(d.selectedIndex=t);break;case"createdBy":"createdBy"===i.template&&(d.selectedIndex=t);break;case"updatedBy":"updatedBy"===i.template&&(d.selectedIndex=t);break;case"collaborator":("collaborator"===i.template&&i.editor&&i.editor.collaborator||"tags"===i.template&&i.editor&&i.editor.collaborator)&&(d.selectedIndex=t);break;case"autoNumber":"autoNumber"===i.template&&(d.selectedIndex=t);break;case"phone":"phone"===i.template&&(d.selectedIndex=t);break;case"password":"password"===i.template&&(d.selectedIndex=t);break;case"url":"url"===i.template&&(d.selectedIndex=t);break;case"email":"email"===i.template&&(d.selectedIndex=t);break;case"dueDate":"dueDate"===i.template&&(d.selectedIndex=t);break;case"rating":"rating"===i.template&&(d.selectedIndex=t);break;case"progress":"progress"===i.template&&(d.selectedIndex=t);break;case"color":"color"===i.template&&(d.selectedIndex=t);break;case"formula":i.formula&&(d.selectedIndex=t);break;case"relationId":i.relationId&&(d.selectedIndex=t)}}))):"type"===o&&(d.selectedIndex=0,d.dropDownOpenPosition="auto",d.dataSource=l._getTypesList()),"cellsAlign"===o&&i&&("center"===i.cellsAlign||"middle"===i.cellsAlign?d.selectedIndex=2:"right"===i.cellsAlign&&(d.selectedIndex=1)),!s)continue;if("dataField"!==o&&"type"!==o&&"deadline"!==o&&"timeFormat"!==o&&"dateFormat"!==o&&"deadlineStatus"!==o&&"deadlineDueDate"!==o&&"relationId"!==o&&"formula"!==o&&"numberFormat"!==o&&"currency"!==o&&"unit"!==o&&"cellsAlign"!==o&&d&&(d.selectedIndex=0),"name"===o){if(i){const e=i.label;d.value=l._unescapeString(e)}else d.value="";d.placeholder=t.find((e=>{if(e.bind===o)return e})).placeholder}"description"===o&&(d.value=i?l._unescapeString(i.description):"",d.placeholder=t.find((e=>{if(e.bind===o)return e})).placeholder);const c=(e,t)=>{i&&i.validationRules.forEach((a=>"minDate"===a.type&&"minDateTime"===e||"maxDate"===a.type&&"maxDateTime"===e||"min"===a.type&&"minValue"===e||"max"===a.type&&"maxValue"===e||a.type===e?(t.value=a.value,!0):void 0))};if("minValue"===o?(s.value=-9999999,c(o,s)):"maxValue"===o?(s.value=9999999,c(o,s)):"minLength"===o?(s.value=0,c(o,s)):"maxLength"===o&&(s.value=500,c(o,s)),"minDateTime"===o){const e=r.querySelector("smart-date-input");e.value=new Date(1900,0,1),c(o,e)}else if("maxDateTime"===o){const e=r.querySelector("smart-date-input");e.value=new Date(2100,0,1),c(o,e)}}}_createColumnBooleanEditor(e,t,a,l,i){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const n=document.createElement("div");return n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),n.setAttribute("checked",""),n.value=!0,t.width&&(a.style.width=t.width,a.style.float="left"),!1===t.value&&(n.value=!1,n.removeAttribute("checked")),e.appendChild(n),e.getValue=function(){return n.value},e.check=function(){n.setAttribute("checked",""),n.value=!0,e.onchange&&e.onchange(n.value)},e.uncheck=function(){n.removeAttribute("checked"),n.value=!1,e.onchange&&e.onchange(n.value)},e.toggle=function(){!0!==n.value&&!1!==n.value&&null!==n.value&&(n.value=!1),null===n.value?n.value=!1:n.value=!n.value,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),e.onchange&&e.onchange(n.value)},e.onclick=i.onclick=()=>{e.toggle()},l.appendChild(a),a.classList.add("smart-grid-dialog-boolean-field"),a.appendChild(e),a.appendChild(i),e}_getColumnTemplateByType(e,t){switch(e){case"boolean":case"bool":return"checkBox";case"image":return"image";case"rating":return"rating";case"attachment":return"attachment";case"createdBy":case"updatedBy":return e;case"collaborator":return"collaborator";case"relationId":return"tags";case"select":case"multiSelect":return"tags";case"url":return"url";case"email":return"email";case"autoNumber":return"autoNumber";case"password":return"password";case"createdTime":return"createdTime";case"updatedTime":return"updatedTime";case"dueDate":return"dueDate";case"duration":return"duration";case"multiText":return t.allowRichText?"richText":"";default:return""}}_getRelations(){const e=this;let t=[];t.push({label:"",menuLabel:" ",value:""});for(let a=0;a<e.dataSourceSettings.relations.length;a++){const l=e.dataSourceSettings.relations[a];t.push({value:l.id,label:l.label})}return t}_getRelationFieldsData(e){const t=this;let a={};for(let e=0;e<t.dataSourceSettings.relations.length;e++){const l=t.dataSourceSettings.relations[e];a[l.id]=l}const l=a[e];return l?("string"==typeof l.columns?JSON.parse(l.columns):l.columns).filter((e=>!e.template||"tags"===e.template||"collaborator"===e.template||"dropdownlist"===e.template||"list"===e.template)).map((e=>({label:e.label,value:e.dataField}))):[]}_getRelationData(e,t){const a=this,l=[];if(!a.dataSourceSettings.relations||!a.dataSourceSettings.relations.length)return;let i=0;const n=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161"];for(let i=0;i<a.dataSourceSettings.relations.length;i++){const n=a.dataSourceSettings.relations[i];if(n.id===e){const e=t,a=[];if(n.dataSource)for(let t=0;t<n.dataSource.length;t++){const i=n.dataSource[t][e];a[i]||(a[i]=!0,l.push({value:i,label:i}))}break}}l.length&&l.sort(((e,t)=>e.label<t.label?-1:e.label>t.label?1:0));for(let e=0;e<l.length;e++)l[e].color=n[i],i++,i>=n.length-1&&(i=0);return l}_confirmAddColumnDialog(e){const t=this,a=e.querySelectorAll(".smart-grid-dialog-editor"),l=[];let i,n,o={};e===t._dialogAddStackColumn&&(o.type="select");for(let e=0;e<a.length;e++){const l=a[e],i=l.querySelector(".smart-input"),n=l.getAttribute("bind"),r=l.parentElement;if("kanban"!==n)if("name"!==n&&"description"!==n)if("minLength"!==n&&"maxLength"!==n&&"minValue"!==n&&"maxValue"!==n&&"minDateTime"!==n&&"maxDateTime"!==n)if("options"!==n&&"users"!==n){if("relationId"===n)o.relationIdLabel=i.value,o.relationField=l.querySelector(".field-input").selectedValue,o.relationFieldLabel=l.querySelector(".field-input").value;else if("formula"===n){if("formula"!==o.type)continue;o.formula=i.value}else if("allowEdit"===n&&r.classList.contains("smart-hidden"))i.value=!1;else if("required"===n&&r.classList.contains("smart-hidden"))i.value=!1;else if("dateFormatSeparator"===n){const e=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.dateFormatSeparatorType="/";break;case 1:o.dateFormatSeparatorType="-";break;case 2:o.dateFormatSeparatorType="."}break}}i&&(i.getSelectedItem?o[n]=i.getSelectedItem().value:o[n]=i.value)}else{const e=[],a=l.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),i=l.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let t=0;t<a.length;t++){const l=a[t],n={label:l.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\\/g,""),value:l.getAttribute("data-item-value").replace(/\\/g,""),id:parseInt(l.getAttribute("data-id")),color:i[t].value};n.color=i[t].value,e.push(n)}if("users"===n&&"collaborator"===o.type){t.users||(t.users=[]);for(let a=0;a<e.length;a++){const l=e[a],i=t.users.find((e=>e.id===l.id));i&&(i.name=l.label,i.color=l.color)}}o[n]=e;const r=l.querySelector(".smart-default-item");o["default_"+n]=r.selectedValues?r.selectedValues[0]:null}else o[n]=i.getValue();else o[n]=i.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""");else{const e=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++){const a=e[t];if(a.querySelector("[checked]")){o.kanban=a.name;break}}}}e.data=o;let r={},s={},d="";if(i=o.minDateTime,n=o.maxDateTime,"date"===o.type||"dueDate"===o.type||"startDate"===o.type){r={template:"dateInput",min:i,max:n};let e=!1;o.deadlineStatus&&(r.boundDataField=o.deadlineStatus),"-"!==o.dateFormat&&(d=o.dateFormat,o.allowCustomDateSeparator&&(d.indexOf("/")>=0?d=d.replaceAll("/",o.dateFormatSeparatorType):d.indexOf("-")>=0?d=d.replaceAll("-",o.dateFormatSeparatorType):d.indexOf(".")>=0&&(d=d.replaceAll(".",o.dateFormatSeparatorType))),o.dateFormat.indexOf("T")>=0&&(r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),e=!0),r.autoOpen=!0,o.allowTimeFormat&&"-"!==o.timeFormat&&(e&&(d+=" "),d+=o.timeFormat,r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),o.cellsFormat=d,l.push({type:"minDate",value:i}),l.push({type:"maxDate",value:n})}else if("time"===o.type)r={template:"timeInput",hour12:!0},o.timeFormat.indexOf("HH")>=0&&(r.hour12=!1),r.autoOpen=!0,d=o.timeFormat,o.cellsFormat=d;else if("duration"===o.type)r={template:"dateRangeInput"},d="MM/dd/yyyy hh:mm",o.cellsFormat=d;else if("number"===o.type||"slider"===o.type){i=parseInt(o.minValue),n=parseInt(o.maxValue),o.numberFormat=JSON.parse(JSON.stringify(o.numberFormat)),"unit"===o.numberFormat.style&&(o.numberFormat.unit=o.unit);let e=null,a=null;"currency"===o.numberFormat.style&&(o.numberFormat.currency=o.currency,o.numberFormat.locale=t._getLocaleByCurrency(o.currency)),"decimal"!==o.numberFormat.style||o.numberFormat.notation||(o.numberFormat.useGrouping=o.allowThousandsSeparator),"squaremeter"===o.numberFormat.unit&&(o.numberFormat={type:"squaremeter",style:"decimal",maximumFractionDigits:0}),"cubicmeter"===o.numberFormat.unit&&(o.numberFormat={type:"cubicmeter",style:"decimal",maximumFractionDigits:0}),r={template:"number"===o.type?"numberInput":"slider",min:i,max:n,numberFormat:o.numberFormat},s={Intl:{NumberFormat:o.numberFormat}},a&&(s=a),d="d",e&&(d=e),l.push({type:"min",value:i}),l.push({type:"max",value:n})}else if("rating"===o.type)r={template:"rating"};else if("boolean"===o.type)r={template:"checkBox"};else if("image"===o.type)r={template:"image"};else if("attachment"===o.type)r={template:"attachment"};else if("relationId"===o.type){const e=t._getRelationData(o.relationId,o.relationField);r={template:"multiComboInput",readonly:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,relationId:o.relationId,relationField:o.relationField,pills:!0,singleSelect:!o.relationMultiField,dataSource:e}}else if("select"===o.type||"multiSelect"===o.type||"tags"===o.type){let a=o.options,l=!1;if("select"===o.type)if(e.editColumn&&!e.editColumn.editor.allowEmptyItem){a=o.options;const i=[];for(let e=0;e<o.options.length;e++)if(""===o.options[e].label)o.options[e].value="";else if(""===o.options[e].value){const t=o.options[e].label.trim();if(i[t])continue;o.options[e].value=t,i.push(t)}else if(!isNaN(parseInt(o.options[e].value))){const t=o.options[e].label.trim();if(i[t])continue;o.options[e].value=t,i.push(t)}if(e.editColumn._dataField&&"taskStatus"===e.editColumn._dataField||e===t._dialogAddStackColumn)for(let e=0;e<o.options.length;e++){const t=o.options[e];isNaN(parseInt(t.value))||(t.value=t.label.replaceAll(" ",""))}a=o.options;let n=!1;for(let e=0;e<o.options.length;e++)if(""===o.options[e].label){n=!0,l=!0,o.options[e].value="";break}a=n?o.options:[{color:"#F47A54",value:"",label:""}].concat(o.options)}else{const e=[];let t=!1;for(let a=0;a<o.options.length;a++)if(""===o.options[a].label)t=!0,l=!0,o.options[a].value="";else if(""===o.options[a].value){const t=o.options[a].label.trim();if(e[t])continue;o.options[a].value=t,e.push(t)}else if(!isNaN(parseInt(o.options[a].value))){const t=o.options[a].label.trim();if(e[t])continue;o.options[a].value=t,e.push(t)}a=t?o.options:[{color:"#F4511E",value:"",label:""}].concat(o.options)}else if("multiSelect"===o.type){const e=[];for(let t=0;t<o.options.length;t++)if(""===o.options[t].label)o.options[t].value="";else if(""===o.options[t].value){const a=o.options[t].label.trim();if(e[a])continue;o.options[t].value=a,e.push(a)}else if(!isNaN(parseInt(o.options[t].value))){const a=o.options[t].label.trim();if(e[a])continue;o.options[t].value=a,e.push(a)}a=o.options}a.length&&""===a[0]&&!l&&o.required&&(a=a.splice(1)),r={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:o.allowColorItems,autoOpen:!0,pills:!0,singleSelect:"select"===o.type,dataSource:a}}else if("collaborator"===o.type){let e=o.users;o.allowMultipleCollaborators||e&&e.length&&""!==e[0].value&&(e=[{label:"",value:"",color:"#F47A54"}].concat(o.users));for(let a=0;a<t.users.length;a++)e.forEach((e=>{e.value!==t.users[a].id&&e.value!==""+t.users[a].id||(e.image=t.users[a].image,e.id=t.users[a].id)}));r={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:o.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!o.allowMultipleCollaborators,dataSource:e}}else"multiText"===o.type?(i=o.minLength,n=o.maxLength,r={template:"textarea",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n})):"password"===o.type?(i=o.minLength,n=o.maxLength,r={template:"password",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n})):"phone"===o.type?r={template:"phone",required:o.required}:(i=o.minLength,n=o.maxLength,r={template:"input",min:i,max:n,required:o.required},l.push({type:"minLength",value:i}),l.push({type:"maxLength",value:n}));let c="string";switch(o.type){case"boolean":case"bool":c="boolean";break;case"createdTime":case"updatedTime":case"duration":case"date":case"time":c="date";break;case"autoNumber":case"slider":case"rating":case"number":c="number"}const u=e=>{if(o.setDefaultValue)switch(o.type){case"string":case"multiText":case"description":case"name":e.defaultValue=o.defaultString;break;case"number":case"slider":e.defaultValue=o.defaultNumber;break;case"date":case"dueDate":case"startDate":e.defaultValue="current"===o.defaultDate?"today":o.defaultDateValue;break;case"collaborator":void 0!==o.default_users?e.defaultValue=o.default_users:e.defaultValue=null;break;case"select":case"multiSelect":case"status":case"priority":o.default_options?e.defaultValue=o.default_options:e.defaultValue=null}else e.defaultValue=null};if(e.editColumn){const a=e.editColumn;a.canNotify=!1,a.label=o.name,void 0!==o.description&&(a.description=o.description),a.showDescriptionButton=!0,void 0!==o.allowResize&&(a.allowResize=o.allowResize),void 0!==o.allowSort&&(a.allowSort=o.allowSort),void 0!==o.allowFilter&&(a.allowFilter=o.allowFilter),void 0!==o.allowEdit&&(a.allowEdit=o.allowEdit),void 0!==o.cellsAlign&&(a.align=a.cellsAlign=o.cellsAlign),void 0!==o.cellsFormat&&(a.cellsFormat=d),void 0!==o.formula?a.formula=o.formula:a.formula="";const i=a._editorId?a._editorId:"",n=r.template+"_"+a.dataField+i;t._cellEditors[n]&&delete t._cellEditors[n];let m=!0;"list"!==a.template&&"dropDownList"!==a.template||(m=!1),"autoNumber"!==a.template&&"createdBy"!==a.template&&"updatedBy"!==a.template&&"createdTime"!==a.template&&"progress"!==a.template&&"updatedTime"!==a.template&&"checklist"!==a.template&&"color"!==a.template||(m=!1),a.editor&&a.editor.template.indexOf("custom")>=0&&(m=!1),a.editor&&a.editor.disabledDialogOptions&&(m=!1),u(a),m&&(a.editor=JSON.parse(JSON.stringify(r)),a.template=t._getColumnTemplateByType(o.type,o),a._cellsCachedValues=[]),"date"===o.type&&("dueDate"===o.deadline?(r=t._getKanbanTaskField("dueDate").editor,o.deadlineStatus&&(r.boundDataField=o.deadlineStatus),a.template="dueDate"):"startDate"===o.deadline?(r=t._getKanbanTaskField("startDate").editor,o.deadlineDueDate&&(r.boundDataField=o.deadlineDueDate),a.template="startDate"):(a.template="",r.template="dateInput",r.onValidate=null)),"relationId"===o.type&&(a.relationId=o.relationId,a.relationField=o.relationField),a.formatSettings=s,o.type!==e.columnType&&e.columnType&&(a.dataType=c),a.icon=t._getIconByType(o.type),a._isDirty=!0,o.required&&l.push({type:"required"}),a.validationRules=l,a._state&&["label","description","defaultValue","showDescriptionButton","dataSet","dataType","editor","formatSettings","template","summary","validationRules","allowResize","allowSort","allowFilter","allowEdit","align","cellsAlign","cellsFormat"].forEach((e=>{a._state[e]=a[e]})),a.canNotify=!0,t.$.fireEvent("closeColumnDialog",{dataField:a.dataField}),t.onColumnUpdated&&t.onColumnUpdated(t.columns.indexOf(a),a),t._onColumnUpdated&&t._onColumnUpdated(a,o),t._recycle(!0),a.refresh(),a._isDirty=!1}else{let e=[];"number"===c&&(e=["sum"]);const a=t._getColumnLabel(o),i=new Smart.Grid.Column({label:a,description:o.description,dataField:o.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:o.allowResize,allowSort:o.allowSort,allowFilter:o.allowFilter,allowEdit:o.allowEdit,showDescriptionButton:!0,dataType:c,editor:r,summary:e,template:t._getColumnTemplateByType(o.type,o),formatSettings:s,cellsAlign:o.cellsAlign,align:o.cellsAlign,cellsFormat:d,visibleIndex:t.columns.length-1,formula:o.formula,relationId:o.relationId,relationField:o.relationField,grid:t});if("autoNumber"===i.template&&(i.autoGenerated=!0,e=[]),u(i),o.required&&(l.push({type:"required"}),i.validationRules=l),"date"===o.type&&("dueDate"===o.deadline?o.type="dueDate":"startDate"===o.deadline&&(o.type="startDate")),"collaborator"===o.type){let e=!1;for(let a=0;a<t.columns.length;a++)if("taskUserId"===t.columns[a]._dataField){e=!0;break}e||(i._dataField="taskUserId")}if(t._getKanbanFields().indexOf(o.type)>=0){const e=t._getKanbanTaskField(o.type);switch(u(e),"startDate"===o.type&&o.deadlineDueDate&&(e.editor.boundDataField=o.deadlineDueDate),"dueDate"===o.type&&o.deadlineStatus&&(e.editor.boundDataField=o.deadlineStatus),delete e._state,o.description&&(e.description=o.description),o.name&&(e.label=o.name),e.allowFilter=o.allowFilter,e.allowResize=o.allowResize,e.allowSort=o.allowSort,o.type){case"priority":case"status":case"tags":e.editor.dataSource=JSON.parse(JSON.stringify(o.options))}let a=t.columnByDataField[e.dataField];if("status"===o.type||"name"===o.type||"description"===o.type)for(let e=0;e<t.columns.length;e++){const l=t.columns[e];if(l._dataField&&!t.columnByDataField[l._dataField]&&(t.columnByDataField[l._dataField]=l),l.statusColumn||"taskStatus"===l._dataField){a=l;break}}a&&!1===a._visible?(a.visible=!0,delete a._visible):(a&&(e.dataField=e.displayField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),"object"==typeof e.editor&&e.editor.dataSource&&(e.editor.dataSource=JSON.parse(JSON.stringify(e.editor.dataSource))),o.name||(e.label=e.label+" "+t.localize("copy"))),t.columns.push(e))}else t.columns.push(i);t._refreshHeaderBar(),t.$.fireEvent("closeColumnDialog",{dataField:i.dataField})}}_getColumnLabel(e){const t=this;let a=e.name;if(!a){let a="";switch(e.type){case"string":a=t.localize("dialogAddColumnTypeText");break;case"multiText":a=t.localize("dialogAddColumnTypeMultilineText");break;case"image":a=t.localize("dialogAddColumnTypeImage");break;case"attachment":a=t.localize("dialogAddColumnTypeAttachment");break;case"number":a=t.localize("dialogAddColumnTypeNumber");break;case"select":a=t.localize("dialogAddColumnTypeSelect");break;case"multiSelect":a=t.localize("dialogAddColumnTypeMultipleSelect");break;case"boolean":a=t.localize("dialogAddColumnTypeCheckBox");break;case"date":a=t.localize("dialogAddColumnTypeDate");break;case"time":a=t.localize("dialogAddColumnTypeTime");break;case"duration":a=t.localize("dialogAddColumnTypeDuration");break;case"createdTime":a=t.localize("dialogAddColumnTypeCreatedTime");break;case"updatedTime":a=t.localize("dialogAddColumnTypeLastUpdatedTime");break;case"createdBy":a=t.localize("dialogAddColumnTypeCreatedBy");break;case"updatedBy":a=t.localize("dialogAddColumnTypeLastUpdatedBy");break;case"collaborator":a=t.localize("dialogAddColumnTypeCollaborator");break;case"slider":a=t.localize("dialogAddColumnTypeSlider");break;case"autoNumber":a=t.localize("dialogAddColumnTypeAutoNumber");break;case"url":a=t.localize("dialogAddColumnTypeURL");break;case"relationId":a=t.localize("dialogAddColumnTypeLink"),e.relationFieldLabel&&e.relationIdLabel&&(a=e.relationFieldLabel+" ("+e.relationIdLabel+")");break;case"formula":a=t.localize("dialogAddColumnTypeFormula");break;case"email":a=t.localize("dialogAddColumnTypeEmail");break;case"phone":a=t.localize("dialogAddColumnTypePhone");break;case"password":a=t.localize("dialogAddColumnTypePassword");break;case"rating":a=t.localize("dialogAddColumnTypeRating")}let l=1;for(let e=0;e<t.columns.length;e++)t.columns[e].label.indexOf(a)>=0&&l++;return 1===l?a:a+" "+l}return a}_openAddColumnDialog(e,t,a){const l=this,i=l._dialogAddColumn||l._createDialog(l.editing.addColumnDialog),n=e?l.localize("dialogEditColumn",{value:e.label}):l.localize("dialogAddColumn"),o=i.querySelector(".smart-footer").querySelector(".smart-stack-layout");i.classList.add("smart-grid-dialog-add-column"),i.type=e?"customize":"add",i.editColumn=e||null,delete i._randomOptionIndex,e&&e.element?e.element.setAttribute("focus",""):l._addNewColumn&&l._addNewColumn.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),l._cellEditors||(l._cellEditors=[]);const r=l._getAddColumnDialogTemplate();if(i.header.innerHTML=n,i.header.parentElement.classList.add("smart-hidden"),i.callback=a,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===l.view?(i.header.innerHTML=l.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),i.classList.add("view")):i.classList.remove("kanban")),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),"kanban"===l.view?i.btnCancel.classList.add("smart-hidden"):i.btnCancel.classList.remove("smart-hidden"),l.cancelEdit(),!l._dialogAddColumn){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i._refreshPosition=()=>{const e=l.offset(l.$.columnHeader),t=l.$.columnHeader.offsetHeight,a=l.offset(l);if(i.style.maxHeight="",i.style.minHeight="",e.top+t+i.offsetHeight>window.innerHeight-a.top){const l=t+e.top+i.offsetHeight-window.innerHeight+a.top;i.style.maxHeight=Math.max(250,i.offsetHeight-l)+"px",i.style.minHeight="250px"}else i.style.maxHeight="",i.style.minHeight=""},i.onOpen=function(){const e=l._dialogAddColumn,t=l._getAddColumnDialogTemplate(),a=l._addColumnDialogEditors;if(delete e.columnType,l._addColumnDialogInitEditors(e,t,a),l._addColumnDialogShowHideEditors(e),e.editColumn){const t=e.querySelector('[bind="type"]'),a=t?t.querySelector("smart-input"):null,l=t?a.getSelectedItem().value:"kanban";e.columnType=l}else delete e.columnType;l._filterColumnTypes(),l.$.fireEvent("openColumnDialog",{dataField:e.editColumn?e.editColumn.dataField:null}),e._refreshPosition()},i.onClose=function(){i.editColumn&&i.editColumn.element&&i.editColumn.element.removeAttribute("focus"),l._addNewColumn&&l._addNewColumn.element.removeAttribute("focus"),i.classList.remove("view"),i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){l._confirmAddColumnDialog(i),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&"kanban"!==l.view&&(i.result=!1,i.close())},l._dialogAddColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e),l._addColumnDialogEditors=[];const t=l._addColumnDialogEditors;l._initAddColumnDialogEditors(t,r,i,e)}const s=()=>{const t=parseInt(i.style.width),a=l.offset(l);if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=l.offsetWidth+"px",void(i.style.height=l.offsetHeight+"px");{const e=l.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const n=e.element;if(n){const e=l.offset(n),o=e.left-a.left,r=a.left,s=Math.max(r,o);if(s+t+n.offsetWidth>a.left+l.offsetWidth){const l=s-t+n.offsetWidth;l<0?i.open("center",e.top+n.offsetHeight-a.top):i.open(Math.max(r,l),e.top+n.offsetHeight-a.top)}else i.open(s,e.top+n.offsetHeight-a.top)}else i.classList.add("center"),i.open("center","center")}else if(l._addNewColumn){let e=l._addNewColumn.element,n=l.offset(e),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o);l.editing.addNewColumn._addButton&&l.editing.addNewColumn._addButton.classList.contains("show")&&(e=l.editing.addNewColumn._addButton,n=l.offset(l.editing.addNewColumn._addButton),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o)),i.open(s,n.top+e.offsetHeight-a.top)}else i.open("center","center"),i.classList.add("center")};s(),i.refresh=()=>{s()}}_filterColumnTypes(){const e=this,t=e._dialogAddColumn;if(!t)return;const a=e._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input");if(t.columnType){const l=e._getTypesList().find((e=>{if(e.value===t.columnType)return e}));if(l)if("string"===t.columnType||"multiText"===t.columnType)a.dataSource=e._getTypesList().filter((e=>!(["createdTime","updatedTime","createdBy","updatedBy","autoNumber","image","color","checklist","progress","collaborator","attachment"].indexOf(e.value)>=0)));else if("select"===t.columnType||"multiSelect"===t.columnType){const t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")}];a.dataSource=t}else{const t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")}].concat(l);a.dataSource=t}else a.dataSource=e._getTypesList()}else t.editColumn||(a.dataSource=e._getTypesList(),a.selectedIndex=0)}_getIconByType(e){let t="smart-icon-font";switch(e){case"multiText":t="smart-icon-fontsize";break;case"image":t="smart-icon-image";break;case"attachment":t="smart-icon-docs";break;case"number":case"progress":t="smart-icon-number";break;case"priority":case"status":case"select":t="smart-icon-sort-down";break;case"multiSelect":t="smart-icon-list-unordered";break;case"boolean":t="smart-icon-check-squared";break;case"date":case"startDate":case"duration":case"dueDate":t="smart-icon-calendar";break;case"time":case"createdTime":case"updatedTime":t="smart-icon-clock";break;case"createdBy":case"updatedBy":case"collaborator":t="smart-icon-user";break;case"slider":t="smart-icon-number";break;case"autoNumber":case"checklist":t="smart-icon-list-ordered";break;case"url":t="smart-icon-link";break;case"email":t="smart-icon-mail";break;case"password":t="smart-icon-lock";break;case"phone":t="smart-icon-phone";break;case"name":t="smart-icon-font";break;case"description":t="smart-icon-fontsize";break;case"tags":t="smart-icon-list-ordered";break;case"color":t="smart-icon-color-background";break;case"assigned":t="smart-icon-user";break;case"rating":t="smart-icon-star";break;case"relationId":t="smart-icon-table-alt";break;case"formula":t="smart-icon-math"}return t}_initAddColumnDialogEditors(e,t,a,l){const i=this;for(let n=0;n<t.length;n++){const o=t[n],r=document.createElement("div"),s=document.createElement("label");s.innerHTML=o.label;const d=document.createElement("div");if(d.classList.add("smart-grid-dialog-editor","add-column"),d.innerHTML="",d.setAttribute("filter",o.filter),d.setAttribute("bind",o.bind),r.setAttribute("field-name",o.bind),r.setAttribute("field-filter",o.filter),e[o.bind]=d,"type"===o.bind&&d.addEventListener("change",(()=>{i._addColumnDialogShowHideEditors(a),a.editColumn&&i._filterColumnTypes();const t=i._dialogAddColumn.querySelector('[bind="type"]'),l=t.querySelector("smart-input"),n=l.getSelectedItem().value,o=i._getIconByType(n);if(e.type.icon=o,e.name.querySelector("input").setAttribute("data-label",l.value),t.firstElementChild.className="smart-grid-icon show smart-description-button "+o,"select"===n||"multiSelect"===n){const t=e.options.querySelector("smart-sortable");if(t&&t._validate){if(a.editColumn)if(a.editColumn.editor.dataSource)t._init([...a.editColumn.editor.dataSource]);else{const e=[];for(let t=0;t<i.rows.length;t++){const l=i.rows[t].data[a.editColumn.dataField];if(l&&l.indexOf(",")>=0){const t=l.split(",");for(let a=0;a<t.length;a++)-1===e.indexOf(t[a].trim())&&e.push(t[a].trim())}else if(-1===e.indexOf(l)&&void 0!==l){if(""===l&&"multiSelect"===n)continue;e.push(l)}}e.length?t._init(e.map((e=>({value:e,label:e})))):t._init()}else t._init();t._validate()}}else if("priority"===n||"status"===n||"tags"===n){const t=e.options.querySelector("smart-sortable"),a=i._getKanbanTaskField(n);t&&t._validate&&(t._init([...a.editor.dataSource]),t._validate())}else a.btnConfirm.disabled=!1})),"boolean"===o.type)i._createColumnBooleanEditor(d,o,r,l,s);else{if("label"===o.type){l.appendChild(r),r.classList.add("smart-grid-dialog-field"),r.appendChild(s);const e=document.createElement("div");e.style.height="10px",r.appendChild(e);continue}if("relationId"===o.type){let e=document.createElement("smart-input");e.classList.add("underlined","edit-column-input"),e.style.width="calc(100% - 25px)",e.style.height="30px",o.width&&(r.style.width=o.width,r.style.float="left"),e.readonly=!0,e.dropDownButtonPosition="right",e.dropDownHeight="auto";let a=i._getRelations(),c={};for(let e=0;e<i.dataSourceSettings.relations.length;e++){const t=i.dataSourceSettings.relations[e];c[t.id]=t}let u=document.createElement("smart-input");u.classList.add("underlined","smart-hidden","edit-column-input","field-input"),u.style.width="calc(100% - 25px)",u.style.height="30px",u.readonly=!0,u.dropDownButtonPosition="right",u.dropDownHeight="auto";const m=document.createElement("div"),p=document.createElement("div");if(p.style.marginTop="5px",p.innerHTML=i.localize("dialogAddColumnLinkField"),p.classList.add("smart-hidden"),e.dataSource=a,e.onchange=()=>{if(u.dataSource=null,u.clearValue(),""===e.value)u.classList.add("smart-hidden"),p.classList.add("smart-hidden");else{p.classList.remove("smart-hidden"),u.classList.remove("smart-hidden");const t=c[e.selectedValue];t&&(u.dataSource=i._getRelationFieldsData(t.id))}},o.width&&(r.style.width=o.width,r.style.float="left"),d.style.height="auto",m.classList.add("smart-flex"),m.style.width="100%",m.style.flexDirection="column",m.appendChild(e),m.appendChild(p),m.appendChild(u),d.appendChild(m),l.appendChild(r),r.classList.add("smart-grid-dialog-field"),r.appendChild(s),r.appendChild(d),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}else if("formula"===o.type){let e=document.createElement("smart-input");e.classList.add("underlined","edit-column-input"),e.style.width="100%",o.width&&(r.style.width=o.width,r.style.float="left"),d.appendChild(e),l.appendChild(r),r.classList.add("smart-grid-dialog-field"),r.appendChild(s),r.appendChild(d);const a=document.createElement("div");if(a.innerHTML=i.localize("dialogAddColumnTypeFormulaInfo"),a.style.color="var(--smart-primary)",a.style.fontSize="12px",a.style.marginBottom="10px",r.appendChild(a),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}else{let c=document.createElement("smart-input");if(c.classList.add("underlined","edit-column-input"),c.style.width="100%",c.style.height="30px",o.width&&(r.style.width=o.width,r.style.float="left"),"items"===o.type){const t=document.createElement("smart-button");t.classList.add("primary"),t.innerHTML='<div style="align-items: center; white-space: nowrap; display: flex;"><span class="smart-grid-icon show smart-icon-plus"></span><span>'+i.localize("commandBarAddRow")+"</span></div>";const l=document.createElement("div");l.classList.add("smart-grid-add-column-dialog-color-panel");const n=document.createElement("smart-sortable");n.disableMode="manual",n.dragMode="handle",n.handlePosition="left",n.handleVisibility="visible";const r=()=>{if(a.btnConfirm.disabled=!1,0===l.offsetHeight)return;let e=0;l.querySelectorAll(".edit-column-input").forEach((t=>{""===t.value&&e++;const l=a.querySelector('[field-name="type"]');l&&("multiSelect"===l.querySelector("smart-input").selectedValues[0]&&e>=1&&(a.btnConfirm.disabled=!0),e>1&&(a.btnConfirm.disabled=!0))})),n._updateDefaultInput()},s=(l,s,d,c)=>{const u=document.createElement("div"),m=i._getColorInput(),p=document.createElement("div"),g=document.createElement("smart-input"),b=e.allowColorItems;if(void 0!==d)g.setAttribute("data-id",d),g.setAttribute("data-item-value",d);else{const e=n.querySelectorAll(".smart-sortable-item").length;g.setAttribute("data-id",e),g.setAttribute("data-item-value",e)}if(void 0!==c&&g.setAttribute("data-item-value",c),m.disabled=!b.querySelector(".smart-input").value,p.className="smart-grid-icon smart-icon-close show",p.setAttribute("role","button"),p.setAttribute("aria-label","button"),g.classList.add("underlined","edit-column-input"),g.style.width="100%",g.style.height="30px",g.required=!0,(a.editColumn&&"collaborator"===a.editColumn.template||"users"===o.bind)&&(g.disabled=!0),l&&(g.value=i._unescapeString(l)),s)m.value=s;else if(!m.disabled){void 0!==a._randomOptionIndex?a._randomOptionIndex++:a._randomOptionIndex=2;const e=a._randomOptionIndex;e>=m.dataSource.length-1&&delete a._randomOptionIndex;const t=m.dataSource[e];m.value=t}if(g.onkeyup=g.onchange=g.onblur=e=>{r(),"Enter"===e.key&&(g.parentElement.nextElementSibling||(t.click(),r()))},m.onchange=()=>{n._updateDefaultInput()},u.appendChild(m),u.appendChild(g),"users"!==o.bind&&u.appendChild(p),p.onmouseenter=()=>{if(i._dialogAddColumn&&i._dialogAddColumn.editColumn){if(p.title="",p.classList.remove("smart-quiet"),!c)return;const e=i._dialogAddColumn.editColumn;if(e)for(let t=0;t<i.rows.length;t++)if(i.rows[t].data[e.dataField]===c){p.title=i.localize("dialogAddColumnListItemsError"),p.classList.add("smart-quiet");break}}},c&&i._dialogAddColumn){const e=i._dialogAddColumn.editColumn;if(e)for(let t=0;t<i.rows.length;t++)if(i.rows[t].data[e.dataField]===c){p.title=i.localize("dialogAddColumnListItemsError"),p.classList.add("smart-quiet");break}}return p.onclick=()=>{p.title||(u.remove(),n.updateItems(),r())},u.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),"users"===o.bind&&u.setAttribute("disable-drag",""),u};n._getOptions=e=>{const t=[],a=l.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),n=l.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<a.length;e++){const l=a[e],i={label:l.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\\/g,""),value:l.getAttribute("data-item-value").replace(/\\/g,""),id:parseInt(l.getAttribute("data-id")),color:n[e].value};i.color=n[e].value;const o=parseInt(i.value);if(!isNaN(o)){const e=i.label.trim();i.value=e}t.push(i)}if("users"===e.bind){i.users||(i.users=[]);for(let e=0;e<t.length;e++){const a=t[e],l=i.users.find((e=>e.id===a.id));l&&(l.name=a.label,l.color=a.color)}}return t},n._updateDefaultInput=e=>{e||(e=n._getOptions(o)),n._defaultInput&&(n._defaultInput.dataSource=e,n._defaultInput.selectedValues=[],!e||e&&!e.length||"kanban"===i.view?(n._defaultInput.classList.add("smart-hidden"),n._defaultOption.classList.add("smart-hidden")):(a.editColumn&&a.editColumn.defaultValue&&(n._defaultInput.selectedValues=[a.editColumn.defaultValue]),n._defaultInput.classList.remove("smart-hidden"),n._defaultOption.classList.remove("smart-hidden")))},n._init=e=>{n.clearContent(),"users"===o.bind?(n.handleVisibility="none",n.handlePosition="none"):(n.handleVisibility="visible",n.handlePosition="left"),e&&(e.forEach(((e,t)=>{const a=void 0!==e.id?e.id:t,l=s(e.label,e.color,a,e.value,t);n.$.container.appendChild(l)})),n.updateItems()),n._updateDefaultInput(e)},n._validate=r,e.allowColorItems.onchange=t=>{let a=e.allowColorItems.parentElement.nextElementSibling,l=null;for(;a;){if("options"===a.getAttribute("field-name")){if(l=a,l&&l.classList.contains("smart-hidden")){a=a.nextElementSibling;continue}break}if("users"===a.getAttribute("field-name")){if(l=a,l&&l.classList.contains("smart-hidden")){a=a.nextElementSibling;continue}break}a=a.nextElementSibling}l&&l.querySelectorAll("smart-color-input").forEach((e=>{e.disabled=!t}))},l.appendChild(n),"users"!==o.bind&&(l.appendChild(t),t.onclick=e=>{const t=s();n.$.container.appendChild(t),n.updateItems(),t.querySelector(".edit-column-input").focus(),a.btnConfirm.disabled=!0,a._refreshPosition(),e.preventDefault()});const u=document.createElement("div");u.innerHTML=i.localize("dialogAddColumnDefault");const m=document.createElement("smart-multi-combo-input");m.singleSelect=!0,m.readonly=!0,m.dropDownButtonPosition="right",m.colorItems=!0,m.autoOpen=!0,m.pills=!0,m.style.setProperty("--smart-surface","--smart-background"),m.style.width="100%",m.classList.add("smart-default-item","underlined");const p=document.createElement("div");p.style.display="flex",p.style.flexDirection="column",p.style.marginTop="5px",p.classList.add("smart-default-item-container"),p.appendChild(u),p.appendChild(m),l.appendChild(p),n._defaultInput=m,n._defaultOption=u,c=l,d.style.height="auto"}else if("number"===o.type)c=document.createElement("smart-number-input"),c.classList.add("underlined"),c.style.width="100%",c.style.height="30px","minValue"===o.bind?(c.value=0,c.min=-9999999,c.max=9999999):"maxValue"===o.bind?(c.value=1e6,c.min=-9999999,c.max=9999999):"minLength"===o.bind?c.value=0:"maxLength"===o.bind&&(c.value=500);else if("datetime"===o.type)c=document.createElement("smart-date-input"),c.classList.add("underlined"),c.style.width="100%",c.style.height="30px","minDateTime"===o.bind?c.value=new Date(1900,0,1):"maxDateTime"===o.bind&&(c.value=new Date(2100,0,1));else if("radio"===o.type){const e=(e,t,a)=>{const l=document.createElement("div"),i=document.createElement("label"),n=document.createElement("div");return i.innerHTML=e,n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),t&&n.setAttribute("checked",""),n.value=void 0!==t&&t,d.appendChild(n),l.onclick=function(){if(n.value=!0,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),l.onchange&&l.onchange(l),n.value){const e=n.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n.value=!0,n.setAttribute("checked",n.value?"":"indeterminate"),e.value=a}},l.appendChild(n),l.appendChild(i),l.classList.add("smart-grid-dialog-boolean-field"),l.setAttribute("template","checkBox"),l.setAttribute("editor",""),l.label=i,l.value=t,l.name=a,l},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),d.classList.add("radio-group");for(let a=0;a<o.options.length;a++){const l=o.options[a],i=e(l.label,l.checked,l.value);if(o.columns){const e=100/o.columns;i.style.width=e+"%",i.style.float="left"}t.appendChild(i),l.checked&&(d.value=l.value)}const a=document.createElement("div");a.style.clear="both",t.appendChild(a),c=t}if(o.options){c.readonly=!0;let e=o.options;"type"===o.bind&&(void 0!==i.currentUser&&null!==i.currentUser||(e=e.filter((e=>"updatedBy"!==e.value&&"createdBy"!==e.value))),(void 0===i.users||null===i.users||i.users&&0===i.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),c.dataSource=e,c.dropDownButtonPosition="right","dataField"!==o.bind&&(c.selectedIndex=0),o.options.length<15?c.dropDownHeight="auto":c.dropDownHeight=300}if(o.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",o.icon,"show","smart-description-button"),d.appendChild(e),c.style.width="calc(100% - 25px)"}if(d.appendChild(c),o.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=o.info,d.appendChild(e),c.style.width="calc(100% - 25px)"}if(l.appendChild(r),r.classList.add("smart-grid-dialog-field"),r.appendChild(s),r.appendChild(d),o.width&&!t[n+1].width){const e=document.createElement("div");e.style.clear="both",l.appendChild(e)}}}}}_getDefaultLocales(){return{AED:"ar_AE",AFN:"fa_AF",ALL:"sq",AMD:"hy",ANG:"nl",AOA:"pt_AO",ARS:"es_AR",AUD:"en",AWG:"nl_AW",AZN:"az",BAM:"bs",BBD:"en_BB",BDT:"bn_BD",BGN:"bg",BHD:"ar_BH",BIF:"fr_BI",BMD:"en_BM",BND:"ms_BN",BOB:"es_BO",BRL:"pt_BR",BSD:"en_BS",BTN:"dz",BWP:"en_BW",BYN:"be",BYR:"be",BZD:"en_BZ",CAD:"en_CA",CDF:"fr_CD",CHF:"de_CH",CLP:"es_CL",CNY:"zh_Hans_CN",COP:"es_CO",CRC:"es_CR",CUP:"es_CU",CVE:"pt_CV",CZK:"cs",DJF:"fr_DJ",DKK:"da_DK",DOP:"es_DO",DZD:"ar_DZ",EGP:"ar_EG",ERN:"ti_ER",ETB:"am",EUR:"de",FJD:"en_FJ",FKP:"en_FK",GBP:"en",GEL:"ka",GHS:"en_GH",GIP:"en_GI",GMD:"en_GM",GNF:"fr_GN",GTQ:"es_GT",GYD:"en_GY",HKD:"zh_Hans_HK",HNL:"es_HN",HRK:"hr_HR",HTG:"en",HUF:"hu_HU",IDR:"id",ILS:"he",INR:"en_IN",IQD:"ar_IQ",IRR:"fa_IR",ISK:"is",JMD:"en_JM",JOD:"ar_JO",JPY:"ja",KES:"en_KE",KGS:"ky",KHR:"km",KMF:"ar",KPW:"ko_KP",KRW:"ko_KR",KWD:"ar_KW",KYD:"en_KY",KZT:"kk",LAK:"lo",LBP:"ar_LB",LKR:"si",LRD:"en_LR",LSL:"en_LS",LYD:"ar_LY",MAD:"ar",MDL:"ro",MGA:"fr_MG",MKD:"mk",MMK:"my",MNT:"mn",MOP:"zh",MRO:"ar_MR",MRU:"ar_MR",MUR:"en_MU",MVR:"en",MWK:"en",MXN:"es_MX",MYR:"ms_MY",MZN:"pt_MZ",NAD:"en_NA",NGN:"en_NG",NIO:"es_NI",NOK:"nb_NO",NPR:"ne",NZD:"en_NZ",OMR:"ar_OM",PAB:"es_PA",PEN:"es_PE",PGK:"en_PG",PHP:"fil",PKR:"ur_PK",PLN:"pl",PYG:"es_PY",QAR:"ar_QA",RON:"ro",RSD:"sr",RUB:"ru",RWF:"rw",SAR:"ar_SA",SBD:"en_SB",SCR:"en_SC",SDG:"ar_SD",SEK:"sv_SE",SGD:"en_SG",SHP:"en_SH",SLL:"en_SL",SOS:"so_SO",SRD:"nl_SR",SSP:"en",STD:"pt_ST",STN:"pt_ST",SYP:"ar_SY",SZL:"en_SZ",THB:"th",TJS:"en",TMT:"tk",TND:"ar_TN",TOP:"to",TRY:"tr_TR",TTD:"en_TT",TWD:"zh_Hant_TW",TZS:"sw_TZ",UAH:"uk",UGX:"en_UG",USD:"en_US",UYU:"es_UY",UZS:"uz",VEF:"es_VE",VND:"vi",VUV:"en_BI",WST:"en_AS",XAF:"fr",XCD:"en",XOF:"fr",XPF:"fr_PF",YER:"ar_YE",ZAR:"zu",ZMW:"en_ZM",ZWL:"en_ZW"}}_getLocaleByCurrency(e){const t=this._getDefaultLocales();return t[e]?t[e].replace("_","-"):"en-US"}_getCurrencyByLocale(e){const t=this;if(t._currencyByLocale||(t._currencyByLocale={}),t._currencyByLocale[e])return t._currencyByLocale[e];const a=t._getCurrencies(),l=t._getDefaultLocales(),i=Object.keys(l);for(let n of i)if(l[n].replace("_","-")===e){const l=n;for(let i=0;i<a.length;i++)if(a[i].abbreviation===l){t._currencyByLocale[e]=a[i].sign;break}}return t._currencyByLocale[e]?t._currencyByLocale[e]:null}_getCurrencies(){return[{currency:"US Dollar",sign:"$",abbreviation:"USD"},{currency:"Euro",sign:"€",abbreviation:"EUR"},{currency:"Afghan Afghani",sign:"Af.",abbreviation:"AFN"},{currency:"Albanian Lek",sign:"Lek",abbreviation:"ALL"},{currency:"Algerian Dinar",sign:"din",abbreviation:"DZD"},{currency:"Angolan Kwanza",sign:"Kz",abbreviation:"AOA"},{currency:"Argentine Peso",sign:"$",abbreviation:"ARS"},{currency:"Armenian Dram",sign:"Dram",abbreviation:"AMD"},{currency:"Aruban Florin",sign:"Afl.",abbreviation:"AWG"},{currency:"Australian Dollar",sign:"$",abbreviation:"AUD"},{currency:"Azerbaijani Manat",sign:"₼",abbreviation:"AZN"},{currency:"Bahamian Dollar",sign:"$",abbreviation:"BSD"},{currency:"Bahraini Dinar",sign:"din",abbreviation:"BHD"},{currency:"Bangladeshi Taka",sign:"৳",abbreviation:"BDT"},{currency:"Barbadian Dollar",sign:"$",abbreviation:"BBD"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYN"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYR"},{currency:"Belize Dollar",sign:"$",abbreviation:"BZD"},{currency:"Bermudan Dollar",sign:"$",abbreviation:"BMD"},{currency:"Bhutanese Ngultrum",sign:"Nu.",abbreviation:"BTN"},{currency:"Bolivian Boliviano",sign:"Bs",abbreviation:"BOB"},{currency:"Bosnia-Herzegovina Convertible Mark",sign:"KM",abbreviation:"BAM"},{currency:"Botswanan Pula",sign:"P",abbreviation:"BWP"},{currency:"Brazilian Real",sign:"R$",abbreviation:"BRL"},{currency:"British Pound Sterling",sign:"£",abbreviation:"GBP"},{currency:"Brunei Dollar",sign:"$",abbreviation:"BND"},{currency:"Bulgarian Lev",sign:"лв.",abbreviation:"BGN"},{currency:"Burundian Franc",sign:"FBu",abbreviation:"BIF"},{currency:"Cambodian Riel",sign:"Riel",abbreviation:"KHR"},{currency:"Canadian Dollar",sign:"$",abbreviation:"CAD"},{currency:"Cape Verdean Escudo",sign:"CVE",abbreviation:"CVE"},{currency:"Cayman Islands Dollar",sign:"$",abbreviation:"KYD"},{currency:"CFA Franc BCEAO",sign:"CFA",abbreviation:"XOF"},{currency:"CFA Franc BEAC",sign:"FCFA",abbreviation:"XAF"},{currency:"CFP Franc",sign:"FCFP",abbreviation:"XPF"},{currency:"Chilean Peso",sign:"$",abbreviation:"CLP"},{currency:"Chinese Yuan",sign:"¥",abbreviation:"CNY"},{currency:"Chinese Yuan (offshore)",sign:"¥",abbreviation:"RMB"},{currency:"Colombian Peso",sign:"$",abbreviation:"COP"},{currency:"Comorian Franc",sign:"CF",abbreviation:"KMF"},{currency:"Congolese Franc",sign:"FrCD",abbreviation:"CDF"},{currency:"Costa Rican Colon",sign:"₡",abbreviation:"CRC"},{currency:"Croatian Kuna",sign:"kn",abbreviation:"HRK"},{currency:"Cuban Convertible Peso",sign:"$",abbreviation:"CUC"},{currency:"Cuban Peso",sign:"$",abbreviation:"CUP"},{currency:"Czech Republic Koruna",sign:"Kč",abbreviation:"CZK"},{currency:"Danish Krone",sign:"kr.",abbreviation:"DKK"},{currency:"Djiboutian Franc",sign:"Fdj",abbreviation:"DJF"},{currency:"Dominican Peso",sign:"RD$",abbreviation:"DOP"},{currency:"East Caribbean Dollar",sign:"$",abbreviation:"XCD"},{currency:"Egyptian Pound",sign:"£",abbreviation:"EGP"},{currency:"Eritrean Nakfa",sign:"Nfk",abbreviation:"ERN"},{currency:"Ethiopian Birr",sign:"Birr",abbreviation:"ETB"},{currency:"Falkland Islands Pound",sign:"£",abbreviation:"FKP"},{currency:"Fijian Dollar",sign:"$",abbreviation:"FJD"},{currency:"Gambian Dalasi",sign:"GMD",abbreviation:"GMD"},{currency:"Georgian Lari",sign:"GEL",abbreviation:"GEL"},{currency:"Ghanaian Cedi",sign:"GHS",abbreviation:"GHS"},{currency:"Gibraltar Pound",sign:"£",abbreviation:"GIP"},{currency:"Guatemalan Quetzal",sign:"Q",abbreviation:"GTQ"},{currency:"Guinean Franc",sign:"FG",abbreviation:"GNF"},{currency:"Guyanaese Dollar",sign:"$",abbreviation:"GYD"},{currency:"Haitian Gourde",sign:"HTG",abbreviation:"HTG"},{currency:"Honduran Lempira",sign:"L",abbreviation:"HNL"},{currency:"Hong Kong Dollar",sign:"$",abbreviation:"HKD"},{currency:"Hungarian Forint",sign:"Ft",abbreviation:"HUF"},{currency:"Icelandic Krona",sign:"kr",abbreviation:"ISK"},{currency:"Indian Rupee",sign:"₹",abbreviation:"INR"},{currency:"Indonesian Rupiah",sign:"Rp",abbreviation:"IDR"},{currency:"Iranian Rial",sign:"Rial",abbreviation:"IRR"},{currency:"Iraqi Dinar",sign:"din",abbreviation:""},{currency:"Israeli New Sheqel",sign:" ₪",abbreviation:"ILS"},{currency:"Jamaican Dollar",sign:"$",abbreviation:"JMD"},{currency:"Japanese Yen",sign:"¥",abbreviation:"JPY"},{currency:"Jordanian Dinar",sign:"din",abbreviation:"JOD"},{currency:"Kazakhstani Tenge",sign:"₸",abbreviation:"KZT"},{currency:"Kenyan Shilling",sign:"Ksh",abbreviation:"KES"},{currency:"Kuwaiti Dinar",sign:"din",abbreviation:"KWD"},{currency:"Kyrgystani Som",sign:"KGS",abbreviation:"KGS"},{currency:"Laotian Kip",sign:"₭",abbreviation:"LAK"},{currency:"Lebanese Pound",sign:"L£",abbreviation:"LBP"},{currency:"Lesotho Loti",sign:"LSL",abbreviation:"LSL"},{currency:"Liberian Dollar",sign:"$",abbreviation:"LRD"},{currency:"Libyan Dinar",sign:"din",abbreviation:"LYD"},{currency:"Lithuanian Litas",sign:"Lt",abbreviation:"LTL"},{currency:"Macanese Pataca",sign:"MOP",abbreviation:"MOP"},{currency:"Macedonian Denar",sign:"din",abbreviation:"MKD"},{currency:"Malagasy Ariary",sign:"Ar",abbreviation:"MGA"},{currency:"Malawian Kwacha",sign:"MWK",abbreviation:"MWK"},{currency:"Malaysian Ringgit",sign:"RM",abbreviation:"MYR"},{currency:"Maldivian Rufiyaa",sign:"Rf",abbreviation:"MVR"},{currency:"Mauritanian Ouguiya",sign:"MRO",abbreviation:"MRO"},{currency:"Mauritian Rupee",sign:"MURs",abbreviation:"MUR"},{currency:"Mexican Peso",sign:"$",abbreviation:"MXN"},{currency:"Moldovan Leu",sign:"MDL",abbreviation:"MDL"},{currency:"Mongolian Tugrik",sign:"₮",abbreviation:"MNT"},{currency:"Moroccan Dirham",sign:"dh",abbreviation:"MAD"},{currency:"Mozambican Metical",sign:"MTn",abbreviation:"MZN"},{currency:"Myanma Kyat",sign:"K",abbreviation:"MMK"},{currency:"Namibian Dollar",sign:"$",abbreviation:"NAD"},{currency:"Nepalese Rupee",sign:"Rs",abbreviation:"NPR"},{currency:"Netherlands Antillean Guilder",sign:"NAf.",abbreviation:"ANG"},{currency:"New Taiwan Dollar",sign:"NT$",abbreviation:"TWD"},{currency:"New Zealand Dollar",sign:"$",abbreviation:"NZD"},{currency:"Nicaraguan Cordoba",sign:"C$",abbreviation:"NIO"},{currency:"Nigerian Naira",sign:"₦",abbreviation:"NGN"},{currency:"North Korean Won",sign:"₩KP",abbreviation:"KPW"},{currency:"Norwegian Krone",sign:"kr",abbreviation:"NOK"},{currency:"Omani Rial",sign:"Rial",abbreviation:"OMR"},{currency:"Pakistani Rupee",sign:"Rs",abbreviation:"PKR"},{currency:"Panamanian Balboa",sign:"B/.",abbreviation:"PAB"},{currency:"Papua New Guinean Kina",sign:"PGK",abbreviation:"PGK"},{currency:"Paraguayan Guarani",sign:"Gs.",abbreviation:"PYG"},{currency:"Peruvian Nuevo Sol",sign:"S/.",abbreviation:"PEN"},{currency:"Philippine Peso",sign:"₱",abbreviation:"PHP"},{currency:"Polish Zloty",sign:"zł",abbreviation:"PLN"},{currency:"Qatari Rial",sign:"Rial",abbreviation:"QAR"},{currency:"Romanian Leu",sign:"RON",abbreviation:"RON"},{currency:"Russian Ruble",sign:"₽",abbreviation:"RUB"},{currency:"Rwandan Franc",sign:"RF",abbreviation:"RWF"},{currency:"Saint Helena Pound",sign:"£",abbreviation:"SHP"},{currency:"Samoan Tala",sign:"WST",abbreviation:"WST"},{currency:"Sao Tomean Dobra",sign:"Db",abbreviation:"STD"},{currency:"Saudi Riyal",sign:"Rial",abbreviation:"SAR"},{currency:"Serbian Dinar",sign:"din",abbreviation:"RSD"},{currency:"Seychellois Rupee",sign:"SCR",abbreviation:"SCR"},{currency:"Sierra Leonean Leone",sign:"SLL",abbreviation:"SLL"},{currency:"Singapore Dollar",sign:"$",abbreviation:"SGD"},{currency:"Solomon Islands Dollar",sign:"$",abbreviation:"SBD"},{currency:"Somali Shilling",sign:"SOS",abbreviation:"SOS"},{currency:"South African Rand",sign:"R",abbreviation:"ZAR"},{currency:"South Korean Won",sign:"₩",abbreviation:"KRW"},{currency:"South Sudanese Pound",sign:"£",abbreviation:"SSP"},{currency:"Sri Lankan Rupee",sign:"Rs",abbreviation:"LKR"},{currency:"Sudanese Pound",sign:"SDG",abbreviation:"SDG"},{currency:"Surinamese Dollar",sign:"$",abbreviation:"SRD"},{currency:"Swazi Lilangeni",sign:"SZL",abbreviation:"SZL"},{currency:"Swedish Krona",sign:"kr",abbreviation:"SEK"},{currency:"Swiss Franc",sign:"CHF",abbreviation:"CHF"},{currency:"Syrian Pound",sign:"£",abbreviation:"SYP"},{currency:"Tajikistani Somoni",sign:"Som",abbreviation:"TJS"},{currency:"Tanzanian Shilling",sign:"TSh",abbreviation:"TZS"},{currency:"Thai Baht",sign:"฿",abbreviation:"THB"},{currency:"Tongan Pa'anga",sign:"T$",abbreviation:"TOP"},{currency:"Trinidad and Tobago Dollar",sign:"$",abbreviation:"TTD"},{currency:"Tunisian Dinar",sign:"din",abbreviation:"TND"},{currency:"Turkish Lira",sign:"₺",abbreviation:"TRY"},{currency:"Turkmenistani Manat",sign:"m",abbreviation:"TMT"},{currency:"Ugandan Shilling",sign:"UGX",abbreviation:"UGX"},{currency:"Ukrainian Hryvnia",sign:"грн.",abbreviation:"UAH"},{currency:"United Arab Emirates Dirham",sign:"dh",abbreviation:"AED"},{currency:"Uruguayan Peso",sign:"$",abbreviation:"UYU"},{currency:"Uzbekistan Som",sign:"soʼm",abbreviation:"UZS"},{currency:"Vanuatu Vatu",sign:"VUV",abbreviation:"VUV"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VEF"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VES"},{currency:"Vietnamese Dong",sign:"₫",abbreviation:"VND"},{currency:"Yemeni Rial",sign:"Rial",abbreviation:"YER"},{currency:"Zambian Kwacha",sign:"ZMW",abbreviation:"ZMW"},{currency:"Zimbabwean Dollar",sign:"$",abbreviation:"ZWD"}].map((e=>(e.label=e.currency,e.menuLabel='<div style="display: flex; justify-content: space-between;"><span>'+e.currency+'</span><span style="opacity: 0.7;">'+e.sign+" 1,000.00</span></div>",e.value=e.abbreviation,e)))}_openAddStackColumnDialog(e,t,a){const l=this,i=l._dialogAddStackColumn||l._createDialog(l.editing.addColumnDialog),n=e?l.localize("dialogEditColumn",{value:e.label}):l.localize("dialogAddColumn"),o=i.querySelector(".smart-footer").querySelector(".smart-stack-layout"),r=l._getAddStackColumnDialogTemplate();i.classList.add("smart-grid-dialog-add-column"),i.type="add",i.editColumn=e||null,e&&e.element&&e.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),l._cellEditors||(l._cellEditors=[]),i.header.innerHTML=n,i.header.parentElement.classList.add("smart-hidden"),i.callback=a,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===l.view?(i.header.innerHTML=l.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),i.classList.add("view")):i.classList.remove("kanban")),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),l.cancelEdit(),i.content&&(i.content.innerHTML="");const s=document.createElement("div");s.classList.add("smart-content-layout-container"),i.content.appendChild(s),l._addStackColumnDialogEditors=[];const d=l._addStackColumnDialogEditors;if(l._initAddColumnDialogEditors(d,r,i,s),!l._dialogAddStackColumn){i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),i.onOpen=function(){const e=l._dialogAddStackColumn,t=l._getAddStackColumnDialogTemplate(),a=l._addStackColumnDialogEditors;l._addColumnDialogInitEditors(e,t,a),l._addColumnDialogShowHideEditors(e);const i=l.offset(l.$.columnHeader),n=l.$.columnHeader.offsetHeight,o=l.offset(l);if(e.style.maxHeight="",e.style.minHeight="",i.top+n+e.offsetHeight>window.innerHeight-o.top){const t=n+i.top+e.offsetHeight-window.innerHeight+o.top;e.style.maxHeight=Math.max(250,e.offsetHeight-t)+"px",e.style.minHeight="250px"}else e.style.maxHeight="",e.style.minHeight=""},i.onClose=function(){i.editColumn&&i.editColumn.element&&i.editColumn.element.removeAttribute("focus"),i.classList.remove("view"),i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){l._confirmAddColumnDialog(i),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&"kanban"!==l.view&&(i.result=!1,i.close())},l._dialogAddStackColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e)}const c=()=>{if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=l.offsetWidth+"px",void(i.style.height=l.offsetHeight+"px");{const e=l.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}i.open("center","center"),i.classList.add("center")};c(),i.refresh=()=>{c()}}_openImagePreviewDialog(e){const t=this,a=e?[...e.parentNode.parentNode.querySelectorAll("img")]:[];let l=e.hasAttribute("data-url")?e.getAttribute("data-url"):e.src;if((e=e.cloneNode()).src=l,!t._dialogImagePreview){t._dialogImagePreview=t._createDialog({modal:!0,screenModal:!0,left:"screenMiddle",top:"screenCenter",width:"80%",height:"80%"}),t._dialogImagePreview.content.innerHTML='<div style="width: 100%; height: 100%;"><div class="images-container"></div><div class="image-preview"></div></div>';const e=t._dialogImagePreview.content.firstElementChild;e.style.display="grid",e.style.gridTemplateColumns="50px 1fr"}const i=t._dialogImagePreview.querySelector(".images-container");i.innerHTML="";const n=(e,a)=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const l=150+Math.min(850,e.naturalWidth),i=150+Math.min(650,e.naturalHeight);t._dialogImagePreview.style.width=l+"px",t._dialogImagePreview.style.height=i+"px",!1!==a&&(t._dialogImagePreview.style.left="calc(50% - "+Math.min(850,t._dialogImagePreview.offsetWidth/2)+"px)",t._dialogImagePreview.style.top="calc(50% - "+Math.min(650,t._dialogImagePreview.offsetHeight/2)+"px)");const n=getComputedStyle(t._dialogImagePreview),o=parseInt(n.top),r=parseInt(n.left);if((window.offsetWidth<l||window.offsetHeight<i||o<0||r<0)&&(t._dialogImagePreview.style.left="0px",t._dialogImagePreview.style.top="0px",t._dialogImagePreview.style.width="100%",t._dialogImagePreview.style.height="100%"),o+i>window.innerHeight){const e=o+i-window.innerHeight;t._dialogImagePreview.style.height=i-e-20+"px"}e.style.maxWidth="100%",e.style.objectFit="contain",e.style.width="100%",e.style.height="calc(100% - 10px)"},o=()=>{const e=t._dialogImagePreview.querySelector(".images-container");let a=-1;return e.querySelectorAll("img").forEach(((e,t)=>{if(e.hasAttribute("active"))return a=t,!0})),a},r=e=>{const a=t._dialogImagePreview.querySelector(".images-container");e&&(e.hasAttribute("active")||a.querySelectorAll("img").forEach((t=>{t.style.borderColor="transparent",t.removeAttribute("active");let a=t.hasAttribute("data-url")?t.getAttribute("data-url").replaceAll("\\","/"):"";if(t.src===e.src||a===e.src){t.style.borderColor="var(--smart-primary)",t.setAttribute("active","");let e=t.src;t.hasAttribute("data-url")&&(e=t.getAttribute("data-url")),s.innerHTML=`<img src="${e}"/>`;const a=s.querySelector("img");a.onload=()=>{n(a,!1)}}})))};if(a.length>1)for(let t=0;t<a.length;t++){const l=a[t].cloneNode();l.style.width="40px",l.style.height="40px",l.style.cursor="pointer",l.style.borderStyle="solid",l.style.borderWidth="1px",l.style.borderColor="transparent",l.style.borderRadius="var(--smart-border)",l.style.marginTop="10px",l.classList.remove("smart-hidden"),l.title=a[t].title||a[t].parentNode.title,a[t].src===e.src&&(l.style.borderColor="var(--smart-primary)",l.setAttribute("active","")),i.appendChild(l),l.onmouseenter=()=>{l.style.borderColor="var(--smart-primary)"},l.onmouseleave=()=>{l.hasAttribute("active")||(l.style.borderColor="transparent")},l.onclick=()=>{r(l)}}const s=t._dialogImagePreview.content.querySelector(".image-preview");s.innerHTML="",s.style.overflow="auto",s.appendChild(e),t._dialogImagePreview.btnClose.onclick=e=>{t._dialogImagePreview.close(),e.preventDefault(),e.stopPropagation()},e.style.marginLeft="auto",e.style.marginRight="auto",e.style.maxWidth="",e.style.width="",e.style.height="",e.onload=()=>{n(e)},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){if("Escape"===e.key&&t._dialogImagePreview.close(),"ArrowUp"===e.key||"ArrowLeft"===e.key){const t=o();r(a[t-1]),e.stopPropagation(),e.preventDefault()}else if("ArrowDown"===e.key||"ArrowRight"===e.key){const t=o();r(a[t+1]),e.stopPropagation(),e.preventDefault()}},t._dialogImagePreview.btnClose.tabIndex=0,t._dialogImagePreview.onOpen=()=>{setTimeout((()=>{t._dialogImagePreview.btnClose.focus()}),100)},t._dialogImagePreview.footer.remove(),t._dialogImagePreview.header.parentNode.style.backgroundColor="var(--smart-background)",t._dialogImagePreview.open(),e&&r(e)}_getFileFromBase64(e,t){let a=e.split(","),l=a[0].match(/:(.*?);/)[1],i=atob(a[1]),n=i.length,o=new Uint8Array(n);for(;n--;)o[n]=i.charCodeAt(n);return new File([o],t,{type:l})}_getBase64(e,t){var a=new FileReader;a.readAsDataURL(e),a.onload=function(){t(a.result)},a.onerror=function(){t("error")}}_findIsFile(e){return"string"==typeof e&&(e.indexOf("http")>=0||e.indexOf("base64")>=0||e.indexOf('[{"value":"/')>=0)}_findUserFile(e){const t=this;if(e&&e.value.startsWith("/"))return!0;if(t.uploadSettings.userFiles)for(let a=0;a<t.uploadSettings.userFiles.length;a++){const l=t.uploadSettings.userFiles[a];if(l){let t=e.name||e.label;if(!t&&!e.label&&e.value){const a=e.value.split("/");t=a[a.length-1]}if(l.label===t)return l;if(l.label.indexOf("_")>=0&&(l.label.substring(0,l.label.lastIndexOf("_"))+l.label.substring(l.label.indexOf("."))).indexOf(t)>=0)return l;const a=l.value.replaceAll("\\","/");if(a===e.value||a===e.url)return l}}return null}_removeFiles(){const e=this,t=e._dialogFile,a=(t.preview.querySelectorAll(".item"),t.fileUpload),l=t.cell.value&&t.cell.value.indexOf("[{")>=0?JSON.parse(t.cell.value):[];if(e.uploadSettings.removeUrl){let i=new FormData,n=new XMLHttpRequest;for(let n=0;n<a.files.length;n++){let o=l[n]?l[n]:e.uploadSettings.url+"/"+a.files[n].name;if(t&&t.cell&&t.cell.value&&t.cell.value.indexOf("[")>=0){const e=JSON.parse(t.cell.value);for(let t=0;t<e.length;t++)if(e[t].label===a.files[n].name){o=e[t].value;break}}e._findUserFile(a.files[n])||i.append(e.uploadSettings.name,a.files[n])}for(let a=0;a<t.uploadedWithLink.length;a++){const l=t.uploadedWithLink[a];e._findUserFile(l)||i.append(e.uploadSettings.name,l)}n.open("POST",e.uploadSettings.removeUrl),n.send(i)}if(e.uploadSettings.onUploadRemove){const l=t.cell.value&&t.cell.value.indexOf("[{")>=0?JSON.parse(t.cell.value):[];for(let t=0;t<a.files.length;t++)l&&l[t]?e.uploadSettings.onUploadRemove(l[t]):e.uploadSettings.removeUrl&&e.uploadSettings.onUploadRemove(e.uploadSettings.removeUrl+"/"+a.files[t].name)}t.uploadedWithLink=[],a.value="",t.input.value="",e._updateFilePreview(),t.tabs[2].classList.contains("active")&&t.tabs[2].click()}_removeFile(e){const t=this,a=t._dialogFile,l=a.preview.querySelectorAll(".item"),i=e.name||e.label,n=a.fileUpload,o=new DataTransfer;l.forEach((e=>{let t=!0;e.file.name!==i&&e.file.label!==i||(t=!1),e.file.value&&(t=!1),t&&o.items.add(e.file)})),n.files=o.files,a.clearButton&&0===l.length&&a.clearButton.classList.remove("show");let r=t.uploadSettings.url+"/"+i;if(a&&a.cell&&a.cell.value&&a.cell.value.indexOf("[")>=0){const e=JSON.parse(a.cell.value);for(let t=0;t<e.length;t++)if(e[t].label===i){r=e[t].value;break}}let s=-1;for(let e=0;e<a.uploadedWithLink.length;e++){const t=a.uploadedWithLink[e];if(t&&t.label===i){s=e;break}}if(s>=0&&a.uploadedWithLink.splice(s,1),t.uploadSettings.userFiles)for(let e=0;e<t.uploadSettings.userFiles.length;e++){const l=t.uploadSettings.userFiles[e];if(l&&l.label===i)return void(a.tabs[2].classList.contains("active")&&a.tabs[2].click())}if(t.uploadSettings.onUploadRemove){let e=r;t.uploadSettings.onUploadRemove(e)}if(t.uploadSettings.removeUrl){let e=new FormData,a=new XMLHttpRequest;e.append(t.uploadSettings.name,r),a.open("POST",t.uploadSettings.removeUrl),a.send(e)}}getFileTypes(e){return e?["image/apng","image/bmp","image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon","video/x-msvideo","text/csv","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-fontobject","image/gif","application/json","text/plain","application/xml","application/zip","application/gzip","application/pdf","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/x-7z-compressed","application/vnd.rar","application/rtf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/x-zip-compressed"]:["image/apng","image/bmp","image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon"]}_getFileSize(e){return"string"==typeof e?e:e<1024?e+"bytes":e>=1024&&e<1048576?((e/1024).toFixed(1)+"KB").replace(".0",""):e>=1048576?(e/1048576).toFixed(1)+"MB":void 0}_getFileListItem(e){const t=this,a=t._dialogFile,l=a.acceptFiles,i=document.createElement("div");e.name||(e.name=e.label);const n=e.size||0;i.classList.add("item"),i.onpointerdown=n=>{const o=i.getBoundingClientRect();if(a.input.value="",n.clientY>=o.bottom-12)n.clientX>o.left+o.width/2-13&&n.clientX<o.left+o.width/2+13&&(i.remove(),t._removeFile(i.file));else if(l){if(e.value){const t=document.createElement("a");return t.href=e.value,t.target="_blank",void t.click()}const t=URL.createObjectURL(e),a=document.createElement("a");a.download=e.name,a.href=t,a.click()}else t._openImagePreviewDialog(i.querySelector("img"))};const o=document.createElement("div"),r=n?`, ${t._getFileSize(e.size)}.`:"";let s;return o.textContent=o.textContentTitle=`${e.name}${r}`,o.textContent.length>20&&(o.textContent=`${e.name.substring(0,5)}...${e.name.substring(e.name.length-4)} ${r}`),a.objectURL||(a.objectURL=[]),a.objectURL[e.name+"_"+n]||(e.small?a.objectURL[e.name+"_"+n]=e.small?e.small:URL.createObjectURL(e):e.medium?a.objectURL[e.name+"_"+n]=e.medium?e.medium:URL.createObjectURL(e):a.objectURL[e.name+"_"+n]=e.value?e.value:URL.createObjectURL(e)),l?(s=document.createElement("div"),s.classList.add("attachment","smart-grid-icon","show"),e.name.indexOf(".pdf")>=0?s.classList.add("smart-icon-pdf"):e.name.indexOf(".png")>=0||e.name.indexOf(".jpg")>=0||e.name.indexOf(".jpeg")>=0||e.name.indexOf(".gif")>=0?s.classList.add("smart-icon-image"):e.name.indexOf(".tsv")>=0||e.name.indexOf(".txt")>=0||e.name.indexOf(".csv")>=0?s.classList.add("smart-icon-text"):e.name.indexOf(".xls")>=0||e.name.indexOf(".xlsx")>=0?s.classList.add("smart-icon-excel"):e.name.indexOf(".ppt")>=0?s.classList.add("smart-icon-powerpoint"):e.name.indexOf(".zip")>=0||e.name.indexOf(".rar")>=0||e.name.indexOf(".7z")>=0?s.classList.add("smart-icon-archive"):e.name.indexOf(".doc")>=0||e.name.indexOf(".docx")>=0?s.classList.add("smart-icon-word"):s.classList.add("smart-icon-file")):(s=document.createElement("img"),s.loading="lazy",s.src=a.objectURL[e.name+"_"+n],s.onerror=()=>{if(i.style.display="none",a.uploadedWithLink.length){const t=a.uploadedWithLink.indexOf(e);t>=0&&a.uploadedWithLink.splice(t,1)}}),i.file=e,i.title=o.textContentTitle||o.textContent,i.appendChild(s),i.appendChild(o),i}_updateFilePreview(){const e=this,t=e._dialogFile,a=t.preview,l=t.fileUpload;for(;a.firstChild;)a.removeChild(a.firstChild);const i=()=>{const l=document.createElement("div");l.classList.add("list");const i=document.createElement("div");i.classList.add("smart-grid-icon","show","smart-icon-delete"),i.title=e.localize("clear"),a.appendChild(i),i.onclick=()=>{e._removeFiles()},t.clearButton=i,a.appendChild(l)},n=l.files;if(0===n.length)if(0===t.uploadedWithLink.length){const t=document.createElement("p");t.textContent=e.localize("dialogFileFileUpload"),a.appendChild(t)}else i();else{i();const o=new DataTransfer,r=t.column.editor.maxImages||e.uploadSettings.uploadMaxCount||5,s=t.column.editor.maxImageSize||e.uploadSettings.uploadMaxSize||524288;let d=0,c=[];for(const l of n){if(!e._validateFileType(l))continue;const i=e._getFileListItem(l);if(d>=r)c.push(l.name);else if(l.size>s){const t=document.createElement("p");t.textContent=t.textContentTitle=e.localize("dialogFileSize",{value:l.name,fileSize:e._getFileSize(s)}),a.appendChild(t)}else o.items.add(l),t.preview.querySelector(".list").appendChild(i),d++}if(c.length>0){const t=document.createElement("p");t.textContent=e.localize("dialogFileCount",{files:c.toString(),fileCount:r}),a.appendChild(t)}l.files=o.files}if(t.uploadedWithLink&&t.uploadedWithLink.length)for(let a=0;a<t.uploadedWithLink.length;a++){const l=t.uploadedWithLink[a];if(l){const a=e._getFileListItem(l);l.name=l.label,a.file=l,t.preview.lastChild.appendChild(a)}}}_validateFileType(e){return this.getFileTypes(this._dialogFile.acceptFiles).includes(e.type)}_getFileIndex(e){const t=this._dialogFile;let a=-1;for(let l=0;l<t.uploadedWithLink.length;l++){const i=t.uploadedWithLink[l];if(i.label===e.name||i.label===e.label&&(void 0!==i.label||void 0!==e.label)){a=l;break}if(i.name===e.name||i.name===e.label){a=l;break}if(e.label.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}}for(let l=0;l<t.fileUpload.files.length;l++){const i=t.fileUpload.files[l];if(i.label===e.name||i.label===e.label&&(void 0!==i.label||void 0!==e.label)){a=l;break}if(i.name===e.name||i.name===e.label){a=l;break}if(e.label&&e.label.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}if(e.name&&e.name.indexOf(i.name.substring(0,i.name.indexOf(".")))>=0){a=l;break}}return a}_openFileDialog(e,t=!1){const a=this,l=a._dialogFile||a._createDialog(),i='<span class="smart-grid-icon '+(!1===t?"smart-icon-image":"smart-icon-docs")+' show"></span>'+(!1===t?a.localize("dialogImageFileHeader"):a.localize("dialogFileHeader"));if(l.cell=e,l.header.innerHTML=i,l.column=e.column,l.acceptFiles=t,l.classList.add("smart-grid-image-dialog"),!a._dialogFile){l.modal=!0,l.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=a.localize("dialogEditButtonCancel");const e=()=>{l.loader&&l.loader.classList.add("smart-hidden"),l.close()};l.onOpen=function(){l.fileUpload.value="",l.input.value="",l.uploadedWithLink=[];let e=l.cell.editor.instance.getValue();if("[]"===e)return void l.tabs[0].click();l.tabs[0].click();let t=!0;const i=new DataTransfer;if("string"==typeof e&&e.indexOf("base64")>=0||"string"==typeof e&&e.indexOf("[{")>=0?e=JSON.parse(e):"string"==typeof e&&e.indexOf("./")>=0&&(e=e.split(","),e=e.map((e=>({label:e,value:e})))),Array.isArray(e)){let n=0;e.forEach((async o=>{if(t=!1,"string"==typeof o.value&&o.value.indexOf("base64")>=0&&(t=!0),t)i.items.add(a._getFileFromBase64(o.value,o.label));else{const t=(t,i)=>{a.uploadSettings.url&&(a._findUserFile(t)?(l.uploadedWithLink.push(t),n++,n===e.length&&a._updateFilePreview()):i("error"))};o.value.indexOf(window.location.host)>=0?t(o,(t=>{"error"!==t&&i.items.add(t),n++,n===e.length&&(l.fileUpload.files=i.files,a._updateFilePreview())})):(l.uploadedWithLink.push(o),n++,n===e.length&&a._updateFilePreview())}})),l.fileUpload.files=i.files,a._updateFilePreview()}else a._updateFilePreview()},l.onClose=function(){},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){let i=[],n=[...l.fileUpload.files];l.loader?l.loader.classList.remove("smart-hidden"):(l.loader=document.createElement("div"),l.loader.classList.add("smart-grid-loader"),l.loader.style.width=l.loader.style.height="24px",l.btnConfirm.parentNode.insertBefore(l.loader,l.btnConfirm)),l.uploadedWithLink&&l.uploadedWithLink&&l.uploadedWithLink.length&&(i=i.concat(l.uploadedWithLink)),(()=>{if(l.cell.value&&"string"==typeof l.cell.value){const e=JSON.parse(l.cell.value);e&&e.length&&(n=n.filter((t=>{let a=!0;return e.forEach((e=>{if(e.label===t.name&&(a=!1,!a)){const t={value:e.value,label:e.label};e.small&&(t.small=e.small),e.medium&&(t.medium=e.medium),e.large&&(t.large=e.large),i.push(t)}})),a})))}})();const o=()=>{const t=l.cell.value;l.cell.editor.instance.setValue(i),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&(a._endCellEdit(l.cell),a._handleFileColumnHistory(l.cell.row,l.cell.column.dataField,t,i)),e()};if(a.uploadSettings.url){const r=(t,i)=>{const n=t.filter((e=>-1!==e.value.indexOf(window.location.host)));if(i&&i[0]&&"error"===i[0].response&&(a.cancelEdit(),e()),n.length===l.fileUpload.files.length+l.uploadedWithLink.length){(i.files||i[0])&&a.uploadSettings.onUploadCompleted&&a.uploadSettings.onUploadCompleted({files:l.fileUpload.files,status:200,serverResponse:i});const t=l.cell.column.dataField;let o=l.cell.value;l.cell.editor.instance.setValue(n),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&(a._endCellEdit(l.cell),a._handleFileColumnHistory(l.cell.row,t,o,n)),e()}};if(0===n.length&&0===l.uploadedWithLink.length)l.cell.editor.instance.setValue(i),!(a.editing.dialog.enabled&&a.editing.dialog.visible)&&a._endCellEdit(l.cell),e();else if(a.uploadSettings.singleFilePost){let e=!1;for(let o=0;o<n.length;o++){const s=[];s.push(n[o]),a._handleFileUpload(l,s,i,t?"file":"image",r),e=!0}for(let t=0;t<l.uploadedWithLink.length;t++){const n=[];a._findUserFile(l.uploadedWithLink[t])||(n.push(l.uploadedWithLink[t].value),a._handleFileUpload(l,n,i,"url",r),e=!0)}e||o()}else if(n.length&&a._handleFileUpload(l,n,i,t?"file":"image",r),l.uploadedWithLink.length){const e=l.uploadedWithLink.filter((e=>!a._findUserFile(e)));if(e.length){const t=e.map((e=>e.value));a._handleFileUpload(l,t,i,"url",r)}else i.length===l.fileUpload.files.length+l.uploadedWithLink.length&&o()}}else{let e=0;for(let t=0;t<n.length;t++){const l=n[t];a._getBase64(l,(t=>{"error"===t&&console.log("Image load error"),e++,i.push({value:t,label:l.name}),e===n.length&&o()}))}0===n.length&&o()}},l.onkeydown=function(e){"Escape"===e.key&&l.close()},a._dialogFile=l,l.content.innerHTML=`\n <div>\n <div>\n <div class="tabs">\n <div class="active tab">\n <span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogFileDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${a.localize("dialogFileLink")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-cloud show"></span><label>${a.localize("dialogMyFiles")}</label>\n </div>\n </div>\n </div>\n <div class="smart-grid-drop-zone">\n <div>\n <div class="title"><span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogFileUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${a.localize("dialogFileDrop")}</label></div>\n </div> \n <input accept=".jpg, .jpeg, .png" type="file" multiple="multiple" style="display: none;">\n </div>\n <div class="smart-hidden url-zone">\n <div class="url-title">\n ${a.localize("dialogFileURL")}\n </div>\n <div class="upload">\n <smart-input placeholder="https://example.com/image.png" class="underlined"></smart-input>\n <br/>\n <smart-button disabled class="success">${a.localize("dialogFileURLUpload")}</smart-button>\n </div>\n </div>\n <div class="smart-hidden smart-grid-file-zone">\n \n <div class="files">\n </div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-attention-circled show"></span><label>${a.localize("dialogMyFilesTitle")}</label></div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,l.input=l.querySelector("smart-input"),l.dropZone=l.querySelector(".smart-grid-drop-zone"),l.upload=l.querySelector(".title"),l.fileUpload=l.querySelector("input"),l.preview=l.querySelector(".preview"),l.tabs=l.querySelectorAll(".tab"),l.urlZone=l.querySelector(".url-zone"),l.fileZone=l.querySelector(".smart-grid-file-zone"),l.files=l.querySelector(".smart-grid-file-zone .files"),l.uploadButton=l.querySelector("smart-button"),l.input.accept=t?".jpg, .jpeg, .png, .pdf, .xls, .xlsx, .doc, .docx, .gif, .csv, .txt, .xml, .zip, .rtf, .ppt, .pptx, .avi, .html, .htm":".jpg, .jpeg, .png, .gif",l.dropZone.ondrop=l.dropZone.dropHere=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;const i=l.column.editor.maxImages||5;for(let l=0;l<e.dataTransfer.items.length;l++)if("file"===e.dataTransfer.items[l].kind){const i=e.dataTransfer.items[l].getAsFile();a._validateFileType(i)&&t++}if(t===e.dataTransfer.files.length||t===i){const t=new DataTransfer;let n=[...e.dataTransfer.files],o=[...l.fileUpload.files];n.length>i&&(n=n.slice(0,5)),o.length>i&&(o=o.slice(0,5)),o.forEach(((e,a)=>{a<i&&t.items.add(e)})),n.forEach(((e,a)=>{a<i&&t.items.add(e)})),l.fileUpload.files=t.files,a._updateFilePreview()}}else l.fileUpload.files=e.dataTransfer.files,a._updateFilePreview()},l.dropZone.ondragover=e=>{e.preventDefault()},l.tabs[0].onclick=()=>{l.tabs[0].classList.add("active"),l.tabs[1].classList.remove("active"),l.tabs[2].classList.remove("active"),l.dropZone.classList.remove("smart-hidden"),l.fileZone.classList.add("smart-hidden"),l.urlZone.classList.add("smart-hidden")},l.tabs[1].onclick=()=>{l.tabs[0].classList.remove("active"),l.tabs[1].classList.add("active"),l.tabs[2].classList.remove("active"),l.dropZone.classList.add("smart-hidden"),l.fileZone.classList.add("smart-hidden"),l.urlZone.classList.remove("smart-hidden")},l.tabs[2].onclick=()=>{if(l.tabs[0].classList.remove("active"),l.tabs[1].classList.remove("active"),l.tabs[2].classList.add("active"),l.dropZone.classList.add("smart-hidden"),l.urlZone.classList.add("smart-hidden"),l.fileZone.classList.remove("smart-hidden"),l.files.innerHTML="",a.uploadSettings.userFiles&&a.uploadSettings.userFiles.length){const e=document.createDocumentFragment();a.uploadSettings.userFiles.forEach((t=>{Array.isArray(t)&&(t=t[0]);let i=t;"string"==typeof t.value&&t.value.indexOf("base64")>=0&&(t=a._getFileFromBase64(t.value,t.label)),t.type||(t.type="unknown");const n=a._getFileListItem(t);a._validateFileType(t)&&(a._getFileIndex(t)>=0&&n.classList.add("active"),n.onpointerdown=()=>{n.classList.toggle("active");let e=a._getFileIndex(t);n.classList.contains("active")?e<0&&l.uploadedWithLink.push({label:i.name||i.label,value:i.value}):a._removeFile(i),a._updateFilePreview()},e.appendChild(n))})),l.files.appendChild(e)}},l.uploadButton.onclick=()=>{const e=this,t=l.input.value,a=t.split("/"),i=a[a.length-1];if(l.column&&l.column.editor&&e.uploadSettings.url){const a={value:t,label:i},n=e._findUserFile(a);for(let e=0;e<l.uploadedWithLink.length;e++){if(l.uploadedWithLink[e].label===i)return;if(n&&l.uploadedWithLink[e].label===n.label)return}l.uploadedWithLink.push(n||a),e._updateFilePreview()}else{const a={value:t,label:i};for(let e=0;e<l.uploadedWithLink.length;e++)if(l.uploadedWithLink[e].label===i)return;l.uploadedWithLink.push(a),e._updateFilePreview()}l.input.value="",l.uploadButton.disabled=!0},l.fileUpload.onchange=()=>{if(0===l.fileUpload.files.length&&l._tempFiles)l.fileUpload.files=l._tempFiles;else if(l._tempFiles){const e=new DataTransfer,t=[...l.fileUpload.files],i=[...l._tempFiles];i.forEach((t=>{e.items.add(t)})),t.forEach((t=>{let l=!0;a._validateFileType(t)||(l=!1),i.forEach((e=>{e.name===t.name&&e.size===t.size&&e.lastModified===t.lastModified&&(l=!1)})),l&&e.items.add(t)})),l.fileUpload.files=e.files}a._updateFilePreview()},l.input.onchange=l.input.onblur=l.input.onkeyup=()=>{l.uploadButton.disabled=!l.input.value||!l.input.value.startsWith("https://");const e=l.input.value,t=e.split("/"),i=t[t.length-1];if(l.column&&l.column.editor&&a.uploadSettings.url){const t={value:e,label:i},n=a._findUserFile(t);for(let e=0;e<l.uploadedWithLink.length;e++)l.uploadedWithLink[e].label===i&&(l.uploadButton.disabled=!0),n&&l.uploadedWithLink[e].label===n.label&&(l.uploadButton.disabled=!0)}},l.upload.onclick=()=>{l._tempFiles=[];const e=new DataTransfer;[...l.fileUpload.files].forEach((t=>{e.items.add(t)})),l._tempFiles=e.files,l.fileUpload.click()}}l.fileUpload.accept=t?".jpg, .jpeg, .png, .pdf, .xls, .xlsx, .doc, .docx, .gif, .csv, .txt, .xml, .zip, .rtf, .ppt, .pptx, .avi, .html, .htm":".jpg, .jpeg, .png, .gif",l.open(),setTimeout((function(){l.btnConfirm.focus()}),100)}_handleFileUpload(e,t,a,l,i){const n=this;if(l||(l="image"),e.column&&e.column.editor&&n.uploadSettings.url){const o=new FormData,r=n.uploadSettings.url;let s=!1;const d=t[0],c=n.uploadSettings.data;c&&""!==c&&("string"==typeof c?o.append("postData",c):o.append("postData",JSON.stringify(c))),o.append("fileType",l);for(let e=0;e<t.length;e++)o.append(n.uploadSettings.name,t[e]),s=!0;let u=new XMLHttpRequest;u.open("POST",r),n.uploadSettings.onSetHeaders&&"function"==typeof n.uploadSettings.onSetHeaders&&n.uploadSettings.onSetHeaders(u,d),s&&n.$.fireEvent("uploadStarted",{files:t,size:d.size}),n.uploadSettings.onUploadStarted&&n.uploadSettings.onUploadStarted({files:t,status:u.status}),u.upload.onprogress=function(e){n.uploadSettings.onProgress&&n.uploadSettings.onProgress(e)},u.onabort=function(e){n.uploadSettings.onAbort&&n.uploadSettings.onAbort(e)},u.onerror=function(e){n.uploadSettings.onError&&n.uploadSettings.onError(e)},u.onload=function(){let e=!1;if(u.response&&("string"==typeof u.response?(e=u.response,e.indexOf("[{")>=0&&(e=JSON.parse(u.response))):e=JSON.parse(u.response)),u.status>=200&&u.status<=299){const o=(e,t)=>{if(e.response&&e.response.response&&"success"!==e.response.response)return null;let a=!1;u.fileURL&&(a=u.file_url);let l={};e&&e.file_url?a=e.file_url:e&&e[0]&&e[0].file_url&&(a=e[0].file_url);let i=!1;e&&e.file_url_small?i=e.file_url_small:e&&e[0]&&e[0].file_url_small&&(i=e[0].file_url_small);let n=!1;e&&e.file_url_medium?n=e.file_url_medium:e&&e[0]&&e[0].file_url_medium&&(n=e[0].file_url_medium);let o=!1;return e&&e.file_url_large?o=e.file_url_large:e&&e[0]&&e[0].file_url_large&&(o=e[0].file_url_large),a&&(l.value=a),i&&(l.small=i),n&&(l.medium=n),o&&(l.large=o),l.label=t,l};for(let i=0;i<t.length;i++){const r=t[i].name?[]:t[i].split("/"),s="url"===l?r[r.length-1]:t[i].name;n.uploadSettings.url;const d=o((e.files||e[0]&&e[0].files||[e[0]])[i],s);d&&a.push(d)}i(a,e)}else i(a,e),n.uploadSettings.onUploadError&&n.uploadSettings.onUploadError({files:t,status:u.status,serverResponse:e})},u.onreadystatechange=function(){e.column.editor.responseHandler&&"function"==typeof e.column.editor.responseHandler&&e.column.editor.responseHandler(u)},s&&u.send(o),n.uploadSettings.onChange&&n.uploadSettings.onChange(t)}}_handleFileColumnHistory(e,t,a,l){const i=this;if(i.storeHistory){a&&"string"==typeof a&&(a=(a=(a=JSON.parse(a)).map((e=>e.label))).toString()),a&&(Array.isArray(a)&&(a=a.map((e=>e.label))),a=a.toString()),null==a&&(a=""),l&&"string"==typeof l&&(l=(l=(l=JSON.parse(l)).map((e=>e.label))).toString()),null==l&&(l=""),l&&(Array.isArray(l)&&(l=l.map((e=>e.label))),l=l.toString());const n={user:i._currentUser.info.id,date:e.updatedDate};n.action=t,n.details={oldValue:a,value:l},e.addHistory(n)}}});
|