smart-webcomponents-react 19.0.0 → 19.0.5
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/chart/ganttchart.d.ts +1 -1
- package/ganttchart/ganttchart.d.ts +1 -1
- package/ganttchart/ganttchart.esm.js +3 -3
- package/ganttchart/ganttchart.umd.js +3 -3
- package/index.d.ts +1 -2
- package/package.json +1 -1
- 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 +1 -1
- package/source/modules/smart.card.js +1 -1
- package/source/modules/smart.cardview.js +3 -3
- 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 +1 -1
- package/source/modules/smart.chip.js +1 -1
- package/source/modules/smart.colorinput.js +1 -1
- package/source/modules/smart.colorpanel.js +1 -1
- package/source/modules/smart.colorpicker.js +1 -1
- package/source/modules/smart.combobox.js +1 -1
- package/source/modules/smart.common.js +2 -2
- package/source/modules/smart.countryinput.js +1 -1
- package/source/modules/smart.dateinput.js +1 -1
- package/source/modules/smart.daterangeinput.js +1 -1
- package/source/modules/smart.datetimepicker.js +1 -1
- 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 +1 -1
- package/source/modules/smart.formulaparser.js +1 -1
- package/source/modules/smart.ganttchart.js +4 -4
- package/source/modules/smart.gauge.js +1 -1
- package/source/modules/smart.grid.js +8 -8
- package/source/modules/smart.gridpanel.js +3 -3
- package/source/modules/smart.input.js +1 -1
- package/source/modules/smart.kanban.js +3 -3
- package/source/modules/smart.layout.js +1 -1
- package/source/modules/smart.led.js +1 -1
- package/source/modules/smart.listbox.js +1 -1
- package/source/modules/smart.listmenu.js +1 -1
- package/source/modules/smart.map.js +1 -1
- package/source/modules/smart.maskedtextbox.js +1 -1
- package/source/modules/smart.menu.js +1 -1
- package/source/modules/smart.multicomboinput.js +1 -1
- package/source/modules/smart.multiinput.js +1 -1
- package/source/modules/smart.multilinetextbox.js +1 -1
- package/source/modules/smart.multisplitbutton.js +1 -1
- package/source/modules/smart.numberinput.js +1 -1
- package/source/modules/smart.numerictextbox.js +1 -1
- package/source/modules/smart.pager.js +1 -1
- package/source/modules/smart.passwordinput.js +1 -1
- package/source/modules/smart.passwordtextbox.js +1 -1
- package/source/modules/smart.path.js +1 -1
- package/source/modules/smart.phoneinput.js +1 -1
- package/source/modules/smart.pivottable.js +3 -3
- package/source/modules/smart.progressbar.js +1 -1
- package/source/modules/smart.qrcode.js +1 -1
- package/source/modules/smart.querybuilder.js +1 -1
- package/source/modules/smart.radiobutton.js +1 -1
- package/source/modules/smart.rating.js +1 -1
- package/source/modules/smart.ribbon.js +1 -1
- package/source/modules/smart.router.js +2 -2
- package/source/modules/smart.scheduler.js +2 -2
- 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 +3 -3
- package/source/modules/smart.tabs.js +1 -1
- package/source/modules/smart.tank.js +1 -1
- package/source/modules/smart.textarea.js +1 -1
- package/source/modules/smart.textbox.js +1 -1
- package/source/modules/smart.timeinput.js +1 -1
- package/source/modules/smart.timepicker.js +1 -1
- package/source/modules/smart.toast.js +1 -1
- package/source/modules/smart.tooltip.js +1 -1
- package/source/modules/smart.tree.js +1 -1
- package/source/modules/smart.validator.js +1 -1
- package/source/modules/smart.window.js +1 -1
- package/source/smart.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 +1 -1
- 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 +2 -2
- package/source/smart.element.js +1 -1
- package/source/smart.elements.js +10 -10
- package/source/smart.export.js +1 -1
- package/source/smart.fileupload.js +1 -1
- package/source/smart.filter.js +1 -1
- package/source/smart.filterbuilder.js +1 -1
- package/source/smart.filterpanel.js +1 -1
- 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 +1 -1
- package/source/smart.grid.chart.js +1 -1
- package/source/smart.grid.column.js +1 -1
- package/source/smart.grid.core.js +2 -2
- package/source/smart.grid.dialog.js +2 -2
- package/source/smart.grid.edit.js +2 -2
- package/source/smart.grid.export.js +1 -1
- package/source/smart.grid.filter.js +1 -1
- package/source/smart.grid.group.js +1 -1
- package/source/smart.grid.js +1 -1
- package/source/smart.grid.menu.js +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 +1 -1
- package/source/smart.grid.sort.js +2 -2
- 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 +2 -2
- package/source/smart.input.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/source/smart.textbox.js +1 -1
- package/source/smart.tickintervalhandler.js +1 -1
- package/source/smart.timeinput.js +1 -1
- package/source/smart.timepicker.js +1 -1
- package/source/smart.toast.js +1 -1
- package/source/smart.tooltip.js +1 -1
- package/source/smart.tree.js +1 -1
- package/source/smart.validationpanel.js +1 -1
- package/source/smart.validator.js +1 -1
- package/source/smart.window.js +1 -1
- package/source/styles/bootstrap/smart.bootstrap.blue.css +3369 -3372
- package/source/styles/bootstrap/smart.bootstrap.css +3369 -3372
- package/source/styles/bootstrap/smart.bootstrap.cyan.css +3369 -3372
- package/source/styles/bootstrap/smart.bootstrap.green.css +3369 -3372
- package/source/styles/bootstrap/smart.bootstrap.indigo.css +3369 -3372
- package/source/styles/bootstrap/smart.bootstrap.orange.css +3369 -3372
- package/source/styles/bootstrap/smart.bootstrap.pink.css +3369 -3372
- package/source/styles/bootstrap/smart.bootstrap.purple.css +3369 -3372
- package/source/styles/bootstrap/smart.bootstrap.red.css +3369 -3372
- package/source/styles/bootstrap/smart.bootstrap.teal.css +3369 -3372
- package/source/styles/bootstrap/smart.bootstrap.turquoise.css +3369 -3372
- package/source/styles/components/smart.array.css +1 -1
- package/source/styles/components/smart.calendar.css +2 -2
- package/source/styles/components/smart.cardview.css +2 -2
- package/source/styles/components/smart.checkinput.css +1 -1
- package/source/styles/components/smart.colorinput.css +1 -1
- package/source/styles/components/smart.columnpanel.css +1 -1
- package/source/styles/components/smart.countryinput.css +1 -1
- package/source/styles/components/smart.dateinput.css +2 -2
- package/source/styles/components/smart.daterangeinput.css +2 -2
- package/source/styles/components/smart.datetimeformatpanel.css +1 -1
- package/source/styles/components/smart.datetimepicker.css +1 -1
- package/source/styles/components/smart.editor.css +2 -2
- package/source/styles/components/smart.filterbuilder.css +2 -2
- package/source/styles/components/smart.filterpanel.css +1 -1
- package/source/styles/components/smart.ganttchart.css +2 -2
- package/source/styles/components/smart.grid.css +3 -3
- package/source/styles/components/smart.gridpanel.css +1 -1
- package/source/styles/components/smart.input.css +1 -1
- package/source/styles/components/smart.kanban.css +2 -2
- package/source/styles/components/smart.maskedtextbox.css +1 -1
- package/source/styles/components/smart.multicolumnfilterpanel.css +2 -2
- package/source/styles/components/smart.multicomboinput.css +1 -1
- package/source/styles/components/smart.multiinput.css +1 -1
- package/source/styles/components/smart.multilinetextbox.css +1 -1
- package/source/styles/components/smart.numberformatpanel.css +1 -1
- package/source/styles/components/smart.numberinput.css +1 -1
- package/source/styles/components/smart.pager.css +1 -1
- package/source/styles/components/smart.passwordinput.css +1 -1
- package/source/styles/components/smart.passwordtextbox.css +1 -1
- package/source/styles/components/smart.phoneinput.css +1 -1
- package/source/styles/components/smart.pivottable.css +1 -1
- package/source/styles/components/smart.querybuilder.css +3 -3
- package/source/styles/components/smart.ribbon.css +1 -1
- package/source/styles/components/smart.scheduler.css +2 -2
- package/source/styles/components/smart.sortpanel.css +1 -1
- package/source/styles/components/smart.table.css +1 -1
- package/source/styles/components/smart.textarea.css +1 -1
- package/source/styles/components/smart.textbox.css +1 -1
- package/source/styles/components/smart.timeinput.css +1 -1
- package/source/styles/components/smart.validationpanel.css +1 -1
- package/source/styles/components/smart.window.css +1 -1
- package/source/styles/default/scss/textbox/_multi-combo-input.scss +5 -0
- package/source/styles/default/smart.accordion.css +309 -309
- package/source/styles/default/smart.array.css +77 -77
- package/source/styles/default/smart.badge.css +50 -50
- package/source/styles/default/smart.barcode.css +3 -3
- package/source/styles/default/smart.breadcrumb.css +324 -324
- package/source/styles/default/smart.button.css +515 -515
- package/source/styles/default/smart.calendar.css +742 -742
- package/source/styles/default/smart.card.css +53 -53
- package/source/styles/default/smart.chart.css +119 -119
- package/source/styles/default/smart.checkbox.css +148 -148
- package/source/styles/default/smart.chip.css +101 -101
- package/source/styles/default/smart.colorpanel.css +617 -617
- package/source/styles/default/smart.colorpicker.css +132 -132
- package/source/styles/default/smart.currencyformatpanel.css +71 -71
- package/source/styles/default/smart.dateformatpanel.css +105 -105
- package/source/styles/default/smart.datetimepicker.css +611 -611
- package/source/styles/default/smart.dockinglayout.css +748 -748
- package/source/styles/default/smart.dropdownbutton.css +257 -257
- package/source/styles/default/smart.editor.css +1528 -1527
- package/source/styles/default/smart.editors.css +150 -150
- package/source/styles/default/smart.fileupload.css +498 -498
- package/source/styles/default/smart.ganttchart.css +1594 -1594
- package/source/styles/default/smart.gauge.css +145 -145
- package/source/styles/default/smart.inputgroup.css +483 -483
- package/source/styles/default/smart.layout.css +465 -465
- package/source/styles/default/smart.layouts.css +483 -483
- package/source/styles/default/smart.led.css +144 -144
- package/source/styles/default/smart.link-button.css +321 -321
- package/source/styles/default/smart.listbox.css +564 -564
- package/source/styles/default/smart.listmenu.css +661 -661
- package/source/styles/default/smart.loader.css +203 -203
- package/source/styles/default/smart.maskedtextbox.css +27 -27
- package/source/styles/default/smart.multilinetextbox.css +190 -190
- package/source/styles/default/smart.multisplitbutton.css +225 -225
- package/source/styles/default/smart.numberformatpanel.css +72 -72
- package/source/styles/default/smart.numerictextbox.css +522 -522
- package/source/styles/default/smart.pager.css +253 -253
- package/source/styles/default/smart.passwordtextbox.css +129 -129
- package/source/styles/default/smart.path.css +581 -581
- package/source/styles/default/smart.pivottable.css +800 -800
- package/source/styles/default/smart.powerbutton.css +100 -100
- package/source/styles/default/smart.progressbar.css +501 -501
- package/source/styles/default/smart.qrcode.css +3 -3
- package/source/styles/default/smart.querybuilder.css +624 -623
- package/source/styles/default/smart.radiobutton.css +137 -137
- package/source/styles/default/smart.rating.css +17 -17
- package/source/styles/default/smart.scheduler.css +2789 -2789
- package/source/styles/default/smart.scrollbar.css +118 -118
- package/source/styles/default/smart.scrollviewer.css +109 -109
- package/source/styles/default/smart.slider.css +464 -464
- package/source/styles/default/smart.sortable.css +114 -114
- package/source/styles/default/smart.splitter.css +395 -395
- package/source/styles/default/smart.switchbutton.css +293 -293
- package/source/styles/default/smart.table.css +2025 -2025
- package/source/styles/default/smart.tabs.css +923 -923
- package/source/styles/default/smart.tank.css +661 -661
- package/source/styles/default/smart.textbox.css +3431 -3427
- package/source/styles/default/smart.timepicker.css +150 -150
- package/source/styles/default/smart.toast.css +252 -252
- package/source/styles/default/smart.toggle.css +175 -175
- package/source/styles/default/smart.tooltip.css +124 -124
- package/source/styles/default/smart.tree.css +783 -783
- package/source/styles/default/smart.validationpanel.css +116 -116
- package/source/styles/default/smart.window.css +829 -829
- package/source/styles/smart.default.css +4 -4
- package/source/styles/smart.fluent.css +3313 -3313
- package/source/typescript/smart.elements.d.ts +1 -2
- package/source/typescript/smart.ganttchart.d.ts +1 -2
|
@@ -819,7 +819,7 @@ Smart.Utilities.Assign("Complex",class{constructor(r,a){if("string"==typeof r)th
|
|
|
819
819
|
/***/ 6057:
|
|
820
820
|
/***/ (() => {
|
|
821
821
|
|
|
822
|
-
(()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),void 0===e.skipFirstRow&&(t.skipFirstRow=!1),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0)t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0)t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0)t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0)t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType))t._bindToICS(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType))t._bindToXML(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType))t._bindToCSV(),a();else if("array"===t.dataSourceType)t._bindToArray(),a();else if("json"===t.dataSourceType){if(t.dataSource&&t.dataSource.url)return t.url=t.dataSource.url,t.dataSource.method&&(t.type=t.dataSource.method),t.dataSource.type&&(t.type=t.dataSource.type),t.dataSource.data&&(t.data=t.dataSource.data),void new e(t,(e=>{t.dataSource=e}));t._bindToJSON(),a()}}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={};let l=i[t].split(a);if(t>0){let e=[],a=0,n=!1,r=i[t];for(let t=0;t<r.length;t++)if('"'===r.charAt(t))n=!n;else if(","===r.charAt(t)&&!n){let n=r.substring(a,t);n=n.trim(),n=n.replaceAll('"',""),e.push(n),a=t+1}let o=r.substring(a);o=o.trim(),o=o.replaceAll('"',""),","===o?e.push('""'):e.push(o),l=e}for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/")&&-1===i.indexOf("-"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):i.indexOf(".")>=0&&i.lastIndexOf(".")!==i.indexOf(".")?-1===i.indexOf(",")&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}0===t&&e.skipFirstRow||(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),t.data=r.data,a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{let a=t.value,n=t.valueTo;if(a&&a instanceof Date){a=`'${new Smart.Utilities.DateTime(a).toString("yyyy-MM-dd")}'`}if(t.valueTo&&t.valueTo instanceof Date){n=`'${new Smart.Utilities.DateTime(n).toString("yyyy-MM-dd")}'`}switch(t.condition){case"EQUAL":return e+" = "+a;case"NOT_EQUAL":return e+" != "+a;case"GREATER_THAN":return e+" > "+a;case"GREATER_THAN_OR_EQUAL":return e+" >= "+a;case"LESS_THAN":return e+" < "+a;case"LESS_THAN_OR_EQUAL":return e+" <= "+a;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+a+" and "+e+" <= "+n+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1!==o.logicalOperators[t]&&"or"!==o.logicalOperators[t]||(s=" OR ")}l.length&&r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e).replace(/</g,"<").replace(/>/g,">")}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n].replace(/</g,"<").replace(/>/g,">")+"'");null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=JSON.parse(JSON.stringify(e.boundSource[n]));if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=s.boundSource.canNotify;s.boundSource.canNotify=!1;const f=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let h=new Array;for(let t=0;t<e.length;t++)h[t]=f();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const p=new Array,g=new Array;let S=0;const y=function(t){let a=t;for(let n=0;n<e.length;n++){if(void 0===t[e[n]]){a=s._getDataItem(t,t.$.index);break}}if(n)for(let e in n){const t=n[e];t.name&&t.map&&(a[t.map]=a[t.name])}return a};let m=!1;for(let n=0;n<d.length;n++){let u=y(d[n]);u[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=u[a];null!=n?((""===n||void 0===n&&0===t)&&(m=!0),T[b++]={value:n,group:a,hash:h[t]}):(T[b++]={value:null,group:a,hash:h[t]},0===t&&(m=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===g[v]||null===g[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=u,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==u[c.expanded]?x[c.expanded]=u[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=u[i]),x[t]=new Array;let e=p.length+l;this.id&&"number"!=typeof u.$.id&&!isFinite(u.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),p[S++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=u,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==u[c.expanded]?e[c.expanded]=u[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=u[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}g[v]=x}else x=g[v]}u&&(u[c.leaf]=!0),null!==x?(null===this.id?void 0===u.$.id&&(u.$.id=x.$.id+"_"+x[t].length):void 0===u.$.id&&-1===u.$.id.toString().indexOf(x.$.id)&&(u.$.id=x.$.id+"_"+u.$.id),u[o]=x,u[c.level]=x[c.level]+1,x[t][x[t].length]=u):void 0===u.$.id&&(u.$.id=f())}if(m){let e=null,t=!1;for(let a=0;a<p.length;a++){const n=p[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),p.splice(a,1);break}}if(e&&(p.push(e),t))for(let e=0;e<p.length;e++){const t=p[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return s.boundSource.canNotify=u,p}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(void 0!==d&&"uncategorized"!==d||(d=""),o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("status"===t)n=r[o.dataField][t],null==n&&(n=[]),n[d]||(n[d]=[]),n[d].push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}else if("status"===t){let e=r[o.dataField][t];null==e&&(e=[]),e[d]||(e[d]=[]),e[d].push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].status){const e=r[n.dataField].status;r[n.dataField].status=e}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType){if(o&&"string"==typeof o&&o.indexOf("[")>=0){const e=JSON.parse(o);if(r.formatString&&Smart.Utilities.DateTime){const t=Smart.Utilities.DateTime.ParseDate(e[0],r.formatString),a=Smart.Utilities.DateTime.ParseDate(e[1],r.formatString);e[0]=t,e[1]=a}else{const t=a.$document.deserialize(""+e[0],r.dataType,!0),n=a.$document.deserialize(""+e[1],r.dataType,!0);e[0]=t,e[1]=n}o=e,n[r.name]=o;continue}if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0)}else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o),o.indexOf("<br")>=0&&(o=o.replaceAll("<br/>","\n\r"),o=o.replaceAll("<br>","\n\r")))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o)if(void 0!==n[a.id])o=n[a.id];else{const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];if(""!==t&&" "!==t){if("true"===t.trim()){i.push(!0);continue}if("false"===t.trim()){i.push(!1);continue}if(t.indexOf(" GMT")>=0)i.push(t.trim());else if(t.indexOf("or ")>=0||t.indexOf("and ")>=0||t.indexOf("1 ")>=0||t.indexOf("0 ")>=0||t.indexOf("| ")>=0||t.indexOf("& ")>=0){const e=t.trim().split(" ");if(e.length>1){const t=e[0].trim(),a=e[1].trim();"1"===t?i.push("or"):"0"===t?i.push("and"):i.push(t),i.push(a)}else i.push(t.trim())}else i.push(t.trim())}}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy){if(o.virtualDataSource)return;throw new Error("sort: Missing or Invalid arguments!")}"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
|
|
822
|
+
(()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),void 0===e.skipFirstRow&&(t.skipFirstRow=!1),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}forEach(e){const t=this;if(e)if(t.boundHierarchy&&t.boundHierarchy.length>0){const a=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(t.boundHierarchy);for(let t=0;t<a.length;t++){e(a[t],t)}}else for(let a=0;a<t.boundSource.length;a++){e(t.boundSource[a],a)}}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("parent")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0)t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0)t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0)t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0)t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType))t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}));else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType))t._bindToICS(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType))t._bindToXML(),a();else if("string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType))t._bindToCSV(),a();else if("array"===t.dataSourceType)t._bindToArray(),a();else if("json"===t.dataSourceType){if(t.dataSource&&t.dataSource.url)return t.url=t.dataSource.url,t.dataSource.method&&(t.type=t.dataSource.method),t.dataSource.type&&(t.type=t.dataSource.type),t.dataSource.data&&(t.data=t.dataSource.data),void new e(t,(e=>{t.dataSource=e}));t._bindToJSON(),a()}}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={};let l=i[t].split(a);if(t>0){let e=[],a=0,n=!1,r=i[t];for(let t=0;t<r.length;t++)if('"'===r.charAt(t))n=!n;else if(","===r.charAt(t)&&!n){let n=r.substring(a,t);n=n.trim(),n=n.replaceAll('"',""),e.push(n),a=t+1}let o=r.substring(a);o=o.trim(),o=o.replaceAll('"',""),","===o?e.push('""'):e.push(o),l=e}for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/")&&-1===i.indexOf("-"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):i.indexOf(".")>=0&&i.lastIndexOf(".")!==i.indexOf(".")?-1===i.indexOf(",")&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}0===t&&e.skipFirstRow||(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),t.data=r.data,a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{let a=t.value,n=t.valueTo;if(a&&a instanceof Date){a=`'${new Smart.Utilities.DateTime(a).toString("yyyy-MM-dd")}'`}if(t.valueTo&&t.valueTo instanceof Date){n=`'${new Smart.Utilities.DateTime(n).toString("yyyy-MM-dd")}'`}switch(t.condition){case"EQUAL":return e+" = "+a;case"NOT_EQUAL":return e+" != "+a;case"GREATER_THAN":return e+" > "+a;case"GREATER_THAN_OR_EQUAL":return e+" >= "+a;case"LESS_THAN":return e+" < "+a;case"LESS_THAN_OR_EQUAL":return e+" <= "+a;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+a+" and "+e+" <= "+n+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1!==o.logicalOperators[t]&&"or"!==o.logicalOperators[t]||(s=" OR ")}l.length&&r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e).replace(/</g,"<").replace(/>/g,">")}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row){if("$"===n||n===a.id)continue;const r=null===t.edit.row[n]?"":t.edit.row[n]+"";e.push(n+"='"+r.replace(/</g,"<").replace(/>/g,">")+"'")}null===a.id?d.update=" SET "+e.join(", "):d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),null!==t.edit.row[n]?e.push("'"+t.edit.row[n]+"'"):e.push("null"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.where.indexOf("undefined")>=0&&(d.where=""),d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,edit:t.edit,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}removeById(e){const t=this,a=t.indexOf(t.dataItemById[e]);t.boundSource[a]&&t.removeAt(a)}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=JSON.parse(JSON.stringify(e.boundSource[n]));if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=s.boundSource.canNotify;s.boundSource.canNotify=!1;const f=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let h=new Array;for(let t=0;t<e.length;t++)h[t]=f();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const p=new Array,g=new Array;let S=0;const y=function(t){let a=t;for(let n=0;n<e.length;n++){if(void 0===t[e[n]]){a=s._getDataItem(t,t.$.index);break}}if(n)for(let e in n){const t=n[e];t.name&&t.map&&(a[t.map]=a[t.name])}return a};let m=!1;for(let n=0;n<d.length;n++){let u=y(d[n]);u[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=u[a];null!=n?((""===n||void 0===n&&0===t)&&(m=!0),T[b++]={value:n,group:a,hash:h[t]}):(T[b++]={value:null,group:a,hash:h[t]},0===t&&(m=!0))}if(T.length!==e.length)break;let x=null,v="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(v=v+"_"+T[e].hash+"_"+n,void 0===g[v]||null===g[v]){if(null===x){x={$:{}},x[c.level]=0,x[c.leaf]=!1,x[o]=null,x[a]=n,x[r]=u,x.groupDataField=d,x[d]||(x[d]=x.data[d]),void 0!==u[c.expanded]?x[c.expanded]=u[c.expanded]:(x[c.expanded]=!1,s.expandHierarchy&&(x[c.expanded]=!0)),i&&(x[i]=u[i]),x[t]=new Array;let e=p.length+l;this.id&&"number"!=typeof u.$.id&&!isFinite(u.$.id)||(e="Item"+e),void 0===x.$.id&&(x.$.id=e),s._expandedRowIds[x.$.id]&&(x[c.expanded]=!0),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[x.$.id]&&(x[c.expanded]=!1),p[S++]=x}else{const e={$:{}};e[c.level]=x[c.level]+1,e[o]=x,e[a]=n,e[t]=new Array,e[r]=u,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==u[c.expanded]?e[c.expanded]=u[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=u[i]),void 0===e.$.id&&(e.$.id=x.$.id+"_"+x[t].length),s.expandHierarchy&&s._collapsedIds&&s._collapsedIds[e.$.id]&&(e[c.expanded]=!1),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),x[t][x[t].length]=e,x=e}g[v]=x}else x=g[v]}u&&(u[c.leaf]=!0),null!==x?(null===this.id?void 0===u.$.id&&(u.$.id=x.$.id+"_"+x[t].length):void 0===u.$.id&&-1===u.$.id.toString().indexOf(x.$.id)&&(u.$.id=x.$.id+"_"+u.$.id),u[o]=x,u[c.level]=x[c.level]+1,x[t][x[t].length]=u):void 0===u.$.id&&(u.$.id=f())}if(m){let e=null,t=!1;for(let a=0;a<p.length;a++){const n=p[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),p.splice(a,1);break}}if(e&&(p.push(e),t))for(let e=0;e<p.length;e++){const t=p[e];t.$.id="Item"+e,Object.keys(s._expandedRowIds).length>0&&(s._expandedRowIds[t.$.id]?t[c.expanded]=!0:t[c.expanded]=!1,s.expandHierarchy&&(t[c.expanded]=!0,s._collapsedIds&&s._collapsedIds[t.$.id]&&(t[c.expanded]=!1)))}}return s.boundSource.canNotify=u,p}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),null===o&&(o=n[e]=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(void 0!==d&&"uncategorized"!==d||(d=""),o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("status"===t)n=r[o.dataField][t],null==n&&(n=[]),n[d]||(n[d]=[]),n[d].push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}else if("status"===t){let e=r[o.dataField][t];null==e&&(e=[]),e[d]||(e[d]=[]),e[d].push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].status){const e=r[n.dataField].status;r[n.dataField].status=e}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&t&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType){if(o&&"string"==typeof o&&o.indexOf("[")>=0){const e=JSON.parse(o);if(r.formatString&&Smart.Utilities.DateTime){const t=Smart.Utilities.DateTime.ParseDate(e[0],r.formatString),a=Smart.Utilities.DateTime.ParseDate(e[1],r.formatString);e[0]=t,e[1]=a}else{const t=a.$document.deserialize(""+e[0],r.dataType,!0),n=a.$document.deserialize(""+e[1],r.dataType,!0);e[0]=t,e[1]=n}o=e,n[r.name]=o;continue}if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0)}else"any"!==r.dataType&&(o="string"===r.dataType&&"null"===o?"null":a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o),o.indexOf("<br")>=0&&(o=o.replaceAll("<br/>","\n\r"),o=o.replaceAll("<br>","\n\r")))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o)if(void 0!==n[a.id])o=n[a.id];else{const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];if(""!==t&&" "!==t){if("true"===t.trim()){i.push(!0);continue}if("false"===t.trim()){i.push(!1);continue}if(t.indexOf(" GMT")>=0)i.push(t.trim());else if(t.indexOf("or ")>=0||t.indexOf("and ")>=0||t.indexOf("1 ")>=0||t.indexOf("0 ")>=0||t.indexOf("| ")>=0||t.indexOf("& ")>=0){const e=t.trim().split(" ");if(e.length>1){const t=e[0].trim(),a=e[1].trim();"1"===t?i.push("or"):"0"===t?i.push("and"):i.push(t),i.push(a)}else i.push(t.trim())}else i.push(t.trim())}}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n=r.length>2?"":"and",i=0,d=[];for(let o=0;o<r.length;o++){let l=r[o];if("and"!==l&&"or"!==l){if(i++,2===i){let s=a[r[o-1]];s||(s=r[o-1]),"number"===e&&(l=parseFloat(l)),"date"===e&&(l=new Date(l));const c=t.createFilter(e,l,s);if(i=0,d.push(c),n){for(let e=0;e<d.length;e++)t.addFilter(n,d[e]);d=[]}}}else n=l}o.push(t)}else{let e=r[0];if(e&&a[e]&&(e="and"),"and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy){if(o.virtualDataSource)return;throw new Error("sort: Missing or Invalid arguments!")}"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let d=e[0][t[r]];if(void 0===d&&e[0]&&e[0].children&&e[0].data&&(d=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}o.sortComparators&&o.sortComparators[t[r]]?s[r]=o.sortComparators[t[r]]:s[r]=c(d,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
|
|
823
823
|
|
|
824
824
|
/***/ }),
|
|
825
825
|
|
|
@@ -868,7 +868,7 @@ Smart.Utilities.Assign("FilterGroup",class t{constructor(){const t=this;t.string
|
|
|
868
868
|
/***/ 3176:
|
|
869
869
|
/***/ (() => {
|
|
870
870
|
|
|
871
|
-
Smart("smart-grid-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},messages:{value:{en:{apply:"Ok",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",dateFirst:"1",dateLast:"9",from:"from",numberFirst:"1",numberLast:"9",stringFirst:"A",stringLast:"Z",thenBy:"then by"}},type:"object",extend:!0}}}static get listeners(){return{change:"_changeHandler",click:"_clickHandler",keydown:"_keydownHandler","sortable.dragEnd":"_sortableDragEndHandler"}}static get requires(){return{"Smart.Input":"smart.input.js","Smart.Sortable":"smart.sortable.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <smart-sortable id="sortable" disable-mode="manual" animation="[[animation]]" disabled="[[readonly]]" right-to-left="[[rightToLeft]]"\n drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]">\n </smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <smart-input id="inputNotSorted" right-to-left="[[rightToLeft]]" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),"right"===e.closeButtonPosition&&(e.$.sortable.handlePosition="left"),e._localize(),e._createSources(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":Array.from(l.$.sortable.getElementsByTagName("smart-input")).forEach((t=>t[e]=a));break;case"disabled":case"unfocusable":l._setFocusable();break;case"closeButtonPosition":"right"===l.closeButtonPosition?l.$.sortable.handlePosition="left":l.$.sortable.handlePosition="right";break;case"dataSource":l.$.sortable.$.container.innerHTML="",l._createSources();break;case"locale":case"messages":{const e=l.$.sortable._items;l._localize(),e.length&&(e[0].children[1].innerHTML=l.localize("firstBy"),e.forEach((function(e,t){0!==t&&(e.children[1].innerHTML=l.localize("thenBy"));const a=l._HTMLToSourceMap.get(e),n=l._ascDescTemplates[a.dataType]||l._ascDescTemplates.string;e.children[3].innerHTML=l.localize("from"),e.children[4].firstElementChild.innerHTML=n[0],e.children[4].children[1].innerHTML=n[1]})));break}case"maxLevel":if(null!=a)for(;l.$.sortable._items.length>0&&l.$.sortable._items.length>a;)l._interactionHandler(l.$.sortable._items[l.$.sortable._items.length-1].firstElementChild);l._disableItemAddition();break;case"rightToLeft":l.$.inputNotSorted.rightToLeft=a,l.$.inputNotSorted.dropDownButtonPosition=a?"left":"right",l.$.sortable._items.forEach((e=>{const t=e.querySelector("smart-input");t.rightToLeft=a,t.dropDownButtonPosition=a?"left":"right"}))}}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(t.$.inputNotSorted.contains(a)){const e=t.$.inputNotSorted.value,a=t._labelToSourceMap.get(e);return t._createSortItem(a,t.$.sortable._items.length),t.$.sortable.updateItems(),t._visibleLabels.push(e),t._updateHiddenSource(),t._disableItemAddition(),void(t.$.inputNotSorted.value="")}const l=a.closest("smart-input");if(!l)return;const n=l.parentElement.parentElement,i=n.children[4].firstElementChild,o=n.children[4].children[1],r=l.value,s=t._HTMLToSourceMap.get(n).label,d=t._labelToSourceMap.get(r),c=t._ascDescTemplates[d.dataType]||t._ascDescTemplates.string;t._HTMLToSourceMap.set(n,d),t._visibleLabels.splice(t._visibleLabels.indexOf(s),1,r),t._updateHiddenSource(),i.innerHTML=c[0],o.innerHTML=c[1],d.sortDirection&&-1===d.sortDirection.indexOf("asc")?(o.classList.add("selected"),i.classList.remove("selected")):(i.classList.add("selected"),o.classList.remove("selected"))}_updateHiddenSource(){const e=this;e._hiddenSource=e.dataSource.map((e=>({label:e.label,value:e.dataField,icon:e.icon}))).filter((t=>-1===e._visibleLabels.indexOf(t.label)));const t=e.$.inputNotSorted.context;e.$.inputNotSorted.context=e.$.inputNotSorted,e.$.inputNotSorted.dataSource=e._hiddenSource,e.$.sortable._items.forEach((t=>{const a=t.getElementsByTagName("smart-input")[0],l=a.context;a.context=a,a.dataSource=e._hiddenSource,a.context=l})),e.$.inputNotSorted.context=t,e._disableItemAddition(),e.$.fireEvent("dataSourceChange")}_clickHandler(e){const t=this;t._interactionHandler(t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,e)}_interactionHandler(e,t){const a=this;if(a.disabled||a.readonly)return!0;const l=e.closest(".smart-grid-panel-item");if(l){if(e===l.firstElementChild){const e=a._HTMLToSourceMap.get(l).label;a.$.sortable.$.container.removeChild(l),a.$.sortable.updateItems(),a._visibleLabels.splice(a._visibleLabels.indexOf(e),1),a._updateHiddenSource(),a._disableItemAddition(),a.$.sortable._items.length&&(a.$.sortable._items[0].children[1].innerHTML=a.localize("firstBy")),a.$.fireEvent("remove")}else if(l.children[4].contains(e)){const n=l.children[4].firstElementChild,i=l.children[4].children[1];"click"===t.type?e.classList.contains("selected")||(e===n?(i.classList.remove("selected"),n.classList.add("selected"),a._HTMLToSourceMap.get(l).sortDirection="ascending"):e===i&&(n.classList.remove("selected"),i.classList.add("selected"),a._HTMLToSourceMap.get(l).sortDirection="descending")):(n.classList.toggle("selected"),i.classList.toggle("selected"),a._HTMLToSourceMap.get(l).sortDirection=n.classList.contains("selected")?"ascending":"descending")}return!0}if(e===a.$.buttonsContainer.firstElementChild)return a.$.fireEvent("cancel"),!0;if(e===a.$.buttonsContainer.children[1]){const e=[],t={dataFields:[],dataTypes:[],orderBy:[]},l={value:e};return a.$.sortable._items.forEach((l=>{const n=a._HTMLToSourceMap.get(l);e.push({dataField:n.dataField,sortDirection:n.sortDirection}),t.dataFields.push(n.dataField),t.dataTypes.push(n.dataType),t.orderBy.push(n.sortDirection)})),a instanceof Smart.SortPanel&&a.$.maintainSortContainer&&(t.maintainSort=a.$.maintainSortContainer.firstElementChild.hasAttribute("active")),(a instanceof Smart.SortPanel||a instanceof Smart.GroupPanel)&&(l.sortByInfo=t),a.$.fireEvent("apply",l),!0}}_keydownHandler(e){const t=this,a=e.key;" "!==a&&"Enter"!==a||(e.preventDefault(),t._interactionHandler((t.shadowRoot||t.getRootNode()).activeElement,e))}_sortableDragEndHandler(e){const t=this,a=e.detail.oldIndex,l=e.detail.newIndex,n=Math.max(a,l),i=t.$.sortable._items;0===(a&&l)&&(i[0].children[1].innerHTML=t.localize("firstBy"),i[1].children[1].innerHTML=t.localize("thenBy"),n>1&&(i[n].children[1].innerHTML=t.localize("thenBy")))}_localize(){const e=this;e.$.inputNotSorted.placeholder=e.localize("pickAnother"),e.$.buttonsContainer.firstElementChild.innerHTML=e.localize("cancel"),e.$.buttonsContainer.children[1].innerHTML=e.localize("apply"),e._ascDescTemplates={boolean:[e.localize("booleanFirst")+" → "+e.localize("booleanLast"),e.localize("booleanLast")+" → "+e.localize("booleanFirst")],date:[e.localize("dateFirst")+" → "+e.localize("dateLast"),e.localize("dateLast")+" → "+e.localize("dateFirst")],number:[e.localize("numberFirst")+" → "+e.localize("numberLast"),e.localize("numberLast")+" → "+e.localize("numberFirst")],string:[e.localize("stringFirst")+" → "+e.localize("stringLast"),e.localize("stringLast")+" → "+e.localize("stringFirst")]}}_createSources(){const e=this,t=(e instanceof Smart.SortPanel?"sort":"group")+"Index",a=[],l=[];if(e._HTMLToSourceMap=new Map,e._labelToSourceMap=new Map,e.dataSource.forEach((l=>{e._labelToSourceMap.set(l.label,l),-1!==l[t]&&void 0!==l[t]&&a.push(l)})),a.sort(((e,a)=>e[t]-a[t])),void 0!==e.maxLevel&&null!==e.maxLevel)for(;a.length>0&&a.length>e.maxLevel;)a.pop();e.$.inputNotSorted.dropDownButtonPosition=e.rightToLeft?"left":"right",e.$.inputNotSorted.dataSource&&e.$.inputNotSorted.dataSource.length<10&&e.$.inputNotSorted.dataSource.length>0?e.$.inputNotSorted.dropDownHeight="auto":e.$.inputNotSorted.dropDownHeight=250,a.forEach((e=>l.push(e.label))),e._visibleLabels=l,e._updateHiddenSource(),a.forEach(((t,a)=>{e._createSortItem(t,a)})),e.$.sortable.updateItems(),e._disableItemAddition(),e._setFocusable()}_createSortItem(e,t){const a=this,l=a.disabled||a.unfocusable?-1:0,n=document.createElement("div"),i=a._ascDescTemplates[e.dataType]||a._ascDescTemplates.string;n.className="smart-grid-panel-item",n.innerHTML=`<div class="smart-grid-panel-item-close-button" tabindex="${l}" role="button" aria-label="Close"></div>\n<div class="smart-grid-panel-label-by smart-unselectable" role="presentation">${a.localize(t>0?"thenBy":"firstBy")}</div>\n<div class="smart-grid-panel-field-container" role="presentation"><smart-input class="smart-grid-panel-field-selection" value="${e.label}" animation="${a.animation}" readonly theme="${a.theme}" aria-label="Field name"></smart-input></div>\n<div class="smart-grid-panel-from smart-unselectable" role="presentation">${a.localize("from")}</div >\n<div class="smart-grid-panel-direction smart-unselectable" tabindex="${l}" role="presentation">\n <div class="smart-grid-panel-asc" role="button" aria-label="Ascending">${i[0]}</div >\n <div class="smart-grid-panel-desc" role="button" aria-label="Descending">${i[1]}</div>\n</div>\n`;const o=n.querySelector("smart-input");o.dataSource=a._hiddenSource,o.rightToLeft=a.rightToLeft,o.dropDownButtonPosition=a.rightToLeft?"left":"right",o.dataSource&&o.dataSource.length<10?o.dropDownHeight="auto":o.dropDownHeight=250,a.$.sortable.$.container.appendChild(n),o.tabIndex=l,e.sortDirection&&-1===e.sortDirection.indexOf("asc")?n.children[4].children[1].classList.add("selected"):(e.sortDirection="ascending",n.children[4].firstElementChild.classList.add("selected")),a._HTMLToSourceMap.set(n,e)}_disableItemAddition(){const e=this,t=e.maxLevel,a=0===e._hiddenSource.length||null!=t&&Math.max(0,t)===e.$.sortable._items.length;e.$.inputNotSorted.disabled=a,a&&e.$.inputNotSorted.removeAttribute("focus")}_setFocusable(){const e=this,t=e.disabled||e.unfocusable?-1:0,a=Array.from(e.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(e.getElementsByClassName("smart-grid-panel-direction")),n=Array.from(e.getElementsByTagName("input")),i=a.concat(l).concat(n);e.$.buttonsContainer.firstElementChild.tabIndex=t,e.$.buttonsContainer.children[1].tabIndex=t,i.forEach((e=>e.tabIndex=t))}}),Smart("smart-sort-panel",class extends Smart.GridPanel{static get properties(){return{messages:{value:{en:{firstBy:"Sort by",noSorting:"No sorting applied",pickAnother:"Pick another field to sort by",maintainSort:"Maintain Sort",applyOnce:"Apply once"}},type:"object",extend:!0}}}template(){return'<div id="container" role="presentation">\n <smart-sortable disable-mode="manual" right-to-left="[[rightToLeft]]" id="sortable" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div>\n <smart-input right-to-left="[[rightToLeft]]" id="inputNotSorted" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="maintainSortContainer" class="smart-hidden smart-grid-panel-buttons-container smart-grid-panel-maintain-sort smart-unselectable" role="presentation">\n <span class="smart-grid-panel-maintain-sort-button" role="button"></span>\n </div>\n \n </div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}_changeApplyButtonText(e){const t=this,a=t.$.maintainSortContainer.firstElementChild,l=t.querySelector(".smart-grid-panel-apply-button");e?a.hasAttribute("active")?(a.removeAttribute("active"),l&&(l.innerHTML=t.localize("applyOnce"))):(a.setAttribute("active",""),l&&(l.innerHTML=t.localize("apply"))):a.hasAttribute("active")?l.innerHTML=t.localize("apply"):l.innerHTML=t.localize("applyOnce")}_interactionHandler(e,t){const a=this;super._interactionHandler(e,t)||e===a.$.maintainSortContainer.firstElementChild&&a._changeApplyButtonText(!0)}static get styleUrls(){return["smart.textbox.css"]}_localize(){super._localize();const e=this;e.$.sortable.$.container.setAttribute("no-sorting",e.localize("noSorting")),e.$.maintainSortContainer.firstElementChild.innerHTML=e.localize("maintainSort"),e._changeApplyButtonText()}}),Smart("smart-group-panel",class extends Smart.GridPanel{static get properties(){return{maxLevel:{value:8,type:"number?"},messages:{value:{en:{collapseAll:"Collapse all",expandAll:"Expand all",firstBy:"Group by",noGrouping:"No grouping",pickAnother:"Pick another field to group by"}},type:"object",extend:!0}}}template(){return'<div id="container" role="presentation">\n <smart-sortable disable-mode="manual" right-to-left="[[rightToLeft]]" id="sortable" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="expandCollapseContainer" class="smart-grid-panel-buttons-container smart-grid-panel-expand-collapse smart-unselectable" role="presentation">\n <span class="smart-group-panel-collapse-button" role="button"></span>\n <span class="smart-group-panel-expand-button" role="button"></span>\n </div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <smart-input right-to-left="[[rightToLeft]]" id="inputNotSorted" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}_interactionHandler(e,t){const a=this;super._interactionHandler(e,t)||(e===a.$.expandCollapseContainer.firstElementChild?a.$.fireEvent("collapseAll"):e===a.$.expandCollapseContainer.children[1]&&a.$.fireEvent("expandAll"))}_localize(){super._localize();const e=this;e.$.expandCollapseContainer.firstElementChild.innerHTML=e.localize("collapseAll"),e.$.expandCollapseContainer.children[1].innerHTML=e.localize("expandAll"),e.$.sortable.$.container.setAttribute("no-grouping",e.localize("noGrouping"))}_setFocusable(){super._setFocusable();const e=this,t=e.disabled||e.unfocusable?-1:0;e.$.expandCollapseContainer.firstElementChild.tabIndex=t,e.$.expandCollapseContainer.children[1].tabIndex=t}}),Smart("smart-multi-column-filter-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},editorCallback:{value:null,type:"function?",reflectToAttribute:!1},editorPlaceholder:{value:"Value",type:"string"},messages:{value:{en:{addFilter:"+ Add filter",and:"And",apply:"Ok",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",or:"Or",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",where:"Where",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month"}},type:"object",extend:!0},operator:{value:"and",allowedValues:["and","or"],type:"string"},value:{value:[],type:"array"}}}static get listeners(){return{change:"_changeHandler",click:"_interactionHandler",keydown:"_interactionHandler"}}static get requires(){return{"Smart.Button":"smart.button.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.FilterGroup":"smart.filter.js","Smart.Input":"smart.input.js","Smart.NumericTextBox":"smart.numerictextbox.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div id="itemsContainer" class="smart-filter-panel-items-container smart-unselectable"></div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div id="addFilterButton" class="smart-filter-panel-add-filter-button smart-unselectable" role="button"></div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),e._setFocusable(),e._localize(),e._applyValue(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":Array.from(l.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input")).forEach((t=>{t[e]=a,"smart-input"===t.tagName.toLowerCase()&&"rightToLeft"===e&&"none"!==t.dropDownButtonPosition&&(t.dropDownButtonPosition=a?"left":"right")}));break;case"disabled":case"unfocusable":l._setFocusable(!0);break;case"dataSource":case"value":l._applyValue();break;case"editorPlaceholder":Array.from(l.$.itemsContainer.getElementsByClassName("editor")).forEach((e=>e.placeholder=a));break;case"locale":case"messages":l._localize(!0);break;case"operator":l._setOperator()}}_setOperator(){const e=this,t=e.localize(e.operator);for(let a=2;a<e._items.length;a++)e._items[a].children[1].innerHTML=t}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a instanceof Smart.Input==0)return;const l=a.parentElement,n=l.children;if(a===n[1])t.operator=a.$.input.dataValue,t._setOperator();else if(a===n[2]){let a,i,o=t.dataSource.find((t=>t.dataField===e.detail.oldValue)).dataType,r=t.dataSource.find((t=>t.dataField===e.detail.oldValue)),s=t.dataSource.find((t=>t.dataField===e.detail.value)),d=s.dataType,c=[];if(s.options&&(d="enum",c=s.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),r&&r.options&&(o="enum"),"enum"!==d&&d===o)return void(t.editorCallback&&t.editorCallback(n[4],s));let p=n[3].value;switch(d){case"date":a=t._dateConditions,i=document.createElement("smart-date-time-picker"),i.calendarButton=!0,i.dropDownAppendTo="body",i.dropDownDisplayMode="auto",i.formatString="M/d/yy H:mm",p="";break;case"number":a=t._numberAndDateConditions,i=document.createElement("smart-numeric-text-box"),p="";break;case"boolean":a=t._booleanConditions,i=document.createElement("smart-check-box"),p="";break;case"enum":a=t._enumConditions,i=document.createElement("smart-input"),i.dataSource=c.length?c:s.options,i.readonly=!0,i.dropDownButtonPosition="right",p=a[0];break;default:a=t._stringConditions,p=t._stringConditions.find((e=>"CONTAINS"===e.value)),i=document.createElement("smart-input")}a.forEach((e=>{delete e.selected})),i.rightToLeft=t.rightToLeft,i.animation=t.animation,i.theme=t.theme,i.unfocusable=t.disabled||t.unfocusable,i.classList.add("underlined"),i.dataSource&&i.dataSource.length<10?i.dropDownHeight="auto":i.dropDownHeight=250,"boolean"!==d&&(i.placeholder=t.editorPlaceholder),t.editorCallback&&t.editorCallback(i,s),n[4]&&n[4].remove(),l.appendChild(i),""===p||a.find((e=>e.label===p))||(p.value?(n[3].value=p.label,n[3].selectedValue=p.value):(n[3].value="",n[3].selectedValue="")),n[3].dataSource=a,""===p&&(n[3].value=a[0].label,n[3].selectedValue=a[0].value),a.length>=10?n[3].dropDownHeight=250:n[3].dropDownHeight="auto",l.dataType=d}else if(a===n[3]){const e=n[4],t=a.$.input.dataValue;-1!==t.indexOf("NULL")||-1!==t.indexOf("EMPTY")||-1!==t.indexOf("THIS_WEEK")||-1!==t.indexOf("LAST_WEEK")||-1!==t.indexOf("NEXT_WEEK")||-1!==t.indexOf("THIS_MONTH")||-1!==t.indexOf("LAST_MONTH")||-1!==t.indexOf("NEXT_MONTH")||-1!==t.indexOf("THIS_YEAR")||-1!==t.indexOf("LAST_YEAR")||-1!==t.indexOf("NEXT_YEAR")||-1!==t.indexOf("TODAY")||-1!==t.indexOf("TOMORROW")||-1!==t.indexOf("YESTERDAY")?(e.value="",e.checked=!1,e.classList.add("smart-visibility-hidden")):e.classList.remove("smart-visibility-hidden"),a.condition=t}}_interactionHandler(e){const t=this;if(t.disabled||t.readonly)return;if("keydown"===e.type){if("Enter"!==e.key)return;e.preventDefault()}const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-grid-panel-item");if(l){if(a===l.firstElementChild){const e=t._items.indexOf(l);let a;t._items.splice(e,1),l.remove(),t._items.length>0&&e<2&&(0===e&&(t._items[0].children[1].remove(),a=document.createElement("div"),a.innerHTML=t.localize("where"),t._items[0].insertBefore(a,t._items[0].children[1])),t._items.length>1&&(t._items[1].children[1].remove(),a=document.createElement("smart-input"),a.className="underlined",a.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],a.dropDownButtonPosition=t.rightToLeft?"left":"right",a.readonly=!0,a.value=t.localize(t.operator),a.animation=t.animation,a.theme=t.theme,a.rightToLeft=t.rightToLeft,a.unfocusable=t.disabled||t.unfocusable,t._items[1].insertBefore(a,t._items[1].children[1])))}}else if(a===t.$.addFilterButton&&t.dataSource.length>0)t.$.itemsContainer.appendChild(t._createItem(t.dataSource[0],"","",t._items.length));else if(a!==t.$.buttonsContainer.firstElementChild){if(a===t.$.buttonsContainer.children[1]){let e=t._stringConditions.concat(t._dateConditions),a=t.operator,l=[],n={},i=[];t._customConditions&&(e=e.concat(t._customConditions)),t._items.forEach((i=>{const o=t.dataSource.find((e=>e.label===i.children[2].value)),r=[];let s=i.children[3].value;if(""===s)return;let d=o.dataType;if(s=e.find((e=>e.label===s)).value,r.push(o.dataField,s),-1===s.indexOf("NULL")&&-1===s.indexOf("EMPTY"))if("boolean"===d)r.push(i.children[4].checked);else if("date"===d)r.push(i.children[4].value.toDate());else if("enum"===d||o.options){let e=i.children[4].$.input.dataValue;if(void 0===e){const t=o.options.find((e=>e.label===i.children[4].value));if(!t)return;e=t.value}d="string",r.push(e)}else r.push(i.children[4].value);let c=n[r[0]];void 0===c&&(c=new Smart.Utilities.FilterGroup,n[r[0]]=c);const p=c.createFilter(d,r[2],r[1]);c.addFilter(a,p),l.push(r)}));for(let e in n)i.push([e,n[e]]);t.value=l,t.$.fireEvent("apply",{filters:i,operator:a,value:l})}}else t.$.fireEvent("cancel")}_applyValue(){const e=this,t=document.createDocumentFragment();let a=0;for(e._items=[];e.$.itemsContainer.firstElementChild;)e.$.itemsContainer.firstElementChild.remove();0!==e.dataSource.length&&(e.value.forEach((l=>{if(!Array.isArray(l))return;const n=l[0],i=e.dataSource.find((e=>e.dataField===n));if(!i)return;const o=e._createItem(i,l[1],l[2],a);t.appendChild(o),a++})),e.$.itemsContainer.appendChild(t))}_createItem(e,t,a,l){const n=this,i=n.disabled||n.unfocusable?-1:0,o=document.createElement("div"),r=document.createDocumentFragment(),s=document.createElement("div"),d=document.createElement("smart-input"),c=document.createElement("smart-input");let p,u;if(s.className="smart-grid-panel-item-close-button",s.tabIndex=i,s.setAttribute("role","button"),s.setAttribute("aria-label","button"),r.appendChild(s),0===l?(p=document.createElement("div"),p.innerHTML=n.localize("where"),p.setAttribute("role","presentation")):1===l?(p=document.createElement("smart-input"),p.className="underlined",p.dataSource=[{value:"and",label:n.localize("and")},{value:"or",label:n.localize("or")}],p.dropDownButtonPosition=n.rightToLeft?"left":"right",p.readonly=!0,p.value=n.localize(n.operator),p.animation=n.animation,p.theme=n.theme,p.rightToLeft=n.rightToLeft,p.unfocusable=n.disabled||n.unfocusable,p.setAttribute("aria-label","Operator")):(p=document.createElement("div"),p.innerHTML=n.localize(n.operator),p.setAttribute("role","presentation")),r.appendChild(p),d.className="underlined",d.dataSource=n.dataSource.map((e=>({value:e.dataField,label:e.label,icon:e.icon}))),d.dropDownButtonPosition=n.rightToLeft?"left":"right",d.readonly=!0,d.value=e.label,d.animation=n.animation,d.theme=n.theme,d.rightToLeft=n.rightToLeft,d.unfocusable=n.disabled||n.unfocusable,d.setAttribute("aria-label","Field"),d.dataSource&&d.dataSource.length<10?d.dropDownHeight="auto":d.dropDownHeight=250,r.appendChild(d),"boolean"===e.dataType)c.dataSource=JSON.parse(JSON.stringify(n._booleanConditions)),u=document.createElement("smart-check-box"),u.checked="boolean"==typeof a&&a;else if("date"===e.dataType)c.dataSource=n._dateConditions,u=document.createElement("smart-date-time-picker"),u.dropDownDisplayMode="auto",u.calendarButton=!0,u.dropDownAppendTo="body",u.formatString="M/d/yy H:mm",u.value=a;else if("number"===e.dataType)c.dataSource=JSON.parse(JSON.stringify(n._numberAndDateConditions)),u=document.createElement("smart-numeric-text-box"),u.value="number"==typeof a||"string"==typeof a?a:0;else if("enum"===e.dataType||e.options){c.dataSource=JSON.parse(JSON.stringify(n._enumConditions)),u=document.createElement("smart-input");let t=[];e.options&&(t=e.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),u.dataSource=t.length?t:e.options,u.readonly=!0,u.dropDownButtonPosition="right";const l=a?e.options.find((e=>e.value===a)):null;u.value=l&&a?l.label:""}else c.dataSource=JSON.parse(JSON.stringify(n._stringConditions)),u=document.createElement("smart-input"),u.value=null!=a?a.toString():"",t||(t="CONTAINS");return c.className="underlined",c.dropDownButtonPosition=n.rightToLeft?"left":"right",c.readonly=!0,c.animation=n.animation,c.theme=n.theme,c.rightToLeft=n.rightToLeft,c.unfocusable=n.disabled||n.unfocusable,c.setAttribute("aria-label","Condition"),c.classList.add("smart-filter-panel-list"),c.dataSource.forEach((e=>{delete e.selected})),c.dataSource.find((e=>e.value===t))?(c.value=n.localize(t),c.selectedValue=t,c.condition=t):(u.value="",u.checked=!1),(void 0===t||-1===t.indexOf("NULL")&&-1===t.indexOf("EMPTY"))&&-1===t.indexOf("THIS_WEEK")&&-1===t.indexOf("LAST_WEEK")&&-1===t.indexOf("NEXT_WEEK")&&-1===t.indexOf("THIS_MONTH")&&-1===t.indexOf("LAST_MONTH")&&-1===t.indexOf("NEXT_MONTH")&&-1===t.indexOf("THIS_YEAR")&&-1===t.indexOf("LAST_YEAR")&&-1===t.indexOf("NEXT_YEAR")&&-1===t.indexOf("TODAY")&&-1===t.indexOf("TOMORROW")&&-1===t.indexOf("YESTERDAY")||(u.value="",u.checked=!1,u.classList.add("smart-visibility-hidden")),c.dataSource&&c.dataSource.length<10?c.dropDownHeight="auto":c.dropDownHeight=250,u.animation=n.animation,u.classList.add("editor"),u.rightToLeft=n.rightToLeft,u.theme=n.theme,u.unfocusable=n.disabled||n.unfocusable,u.classList.add("underlined"),"boolean"!==e.dataType&&(u.placeholder=n.editorPlaceholder),n.editorCallback&&n.editorCallback(u,e),r.appendChild(c),r.appendChild(u),o.appendChild(r),o.className="smart-grid-panel-item",n._items.push(o),o.dataType=e.dataType,o}_localize(e){const t=this;t.$.addFilterButton.innerHTML=t.localize("addFilter"),t.$.buttonsContainer.firstElementChild.innerHTML=t.localize("cancel"),t.$.buttonsContainer.children[1].innerHTML=t.localize("apply"),t.$.itemsContainer.setAttribute("no-filters",t.localize("noFilters")),t._stringConditions=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("EMPTY")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("NOT_EMPTY")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("CONTAINS")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("DOES_NOT_CONTAIN")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("STARTS_WITH")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("ENDS_WITH")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._enumConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")}],t._dateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TOMORROW",label:t.localize("TOMORROW")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TODAY",label:t.localize("TODAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"YESTERDAY",label:t.localize("YESTERDAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_WEEK",label:t.localize("NEXT_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_WEEK",label:t.localize("THIS_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_WEEK",label:t.localize("LAST_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_MONTH",label:t.localize("NEXT_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_MONTH",label:t.localize("THIS_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_MONTH",label:t.localize("LAST_MONTH")}],t._numberAndDateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._booleanConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],e&&t._items.forEach(((e,a)=>{const l=e.children[1],n=e.children[3];0===a?l.innerHTML=t.localize("where"):1===a?(l.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],l.value=t.localize(t.operator)):l.innerHTML=t.localize(t.operator),"string"!==e.dataType||e.options?"enum"===e.dataType||e.options?n.dataSource=t._enumConditions:"boolean"===e.dataType?n.dataSource=t._booleanConditions:"date"===e.dataType?n.dataSource=t._dateConditions:n.dataSource=t._numberAndDateConditions:n.dataSource=t._stringConditions,n.value=n.condition?t.localize(n.condition):""}))}_setFocusable(e){const t=this,a=t.disabled||t.unfocusable?-1:0;if(t.$.addFilterButton.tabIndex=a,t.$.buttonsContainer.firstElementChild.tabIndex=a,t.$.buttonsContainer.children[1].tabIndex=a,e){const e=Array.from(t.$.itemsContainer.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(t.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input"));e.forEach((e=>e.tabIndex=a)),l.forEach((e=>e.unfocusable=t.disabled||t.unfocusable))}}}),Smart("smart-column-panel",class extends Smart.BaseElement{static get properties(){return{dataSource:{value:[],type:"array",reflectToAttribute:!1},messages:{value:{en:{apply:"Ok",cancel:"Cancel",find:"Find a field",reset:"Reset",noResults:"No results"}},type:"object",extend:!0}}}static get listeners(){return{click:"_interactionHandler",keydown:"_interactionHandler","find.keyup":"_findKeyupHandler","sortable.dragEnd":"_sortableDragEndHandler"}}static get requires(){return{"Smart.Sortable":"smart.sortable.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div class="smart-column-panel-find-container" role="search">\n <input id="find" readonly="[[readonly]]" role="searchbox" aria-label="Find a field"></input>\n <span id="clearButton" class="clear-button smart-hidden" role="button" aria-label="Clear"></span>\n </div>\n <smart-sortable id="sortable" disable-mode="manual" right-to-left="[[rightToLeft]]" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <span id="reset" class="smart-grid-panel-reset-button" role="button"></span>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),e._positionChanged=!1,e._localize(),e._moves=[],e._createSortItems(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"disabled":case"unfocusable":l._setFocusable();break;case"dataSource":{const e=l.$.sortable.$.container;for(;e.firstChild;)e.removeChild(e.firstChild);l._createSortItems(),l._positionChanged=!1,l.$.find.value="",l._findKeyupHandler(),l.$.clearButton.classList.add("smart-hidden");break}case"locale":case"messages":l._localize()}}_createSortItems(){const e=this,t=document.createDocumentFragment();e._HTMLToSourceMap=new Map,e.dataSource.forEach((a=>t.appendChild(e._createSortItem(a)))),e.$.sortable.$.container.appendChild(t),e.$.sortable.updateItems(),e._setFocusable()}_createSortItem(e){const t=document.createElement("div"),a=this.id+"Label"+e.dataField;return this._HTMLToSourceMap.set(t,e),t.className="smart-grid-panel-item",t.innerHTML=`<div class="toggle-visibility${!1!==e.visible?"":" hidden"}${e.disableToggle?" disable-toggle":""}" role="button" aria-controls="${a}" aria-label="Toggle visibility"></div>\n<span id="${a}" class="smart-column-panel-label smart-unselectable${e.icon?" icon "+e.icon:""}">${e.label}</span>`,1===e.level?t.classList.add("indent"):0===e.level&&t.classList.add("group"),e.disableDrag&&t.setAttribute("disable-drag",""),e.dataField&&t.setAttribute("data-field",e.dataField),e.parentDataField&&t.setAttribute("parent-data-field",e.parentDataField),!1!==e.allowHide&&!0!==e.disableToggle||(t.style.pointerEvents="none",t.setAttribute("disabled",""),t.style.opacity=.8),t}_interactionHandler(e){const t=this;if(t.disabled||t.readonly||"keydown"===e.type&&-1===[" ","Enter"].indexOf(e.key))return;const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a.classList.contains("toggle-visibility")){a.classList.toggle("hidden");const e=a.closest(".smart-grid-panel-item");if(e.hasAttribute("data-field")){const l=e.getAttribute("data-field");if(e.hasAttribute("parent-data-field")||e.hasAttribute("disabled")){const a=e.getAttribute("parent-data-field"),l=t.$.sortable.querySelectorAll(".smart-grid-panel-item");let n=null;if(l.forEach((e=>{e.getAttribute("data-field")===a&&(n=e)})),n){let e=0,t=0;l.forEach((l=>{l.getAttribute("parent-data-field")===a&&(e++,l.firstElementChild.classList.contains("hidden")&&t++)})),t===e?n.firstElementChild.classList.add("hidden"):t<e&&n.firstElementChild.classList.remove("hidden")}}else t.$.sortable._items.forEach((e=>{if(e.hasAttribute("parent-data-field")&&!e.hasAttribute("disabled")){const t=e.getAttribute("parent-data-field"),n=e.firstElementChild;t===l&&(a.classList.contains("hidden")?n.classList.add("hidden"):n.classList.remove("hidden"))}}))}}else if(a.parentElement===t.$.buttonsContainer){if(a===t.$.buttonsContainer.firstElementChild)return t.$.fireEvent("cancel"),void(t._moves=[]);if(a===t.$.buttonsContainer.children[1]){const e=[];Array.from(t.$.sortable.$.container.children).forEach((a=>{const l=Object.assign({},t._HTMLToSourceMap.get(a));l.visible=!a.firstElementChild.classList.contains("hidden"),e.push(l)})),t.$.fireEvent("apply",{value:e,positionChanged:t._positionChanged,moves:t._moves}),t._positionChanged=!1,t._moves=[]}}else if(a===t.$.reset){const e=[];Array.from(t.$.sortable.$.container.children).forEach((a=>{const l=Object.assign({},t._HTMLToSourceMap.get(a));l.visible=!0,e.push(l)})),t.$.fireEvent("apply",{value:e,positionChanged:t._positionChanged,moves:t._moves}),t._positionChanged=!1,t._moves=[]}else a.classList.contains("clear-button")&&(t.$.find.value="",t._findKeyupHandler())}_findKeyupHandler(){const e=this;if(e.disabled||e.readonly)return;const t=e.$.find,a=t.value,l=[...e.$.sortable.$.container.children];if(void 0===e._disabledSortable&&(e._disabledSortable=e.$.sortable.disabled),""===a)return t.parentElement.classList.remove("no-results"),e.$.clearButton.classList.add("smart-hidden"),l.forEach((e=>e.classList.remove("smart-hidden"))),e.$.sortable.disabled=e._disabledSortable||e.readonly,void delete e._disabledSortable;let n=!0;e.$.clearButton.classList.remove("smart-hidden"),l.forEach((t=>{-1===e._HTMLToSourceMap.get(t).label.toLowerCase().indexOf(a.toLowerCase())?t.classList.add("smart-hidden"):(t.classList.remove("smart-hidden"),n=!1)})),e.$.sortable.disabled=n,n?t.parentElement.classList.add("no-results"):t.parentElement.classList.remove("no-results")}_sortableDragEndHandler(e){const t=e.detail;this._positionChanged=!0,this._moves.push({oldIndex:t.oldIndex,newIndex:t.newIndex})}_localize(){const e=this;e.$.find.placeholder=e.localize("find"),e.$.reset.innerHTML=e.localize("reset"),e.$.buttonsContainer.firstElementChild.innerHTML=e.localize("cancel"),e.$.buttonsContainer.children[1].innerHTML=e.localize("apply"),e.$.container.firstElementChild.setAttribute("no-results",e.localize("noResults"))}_setFocusable(){const e=this,t=e.disabled||e.unfocusable?-1:0,a=Array.from(e.$.sortable.getElementsByClassName("toggle-visibility"));e.$.find.tabIndex=t,e.$.clearButton.tabIndex=t,e.$.buttonsContainer.firstElementChild.tabIndex=t,e.$.buttonsContainer.children[1].tabIndex=t,a.forEach((e=>e.tabIndex=e.classList.contains("disable-toggle")?-1:t))}}),Smart("smart-formatting-panel",class extends Smart.BaseElement{static get properties(){return{columns:{value:[],type:"array",reflectToAttribute:!1},dataSource:{value:[],type:"any",reflectToAttribute:!1},items:{value:null,type:"array?",reflectToAttribute:!1},dropDownAppendTo:{value:null,type:"any",reflectToAttribute:!1},messages:{value:{en:{add:"Add condition",all:"All columns",apply:"Ok",between:"Between",cancel:"Cancel",close:"Close",column:"Column:",condition:"Condition:",equal:"Equal To",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"Greater Than",highlight:"Highlight",lessThan:"Less Than",notEqual:"Not Equal To",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:"}},type:"object",extend:!0}}}static get listeners(){return{click:"_interactionHandler",keydown:"_interactionHandler",change:"_changeHandler","popup.change":"_changeHandler","popup.click":"_interactionHandler","popup.keydown":"_interactionHandler","document.down":"_documentDownHandler"}}template(){return'<div id="container" role="presentation">\n <div id="itemsContainer" class="smart-formatting-panel-items-container" role="presentation"></div>\n <div id="addNewButton" class="smart-add-new-button" role="button" aria-label="Add new condition"></div>\n <div id="popup" class="smart-formatting-panel-popup smart-hidden smart-visibility-hidden" role="dialog">\n <div id="popupHeader" class="header" role="presentation">\n <div id="text" class="selected" role="button" aria-label="Text color"></div>\n <div id="highlight" role="button" aria-label="Highlight color"></div>\n </div>\n <div id="colorCode" class="color-code"></div>\n <input id="colorInput" type="color" />\n <div id="colorsContainer" class="colors-container"></div>\n <smart-button id="apply" class="ok primary" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n <smart-button id="cancel" class="cancel" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n </div>\n </div>'}render(){const e=this,t=getComputedStyle(e);e.setAttribute("role","dialog"),e.$.popup.id=e.id+"Popup",e._basicColors=[[0,0,0],[68,68,68],[102,102,102],[153,153,153],[204,204,204],[238,238,238],[243,243,243],[255,255,255],[255,0,0],[255,153,0],[255,255,0],[0,255,0],[0,255,255],[0,0,255],[153,0,255],[255,0,255],[244,204,204],[252,229,205],[255,242,204],[217,234,211],[208,224,227],[207,226,243],[217,210,233],[234,209,220],[234,153,153],[249,203,156],[255,229,153],[182,215,168],[162,196,201],[159,197,232],[180,167,214],[213,166,189],[224,102,102],[246,178,107],[255,217,102],[147,196,125],[118,165,175],[111,168,220],[142,124,195],[194,123,160],[204,0,0],[230,145,56],[241,194,50],[106,168,79],[69,129,142],[61,133,198],[103,78,167],[166,77,121],[153,0,0],[180,95,6],[191,144,0],[56,118,29],[19,79,92],[11,83,148],[53,28,117],[116,27,71],[102,0,0],[120,63,4],[127,96,0],[39,78,19],[12,52,61],[7,55,99],[32,18,77],[76,17,48]],e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)},t.fontFamily.indexOf("-apple")>=0&&(e._defaults.fontFamily="Segoe UI"),e._localize(),e._setFocusable(),e._populatePopupWithColors(),e._processColumnsAndDataSource(),e._addDefaultItems(),super.render()}attached(){const e=this;super.attached(),e.isCompleted&&e._addDefaultItemsOnAttach&&e._addDefaultItems()}add(e,t){const a=this;if(e&&e.column&&"all"!==e.column&&!a.columns.find((t=>t.dataField===e.column)))return void a.items.splice(t,1);const l=document.createElement("div"),n=a._defaults,i=` animation="${a.animation}"${a.rightToLeft?" right-to-left":""} theme="${a.theme}"${a.unfocusable?" unfocusable":""}`,o=a.disabled||a.unfocusable?"":' tabindex="0"';e=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:n.fontFamily,fontSize:n.fontSize,text:n.text,highlight:n.highlight},e);const r=`\n<div class="value-label">${a.localize("value")}</div>\n<smart-input class="columns-input underlined" data-source='${JSON.stringify(a._columnsInputDataSource)}' placeholder="${a.localize("column")}" readonly value="${a._columnsInputDataSource.find((t=>t.value===e.column)).label}"${i}></smart-input>\n<smart-input class="condition-input underlined" data-source='${a._conditionsDataSource}' placeholder="${a.localize("condition")}" readonly value="${a.localize(e.condition)}"${i}></smart-input>\n<smart-input class="first-value underlined" type="number" placeholder="${a.localize("value")}" value="${e.firstValue}"${i}></smart-input>\n<div class="ampersand">&</div>\n<smart-input class="second-value underlined" type="number" placeholder="${a.localize("secondValue")}" value="${e.secondValue}"${i}></smart-input>\n<div class="close-button" title="${a.localize("close")}"${o} role="button" aria-label="Close"></div>\n<div class="format-label">${a.localize("format")}</div>\n<smart-input class="font-family-input underlined" drop-down-height="auto" placeholder="${a.localize("fontFamily")}" readonly${i}></smart-input>\n<smart-input class="font-size-input underlined" data-source='["8px", "9px", "10px", "11px", "12px", "13px", "14px", "15px", "16px"]' drop-down-height="auto" placeholder="${a.localize("fontSize")}" readonly value="${e.fontSize}"${i}></smart-input>\n<div class="popup-button smart-unselectable"${o} role="button" aria-haspopup="dialog" aria-label="Toggle pop-up">A</div>\n<div class="preview smart-unselectable">2.71828</div>`;l.classList.add("smart-formatting-panel-item"),l.classList.toggle("between","between"===e.condition),l.innerHTML=r,l.columnsInput=l.querySelector(".columns-input"),l.conditionInput=l.querySelector(".condition-input"),l.firstValue=l.querySelector(".first-value"),l.secondValue=l.querySelector(".second-value"),l.closeButton=l.querySelector(".close-button"),l.fontFamilyInput=l.querySelector(".font-family-input"),l.fontFamilyInput.dataSource=[n.fontFamily,"Arial","Verdana","Courier New","Georgia","Times New Roman"],l.fontFamilyInput.value=e.fontFamily,l.fontSizeInput=l.querySelector(".font-size-input"),l.popupButton=l.querySelector(".popup-button"),l.fontFamilyInput=l.querySelector(".font-family-input"),l.preview=l.querySelector(".preview"),l.popupButton.style.color=e.text,l.popupButton.style.backgroundColor=e.highlight,l.preview.style.fontFamily=e.fontFamily,l.preview.style.fontSize=e.fontSize,l.preview.style.color=e.text,l.preview.style.backgroundColor=e.highlight,l.data=e,a.$.itemsContainer.appendChild(l),l.columnsInput.$.input.value||(l.columnsInput.$.input.dataValue="all"),l.conditionInput.$.input.dataValue=e.condition,a._checkScrollBar()}apply(){const e=this,t=new Smart.Utilities.ConditionalFormatter(e.dataSource),a=Array.from(e.$.itemsContainer.children),l=[];let n;if(0===a.length)return;if(e.ownerElement&&"smart-pivot-table"===e.ownerElement.nodeName.toLowerCase()){const t=e.ownerElement._dynamicColumns;n=function(e){return"all"===e?t.map((e=>e.id)):t.filter((t=>t.dataFields[t.dataFields.length-1].dataField===e)).map((e=>e.id))}}else n=function(t){return"all"===t?e._columns.map((e=>e.value)):[t]};for(let e=0;e<a.length;e++){const i=a[e].data,o=n(i.column),r=i.condition;t.color=i.highlight,t.comparator=i.firstValue,t.min=i.firstValue,t.max=i.secondValue;const s=t.format(r,o);for(let e in s){const t=s[e];for(let e in t){const a=t[e];a.color=i.text,a.fontFamily=i.fontFamily,a.fontSize=i.fontSize}}l.push(s)}if(0===l.length)return l[0];const i={};for(let e=0;e<l.length;e++){const t=l[e];for(let e in t){const a=t[e];i[e]||(i[e]={});for(let t in a)i[e][t]=Object.assign({},i[e][t],a[t])}}return i}getItems(){return Array.from(this.$.itemsContainer.children).map((e=>e.data))}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":if(Array.from(l.$.itemsContainer.querySelectorAll(".smart-element")).forEach((t=>t[e]=a)),null!==l.dropDownAppendTo&&(l.$.apply[e]=a,l.$.cancel[e]=a),"theme"===e){const e=getComputedStyle(l);l._defaults.text=l._toHex(e.color),l._defaults.highlight=l._toHex(e.backgroundColor)}break;case"columns":case"items":"columns"===e&&(l._processColumnsAndDataSource(),l.items=null),l.$.itemsContainer.innerHTML="",l._addDefaultItems();break;case"disabled":case"unfocusable":{const t=l.disabled||l.unfocusable,n=Array.from(l.$.itemsContainer.querySelectorAll(".close-button, .popup-button"));"disabled"===e?l._closePopup():null!==l.dropDownAppendTo&&(l.$.apply.unfocusable=a,l.$.cancel.unfocusable=a),l._setFocusable(),Array.from(l.$.itemsContainer.querySelectorAll(".smart-element")).forEach((e=>e.unfocusable=t)),t?n.forEach((e=>e.removeAttribute("tabindex"))):n.forEach((e=>e.setAttribute("tabindex",0)));break}case"dataSource":Smart.DataAdapter&&a instanceof Smart.DataAdapter&&(l.dataSource=a.toArray());break;case"locale":case"messages":l.items=l.getItems(),l.$.itemsContainer.innerHTML="",l._localize(),l._columnsInputDataSource=JSON.parse(JSON.stringify(l._columns.concat([{label:l.localize("all"),value:"all"}]))),l._addDefaultItems()}}_populatePopupWithColors(){const e=this,t=e._basicColors,a=document.createDocumentFragment();for(let l=0;l<t.length;l++){const n=document.createElement("div"),i=t[l],o=`rgb(${i[0]}, ${i[1]}, ${i[2]})`,r=e._toHex(o);n.setAttribute("role","button"),n.setAttribute("aria-label","Select color "+r),n.index=l,n.value=r,n.style.backgroundColor=o,a.appendChild(n)}e.$.colorsContainer.appendChild(a)}_processColumnsAndDataSource(){const e=this,t=e.columns,a=e.dataSource,l=[];Smart.DataAdapter&&a instanceof Smart.DataAdapter&&(e.dataSource=a.toArray());for(let e=0;e<t.length;e++){const a=t[e];"number"===a.dataType&&l.push({label:a.label,value:a.dataField})}e._columns=l,e._columnsInputDataSource=JSON.parse(JSON.stringify(l.concat([{label:e.localize("all"),value:"all"}])))}_addDefaultItems(){const e=this,t=e.items,a=e.getRootNode();a===document||document.body.contains(a)?(t&&t.length>0?t.forEach(((t,a)=>e.add(t,a))):(e.add({condition:"greaterThan",firstValue:100}),e.add({condition:"lessThan",firstValue:0})),delete e._addDefaultItemsOnAttach):e._addDefaultItemsOnAttach=!0}_changeHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-formatting-panel-item");if(l)if(a!==l.columnsInput){if(a===l.conditionInput)return l.data.condition=a.$.input.dataValue,void l.classList.toggle("between","between"===a.$.input.dataValue);if(l.firstValue.contains(a))l.data.firstValue=parseFloat(a.value);else{if(!l.secondValue.contains(a))return a===l.fontFamilyInput?(l.data.fontFamily=a.value,void(l.preview.style.fontFamily=a.value)):void(a===l.fontSizeInput&&(l.data.fontSize=a.value,l.preview.style.fontSize=a.value));l.data.secondValue=parseFloat(a.value)}}else l.data.column=a.$.input.dataValue;else t.$.popup.contains(a)&&t._updateUI(a.value.toUpperCase())}_checkScrollBar(){this.classList.toggle("scroll",this.$.itemsContainer.offsetHeight<this.$.itemsContainer.scrollHeight)}_interactionHandler(e){const t=this;if(!t.dropDownAppendTo&&e.currentTarget===t.$.popup)return;if("keydown"===e.type){if(-1===[" ","Enter"].indexOf(e.key))return void(t.disabled||t.readonly||t._keydownHandler(e));e.preventDefault()}const a=t.isInShadowDOM?e.composedPath()[0]:e.target;if(a===t.$.addNewButton)return void t.add();const l=a.closest(".smart-formatting-panel-item");if(l)return void(a===l.closeButton?(l.remove(),this._checkScrollBar()):a===l.popupButton&&(t._togglePopup(l),t._activePopupButton=a));const n=t.$.popup;if(n.contains(a)){if(a.parentElement===t.$.colorsContainer)return void t._updateUI(a.value);if(a.parentElement===t.$.popupHeader)a.classList.add("selected"),a===t.$.text?(n.selection="currentText",t.$.highlight.classList.remove("selected")):(n.selection="currentHighlight",t.$.text.classList.remove("selected")),t._updateUI(n[n.selection]);else if(a.classList.contains("smart-button")){if(t.$.apply.contains(a)||a&&a.ownerElement&&a.ownerElement.classList.contains("ok")){const e=n.item;e.data.text=n.currentText,e.data.highlight=n.currentHighlight,e.popupButton.style.color=n.currentText,e.popupButton.style.backgroundColor=n.currentHighlight,e.preview.style.color=n.currentText,e.preview.style.backgroundColor=n.currentHighlight}t._closePopup()}}}_keydownHandler(e){const t=this,a=e.key;if(-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Escape","Home","PageDown","PageUp"].indexOf(a))return;if(e.preventDefault(),"Escape"===a&&!t.$.popup.classList.contains("smart-hidden"))return void t._closePopup();if(t.getRootNode().activeElement!==t.$.colorsContainer)return;const l=Array.from(this.$.colorsContainer.children),n=this.$.colorsContainer.querySelector(".selected");let i,o="ArrowRight",r="ArrowLeft";if(t.rightToLeft&&(o="ArrowLeft",r="ArrowRight"),n){let e=n.index;switch(a){case r:e=Math.max(e-1,e-e%8);break;case o:e=Math.min(e+1,e+8-e%8-1);break;case"ArrowUp":e=Math.max(e-8,e%8);break;case"ArrowDown":e=Math.min(e+8,56+e%8);break;case"Home":e-=e%8;break;case"End":e=e+8-e%8-1;break;case"PageUp":e%=8;break;case"PageDown":e=56+e%8}i=l[e]}else i=l[0];t._updateUI(i.value,i)}_togglePopup(e){const t=this,a=t.$.popup;if(e===a.item)return void t._closePopup();if(a.setAttribute("animation",t.animation),a.setAttribute("theme",t.theme),t.rightToLeft&&a.setAttribute("right-to-left",""),a.classList.contains("smart-hidden")&&a.classList.remove("smart-hidden"),t.dropDownAppendTo)if("body"===t.dropDownAppendTo)document.body.appendChild(a);else{const e=document.querySelector(t.dropDownAppendTo);e&&e.appendChild(a)}const l=e.popupButton,n=l.getBoundingClientRect(),i=l.offsetLeft,o=l.offsetTop,r=a.offsetWidth,s=a.offsetHeight,d=t.$.itemsContainer.scrollTop,c=t._toHex(e.data.text),p=t._toHex(e.data.highlight);n.top>=s+5?a.style.top=o-(s+d+5)+"px":a.style.top=o+n.height-d+5+"px",a.style.left=i+n.width/2-r/2+"px",t.dropDownAppendTo&&(a.style.top=n.bottom+5+"px",a.style.left=n.left+n.width/2-r/2+"px"),t.$.text.classList.add("selected"),t.$.highlight.classList.remove("selected"),t.$.text.focus(),a.item=e,a.selection="currentText",a.currentText=c,a.currentHighlight=p,t._updateUI(c),a.controlledBy&&(a.controlledBy.removeAttribute("aria-controls"),a.controlledBy.removeAttribute("aria-expanded")),l.setAttribute("aria-controls",a.id),l.setAttribute("aria-expanded",!0),a.controlledBy=l,a.classList.remove("smart-visibility-hidden")}_closePopup(){const e=this,t=e.$.popup;"none"!==e.animation?(t.addEventListener("transitionend",(function e(){t.classList.add("smart-hidden"),t.removeEventListener("transitionend",e)})),t.classList.add("smart-visibility-hidden")):(t.classList.add("smart-visibility-hidden"),t.classList.add("smart-hidden")),delete t.item,e._activePopupButton&&e._activePopupButton.focus(),t.controlledBy&&(t.controlledBy.removeAttribute("aria-controls"),t.controlledBy.removeAttribute("aria-expanded"))}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_updateUI(e,t){const a=this;a.$.colorInput.value=e,a.$.colorCode.innerHTML=e,a._selectColor(e,t)}_selectColor(e,t){const a=this.$.popup,l=Array.from(this.$.colorsContainer.children);l.forEach((e=>e.classList.remove("selected"))),(t=t||l.find((t=>t.value===e)))&&t.classList.add("selected"),a[a.selection]=e}_localize(){const e=this;e._conditionsDataSource=JSON.stringify([{label:e.localize("lessThan"),value:"lessThan"},{label:e.localize("greaterThan"),value:"greaterThan"},{label:e.localize("equal"),value:"equal"},{label:e.localize("notEqual"),value:"notEqual"},{label:e.localize("between"),value:"between"}]),e.$.text.innerHTML=e.localize("text"),e.$.highlight.innerHTML=e.localize("highlight"),e.$.apply.innerHTML=e.localize("apply"),e.$.cancel.innerHTML=e.localize("cancel"),e.$.addNewButton.title=e.localize("add")}_setFocusable(){const e=this,t=!e.disabled&&!e.unfocusable,a=[e.$.addNewButton,e.$.text,e.$.highlight,e.$.colorsContainer];t?(a.forEach((e=>e.setAttribute("tabindex",0))),e.$.colorInput.removeAttribute("tabindex")):(a.forEach((e=>e.removeAttribute("tabindex"))),e.$.colorInput.setAttribute("tabindex",-1))}_documentDownHandler(e){const t=this,a=t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target,l=t.$.popup;l.classList.contains("smart-hidden")||l.contains(a)||a.classList.contains("popup-button")||(delete t._activePopupButton,t._closePopup())}}),Smart("smart-data-view",class extends Smart.BaseElement{static get properties(){return{addNewButton:{value:!1,type:"boolean"},allowDrag:{value:!1,type:"boolean"},collapsible:{value:!1,type:"boolean"},columns:{value:[],type:"object",reflectToAttribute:!1},dataSource:{value:null,type:"object?",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},editable:{value:!1,type:"boolean"},headerPosition:{value:"none",allowedValues:["none","top","bottom"],type:"string"},messages:{value:{en:{addFilter:"+ Add filter",and:"And",apply:"Ok",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Customize Columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",sort:"Sort",group:"Group",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",formatColumn:"Format Column",formating:"Conditional Formating",sortedByMultiple:"Sorted by {{n}} fields",sortedByOne:"Sorted by 1 field",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",firstByGroup:"Group by",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"Equal To",greaterThan:"Greater Than",highlight:"Highlight",lessThan:"Less Than",notEqual:"Not Equal To",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",reset:"Reset"}}}}}static get listeners(){return{"header.apply":"_applyHandler","header.cancel":"closePanel","headerDropDown.transitionend":"_headerDropDownTransitionendHandler","searchInput.keyup":"_searchInputKeyupHandler",resize:"_resizeHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler"}}render(){const e=this;e.$.headerDropDown.id||(e.$.headerDropDown.id=e.id+"HeaderDropDown"),e.setAttribute("role","group"),e._isMobile=Smart.Utilities.Core.isMobile,super.render()}addFilter(e,t="and"){const a=this;if(!Array.isArray(e)||e.length>0&&!Array.isArray(e[0]))return;let l;a.closePanel(),arguments[2]?l={filters:arguments[2],operator:t}:(l={filters:[],operator:t},e.forEach((e=>{e[1].filters.forEach((t=>{l.filters.push([e[0],t.condition,t.value])}))}))),JSON.stringify(l)!==JSON.stringify(a._appliedFiltering)&&(l.filterGroups=e,a._appliedFiltering=l,a._applyFilter(e,t),a.$.fireEvent("filter"),a._refreshFilterButton())}_refreshFilterButton(){const e=this,t=e._appliedFiltering.filters?e._appliedFiltering.filters.length:0;if(0===t)return e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"),void e.$.filterButton.classList.remove("filtered");e.$.filterButton.firstElementChild.innerHTML=1===t?e.localize("filteredByOne"):e.localize("filteredByMultiple",{n:t}),e.$.filterButton.classList.add("filtered")}addSort(e,t){const a=this,l=a.dataSource,n=JSON.stringify(a._appliedSorting);let i;function o(e,n){if(a.columns.find((t=>t.dataField===e))){let a=Array.isArray(t)?t[n]:"string"==typeof t?t:"ascending";i.dataFields.push(e),i.dataTypes.push(l.dataFields.find((t=>t.name===e)).dataType),a=a&&-1!==a.indexOf("desc")?"descending":"ascending",i.orderBy.push(a)}}if(0!==arguments.length&&l&&0!==l.length){if(a.closePanel(),1===arguments.length&&"object"==typeof e)i=e;else if(i={dataFields:[],dataTypes:[],orderBy:[]},Array.isArray(e))e.forEach(o);else{if("string"!=typeof e)return;o(e,0)}a.closePanel(),a._appliedSorting=i,n!==JSON.stringify(a._appliedSorting)&&(a._applySort(),a.$.fireEvent("sort"),a._refreshSortButton())}}_refreshSortButton(){const e=this,t=e._appliedSorting.dataFields.length;return 0===t||e.grid&&!1===e.grid.sorting.maintainSort?(e.$.sortButton.firstElementChild.innerHTML=e.localize("sort"),void e.$.sortButton.classList.remove("sorted")):(e.$.sortButton.firstElementChild.innerHTML=1===t?e.localize("sortedByOne"):e.localize("sortedByMultiple",{n:t}),void e.$.sortButton.classList.add("sorted"))}closePanel(){const e=this.$.headerDropDown;e.classList.remove("open"),setTimeout((()=>{e.classList.add("smart-visibility-hidden")}),150),this._closeSearchPanel(),e.controlledBy&&(e.controlledBy.removeAttribute("aria-controls"),e.controlledBy.setAttribute("aria-expanded",!1),delete e.controlledBy)}_closeSearchPanel(){const e=this;e._searchInfo&&delete e._searchInfo}_closeDialog(){const e=this;e._editInfo&&e._editInfo.window.close()}openFormatPanel(){}openFilterPanel(e,t){const a=this,l=a.dataSource;if(!l||0===l.length&&!l.virtualDataSource||a.disabled||"none"===a.headerPosition)return;let n;a._editInfo&&a._editInfo.window.close(),a.$.headerDropDown.classList.add("filter-panel"),a.$.headerDropDown.classList.remove("customize-panel","colors-panel","sort-panel","search-panel","format-panel"),a.$.filter.classList.remove("smart-hidden"),a.$.customize.classList.add("smart-hidden"),a.$.sort.classList.add("smart-hidden"),a.$.colors.classList.add("smart-hidden"),a.$.format&&a.$.format.classList.add("smart-hidden"),a.$.group&&a.$.group.classList.add("smart-hidden"),a.$.search.classList.add("smart-hidden"),a._closeSearchPanel(),a._filterPartCreated?(n=a.$.filter.firstElementChild,n.set("dataSource",e),n.set("locale",a.locale),n.messages=a._innerElementMessages.multiColumnFilterPanel,n.operator=a._appliedFiltering.operator,n.editorPlaceholder=a.localize("filterValuePlaceholder"),n.set("operator",a._appliedFiltering.operator),n.set("value",a._appliedFiltering.filters),n._applyValue(),n.rightToLeft=a.rightToLeft):(n=document.createElement("smart-multi-column-filter-panel"),n.rightToLeft=a.rightToLeft,n.animation=a.animation,n.dataSource=e,n.locale=a.locale,n.messages=a._innerElementMessages.multiColumnFilterPanel,n.operator=a._appliedFiltering.operator,n.editorPlaceholder=a.localize("filterValuePlaceholder"),n.theme=a.theme,n.value=a._appliedFiltering.filters,n.editorCallback=t,a.$.filter.appendChild(n),a._filterPartCreated=!0),a._openHeaderDropDown(a.$.filterButton)}openColorsPanel(e,t,a){const l=this,n=l.dataSource;if(!n||0===n.length&&!n.virtualDataSource||l.disabled||"none"===l.headerPosition)return;let i;l._editInfo&&l._editInfo.window.close(),l.$.headerDropDown.classList.add("colors-panel"),l.$.headerDropDown.classList.remove("filter-panel","group-panel","customize-panel","sort-panel","search-panel","format-panel"),l.$.colors.classList.remove("smart-hidden"),l.$.customize.classList.add("smart-hidden"),l.$.filter.classList.add("smart-hidden"),l.$.sort.classList.add("smart-hidden"),l.$.filter&&l.$.filter.classList.add("smart-hidden"),l.$.group&&l.$.group.classList.add("smart-hidden"),l.$.search.classList.add("smart-hidden"),l._closeSearchPanel(),l._colorsPartCreated?(i=l.$.colors.firstElementChild,i.set("dataSource",e),i.set("locale",l.locale),i.messages=l._innerElementMessages.multiColumnFilterPanel,i.operator="or",i.editorPlaceholder=l.localize("filterValuePlaceholder"),i.set("operator","or"),l._appliedColors||(l._appliedColors=[]),i.set("value",l._appliedColors),i._applyValue(),i.rightToLeft=l.rightToLeft):(i=document.createElement("smart-colors-panel"),i.rightToLeft=l.rightToLeft,i.animation=l.animation,i.dataSource=e,i.locale=l.locale,i.messages=l._innerElementMessages.multiColumnFilterPanel,i.operator="or",i.editorPlaceholder=l.localize("filterValuePlaceholder"),i.theme=l.theme,i.editorCallback=t,i.ownerElement=a,l.$.colors.appendChild(i),l._colorsPartCreated=!0),l._openHeaderDropDown(l.$.colorsButton)}openSortPanel(e){const t=this,a=t.dataSource;if(!a||0===a.length&&!a.virtualDataSource||t.disabled||"none"===t.headerPosition)return;let l;t._closeDialog(),t.$.headerDropDown.classList.add("sort-panel"),t.$.headerDropDown.classList.remove("customize-panel","filter-panel","format-panel","search-panel"),t.$.sort.classList.remove("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.colors.classList.add("smart-hidden"),t.$.format&&t.$.format.classList.add("smart-hidden"),t.$.group&&t.$.group.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t._closeSearchPanel(),t._sortPartCreated?(l=t.$.sort.firstElementChild,l.rightToLeft=t.rightToLeft,l.dataSource=e,l.locale=t.locale,l.messages=t._innerElementMessages.sortPanel,l.set("dataSource",e),l.propertyChangedHandler("dataSource",void 0,e)):(l=document.createElement("smart-sort-panel"),l.rightToLeft=t.rightToLeft,l.animation=t.animation,l.dataSource=e,l.locale=t.locale,l.messages=t._innerElementMessages.sortPanel,l.theme=t.theme,t.$.sort.appendChild(l),t._sortPartCreated=!0),t._openHeaderDropDown(t.$.sortButton)}removeFilter(){this.addFilter([])}removeSort(){this.addSort({dataFields:[],dataTypes:[],orderBy:[]})}_clearFilterAndSortUI(){const e=this;e._appliedFiltering={filterGroups:[],filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._appliedGrouping={dataFields:[]},e._appliedColors=[[],{type:"conditions",decorate:"border",singleSelect:""}],e.$.filterButton.classList.remove("filtered"),e.$.sortButton.classList.remove("sorted"),e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"),e.$.sortButton.firstElementChild.innerHTML=e.localize("sort")}_getInnerElementMessages(){const e=this,t=e.locale,a={columnPanel:{},groupPanel:{},multiColumnFilterPanel:{},sortPanel:{},formattingPanel:{},dateTimePicker:{}};a.formattingPanel[t]={add:e.localize("add"),all:e.localize("all"),apply:e.localize("apply"),between:e.localize("between"),cancel:e.localize("cancel"),close:e.localize("close"),column:e.localize("column"),condition:e.localize("condition"),equal:e.localize("equal"),fontFamily:e.localize("fontFamily"),fontSize:e.localize("fontSize"),format:e.localize("format"),greaterThan:e.localize("greaterThan"),highlight:e.localize("highlight"),lessThan:e.localize("lessThan"),notEqual:e.localize("notEqual"),remove:e.localize("remove"),secondValue:e.localize("secondValue"),text:e.localize("text"),value:e.localize("value")},a.columnPanel[t]={apply:e.localize("apply"),cancel:e.localize("cancel"),reset:e.localize("reset"),find:e.localize("find"),noResults:e.localize("noResults")},a.groupPanel[t]={apply:e.localize("apply"),cancel:e.localize("cancel"),collapseAll:e.localize("collapseAll"),expandAll:e.localize("expandAll"),firstBy:e.localize("firstByGroup"),noGrouping:e.localize("noGrouping"),pickAnother:e.localize("pickAnotherGroupBy"),stringFirst:e.localize("stringFirst"),stringLast:e.localize("stringLast"),thenBy:e.localize("thenBy"),from:e.localize("from"),booleanFirst:e.localize("booleanFirst"),booleanLast:e.localize("booleanLast"),dateFirst:e.localize("dateFirst"),dateLast:e.localize("dateLast"),numberFirst:e.localize("numberFirst"),numberLast:e.localize("numberLast")},a.multiColumnFilterPanel[t]={addFilter:e.localize("addFilter"),noResults:e.localize("noResults"),add:"+ "+e.localize("add"),select:e.localize("dialogAddColumnTypeSelect"),condition:e.localize("conditions"),and:e.localize("and"),apply:e.localize("apply"),cancel:e.localize("cancel"),CONTAINS:e.localize("CONTAINS"),CONTAINS_CASE_SENSITIVE:e.localize("CONTAINS_CASE_SENSITIVE"),DOES_NOT_CONTAIN:e.localize("DOES_NOT_CONTAIN"),DOES_NOT_CONTAIN_CASE_SENSITIVE:e.localize("DOES_NOT_CONTAIN_CASE_SENSITIVE"),EMPTY:e.localize("EMPTY"),ENDS_WITH:e.localize("ENDS_WITH"),ENDS_WITH_CASE_SENSITIVE:e.localize("ENDS_WITH_CASE_SENSITIVE"),EQUAL:e.localize("EQUAL"),EQUAL_CASE_SENSITIVE:e.localize("EQUAL_CASE_SENSITIVE"),GREATER_THAN:e.localize("GREATER_THAN"),GREATER_THAN_OR_EQUAL:e.localize("GREATER_THAN_OR_EQUAL"),LESS_THAN:e.localize("LESS_THAN"),LESS_THAN_OR_EQUAL:e.localize("LESS_THAN_OR_EQUAL"),noFilters:e.localize("noFilters"),NOT_EMPTY:e.localize("NOT_EMPTY"),NOT_EQUAL:e.localize("NOT_EQUAL"),NOT_NULL:e.localize("NOT_NULL"),NULL:e.localize("NULL"),or:e.localize("or"),STARTS_WITH:e.localize("STARTS_WITH"),STARTS_WITH_CASE_SENSITIVE:e.localize("STARTS_WITH_CASE_SENSITIVE"),where:e.localize("where"),TOMORROW:e.localize("TOMORROW"),TODAY:e.localize("TODAY"),YESTERDAY:e.localize("YESTERDAY"),THIS_WEEK:e.localize("THIS_WEEK"),LAST_WEEK:e.localize("LAST_WEEK"),NEXT_WEEK:e.localize("NEXT_WEEK"),THIS_MONTH:e.localize("THIS_MONTH"),LAST_MONTH:e.localize("LAST_MONTH"),NEXT_MONTH:e.localize("NEXT_MONTH"),conditions:e.localize("conditions"),colorsSingleSelect:e.localize("colorsSingleSelect"),colorRows:e.localize("colorRows"),colorSelect:e.localize("colorSelect"),colorLeftBorderLabel:e.localize("colorLeftBorderLabel"),colorRowLabel:e.localize("colorRowLabel"),colorCellLabel:e.localize("colorCellLabel"),colorLeftBorder:e.localize("colorLeftBorder"),colorRow:e.localize("colorRow"),colorCell:e.localize("colorCell"),noOptions:e.localize("noOptions")},a.sortPanel[t]={apply:e.localize("apply"),applyOnce:e.localize("applyOnce"),booleanFirst:e.localize("booleanFirst"),booleanLast:e.localize("booleanLast"),cancel:e.localize("cancel"),dateFirst:e.localize("dateFirst"),dateLast:e.localize("dateLast"),firstBy:e.localize("firstBy"),from:e.localize("from"),numberFirst:e.localize("numberFirst"),numberLast:e.localize("numberLast"),noSorting:e.localize("noSorting"),pickAnother:e.localize("pickAnother"),maintainSort:e.localize("maintainSort"),stringFirst:e.localize("stringFirst"),stringLast:e.localize("stringLast"),thenBy:e.localize("thenBy")},a.dateTimePicker[t]={now:e.localize("now"),dateTabLabel:e.localize("dateTabLabel"),timeTabLabel:e.localize("timeTabLabel")},e._innerElementMessages=a}_handleHeaderPosition(e){const t=this,a=t.headerPosition,l=t.$.header;"none"!==a?(l.classList.remove("smart-hidden"),"top"===a&&l.nextElementSibling!==e?t.$.container.insertBefore(l,e):"bottom"===a&&l.previousElementSibling!==e&&t.$.container.insertBefore(l,t.$.loadingIndicatorContainer)):l.classList.add("smart-hidden")}_headerClickHandler(e){const t=this,a=t.$.headerDropDown;function l(e,l){a.classList.contains("smart-visibility-hidden")||e.classList.contains("smart-hidden")?t[l]():t.closePanel()}if(t.$.customizeButton.contains(e))l(t.$.customize,"openCustomizePanel");else if(t.$.filterButton.contains(e))l(t.$.filter,"openFilterPanel");else if(t.$.sortButton.contains(e))l(t.$.sort,"openSortPanel");else if(t.$.formatButton&&t.$.formatButton.contains(e))l(t.$.format,"openFormatPanel");else if(t.$.colorsButton&&t.$.colorsButton.contains(e))l(t.$.colors,"openColorsPanel");else if(e===t.$.searchButton)l(t.$.search,"_openSearchPanel");else if(t.$.groupButton&&t.$.groupButton.contains(e))l(t.$.group,"openGroupPanel");else if(t.$.viewStatesButton&&t.$.viewStatesButton.contains(e))l(t.$.view,"openViewPanel");else if(e===t.$.searchClose)t.$.searchInput.value="",t._search("",!1),t.closePanel();else if(e===t.$.searchPrev||e===t.$.searchNext){const a=t._searchInfo,l=a.foundIdsArray,n=e===t.$.searchNext,i=l.length;let o;if(void 0===a.highlighted)o=n?0:i-1;else{if(1===l.length)return;{const e=l.indexOf(a.highlighted);o=n?(e+1)%i:e-1>=0?e-1:i-1}}a.highlighted=l[o],t.grid?(t.grid.highlighted=a.highlighted,t.grid.ensureVisible(a.highlighted),t.grid._recycle(!1)):t.ensureVisible&&t.ensureVisible(a.highlighted),t.$.searchLabel.innerHTML=t.localize("found",{nth:o+1,n:l.length})}}_headerDropDownTransitionendHandler(e){const t=this,a=t.$.headerDropDown;t._openTimer=setTimeout((()=>{e&&("visibility"!==e.propertyName||a.classList.contains("smart-visibility-hidden"))||(a.classList.contains("search-panel")?t.$.searchInput.focus():!1===t.unfocusable&&(!t._isMobile&&a.classList.contains("customize-panel")?a.querySelector("smart-column-panel").$.find.focus():a.classList.contains("filter-panel")?a.querySelector("smart-multi-column-filter-panel").$.addFilterButton.focus():a.classList.contains("sort-panel")&&a.querySelector("smart-sort-panel").$.inputNotSorted.focus()))}),100)}_localizeHeader(){const e=this;e.$.customizeButton.firstElementChild.innerHTML=e.localize("customize"),e.$.groupButton&&(e.$.groupButton.firstElementChild.innerHTML=e.localize("group")),0===e._appliedFiltering.filters.length?e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"):1===e._appliedFiltering.filters.length?e.$.filterButton.firstElementChild.innerHTML=e.localize("filteredByOne"):e.$.filterButton.firstElementChild.innerHTML=e.localize("filteredByMultiple",{n:e._appliedFiltering.filters.length}),0===e._appliedSorting.dataFields.length?e.$.sortButton.firstElementChild.innerHTML=e.localize("sort"):1===e._appliedSorting.dataFields.length?e.$.sortButton.firstElementChild.innerHTML=e.localize("sortedByOne"):e.$.sortButton.firstElementChild.innerHTML=e.localize("sortedByMultiple",{n:e._appliedSorting.dataFields.length}),e.$.formatButton&&(e.$.formatButton.firstElementChild.innerHTML=e.localize("formating")),e.$.searchInput.placeholder=e.localize("findInView")}_openHeaderDropDown(e){const t=this,a=t.$.headerDropDown;"top"===t.headerPosition?(a.style.bottom=null,a.style.top="100%"):(a.style.top=null,a.style.bottom="100%"),e!==t.$.searchButton||e===t.$.searchButton&&t.rightToLeft?a.style.left=e.offsetLeft-(t.rightToLeft?a.offsetWidth-e.offsetWidth:0)+"px":a.style.left=(t.rightToLeft?e.offsetLeft:e.offsetLeft+Math.max(25,e.offsetWidth)-a.offsetWidth)+"px",a.classList.remove("smart-visibility-hidden"),a.classList.add("open"),a.controlledBy&&(a.controlledBy.removeAttribute("aria-controls"),a.controlledBy.setAttribute("aria-expanded",!1)),a.controlledBy=e,e.setAttribute("aria-controls",a.id),e.setAttribute("aria-expanded",!0),t._headerDropDownTransitionendHandler()}_searchInputKeyupHandler(e){const t=this;function a(){t._searchInfo&&t.$.searchInput.value!==t._searchInfo.query&&t._search(t.$.searchInput.value)}return clearTimeout(t._searchInputTimeout),"Escape"===e.key?(t.$.searchInput.value="",a(),void t.closePanel()):"Enter"===e.key&&t._searchInfo.foundIdsArray&&t._searchInfo.foundIdsArray.length>1?(a(),void t._headerClickHandler(t.$.searchNext,t.$.cardContainer||t.$.body)):void(t._searchInputTimeout=setTimeout(a,500))}}),Smart("smart-colors-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},editorCallback:{value:null,type:"function?",reflectToAttribute:!1},editorPlaceholder:{value:"Value",type:"string"},messages:{value:{en:{addFilter:"+ Add decorator",and:"And",apply:"Ok",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",or:"Or",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",where:"Where",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month"}},type:"object",extend:!0},operator:{value:"and",allowedValues:["and","or"],type:"string"},value:{value:[],type:"array"}}}static get listeners(){return{change:"_changeHandler",click:"_interactionHandler",keydown:"_interactionHandler"}}static get requires(){return{"Smart.Button":"smart.button.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.FilterGroup":"smart.filter.js","Smart.Input":"smart.input.js","Smart.NumericTextBox":"smart.numerictextbox.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div id="gridLayout">\n <div style="border-right: 1px solid var(--smart-border)" class="tabs" id="tabs">\n <div title="Color rows when they match the conditions" class="tab active" id="condition"></div>\n <div title="Color rows the same as a single select value" class="tab" id="select"></div>\n </div>\n <div style="margin-left: 10px;" id="applyTo"></div>\n </div>\n <div>\n\n <span id="conditionLabel">Color rows when they match the conditions</span>\n <div id="singleSelectLabel" class="smart-hidden">Which single select field should the row be colored by?</div>\n <smart-input style="margin-top: 10px; margin-bottom: 10px; width: 250px; display: block;" selected-index="0" class="underlined smart-hidden" readonly id="singleSelect"></smartinput>\n </div>\n <div id="itemsContainer" style="padding-top: 0px;" class="smart-filter-panel-items-container smart-unselectable"></div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div id="addFilterButton" class="smart-filter-panel-add-filter-button smart-unselectable" role="button"></div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>'}ready(){super.ready()}updateSingleSelect(){const e=this,t=e.ownerElement.columns.filter((e=>!!e.template&&!("tags"!==e.template&&"collaborator"!==e.template&&"dropdownlist"!==e.template&&"list"!==e.template||!e.editor.singleSelect))).map((e=>({label:e.label,value:e.dataField})));e.$.singleSelect.dataSource=t,e.$.singleSelect.selectedValue=t[0]?t[0].value:""}render(){const e=this;e.setAttribute("role","dialog"),e.$.gridLayout.style.display="grid",e.$.gridLayout.style.gridTemplateColumns="400px auto",e.$.gridLayout.style.gridColumnGap="1rem",e.$.gridLayout.style.overflow="hidden",e.$.condition.onclick=()=>{e.$.select.classList.remove("active"),e.$.condition.classList.add("active"),e.$.singleSelectLabel.classList.add("smart-hidden"),e.$.singleSelect.classList.add("smart-hidden"),e.$.addFilterButton.classList.remove("smart-visibility-hidden"),e.$.itemsContainer.classList.remove("smart-hidden"),e.$.conditionLabel.classList.remove("smart-hidden"),e.$.singleSelect.classList.add("smart-hidden"),e.$.applyToInput.dataSource[2].visible=!0},e.$.select.onclick=()=>{e.$.select.classList.add("active"),e.$.condition.classList.remove("active"),e.$.singleSelectLabel.classList.remove("smart-hidden"),e.$.singleSelect.classList.remove("smart-hidden"),e.$.addFilterButton.classList.add("smart-visibility-hidden"),e.$.itemsContainer.classList.add("smart-hidden"),e.$.conditionLabel.classList.add("smart-hidden"),e.$.singleSelect.classList.remove("smart-hidden"),e.$.applyToInput.dataSource[2].visible=!1,2===e.$.applyToInput.selectedIndex&&(e.$.applyToInput.selectedIndex=0)};const t=document.createElement("smart-input");t.readonly=!0,t.dropDownButtonPosition="right",t.dropDownAppendTo="body",t.style.width="100%",e.$.singleSelect.dropDownButtonPosition="right",e.$.singleSelect.dropDownAppendTo="body",e.updateSingleSelect();const a="var(--smart-primary);";t.dataSource=[{label:"Left border",value:"border",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Left border</div><div class="smart-quiet">Color the left border of a row</div>',prefix:'<span style="top: 8px; border-right: 3px solid '+a+'; padding: 2px; display: inline-block; margin-right: 16px; position: relative;">1</span>'},{label:"Row",value:"row",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Row background</div><div class="smart-quiet">Color the background of a row</div>',prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border: 1px solid var(--smart-primary); color: var(--smart-primary-color); top: 8px; background: '+a+'; padding: 2px; display: inline-block; margin-right: 8px; position: relative;">2</span>'},{label:"Cell",value:"cell",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Cell background</div><div class="smart-quiet">Color the background of a cell</div>',prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border:1px solid '+a+'; padding: 2px; display: inline-block; top: 8px; margin-right: 8px; position: relative;">2</span>'}],e.$.applyTo.appendChild(t),e.$.applyToInput=t,e._setFocusable(),e._localize(),e.$.applyToInput.selectedIndex=0,e._applyValue(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":Array.from(l.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input")).forEach((t=>{t[e]=a,"smart-input"===t.tagName.toLowerCase()&&"rightToLeft"===e&&"none"!==t.dropDownButtonPosition&&(t.dropDownButtonPosition=a?"left":"right")}));break;case"disabled":case"unfocusable":l._setFocusable(!0);break;case"dataSource":case"value":l._applyValue();break;case"editorPlaceholder":Array.from(l.$.itemsContainer.getElementsByClassName("editor")).forEach((e=>e.placeholder=a));break;case"locale":case"messages":l._localize(!0);break;case"operator":l._setOperator()}}_setOperator(){const e=this,t=e.localize(e.operator);for(let a=2;a<e._items.length;a++)e._items[a].children[1].innerHTML=t}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a instanceof Smart.Input==0)return;const l=a.parentElement,n=l.children;if(a===n[1])t.operator=a.$.input.dataValue,t._setOperator();else if(a===n[2]){let a,i,o=t.dataSource.find((t=>t.dataField===e.detail.oldValue)).dataType,r=t.dataSource.find((t=>t.dataField===e.detail.oldValue)),s=t.dataSource.find((t=>t.dataField===e.detail.value)),d=s.dataType,c=[];if(s.options&&(d="enum",c=s.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),r&&r.options&&(o="enum"),"enum"!==d&&d===o)return void(t.editorCallback&&t.editorCallback(n[4],s));let p=n[3]?n[3].value:"";switch(d){case"date":a=t._dateConditions,i=document.createElement("smart-date-time-picker"),i.calendarButton=!0,i.dropDownAppendTo="body",i.dropDownDisplayMode="auto",i.formatString="M/d/yy H:mm",p="";break;case"number":a=t._numberAndDateConditions,i=document.createElement("smart-numeric-text-box"),p="";break;case"boolean":a=t._booleanConditions,i=document.createElement("smart-check-box"),p="";break;case"enum":a=t._enumConditions,i=document.createElement("smart-input"),i.dataSource=c.length?c:s.options,i.readonly=!0,i.dropDownButtonPosition="right",p=a[0];break;default:a=t._stringConditions,p=t._stringConditions.find((e=>"CONTAINS"===e.value)),i=document.createElement("smart-input")}a.forEach((e=>{delete e.selected})),i.rightToLeft=t.rightToLeft,i.animation=t.animation,i.theme=t.theme,i.unfocusable=t.disabled||t.unfocusable,i.classList.add("underlined"),i.dataSource&&i.dataSource.length<10?i.dropDownHeight="auto":i.dropDownHeight=250,"boolean"!==d&&(i.placeholder=t.editorPlaceholder),t.editorCallback&&t.editorCallback(i,s),n[4]&&n[4].remove(),l.appendChild(i),""===p||a.find((e=>e.label===p))||(p.value?(n[3].value=p.label,n[3].selectedValue=p.value):(n[3].value="",n[3].selectedValue="")),n[3].dataSource=a,""===p&&(n[3].value=a[0].label,n[3].selectedValue=a[0].value),a.length>=10?n[3].dropDownHeight=250:n[3].dropDownHeight="auto",l.dataType=d}else if(a===n[3]){const e=n[4],t=a.$.input.dataValue;-1!==t.indexOf("NULL")||-1!==t.indexOf("EMPTY")||-1!==t.indexOf("THIS_WEEK")||-1!==t.indexOf("LAST_WEEK")||-1!==t.indexOf("NEXT_WEEK")||-1!==t.indexOf("THIS_MONTH")||-1!==t.indexOf("LAST_MONTH")||-1!==t.indexOf("NEXT_MONTH")||-1!==t.indexOf("THIS_YEAR")||-1!==t.indexOf("LAST_YEAR")||-1!==t.indexOf("NEXT_YEAR")||-1!==t.indexOf("TODAY")||-1!==t.indexOf("TOMORROW")||-1!==t.indexOf("YESTERDAY")?(e.value="",e.checked=!1,e.classList.add("smart-visibility-hidden")):e.classList.remove("smart-visibility-hidden"),a.condition=t}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#0B8043","#33B679","#3F51B5","#039BE5","#7986CB","#8C47FF","#8E24AA","#FF36C2","#616161","#454545","#949494","#000000"],e.additionalColors=["#FF9EB7","#FF9EB7","#FFD66D","#FFEBB6","#93DF89","#D1F7C4","#9DC7FF","#D0F0FD","#CDAFFF","#ECE1FD","#FA9DE2","#FFDAF6","#CBCBCB","#EDEDED","#FFFFFF",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;e.querySelector(".smart-color-box").style.borderRadius="50%",t&&t.classList.add("smart-grid-color-input")},e}_interactionHandler(e){const t=this;if(t.disabled||t.readonly)return;if("keydown"===e.type){if("Enter"!==e.key)return;e.preventDefault()}const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-grid-panel-item");if(l){if(a===l.firstElementChild){const e=t._items.indexOf(l);let a;if(t._items.splice(e,1),l.remove(),t._items.length>0&&e<2){if(0===e){t._items[0].children[1].remove(),a=document.createElement("div"),a.innerHTML=t.localize("where");const e=t._getColorInput();t._items[0].insertBefore(e,t._items[0].children[1])}t._items.length>1&&(t._items[1].children[1].remove(),a=document.createElement("smart-input"),a.className="underlined",a.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],a.dropDownButtonPosition=t.rightToLeft?"left":"right",a.readonly=!0,a.value=t.localize(t.operator),a.animation=t.animation,a.theme=t.theme,a.rightToLeft=t.rightToLeft,a.unfocusable=t.disabled||t.unfocusable,t._items[1].insertBefore(a,t._items[1].children[1]))}}}else if(a===t.$.addFilterButton&&t.dataSource.length>0)t.$.itemsContainer.appendChild(t._createItem(t.dataSource[0],"","",t._items.length));else if(a!==t.$.buttonsContainer.firstElementChild){if(a===t.$.buttonsContainer.children[1]){let e=t._stringConditions.concat(t._dateConditions),a=t.operator,l=[],n={},i=[];t._customConditions&&(e=e.concat(t._customConditions)),t._items.forEach((i=>{const o=t.dataSource.find((e=>e.label===i.children[2].value)),r=[];let s=i.children[3].value;if(""===s)return;let d=o.dataType;s=e.find((e=>e.label===s)).value;const c=i.querySelector("smart-color-input").value;if(r.push(o.dataField,s),-1===s.indexOf("NULL")&&-1===s.indexOf("EMPTY"))if("boolean"===d)r.push(i.children[4].checked);else if("date"===d)r.push(i.children[4].value.toDate());else if("enum"===d||o.options){let e=i.children[4].$.input.dataValue;if(void 0===e){const t=o.options.find((e=>e.label===i.children[4].value));if(!t)return;e=t.value}d="string",r.push(e)}else r.push(i.children[4].value);r.push(c);let p=n[r[0]];void 0===p&&(p=new Smart.Utilities.FilterGroup,n[r[0]]=p);const u=p.createFilter(d,r[2],r[1]);p.addFilter(a,u),l.push(r)}));for(let e in n)i.push([e,n[e]]);const o={};o.type=t.$.condition.classList.contains("active")?"conditions":"singleSelect",o.decorate=t.$.applyToInput.selectedValue,o.singleSelect=t.$.singleSelect.selectedValue,null===o.decorate&&(o.decorate="border"),t.value=l,t.$.fireEvent("apply",{filters:i,decorator:o,value:l})}}else t.$.fireEvent("cancel")}_applyValue(){const e=this,t=document.createDocumentFragment();let a=0;for(e._items=[];e.$.itemsContainer.firstElementChild;)e.$.itemsContainer.firstElementChild.remove();if(0===e.dataSource.length)return;const l=e.value&&e.value[0]||[],n=e.value?e.value[1]:{};n&&"singleSelect"===n.type?e.$.select.click():e.$.condition.click(),l.forEach((l=>{if(!Array.isArray(l))return;const n=l[0],i=e.dataSource.find((e=>e.dataField===n));if(!i)return;let o;o="EMPTY"===l[1]||"NULL"===l[1]||"NOT_EMPTY"===l[1]||"NOT_NULL"===l[1]?e._createItem(i,l[1],void 0,a,l[2]):e._createItem(i,l[1],l[2],a,l[3]),t.appendChild(o),a++})),e.$.itemsContainer.appendChild(t),e.updateSingleSelect(),n&&(e.$.applyToInput.selectedValue=n.decorate,e.$.singleSelect.selectedValue=n.singleSelect)}_createItem(e,t,a,l,n=""){const i=this,o=i.disabled||i.unfocusable?-1:0,r=document.createElement("div"),s=document.createDocumentFragment(),d=document.createElement("div"),c=document.createElement("smart-input"),p=document.createElement("smart-input");let u,m;d.className="smart-grid-panel-item-close-button",d.tabIndex=o,d.setAttribute("role","button"),d.setAttribute("aria-label","button"),s.appendChild(d),u=document.createElement("div");const h=i._getColorInput();if(h.value=n,u.appendChild(h),u.setAttribute("role","presentation"),s.appendChild(u),c.className="underlined",c.dataSource=i.dataSource.map((e=>({value:e.dataField,label:e.label,icon:e.icon}))),c.dropDownButtonPosition=i.rightToLeft?"left":"right",c.readonly=!0,c.value=e.label,c.animation=i.animation,c.theme=i.theme,c.rightToLeft=i.rightToLeft,c.unfocusable=i.disabled||i.unfocusable,c.setAttribute("aria-label","Field"),c.dataSource&&c.dataSource.length<10?c.dropDownHeight="auto":c.dropDownHeight=250,s.appendChild(c),"boolean"===e.dataType)p.dataSource=JSON.parse(JSON.stringify(i._booleanConditions)),m=document.createElement("smart-check-box"),m.checked="boolean"==typeof a&&a;else if("date"===e.dataType)p.dataSource=i._dateConditions,m=document.createElement("smart-date-time-picker"),m.dropDownDisplayMode="auto",m.calendarButton=!0,m.dropDownAppendTo="body",m.formatString="M/d/yy H:mm",m.value=a;else if("number"===e.dataType)p.dataSource=JSON.parse(JSON.stringify(i._numberAndDateConditions)),m=document.createElement("smart-numeric-text-box"),m.value="number"==typeof a||"string"==typeof a?a:0;else if("enum"===e.dataType||e.options){p.dataSource=JSON.parse(JSON.stringify(i._enumConditions)),m=document.createElement("smart-input");let t=[];e.options&&(t=e.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),m.dataSource=t.length?t:e.options,m.readonly=!0,m.dropDownButtonPosition="right";const l=a?e.options.find((e=>e.value===a)):null;m.value=l&&a?l.label:""}else p.dataSource=JSON.parse(JSON.stringify(i._stringConditions)),m=document.createElement("smart-input"),m.value=null!=a?a.toString():"",t||(t="CONTAINS");return p.className="underlined",p.dropDownButtonPosition=i.rightToLeft?"left":"right",p.readonly=!0,p.animation=i.animation,p.theme=i.theme,p.rightToLeft=i.rightToLeft,p.unfocusable=i.disabled||i.unfocusable,p.setAttribute("aria-label","Condition"),p.classList.add("smart-filter-panel-list"),p.dataSource.forEach((e=>{delete e.selected})),p.dataSource.find((e=>e.value===t))?(p.value=i.localize(t),p.selectedValue=t,p.condition=t):(m.value="",m.checked=!1),(void 0===t||-1===t.indexOf("NULL")&&-1===t.indexOf("EMPTY"))&&-1===t.indexOf("THIS_WEEK")&&-1===t.indexOf("LAST_WEEK")&&-1===t.indexOf("NEXT_WEEK")&&-1===t.indexOf("THIS_MONTH")&&-1===t.indexOf("LAST_MONTH")&&-1===t.indexOf("NEXT_MONTH")&&-1===t.indexOf("THIS_YEAR")&&-1===t.indexOf("LAST_YEAR")&&-1===t.indexOf("NEXT_YEAR")&&-1===t.indexOf("TODAY")&&-1===t.indexOf("TOMORROW")&&-1===t.indexOf("YESTERDAY")||(m.value="",m.checked=!1,m.classList.add("smart-visibility-hidden")),p.dataSource&&p.dataSource.length<10?p.dropDownHeight="auto":p.dropDownHeight=250,m.animation=i.animation,m.classList.add("editor"),m.rightToLeft=i.rightToLeft,m.theme=i.theme,m.unfocusable=i.disabled||i.unfocusable,m.classList.add("underlined"),"boolean"!==e.dataType&&(m.placeholder=i.editorPlaceholder),i.editorCallback&&i.editorCallback(m,e),s.appendChild(p),s.appendChild(m),r.appendChild(s),r.className="smart-grid-panel-item",i._items.push(r),r.dataType=e.dataType,r}_localize(e){const t=this;t.$.addFilterButton.innerHTML=t.localize("add"),t.$.buttonsContainer.firstElementChild.innerHTML=t.localize("cancel"),t.$.buttonsContainer.children[1].innerHTML=t.localize("apply"),t.$.itemsContainer.setAttribute("no-filters",t.localize("noResults")),t.$.select.innerHTML='<span class="smart-icon smart-grid-icon smart-icon-sort-down show"></span>'+t.localize("select"),t.$.condition.innerHTML='<span class="smart-icon smart-grid-icon smart-icon-filter show"></span>'+t.localize("conditions"),t.$.condition.title=t.localize("colorRows"),t.$.select.title=t.localize("colorSelect"),t.$.conditionLabel.innerHTML=t.localize("colorRows"),t.$.singleSelectLabel.innerHTML=t.localize("colorsSingleSelect"),t.$.singleSelect.dropDownPlaceholder=t.localize("noOptions");const a="var(--smart-primary);";t.$.applyToInput.dataSource=[{label:t.localize("colorLeftBorderLabel"),value:"border",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorLeftBorderLabel")}</div><div class="smart-quiet">${t.localize("colorLeftBorder")}</div>`,prefix:'<span style="top: 8px; border-right: 3px solid '+a+'; padding: 2px; display: inline-block; margin-right: 16px; position: relative;">1</span>'},{label:t.localize("colorRowLabel"),value:"row",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorRowLabel")}</div><div class="smart-quiet">${t.localize("colorRow")}</div>`,prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border: 1px solid var(--smart-primary); color: var(--smart-primary-color); top: 8px; background: '+a+'; padding: 2px; display: inline-block; margin-right: 8px; position: relative;">2</span>'},{label:t.localize("colorCellLabel"),value:"cell",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorCellLabel")}</div><div class="smart-quiet">${t.localize("colorCell")}</div>`,prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border:1px solid '+a+'; padding: 2px; display: inline-block; top: 8px; margin-right: 8px; position: relative;">2</span>'}],t.$.applyToInput.selectedValue="border",t._stringConditions=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("EMPTY")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("NOT_EMPTY")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("CONTAINS")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("DOES_NOT_CONTAIN")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("STARTS_WITH")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("ENDS_WITH")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._enumConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")}],t._dateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TOMORROW",label:t.localize("TOMORROW")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TODAY",label:t.localize("TODAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"YESTERDAY",label:t.localize("YESTERDAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_WEEK",label:t.localize("NEXT_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_WEEK",label:t.localize("THIS_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_WEEK",label:t.localize("LAST_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_MONTH",label:t.localize("NEXT_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_MONTH",label:t.localize("THIS_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_MONTH",label:t.localize("LAST_MONTH")}],t._numberAndDateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._booleanConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],e&&t._items.forEach(((e,a)=>{const l=e.children[1],n=e.children[3];0===a?l.innerHTML="":1===a?(l.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],l.value=t.localize(t.operator)):l.innerHTML=t.localize(t.operator),"string"!==e.dataType||e.options?"enum"===e.dataType||e.options?n.dataSource=t._enumConditions:"boolean"===e.dataType?n.dataSource=t._booleanConditions:"date"===e.dataType?n.dataSource=t._dateConditions:n.dataSource=t._numberAndDateConditions:n.dataSource=t._stringConditions,n.value=n.condition?t.localize(n.condition):""}))}_setFocusable(e){const t=this,a=t.disabled||t.unfocusable?-1:0;if(t.$.addFilterButton.tabIndex=a,t.$.buttonsContainer.firstElementChild.tabIndex=a,t.$.buttonsContainer.children[1].tabIndex=a,e){const e=Array.from(t.$.itemsContainer.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(t.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input"));e.forEach((e=>e.tabIndex=a)),l.forEach((e=>e.unfocusable=t.disabled||t.unfocusable))}}});
|
|
871
|
+
Smart("smart-grid-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},messages:{value:{en:{apply:"Ok",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",dateFirst:"1",dateLast:"9",from:"from",numberFirst:"1",numberLast:"9",stringFirst:"A",stringLast:"Z",thenBy:"then by"}},type:"object",extend:!0}}}static get listeners(){return{change:"_changeHandler",click:"_clickHandler",keydown:"_keydownHandler","sortable.dragEnd":"_sortableDragEndHandler"}}static get requires(){return{"Smart.Input":"smart.input.js","Smart.Sortable":"smart.sortable.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <smart-sortable id="sortable" disable-mode="manual" animation="[[animation]]" disabled="[[readonly]]" right-to-left="[[rightToLeft]]"\n drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]">\n </smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <smart-input id="inputNotSorted" right-to-left="[[rightToLeft]]" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),"right"===e.closeButtonPosition&&(e.$.sortable.handlePosition="left"),e._localize(),e._createSources(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":Array.from(l.$.sortable.getElementsByTagName("smart-input")).forEach((t=>t[e]=a));break;case"disabled":case"unfocusable":l._setFocusable();break;case"closeButtonPosition":"right"===l.closeButtonPosition?l.$.sortable.handlePosition="left":l.$.sortable.handlePosition="right";break;case"dataSource":l.$.sortable.$.container.innerHTML="",l._createSources();break;case"locale":case"messages":{const e=l.$.sortable._items;l._localize(),e.length&&(e[0].children[1].innerHTML=l.localize("firstBy"),e.forEach((function(e,t){0!==t&&(e.children[1].innerHTML=l.localize("thenBy"));const a=l._HTMLToSourceMap.get(e),n=l._ascDescTemplates[a.dataType]||l._ascDescTemplates.string;e.children[3].innerHTML=l.localize("from"),e.children[4].firstElementChild.innerHTML=n[0],e.children[4].children[1].innerHTML=n[1]})));break}case"maxLevel":if(null!=a)for(;l.$.sortable._items.length>0&&l.$.sortable._items.length>a;)l._interactionHandler(l.$.sortable._items[l.$.sortable._items.length-1].firstElementChild);l._disableItemAddition();break;case"rightToLeft":l.$.inputNotSorted.rightToLeft=a,l.$.inputNotSorted.dropDownButtonPosition=a?"left":"right",l.$.sortable._items.forEach((e=>{const t=e.querySelector("smart-input");t.rightToLeft=a,t.dropDownButtonPosition=a?"left":"right"}))}}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(t.$.inputNotSorted.contains(a)){const e=t.$.inputNotSorted.value,a=t._labelToSourceMap.get(e);return t._createSortItem(a,t.$.sortable._items.length),t.$.sortable.updateItems(),t._visibleLabels.push(e),t._updateHiddenSource(),t._disableItemAddition(),void(t.$.inputNotSorted.value="")}const l=a.closest("smart-input");if(!l)return;const n=l.parentElement.parentElement,i=n.children[4].firstElementChild,o=n.children[4].children[1],r=l.value,s=t._HTMLToSourceMap.get(n).label,d=t._labelToSourceMap.get(r),c=t._ascDescTemplates[d.dataType]||t._ascDescTemplates.string;t._HTMLToSourceMap.set(n,d),t._visibleLabels.splice(t._visibleLabels.indexOf(s),1,r),t._updateHiddenSource(),i.innerHTML=c[0],o.innerHTML=c[1],d.sortDirection&&-1===d.sortDirection.indexOf("asc")?(o.classList.add("selected"),i.classList.remove("selected")):(i.classList.add("selected"),o.classList.remove("selected"))}_updateHiddenSource(){const e=this;e._hiddenSource=e.dataSource.map((e=>({label:e.label,value:e.dataField,icon:e.icon}))).filter((t=>-1===e._visibleLabels.indexOf(t.label)));const t=e.$.inputNotSorted.context;e.$.inputNotSorted.context=e.$.inputNotSorted,e.$.inputNotSorted.dataSource=e._hiddenSource,e.$.sortable._items.forEach((t=>{const a=t.getElementsByTagName("smart-input")[0],l=a.context;a.context=a,a.dataSource=e._hiddenSource,a.context=l})),e.$.inputNotSorted.context=t,e._disableItemAddition(),e.$.fireEvent("dataSourceChange")}_clickHandler(e){const t=this;t._interactionHandler(t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,e)}_interactionHandler(e,t){const a=this;if(a.disabled||a.readonly)return!0;const l=e.closest(".smart-grid-panel-item");if(l){if(e===l.firstElementChild){const e=a._HTMLToSourceMap.get(l).label;a.$.sortable.$.container.removeChild(l),a.$.sortable.updateItems(),a._visibleLabels.splice(a._visibleLabels.indexOf(e),1),a._updateHiddenSource(),a._disableItemAddition(),a.$.sortable._items.length&&(a.$.sortable._items[0].children[1].innerHTML=a.localize("firstBy")),a.$.fireEvent("remove")}else if(l.children[4].contains(e)){const n=l.children[4].firstElementChild,i=l.children[4].children[1];"click"===t.type?e.classList.contains("selected")||(e===n?(i.classList.remove("selected"),n.classList.add("selected"),a._HTMLToSourceMap.get(l).sortDirection="ascending"):e===i&&(n.classList.remove("selected"),i.classList.add("selected"),a._HTMLToSourceMap.get(l).sortDirection="descending")):(n.classList.toggle("selected"),i.classList.toggle("selected"),a._HTMLToSourceMap.get(l).sortDirection=n.classList.contains("selected")?"ascending":"descending")}return!0}if(e===a.$.buttonsContainer.firstElementChild)return a.$.fireEvent("cancel"),!0;if(e===a.$.buttonsContainer.children[1]){const e=[],t={dataFields:[],dataTypes:[],orderBy:[]},l={value:e};return a.$.sortable._items.forEach((l=>{const n=a._HTMLToSourceMap.get(l);e.push({dataField:n.dataField,sortDirection:n.sortDirection}),t.dataFields.push(n.dataField),t.dataTypes.push(n.dataType),t.orderBy.push(n.sortDirection)})),a instanceof Smart.SortPanel&&a.$.maintainSortContainer&&(t.maintainSort=a.$.maintainSortContainer.firstElementChild.hasAttribute("active")),(a instanceof Smart.SortPanel||a instanceof Smart.GroupPanel)&&(l.sortByInfo=t),a.$.fireEvent("apply",l),!0}}_keydownHandler(e){const t=this,a=e.key;" "!==a&&"Enter"!==a||(e.preventDefault(),t._interactionHandler((t.shadowRoot||t.getRootNode()).activeElement,e))}_sortableDragEndHandler(e){const t=this,a=e.detail.oldIndex,l=e.detail.newIndex,n=Math.max(a,l),i=t.$.sortable._items;0===(a&&l)&&(i[0].children[1].innerHTML=t.localize("firstBy"),i[1].children[1].innerHTML=t.localize("thenBy"),n>1&&(i[n].children[1].innerHTML=t.localize("thenBy")))}_localize(){const e=this;e.$.inputNotSorted.placeholder=e.localize("pickAnother"),e.$.buttonsContainer.firstElementChild.innerHTML=e.localize("cancel"),e.$.buttonsContainer.children[1].innerHTML=e.localize("apply"),e._ascDescTemplates={boolean:[e.localize("booleanFirst")+" → "+e.localize("booleanLast"),e.localize("booleanLast")+" → "+e.localize("booleanFirst")],date:[e.localize("dateFirst")+" → "+e.localize("dateLast"),e.localize("dateLast")+" → "+e.localize("dateFirst")],number:[e.localize("numberFirst")+" → "+e.localize("numberLast"),e.localize("numberLast")+" → "+e.localize("numberFirst")],string:[e.localize("stringFirst")+" → "+e.localize("stringLast"),e.localize("stringLast")+" → "+e.localize("stringFirst")]}}_createSources(){const e=this,t=(e instanceof Smart.SortPanel?"sort":"group")+"Index",a=[],l=[];if(e._HTMLToSourceMap=new Map,e._labelToSourceMap=new Map,e.dataSource.forEach((l=>{e._labelToSourceMap.set(l.label,l),-1!==l[t]&&void 0!==l[t]&&a.push(l)})),a.sort(((e,a)=>e[t]-a[t])),void 0!==e.maxLevel&&null!==e.maxLevel)for(;a.length>0&&a.length>e.maxLevel;)a.pop();e.$.inputNotSorted.dropDownButtonPosition=e.rightToLeft?"left":"right",e.$.inputNotSorted.dataSource&&e.$.inputNotSorted.dataSource.length<10&&e.$.inputNotSorted.dataSource.length>0?e.$.inputNotSorted.dropDownHeight="auto":e.$.inputNotSorted.dropDownHeight=250,a.forEach((e=>l.push(e.label))),e._visibleLabels=l,e._updateHiddenSource(),a.forEach(((t,a)=>{e._createSortItem(t,a)})),e.$.sortable.updateItems(),e._disableItemAddition(),e._setFocusable()}_createSortItem(e,t){const a=this,l=a.disabled||a.unfocusable?-1:0,n=document.createElement("div"),i=a._ascDescTemplates[e.dataType]||a._ascDescTemplates.string;n.className="smart-grid-panel-item",n.innerHTML=`<div class="smart-grid-panel-item-close-button" tabindex="${l}" role="button" aria-label="Close"></div>\n<div class="smart-grid-panel-label-by smart-unselectable" role="presentation">${a.localize(t>0?"thenBy":"firstBy")}</div>\n<div class="smart-grid-panel-field-container" role="presentation"><smart-input class="smart-grid-panel-field-selection" value="${e.label}" animation="${a.animation}" readonly theme="${a.theme}" aria-label="Field name"></smart-input></div>\n<div class="smart-grid-panel-from smart-unselectable" role="presentation">${a.localize("from")}</div >\n<div class="smart-grid-panel-direction smart-unselectable" tabindex="${l}" role="presentation">\n <div class="smart-grid-panel-asc" role="button" aria-label="Ascending">${i[0]}</div >\n <div class="smart-grid-panel-desc" role="button" aria-label="Descending">${i[1]}</div>\n</div>\n`;const o=n.querySelector("smart-input");o.dataSource=a._hiddenSource,o.rightToLeft=a.rightToLeft,o.dropDownButtonPosition=a.rightToLeft?"left":"right",o.dataSource&&o.dataSource.length<10?o.dropDownHeight="auto":o.dropDownHeight=250,a.$.sortable.$.container.appendChild(n),o.tabIndex=l,e.sortDirection&&-1===e.sortDirection.indexOf("asc")?n.children[4].children[1].classList.add("selected"):(e.sortDirection="ascending",n.children[4].firstElementChild.classList.add("selected")),a._HTMLToSourceMap.set(n,e)}_disableItemAddition(){const e=this,t=e.maxLevel,a=0===e._hiddenSource.length||null!=t&&Math.max(0,t)===e.$.sortable._items.length;e.$.inputNotSorted.disabled=a,a&&e.$.inputNotSorted.removeAttribute("focus")}_setFocusable(){const e=this,t=e.disabled||e.unfocusable?-1:0,a=Array.from(e.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(e.getElementsByClassName("smart-grid-panel-direction")),n=Array.from(e.getElementsByTagName("input")),i=a.concat(l).concat(n);e.$.buttonsContainer.firstElementChild.tabIndex=t,e.$.buttonsContainer.children[1].tabIndex=t,i.forEach((e=>e.tabIndex=t))}}),Smart("smart-sort-panel",class extends Smart.GridPanel{static get properties(){return{messages:{value:{en:{firstBy:"Sort by",noSorting:"No sorting applied",pickAnother:"Pick another field to sort by",maintainSort:"Maintain Sort",applyOnce:"Apply once"}},type:"object",extend:!0}}}template(){return'<div id="container" role="presentation">\n <smart-sortable disable-mode="manual" right-to-left="[[rightToLeft]]" id="sortable" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div>\n <smart-input right-to-left="[[rightToLeft]]" id="inputNotSorted" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="maintainSortContainer" class="smart-hidden smart-grid-panel-buttons-container smart-grid-panel-maintain-sort smart-unselectable" role="presentation">\n <span class="smart-grid-panel-maintain-sort-button" role="button"></span>\n </div>\n \n </div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}_changeApplyButtonText(e){const t=this,a=t.$.maintainSortContainer.firstElementChild,l=t.querySelector(".smart-grid-panel-apply-button");e?a.hasAttribute("active")?(a.removeAttribute("active"),l&&(l.innerHTML=t.localize("applyOnce"))):(a.setAttribute("active",""),l&&(l.innerHTML=t.localize("apply"))):a.hasAttribute("active")?l.innerHTML=t.localize("apply"):l.innerHTML=t.localize("applyOnce")}_interactionHandler(e,t){const a=this;super._interactionHandler(e,t)||e===a.$.maintainSortContainer.firstElementChild&&a._changeApplyButtonText(!0)}static get styleUrls(){return["smart.textbox.css"]}_localize(){super._localize();const e=this;e.$.sortable.$.container.setAttribute("no-sorting",e.localize("noSorting")),e.$.maintainSortContainer.firstElementChild.innerHTML=e.localize("maintainSort"),e._changeApplyButtonText()}}),Smart("smart-group-panel",class extends Smart.GridPanel{static get properties(){return{maxLevel:{value:8,type:"number?"},messages:{value:{en:{collapseAll:"Collapse all",expandAll:"Expand all",firstBy:"Group by",noGrouping:"No grouping",pickAnother:"Pick another field to group by"}},type:"object",extend:!0}}}template(){return'<div id="container" role="presentation">\n <smart-sortable disable-mode="manual" right-to-left="[[rightToLeft]]" id="sortable" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="expandCollapseContainer" class="smart-grid-panel-buttons-container smart-grid-panel-expand-collapse smart-unselectable" role="presentation">\n <span class="smart-group-panel-collapse-button" role="button"></span>\n <span class="smart-group-panel-expand-button" role="button"></span>\n </div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <smart-input right-to-left="[[rightToLeft]]" id="inputNotSorted" animation="[[animation]]" readonly theme="[[theme]]"></smart-input>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}_interactionHandler(e,t){const a=this;super._interactionHandler(e,t)||(e===a.$.expandCollapseContainer.firstElementChild?a.$.fireEvent("collapseAll"):e===a.$.expandCollapseContainer.children[1]&&a.$.fireEvent("expandAll"))}_localize(){super._localize();const e=this;e.$.expandCollapseContainer.firstElementChild.innerHTML=e.localize("collapseAll"),e.$.expandCollapseContainer.children[1].innerHTML=e.localize("expandAll"),e.$.sortable.$.container.setAttribute("no-grouping",e.localize("noGrouping"))}_setFocusable(){super._setFocusable();const e=this,t=e.disabled||e.unfocusable?-1:0;e.$.expandCollapseContainer.firstElementChild.tabIndex=t,e.$.expandCollapseContainer.children[1].tabIndex=t}}),Smart("smart-multi-column-filter-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},editorCallback:{value:null,type:"function?",reflectToAttribute:!1},editorPlaceholder:{value:"Value",type:"string"},messages:{value:{en:{addFilter:"+ Add filter",and:"And",apply:"Ok",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",or:"Or",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",where:"Where",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month"}},type:"object",extend:!0},operator:{value:"and",allowedValues:["and","or"],type:"string"},value:{value:[],type:"array"}}}static get listeners(){return{change:"_changeHandler",click:"_interactionHandler",keydown:"_interactionHandler"}}static get requires(){return{"Smart.Button":"smart.button.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.FilterGroup":"smart.filter.js","Smart.Input":"smart.input.js","Smart.NumericTextBox":"smart.numerictextbox.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div id="itemsContainer" class="smart-filter-panel-items-container smart-unselectable"></div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div id="addFilterButton" class="smart-filter-panel-add-filter-button smart-unselectable" role="button"></div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),e._setFocusable(),e._localize(),e._applyValue(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":Array.from(l.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input")).forEach((t=>{t[e]=a,"smart-input"===t.tagName.toLowerCase()&&"rightToLeft"===e&&"none"!==t.dropDownButtonPosition&&(t.dropDownButtonPosition=a?"left":"right")}));break;case"disabled":case"unfocusable":l._setFocusable(!0);break;case"dataSource":case"value":l._applyValue();break;case"editorPlaceholder":Array.from(l.$.itemsContainer.getElementsByClassName("editor")).forEach((e=>e.placeholder=a));break;case"locale":case"messages":l._localize(!0);break;case"operator":l._setOperator()}}_setOperator(){const e=this,t=e.localize(e.operator);for(let a=2;a<e._items.length;a++)e._items[a].children[1].innerHTML=t}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a instanceof Smart.Input==0)return;const l=a.parentElement,n=l.children;if(a===n[1])t.operator=a.$.input.dataValue,t._setOperator();else if(a===n[2]){let a,i,o=t.dataSource.find((t=>t.dataField===e.detail.oldValue)).dataType,r=t.dataSource.find((t=>t.dataField===e.detail.oldValue)),s=t.dataSource.find((t=>t.dataField===e.detail.value)),d=s.dataType,c=[];if(s.options&&(d="enum",c=s.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),r&&r.options&&(o="enum"),"enum"!==d&&d===o)return void(t.editorCallback&&t.editorCallback(n[4],s));let p=n[3].value;switch(d){case"date":a=t._dateConditions,i=document.createElement("smart-date-time-picker"),i.calendarButton=!0,i.dropDownAppendTo="body",i.dropDownDisplayMode="auto",i.formatString="M/d/yy H:mm",p="";break;case"number":a=t._numberAndDateConditions,i=document.createElement("smart-numeric-text-box"),p="";break;case"boolean":a=t._booleanConditions,i=document.createElement("smart-check-box"),p="";break;case"enum":a=t._enumConditions,i=document.createElement("smart-input"),i.dataSource=c.length?c:s.options,i.readonly=!0,i.dropDownButtonPosition="right",p=a[0];break;default:a=t._stringConditions,p=t._stringConditions.find((e=>"CONTAINS"===e.value)),i=document.createElement("smart-input")}a.forEach((e=>{delete e.selected})),i.rightToLeft=t.rightToLeft,i.animation=t.animation,i.theme=t.theme,i.unfocusable=t.disabled||t.unfocusable,i.classList.add("underlined"),i.dataSource&&i.dataSource.length<10?i.dropDownHeight="auto":i.dropDownHeight=250,"boolean"!==d&&(i.placeholder=t.editorPlaceholder),t.editorCallback&&t.editorCallback(i,s),n[4]&&n[4].remove(),l.appendChild(i),""===p||a.find((e=>e.label===p))||(p.value?(n[3].value=p.label,n[3].selectedValue=p.value):(n[3].value="",n[3].selectedValue="")),n[3].dataSource=a,""===p&&(n[3].value=a[0].label,n[3].selectedValue=a[0].value),a.length>=10?n[3].dropDownHeight=250:n[3].dropDownHeight="auto",l.dataType=d}else if(a===n[3]){const e=n[4],t=a.$.input.dataValue;-1!==t.indexOf("NULL")||-1!==t.indexOf("EMPTY")||-1!==t.indexOf("THIS_WEEK")||-1!==t.indexOf("LAST_WEEK")||-1!==t.indexOf("NEXT_WEEK")||-1!==t.indexOf("THIS_MONTH")||-1!==t.indexOf("LAST_MONTH")||-1!==t.indexOf("NEXT_MONTH")||-1!==t.indexOf("THIS_YEAR")||-1!==t.indexOf("LAST_YEAR")||-1!==t.indexOf("NEXT_YEAR")||-1!==t.indexOf("TODAY")||-1!==t.indexOf("TOMORROW")||-1!==t.indexOf("YESTERDAY")?(e.value="",e.checked=!1,e.classList.add("smart-visibility-hidden")):e.classList.remove("smart-visibility-hidden"),a.condition=t}}_interactionHandler(e){const t=this;if(t.disabled||t.readonly)return;if("keydown"===e.type){if("Enter"!==e.key)return;e.preventDefault()}const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-grid-panel-item");if(l){if(a===l.firstElementChild){const e=t._items.indexOf(l);let a;t._items.splice(e,1),l.remove(),t._items.length>0&&e<2&&(0===e&&(t._items[0].children[1].remove(),a=document.createElement("div"),a.innerHTML=t.localize("where"),t._items[0].insertBefore(a,t._items[0].children[1])),t._items.length>1&&(t._items[1].children[1].remove(),a=document.createElement("smart-input"),a.className="underlined",a.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],a.dropDownButtonPosition=t.rightToLeft?"left":"right",a.readonly=!0,a.value=t.localize(t.operator),a.animation=t.animation,a.theme=t.theme,a.rightToLeft=t.rightToLeft,a.unfocusable=t.disabled||t.unfocusable,t._items[1].insertBefore(a,t._items[1].children[1])))}}else if(a===t.$.addFilterButton&&t.dataSource.length>0)t.$.itemsContainer.appendChild(t._createItem(t.dataSource[0],"","",t._items.length));else if(a!==t.$.buttonsContainer.firstElementChild){if(a===t.$.buttonsContainer.children[1]){let e=t._stringConditions.concat(t._dateConditions),a=t.operator,l=[],n={},i=[];t._customConditions&&(e=e.concat(t._customConditions)),t._items.forEach((i=>{const o=t.dataSource.find((e=>e.label===i.children[2].value)),r=[];let s=i.children[3].value;if(""===s)return;let d=o.dataType;if(s=e.find((e=>e.label===s)).value,r.push(o.dataField,s),-1===s.indexOf("NULL")&&-1===s.indexOf("EMPTY"))if("boolean"===d)r.push(i.children[4].checked);else if("date"===d)r.push(i.children[4].value.toDate());else if("enum"===d||o.options){let e=i.children[4].$.input.dataValue;if(void 0===e){const t=o.options.find((e=>e.label===i.children[4].value));if(!t)return;e=t.value}d="string",r.push(e)}else r.push(i.children[4].value);let c=n[r[0]];void 0===c&&(c=new Smart.Utilities.FilterGroup,n[r[0]]=c);const p=c.createFilter(d,r[2],r[1]);c.addFilter(a,p),l.push(r)}));for(let e in n)i.push([e,n[e]]);t.value=l,t.$.fireEvent("apply",{filters:i,operator:a,value:l})}}else t.$.fireEvent("cancel")}_applyValue(){const e=this,t=document.createDocumentFragment();let a=0;for(e._items=[];e.$.itemsContainer.firstElementChild;)e.$.itemsContainer.firstElementChild.remove();0!==e.dataSource.length&&(e.value.forEach((l=>{if(!Array.isArray(l))return;const n=l[0],i=e.dataSource.find((e=>e.dataField===n));if(!i)return;const o=e._createItem(i,l[1],l[2],a);t.appendChild(o),a++})),e.$.itemsContainer.appendChild(t))}_createItem(e,t,a,l){const n=this,i=n.disabled||n.unfocusable?-1:0,o=document.createElement("div"),r=document.createDocumentFragment(),s=document.createElement("div"),d=document.createElement("smart-input"),c=document.createElement("smart-input");let p,u;if(s.className="smart-grid-panel-item-close-button",s.tabIndex=i,s.setAttribute("role","button"),s.setAttribute("aria-label","button"),r.appendChild(s),0===l?(p=document.createElement("div"),p.innerHTML=n.localize("where"),p.setAttribute("role","presentation")):1===l?(p=document.createElement("smart-input"),p.className="underlined",p.dataSource=[{value:"and",label:n.localize("and")},{value:"or",label:n.localize("or")}],p.dropDownButtonPosition=n.rightToLeft?"left":"right",p.readonly=!0,p.value=n.localize(n.operator),p.animation=n.animation,p.theme=n.theme,p.rightToLeft=n.rightToLeft,p.unfocusable=n.disabled||n.unfocusable,p.setAttribute("aria-label","Operator")):(p=document.createElement("div"),p.innerHTML=n.localize(n.operator),p.setAttribute("role","presentation")),r.appendChild(p),d.className="underlined",d.dataSource=n.dataSource.map((e=>({value:e.dataField,label:e.label,icon:e.icon}))),d.dropDownButtonPosition=n.rightToLeft?"left":"right",d.readonly=!0,d.value=e.label,d.animation=n.animation,d.theme=n.theme,d.rightToLeft=n.rightToLeft,d.unfocusable=n.disabled||n.unfocusable,d.setAttribute("aria-label","Field"),d.dataSource&&d.dataSource.length<10?d.dropDownHeight="auto":d.dropDownHeight=250,r.appendChild(d),"boolean"===e.dataType)c.dataSource=JSON.parse(JSON.stringify(n._booleanConditions)),u=document.createElement("smart-check-box"),u.checked="boolean"==typeof a&&a;else if("date"===e.dataType)c.dataSource=n._dateConditions,u=document.createElement("smart-date-time-picker"),u.dropDownDisplayMode="auto",u.calendarButton=!0,u.dropDownAppendTo="body",u.formatString="M/d/yy H:mm",u.value=a;else if("number"===e.dataType)c.dataSource=JSON.parse(JSON.stringify(n._numberAndDateConditions)),u=document.createElement("smart-numeric-text-box"),u.value="number"==typeof a||"string"==typeof a?a:0;else if("enum"===e.dataType||e.options){c.dataSource=JSON.parse(JSON.stringify(n._enumConditions)),u=document.createElement("smart-input");let t=[];e.options&&(t=e.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),u.dataSource=t.length?t:e.options,u.readonly=!0,u.dropDownButtonPosition="right";const l=a?e.options.find((e=>e.value===a)):null;u.value=l&&a?l.label:""}else c.dataSource=JSON.parse(JSON.stringify(n._stringConditions)),u=document.createElement("smart-input"),u.value=null!=a?a.toString():"",t||(t="CONTAINS");return c.className="underlined",c.dropDownButtonPosition=n.rightToLeft?"left":"right",c.readonly=!0,c.animation=n.animation,c.theme=n.theme,c.rightToLeft=n.rightToLeft,c.unfocusable=n.disabled||n.unfocusable,c.setAttribute("aria-label","Condition"),c.classList.add("smart-filter-panel-list"),c.dataSource.forEach((e=>{delete e.selected})),c.dataSource.find((e=>e.value===t))?(c.value=n.localize(t),c.selectedValue=t,c.condition=t):(u.value="",u.checked=!1),(void 0===t||-1===t.indexOf("NULL")&&-1===t.indexOf("EMPTY"))&&-1===t.indexOf("THIS_WEEK")&&-1===t.indexOf("LAST_WEEK")&&-1===t.indexOf("NEXT_WEEK")&&-1===t.indexOf("THIS_MONTH")&&-1===t.indexOf("LAST_MONTH")&&-1===t.indexOf("NEXT_MONTH")&&-1===t.indexOf("THIS_YEAR")&&-1===t.indexOf("LAST_YEAR")&&-1===t.indexOf("NEXT_YEAR")&&-1===t.indexOf("TODAY")&&-1===t.indexOf("TOMORROW")&&-1===t.indexOf("YESTERDAY")||(u.value="",u.checked=!1,u.classList.add("smart-visibility-hidden")),c.dataSource&&c.dataSource.length<10?c.dropDownHeight="auto":c.dropDownHeight=250,u.animation=n.animation,u.classList.add("editor"),u.rightToLeft=n.rightToLeft,u.theme=n.theme,u.unfocusable=n.disabled||n.unfocusable,u.classList.add("underlined"),"boolean"!==e.dataType&&(u.placeholder=n.editorPlaceholder),n.editorCallback&&n.editorCallback(u,e),r.appendChild(c),r.appendChild(u),o.appendChild(r),o.className="smart-grid-panel-item",n._items.push(o),o.dataType=e.dataType,o}_localize(e){const t=this;t.$.addFilterButton.innerHTML=t.localize("addFilter"),t.$.buttonsContainer.firstElementChild.innerHTML=t.localize("cancel"),t.$.buttonsContainer.children[1].innerHTML=t.localize("apply"),t.$.itemsContainer.setAttribute("no-filters",t.localize("noFilters")),t._stringConditions=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("EMPTY")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("NOT_EMPTY")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("CONTAINS")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("DOES_NOT_CONTAIN")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("STARTS_WITH")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("ENDS_WITH")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._enumConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")}],t._dateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TOMORROW",label:t.localize("TOMORROW")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TODAY",label:t.localize("TODAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"YESTERDAY",label:t.localize("YESTERDAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_WEEK",label:t.localize("NEXT_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_WEEK",label:t.localize("THIS_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_WEEK",label:t.localize("LAST_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_MONTH",label:t.localize("NEXT_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_MONTH",label:t.localize("THIS_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_MONTH",label:t.localize("LAST_MONTH")}],t._numberAndDateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._booleanConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],e&&t._items.forEach(((e,a)=>{const l=e.children[1],n=e.children[3];0===a?l.innerHTML=t.localize("where"):1===a?(l.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],l.value=t.localize(t.operator)):l.innerHTML=t.localize(t.operator),"string"!==e.dataType||e.options?"enum"===e.dataType||e.options?n.dataSource=t._enumConditions:"boolean"===e.dataType?n.dataSource=t._booleanConditions:"date"===e.dataType?n.dataSource=t._dateConditions:n.dataSource=t._numberAndDateConditions:n.dataSource=t._stringConditions,n.value=n.condition?t.localize(n.condition):""}))}_setFocusable(e){const t=this,a=t.disabled||t.unfocusable?-1:0;if(t.$.addFilterButton.tabIndex=a,t.$.buttonsContainer.firstElementChild.tabIndex=a,t.$.buttonsContainer.children[1].tabIndex=a,e){const e=Array.from(t.$.itemsContainer.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(t.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input"));e.forEach((e=>e.tabIndex=a)),l.forEach((e=>e.unfocusable=t.disabled||t.unfocusable))}}}),Smart("smart-column-panel",class extends Smart.BaseElement{static get properties(){return{dataSource:{value:[],type:"array",reflectToAttribute:!1},messages:{value:{en:{apply:"Ok",cancel:"Cancel",find:"Find a field",reset:"Reset",noResults:"No results"}},type:"object",extend:!0}}}static get listeners(){return{click:"_interactionHandler",keydown:"_interactionHandler","find.keyup":"_findKeyupHandler","sortable.dragEnd":"_sortableDragEndHandler"}}static get requires(){return{"Smart.Sortable":"smart.sortable.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div class="smart-column-panel-find-container" role="search">\n <input id="find" readonly="[[readonly]]" role="searchbox" aria-label="Find a field"></input>\n <span id="clearButton" class="clear-button smart-hidden" role="button" aria-label="Clear"></span>\n </div>\n <smart-sortable id="sortable" disable-mode="manual" right-to-left="[[rightToLeft]]" animation="[[animation]]" disabled="[[readonly]]" drag-mode="handle" handle-position="right" handle-visibility="visible" theme="[[theme]]"></smart-sortable>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <span id="reset" class="smart-grid-panel-reset-button" role="button"></span>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>\n </div>'}ready(){super.ready()}render(){const e=this;e.setAttribute("role","dialog"),e._positionChanged=!1,e._localize(),e._moves=[],e._createSortItems(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"disabled":case"unfocusable":l._setFocusable();break;case"dataSource":{const e=l.$.sortable.$.container;for(;e.firstChild;)e.removeChild(e.firstChild);l._createSortItems(),l._positionChanged=!1,l.$.find.value="",l._findKeyupHandler(),l.$.clearButton.classList.add("smart-hidden");break}case"locale":case"messages":l._localize()}}_createSortItems(){const e=this,t=document.createDocumentFragment();e._HTMLToSourceMap=new Map,e.dataSource.forEach((a=>t.appendChild(e._createSortItem(a)))),e.$.sortable.$.container.appendChild(t),e.$.sortable.updateItems(),e._setFocusable()}_createSortItem(e){const t=document.createElement("div"),a=this.id+"Label"+e.dataField;return this._HTMLToSourceMap.set(t,e),t.className="smart-grid-panel-item",t.innerHTML=`<div class="toggle-visibility${!1!==e.visible?"":" hidden"}${e.disableToggle?" disable-toggle":""}" role="button" aria-controls="${a}" aria-label="Toggle visibility"></div>\n<span id="${a}" class="smart-column-panel-label smart-unselectable${e.icon?" icon "+e.icon:""}">${e.label}</span>`,1===e.level?t.classList.add("indent"):0===e.level&&t.classList.add("group"),e.disableDrag&&t.setAttribute("disable-drag",""),e.dataField&&t.setAttribute("data-field",e.dataField),e.parentDataField&&t.setAttribute("parent-data-field",e.parentDataField),!1!==e.allowHide&&!0!==e.disableToggle||(t.style.pointerEvents="none",t.setAttribute("disabled",""),t.style.opacity=.8),t}_interactionHandler(e){const t=this;if(t.disabled||t.readonly||"keydown"===e.type&&-1===[" ","Enter"].indexOf(e.key))return;const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a.classList.contains("toggle-visibility")){a.classList.toggle("hidden");const e=a.closest(".smart-grid-panel-item");if(e.hasAttribute("data-field")){const l=e.getAttribute("data-field");if(e.hasAttribute("parent-data-field")||e.hasAttribute("disabled")){const a=e.getAttribute("parent-data-field"),l=t.$.sortable.querySelectorAll(".smart-grid-panel-item");let n=null;if(l.forEach((e=>{e.getAttribute("data-field")===a&&(n=e)})),n){let e=0,t=0;l.forEach((l=>{l.getAttribute("parent-data-field")===a&&(e++,l.firstElementChild.classList.contains("hidden")&&t++)})),t===e?n.firstElementChild.classList.add("hidden"):t<e&&n.firstElementChild.classList.remove("hidden")}}else t.$.sortable._items.forEach((e=>{if(e.hasAttribute("parent-data-field")&&!e.hasAttribute("disabled")){const t=e.getAttribute("parent-data-field"),n=e.firstElementChild;t===l&&(a.classList.contains("hidden")?n.classList.add("hidden"):n.classList.remove("hidden"))}}))}}else if(a.parentElement===t.$.buttonsContainer){if(a===t.$.buttonsContainer.firstElementChild)return t.$.fireEvent("cancel"),void(t._moves=[]);if(a===t.$.buttonsContainer.children[1]){const e=[];Array.from(t.$.sortable.$.container.children).forEach((a=>{const l=Object.assign({},t._HTMLToSourceMap.get(a));l.visible=!a.firstElementChild.classList.contains("hidden"),e.push(l)})),t.$.fireEvent("apply",{value:e,positionChanged:t._positionChanged,moves:t._moves}),t._positionChanged=!1,t._moves=[]}}else if(a===t.$.reset){const e=[];Array.from(t.$.sortable.$.container.children).forEach((a=>{const l=Object.assign({},t._HTMLToSourceMap.get(a));l.visible=!0,e.push(l)})),t.$.fireEvent("apply",{value:e,positionChanged:t._positionChanged,moves:t._moves}),t._positionChanged=!1,t._moves=[]}else a.classList.contains("clear-button")&&(t.$.find.value="",t._findKeyupHandler())}_findKeyupHandler(){const e=this;if(e.disabled||e.readonly)return;const t=e.$.find,a=t.value,l=[...e.$.sortable.$.container.children];if(void 0===e._disabledSortable&&(e._disabledSortable=e.$.sortable.disabled),""===a)return t.parentElement.classList.remove("no-results"),e.$.clearButton.classList.add("smart-hidden"),l.forEach((e=>e.classList.remove("smart-hidden"))),e.$.sortable.disabled=e._disabledSortable||e.readonly,void delete e._disabledSortable;let n=!0;e.$.clearButton.classList.remove("smart-hidden"),l.forEach((t=>{-1===e._HTMLToSourceMap.get(t).label.toLowerCase().indexOf(a.toLowerCase())?t.classList.add("smart-hidden"):(t.classList.remove("smart-hidden"),n=!1)})),e.$.sortable.disabled=n,n?t.parentElement.classList.add("no-results"):t.parentElement.classList.remove("no-results")}_sortableDragEndHandler(e){const t=e.detail;this._positionChanged=!0,this._moves.push({oldIndex:t.oldIndex,newIndex:t.newIndex})}_localize(){const e=this;e.$.find.placeholder=e.localize("find"),e.$.reset.innerHTML=e.localize("reset"),e.$.buttonsContainer.firstElementChild.innerHTML=e.localize("cancel"),e.$.buttonsContainer.children[1].innerHTML=e.localize("apply"),e.$.container.firstElementChild.setAttribute("no-results",e.localize("noResults"))}_setFocusable(){const e=this,t=e.disabled||e.unfocusable?-1:0,a=Array.from(e.$.sortable.getElementsByClassName("toggle-visibility"));e.$.find.tabIndex=t,e.$.clearButton.tabIndex=t,e.$.buttonsContainer.firstElementChild.tabIndex=t,e.$.buttonsContainer.children[1].tabIndex=t,a.forEach((e=>e.tabIndex=e.classList.contains("disable-toggle")?-1:t))}}),Smart("smart-formatting-panel",class extends Smart.BaseElement{static get properties(){return{columns:{value:[],type:"array",reflectToAttribute:!1},dataSource:{value:[],type:"any",reflectToAttribute:!1},items:{value:null,type:"array?",reflectToAttribute:!1},dropDownAppendTo:{value:null,type:"any",reflectToAttribute:!1},messages:{value:{en:{add:"Add condition",all:"All columns",apply:"Ok",between:"Between",cancel:"Cancel",close:"Close",column:"Column:",condition:"Condition:",equal:"Equal To",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"Greater Than",highlight:"Highlight",lessThan:"Less Than",notEqual:"Not Equal To",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:"}},type:"object",extend:!0}}}static get listeners(){return{click:"_interactionHandler",keydown:"_interactionHandler",change:"_changeHandler","popup.change":"_changeHandler","popup.click":"_interactionHandler","popup.keydown":"_interactionHandler","document.down":"_documentDownHandler"}}template(){return'<div id="container" role="presentation">\n <div id="itemsContainer" class="smart-formatting-panel-items-container" role="presentation"></div>\n <div id="addNewButton" class="smart-add-new-button" role="button" aria-label="Add new condition"></div>\n <div id="popup" class="smart-formatting-panel-popup smart-hidden smart-visibility-hidden" role="dialog">\n <div id="popupHeader" class="header" role="presentation">\n <div id="text" class="selected" role="button" aria-label="Text color"></div>\n <div id="highlight" role="button" aria-label="Highlight color"></div>\n </div>\n <div id="colorCode" class="color-code"></div>\n <input id="colorInput" type="color" />\n <div id="colorsContainer" class="colors-container"></div>\n <smart-button id="apply" class="ok primary" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n <smart-button id="cancel" class="cancel" animation="[[animation]]" right-to-left="[[rightToLeft]]" theme="[[theme]]" unfocusable="[[unfocusable]]"></smart-button>\n </div>\n </div>'}render(){const e=this,t=getComputedStyle(e);e.setAttribute("role","dialog"),e.$.popup.id=e.id+"Popup",e._basicColors=[[0,0,0],[68,68,68],[102,102,102],[153,153,153],[204,204,204],[238,238,238],[243,243,243],[255,255,255],[255,0,0],[255,153,0],[255,255,0],[0,255,0],[0,255,255],[0,0,255],[153,0,255],[255,0,255],[244,204,204],[252,229,205],[255,242,204],[217,234,211],[208,224,227],[207,226,243],[217,210,233],[234,209,220],[234,153,153],[249,203,156],[255,229,153],[182,215,168],[162,196,201],[159,197,232],[180,167,214],[213,166,189],[224,102,102],[246,178,107],[255,217,102],[147,196,125],[118,165,175],[111,168,220],[142,124,195],[194,123,160],[204,0,0],[230,145,56],[241,194,50],[106,168,79],[69,129,142],[61,133,198],[103,78,167],[166,77,121],[153,0,0],[180,95,6],[191,144,0],[56,118,29],[19,79,92],[11,83,148],[53,28,117],[116,27,71],[102,0,0],[120,63,4],[127,96,0],[39,78,19],[12,52,61],[7,55,99],[32,18,77],[76,17,48]],e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)},t.fontFamily.indexOf("-apple")>=0&&(e._defaults.fontFamily="Segoe UI"),e._localize(),e._setFocusable(),e._populatePopupWithColors(),e._processColumnsAndDataSource(),e._addDefaultItems(),super.render()}attached(){const e=this;super.attached(),e.isCompleted&&e._addDefaultItemsOnAttach&&e._addDefaultItems()}add(e,t){const a=this;if(e&&e.column&&"all"!==e.column&&!a.columns.find((t=>t.dataField===e.column)))return void a.items.splice(t,1);const l=document.createElement("div"),n=a._defaults,i=` animation="${a.animation}"${a.rightToLeft?" right-to-left":""} theme="${a.theme}"${a.unfocusable?" unfocusable":""}`,o=a.disabled||a.unfocusable?"":' tabindex="0"';e=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:n.fontFamily,fontSize:n.fontSize,text:n.text,highlight:n.highlight},e);const r=`\n<div class="value-label">${a.localize("value")}</div>\n<smart-input class="columns-input underlined" data-source='${JSON.stringify(a._columnsInputDataSource)}' placeholder="${a.localize("column")}" readonly value="${a._columnsInputDataSource.find((t=>t.value===e.column)).label}"${i}></smart-input>\n<smart-input class="condition-input underlined" data-source='${a._conditionsDataSource}' placeholder="${a.localize("condition")}" readonly value="${a.localize(e.condition)}"${i}></smart-input>\n<smart-input class="first-value underlined" type="number" placeholder="${a.localize("value")}" value="${e.firstValue}"${i}></smart-input>\n<div class="ampersand">&</div>\n<smart-input class="second-value underlined" type="number" placeholder="${a.localize("secondValue")}" value="${e.secondValue}"${i}></smart-input>\n<div class="close-button" title="${a.localize("close")}"${o} role="button" aria-label="Close"></div>\n<div class="format-label">${a.localize("format")}</div>\n<smart-input class="font-family-input underlined" drop-down-height="auto" placeholder="${a.localize("fontFamily")}" readonly${i}></smart-input>\n<smart-input class="font-size-input underlined" data-source='["8px", "9px", "10px", "11px", "12px", "13px", "14px", "15px", "16px"]' drop-down-height="auto" placeholder="${a.localize("fontSize")}" readonly value="${e.fontSize}"${i}></smart-input>\n<div class="popup-button smart-unselectable"${o} role="button" aria-haspopup="dialog" aria-label="Toggle pop-up">A</div>\n<div class="preview smart-unselectable">2.71828</div>`;l.classList.add("smart-formatting-panel-item"),l.classList.toggle("between","between"===e.condition),l.innerHTML=r,l.columnsInput=l.querySelector(".columns-input"),l.conditionInput=l.querySelector(".condition-input"),l.firstValue=l.querySelector(".first-value"),l.secondValue=l.querySelector(".second-value"),l.closeButton=l.querySelector(".close-button"),l.fontFamilyInput=l.querySelector(".font-family-input"),l.fontFamilyInput.dataSource=[n.fontFamily,"Arial","Verdana","Courier New","Georgia","Times New Roman"],l.fontFamilyInput.value=e.fontFamily,l.fontSizeInput=l.querySelector(".font-size-input"),l.popupButton=l.querySelector(".popup-button"),l.fontFamilyInput=l.querySelector(".font-family-input"),l.preview=l.querySelector(".preview"),l.popupButton.style.color=e.text,l.popupButton.style.backgroundColor=e.highlight,l.preview.style.fontFamily=e.fontFamily,l.preview.style.fontSize=e.fontSize,l.preview.style.color=e.text,l.preview.style.backgroundColor=e.highlight,l.data=e,a.$.itemsContainer.appendChild(l),l.columnsInput.$.input.value||(l.columnsInput.$.input.dataValue="all"),l.conditionInput.$.input.dataValue=e.condition,a._checkScrollBar()}apply(){const e=this,t=new Smart.Utilities.ConditionalFormatter(e.dataSource),a=Array.from(e.$.itemsContainer.children),l=[];let n;if(0===a.length)return;if(e.ownerElement&&"smart-pivot-table"===e.ownerElement.nodeName.toLowerCase()){const t=e.ownerElement._dynamicColumns;n=function(e){return"all"===e?t.map((e=>e.id)):t.filter((t=>t.dataFields[t.dataFields.length-1].dataField===e)).map((e=>e.id))}}else n=function(t){return"all"===t?e._columns.map((e=>e.value)):[t]};for(let e=0;e<a.length;e++){const i=a[e].data,o=n(i.column),r=i.condition;t.color=i.highlight,t.comparator=i.firstValue,t.min=i.firstValue,t.max=i.secondValue;const s=t.format(r,o);for(let e in s){const t=s[e];for(let e in t){const a=t[e];a.color=i.text,a.fontFamily=i.fontFamily,a.fontSize=i.fontSize}}l.push(s)}if(0===l.length)return l[0];const i={};for(let e=0;e<l.length;e++){const t=l[e];for(let e in t){const a=t[e];i[e]||(i[e]={});for(let t in a)i[e][t]=Object.assign({},i[e][t],a[t])}}return i}getItems(){return Array.from(this.$.itemsContainer.children).map((e=>e.data))}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":if(Array.from(l.$.itemsContainer.querySelectorAll(".smart-element")).forEach((t=>t[e]=a)),null!==l.dropDownAppendTo&&(l.$.apply[e]=a,l.$.cancel[e]=a),"theme"===e){const e=getComputedStyle(l);l._defaults.text=l._toHex(e.color),l._defaults.highlight=l._toHex(e.backgroundColor)}break;case"columns":case"items":"columns"===e&&(l._processColumnsAndDataSource(),l.items=null),l.$.itemsContainer.innerHTML="",l._addDefaultItems();break;case"disabled":case"unfocusable":{const t=l.disabled||l.unfocusable,n=Array.from(l.$.itemsContainer.querySelectorAll(".close-button, .popup-button"));"disabled"===e?l._closePopup():null!==l.dropDownAppendTo&&(l.$.apply.unfocusable=a,l.$.cancel.unfocusable=a),l._setFocusable(),Array.from(l.$.itemsContainer.querySelectorAll(".smart-element")).forEach((e=>e.unfocusable=t)),t?n.forEach((e=>e.removeAttribute("tabindex"))):n.forEach((e=>e.setAttribute("tabindex",0)));break}case"dataSource":Smart.DataAdapter&&a instanceof Smart.DataAdapter&&(l.dataSource=a.toArray());break;case"locale":case"messages":l.items=l.getItems(),l.$.itemsContainer.innerHTML="",l._localize(),l._columnsInputDataSource=JSON.parse(JSON.stringify(l._columns.concat([{label:l.localize("all"),value:"all"}]))),l._addDefaultItems()}}_populatePopupWithColors(){const e=this,t=e._basicColors,a=document.createDocumentFragment();for(let l=0;l<t.length;l++){const n=document.createElement("div"),i=t[l],o=`rgb(${i[0]}, ${i[1]}, ${i[2]})`,r=e._toHex(o);n.setAttribute("role","button"),n.setAttribute("aria-label","Select color "+r),n.index=l,n.value=r,n.style.backgroundColor=o,a.appendChild(n)}e.$.colorsContainer.appendChild(a)}_processColumnsAndDataSource(){const e=this,t=e.columns,a=e.dataSource,l=[];Smart.DataAdapter&&a instanceof Smart.DataAdapter&&(e.dataSource=a.toArray());for(let e=0;e<t.length;e++){const a=t[e];"number"===a.dataType&&l.push({label:a.label,value:a.dataField})}e._columns=l,e._columnsInputDataSource=JSON.parse(JSON.stringify(l.concat([{label:e.localize("all"),value:"all"}])))}_addDefaultItems(){const e=this,t=e.items,a=e.getRootNode();a===document||document.body.contains(a)?(t&&t.length>0?t.forEach(((t,a)=>e.add(t,a))):(e.add({condition:"greaterThan",firstValue:100}),e.add({condition:"lessThan",firstValue:0})),delete e._addDefaultItemsOnAttach):e._addDefaultItemsOnAttach=!0}_changeHandler(e){const t=this,a=t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-formatting-panel-item");if(l)if(a!==l.columnsInput){if(a===l.conditionInput)return l.data.condition=a.$.input.dataValue,void l.classList.toggle("between","between"===a.$.input.dataValue);if(l.firstValue.contains(a))l.data.firstValue=parseFloat(a.value);else{if(!l.secondValue.contains(a))return a===l.fontFamilyInput?(l.data.fontFamily=a.value,void(l.preview.style.fontFamily=a.value)):void(a===l.fontSizeInput&&(l.data.fontSize=a.value,l.preview.style.fontSize=a.value));l.data.secondValue=parseFloat(a.value)}}else l.data.column=a.$.input.dataValue;else t.$.popup.contains(a)&&t._updateUI(a.value.toUpperCase())}_checkScrollBar(){this.classList.toggle("scroll",this.$.itemsContainer.offsetHeight<this.$.itemsContainer.scrollHeight)}_interactionHandler(e){const t=this;if(!t.dropDownAppendTo&&e.currentTarget===t.$.popup)return;if("keydown"===e.type){if(-1===[" ","Enter"].indexOf(e.key))return void(t.disabled||t.readonly||t._keydownHandler(e));e.preventDefault()}const a=t.isInShadowDOM?e.composedPath()[0]:e.target;if(a===t.$.addNewButton)return void t.add();const l=a.closest(".smart-formatting-panel-item");if(l)return void(a===l.closeButton?(l.remove(),this._checkScrollBar()):a===l.popupButton&&(t._togglePopup(l),t._activePopupButton=a));const n=t.$.popup;if(n.contains(a)){if(a.parentElement===t.$.colorsContainer)return void t._updateUI(a.value);if(a.parentElement===t.$.popupHeader)a.classList.add("selected"),a===t.$.text?(n.selection="currentText",t.$.highlight.classList.remove("selected")):(n.selection="currentHighlight",t.$.text.classList.remove("selected")),t._updateUI(n[n.selection]);else if(a.classList.contains("smart-button")){if(t.$.apply.contains(a)||a&&a.ownerElement&&a.ownerElement.classList.contains("ok")){const e=n.item;e.data.text=n.currentText,e.data.highlight=n.currentHighlight,e.popupButton.style.color=n.currentText,e.popupButton.style.backgroundColor=n.currentHighlight,e.preview.style.color=n.currentText,e.preview.style.backgroundColor=n.currentHighlight}t._closePopup()}}}_keydownHandler(e){const t=this,a=e.key;if(-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Escape","Home","PageDown","PageUp"].indexOf(a))return;if(e.preventDefault(),"Escape"===a&&!t.$.popup.classList.contains("smart-hidden"))return void t._closePopup();if(t.getRootNode().activeElement!==t.$.colorsContainer)return;const l=Array.from(this.$.colorsContainer.children),n=this.$.colorsContainer.querySelector(".selected");let i,o="ArrowRight",r="ArrowLeft";if(t.rightToLeft&&(o="ArrowLeft",r="ArrowRight"),n){let e=n.index;switch(a){case r:e=Math.max(e-1,e-e%8);break;case o:e=Math.min(e+1,e+8-e%8-1);break;case"ArrowUp":e=Math.max(e-8,e%8);break;case"ArrowDown":e=Math.min(e+8,56+e%8);break;case"Home":e-=e%8;break;case"End":e=e+8-e%8-1;break;case"PageUp":e%=8;break;case"PageDown":e=56+e%8}i=l[e]}else i=l[0];t._updateUI(i.value,i)}_togglePopup(e){const t=this,a=t.$.popup;if(e===a.item)return void t._closePopup();if(a.setAttribute("animation",t.animation),a.setAttribute("theme",t.theme),t.rightToLeft&&a.setAttribute("right-to-left",""),a.classList.contains("smart-hidden")&&a.classList.remove("smart-hidden"),t.dropDownAppendTo)if("body"===t.dropDownAppendTo)document.body.appendChild(a);else{const e=document.querySelector(t.dropDownAppendTo);e&&e.appendChild(a)}const l=e.popupButton,n=l.getBoundingClientRect(),i=l.offsetLeft,o=l.offsetTop,r=a.offsetWidth,s=a.offsetHeight,d=t.$.itemsContainer.scrollTop,c=t._toHex(e.data.text),p=t._toHex(e.data.highlight);n.top>=s+5?a.style.top=o-(s+d+5)+"px":a.style.top=o+n.height-d+5+"px",a.style.left=i+n.width/2-r/2+"px",t.dropDownAppendTo&&(a.style.top=n.bottom+5+"px",a.style.left=n.left+n.width/2-r/2+"px"),t.$.text.classList.add("selected"),t.$.highlight.classList.remove("selected"),t.$.text.focus(),a.item=e,a.selection="currentText",a.currentText=c,a.currentHighlight=p,t._updateUI(c),a.controlledBy&&(a.controlledBy.removeAttribute("aria-controls"),a.controlledBy.removeAttribute("aria-expanded")),l.setAttribute("aria-controls",a.id),l.setAttribute("aria-expanded",!0),a.controlledBy=l,a.classList.remove("smart-visibility-hidden")}_closePopup(){const e=this,t=e.$.popup;"none"!==e.animation?(t.addEventListener("transitionend",(function e(){t.classList.add("smart-hidden"),t.removeEventListener("transitionend",e)})),t.classList.add("smart-visibility-hidden")):(t.classList.add("smart-visibility-hidden"),t.classList.add("smart-hidden")),delete t.item,e._activePopupButton&&e._activePopupButton.focus(),t.controlledBy&&(t.controlledBy.removeAttribute("aria-controls"),t.controlledBy.removeAttribute("aria-expanded"))}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_updateUI(e,t){const a=this;a.$.colorInput.value=e,a.$.colorCode.innerHTML=e,a._selectColor(e,t)}_selectColor(e,t){const a=this.$.popup,l=Array.from(this.$.colorsContainer.children);l.forEach((e=>e.classList.remove("selected"))),(t=t||l.find((t=>t.value===e)))&&t.classList.add("selected"),a[a.selection]=e}_localize(){const e=this;e._conditionsDataSource=JSON.stringify([{label:e.localize("lessThan"),value:"lessThan"},{label:e.localize("greaterThan"),value:"greaterThan"},{label:e.localize("equal"),value:"equal"},{label:e.localize("notEqual"),value:"notEqual"},{label:e.localize("between"),value:"between"}]),e.$.text.innerHTML=e.localize("text"),e.$.highlight.innerHTML=e.localize("highlight"),e.$.apply.innerHTML=e.localize("apply"),e.$.cancel.innerHTML=e.localize("cancel"),e.$.addNewButton.title=e.localize("add")}_setFocusable(){const e=this,t=!e.disabled&&!e.unfocusable,a=[e.$.addNewButton,e.$.text,e.$.highlight,e.$.colorsContainer];t?(a.forEach((e=>e.setAttribute("tabindex",0))),e.$.colorInput.removeAttribute("tabindex")):(a.forEach((e=>e.removeAttribute("tabindex"))),e.$.colorInput.setAttribute("tabindex",-1))}_documentDownHandler(e){const t=this,a=t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target,l=t.$.popup;l.classList.contains("smart-hidden")||l.contains(a)||a.classList.contains("popup-button")||(delete t._activePopupButton,t._closePopup())}}),Smart("smart-data-view",class extends Smart.BaseElement{static get properties(){return{addNewButton:{value:!1,type:"boolean"},allowDrag:{value:!1,type:"boolean"},collapsible:{value:!1,type:"boolean"},columns:{value:[],type:"object",reflectToAttribute:!1},dataSource:{value:null,type:"object?",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},editable:{value:!1,type:"boolean"},headerPosition:{value:"none",allowedValues:["none","top","bottom"],type:"string"},messages:{value:{en:{addFilter:"+ Add filter",and:"And",apply:"Ok",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Customize Columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",sort:"Sort",group:"Group",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",formatColumn:"Format Column",formating:"Conditional Formating",sortedByMultiple:"Sorted by {{n}} fields",sortedByOne:"Sorted by 1 field",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",firstByGroup:"Group by",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"Equal To",greaterThan:"Greater Than",highlight:"Highlight",lessThan:"Less Than",notEqual:"Not Equal To",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",reset:"Reset"}}}}}static get listeners(){return{"header.apply":"_applyHandler","header.cancel":"closePanel","headerDropDown.transitionend":"_headerDropDownTransitionendHandler","searchInput.keyup":"_searchInputKeyupHandler",resize:"_resizeHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler"}}render(){const e=this;e.$.headerDropDown.id||(e.$.headerDropDown.id=e.id+"HeaderDropDown"),e.setAttribute("role","group"),e._isMobile=Smart.Utilities.Core.isMobile,super.render()}addFilter(e,t="and"){const a=this;if(!Array.isArray(e)||e.length>0&&!Array.isArray(e[0]))return;let l;a.closePanel(),arguments[2]?l={filters:arguments[2],operator:t}:(l={filters:[],operator:t},e.forEach((e=>{e[1].filters.forEach((t=>{l.filters.push([e[0],t.condition,t.value])}))}))),JSON.stringify(l)!==JSON.stringify(a._appliedFiltering)&&(l.filterGroups=e,a._appliedFiltering=l,a._applyFilter(e,t),a.$.fireEvent("filter"),a._refreshFilterButton())}_refreshFilterButton(){const e=this,t=e._appliedFiltering.filters?e._appliedFiltering.filters.length:0;if(0===t)return e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"),void e.$.filterButton.classList.remove("filtered");e.$.filterButton.firstElementChild.innerHTML=1===t?e.localize("filteredByOne"):e.localize("filteredByMultiple",{n:t}),e.$.filterButton.classList.add("filtered")}addSort(e,t){const a=this,l=a.dataSource,n=JSON.stringify(a._appliedSorting);let i;function o(e,n){if(a.columns.find((t=>t.dataField===e))){let a=Array.isArray(t)?t[n]:"string"==typeof t?t:"ascending";i.dataFields.push(e),i.dataTypes.push(l.dataFields.find((t=>t.name===e)).dataType),a=a&&-1!==a.indexOf("desc")?"descending":"ascending",i.orderBy.push(a)}}if(0!==arguments.length&&l&&0!==l.length){if(a.closePanel(),1===arguments.length&&"object"==typeof e)i=e;else if(i={dataFields:[],dataTypes:[],orderBy:[]},Array.isArray(e))e.forEach(o);else{if("string"!=typeof e)return;o(e,0)}a.closePanel(),a._appliedSorting=i,n!==JSON.stringify(a._appliedSorting)&&(a._applySort(),a.$.fireEvent("sort"),a._refreshSortButton())}}_refreshSortButton(){const e=this,t=e._appliedSorting.dataFields.length;return 0===t||e.grid&&!1===e.grid.sorting.maintainSort?(e.$.sortButton.firstElementChild.innerHTML=e.localize("sort"),void e.$.sortButton.classList.remove("sorted")):(e.$.sortButton.firstElementChild.innerHTML=1===t?e.localize("sortedByOne"):e.localize("sortedByMultiple",{n:t}),void e.$.sortButton.classList.add("sorted"))}closePanel(){const e=this.$.headerDropDown;e.classList.remove("open"),setTimeout((()=>{e.classList.add("smart-visibility-hidden")}),150),this._closeSearchPanel(),e.controlledBy&&(e.controlledBy.removeAttribute("aria-controls"),e.controlledBy.setAttribute("aria-expanded",!1),delete e.controlledBy)}_closeSearchPanel(){const e=this;e._searchInfo&&delete e._searchInfo}_closeDialog(){const e=this;e._editInfo&&e._editInfo.window.close()}openFormatPanel(){}openFilterPanel(e,t){const a=this,l=a.dataSource;if(!l||0===l.length&&!l.virtualDataSource||a.disabled||"none"===a.headerPosition)return;let n;a._editInfo&&a._editInfo.window.close(),a.$.headerDropDown.classList.add("filter-panel"),a.$.headerDropDown.classList.remove("customize-panel","colors-panel","sort-panel","search-panel","format-panel"),a.$.filter.classList.remove("smart-hidden"),a.$.customize.classList.add("smart-hidden"),a.$.sort.classList.add("smart-hidden"),a.$.colors.classList.add("smart-hidden"),a.$.format&&a.$.format.classList.add("smart-hidden"),a.$.group&&a.$.group.classList.add("smart-hidden"),a.$.search.classList.add("smart-hidden"),a._closeSearchPanel(),a._filterPartCreated?(n=a.$.filter.firstElementChild,n.set("dataSource",e),n.set("locale",a.locale),n.messages=a._innerElementMessages.multiColumnFilterPanel,n.operator=a._appliedFiltering.operator,n.editorPlaceholder=a.localize("filterValuePlaceholder"),n.set("operator",a._appliedFiltering.operator),n.set("value",a._appliedFiltering.filters),n._applyValue(),n.rightToLeft=a.rightToLeft):(n=document.createElement("smart-multi-column-filter-panel"),n.rightToLeft=a.rightToLeft,n.animation=a.animation,n.dataSource=e,n.locale=a.locale,n.messages=a._innerElementMessages.multiColumnFilterPanel,n.operator=a._appliedFiltering.operator,n.editorPlaceholder=a.localize("filterValuePlaceholder"),n.theme=a.theme,n.value=a._appliedFiltering.filters,n.editorCallback=t,a.$.filter.appendChild(n),a._filterPartCreated=!0),a._openHeaderDropDown(a.$.filterButton)}openColorsPanel(e,t,a){const l=this,n=l.dataSource;if(!n||0===n.length&&!n.virtualDataSource||l.disabled||"none"===l.headerPosition)return;let i;l._editInfo&&l._editInfo.window.close(),l.$.headerDropDown.classList.add("colors-panel"),l.$.headerDropDown.classList.remove("filter-panel","group-panel","customize-panel","sort-panel","search-panel","format-panel"),l.$.colors.classList.remove("smart-hidden"),l.$.customize.classList.add("smart-hidden"),l.$.filter.classList.add("smart-hidden"),l.$.sort.classList.add("smart-hidden"),l.$.filter&&l.$.filter.classList.add("smart-hidden"),l.$.group&&l.$.group.classList.add("smart-hidden"),l.$.search.classList.add("smart-hidden"),l._closeSearchPanel(),l._colorsPartCreated?(i=l.$.colors.firstElementChild,i.set("dataSource",e),i.set("locale",l.locale),i.messages=l._innerElementMessages.multiColumnFilterPanel,i.operator="or",i.editorPlaceholder=l.localize("filterValuePlaceholder"),i.set("operator","or"),l._appliedColors||(l._appliedColors=[]),i.set("value",l._appliedColors),i._applyValue(),i.rightToLeft=l.rightToLeft):(i=document.createElement("smart-colors-panel"),i.rightToLeft=l.rightToLeft,i.animation=l.animation,i.dataSource=e,i.locale=l.locale,i.messages=l._innerElementMessages.multiColumnFilterPanel,i.operator="or",i.editorPlaceholder=l.localize("filterValuePlaceholder"),i.theme=l.theme,i.editorCallback=t,i.ownerElement=a,l._appliedColors&&i.set("value",l._appliedColors),l.$.colors.appendChild(i),l._colorsPartCreated=!0),l._openHeaderDropDown(l.$.colorsButton)}openSortPanel(e){const t=this,a=t.dataSource;if(!a||0===a.length&&!a.virtualDataSource||t.disabled||"none"===t.headerPosition)return;let l;t._closeDialog(),t.$.headerDropDown.classList.add("sort-panel"),t.$.headerDropDown.classList.remove("customize-panel","filter-panel","format-panel","search-panel"),t.$.sort.classList.remove("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.colors.classList.add("smart-hidden"),t.$.format&&t.$.format.classList.add("smart-hidden"),t.$.group&&t.$.group.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t._closeSearchPanel(),t._sortPartCreated?(l=t.$.sort.firstElementChild,l.rightToLeft=t.rightToLeft,l.dataSource=e,l.locale=t.locale,l.messages=t._innerElementMessages.sortPanel,l.set("dataSource",e),l.propertyChangedHandler("dataSource",void 0,e)):(l=document.createElement("smart-sort-panel"),l.rightToLeft=t.rightToLeft,l.animation=t.animation,l.dataSource=e,l.locale=t.locale,l.messages=t._innerElementMessages.sortPanel,l.theme=t.theme,t.$.sort.appendChild(l),t._sortPartCreated=!0),t._openHeaderDropDown(t.$.sortButton)}removeFilter(){this.addFilter([])}removeSort(){this.addSort({dataFields:[],dataTypes:[],orderBy:[]})}_clearFilterAndSortUI(){const e=this;e._appliedFiltering={filterGroups:[],filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._appliedGrouping={dataFields:[]},e._appliedColors=[[],{type:"conditions",decorate:"border",singleSelect:""}],e.$.filterButton.classList.remove("filtered"),e.$.sortButton.classList.remove("sorted"),e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"),e.$.sortButton.firstElementChild.innerHTML=e.localize("sort")}_getInnerElementMessages(){const e=this,t=e.locale,a={columnPanel:{},groupPanel:{},multiColumnFilterPanel:{},sortPanel:{},formattingPanel:{},dateTimePicker:{}};a.formattingPanel[t]={add:e.localize("add"),all:e.localize("all"),apply:e.localize("apply"),between:e.localize("between"),cancel:e.localize("cancel"),close:e.localize("close"),column:e.localize("column"),condition:e.localize("condition"),equal:e.localize("equal"),fontFamily:e.localize("fontFamily"),fontSize:e.localize("fontSize"),format:e.localize("format"),greaterThan:e.localize("greaterThan"),highlight:e.localize("highlight"),lessThan:e.localize("lessThan"),notEqual:e.localize("notEqual"),remove:e.localize("remove"),secondValue:e.localize("secondValue"),text:e.localize("text"),value:e.localize("value")},a.columnPanel[t]={apply:e.localize("apply"),cancel:e.localize("cancel"),reset:e.localize("reset"),find:e.localize("find"),noResults:e.localize("noResults")},a.groupPanel[t]={apply:e.localize("apply"),cancel:e.localize("cancel"),collapseAll:e.localize("collapseAll"),expandAll:e.localize("expandAll"),firstBy:e.localize("firstByGroup"),noGrouping:e.localize("noGrouping"),pickAnother:e.localize("pickAnotherGroupBy"),stringFirst:e.localize("stringFirst"),stringLast:e.localize("stringLast"),thenBy:e.localize("thenBy"),from:e.localize("from"),booleanFirst:e.localize("booleanFirst"),booleanLast:e.localize("booleanLast"),dateFirst:e.localize("dateFirst"),dateLast:e.localize("dateLast"),numberFirst:e.localize("numberFirst"),numberLast:e.localize("numberLast")},a.multiColumnFilterPanel[t]={addFilter:e.localize("addFilter"),noResults:e.localize("noResults"),add:"+ "+e.localize("add"),select:e.localize("dialogAddColumnTypeSelect"),condition:e.localize("conditions"),and:e.localize("and"),apply:e.localize("apply"),cancel:e.localize("cancel"),CONTAINS:e.localize("CONTAINS"),CONTAINS_CASE_SENSITIVE:e.localize("CONTAINS_CASE_SENSITIVE"),DOES_NOT_CONTAIN:e.localize("DOES_NOT_CONTAIN"),DOES_NOT_CONTAIN_CASE_SENSITIVE:e.localize("DOES_NOT_CONTAIN_CASE_SENSITIVE"),EMPTY:e.localize("EMPTY"),ENDS_WITH:e.localize("ENDS_WITH"),ENDS_WITH_CASE_SENSITIVE:e.localize("ENDS_WITH_CASE_SENSITIVE"),EQUAL:e.localize("EQUAL"),EQUAL_CASE_SENSITIVE:e.localize("EQUAL_CASE_SENSITIVE"),GREATER_THAN:e.localize("GREATER_THAN"),GREATER_THAN_OR_EQUAL:e.localize("GREATER_THAN_OR_EQUAL"),LESS_THAN:e.localize("LESS_THAN"),LESS_THAN_OR_EQUAL:e.localize("LESS_THAN_OR_EQUAL"),noFilters:e.localize("noFilters"),NOT_EMPTY:e.localize("NOT_EMPTY"),NOT_EQUAL:e.localize("NOT_EQUAL"),NOT_NULL:e.localize("NOT_NULL"),NULL:e.localize("NULL"),or:e.localize("or"),STARTS_WITH:e.localize("STARTS_WITH"),STARTS_WITH_CASE_SENSITIVE:e.localize("STARTS_WITH_CASE_SENSITIVE"),where:e.localize("where"),TOMORROW:e.localize("TOMORROW"),TODAY:e.localize("TODAY"),YESTERDAY:e.localize("YESTERDAY"),THIS_WEEK:e.localize("THIS_WEEK"),LAST_WEEK:e.localize("LAST_WEEK"),NEXT_WEEK:e.localize("NEXT_WEEK"),THIS_MONTH:e.localize("THIS_MONTH"),LAST_MONTH:e.localize("LAST_MONTH"),NEXT_MONTH:e.localize("NEXT_MONTH"),conditions:e.localize("conditions"),colorsSingleSelect:e.localize("colorsSingleSelect"),colorRows:e.localize("colorRows"),colorSelect:e.localize("colorSelect"),colorLeftBorderLabel:e.localize("colorLeftBorderLabel"),colorRowLabel:e.localize("colorRowLabel"),colorCellLabel:e.localize("colorCellLabel"),colorLeftBorder:e.localize("colorLeftBorder"),colorRow:e.localize("colorRow"),colorCell:e.localize("colorCell"),noOptions:e.localize("noOptions")},a.sortPanel[t]={apply:e.localize("apply"),applyOnce:e.localize("applyOnce"),booleanFirst:e.localize("booleanFirst"),booleanLast:e.localize("booleanLast"),cancel:e.localize("cancel"),dateFirst:e.localize("dateFirst"),dateLast:e.localize("dateLast"),firstBy:e.localize("firstBy"),from:e.localize("from"),numberFirst:e.localize("numberFirst"),numberLast:e.localize("numberLast"),noSorting:e.localize("noSorting"),pickAnother:e.localize("pickAnother"),maintainSort:e.localize("maintainSort"),stringFirst:e.localize("stringFirst"),stringLast:e.localize("stringLast"),thenBy:e.localize("thenBy")},a.dateTimePicker[t]={now:e.localize("now"),dateTabLabel:e.localize("dateTabLabel"),timeTabLabel:e.localize("timeTabLabel")},e._innerElementMessages=a}_handleHeaderPosition(e){const t=this,a=t.headerPosition,l=t.$.header;"none"!==a?(l.classList.remove("smart-hidden"),"top"===a&&l.nextElementSibling!==e?t.$.container.insertBefore(l,e):"bottom"===a&&l.previousElementSibling!==e&&t.$.container.insertBefore(l,t.$.loadingIndicatorContainer)):l.classList.add("smart-hidden")}_headerClickHandler(e){const t=this,a=t.$.headerDropDown;function l(e,l){a.classList.contains("smart-visibility-hidden")||e.classList.contains("smart-hidden")?t[l]():t.closePanel()}if(t.$.customizeButton.contains(e))l(t.$.customize,"openCustomizePanel");else if(t.$.filterButton.contains(e))l(t.$.filter,"openFilterPanel");else if(t.$.sortButton.contains(e))l(t.$.sort,"openSortPanel");else if(t.$.formatButton&&t.$.formatButton.contains(e))l(t.$.format,"openFormatPanel");else if(t.$.colorsButton&&t.$.colorsButton.contains(e))l(t.$.colors,"openColorsPanel");else if(e===t.$.searchButton)l(t.$.search,"_openSearchPanel");else if(t.$.groupButton&&t.$.groupButton.contains(e))l(t.$.group,"openGroupPanel");else if(t.$.viewStatesButton&&t.$.viewStatesButton.contains(e))l(t.$.view,"openViewPanel");else if(e===t.$.searchClose)t.$.searchInput.value="",t._search("",!1),t.closePanel();else if(e===t.$.searchPrev||e===t.$.searchNext){const a=t._searchInfo,l=a.foundIdsArray,n=e===t.$.searchNext,i=l.length;let o;if(void 0===a.highlighted)o=n?0:i-1;else{if(1===l.length)return;{const e=l.indexOf(a.highlighted);o=n?(e+1)%i:e-1>=0?e-1:i-1}}a.highlighted=l[o],t.grid?(t.grid.highlighted=a.highlighted,t.grid.ensureVisible(a.highlighted),t.grid._recycle(!1)):t.ensureVisible&&t.ensureVisible(a.highlighted),t.$.searchLabel.innerHTML=t.localize("found",{nth:o+1,n:l.length})}}_headerDropDownTransitionendHandler(e){const t=this,a=t.$.headerDropDown;t._openTimer=setTimeout((()=>{e&&("visibility"!==e.propertyName||a.classList.contains("smart-visibility-hidden"))||(a.classList.contains("search-panel")?t.$.searchInput.focus():!1===t.unfocusable&&(!t._isMobile&&a.classList.contains("customize-panel")?a.querySelector("smart-column-panel").$.find.focus():a.classList.contains("filter-panel")?a.querySelector("smart-multi-column-filter-panel").$.addFilterButton.focus():a.classList.contains("sort-panel")&&a.querySelector("smart-sort-panel").$.inputNotSorted.focus()))}),100)}_localizeHeader(){const e=this;e.$.customizeButton.firstElementChild.innerHTML=e.localize("customize"),e.$.groupButton&&(e.$.groupButton.firstElementChild.innerHTML=e.localize("group")),0===e._appliedFiltering.filters.length?e.$.filterButton.firstElementChild.innerHTML=e.localize("filter"):1===e._appliedFiltering.filters.length?e.$.filterButton.firstElementChild.innerHTML=e.localize("filteredByOne"):e.$.filterButton.firstElementChild.innerHTML=e.localize("filteredByMultiple",{n:e._appliedFiltering.filters.length}),0===e._appliedSorting.dataFields.length?e.$.sortButton.firstElementChild.innerHTML=e.localize("sort"):1===e._appliedSorting.dataFields.length?e.$.sortButton.firstElementChild.innerHTML=e.localize("sortedByOne"):e.$.sortButton.firstElementChild.innerHTML=e.localize("sortedByMultiple",{n:e._appliedSorting.dataFields.length}),e.$.formatButton&&(e.$.formatButton.firstElementChild.innerHTML=e.localize("formating")),e.$.searchInput.placeholder=e.localize("findInView")}_openHeaderDropDown(e){const t=this,a=t.$.headerDropDown;"top"===t.headerPosition?(a.style.bottom=null,a.style.top="100%"):(a.style.top=null,a.style.bottom="100%"),e!==t.$.searchButton||e===t.$.searchButton&&t.rightToLeft?a.style.left=e.offsetLeft-(t.rightToLeft?a.offsetWidth-e.offsetWidth:0)+"px":a.style.left=(t.rightToLeft?e.offsetLeft:e.offsetLeft+Math.max(25,e.offsetWidth)-a.offsetWidth)+"px",a.classList.remove("smart-visibility-hidden"),a.classList.add("open"),a.controlledBy&&(a.controlledBy.removeAttribute("aria-controls"),a.controlledBy.setAttribute("aria-expanded",!1)),a.controlledBy=e,e.setAttribute("aria-controls",a.id),e.setAttribute("aria-expanded",!0),t._headerDropDownTransitionendHandler()}_searchInputKeyupHandler(e){const t=this;function a(){t._searchInfo&&t.$.searchInput.value!==t._searchInfo.query&&t._search(t.$.searchInput.value)}return clearTimeout(t._searchInputTimeout),"Escape"===e.key?(t.$.searchInput.value="",a(),void t.closePanel()):"Enter"===e.key&&t._searchInfo.foundIdsArray&&t._searchInfo.foundIdsArray.length>1?(a(),void t._headerClickHandler(t.$.searchNext,t.$.cardContainer||t.$.body)):void(t._searchInputTimeout=setTimeout(a,500))}}),Smart("smart-colors-panel",class extends Smart.BaseElement{static get properties(){return{closeButtonPosition:{value:"left",allowedValues:["left","right"],type:"string"},dataSource:{value:[],type:"array",reflectToAttribute:!1},editorCallback:{value:null,type:"function?",reflectToAttribute:!1},editorPlaceholder:{value:"Value",type:"string"},messages:{value:{en:{addFilter:"+ Add decorator",and:"And",apply:"Ok",cancel:"Cancel",CONTAINS:"contains",CONTAINS_CASE_SENSITIVE:"contains (case sensitive)",DOES_NOT_CONTAIN:"does not contain",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH:"ends with",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL:"equal",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",GREATER_THAN:"greater than",GREATER_THAN_OR_EQUAL:"greater than or equal",LESS_THAN:"less than",LESS_THAN_OR_EQUAL:"less than or equal",noFilters:"No filters applied",NOT_EMPTY:"not empty",NOT_EQUAL:"not equal",NOT_NULL:"not null",NULL:"null",or:"Or",STARTS_WITH:"starts with",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",where:"Where",TOMORROW:"Tomorrow",TODAY:"Today",YESTERDAY:"Yesterday",NEXT_WEEK:"Next week",THIS_WEEK:"This week",LAST_WEEK:"Last week",NEXT_MONTH:"Next month",THIS_MONTH:"This month",LAST_MONTH:"Last month"}},type:"object",extend:!0},operator:{value:"and",allowedValues:["and","or"],type:"string"},value:{value:[],type:"array"}}}static get listeners(){return{change:"_changeHandler",click:"_interactionHandler",keydown:"_interactionHandler"}}static get requires(){return{"Smart.Button":"smart.button.js","Smart.CheckBox":"smart.checkbox.js","Smart.DateTimePicker":"smart.datetimepicker.js","Smart.FilterGroup":"smart.filter.js","Smart.Input":"smart.input.js","Smart.NumericTextBox":"smart.numerictextbox.js"}}static get styleUrls(){return["smart.gridpanel.css"]}template(){return'<div id="container" role="presentation">\n <div id="gridLayout">\n <div style="border-right: 1px solid var(--smart-border)" class="tabs" id="tabs">\n <div title="Color rows when they match the conditions" class="tab active" id="condition"></div>\n <div title="Color rows the same as a single select value" class="tab" id="select"></div>\n </div>\n <div style="margin-left: 10px;" id="applyTo"></div>\n </div>\n <div>\n\n <span id="conditionLabel">Color rows when they match the conditions</span>\n <div id="singleSelectLabel" class="smart-hidden">Which single select field should the row be colored by?</div>\n <smart-input style="margin-top: 10px; margin-bottom: 10px; width: 250px; display: block;" selected-index="0" class="underlined smart-hidden" readonly id="singleSelect"></smartinput>\n </div>\n <div id="itemsContainer" style="padding-top: 0px;" class="smart-filter-panel-items-container smart-unselectable"></div>\n <div id="footer" class="smart-grid-panel-container-footer" role="presentation">\n <div id="addFilterButton" class="smart-filter-panel-add-filter-button smart-unselectable" role="button"></div>\n <div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation">\n <span class="smart-grid-panel-cancel-button" role="button"></span>\n <span class="smart-grid-panel-apply-button primary" role="button"></span>\n </div>\n </div>'}ready(){super.ready()}updateSingleSelect(){const e=this,t=e.ownerElement.columns.filter((e=>!!e.template&&!("tags"!==e.template&&"collaborator"!==e.template&&"dropdownlist"!==e.template&&"list"!==e.template||!e.editor.singleSelect))).map((e=>({label:e.label,value:e.dataField})));e.$.singleSelect.dataSource=t,e.$.singleSelect.selectedValue=t[0]?t[0].value:""}render(){const e=this;e.setAttribute("role","dialog"),e.$.gridLayout.style.display="grid",e.$.gridLayout.style.gridTemplateColumns="400px auto",e.$.gridLayout.style.gridColumnGap="1rem",e.$.gridLayout.style.overflow="hidden",e.$.condition.onclick=()=>{e.$.select.classList.remove("active"),e.$.condition.classList.add("active"),e.$.singleSelectLabel.classList.add("smart-hidden"),e.$.singleSelect.classList.add("smart-hidden"),e.$.addFilterButton.classList.remove("smart-visibility-hidden"),e.$.itemsContainer.classList.remove("smart-hidden"),e.$.conditionLabel.classList.remove("smart-hidden"),e.$.singleSelect.classList.add("smart-hidden"),e.$.applyToInput.dataSource[2].visible=!0},e.$.select.onclick=()=>{e.$.select.classList.add("active"),e.$.condition.classList.remove("active"),e.$.singleSelectLabel.classList.remove("smart-hidden"),e.$.singleSelect.classList.remove("smart-hidden"),e.$.addFilterButton.classList.add("smart-visibility-hidden"),e.$.itemsContainer.classList.add("smart-hidden"),e.$.conditionLabel.classList.add("smart-hidden"),e.$.singleSelect.classList.remove("smart-hidden"),e.$.applyToInput.dataSource[2].visible=!1,2===e.$.applyToInput.selectedIndex&&(e.$.applyToInput.selectedIndex=0)};const t=document.createElement("smart-input");t.readonly=!0,t.dropDownButtonPosition="right",t.dropDownAppendTo="body",t.style.width="100%",e.$.singleSelect.dropDownButtonPosition="right",e.$.singleSelect.dropDownAppendTo="body",e.updateSingleSelect();const a="var(--smart-primary);";t.dataSource=[{label:"Left border",value:"border",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Left border</div><div class="smart-quiet">Color the left border of a row</div>',prefix:'<span style="top: 8px; border-right: 3px solid '+a+'; padding: 2px; display: inline-block; margin-right: 16px; position: relative;">1</span>'},{label:"Row",value:"row",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Row background</div><div class="smart-quiet">Color the background of a row</div>',prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border: 1px solid var(--smart-primary); color: var(--smart-primary-color); top: 8px; background: '+a+'; padding: 2px; display: inline-block; margin-right: 8px; position: relative;">2</span>'},{label:"Cell",value:"cell",menuLabel:'<div style="flex-direction: column; display: inline-flex"><div>Cell background</div><div class="smart-quiet">Color the background of a cell</div>',prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border:1px solid '+a+'; padding: 2px; display: inline-block; top: 8px; margin-right: 8px; position: relative;">2</span>'}],e.$.applyTo.appendChild(t),e.$.applyToInput=t,e._setFocusable(),e._localize(),e.$.applyToInput.selectedIndex=0,e._applyValue(),super.render()}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const l=this;switch(e){case"animation":case"theme":case"rightToLeft":Array.from(l.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input")).forEach((t=>{t[e]=a,"smart-input"===t.tagName.toLowerCase()&&"rightToLeft"===e&&"none"!==t.dropDownButtonPosition&&(t.dropDownButtonPosition=a?"left":"right")}));break;case"disabled":case"unfocusable":l._setFocusable(!0);break;case"dataSource":case"value":l._applyValue();break;case"editorPlaceholder":Array.from(l.$.itemsContainer.getElementsByClassName("editor")).forEach((e=>e.placeholder=a));break;case"locale":case"messages":l._localize(!0);break;case"operator":l._setOperator()}}_setOperator(){const e=this,t=e.localize(e.operator);for(let a=2;a<e._items.length;a++)e._items[a].children[1].innerHTML=t}_changeHandler(e){const t=this,a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(a instanceof Smart.Input==0)return;const l=a.parentElement,n=l.children;if(a===n[1])t.operator=a.$.input.dataValue,t._setOperator();else if(a===n[2]){let a,i,o=t.dataSource.find((t=>t.dataField===e.detail.oldValue)).dataType,r=t.dataSource.find((t=>t.dataField===e.detail.oldValue)),s=t.dataSource.find((t=>t.dataField===e.detail.value)),d=s.dataType,c=[];if(s.options&&(d="enum",c=s.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),r&&r.options&&(o="enum"),"enum"!==d&&d===o)return void(t.editorCallback&&t.editorCallback(n[4],s));let p=n[3]?n[3].value:"";switch(d){case"date":a=t._dateConditions,i=document.createElement("smart-date-time-picker"),i.calendarButton=!0,i.dropDownAppendTo="body",i.dropDownDisplayMode="auto",i.formatString="M/d/yy H:mm",p="";break;case"number":a=t._numberAndDateConditions,i=document.createElement("smart-numeric-text-box"),p="";break;case"boolean":a=t._booleanConditions,i=document.createElement("smart-check-box"),p="";break;case"enum":a=t._enumConditions,i=document.createElement("smart-input"),i.dataSource=c.length?c:s.options,i.readonly=!0,i.dropDownButtonPosition="right",p=a[0];break;default:a=t._stringConditions,p=t._stringConditions.find((e=>"CONTAINS"===e.value)),i=document.createElement("smart-input")}a.forEach((e=>{delete e.selected})),i.rightToLeft=t.rightToLeft,i.animation=t.animation,i.theme=t.theme,i.unfocusable=t.disabled||t.unfocusable,i.classList.add("underlined"),i.dataSource&&i.dataSource.length<10?i.dropDownHeight="auto":i.dropDownHeight=250,"boolean"!==d&&(i.placeholder=t.editorPlaceholder),t.editorCallback&&t.editorCallback(i,s),n[4]&&n[4].remove(),l.appendChild(i),""===p||a.find((e=>e.label===p))||(p.value?(n[3].value=p.label,n[3].selectedValue=p.value):(n[3].value="",n[3].selectedValue="")),n[3].dataSource=a,""===p&&(n[3].value=a[0].label,n[3].selectedValue=a[0].value),a.length>=10?n[3].dropDownHeight=250:n[3].dropDownHeight="auto",l.dataType=d}else if(a===n[3]){const e=n[4],t=a.$.input.dataValue;-1!==t.indexOf("NULL")||-1!==t.indexOf("EMPTY")||-1!==t.indexOf("THIS_WEEK")||-1!==t.indexOf("LAST_WEEK")||-1!==t.indexOf("NEXT_WEEK")||-1!==t.indexOf("THIS_MONTH")||-1!==t.indexOf("LAST_MONTH")||-1!==t.indexOf("NEXT_MONTH")||-1!==t.indexOf("THIS_YEAR")||-1!==t.indexOf("LAST_YEAR")||-1!==t.indexOf("NEXT_YEAR")||-1!==t.indexOf("TODAY")||-1!==t.indexOf("TOMORROW")||-1!==t.indexOf("YESTERDAY")?(e.value="",e.checked=!1,e.classList.add("smart-visibility-hidden")):e.classList.remove("smart-visibility-hidden"),a.condition=t}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#0B8043","#33B679","#3F51B5","#039BE5","#7986CB","#8C47FF","#8E24AA","#FF36C2","#616161","#454545","#949494","#000000"],e.additionalColors=["#FF9EB7","#FF9EB7","#FFD66D","#FFEBB6","#93DF89","#D1F7C4","#9DC7FF","#D0F0FD","#CDAFFF","#ECE1FD","#FA9DE2","#FFDAF6","#CBCBCB","#EDEDED","#FFFFFF",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;e.querySelector(".smart-color-box").style.borderRadius="50%",t&&t.classList.add("smart-grid-color-input")},e}_interactionHandler(e){const t=this;if(t.disabled||t.readonly)return;if("keydown"===e.type){if("Enter"!==e.key)return;e.preventDefault()}const a=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target,l=a.closest(".smart-grid-panel-item");if(l){if(a===l.firstElementChild){const e=t._items.indexOf(l);let a;if(t._items.splice(e,1),l.remove(),t._items.length>0&&e<2){if(0===e){t._items[0].children[1].remove(),a=document.createElement("div"),a.innerHTML=t.localize("where");const e=t._getColorInput();t._items[0].insertBefore(e,t._items[0].children[1])}t._items.length>1&&(t._items[1].children[1].remove(),a=document.createElement("smart-input"),a.className="underlined",a.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],a.dropDownButtonPosition=t.rightToLeft?"left":"right",a.readonly=!0,a.value=t.localize(t.operator),a.animation=t.animation,a.theme=t.theme,a.rightToLeft=t.rightToLeft,a.unfocusable=t.disabled||t.unfocusable,t._items[1].insertBefore(a,t._items[1].children[1]))}}}else if(a===t.$.addFilterButton&&t.dataSource.length>0)t.$.itemsContainer.appendChild(t._createItem(t.dataSource[0],"","",t._items.length));else if(a!==t.$.buttonsContainer.firstElementChild){if(a===t.$.buttonsContainer.children[1]){let e=t._stringConditions.concat(t._dateConditions),a=t.operator,l=[],n={},i=[];t._customConditions&&(e=e.concat(t._customConditions)),t._items.forEach((i=>{const o=t.dataSource.find((e=>e.label===i.children[2].value)),r=[];let s=i.children[3].value;if(""===s)return;let d=o.dataType;s=e.find((e=>e.label===s)).value;const c=i.querySelector("smart-color-input").value;if(r.push(o.dataField,s),-1===s.indexOf("NULL")&&-1===s.indexOf("EMPTY"))if("boolean"===d)r.push(i.children[4].checked);else if("date"===d)r.push(i.children[4].value.toDate());else if("enum"===d||o.options){let e=i.children[4].$.input.dataValue;if(void 0===e){const t=o.options.find((e=>e.label===i.children[4].value));if(!t)return;e=t.value}d="string",r.push(e)}else r.push(i.children[4].value);r.push(c);let p=n[r[0]];void 0===p&&(p=new Smart.Utilities.FilterGroup,n[r[0]]=p);const u=p.createFilter(d,r[2],r[1]);p.addFilter(a,u),l.push(r)}));for(let e in n)i.push([e,n[e]]);const o={};o.type=t.$.condition.classList.contains("active")?"conditions":"singleSelect",o.decorate=t.$.applyToInput.selectedValue,o.singleSelect=t.$.singleSelect.selectedValue,null===o.decorate&&(o.decorate="border"),t.value=l,t.$.fireEvent("apply",{filters:i,decorator:o,value:l})}}else t.$.fireEvent("cancel")}_applyValue(){const e=this,t=document.createDocumentFragment();let a=0;for(e._items=[];e.$.itemsContainer.firstElementChild;)e.$.itemsContainer.firstElementChild.remove();if(0===e.dataSource.length)return;const l=e.value&&e.value[0]||[],n=e.value?e.value[1]:{};n&&"singleSelect"===n.type?e.$.select.click():e.$.condition.click(),l.forEach((l=>{if(!Array.isArray(l))return;const n=l[0],i=e.dataSource.find((e=>e.dataField===n));if(!i)return;let o;o="EMPTY"===l[1]||"NULL"===l[1]||"NOT_EMPTY"===l[1]||"NOT_NULL"===l[1]?e._createItem(i,l[1],void 0,a,l[2]):e._createItem(i,l[1],l[2],a,l[3]),t.appendChild(o),a++})),e.$.itemsContainer.appendChild(t),e.updateSingleSelect(),n&&(e.$.applyToInput.selectedValue=n.decorate,e.$.singleSelect.selectedValue=n.singleSelect)}_createItem(e,t,a,l,n=""){const i=this,o=i.disabled||i.unfocusable?-1:0,r=document.createElement("div"),s=document.createDocumentFragment(),d=document.createElement("div"),c=document.createElement("smart-input"),p=document.createElement("smart-input");let u,m;d.className="smart-grid-panel-item-close-button",d.tabIndex=o,d.setAttribute("role","button"),d.setAttribute("aria-label","button"),s.appendChild(d),u=document.createElement("div");const h=i._getColorInput();if(h.value=n,u.appendChild(h),u.setAttribute("role","presentation"),s.appendChild(u),c.className="underlined",c.dataSource=i.dataSource.map((e=>({value:e.dataField,label:e.label,icon:e.icon}))),c.dropDownButtonPosition=i.rightToLeft?"left":"right",c.readonly=!0,c.value=e.label,c.animation=i.animation,c.theme=i.theme,c.rightToLeft=i.rightToLeft,c.unfocusable=i.disabled||i.unfocusable,c.setAttribute("aria-label","Field"),c.dataSource&&c.dataSource.length<10?c.dropDownHeight="auto":c.dropDownHeight=250,s.appendChild(c),"boolean"===e.dataType)p.dataSource=JSON.parse(JSON.stringify(i._booleanConditions)),m=document.createElement("smart-check-box"),m.checked="boolean"==typeof a&&a;else if("date"===e.dataType)p.dataSource=i._dateConditions,m=document.createElement("smart-date-time-picker"),m.dropDownDisplayMode="auto",m.calendarButton=!0,m.dropDownAppendTo="body",m.formatString="M/d/yy H:mm",m.value=a;else if("number"===e.dataType)p.dataSource=JSON.parse(JSON.stringify(i._numberAndDateConditions)),m=document.createElement("smart-numeric-text-box"),m.value="number"==typeof a||"string"==typeof a?a:0;else if("enum"===e.dataType||e.options){p.dataSource=JSON.parse(JSON.stringify(i._enumConditions)),m=document.createElement("smart-input");let t=[];e.options&&(t=e.options.map((e=>{const t=e.color||"var(--smart-primary)";return e.prefix='<span style="background: '+t+'; width: 14px; height: 14px; display: inline-block; border-radius: 50%; margin-left:-4px; margin-right: 8px; top: 2px; position: relative;"></span>',""===e.label&&(e.label=" "),e}))),m.dataSource=t.length?t:e.options,m.readonly=!0,m.dropDownButtonPosition="right";const l=a?e.options.find((e=>e.value===a)):null;m.value=l&&a?l.label:""}else p.dataSource=JSON.parse(JSON.stringify(i._stringConditions)),m=document.createElement("smart-input"),m.value=null!=a?a.toString():"",t||(t="CONTAINS");return p.className="underlined",p.dropDownButtonPosition=i.rightToLeft?"left":"right",p.readonly=!0,p.animation=i.animation,p.theme=i.theme,p.rightToLeft=i.rightToLeft,p.unfocusable=i.disabled||i.unfocusable,p.setAttribute("aria-label","Condition"),p.classList.add("smart-filter-panel-list"),p.dataSource.forEach((e=>{delete e.selected})),p.dataSource.find((e=>e.value===t))?(p.value=i.localize(t),p.selectedValue=t,p.condition=t):(m.value="",m.checked=!1),(void 0===t||-1===t.indexOf("NULL")&&-1===t.indexOf("EMPTY"))&&-1===t.indexOf("THIS_WEEK")&&-1===t.indexOf("LAST_WEEK")&&-1===t.indexOf("NEXT_WEEK")&&-1===t.indexOf("THIS_MONTH")&&-1===t.indexOf("LAST_MONTH")&&-1===t.indexOf("NEXT_MONTH")&&-1===t.indexOf("THIS_YEAR")&&-1===t.indexOf("LAST_YEAR")&&-1===t.indexOf("NEXT_YEAR")&&-1===t.indexOf("TODAY")&&-1===t.indexOf("TOMORROW")&&-1===t.indexOf("YESTERDAY")||(m.value="",m.checked=!1,m.classList.add("smart-visibility-hidden")),p.dataSource&&p.dataSource.length<10?p.dropDownHeight="auto":p.dropDownHeight=250,m.animation=i.animation,m.classList.add("editor"),m.rightToLeft=i.rightToLeft,m.theme=i.theme,m.unfocusable=i.disabled||i.unfocusable,m.classList.add("underlined"),"boolean"!==e.dataType&&(m.placeholder=i.editorPlaceholder),i.editorCallback&&i.editorCallback(m,e),s.appendChild(p),s.appendChild(m),r.appendChild(s),r.className="smart-grid-panel-item",i._items.push(r),r.dataType=e.dataType,r}_localize(e){const t=this;t.$.addFilterButton.innerHTML=t.localize("add"),t.$.buttonsContainer.firstElementChild.innerHTML=t.localize("cancel"),t.$.buttonsContainer.children[1].innerHTML=t.localize("apply"),t.$.itemsContainer.setAttribute("no-filters",t.localize("noResults")),t.$.select.innerHTML='<span class="smart-icon smart-grid-icon smart-icon-sort-down show"></span>'+t.localize("select"),t.$.condition.innerHTML='<span class="smart-icon smart-grid-icon smart-icon-filter show"></span>'+t.localize("conditions"),t.$.condition.title=t.localize("colorRows"),t.$.select.title=t.localize("colorSelect"),t.$.conditionLabel.innerHTML=t.localize("colorRows"),t.$.singleSelectLabel.innerHTML=t.localize("colorsSingleSelect"),t.$.singleSelect.dropDownPlaceholder=t.localize("noOptions");const a="var(--smart-primary);";t.$.applyToInput.dataSource=[{label:t.localize("colorLeftBorderLabel"),value:"border",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorLeftBorderLabel")}</div><div class="smart-quiet">${t.localize("colorLeftBorder")}</div>`,prefix:'<span style="top: 8px; border-right: 3px solid '+a+'; padding: 2px; display: inline-block; margin-right: 16px; position: relative;">1</span>'},{label:t.localize("colorRowLabel"),value:"row",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorRowLabel")}</div><div class="smart-quiet">${t.localize("colorRow")}</div>`,prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border: 1px solid var(--smart-primary); color: var(--smart-primary-color); top: 8px; background: '+a+'; padding: 2px; display: inline-block; margin-right: 8px; position: relative;">2</span>'},{label:t.localize("colorCellLabel"),value:"cell",menuLabel:`<div style="flex-direction: column; display: inline-flex"><div>${t.localize("colorCellLabel")}</div><div class="smart-quiet">${t.localize("colorCell")}</div>`,prefix:'<span style="top: 8px; border: 1px solid var(--smart-primary); color: var(--smart-primary-color); background: '+a+'; padding: 2px; display: inline-block; margin-left:-4px; position: relative;">1</span><span style="border:1px solid '+a+'; padding: 2px; display: inline-block; top: 8px; margin-right: 8px; position: relative;">2</span>'}],t.$.applyToInput.selectedValue="border",t._stringConditions=[{prefix:'<span class="smart-icon smart-icon-empty"></span>',value:"EMPTY",label:t.localize("EMPTY")},{prefix:'<span class="smart-icon smart-icon-not-empty"></span>',value:"NOT_EMPTY",label:t.localize("NOT_EMPTY")},{prefix:'<span class="smart-icon smart-icon-contains"></span>',value:"CONTAINS",label:t.localize("CONTAINS")},{prefix:'<span class="smart-icon smart-icon-does-not-contain"></span>',value:"DOES_NOT_CONTAIN",label:t.localize("DOES_NOT_CONTAIN")},{prefix:'<span class="smart-icon smart-icon-starts-with"></span>',value:"STARTS_WITH",label:t.localize("STARTS_WITH")},{prefix:'<span class="smart-icon smart-icon-ends-with"></span>',value:"ENDS_WITH",label:t.localize("ENDS_WITH")},{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._enumConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")}],t._dateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TOMORROW",label:t.localize("TOMORROW")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"TODAY",label:t.localize("TODAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"YESTERDAY",label:t.localize("YESTERDAY")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_WEEK",label:t.localize("NEXT_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_WEEK",label:t.localize("THIS_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_WEEK",label:t.localize("LAST_WEEK")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"NEXT_MONTH",label:t.localize("NEXT_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"THIS_MONTH",label:t.localize("THIS_MONTH")},{prefix:'<span class="smart-icon smart-icon-calendar"></span>',value:"LAST_MONTH",label:t.localize("LAST_MONTH")}],t._numberAndDateConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-less-than"></span>',value:"LESS_THAN",label:t.localize("LESS_THAN")},{prefix:'<span class="smart-icon smart-icon-less-than-equal"></span>',value:"LESS_THAN_OR_EQUAL",label:t.localize("LESS_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-greater-than"></span>',value:"GREATER_THAN",label:t.localize("GREATER_THAN")},{prefix:'<span class="smart-icon smart-icon-greater-than-equal"></span>',value:"GREATER_THAN_OR_EQUAL",label:t.localize("GREATER_THAN_OR_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],t._booleanConditions=[{prefix:'<span class="smart-icon smart-icon-equal"></span>',value:"EQUAL",label:t.localize("EQUAL")},{prefix:'<span class="smart-icon smart-icon-not-equal"></span>',value:"NOT_EQUAL",label:t.localize("NOT_EQUAL")},{prefix:'<span class="smart-icon smart-icon-null"></span>',value:"NULL",label:t.localize("NULL")},{prefix:'<span class="smart-icon smart-icon-not-null"></span>',value:"NOT_NULL",label:t.localize("NOT_NULL")}],e&&t._items.forEach(((e,a)=>{const l=e.children[1],n=e.children[3];0===a?l.innerHTML="":1===a?(l.dataSource=[{value:"and",label:t.localize("and")},{value:"or",label:t.localize("or")}],l.value=t.localize(t.operator)):l.innerHTML=t.localize(t.operator),"string"!==e.dataType||e.options?"enum"===e.dataType||e.options?n.dataSource=t._enumConditions:"boolean"===e.dataType?n.dataSource=t._booleanConditions:"date"===e.dataType?n.dataSource=t._dateConditions:n.dataSource=t._numberAndDateConditions:n.dataSource=t._stringConditions,n.value=n.condition?t.localize(n.condition):""}))}_setFocusable(e){const t=this,a=t.disabled||t.unfocusable?-1:0;if(t.$.addFilterButton.tabIndex=a,t.$.buttonsContainer.firstElementChild.tabIndex=a,t.$.buttonsContainer.children[1].tabIndex=a,e){const e=Array.from(t.$.itemsContainer.getElementsByClassName("smart-grid-panel-item-close-button")),l=Array.from(t.$.itemsContainer.querySelectorAll("smart-date-time-picker, smart-numeric-text-box, smart-check-box, smart-input"));e.forEach((e=>e.tabIndex=a)),l.forEach((e=>e.unfocusable=t.disabled||t.unfocusable))}}});
|
|
872
872
|
|
|
873
873
|
/***/ }),
|
|
874
874
|
|
|
@@ -1066,7 +1066,7 @@ var __webpack_exports__ = {};
|
|
|
1066
1066
|
/* harmony import */ var _smart_cardview_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(1091);
|
|
1067
1067
|
/* harmony import */ var _smart_cardview_js__WEBPACK_IMPORTED_MODULE_26___default = /*#__PURE__*/__webpack_require__.n(_smart_cardview_js__WEBPACK_IMPORTED_MODULE_26__);
|
|
1068
1068
|
|
|
1069
|
-
/* Smart UI v19.0.
|
|
1069
|
+
/* Smart UI v19.0.5 (2024-04-23)
|
|
1070
1070
|
Copyright (c) 2011-2024 jQWidgets.
|
|
1071
1071
|
License: https://htmlelements.com/license/ */ //
|
|
1072
1072
|
|