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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI v19.0.
|
|
2
|
+
/* Smart UI v19.0.5 (2024-04-23)
|
|
3
3
|
Copyright (c) 2011-2023 jQWidgets.
|
|
4
4
|
License: https://htmlelements.com/license/ */ //
|
|
5
5
|
|
|
6
|
-
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))}}});
|
|
6
|
+
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))}}});
|