smart-webcomponents-react 14.2.83 → 14.2.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/source/modules/smart.accordion.js +1 -1
- package/source/modules/smart.array.js +1 -1
- package/source/modules/smart.barcode.js +1 -1
- package/source/modules/smart.breadcrumb.js +1 -1
- package/source/modules/smart.button.js +1 -1
- package/source/modules/smart.buttongroup.js +1 -1
- package/source/modules/smart.calendar.js +2 -2
- package/source/modules/smart.card.js +1 -1
- package/source/modules/smart.cardview.js +2 -2
- package/source/modules/smart.carousel.js +1 -1
- package/source/modules/smart.chart.js +1 -1
- package/source/modules/smart.checkbox.js +1 -1
- package/source/modules/smart.checkinput.js +1 -1
- package/source/modules/smart.chip.js +1 -1
- package/source/modules/smart.colorinput.js +1 -1
- package/source/modules/smart.colorpanel.js +1 -1
- package/source/modules/smart.colorpicker.js +1 -1
- package/source/modules/smart.combobox.js +1 -1
- package/source/modules/smart.common.js +1 -1
- package/source/modules/smart.countryinput.js +1 -1
- package/source/modules/smart.dateinput.js +2 -2
- package/source/modules/smart.daterangeinput.js +2 -2
- package/source/modules/smart.datetimepicker.js +2 -2
- package/source/modules/smart.dockinglayout.js +1 -1
- package/source/modules/smart.dropdownbutton.js +1 -1
- package/source/modules/smart.dropdownlist.js +1 -1
- package/source/modules/smart.editor.js +1 -1
- package/source/modules/smart.element.js +1 -1
- package/source/modules/smart.fileupload.js +1 -1
- package/source/modules/smart.form.js +1 -1
- package/source/modules/smart.formulaparser.js +1 -1
- package/source/modules/smart.ganttchart.js +2 -2
- package/source/modules/smart.gauge.js +1 -1
- package/source/modules/smart.grid.js +11 -11
- package/source/modules/smart.gridpanel.js +2 -2
- package/source/modules/smart.input.js +1 -1
- package/source/modules/smart.kanban.js +2 -2
- 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 +1 -1
- package/source/modules/smart.progressbar.js +1 -1
- package/source/modules/smart.qrcode.js +1 -1
- package/source/modules/smart.querybuilder.js +2 -2
- package/source/modules/smart.radiobutton.js +1 -1
- package/source/modules/smart.rating.js +1 -1
- package/source/modules/smart.router.js +1 -1
- package/source/modules/smart.scheduler.js +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 +1 -1
- package/source/modules/smart.tabs.js +1 -1
- package/source/modules/smart.tank.js +1 -1
- package/source/modules/smart.textarea.js +1 -1
- package/source/modules/smart.textbox.js +1 -1
- package/source/modules/smart.timeinput.js +1 -1
- package/source/modules/smart.timepicker.js +1 -1
- package/source/modules/smart.toast.js +1 -1
- package/source/modules/smart.tooltip.js +1 -1
- package/source/modules/smart.tree.js +1 -1
- package/source/modules/smart.validator.js +1 -1
- package/source/modules/smart.window.js +1 -1
- package/source/smart.accordion.js +1 -1
- package/source/smart.ajax.js +1 -1
- package/source/smart.array.js +1 -1
- package/source/smart.barcode.js +1 -1
- package/source/smart.bootstrap.js +1 -1
- package/source/smart.breadcrumb.js +1 -1
- package/source/smart.button.js +1 -1
- package/source/smart.buttongroup.js +1 -1
- package/source/smart.calendar.js +2 -2
- package/source/smart.card.js +1 -1
- package/source/smart.cardview.js +1 -1
- package/source/smart.carousel.js +1 -1
- package/source/smart.chart.annotations.js +1 -1
- package/source/smart.chart.api.js +1 -1
- package/source/smart.chart.core.js +1 -1
- package/source/smart.chart.js +1 -1
- package/source/smart.chart.rangeselector.js +1 -1
- package/source/smart.chart.waterfall.js +1 -1
- package/source/smart.checkbox.js +1 -1
- package/source/smart.checkinput.js +1 -1
- package/source/smart.chip.js +1 -1
- package/source/smart.colorinput.js +1 -1
- package/source/smart.colorpanel.js +1 -1
- package/source/smart.colorpicker.js +1 -1
- package/source/smart.combobox.js +1 -1
- package/source/smart.complex.js +1 -1
- package/source/smart.core.js +1 -1
- package/source/smart.countryinput.js +1 -1
- package/source/smart.data.js +1 -1
- package/source/smart.date.js +1 -1
- package/source/smart.dateformatpanel.js +1 -1
- package/source/smart.dateinput.js +1 -1
- package/source/smart.daterangeinput.js +1 -1
- package/source/smart.datetimepicker.js +1 -1
- package/source/smart.dockinglayout.js +1 -1
- package/source/smart.draw.js +1 -1
- package/source/smart.dropdownbutton.js +1 -1
- package/source/smart.dropdownlist.js +1 -1
- package/source/smart.editor.js +1 -1
- package/source/smart.element.js +1 -1
- package/source/smart.elements.js +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 +1 -1
- package/source/smart.gauge.js +1 -1
- package/source/smart.grid.cell.js +2 -2
- package/source/smart.grid.chart.js +1 -1
- package/source/smart.grid.column.js +1 -1
- package/source/smart.grid.core.js +2 -2
- package/source/smart.grid.dialog.js +2 -2
- package/source/smart.grid.edit.js +2 -2
- package/source/smart.grid.export.js +1 -1
- package/source/smart.grid.filter.js +1 -1
- package/source/smart.grid.group.js +1 -1
- package/source/smart.grid.js +1 -1
- package/source/smart.grid.menu.js +2 -2
- package/source/smart.grid.pager.js +1 -1
- package/source/smart.grid.reorder.js +1 -1
- package/source/smart.grid.resize.js +2 -2
- package/source/smart.grid.row.js +1 -1
- package/source/smart.grid.select.js +2 -2
- package/source/smart.grid.sort.js +1 -1
- package/source/smart.grid.toolbar.js +2 -2
- package/source/smart.grid.tree.js +1 -1
- package/source/smart.grid.view.js +2 -2
- package/source/smart.gridpanel.js +1 -1
- package/source/smart.input.js +1 -1
- package/source/smart.kanban.js +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.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.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/components/smart.grid.css +1 -1
- package/source/styles/default/scss/smart.grid.scss +10 -3
- package/source/styles/default/smart.grid.css +7 -3
- package/source/styles/smart.default.css +1 -1
package/source/smart.elements.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI v14.2.
|
|
2
|
+
/* Smart UI v14.2.89 (2022-09-14)
|
|
3
3
|
Copyright (c) 2011-2021 jQWidgets.
|
|
4
4
|
License: https://htmlelements.com/license/ */ //
|
|
5
5
|
|
|
@@ -47,22 +47,22 @@ Smart("smart-multiline-text-box",class extends Smart.TextBox{static get properti
|
|
|
47
47
|
Smart("smart-password-text-box",class extends Smart.BaseElement{static get properties(){return{autoFocus:{value:!1,type:"boolean"},hint:{value:"",reflectToAttribute:!0,type:"string"},label:{value:"",reflectToAttribute:!0,type:"string"},maxLength:{value:null,type:"number?"},minLength:{value:2,type:"number"},messages:{value:{en:{passwordStrength:"Password strength",short:"Short",weak:"Weak",far:"Far",good:"Good",strong:"Strong",showPassword:"Show password"}},type:"object",extend:!0},name:{value:"",type:"string"},passwordStrength:{value:null,type:"function?",reflectToAttribute:!1},placeholder:{value:"",type:"string"},selectAllOnFocus:{value:!1,type:"boolean"},showPasswordIcon:{value:!1,type:"boolean"},showPasswordStrength:{value:!1,type:"boolean"},tooltipArrow:{value:!1,type:"boolean"},tooltipDelay:{value:0,type:"number"},tooltipPosition:{allowedValues:["bottom","top","left","right","absolute"],value:"top",type:"string"},tooltipTemplate:{value:null,type:"string?"},type:{value:"password",type:"string",defaultReflectToAttribute:!0,readonly:!0},value:{value:"",reflectToAttribute:!1,type:"string"}}}static get listeners(){return{"document.up":"_documentUpHandler",mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler","passwordIcon.down":"_showPassword","input.change":"_textBoxChangeHandler","input.paste":"_textBoxChangeHandler","input.keyup":"_textBoxChangeHandler","input.blur":"_blurHandler","input.focus":"_focusHandler"}}static get requires(){return{"Smart.Tooltip":"smart.tooltip.js"}}static get styleUrls(){return["smart.textbox.css","smart.passwordtextbox.css"]}template(){return'<div id="container" role="presentation"><span id="label" class="smart-label">[[label]]</span><div id="innerContainer" class="smart-content" role="presentation"><input class="smart-input" type="password" id="input"\n disabled="[[disabled]]"\n maxlength="[[maxLength]]"\n minlength="[[minLength]]"\n name="[[name]]"\n placeholder="[[placeholder]]"\n readonly="[[readonly]]"\n value="[[value]]"/><span id="passwordIcon" title="Show Password" class="smart-password-icon smart-hidden" role="button" aria-label="Show Password"></span></div><span id="hint" class="smart-hint">[[hint]]</span><smart-tooltip id="tooltip"\n open-mode="manual"\n arrow="[[tooltipArrow]]"\n right-to-left="[[rightToLeft]]"\n tooltip-template="[[tooltipTemplate]]"\n position="[[tooltipPosition]]"\n delay="[[tooltipDelay]]"></smart-tooltip></div>'}propertyChangedHandler(e,t,s){const a=this;let o;switch(e){case"locale":case"messages":case"passwordStrength":o=a._evaluatePasswordStrength(),a._updateTooltipString(o),a.$.passwordIcon.setAttribute("title",a.localize("showPassword")),a._updatePasswordStrengthStyles(o);break;case"tooltipPosition":a.$.tooltip.position=a.tooltipPosition;break;case"tooltipTemplate":a.$.tooltip.tooltipTemplate=a.tooltipTemplate;break;case"value":o=a._evaluatePasswordStrength(),a._updateTooltipString(o),a._updatePasswordStrengthStyles(o);break;case"disabled":case"unfocusable":a._setFocusable();break;case"readonly":break;default:super.propertyChangedHandler(e,t,s)}}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.$.input.tabIndex=-1:e.$.input.removeAttribute("tabindex")}render(){this._createElement(),super.render()}focus(){this.$.input.focus()}blur(){this.$.input.blur()}reset(){const e=this;e.$.input.value=e.value=e._initializationValue}_createElement(){const e=this;e.autoFocus&&e.$.input.focus(),e.$.input.autocomplete="new-password",e.$.addClass("smart-input"),e._setFocusable(),e.$.tooltip.selector=e.$.innerContainer,e.$.passwordIcon.setAttribute("title",e.localize("showPassword")),e._updateTooltipString("short"),e._updatePasswordStrengthStyles(),e._initializationValue=e.value,e.value.length>0?e.$.addClass("has-value"):e.$.removeClass("has-value"),e._handleHintContainer(),e.shadowRoot&&(e.$.tooltip.style.display="none",requestAnimationFrame((()=>e.$.tooltip.style.display=""))),e.$.label.id||(e.$.label.id=e.id+"Label"),e.$.hint.id||(e.$.hint.id=e.id+"Hint"),e.setAttribute("role","presentation"),e.$.innerContainer.removeAttribute("aria-describedby"),e.$.input.setAttribute("aria-describedby",e.$.tooltip.id+" "+e.$.hint.id),e.$.input.setAttribute("aria-labelledby",e.$.label.id)}_handleHintContainer(){const e=this;if(!e.hint)return;const t=e.$.hint;if("function"==typeof e.hint){const s=e.value;e.hint(s,t)?e.$.addClass("invalid"):e.$.removeClass("invalid")}else"string"==typeof e.hint&&(t.innerHTML=e.hint,e.$.removeClass("invalid"))}_focusHandler(){const e=this;e.disabled||(e.selectAllOnFocus&&e.$.input.select(),e.showPasswordIcon&&e.$passwordIcon.removeClass("smart-hidden"),e.setAttribute("focus",""),e._valueBeforeChange=e.value,e.$.fireEvent("focus"),e.showPasswordStrength&&(e._tooltipOpened||(e.$.tooltip.open(),e._tooltipOpened=!0)))}_blurHandler(){const e=this;e.disabled||e._passwordIconPressed||(e._valueBeforeChange!==e.value&&(e.$.fireEvent("change",{value:e.value,oldValue:e._valueBeforeChange}),e._valueBeforeChange=""),e.showPasswordIcon&&e.$passwordIcon.addClass("smart-hidden"),e.removeAttribute("focus"),e.value.length>0?e.$.addClass("has-value"):e.$.removeClass("has-value"),e.$.fireEvent("blur"),e._tooltipOpened&&(e.$.tooltip.close(),e._tooltipOpened=!1))}_showPassword(){const e=this;!e.disabled&&e.showPasswordIcon&&(e.$.input.type="text",e._passwordIconPressed=!0)}_documentUpHandler(){const e=this;!e.disabled&&e.showPasswordIcon&&e._passwordIconPressed&&(e.$.input.type="password",e._passwordIconPressed=!1,e.$.input.focus())}_textBoxChangeHandler(e){const t=this;if(t.disabled||t.readonly)return;const s=t.value;if(t.value=t.$.input.value,t.$.input){const a=t.$.input.value;s!==a&&t.$.fireEvent("changing",{oldValue:s,value:a}),e&&"Enter"===e.key&&(t.$.fireEvent("change",{value:t.value,oldValue:t._valueBeforeChange}),t._valueBeforeChange=t.value)}e&&"keyup"!==e.type&&e.stopPropagation();let a=t._evaluatePasswordStrength();t._updateTooltipString(a),t._updatePasswordStrengthStyles(a)}_updatePasswordStrengthStyles(e){const t=this,s=["short","weak","far","good","strong"];e=e||"short";for(let e=0;e<s.length;e++)t.$container.removeClass("smart-password-"+s[e]);t.disabled||t.$container.addClass("smart-password-"+e)}_evaluatePasswordStrength(){const e=this,t=e.$.input.value,s=t.length,a="<>@!#$%^&*()_+[]{}?:;|'\"\\,./~`-=";if(e.disabled)return;if(e.passwordStrength)return e.passwordStrength(t,a);let o=0,n=0,r=0,l=0;for(var i=0;i<s;i++){const e=t.charAt(i),s=t.charCodeAt(i);s>64&&s<91||s>96&&s<123||s>127&&s<155||s>159&&s<166?o+=1:!1!==isNaN(e)?-1===a.indexOf(e)||(r+=1):n+=1}return l=o+n+2*r+o*n/2+s,s<8?"short":l<20?"weak":l<30?"far":l<40?"good":"strong"}refresh(){}_keyUpHandler(){}_mouseWheelHandler(){}_resizeHandler(){}_selectStartHandler(){}_setDropDownSize(){}_styleChangedHandler(){}_mouseEventsHandler(e){"mouseenter"===e.type?this.setAttribute("hover",""):this.removeAttribute("hover")}_updateTooltipString(e){const t=this;t.$.tooltip.value='<span class="password-strength-label">'+t.localize("passwordStrength")+': </span><span class="password-strength-value">'+t.localize(e)+"</span>"}});
|
|
48
48
|
Smart.Utilities.Assign("Grid.Column",class{constructor(t){const e=this;"string"!=typeof t?Object.assign(e,t):(e.label=t,e.dataField=t),e.dataField||(e.dataField="dataField_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.setState(t),e.dataType||(e.dataType="string"),e.title||(e.title=""),e.rowSpan||(e.rowSpan=null),e.columnGroup||(e.columnGroup=""),e.canNotify=!0,(!t||t&&!t.properties)&&(e.data=t);let o="left";switch(e.dataType){case"string":case"date":o="left";break;case"number":o="right";break;case"boolean":o="center"}if(e.highlight||(e.highlight=!1),void 0===e.index&&(e.index=-1),void 0===e.visibleIndex&&(e.visibleIndex=-1),void 0===e.selected&&(e.selected=!1),void 0===e.freeze&&(e.freeze=!1),e.label||(e.label=""),e.menuItems||(e.menuItems=null),e.displayField||(e.displayField=e.dataField),e.template||(e.template=""),e.editor||(e.editor="input"),"string"==typeof e.editor){e.editor={template:e.editor,autoFocus:!0};let t=!0;e.editor.template&&e.editor.template.indexOf("<input")>=0&&(t=!1),t&&("number"===e.dataType||"int"===e.dataType||"float"===e.dataType?"slider"!==e.editor.template&&(e.editor.template="numberInput"):"date"===e.dataType?"timeInput"!==e.editor.template&&"dateTimePicker"!==e.editor.template&&(e.editor.template="dateInput"):"time"===e.dataType?e.editor.template="timeInput":"boolean"===e.dataType&&(e.editor.template="checkBox"))}else void 0===e.editor.autoFocus&&(e.editor.autoFocus=!0);if(e.icon||(e.icon="smart-icon-font","modifiedTime"===e.template&&(e.template="updatedTime"),"modifiedBy"===e.template&&(e.template="updatedBy"),"select"===e.editor.template&&(e.icon="smart-icon-sort-down"),"multiComboInput"===e.editor.template&&(e.icon="smart-icon-list-unordered"),"textArea"!==e.editor.template&&"textarea"!==e.editor.template||(e.icon="smart-icon-fontsize"),"url"===e.template&&(e.icon="smart-icon-link"),"email"===e.template&&(e.icon="smart-icon-mail"),"color"===e.template&&(e.icon="smart-icon-color-background"),"updatedTime"!==e.template&&"createdTime"!==e.template||(e.icon="smart-icon-clock"),"multiComboInput"===e.editor.template&&e.editor.collaborator&&(e.icon="smart-icon-user"),"createdBy"!==e.template&&"updatedBy"!==e.template||(e.icon="smart-icon-user"),"image"===e.editor.template&&(e.icon="smart-icon-image"),"password"===e.editor.template&&(e.icon="smart-icon-lock"),"phone"===e.editor.template?e.icon="smart-icon-phone":"checkBox"===e.editor.template||"boolean"===e.dataType?e.icon="smart-icon-ok-squared":"numberInput"===e.editor.template||"slider"===e.editor.template||"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.icon="smart-icon-number":"dateInput"===e.editor.template||"dateTimePicker"===e.editor.template||"date"===e.dataType?e.icon="smart-icon-calendar":"timeInput"===e.editor.template||"time"===e.dataType?e.icon="smart-icon-clock":e.editor.template.indexOf("multi")>=0&&(e.icon="smart-icon-list-ordered"),"autoNumber"===e.template&&(e.icon="smart-icon-list-ordered")),e.menu=null,void 0===e.allowActionButtonAnimation&&(e.grid?e.allowActionButtonAnimation=e.grid.appearance.allowColumnActionButtonAnimation:e.allowActionButtonAnimation=!1),void 0===e.allowSortButtonAnimation&&(e.grid?e.allowSortButtonAnimation=e.grid.appearance.allowColumnSortButtonAnimation:e.allowSortButtonAnimation=!1),void 0===e.autoShowActionButton&&(e.grid?e.autoShowActionButton=e.grid.appearance.autoShowColumnActionButton:e.autoShowActionButton=!1),void 0===e.autoShowSortButton&&(e.grid?e.autoShowSortButton=e.grid.appearance.autoShowColumnSortButton:e.autoShowSortButton=!0),void 0===e.showSortButton&&(e.grid?e.showSortButton=e.grid.appearance.showColumnSortButton:e.showSortButton=!1),void 0===e.showIcon&&(e.grid&&!e.autoGenerated?e.showIcon=e.grid.appearance.showColumnIcon:e.showIcon=!1),void 0===e.showDescriptionButton&&(e.grid?e.showDescriptionButton=e.grid.appearance.showColumnDescriptionButton:e.showDescriptionButton=!1),void 0===e.showCustomButton&&(e.grid?e.showCustomButton=e.grid.appearance.showColumnCustomButton:e.showCustomButton=!1),void 0===e.showActionButton&&(e.grid?e.showActionButton=e.grid.appearance.showColumnActionButton:e.showActionButton=!1),void 0===e.allowLabelAnimation&&(e.grid?e.allowLabelAnimation=e.grid.appearance.allowColumnLabelAnimation:e.allowLabelAnimation=!1),void 0===e.autoShowFilterButton&&(e.grid?e.autoShowFilterButton=e.grid.appearance.autoShowColumnFilterButton:e.autoShowFilterButton=!1),void 0===e.showFilterButton&&(e.grid?e.showFilterButton=e.grid.appearance.showColumnFilterButton:e.showFilterButton=!1),void 0===e.autoCloseMenu&&(e.grid?e.autoCloseMenu=e.grid.columnMenu.autoClose:e.autoCloseMenu=!0),void 0===e.allowNull&&(e.allowNull=!0),e.formatFunction||(e.formatFunction=null),e.sortOrder||(e.sortOrder=null),void 0===e.sortIndex&&(e.sortIndex=null),e.sortComparator||(e.sortComparator=null),e.filter||(e.filter=null),e.className||(e.className=""),e.cellsClassName||(e.cellsClassName=""),e.cellsCSSRules||(e.cellsCSSRules=null),e.filterMenuMode||(e.filterMenuMode="default",e.grid&&"excel"===e.grid.filtering.filterMenu.mode&&(e.filterMenuMode="excel"),e.autoGenerated&&(e.filterMenuMode="none")),e.align||(e.align=o),e.cellsAlign||(e.cellsAlign=o),e.cellsWrap||(e.cellsWrap=!1,e.grid&&e.grid.layout.allowCellsWrap&&(e.cellsWrap=e.grid.layout.allowCellsWrap)),e.minWidth||(e.minWidth=30),e.width||(e.width=null),!e.autoGenerated)if(e.grid&&e.grid.layout.columnWidth)e.width=e.grid.layout.columnWidth;else if(e.grid&&e.grid.layout.autoSizeNewColumn&&!e._autoSizeWidth){const t=e._autoSize();e.width=Math.max(e.grid.layout.autoSizeNewColumnMinWidth,t),e._autoSizeWidth=e.width}void 0===e.visible&&(e.visible=!0),void 0===e.allowResize&&(e.allowResize=!0),void 0===e.allowFreeze&&(e.allowFreeze=!0),void 0===e.allowReorder&&(e.allowReorder=!0),void 0===e.allowHide&&(e.allowHide=!0),void 0===e.allowDelete&&(e.allowDelete=!0),void 0===e.allowSort&&(e.allowSort=!0),void 0===e.allowSelect&&(e.allowSelect=!0),void 0===e.allowSortToggleOnClick&&(e.allowSortToggleOnClick=!0),void 0===e.allowGroup&&(e.allowGroup=!0),void 0===e.allowFilter&&(e.allowFilter=!0),void 0===e.allowEdit&&(e.allowEdit=!0),void 0===e.allowSummary&&(e.allowSummary=!0),void 0===e.allowHeaderEdit&&(e.allowHeaderEdit=!0),void 0===e.allowExport&&(e.allowExport=!0),void 0===e.description&&(e.description=""),void 0===e.group&&(e.group=!1),e.summary||(e.summary=[]),"false"===e.freeze&&(e.freeze=!1),"true"===e.freeze&&(e.freeze=!0),!1===e.allowFreeze&&(e.freeze=!1),void 0===e.defaultValue&&(e.defaultValue=null),e.disabledDialogOptions||(e.disabledDialogOptions=[]),e.formatSettings||(e.formatSettings={decimalPlaces:null,decimalSeparator:null,negativeWithBrackets:null,prefix:null,sufix:null,thousandsSeparator:null,dateFormat:"d"}),this.validationRules||(this.validationRules=[]),e.selected=!1,e.sorted=!1,e.filtered=!1,e.parent=null,e.children=[]}refresh(){const t=this;t.element&&t.element._refresh()}render(){const t=this;t.element.column=t,t.element&&t.element._render()}get stateProps(){return["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","description","icon","menuItems","summary","cellsFormat","className","rowSpan","cellsClassName","cellsCSSRules","formatSettings","formatFunction","index","sortIndex","sortOrder","sortComparator","sorted","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","statusColumn","value","thHierarchy","valueField","onAction","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"]}setState(t){const e=this;if(!t)return;if(e._state={},!t.dataField)return;if(t.dataField.startsWith("_"))return{};const o=e.stateProps;for(let l in t)if(!l.startsWith("_")&&o.indexOf(l)>=0)if("editor"===l){e._state[l]={};for(let t in e[l])"row"!==t&&"column"!==t&&"cell"!==t&&"instance"!==t&&"element"!==t&&(e._state[l][t]=e[l][t])}else"groups"===l?e[l]&&e[l].length>0&&(e._state[l]=e[l]):e._state[l]=e[l]}getState(){const t=this;if(t.dataField.startsWith("_"))return{};if(t._state&&(t._state._visible=t._visible,t._state._dataField=t._dataField),!t._state){t._state={label:t.label,dataField:t.dataField,dataType:t.dataType,_visible:t._visible};const e=t.stateProps;for(let o in t)if(!o.startsWith("_")&&e.indexOf(o)>=0)if("editor"===o){t._state[o]={};for(let e in t[o])"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(t._state[o][e]=t[o][e])}else"groups"===o?t[o]&&t[o].length>0&&(t._state[o]=t[o]):"filter"===o?t[o]&&"string"!=typeof t[o]&&(t._state[o]=t[o].toString()):t._state[o]=t[o]}return t._state}setProperty(t,e,o=!0){const l=this,n=l.getProperty(t);n!==e&&(l.canNotify=!1,l[t]=e,o&&(l.propertyChanged(t,n,e),l.grid&&l.grid.onColumnChange&&l.stateProps.indexOf(t)>=0&&l.grid.onColumnChange(l,t,n,e)),l.canNotify=!0)}getProperty(t){const e=this;if("selected"===t){let o=!1;return e.grid._selection.cells["column"+e.dataField]&&(o=null),e.grid&&e.grid._selection.columns[e.dataField]&&(o=!0),e.grid.columns.canNotify=!1,e[t]!==o&&(e[t]=o),e.grid.columns.canNotify=!0,o}return"group"===t?!(!e.dataSource||!e.dataSource.groupBy)&&e.dataSource.groupBy.indexOf(e.dataField)>=0:e[t]}get properties(){return["allowExport","allowFreeze","allowNull","allowGroup","allowSelect","verticalAlign","columnGroup","cellsVerticalAlign","autoCloseMenu","autoShowActionButton","autoShowSortButton","autoShowFilterButton","allowLabelAnimation","allowActionButtonAnimation","allowSortButtonAnimation","allowHide","allowDelete","allowEdit","allowSummary","allowHeaderEdit","allowFilter","allowSort","allowSortToggleOnClick","allowResize","allowReorder","canNotify","data","disabledDialogOptions","description","grid","icon","menuItems","menu","summary","cellsFormat","className","cellsClassName","cellsCSSRules","formatSettings","formatFunction","index","sortIndex","sortOrder","sortComparator","sorted","groups","element","level","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","labelTemplate","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","rowSpan","showDescriptionButton","statusColumn","treeColumn","computedWidth","computedHeight","overflowWidth","parent","getFilterPanel","getCellValue","updateFilterPanel","children","value","thHierarchy","valueField","onAction","left","top","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"]}propertyChanged(t,e,o){const l=this;if(l.data&&void 0!==l.data[t]&&(l.data[t]=o),l._state||(l._state={label:l.label,dataField:l.dataField,dataType:l.dataType,_visible:l._visible}),l._state&&o!==e&&l.dataField&&!l.dataField.startsWith("_"))if("editor"===t){l._state[t]={};for(let e in o)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(l._state[t][e]=o[e])}else"filter"===t?l[t]&&"string"!=typeof o?l._state[t]=o.toString():l._state[t]=o:l.stateProps.indexOf(t)>=0&&(l._state[t]=o);if("highlight"!==t)if("className"!==t)if("editor"!==t)if("allowSort"!==t&&"allowFilter"!==t)if("showIcon"!==t)if("visible"!==t){if("showCustomButton"===t&&(o?l.element._showCustomButton():l.element._hideCustomButton()),"showDescriptionButton"===t)return o?l.element._showDescriptionButton():l.element._hideDescriptionButton(),void l.refresh();if("description"!==t){if("filter"===t&&(l.filter?(l.grid.addFilter(l.dataField,l.filter),l.filtered=!0):(l.grid.removeFilter(l.dataField),l.filtered=!1),(l.autoShowFilterButton||l.showFilterButton)&&(o?l.element._showFilterButton():l.element._hideFilterButton())),"sortIndex"===t)return"many"===l.grid.sorting.mode&&l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),null!==l.sortIndex?l.element.setAttribute("sort-index",l.sortIndex):l.element.removeAttribute("sort-index"),void l.element._updateSortOrder();if("selected"===t){if(!1===l.allowSelect)return;l.selectionColumn&&l.refresh(),o?l.grid._selection.columns[l.dataField]||(l.grid._selection.columns[l.dataField]=!0):!1===o&&l.grid._selection.columns[l.dataField]&&delete l.grid._selection.columns[l.dataField],l.grid._recycle(!1)}if("formatSettings"===t&&l.grid._recycle(!1),"sortOrder"===t)return l.sorted=!1,null===o?l.element._hideSortButton():(l.element._showSortButton(),l.sorted=!0),l.grid.context===document&&l.grid.sortBy(l.dataField,l.sortOrder),void(l.sorted?l.element.setAttribute("aria-sort","asc"===l.sortOrder?"ascending":"descenting"):(l.element.removeAttribute("aria-sort"),l.element.removeAttribute("sort-index")));if("group"!==t){if("showActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._showActionButton():l.element._hideActionButton(),l.element.allowAnimations=!0),"autoShowActionButton"===t&&(l.element.allowAnimations=!1,o?l.element._hideActionButton():l.element._showActionButton(),l.element.allowAnimations=!0),"showFilterButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowFilterButton&&(l._autoShowFilterButton=l.autoShowFilterButton),o?(l.autoShowFilterButton=!1,l.element._showFilterButton()):(l.element._hideFilterButton(),l.autoShowFilterButton=l._autoShowFilterButton),l.element.allowAnimations=!0),"showSortButton"===t&&(l.element.allowAnimations=!1,void 0===l._autoShowSortButton&&(l._autoShowSortButton=l.autoShowSortButton),o?(l.autoShowSortButton=!1,l.element._showSortButton()):(l.element._hideSortButton(),l.autoShowSortButton=l._autoShowSortButton),l.element.allowAnimations=!0),"autoShowSortButton"===t&&(l.element.allowAnimations=!1,l._autoShowSortButton=l.autoShowSortButton,o?l.element._hideSortButton():l.element._showSortButton(),l.element.allowAnimations=!0),"menu"===t&&(o?l.element.setAttribute("aria-controls",l.menu.id):(l.element.removeAttribute("aria-controls"),l.autoShowActionButton&&l.element._hideActionButton())),"cellsFormat"!==t&&"formatSettings"!==t&&"dataField"!==t&&"displayField"!==t&&"template"!==t||l.grid._recycle(),"label"!==t&&"labelTemplate"!==t&&"width"!==t&&"minWidth"!==t||l.grid.refresh(),"freeze"===t){if(!l.allowFreeze)return;const t=()=>{const t=l.grid.context;l.grid.context=l.grid,l.grid._renderColumns(),!1===o&&l.grid._initializeRowElements(),l.grid.refresh(),l.grid.context=t};if(l.grid.columnGroups&&l.grid.columnGroups.length>0&&l.columnGroup)return void t();t()}}else l.grid.context===document&&(o?l.grid.addGroup(l.dataField):l.grid.removeGroup(l.dataField))}else l.refresh()}else l.grid.refresh(l.grid.grouping.enabled);else l.refresh();else l.refresh();else l._editorId="_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);else l.refresh();else this.refresh()}_measureSize(t){const e=this.grid,o=function(){const o=[],l=document.createElement("div"),n=document.createElement("div"),i=Array.isArray(t)?t:[t];n.classList.add("smart-label"),l.appendChild(n),l.style.width="auto",l.style.position="static",e.$.columnHeader.appendChild(l);for(let t=0;t<i.length;t++){n.innerHTML="<span>"+i[t]+"</span>";const e=20+n.firstChild.offsetWidth,l=Math.max(30,e);o.push(l)}return e.$.columnHeader.removeChild(l),o}();return 1===o.length?o[0]:o}_autoSize(t){const e=this,o=e.grid;let l=e.label.toString();if(!t){const t=o.isInitialized?o._recyclingRows:[];for(let o=0;o<t.length;o++){const n=""+t[o].data[e.dataField];if("image"===e.template)break;n&&n.length>l.length&&(l=n)}}const n=e._measureSize(l);return e.showIcon?n+20:n}autoSize(t){const e=this._autoSize(t);this.width=e}createElement(){const t=this,e=document.createElement("smart-grid-column");return e._initialize(t),e.setAttribute("role","columnheader"),e.setAttribute("aria-haspopup",""),t.element=e,t.grid.notify((function(e,o,l){switch(e){case"appearance_allowColumnLabelAnimation":t.setProperty("allowLabelAnimation",l);break;case"appearance_allowColumnSortAnimation":t.setProperty("allowSortAnimation",l);break;case"appearance_allowColumnSortButtonAnimation":t.setProperty("allowSortButtonAnimation",l);break;case"appearance_allowColumnActionButtonAnimation":t.setProperty("allowActionButtonAnimation",l);break;case"appearance_allowColumnFilterButtonAnimation":t.setProperty("allowFilterButtonAnimation",l);break;case"appearance_autoShowColumnActionButton":t.setProperty("autoShowActionButton",l);break;case"appearance_autoShowColumnSortButton":t.setProperty("autoShowSortButton",l);break;case"appearance_autoShowColumnFilterButton":t.setProperty("autoShowFilterButton",l);break;case"appearance_showColumnActionButton":t.setProperty("showActionButton",l);break;case"appearance_showColumnFilterButton":t.setProperty("showFilterButton",l);break;case"appearance_showColumnCustomButton":t.setProperty("showCustomButton",l);break;case"appearance_showColumnDescriptionButton":t.setProperty("showDescriptionButton",l);break;case"appearance_showColumnSortButton":t.setProperty("showSortButton",l);break;case"appearance_showFrozenColumnBackground":case"appearance_showSortColumnBackground":case"appearance_showFilterColumnBackground":t.grid._recycle(!1)}})),e}}),Smart("smart-grid-column",class extends Smart.BaseElement{_showSortButton(t){const e=this;e.column&&(e.column.autoGenerated||(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.column&&e.column.grid&&!1===e.column.grid.sorting.maintainSort?e.sortButton.removeAttribute("order"):(e.column.autoShowSortButton||e.column.allowSort&&e.sortButton.classList.add("smart-icon-sort","smart-grid-icon"),"asc"===e.column.sortOrder?e.sortButton.classList.add("asc"):"desc"===e.column.sortOrder&&e.sortButton.classList.add("desc"),e.column.showSortButton&&(e.sortButton.classList.add("show"),!1!==t&&e._refresh()),null!==e.column.sortIndex?e.sortButton.setAttribute("order",1+e.column.sortIndex):e.sortButton.removeAttribute("order"))))}_updateSortOrder(){const t=this;if(!t.column)return t.removeAttribute("sort-index"),void t.sortButton.removeAttribute("order");null!==t.column.sortIndex?(t.setAttribute("sort-index",t.column.sortIndex),t.sortButton.setAttribute("order",1+t.column.sortIndex)):(t.removeAttribute("sort-index"),t.sortButton.removeAttribute("order"))}_hideSortButton(t){const e=this;e.column&&(e.sortButton.classList.remove("asc"),e.sortButton.classList.remove("desc"),e.sortButton.removeAttribute("order"),e.column.showSortButton&&!e.column.autoShowSortButton||(e.sortButton.classList.remove("show"),e.sortButton.classList.remove("smart-icon-sort"),!1!==t&&e._refresh()))}_showFilterButton(t){const e=this;e.column&&!e.column.autoGenerated&&(e.filterButton.classList.add("show"),e._isInitialized&&!1!==t&&e._refresh())}_hideFilterButton(t){const e=this;e.column&&(e.filterButton.classList.remove("show"),e._isInitialized&&!1!==t&&e._refresh())}_showDescriptionButton(){const t=this;t.column&&!t.column.autoGenerated?t.hasAttribute("columnHeader")||(t.column.description?(t.descriptionButton.setAttribute("title",t.column.description),t.descriptionButton.classList.add("show")):t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh()):t.descriptionButton.classList.remove("show")}_hideDescriptionButton(){const t=this;t.column&&(t.descriptionButton.classList.remove("show"),t._isInitialized&&t._refresh())}_showIcon(){const t=this;t.column&&!t.column.autoGenerated&&(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon",""),t._isInitialized&&t._refresh())}_hideIcon(){const t=this;t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon"),t._refresh()}_showCustomButton(){const t=this;t.column&&!t.column.autoGenerated&&(t.customButton.classList.add("show"),t._refresh())}_hideCustomButton(){const t=this;t.column&&(t.customButton.classList.remove("show"),t._refresh())}_showActionButton(){const t=this;t.column&&t.column.showActionButton&&t.column.grid.hasColumnMenu(t.column)&&!t.column.autoGenerated&&t.actionButton&&(t.actionButton.classList.add("show"),t._refresh())}_hideActionButton(){const t=this;t.column&&t.column.showActionButton&&t.actionButton&&!t.hasAttribute("aria-controls")&&t.actionButton.classList.contains("show")&&(t.actionButton.classList.remove("show"),t._refresh())}_rotate(){const t=this,e=document.createElement("span");return t.label.innerHTML="",e.innerHTML=t.column.label,t.label.appendChild(e),e.className="rotate",e.style.transform="rotate("+t.column.rotationAngle+"deg)",t.column.grid._recycleRotate(t.label,e,t.column.align,t.column.verticalAlign,t.column.label)}_align(){const t=this;let e=t.column.align;switch(t.column.grid.rightToLeft&&("left"===e?e="right":"right"===e&&(e="left")),e){case"left":t.label.classList.add("align-left");break;case"center":t.label.classList.add("align-center");break;case"right":t.label.classList.add("align-right")}switch(t.column.verticalAlign){case"top":t.label.classList.add("align-top");break;case"middle":t.label.classList.add("align-middle");break;case"bottom":t.label.classList.add("align-bottom")}}_refresh(){const t=this;if(!t.column)return;const e=t.column.grid;if(t.sortButton.classList.remove("filter"),t.sortButton.classList.remove("action"),t.label.className="smart-label",t.label.firstElementChild&&(t.column.className?(t.label.firstElementChild.className="",t.label.firstElementChild.className+=" "+t.column.className):t.label.firstElementChild.className=""),t.descriptionButton&&t.descriptionButton.setAttribute("title",t.column.description),!0===t.column.autoGenerated||t.hasAttribute("columnHeader")?t.descriptionButton.classList.remove("show"):t.column.showDescriptionButton&&t.column.description?t.descriptionButton.classList.add("show"):t.descriptionButton.classList.remove("show"),t.column.highlight?t.setAttribute("highlight",""):t.removeAttribute("highlight"),t.column.visible&&"_checkBoxColumn"===t.column.dataField){const e=t.column.grid;let o=e.getVisibleRows();e.paging.enabled&&"page"===e.selection.checkBoxes.selectAllMode&&(o=o.slice(e.paging.pageIndex*e.paging.pageSize,(e.paging.pageIndex+1)*e.paging.pageSize));const l=e.paging.enabled&&"page"===e.selection.checkBoxes.selectAllMode?e._getSelectedRows(!0,!0):e._getSelectedRows(!0,!1);if(e.selection.checkBoxes.autoShow?t.setAttribute("auto-show",""):t.removeAttribute("auto-show"),e._isVirtualMode()){const o=e.dataSource.virtualDataSourceLength;l>0&&l===o?t.setAttribute("selected",""):l>0&&l<o?t.setAttribute("selected","indeterminate"):0!==l&&0!==o||t.removeAttribute("selected")}else l.length>0&&l.length===o.length?t.setAttribute("selected",""):l.length>0&&l.length<o.length?t.setAttribute("selected","indeterminate"):0!==l.length&&0!==o.length||t.removeAttribute("selected");return t.removeAttribute("checkbox"),t.label.classList.remove("smart-input"),void("none"!==e.selection.checkBoxes.selectAllMode&&(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")))}if("_rowHeaderColumn"===this.column.dataField){const e=t.column.grid;if(e.selection.enabled&&e.selection.allowRowHeaderSelection&&e.appearance.showRowHeaderSelectIcon){let o='<div class="smart-grid-command-item">',l=e.areAllRowsSelected()?"smart-icon-check-squared":"smart-icon-check-empty";e.isEmpty()&&(l=""),o+='<span class="smart-grid-icon '+l+'"></span>',o+="</div>",t.label.style.paddingLeft="0px",t.label.style.paddingRight="0px",t.label.innerHTML=o}}if("_commandColumn"===t.column.dataField){const e=t.column.grid,o="icon"!==e.editing.commandColumn.displayMode,l="label"!==e.editing.commandColumn.displayMode,n=e.editing.commandColumn.dataSource.commandColumnMenu;let i='<div class="smart-grid-command-item">';const a="{{messages}}"===n.label?e.localize("commandColumnMenu"):n.label,r=n.icon;l&&o?(i+='<span class="smart-grid-icon '+r+'"></span>',i+='<span class="smart-grid-label">'+a+"</span>"):l&&!o?i+='<span class="smart-grid-icon '+r+'"></span>':o&&!l&&(i+='<span class="smart-grid-label">'+a+"</span>"),i+="</div>",n.visible&&(t.label.innerHTML=i)}const o=t.column.getProperty("selected");if(!1===o&&t.hasAttribute("selected")?t.removeAttribute("selected"):!0===o?t.setAttribute("selected",""):null===o&&t.setAttribute("selected","indeterminate"),t.column.allowSortButtonAnimation?t.sortButton.classList.add("smart-animate"):t.sortButton.classList.remove("smart-animate"),e.dragDrop&&e.dragDrop.column===t.column?t.classList.add("dragged"):t.classList.remove("dragged"),t.column.sorted?t._showSortButton(!1):t._hideSortButton(!1),t.column.sorted?(t.setAttribute("aria-sort","asc"===t.column.sortOrder?"ascending":"descenting"),t._updateSortOrder()):(t.removeAttribute("aria-sort"),t.removeAttribute("sort-index")),(t.column.autoShowFilterButton||t.column.showFilterButton)&&(t.column.filtered?t._showFilterButton(!1):t._hideFilterButton(!1)),t.column.allowFilterButtonAnimation?t.filterButton.classList.add("smart-animate"):t.filterButton.classList.remove("smart-animate"),t.column.allowActionButtonAnimation&&!1!==t.allowAnimations?t.buttonsGroup.classList.add("smart-animate"):t.buttonsGroup.classList.remove("smart-animate"),t.column.allowLabelAnimation&&!1!==t.allowAnimations?t.label.classList.add("smart-animate"):t.label.classList.remove("smart-animate"),t.buttonsGroup.classList.remove("action"),t.actionButton.classList.contains("show")&&t.buttonsGroup.classList.add("action"),t.column.showIcon?(t.icon.classList.add("show","column-icon"),t.setAttribute("has-icon","")):(t.icon.classList.remove("show","column-icon"),t.removeAttribute("has-icon","")),t.icon.classList.contains("show"))if(t.icon.className="smart-grid-icon show column-icon",t.column.icon&&t.column.icon.indexOf(" ")>=0){const e=t.column.icon.trim().split(" ");for(let o=0;o<e.length;o++)t.icon.classList.add(e[o])}else t.icon.classList.add(t.column.icon);let l=t.column.showIcon?1:0;for(let e=0;e<t.buttonsGroup.children.length;e++)t.buttonsGroup.children[e].classList.contains("show")&&l++;switch(l){case 1:t.label.classList.add("one");break;case 2:t.label.classList.add("two");break;case 3:t.label.classList.add("three");break;case 4:t.label.classList.add("four");break;case 5:t.label.classList.add("five");break;case 6:t.label.classList.add("six")}t.classList.remove("smart-visibility-hidden"),t.column.grid._columnGap>0?t.classList.add("smart-grid-column-border"):t.classList.remove("smart-grid-column-border"),t.column.grid.appearance.showColumnHeaderLines?t.classList.remove("smart-grid-vertical-border-collapse"):t.classList.add("smart-grid-vertical-border-collapse"),(!t.column.rotationAngle||t._rotate())&&t._align()}_renderTemplate(){const t=this,e=t.column,o=e.labelTemplate;let l="";if("function"!=typeof o){if(o instanceof HTMLTemplateElement)l=o;else{if("string"!=typeof o||!o.startsWith||!o.startsWith("#"))return void(t.label.innerHTML=o);l=document.querySelector(o)}if(l){let o=l.content.cloneNode(!0).firstElementChild,n=e.label;n=n.toString(),n=n.replace(/'/gi,"\\'"),n=n.replace(/"/gi,'\\"');const i=o.outerHTML.replace(/{{value}}/gi,n).replace(/{{id}}/gi,e.label);t.label.innerHTML=i}}else t.label.innerHTML=o(e.label)}_render(){const t=this,e=t.column.dataField?t.column.dataField:"",o=t.column===t.column.grid._lastVisibleColumn;t.column.labelTemplate?t._renderTemplate():t.label.firstChild?t.label.firstChild.textContent!==t.column.label&&(t.column.label.indexOf("<")>=0?t.label.innerHTML="<span>"+t.column.label+"</span>":t.label.firstChild.textContent=t.column.label):t.label.innerHTML="<span>"+t.column.label+"</span>",t.column.title?t.setAttribute("title",t.column.title):t.removeAttribute("title"),t._refresh(),t.column.autoGenerated&&t.setAttribute("auto-generated",""),t.column.autoGenerated||o?t.style.width=t.column.computedWidth+"px":t.style.width=t.column.computedWidth-t.column.grid._columnGap+"px",t.style.height!==t.column.computedHeight+"px"&&(t.style.height=t.column.computedHeight+"px"),t.style.lineHeight!==t.column.computedHeight+"px"&&(t.style.lineHeight=t.column.computedHeight+"px"),t.column.grid.rightToLeft?t.style.right!==t.column.left+"px"&&(t.style.right=t.column.left+"px"):t.style.left!==t.column.left+"px"&&(t.style.left=t.column.left+"px"),t.style.top!==t.column.top+"px"&&(t.style.top=t.column.top+"px"),t.getAttribute("data-field")!==e&&t.setAttribute("data-field",e),t.setAttribute("header",""),t.column.freeze&&t.setAttribute("freeze",""),t.column.level>0&&(t.style.top=t.column.top+"px")}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_initialize(t){const e=this;e._isInitialized=!1;const o=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div"),i=document.createElement("div"),a=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),u=document.createElement("div"),d=document.createElement("div");e.column=t,e.classList.add("smart-visibility-hidden"),d.classList.add("smart-drag-handle"),s.classList.add("smart-icon","smart-grid-icon"),o.classList.add("smart-label"),l.classList.add("smart-sort-button","smart-grid-icon"),n.classList.add("smart-filter-button","smart-icon-filter","smart-grid-icon"),i.classList.add("smart-action-button","smart-grid-icon"),i.setAttribute("aria-haspopup",""),a.classList.add("smart-description-button","smart-icon-help-circled","smart-grid-icon"),r.classList.add("smart-custom-button",t.customButtonIcon?t.customButtonIcon:"smart-icon-tools","smart-grid-icon"),u.classList.add("smart-buttons-group"),i.innerHTML="<div></div>",e.style.width=e.column.computedWidth+"px",e.appendChild(d),e.appendChild(s),e.appendChild(o),e.appendChild(u),u.appendChild(l),u.appendChild(n),u.appendChild(a),u.appendChild(r),u.appendChild(i),e.handle=d,e.icon=s,e.label=o,e.sortButton=l,e.filterButton=n,e.actionButton=i,e.descriptionButton=a,e.customButton=r,e.buttonsGroup=u,e._properties=[];const c=window.PointerEvent?"pointerdown":"mousedown",m=window.PointerEvent?"pointerup":"mouseup";e._filterDownEvent=function(t){t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t)}.bind(e),e._filterUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionUpEvent=function(t){t.preventDefault(),t.stopPropagation()},e._actionDownEvent=function(t){t.preventDefault(),t.stopPropagation(),e.column.onAction&&e.column.onAction(t)}.bind(e),e.filterButton.addEventListener(c,e._filterDownEvent),e.filterButton.addEventListener(m,e._filterUpEvent),e.actionButton.addEventListener(m,e._actionUpEvent),e.actionButton.addEventListener(c,e._actionDownEvent),!e.column.autoShowActionButton&&e.column.showActionButton&&e._showActionButton(),!e.column.autoShowSortButton&&e.column.showSortButton&&e._showSortButton(),!e.column.autoShowFilterButton&&e.column.showFilterButton&&e._showFilterButton(),e.column.showDescriptionButton&&e._showDescriptionButton(),e.column.showCustomButton&&e._showCustomButton(),e.column.showIcon&&e._showIcon(),"_rowHeaderColumn"===e.column.dataField&&e.classList.add("top-near-corner"),e.customButton.onclick=function(t){e.column.onCustomButtonClick&&e.column.onCustomButtonClick(t)}.bind(e),e.column.sorted||e.column.sortOrder?(e.column.sorted=!0,e.setAttribute("aria-sort","asc"===e.column.sortOrder?"ascending":"descenting"),e._updateSortOrder()):(e.removeAttribute("aria-sort"),e.removeAttribute("sort-index")),e._properties=[],e._isInitialized=!0}template(){return""}_detach(){const t=this,e=window.PointerEvent?"pointerdown":"mousedown",o=window.PointerEvent?"pointerup":"mouseup";t.filterButton.removeEventListener(e,t._filterDownEven),t.filterButton.removeEventListener(o,t._filterUpEvent),t.actionButton.removeEventListener(o,t._actionUpEvent),t.actionButton.removeEventListener(e,t._actionDownEvent),t.element=null,t.column&&(t.column.grid=null,t.column.element=null),t.icon=null,t.label=null,t.sortButton=null,t.filterButton=null,t.actionButton=null,t.descriptionButton=null,t.customButton=null,t.buttonsGroup=null,t.column=null,delete t.grid,delete t.column,delete t.icon,delete t.label,delete t.sortButton,delete t.filterButton,delete t.actionButton,delete t.descriptionButton,delete t.customButton,delete t.buttonsGroup}onDetached(){this._detach()}});
|
|
49
49
|
Smart.Utilities.Assign("Grid.Row",class{constructor(e){const t=this;if(e||(e={}),Object.assign(t,e),e){if(void 0===t.data){const i={$:{}};if(e.grid&&e.grid.dataSource){const t=e.grid.dataSource;for(let e=0;e<t.dataFields.length;e++)i[(t.dataFields?t.dataFields[e]:{}).name]=""}else Object.assign(i,e);e.id&&(i.$.id=e.id),t.data=i}if((void 0===e.$||e.$&&void 0===e.$.id)&&(e.data?(e.data.$&&e.data.$.id&&(t.id=e.data.$.id),t.id||(t.id=e.index)):void 0===t.id&&(t.id=e.index),void 0===t.id&&(t.id=Smart.Utilities.Core.createGUID())),void 0===t.detailHeight&&(t.grid?t.detailHeight=t.grid.rowDetail.height:t.detailHeight=200),void 0===t.height&&t.grid&&(t.height=t.grid.layout.rowMinHeight,t.grid.__autoRowHeight&&(t.height=t.grid.__autoRowHeight),t.grid.layout.rowHeight&&(t.height=t.grid.layout.rowHeight)),void 0===t.cellHeight&&(t.cellHeight=t.height),void 0===t.showDetail&&(t.showDetail=!1),void 0===t.index&&(t.index=-1),void 0===t.visibleIndex&&(t.visibleIndex=-1),void 0===t.freeze&&(t.freeze=!1),void 0===t.height&&(t.height=null),void 0===t.minHeight&&(t.minHeight=25,t.grid&&(t.minHeight=t.grid.layout.rowMinHeight)),void 0===t.checked&&(t.checked=!1),void 0===t.selected?(t.selected=!1,(t.grid&&t.grid._selection.rows[t.id]||t.grid&&t.grid._selection.indexes[t.index])&&(t.selected=!0)):t.selected&&t.grid&&(t.grid._selection.rows[t.id]=!0,t.grid._selection.indexes[t.index]=t.index),void 0===t.enabled&&(t.enabled=!0),void 0===t.visible&&(t.visible=!0),void 0===t.allowCheck&&(t.allowCheck=!0),void 0===t.filtered&&(t.filtered=!0),void 0===t.allowResize&&(t.allowResize=!0),void 0===t.allowReorder&&(t.allowReorder=!0),void 0===t.allowToggle&&(t.allowToggle=!0),void 0===t.allowSelect&&(t.allowSelect=!0),void 0===t.starred&&(t.starred=!1),void 0===t.expanded&&(e.data&&void 0!==e.data.expanded?t.expanded=e.data.expanded:t.expanded=!1),t._addStyle(),t.headerCell=null,t._cells=[],t.name="",t.comments=[],!t.autoGenerated&&999999!==t.index){if(t.data){if(t.data.comments&&("string"==typeof t.data.comments?t.data.comments=JSON.parse(t.data.comments):t.comments=t.data.comments),t.data.rowStyle&&(t.style=t._style=e.rowStyle),t.data.history&&(t.history=t.data.history),t.data.style&&(t.style=t._style=t.data.style,t.grid&&(t.grid._cellStyles||(t.grid._cellStyles=[]),t.grid._cellStyles["row"+t.id]=!0,t.grid._cellStyles.length++)),t.data.settings){const e=JSON.parse(t.data.settings);void 0!==e.starred&&(t.starred=e.starred),void 0!==e.height&&(t.height=t.cellHeight=e.height)}const e=t.data.$?t.data.$:t.data;e.history&&(t.history=e.history),e.style&&(t.style=t._style=e.style),e.height&&(t.height=t.cellHeight=e.height),e.comments&&(t.comments=e.comments),e.starred&&(t.starred=e.starred),e.createdDate&&(t.createdDate=e.createdDate),e.createdBy&&(t.createdBy=e.createdBy),e.updatedDate&&(t.updatedDate=e.updatedDate),e.updatedBy&&(t.updatedBy=e.updatedBy)}t.grid&&t.grid._currentUser&&t.grid._currentUser.info&&(void 0===t.createdUserId?(t.createdUserId=t.grid._currentUser.info.id,t.createdDate=new Date):t.createdDate||(t.createdDate=new Date),t.history||(t.history=[],t.addHistory({action:"created",user:t.grid._currentUser.info.id,details:{value:t.name},date:t.createdDate})))}}}_addStyle(){this.style=this._style={background:"",color:"",status:"",fontSize:"",fontFamily:"",fontWeight:"",textDecoration:"",fontStyle:""}}setStyle(e){const t=this;t._style||t._addStyle(),["background","color","fontSize","status","fontFamily","fontWeight","textDecoration","fontStyle"].forEach((i=>{e[i]&&(t._style[i]=e[i])})),t.grid&&(t._style._changed=!0,t.grid._recycle(!1))}get properties(){return["allowToggle","allowResize","allowSelect","allowReorder","allowCheck","createdDate","updatedDate","createdBy","updatedBy","canNotify","children","starred","checked","cells","detailHeight","detailTemplate","cellHeight","expandHeight","data","enabled","expanded","filtered","freeze","grid","headerCell","height","index","id","minHeight","unbound","name","selected","showDetail","visible","parent","leaf","visibleIndex","history","comments","style"]}createElement(){const e=document.createElement("smart-grid-row");return this.element=e,e.setAttribute("role","row"),e._initialize(this),e}_autoSize(e){const t=this,i=t.grid;if(!i)return;let l=i.layout.rowMinHeight;void 0!==t.minHeight&&(l=t.minHeight);const a=t.element;if(e||(e=t),e&&(t.data=e.data),!a)return t.height;i.__autoHeightRows||(i.__autoHeightRows=[]);const n=(e,t,a)=>{if(!a||!t||t.autoGenerated)return 0;i.__autoHeightRows[t.dataField]||(i.__autoHeightRows[t.dataField]=[]);let n=""+e.data[t.dataField];"date"===t.dataType&&e.data[t.dataField]&&(n=""+e.data[t.dataField].toLocaleString());let r=n.length;e._templatesHeight&&e._templatesHeight[t.dataField]&&(r=e._templatesHeight[t.dataField]);const o=i.__autoHeightRows[t.dataField][r],d=o||function(e){a.style.height="auto",t.cellsWrap?a.content.classList.add("wrap"):a.content.classList.add("nowrap");let i=0;if(e&&t)if(t.template){const l=e.canNotify;if(e.canNotify=!1,a.cell.row=e,"function"==typeof t.template)if(a.content.textContent=e.data[t.dataField],e._templatesHeight&&e._templatesHeight[t.dataField])i=e._templatesHeight[t.dataField];else{const i={row:e,column:t,cell:a.cell,oldValue:a.cell.oldValue,value:a.cell.value,template:null,isMeasuring:!0},l=a.innerHTML;a.cell.template(i),i.template?(a.content.textContent="",a.innerHTML=l):a.content.textContent=e.data[t.dataField]}else a._setTemplate(e.data[t.dataField]||"",t.template,a.content);e.canNotify=l}else if("date"===t.dataType){const i=a.cell.getFormattedValue(e.data[t.dataField],t.cellsFormat);a.content.textContent=i}else a.content.textContent=e.data[t.dataField];let l=a.offsetHeight;return"function"==typeof t.template&&i>0&&(l=i),a.style.height="",a.content.classList.remove("wrap"),a.content.classList.remove("nowrap"),l}(e);l=Math.max(l,d),i.__autoHeightRows[t.dataField][r]=d};for(let t=0;t<i._frozenNearColumns.length;t++)n(e,i._frozenNearColumns[t],a.children[0].children[t]);for(let t=0;t<i._frozenFarColumns.length;t++)n(e,i._frozenFarColumns[t],a.children[2].children[t]);for(let t=0;t<a.children[1].children.length;t++)n(e,i._columnElements[t].column,a.children[1].children[t]);return l}addHistory(e){const t=this;e&&(t.grid.storeHistory?(void 0===t.history&&(t.history=[]),t.history.length===t.grid.storeHistoryItems&&t.history.splice(0,1),t.history.push(e)):t.history=[])}clearHistory(){this.history=[]}autoSize(){const e=this,t=e.grid._measureRowElement(e.data),i=e.data?t.row._autoSize(e):e.grid.layout.rowMinHeight;e.height=i,t.remove()}getCell(e){const t=this,i=t.grid;if(!i)return null;if("string"!=typeof e&&"number"!=typeof e||(e=i.columnByDataField[e]),!e)return null;if(t["column_"+e.dataField]){const i=t["column_"+e.dataField];return i.column=e,i}{const l=new Smart.Grid.Cell(t,e,i);return t["column_"+e.dataField]=l,l}}get cells(){const e=this;return e._cells&&e.grid&&e._cells.length===e.grid.columns.length||e.createCells(),e._cells}get viewCells(){const e=this,t=[];for(let i=0;i<e.grid.viewColumns.length;i++){const l=e.grid.viewColumns[i];if(e["column_"+l.dataField]){const i=e["column_"+l.dataField];t.push(i)}else{const i=new Smart.Grid.Cell(e,l,e.grid);e["column_"+l.dataField]=i,t.push(i)}}return e._viewCells=t,t}createCells(){const e=this,t=e.grid;e._cells=[];for(let i=0;i<t.viewColumns.length;i++){const l=t.viewColumns[i];if(!l.autoGenerated)if(e["column_"+l.dataField]){const t=e["column_"+l.dataField];e._cells.push(t)}else{const i=new Smart.Grid.Cell(e,l,t);e["column_"+l.dataField]=i,e._cells.push(i)}}}toggle(e){this.element._handleExpandCollapse(!this.expanded,e)}select(){this.setProperty("selected",!0)}unselect(){this.setProperty("selected",!1)}expand(){this.element&&this.element._handleExpandCollapse(!0)}collapse(){this.element&&this.element._handleExpandCollapse(!1)}render(){const e=this;e.element.row=e,e.element._render()}setProperty(e,t){const i=this,l=i.getProperty(e);i[e]=t,l!==t&&(i.canNotify=!1,i.propertyChanged(e,l,t),i.canNotify=!0)}getProperty(e){const t=this;if("selected"===e&&t.grid){let i=!1;t.grid._selection.cells["row"+t.id]&&(i=null),t.grid&&t.grid._selection.rows[t.id]&&(i=!0),t.grid&&t.grid._selection.indexes[t.index]&&(i=!0);const l=t.grid.rows.canNotify;return t.grid.rows.canNotify=!1,t[e]=i,t.grid.rows.canNotify=l,i}return t[e]}_updateData(){const e=this;e.data&&e.data.$&&["updatedBy","updatedDate","createdDate","createdBy","starred","comments","history","style"].forEach((t=>{void 0!==e.data.$[t]?(e[t]=e.data.$[t],"style"===t&&(e._style=e[t],e._style._changed=!0)):"starred"===t?e[t]=!1:"comments"===t||"history"===t?e[t]=[]:"updatedBy"===t?e[t]=-1:"updatedDate"===t?e[t]=null:"style"===t&&(e._addStyle(),e._style._changed=!0)}))}propertyChanged(e,t,i){const l=this;if("updatedBy"!==e&&"createdBy"!==e&&"userData"!==e&&"starred"!==e&&"style"!==e&&"history"!==e&&"updatedDate"!==e&&"createdDate"!==e&&"comments"!==e){if("showDetail"===e){l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled&&(l.height=0);const e=l.element.rowDetail;if(l.grid.appearance.allowRowDetailToggleAnimation&&!l.grid.rowDetail.dialog.enabled){l.grid._resizeHandling=!1;const t=function(e){const t=l.grid._toggledRow;!t||"transform"!==e.propertyName&&"height"!==e.propertyName||a(t)},a=function(e){e.grid.$.content.style.transition="",e.element.rowDetail.removeEventListener("transitionend",t),e.element.rowDetail.removeEventListener("transitioncancel",t),e.grid._toggledRow=null,e.element.removeAttribute("has-detail"),l.grid._refresh(),setTimeout((()=>{l.grid._resizeHandling=!0}),50)};l.grid._toggledRow=l,e.addEventListener("transitionend",t),e.addEventListener("transitioncancel",t),i?(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.element.toggleDetailButton.classList.remove("smart-animate"),setTimeout((()=>{l.element.toggleDetailButton.classList.add("smart-animate"),l.element.toggleDetailButton.setAttribute("toggled",""),l.element.setAttribute("show-detail","")})),l.element.style.height=l.cellHeight+l.detailHeight+"px",l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)+l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),e.classList.remove("smart-hidden"),e.style.height!==l.detailHeight+"px"&&(e.style.height=l.detailHeight+"px"),e.style.lineHeight!==l.detailHeight+"px"&&(e.style.lineHeight=l.detailHeight+"px"),e.style.top!==l.cellHeight+"px"&&(e.style.top=l.cellHeight+"px")):(l.element.setAttribute("has-detail",""),l.element.toggleDetailButton.removeAttribute("toggled"),l.grid._autoHeight&&(l.grid.$.content.style.transition="0.25s height ease-in-out",l.grid.$.content.style.height=parseInt(l.grid.$.content.style.height)-l.detailHeight+"px",l.grid.$.scrollView.style.height="auto"),setTimeout((()=>{l.element.style.height=l.cellHeight+"px",l.element.removeAttribute("show-detail")})))}else l.grid.rowDetail.enabled&&!l.grid.rowDetail.dialog.enabled?l.grid._refresh():l.grid._recycle()}if("allowCheck"!==e&&"allowSelect"!==e||l.grid._recycle(),"checked"===e&&(l.grid.checkBoxes.hasThreeStates&&l.grid._hasThreeStates(l,l),l.grid._recycle()),"selected"===e){if(!1===l.allowSelect)return;if(i?(l.grid._selection.rows[l.id]=!0,l.grid._selection.indexes[l.index]=l.index):!1===i&&(void 0!==l.grid._selection.rows[l.id]&&delete l.grid._selection.rows[l.id],void 0!==l.grid._selection.indexes[l.index]&&delete l.grid._selection.indexes[l.index]),!l.element)return;i?l.element.setAttribute("aria-selected",!0):l.element.removeAttribute("aria-selected"),l.grid._recycle()}"visible"===e&&l.grid.refresh(),"expanded"===e&&(l.expandHeight||l.grid.refresh()),"height"===e&&(l.expandHeight||l.cellHeight!==i&&(l.cellHeight=i,l.grid.refresh())),"minHeight"===e&&(l.height=null,l.grid.refresh()),"freeze"===e&&(!0===i||"near"===i?l.grid._frozenNearRows.push(l):"far"===i?l.grid._frozenFarRows.push(l):(l.grid._frozenNearRows.splice(l.grid._frozenNearRows.indexOf(l),1),l.grid._frozenFarRows.splice(l.grid._frozenFarRows.indexOf(l),1)),l.grid.refresh())}else l.data&&l.data.$&&(l.data.$[e]=i,"style"===e&&(l._style=i,l._style._changed=!0))}}),Smart("smart-grid-row",class extends Smart.BaseElement{static get properties(){return{}}get isUtilityElement(){return!0}get hasStyleObserver(){return!1}addThemeClass(){}addDefaultClass(){}_initialize(e){const t=this,i=e.grid,l=i._columnElements,a=i._frozenNearColumns,n=i._frozenFarColumns,r=document.createElement("div"),o=document.createElement("div"),d=document.createElement("div"),s=document.createDocumentFragment(),c=document.createDocumentFragment(),g=document.createDocumentFragment();i.rightToLeft?(o.classList.add("far","smart-grid-cell-container"),r.classList.add("center","smart-grid-cell-container"),d.classList.add("near","smart-grid-cell-container")):(o.classList.add("near","smart-grid-cell-container"),r.classList.add("center","smart-grid-cell-container"),d.classList.add("far","smart-grid-cell-container")),t._properties=[],t.row=e,e.createCells(),t._mouseEnter=function(){if(!i.isScrolling&&!i.editing.isEditing&&(t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.commandColumn.inline&&!t.commandBar)){const e=document.createElement("div"),l=i._getCommandColumnCommandsTemplate();e.classList.add("smart-grid-command-bar"),e.innerHTML=l,r.appendChild(e),requestAnimationFrame((()=>{e.classList.add("show")})),i._updateCommandColumnCommandsVisibility(e,t.row),e.onmousedown=function(e){const l=e.composedPath();let a=null;for(let e=0;e<l.length;e++)if(l[e].classList.contains("smart-grid-command-item")){a=l[e];break}if(a){const l=a.getAttribute("command");i._applyCommand(l,[t.row]),t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null),t.removeAttribute("hover"),e.stopPropagation(),e.preventDefault()}},t.commandBar=e}},t._mouseLeave=function(){i.isScrolling||i.editing.isEditing||t.commandBar&&(t.commandBar.classList.remove("show"),t.commandBar.addEventListener("transitionend",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})),t.commandBar.addEventListener("transitioncancel",(function(){t.commandBar&&(t.commandBar.parentNode.removeChild(t.commandBar),t.commandBar=null)})))},t.addEventListener("mouseenter",t._mouseEnter),t.addEventListener("mouseleave",t._mouseLeave);for(let t=0;t<a.length;t++){const i=a[t],l=e.getCell(i).createElement();c.appendChild(l)}for(let t=0;t<n.length;t++){const i=n[t],l=e.getCell(i).createElement();g.appendChild(l)}for(let i=0;i<l.length;i++){const a=l[i],n=a.column;if(!a.parentNode||!n)break;const r=e.getCell(n).createElement();n&&n._treeColumn&&(t.toggleButton=r.toggleButton),s.appendChild(r)}o.appendChild(c),r.appendChild(s),d.appendChild(g);const h=document.createElement("div");h.classList.add("smart-grid-row-detail","smart-hidden","smart-animate");const m=document.createElement("div");m.classList.add("smart-grid-row-sub-container","smart-hidden"),t._rowFragment=document.createDocumentFragment(),t._rowFragment.appendChild(o),t._rowFragment.appendChild(r),t._rowFragment.appendChild(d),t._rowFragment.appendChild(h),t._rowFragment.appendChild(m),t.appendChild(t._rowFragment),t.cellsNearContainerElement=t.children[0],t.cellsContainerElement=t.children[1],t.cellsFarContainerElement=t.children[2],t.rowDetail=t.children[3],t.rowContainer=t.children[4],i.layout.rowHeight&&"auto"!==i.layout.rowHeight&&(e.filterRow?t.style.height=i.layout.rowMinHeight+"px":t.style.height=i.layout.rowHeight+"px"),delete t._rowFragment}get enableShadowDOM(){return!1}_handleExpandCollapse(e,t){const i=this,l=i.row,a=l.grid;if(!l.allowToggle)return null;a._toggledRow=l;let n={row:l,id:l.id};t&&(n.originalEvent=t.originalEvent),a.$.fireEvent(e?"rowExpand":"rowCollapse",n);const r=a.dataSource.virtualDataSourceOnExpand&&e&&!0!==l.data._loaded;if(e?a.dataSource._expandedRowIds[l.data.$.id]=!0:delete a.dataSource._expandedRowIds[l.data.$.id],!a.appearance.allowRowToggleAnimation||r)a.rows.canNotify=!1,l.expanded=e,a.rows.canNotify=!0,l.data.expanded=e,r?(l.data._loaded=!0,l.element.querySelector("button").setAttribute("load",""),a._virtualDataRequest("expand")):(a._toggledRow=null,a._refresh()),r&&a.appearance.allowRowToggleAnimation&&(i.toggleButton.removeAttribute("toggled"),i.toggleButton.classList.remove("smart-animate"),setTimeout((()=>{i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")}),50));else{const t=function(e){e.height=e.cellHeight,a.$.content.style.transition="",e.element.rowContainer.innerHTML="",e.element.rowContainer.classList.add("smart-hidden"),e.element.rowContainer.removeEventListener("transitionend",n),e.element.rowContainer.removeEventListener("transitioncancel",n),e.element.rowContainer.style.height="",e.element.rowContainer.style.transform="",e.element.rowContainer.style.transition="",e.element.rowContainer.classList.remove("smart-animate"),e.element.toggleButton&&e.element.toggleButton.classList.remove("smart-animate"),a._refresh()},n=function(e){const l=a._toggledRow;i._toggleTimer=null,a._toggledRow=null,!l||"transform"!==e.propertyName&&"height"!==e.propertyName||setTimeout((()=>{t(l)}),50)};if(i._toggleTimer){clearTimeout(i._toggleTimer);const e=a._toggledRow;a._toggledRow=null,t(e)}i._toggleTimer=setTimeout((()=>{const t=function(){!function(){const e=a._toggledRow;a._refresh(),a._refreshRowHierarchy();let t=0;for(let e=0;e<a.rowHierarchy.length;e++){const i=a.rowHierarchy[e];let l=i.parent;for(;l;)l.id===a._toggledRow.id&&(t+=i.height),l=l.parent}const i=a._scrollView.scrollTop,l=a._contentHeight-(e.cellHeight+e.top-i);e.expandHeight=Math.min(l,t),e.height=e.cellHeight+e.expandHeight}(),a._recycle(!1),i.style.overflow="hidden",i.style.height="auto",i.style.lineHeight=l.cellHeight+"px"};e?(l.expanded=!0,t(),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",i.toggleButton&&i.toggleButton.removeAttribute("toggled"),a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),setTimeout((function(){i.toggleButton&&(i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")),i.rowContainer.addEventListener("transitionend",n),i.rowContainer.addEventListener("transitioncancel",n),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)"}))):(t(),l.expanded=!1,i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px",a._autoHeight&&(a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px",a.$.content.style.transition="",a.$.content.style.height=parseInt(a.$.content.style.height)+l.expandHeight+"px"),i.rowContainer.style.height=l.expandHeight+"px",i.rowContainer.style.transform="scaleY(1)",i.toggleButton&&(i.toggleButton.setAttribute("toggled",""),i.toggleButton.classList.add("smart-animate")),setTimeout((function(){i.toggleButton&&i.toggleButton.removeAttribute("toggled",""),a._autoHeight&&(a.$.content.style.transition="0.25s height ease-in-out",a.$.content.style.height=parseInt(a.$.content.style.height)-l.expandHeight+"px"),i.rowContainer.addEventListener("transitionend",n),i.rowContainer.addEventListener("transitioncancel",n),i.rowContainer.classList.add("smart-animate"),i.rowContainer.style.transform="scaleY(0)",i.rowContainer.style.height="0px"}),0))}),50)}}_renderAddNewRow(){const e=this,t=e.row,i=t.grid,l=t.element,a=new Smart.Grid.Cell(t,i.columns[0],i);t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden");let n=i.editing.addNewRow.label;n.indexOf("{{")>=0&&(n=i.localize("addNewRow")),l.innerHTML="<smart-grid-cell><div>"+n+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),l.firstChild.cell=a,i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px"))}_renderFilterRow(){const e=this,t=e.row,i=t.grid,l=t.element;t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),l.innerHTML="<smart-grid-cell><div>"+i.localize("addNewRow")+"</div></smart-grid-cell>",l.firstChild.firstChild.classList.add("align-center"),l.firstChild.classList.add("smart-grid-column-border-collapse"),l.firstChild.setAttribute("freeze",""),l.firstChild.setAttribute("addNewRow",""),l.firstChild.style.width="100%",i._scrollView.vScrollBar.offsetWidth>0&&(l.firstChild.style.width="calc(100% - "+(-1+i._scrollView.vScrollBar.offsetWidth)+"px)"),e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")}_renderEmpty(){this.classList.add("smart-hidden")}_renderCell(e,t,i){if(!t)return void i.classList.add("smart-hidden");let l=e.getCell(t);if(l.element!==i&&(l._styleChanged=!0),e._style&&!t.autoGenerated){const t=l._updating;l._updating=!0,e._style._changed&&(l.color=e._style.color,l.background=e._style.background,l.fontFamily=e._style.fontFamily,l.fontSize=e._style.fontSize,l.fontStyle=e._style.fontStyle,l.textDecoration=e._style.textDecoration,l.fontWeight=e._style.fontWeight);const a=i.firstElementChild,n=e=>a._style&&a._style[e]?a._style[e]:"backgroundColor"===e&&null===l.background&&""===a.style[e]||null===l[e]&&""===a.style[e]?null:a.style[e];n("backgroundColor")===l.background&&n("fontFamily")===l.fontFamily&&n("fontSize")===l.fontSize&&n("fontStyle")===l.fontStyle&&n("textDecoration")===l.textDecoration&&n("fontWeight")===l.fontWeight&&n("color")===l.color||(l._styleChanged=!0),l._updating=t}i.cell!==l&&(i.cell.background===l.background&&i.cell.borderColor===l.borderColor&&i.cell.color===l.color&&i.cell.fontSize===l.fontSize&&i.cell.fontFamily===l.fontFamily&&i.cell.textDecoration===l.textDecoration&&i.cell.fontWeight===l.fontWeight&&i.cell.fontStyle===l.fontStyle||(l._styleChanged=!0)),l.element=i,i.cell=l,t._treeColumn&&l.element.isRendered&&!e.filterRow&&l.element._refresh(),l.render(),t&&t.rowHeaderColumn&&(e.header=i,i.setAttribute("data-id",e.id))}_alternate(){const e=this,t=e.row,i=t.grid,l=i.appearance.alternationStart,a=i.appearance.alternationEnd>0?i.appearance.alternationEnd:1/0;if(!(i.appearance.alternationCount<=0)&&(e.removeAttribute("alternation-index"),t.visibleIndex>=l&&t.visibleIndex<=a)){const a=(t.visibleIndex-l)%i.appearance.alternationCount;e.setAttribute("alternation-index",a)}}_openRowDetailDialog(e){const t=this,i=t.row.grid,l=t.row;if(!i.rowDetail.dialog.enabled||!l.showDetail)return!1;const a=i._dialogRowDetail||i._createDialog(i.rowDetail.dialog);if(!l.detailTemplate&&!i.rowDetail.template&&i._openRowSettingsDialog)return void(i.editing.dialog.visible||(t._settingsDialogRowId=l.id,i._openRowSettingsDialog(l.id)));if(i.rowDetail.dialog.visible&&a.row!==l)return void(l.showDetail=!1);const n="{{message}}"===i.rowDetail.dialog.header?i.localize("dialogRowDetailHeader",{value:l.visibleIndex+1}):i.rowDetail.dialog.header;!i.rowDetail.dialog.visible||i.rowDetail.dialog.row!==l||l.showDetail?(a.header.innerHTML=n,a.content.innerHTML="",a.content.style.width="100%",a.content.style.height="100%",a.row=l,a.querySelector(".smart-footer").classList.add("smart-hidden"),i._dialogRowDetail||(a.setAttribute("tabindex",0),a.modal=!0,a.btnConfirm.innerHTML=i.localize("dialogRowDetailButtonConfirm"),a.btnCancel.innerHTML=i.localize("dialogRowDetailButtonCancel"),a.btnCancel.classList.add("smart-hidden"),a.onOpen=function(){i.rowDetail.dialog.visible=!0},a.onClose=function(){i.rowDetail.dialog.visible=!1,a.row.showDetail=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},i._dialogRowDetail=a),a.open(),setTimeout((function(){a.focus()}),100),a.content.appendChild(e)):a.close()}_renderDetail(e){const t=this,i=t.row.grid,l=t.row;let a=l.id,n=l.detailTemplate||i.rowDetail.template;if(n.startsWith("#")&&(n=document.querySelector(n)),l._detail)return e.firstChild===l._detail||(e.firstChild&&e.removeChild(e.firstChild),e.appendChild(l._detail)),void(i.onRowDetailUpdated&&i.onRowDetailUpdated(l.index,l,e.firstChild));if(n instanceof HTMLTemplateElement){const t=n.content.cloneNode(!0).firstElementChild;a=a.toString(),a=a.replace(/'/gi,"\\'"),a=a.replace(/"/gi,'\\"');let i=t.outerHTML.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id);i.indexOf("{{value=")>=0&&(a?(i=i.substring(0,i.indexOf("{{value="))+a+i.substring(i.indexOf("}")),i=i.replace(/}/gi,""),i=i.replace(/{/gi,"")):(i=i.replace(/{{value=/gi,""),i=i.replace(/}}/gi,""))),i="<div>"+i+"</div>";for(let e in l.data)i=i.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==i&&(e.innerHTML=i)}else{let t="<div>"+n.replace(/{{value}}/gi,a).replace(/{{id}}/gi,l.id)+"</div>";for(let e in l.data)t=t.replace("{{"+e+"}}",l.data[e]);e.innerHTML!==t&&(e.innerHTML=t)}i.onRowDetailInit&&i.onRowDetailInit(l.index,l,e.firstChild),i.rowDetail.dialog.enabled?i.rowDetail.dialog.visible?t._openRowDetailDialog(e.firstChild):t._openRowDetailDialog(e.firstChild.firstElementChild):l._detail=e.firstChild}_render(){let e=this;const t=e.row,i=t.grid;if(!i)return;const l=t.getProperty("selected");if(!1===l&&e.hasAttribute("selected")?e.removeAttribute("selected"):!0===l?e.setAttribute("selected",""):null===l&&e.setAttribute("selected","indeterminate"),t.allowSelect||e.setAttribute("selected","none"),e.hasAttribute("unbound")&&e.removeAttribute("unbound"),t.unbound&&e.setAttribute("unbound",""),e.removeAttribute("focus"),i._selection.focusedCell&&i._selection.focusedCell.row&&i._selection.focusedCell.row.id===t.id&&e.setAttribute("focus",""),!i._toggledRow&&e.classList.contains("smart-animate"))return e.classList.remove("smart-animate"),e.rowContainer.innerHTML="",e.rowContainer.classList.add("smart-hidden"),i._refreshLayout(),void i._recycle();if(0===i.columns.length)return void e._renderEmpty();if(t.addNewRow&&!t.inline)return void e._renderAddNewRow();let a=!1;if(t.addNewRow&&t.inline&&(a=!0),i._toggledRow&&(t.id===i._toggledRow.id?e.setAttribute("toggle",""):e.hasAttribute("toggle")&&e.removeAttribute("toggle")),i._toggledRow&&i.appearance.allowRowToggleAnimation){let l=t.parent;if(!i._toggledRow.expanded&&i._toggledRow.id===t.id){const t=e.rowContainer;for(let e=0;e<t.children.length;e++){const l=t.children[e],a=l.getAttribute("data-id"),n=i.rowById[a];l.getAttribute("data-rendered")||(l.setAttribute("data-rendered",!0),n.element=l,n.render())}}for(;l;){if(l.id===i._toggledRow.id){const a=l.element.rowContainer;if(i._toggledRow.expanded){e.classList.add("smart-hidden");let l=t.createElement(i);for(let e=0;e<a.children.length;e++){const i=a.children[e];if(i.getAttribute("data-id")===t.id.toString())return void(l=i)}t.element=l,a.appendChild(l),a.classList.remove("smart-hidden"),l.row=t,e=l}break}l=l.parent}}e._alternate();const n=parseFloat(i.$.columnNearContainer.style.width),r=parseFloat(i.$.columnContainer.style.width),o=parseFloat(i.$.columnFarContainer.style.width),d=e.children[1],s=e.children[0],c=e.children[2];if(i.rightToLeft?(s.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&s.classList.add("vscroll")):(c.classList.remove("vscroll"),i.computedVerticalScrollBarVisibility&&c.classList.add("vscroll")),e.hasAttribute("group")&&e.removeAttribute("group"),e.hasAttribute("tree")&&e.removeAttribute("tree"),e.hasAttribute("level")&&(e.removeAttribute("level"),e.removeAttribute("aria-level")),e.hasAttribute("leaf")&&e.removeAttribute("leaf"),e.hasAttribute("expanded")&&e.removeAttribute("expanded"),e.hasAttribute("summary")&&e.removeAttribute("summary"),e.hasAttribute("filter")&&e.removeAttribute("filter"),null===t.filtered&&e.setAttribute("filter","indeterminate"),i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&"advanced"===i.grouping.renderMode&&!t.filterRow?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),void 0!==t.label&&t.level===i.dataSource.groupBy.length-1&&e.setAttribute("leaf",""),void 0!==t.label?e.setAttribute("group",""):e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):i.dataSource.boundHierarchy?(e.setAttribute("level",t.level),e.setAttribute("aria-level",t.level),t.expanded&&e.setAttribute("expanded",""),t.leaf&&e.setAttribute("leaf",""),t.summaryRow&&e.setAttribute("summary",""),e.toggleButton&&e.toggleButton.classList.remove("smart-hidden")):(t.canNotify=!1,t.leaf=!0,t.expanded=!1,t.summaryRow=!1,t.data||(t.data={}),t.data.summaryRow&&(t.summaryRow=!0),t.level=0,e.toggleButton&&e.toggleButton.classList.add("smart-hidden"),t.canNotify=!0),e.setAttribute("data-id",t.id),e.visible=t.visible,e.cellsNearContainerElement.classList.remove("smart-visibility-hidden"),e.cellsContainerElement.classList.remove("smart-visibility-hidden"),e.cellsFarContainerElement.classList.remove("smart-visibility-hidden"),e.removeAttribute("rowspan"),i._rowGap>0&&t!==i.rows[i.rows.length-1]?(e.style.marginBottom=i._rowGap+"px",parseInt(e.style.height)-i._rowGap!==t.height&&(e.style.height=t.height-i._rowGap+"px"),parseInt(e.style.lineHeight)-i._rowGap!==t.height&&(e.style.lineHeight=t.height-i._rowGap+"px")):(e.style.marginBottom="",parseInt(e.style.height)!==t.height&&(e.style.height=t.height+"px"),parseInt(e.style.lineHeight)!==t.height&&(e.style.lineHeight=t.height+"px")),i.rightToLeft?(d.style.right!==i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"&&(d.style.right=i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth+"px"),i._scrollView.scrollWidth-i._scrollView.scrollLeft-i._scrollView.vScrollBar.offsetWidth<=0&&!i._scrollView.scrollWidth&&(d.style.right=-i.offsetWidth+i._computedColumnsWidth+"px")):d.style.left!==-i._scrollView.scrollLeft+"px"&&(d.style.left=-i._scrollView.scrollLeft+"px"),i.rowDetail.enabled){const l=e.rowDetail;e.removeAttribute("show-detail"),t.showDetail?(l.classList.remove("smart-hidden"),e.setAttribute("show-detail",""),i.rowDetail.dialog.enabled?l.classList.add("smart-hidden"):(l.style.height!==t.detailHeight+"px"&&(l.style.height=t.detailHeight+"px"),l.style.lineHeight!==t.detailHeight+"px"&&(l.style.lineHeight=t.detailHeight+"px"),l.style.top!==t.cellHeight+"px"&&(l.style.top=t.cellHeight+"px")),e._renderDetail(l)):l.classList.add("smart-hidden")}else e.rowDetail&&e.rowDetail.classList.add("smart-hidden");if(s.classList.remove("smart-hidden"),c.classList.remove("smart-hidden"),s.style.width!==n+"px"&&(s.style.width=n+"px"),d.style.width!==r+"px"&&(d.style.width=r+"px"),c.style.width!==o+"px"&&(c.style.width=o+"px"),s.style.height=t.cellHeight+"px",d.style.height=t.cellHeight+"px",c.style.height=t.cellHeight+"px",0===o&&c.classList.add("smart-hidden"),0===n&&s.classList.add("smart-hidden"),n>0&&(parseInt(n),parseInt(i._autoGeneratedColumnsNearWidth)),o>0&&parseInt(o)===parseInt(i._autoGeneratedColumnsFarWidth)&&c.classList.add("border-collapse"),t._classNames="",i.onRowClass){const e=i.onRowClass(t.visibleIndex,t.data,t);if(e){const i=e.trim().split(" ");t._classNames=i}}if(i.rowCSSRules){const e=Object.keys(i.rowCSSRules);for(let l=0;l<e.length;l++){let a=e[l];const n={index:t.visibleIndex,data:t.data,row:t,api:i};i.rowCSSRules[a](n)&&(t._classNames=[a])}}for(let l=0;l<i._frozenNearColumns.length;l++){const a=i._frozenNearColumns[l];let n=e.children[0].children[l];n||(n=t.getCell(a).createElement(),e.children[0].appendChild(n)),!1!==a.visbile&&e._renderCell(t,a,n)}for(let l=0;l<i._frozenFarColumns.length;l++){const a=i._frozenFarColumns[l];let n=e.children[2].children[l];n||(n=t.getCell(a).createElement(),e.children[2].appendChild(n)),!1!==a.visbile&&e._renderCell(t,a,n)}for(let l=0;l<d.children.length;l++)if(!i._columnElements[l+i._frozenNearColumns.length]){let i=e.children[1].children[l];e._renderCell(t,null,i)}for(let l=0;l<i._columnElements.length;l++){const a=i._columnElements[l],n=a.column;if(!a.parentNode||!n){if(a&&!n){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}continue}let r=e.children[1].children[l];r||(a.column||(a.column=n),r=t.getCell(n).createElement(),e.children[1].appendChild(r)),a.classList.contains("smart-visibility-hidden")?r.classList.add("smart-visibility-hidden"):(r.classList.remove("smart-visibility-hidden"),e._renderCell(t,n,r))}if(a){let t=e.children[1].children[0];const l=d.getBoundingClientRect(),a=s.getBoundingClientRect();for(let e=0;e<s.children.length;e++)s.children[e].classList.add("smart-add-new-row");s.children[0].innerHTML='<div style="width: 100%;" class="smart-grid-icon smart-icon-plus show"></div>',s.children[0].style.width="50px",s.children[0].style.zIndex=9;const n=i.editing.addNewColumn.visible?i._addNewColumn.width:0,r=l.width-a.width-n;t.style.width=r+"px",t.style.left=i._scrollView.scrollLeft+a.width+"px",i.selection.enabled?(t.content.innerHTML=r>=250?i.localize("addNewRowAlt"):i.localize("addNewRowAltSmall"),s.children[1]&&(t.content.title=s.children[1].title=i.localize("addNewRow")),i.rightToLeft&&(t.style.left="initial",t.style.right=a.width+"px"),!1===i.appearance.showRowHeader&&(i.rightToLeft?t.content.innerHTML='<span style="margin-right: 35px;"></span>'+i.localize("addNewRowAlt"):t.content.innerHTML='<span style="margin-left: 35px;"></span>'+i.localize("addNewRowAlt"))):t.content.innerHTML=i.localize("addNewRow"),t.classList.add("smart-add-new-row"),t.firstElementChild.classList.add("align-left"),t.firstElementChild.classList.remove("align-right")}t&&t._style&&(t._style._changed=!1),e.visible?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")}template(){return""}_detach(){const e=this;e.row.headerCell=null,e.row._cells=[],e.row=null,delete e.row,e.element=null,e.removeEventListener("mouseenter",e._mouseEnter),e.removeEventListener("mouseleave",e._mouseLeave),delete e.element,delete e.grid,delete e._mouseEnter,delete e._mouseLeave,delete e.cellsNearContainerElement,delete e.cellsContainerElement,delete e.cellsFarContainerElement,delete e.rowDetail,delete e.rowContainer}onDetached(){this._detach()}});
|
|
50
|
-
Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,e._style){const t=e._style;l.color=t.color,l.background=t.background,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize,l.fontStyle=t.fontStyle,l.textDecoration=t.textDecoration,l.fontWeight=t.fontWeight}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(e,t){if("value"===t)return l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if("editor"===t||"template"===t)return e[t]||l.column[t];if("focused"===t){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!0;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!0;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===t)return!0===l.row.getProperty("selected")||!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField];if("modifiedValue"===t){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const t=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==t?t:e.value}return e[t]},set:function(e,a,i){const n=this.get(e,a);return n===i||(e[a]=i,!("element"!==a&&"isEditing"!==a&&"oldValue"!==a&&"_updating"!==a&&"notifyFn"!==a&&!a.startsWith("_")&&"canNotify"!==a)||("error"===a||("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a&&(void 0===l.oldValue&&(l.oldValue=n),(()=>{l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),null!==i&&i.label&&i.value?(l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value):(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i);const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;l.grid.dataSource&&i!==l.grid.dataSource.boundSource[t][l.column.dataField]&&(l.grid._sortedColumns&&l.grid._sortedColumns.length>0?e[l.column.dataField]=i:l.grid.dataSource.boundSource[t][l.column.dataField]=i)}l.grid.dataSource.boundSource.canNotify=!0})()),"selected"===a&&(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0)),!(!l._updating&&l.canNotify&&(l.grid._recycle(),l.row.canNotify&&(l.propertyChanged&&l.propertyChanged(name.substring(1),n),0)))))))}})}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},i=e=>{const i=t[e];if(""===i||null===i)return;const n=a[e];l+=`${n}: ${i};`},n=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<n.length;e++)i(n[e]);e.getAttribute("style")!==l&&e.setAttribute("style",l),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t)+" - "+l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){const a=l.formatNumber(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat)return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e);!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits?l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits:2,a=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:t,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+a.replace("-","")+")":a}return l.column.formatSettings.Intl.NumberFormat.locale?new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,l.column.formatSettings.Intl.NumberFormat).format(e):new Intl.NumberFormat(this.grid.locale,l.column.formatSettings.Intl.NumberFormat).format(e)}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const n=i.formatNumber(e,t);return void 0===n?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+n+")":n}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let n=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(n=n.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let r=0;r<i._cellsMerge.length;r++){const s=i._cellsMerge[r];let o=[],d=[];if(o.push(s.row),s.rowspan>1){const e=n.indexOf(s.row);if(e>=0)for(let t=e;t<e+s.rowSpan;t++)n[t]&&-1===o.indexOf(n[t])&&o.push(n[t])}if(d.push(s.column.dataField),s.colspan>1){const e=i.columns.indexOf(i.columnByDataField[s.column.dataField]);for(let t=e;t<e+s.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(o.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:s.row.getCell(s.column.dataField),rows:o,columns:d,row:s.row,column:s.column,endRow:o[o.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const n=s.row.getCell(s.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=n,n}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),n=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),o=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=s,e.appendChild(a),e.appendChild(r),r.setAttribute("content",""),a.setAttribute("indent",""),n.setAttribute("label",""),i.setAttribute("toggle-button",""),s.setAttribute("checkbox",""),s.setAttribute("role","checkbox"),l.setAttribute("has-toggle-button",""),r.appendChild(i),r.appendChild(s),o.classList.add("smart-input"),s.appendChild(o),d.checkBoxes.visible?o.classList.remove("smart-hidden"):o.classList.add("smart-hidden"),r.appendChild(n),l.content=n}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let n=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(n=!0,e.row.filterRow&&(n=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(n=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(n=!1)),n)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group","");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let n=a.label;const r=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&r(e,i.children,l))}return l};if(void 0!==a.label){let s="",o=[];if(t.grouping.summaryRow.visible){const n=r(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[]),d={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;d[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([d],n):null;if(m)for(let a=0;a<c.length;a++){const i=c[a];a>0&&(s+=", ");let n=m[l.dataField][i];const r=l.cellsFormat;r&&(n=e.cell.getFormattedValue(n,r)),s+=t.localize(i,{value:n}),o.push(m[l.dataField][i])}}if(t.dataSource.virtualDataSourceOnExpand&&(s=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)n="<div header group-advanced><span group></span><span value></span>",s&&(n+="<div summary>",n+=s,n+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let r="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e));t&&t.color?(r=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}n=`<div style="${r}" header group-advanced><span group>${i}: </span><span value>${e}</span>`,s&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=""+s,n+="</span>")}n+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)n="<div header><span group></span><span value></span>",s&&(n+="<div summary>",n+=s,n+="</div>");else{let e=a.label;"object"==typeof e&&l.cellsFormat&&(e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)),n="<div header><span group>"+i+": </span><span value>"+e+"</span>",s&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=" ("+o+")",n+="</span>")}n+="</div>",e.classList.add("smart-grid-column-border-collapse")}else("basic"===t.grouping.renderMode||"multipleColumns"===t.grouping.renderMode)&&(n=a.label,"object"==typeof n&&l.cellsFormat&&(n=a.getCell(l.dataField).getFormattedValue(n,l.cellsFormat)),a.summaryRow?s&&(n+="<div summary>",n+=s,n+="</div>"):s&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=" ("+o+")",n+="</span>"),e.classList.add("smart-grid-column-border-collapse"));e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),n=s}let s=e.firstChild;if(t.dataSource.boundHierarchy&&i){s.children.length<=1&&(e.innerHTML="<div></div>",s=e.firstChild,e._createToggleButton(s,e.cell),s=e.firstChild);const r=s.children[0],o=s.children[1].children[0],d=s.children[1].children[1].firstChild,c=s.children[1].children[2];r.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?o.classList.add("smart-visibility-hidden"):(o.classList.remove("smart-visibility-hidden"),a.expanded?o.setAttribute("toggled",""):o.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",r.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';r.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?o.classList.add("smart-hidden"):(o.classList.remove("smart-hidden"),o.style.marginLeft=""),r.innerHTML=m,c.innerHTML=n,i&&t.grouping.formatFunction){const i={row:a,column:l,cell:e.cell,value:n,template:null};t.grouping.formatFunction(i),i.value!==n?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:n):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(s.innerHTML=n);let o="smart-label";e.style.zIndex="";const d=t.editing.addNewColumn.visible?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l.cellsAlign&&(o+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(o+=" align-"+l.cellsVerticalAlign),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)");if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(o+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(o+=" align-"+l.cellsVerticalAlign)),s.className!==o&&(s.className=o),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,group:{value:n,template:null}};l.formatFunction(t),t.group.value!==n&&(l._treeColumn?s.children[1].children[2].innerHTML=t.group.value:s.innerHTML=t.group.value),null!==t.group.template&&(s.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const n=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:n,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:n,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:n,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:n,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:n,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:n,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:n,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:n,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:n,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:n,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:n,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:n,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:n,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:n,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]),i="string"===a.dataType?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let r="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition)a._filterInfo.condition="",r="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":r="smart-icon-equals";break;case"starts_with":r="smart-icon-starts-with";break;case"ends_with":r="smart-icon-ends-with";break;case"not_equal":r="smart-icon-not-equal";break;case"less_than":r="smart-icon-less-than";break;case"less_than_or_equal":r="smart-icon-less-than-or-equal";break;case"greater_than":r="smart-icon-greater-than";break;case"greater_than_or_equal":r="smart-icon-greater-than-or-equal";break;case"contains":r="smart-icon-contains";break;case"does_not_contain":r="smart-icon-does-not-contain";break;case"range":r="smart-icon-between";break;default:r="smart-icon-search"}let s=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${r} show"></i></div> `;if("string"===a.dataType)s+=`<input class="smart-filter-input-value" data-type="${a.dataType}" /> `,e.innerHTML=s;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;s+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=s,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)s+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=s,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const a=document.createElement("div");a.classList.add("smart-input"),a.classList.add("smart-grid-check-box-cell-editor"),a.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),a.setAttribute("checked","indeterminate"),s=a.outerHTML,e.innerHTML=s,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const o=e.querySelector("input");if(o&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),o.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),o.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),o.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),o.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=o,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&(o.value=a._filterInfo.value,"date"===a.dataType&&(o.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),a.allowFilter||(o.disabled=!0),a.filterEditor)if(a.filterEditor.template){const t=a.filterEditor.template,l=document.createElement("div");a.filterTemplate instanceof HTMLTemplateElement?l.appendChild(t.content.cloneNode(!0)):t instanceof HTMLElement?l.appendChild(t):l.innerHTML=t,e.innerHTML="",e.appendChild(l),l.style.height="100%",l.style.width="100%";const i=e.querySelector("input");i&&(i.onfocus=()=>{e.setAttribute("focus","")},i.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,l)}else void 0!==a.filterEditor.min&&(o.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(o.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(o.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(o.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(o.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(o.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(o.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(o.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(e,t,l){const a=this,i=a.cell.grid,n=a.cell.column;let r=null;switch((!i.editing.enabled||!n.allowEdit||a.cell.readonly||i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.editRow!==a.cell.row)&&a.setAttribute("readonly",""),t){case"checkBox":case"radioButton":case"switchButton":r=document.createElement("span"),r.className="smart-input",e?r.setAttribute("checked",""):null===e?r.setAttribute("checked","indeterminate"):r.removeAttribute("checked"),a.setAttribute("template",a.cell.template);break;case"checklist":if(e&&e.indexOf("[")>=0&&(e=JSON.parse(e)),l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&l.firstElementChild.getAttribute("value")===e.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(e&&Array.isArray(e)&&e.length>0){const t=e.filter((e=>e.completed)).length;e=i.localize("completed",{value:t})+"/"+e.length}else e="";r=document.createElement("span"),r.innerHTML=e,a.setAttribute("template",a.cell.template),r.setAttribute("value",e.length);break;case"createdBy":case"updatedBy":{const e=a.cell.row;let s=null,o=null;if(s="createdBy"===t?e.createdBy:e.updatedBy,l.firstElementChild&&l.firstElementChild.hasAttribute("user-id")&&s===parseInt(l.firstElementChild.getAttribute("user-id")))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",a.cell.row.id);let c="";if(null!=s&&-1!==s){o=i.users.find((e=>e.id===s));const e=o,t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,n=document.createElement("span");a&&(n.style.backgroundImage=`url('${e.image}')`,n.className="smart-drop-down-list-selection-image"),c+=l?'<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+';" class="smart-truncate smart-token">'+n.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>":'<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+n.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}d.innerHTML=c;const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),r=m,r.setAttribute("user-id",s),a.setAttribute("template",a.cell.template);break}case"tags":{let t=[];if("number"==typeof e&&(e=""+e),null!==e&&(t=e.indexOf("{")>=0||"[]"===e?JSON.parse(e):e.split(",").map((e=>e.trim()))),l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&n.editor._items&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const s=document.createElement("div");s.classList.add("smart-multi-combo-input"),s.setAttribute("data-field",n.dataField),s.setAttribute("row-id",a.cell.row.id);let o="";if(e)for(let e=0;e<t.length;e++){const l=t[e];let a=null;if(n.editor.dataSource)if("string"==typeof l&&n.editor._items&&n.editor._items[l])a=n.editor._items[l];else for(let e=0;e<n.editor.dataSource.length;e++){const t=n.editor.dataSource[e];if(void 0!==t.value&&void 0!==l&&void 0!==l.value&&t.value===l.value){a=t,n.editor._items||(n.editor._items=[]),n.editor._items[l]=t;break}if(void 0===t.value&&t===l||void 0!==t.value&&""+t.value===l){a=t,n.editor._items||(n.editor._items=[]),n.editor._items[l]=t;break}}else a=l;if(!a)continue;const i="string"==typeof a?a:a.label,r="string"==typeof a?null:a.color,s="string"==typeof a?null:a.image;if(""===i)continue;const d=document.createElement("span");if(s&&(d.style.backgroundImage=`url('${a.image}')`,d.className="smart-drop-down-list-selection-image"),r&&n.editor.colorItems?o+='<span title="'+i+'" data-item="'+i+'" style="background: '+r+"; color: "+new Smart.Color(r).getInvertedColor()+';" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>":o+='<span title="'+i+'" data-item="'+i+'" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>",n.editor.dataSource){if(n.editor.singleSelect){o+="</span>";break}o+='<span class=\'smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else o+="</span>"}if(s.innerHTML=o,s.onpointerdown=e=>{if(e.target&&"#text"!==e.target.nodeName&&e.target.classList.contains("smart-drop-down-list-unselect-button")){const l=e.target.parentNode.getAttribute("data-item");if(t[0]&&t[0].label){const r=t.map((e=>e.value)).indexOf(l);r>=0&&(t.splice(r,1),i.setCellValue(a.cell.row.id,n.dataField,JSON.stringify(t)),e.preventDefault(),e.stopPropagation())}else t.indexOf(l)>=0&&(t.splice(t.indexOf(l),1),i.setCellValue(a.cell.row.id,n.dataField,t.join(", ")),e.preventDefault(),e.stopPropagation())}else if(e.target.classList.contains("smart-drop-down-list-selection-label")){if(i.editing.enabled){const t=e.target.parentElement.parentElement,l=t.getAttribute("data-field"),a=t.getAttribute("row-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}},!n.cellsWrap&&n.allowEdit&&i.editing.enabled){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const t=document.createElement("div");t.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),s.classList.add("smart-flex-auto"),i.rightToLeft&&(s.style.direction="rtl"),t.appendChild(s),"input"!==n.editor.template&&t.appendChild(e),r=t,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.previousElementSibling,l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}}else n.cellsWrap||n.allowEdit||s.classList.add("smart-flex-auto"),r=s;a.setAttribute("template",a.cell.template),r.setAttribute("value",e);break}case"dropDownList":case"dropdownlist":case"list":{const t=document.createElement("div");if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(t.innerHTML='<span class="smart-truncate">'+e+"</span>",n.allowEdit&&i.editing.enabled){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),t.classList.add("smart-flex-auto"),l.appendChild(t),l.appendChild(e),l.classList.add(a.cell.template.toLowerCase()),r=l,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),n=t.getAttribute("data-field"),r=l.getAttribute("data-id");if(i.beginEdit(r,n),a.cell.column.editor&&a.cell.column.editor.instance){const e=a.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}else r=t;a.setAttribute("template",a.cell.template.toLowerCase()),r.setAttribute("value",e);break}case"password":l.innerHTML=e?'<span class="smart-truncate">'+e.replace(/./g,"*")+"</span>":"",a.setAttribute("template",a.cell.template);break;case"color":l.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${e};"></span>`,a.setAttribute("template",a.cell.template);break;case"autoNumber":r=document.createElement("span"),r.innerHTML=1+a.cell.row.visibleIndex,a.setAttribute("template",a.cell.template);break;case"createdDate":case"createdTime":l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.createdDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.createdDate,"t")+"</span>",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"updatedDate":case"updatedTime":a.cell.row.updatedDate?l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.updatedDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.updatedDate,"t")+"</span>":l.innerHTML="",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"progress":{const t=e?parseInt(100*e)+"%":"0%";if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&t===l.firstElementChild.getAttribute("value"))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const i="white",n=["#D50000","#F4511E","#F6BF26","#33B679"];let r=n[0];r=e<.25?n[0]:e<.5?n[1]:e<.75?n[2]:n[3],l.innerHTML='<div value="'+t+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+t+';"><div title="'+t+'" style="width: 100%; height: 4px; background: '+r+"; color: "+i+';" class="smart-truncate smart-token"></div></div><span>'+t+"</span></div>",a.setAttribute("template",a.cell.template);break}case"images":{if(""===e)return l.innerHTML="",a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")){const t=l.firstElementChild.getAttribute("value");if(e&&e.indexOf(t)>=0)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild.evaluateScroll&&l.firstElementChild.evaluateScroll());if(t&&e&&Array.isArray(e)&&e[0]&&e[0].value&&t.length===e[0].value.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template)}const t=document.createElement("div"),n=document.createElement("div");t.classList.add("container"),n.classList.add("images");let s=e;if("string"==typeof s&&(s.indexOf("http")>=0||s.indexOf("base64")>=0)){let e="";if(s)try{e=JSON.parse(s)}catch(e){console.log(e)}s=e}Array.isArray(s)&&s.forEach((e=>{const l=document.createElement("img");l.src=e.value,l.title=e.label,t.appendChild(l)}));const o=document.createElement("div");o.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");if(d.classList.add("smart-arrow-right","arrowbtn"),n.onpointerdown=e=>{if("IMG"===e.target.nodeName)i._openImagePreviewDialog(e.target),e.stopPropagation(),e.preventDefault();else if("DIV"===e.target.nodeName&&e.target.classList.contains("arrowbtn")){let l=parseInt(t.style.marginLeft);isNaN(l)&&(l=0);const i=o===e.target,n=t.scrollWidth-a.offsetWidth+30;t.style.marginLeft=i?Math.min(0,l+25)+"px":Math.max(-n,l-25)+"px",l=parseInt(t.style.marginLeft),0===l?o.classList.add("smart-hidden"):o.classList.remove("smart-hidden"),e.stopPropagation(),e.preventDefault()}},t.children.length){n.appendChild(t);const e=25*s.length;e-a.offsetWidth+30>30&&(n.appendChild(o),n.appendChild(d)),n.evaluateScroll=()=>{const l=e-a.offsetWidth+30;t.style.marginLeft="0px",o.classList.add("smart-hidden"),l<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),l>30&&(n.appendChild(o),n.appendChild(d))},r=n}else r=document.createElement("div");a.setAttribute("template",a.cell.template),e&&e[0]&&e[0].value?r.setAttribute("value",e[0].value):s&&s[0]&&s[0].label?r.setAttribute("value",s[0].label):r.setAttribute("value",e);break}case"email":Smart.Validator&&(r=document.createElement("span"),Smart.Validator.email(e)?r.innerHTML=e:(r.className="url",r.innerHTML='<a href="mailto:'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()})),a.setAttribute("template",a.cell.template);break;case"url":Smart.Validator&&(r=document.createElement("span"),r.className="url",Smart.Validator.url(e)?r.innerHTML='<a href="https://'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>":r.innerHTML='<a href="'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()}),a.setAttribute("template",a.cell.template);break;default:{let t=null;a.setAttribute("template","");const r=a.cell.row,s=l;let o=a.cell.getFormattedValue(e,n.cellsFormat);if(s.style.lineHeight="","function"==typeof a.cell.template){const t={row:r,column:n,cell:a.cell,oldValue:a.cell.oldValue,value:e,template:null};let l=s.querySelector(".smart-grid-cell-template");l&&l.getAttribute("column")===n.dataField?t.template=l.firstElementChild:l=null,a.formattedValue!==o&&(l=null),a.cell.canNotify=!1,r.canNotify=!1;const i=Object.assign({},{background:a.cell.background,color:a.cell.color,fontSize:a.cell.fontSize,fontFamily:a.cell.fontFamily,fontWeight:a.cell.fontWeight,textDecoration:a.cell.textDecoration,fontStyle:a.cell.fontStyle});if(a.cell.template(t),!l&&t.template)if(t.template instanceof HTMLElement){const e=document.createElement("div");e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),s.innerHTML="",s.appendChild(e),e.appendChild(t.template)}else s.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+t.template+"</div>";else l||null!==t.template||(s.innerHTML=e);s.style.background===i.background&&s.style.color===i.color&&s.style.fontSize===i.fontSize&&s.style.fontWeight===i.fontWeight&&s.style.fontStyle===i.fontStyle||(a.cell._styleChanged=!0,a.cell._setStyle(s)),a.cell.background!==i.background||a.cell.color!==i.color||a.cell.fontSize!==i.fontSize||a.cell.fontWeight!==i.fontWeight||a.cell.fontStyle!==i.fontStyle?(a.cell._styleChanged=!0,a.cell._setStyle(s)):a.cell._styleChanged&&a.cell._setStyle(s),void 0===a.cell.oldValue&&(a.cell.oldValue=e),a.formattedValue=o,a.cell.canNotify=!0,r.canNotify=!0}else{if(""!==s.textContent&&(s.textContent=""),a.cell.template instanceof HTMLTemplateElement)t=a.cell.template;else if(a.cell.template instanceof HTMLElement){const t=a.cell.template.innerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);s.innerHTML!==t&&(s.innerHTML=t)}if(a.cell.template.startsWith&&a.cell.template.startsWith("#")&&(t=document.querySelector(a.cell.template)),t){let l=t.content.cloneNode(!0).firstElementChild;const d=e;if(e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),l.querySelector("[smart-if]")){const t=l.querySelector("[smart-else]"),a=l.querySelectorAll("[smart-if]");let i=!1;for(let t=0;t<a.length;t++){const r=a[t],s=r.getAttribute("smart-if").split(" "),o=s[1].trim();let c=s[2].trim(),m=e;switch("Today"===c&&(c=new Date),"date"===n.dataType&&(e=new Date(d).getTime(),c=new Date(c).getTime()),o){case">":e>parseFloat(c)&&(l=r,i=!0);break;case">=":e>=parseFloat(c)&&(l=r,i=!0);break;case"=":case"==":case"===":e===c&&(l=r,i=!0);break;case"<":e<parseFloat(c)&&(l=r,i=!0);break;case"<=":e<=parseFloat(c)&&(l=r,i=!0)}if(e=m,i)break}!i&&t&&(l=t)}let c=l.outerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);for(c.indexOf("{{value=")>=0&&(e?(c=c.substring(0,c.indexOf("{{value="))+e+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const t=c.indexOf("{{value::"),l=c.substring(t+9,c.indexOf("}}")),i=a.cell.getFormattedValue(e,l);c=c.replace(`{{value::${l}}}`,i)}if(n._treeColumn){const e=s.firstChild;if(e&&e.classList&&a.toggleButton&&n._treeColumn&&s.children[1]){const e=s.children[0],t=s.children[1].children[0],l=s.children[1].children[1].firstChild,a=s.children[1].children[2];let n="";if(i.grouping.enabled){let e=r.level-1;"multipleColumns"!==i.grouping.renderMode&&(n+='<div style="width: '+(1+e)*i.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<r.level;e++)n+="<div class='smart-indent'></div>";r.checked?l.setAttribute("checked",""):!1===r.checked?l.removeAttribute("checked"):null===r.checked&&l.setAttribute("checked","indeterminate"),r.leaf?r.allowCheck?l.classList.remove("smart-visibility-hidden"):l.classList.add("smart-visibility-hidden"):r.allowCheck?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),r.allowCheck?i.checkBoxes.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"):i.checkBoxes.visible||l.classList.add("smart-hidden"),e.innerHTML=n,t.classList.add("smart-visibility-hidden"),r.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),r.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),r.data.isEmpty&&t.classList.add("smart-visibility-hidden"),a.innerHTML=c,i.appearance.showTooltips?a.setAttribute("title",o):a.hasAttribute("title")&&a.removeAttribute("title")}}else s.innerHTML!==c&&(s.innerHTML=c)}else if("string"==typeof a.cell.template){""===e&&(e=" ");const t=a.cell.template.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);s.innerHTML!==t&&(s.innerHTML=t)}}if("auto"===a.cell.row.height||i.layout.allowCellsWrap||"auto"===i.layout.rowHeight){const e=s.querySelector(".smart-grid-cell-template");if(e){r._templatesHeight||(r._templatesHeight=[]);const t=(e,t)=>{if(e){const l=i.rowById[e.getAttribute("data-id")];l._templatesHeight[n.dataField]=t,l._isDirty=!0,l.autoSize(),delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),i.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(r)return l.innerHTML="",l.appendChild(r),a.cell._setStyle(l),r}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,n=a._isMeasureRow?null:l.cellsFormat;if(!1===t._recycleValues)return e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),void(e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.setAttribute("aria-activedescendant",e.id)):(e.removeAttribute("focus"),a.element.star&&t._selection.focusedCell&&t._selection.focusedCell.id!==a.id&&a.element.star.classList.remove("smart-hidden")));if(t.grouping.enabled&&t.dataSource.groupBy.length>0){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button");let r=l.displayField?i[l.displayField]:i[l.dataField];null!==r||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(r=0),"string"===l.dataType&&(r=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(r=!1),"date"===l.dataType&&(r=new Date)),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(r="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row");const s=t=>t?t.startsWith("off_")?(e.classList.remove(t.substring(4)),!1):(e.classList.add(t),e.setAttribute("customCSS",t),!0):(e.setAttribute("highlight",""),!0);if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS"),e.classList.remove(t)}if(l.highlight&&!a.summaryRow&&(s(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]&&s(t.highlightedCells[a.id][l.dataField]),t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]&&s(t.highlightedRows[a.id]),t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),r=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,r=e.cell.value),void 0===r&&(r="");let o=r;n?o=e.cell.getFormattedValue(r,n):l.formatSettings&&l.formatSettings.Intl&&(o=e.cell.getFormattedValue(r,l.formatSettings.Intl));const d=e.firstChild;if(e.content=d,l._isDirty&&(d.innerHTML=""),d.hasAttribute("data-field")&&d.getAttribute("data-field")!==l.dataField&&(d.innerHTML=""),d.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];d.firstChild&&d.removeChild(d.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?d.appendChild(t):d.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return d.firstChild&&d.removeChild(d.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void d.appendChild(t)}e.cell.value!==r&&(o=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,r,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,r,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);for(let n=0;n<i.length;n++){let s=i[n];const o={index:a.visibleIndex,value:r,dataField:l.dataField,row:a,api:t};l.cellsCSSRules[s](o)&&(e.classList.add(s),e.__classNames=[s])}}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const c=e._getCellAlignment(a,l),m=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let u="";if(c.align&&(u+=c.align+" "),c.verticalAlign&&(u+=c.verticalAlign+" "),l.cellsWrap&&(u+="wrap "),u+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let g=l.left;if(t.rightToLeft?e.style.right!==g+"px"&&(e.style.right=g+"px"):e.style.left!==g+"px"&&(e.style.left=g+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),u+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command",""),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze","")),l.cellsRotationAngle){if(!e._rotateCellContent(d,l,r))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(d));d.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)d.innerHTML="";else if(l.autoGenerated&&(d.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let n in a){const r=l.cellsFormat;let s=a[n];r&&r.indexOf("p")>=0&&"count"===n?s=a[n]:r&&"date"!==l.dataType&&(s=e.cell.getFormattedValue(s,r)),i.push(t.localize(n,{value:s}))}const n=i.join(", "),r=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let s=`<div title = "${n}" class="smart-truncate summary-value" > <span class="label">${n}</span>${r}</div> `;if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;s=`<div title = "${n}" class="smart-truncate summary-value" > <span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> <span class="label">${n}</span>${r}</div> `}d.innerHTML!==s&&(d.innerHTML=s)}else if(t.summaryRow.editing&&l.allowSummary)if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value" ><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;d.innerHTML!==l&&(d.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value" ><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;d.innerHTML!==e&&(d.innerHTML=e)}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?d.firstElementChild.setAttribute("has-summary",""):d.firstElementChild.removeAttribute("has-summary"),d.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),d._clickTarget=e.target},d.onpointerup=l=>{d._clickTarget===l.target&&(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="";if(l=a.showDetail?'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggled toggle-button></button>':'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggle-button></button>',t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,d.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):d.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(d.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else d.innerHTML!==l&&(d.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)d.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let n="";for(let e=0;e<t;e++)n+="A";return n+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?d.textContent="":d.textContent=l(a)}else if(m)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)d.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)d.innerHTML=r;else switch(e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(r,e.cell.template,d);break;case"tags":case"checklist":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(r,e.cell.template,d);break;case"image":e._setTemplate(r,"images",d);break;case"email":e._setTemplate(r,"email",d);break;case"url":e._setTemplate(r,"url",d);break;default:e._setTemplate(r,e.cell.template,d)}else{const i=d.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&d.children[1]){const e=d.children[0],i=d.children[1].children[0],n=d.children[1].children[1].firstChild,r=d.children[1].children[2];let s="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?s="":"multipleColumns"!==t.grouping.renderMode&&(s+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)s+="<div class='smart-indent'></div>";if(a.checked?n.setAttribute("checked",""):!1===a.checked?n.removeAttribute("checked"):null===a.checked&&n.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?n.classList.remove("smart-visibility-hidden"):n.classList.add("smart-visibility-hidden"):a.allowCheck?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(d)}}a.allowCheck?t.checkBoxes.visible?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden"):t.checkBoxes.visible||n.classList.add("smart-hidden"),e.innerHTML=s,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),r.innerHTML=o,t.appearance.showTooltips?r.setAttribute("title",o):r.hasAttribute("title")&&r.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let n=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(n+=l.computedWidth)}e.style.width=n+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let n=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let n=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(n+=l.cellHeight)}e.style.height=n+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const s="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(r,a.visibleIndex,a.data),o=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(o>l[0]&&o<l[1]){d=!0;break}}if(a._rowSpan=s,s&&!d){let r=0;t._cellRowSpan.push([o,o+s,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(s,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=o;e<=o+s-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(r+=l.cellHeight)}e.style.height=r+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",s),i._styleChanged=!0,n=s}}1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width="",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===n&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),d.textContent===o||l.formatFunction||(d.textContent=o),i.column.autoGenerated||i._setStyle(d),t.appearance.showTooltips?d.setAttribute("title",i.tooltip||o):d.hasAttribute("title")&&d.removeAttribute("title")}else d.textContent=o}}if(d.className!==u&&(d.className=u),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&d.firstChild&&d.firstChild.classList&&d.firstChild.classList.contains("smart-grid-cell-loading")&&(d.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),d.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const t={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:r,formattedValue:o,template:null};e.cell.canNotify=!1,a.canNotify=!1;const i=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});await l.formatFunction(t),d.style.background===i.background&&d.style.color===i.color&&d.style.fontSize===i.fontSize&&d.style.fontFamily===i.fontFamily&&d.style.textDecoration===i.textDecoration&&d.style.fontWeight===i.fontWeight&&d.style.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(d)),e.cell.background===i.background&&e.cell.color===i.color&&e.cell.fontSize===i.fontSize&&e.cell.fontWeight===i.fontWeight&&e.cell.textDecoration===i.textDecoration&&e.cell.fontFamily===i.fontFamily&&e.cell.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(d));let n=!0;if(t.value!==r&&(e.toggleButton?d.children[1].children[2].innerHTML=t.value:d.innerHTML=t.value,n=!1),null!==t.template){if(e.toggleButton){const e=d.children[1].children[2];e.innerHTML!==t.template&&(e.innerHTML=t.template)}else if(d.innerHTML!==t.template){const e=document.createElement("div");e.innerHTML=t.template,e.innerHTML!==d.innerHTML&&(d.innerHTML=t.template)}n=!1}n&&(l.cellsFormat?d.textContent=o:d.textContent=r),e.cell.canNotify=!0,a.canNotify=!0}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,d),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&d.querySelector("[toggle-button]")){const e=d.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),n=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),n.appendChild(l),n.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(n),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const n=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-n.top+"px",i.style.left=a._offsetLeft(l)-n.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,n=e.row,r=e.row.index,s=n._style;if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][r];a.cell.canNotify=!1,n.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(s&&s._changed?(a.cell._styleChanged=!0,a.cell.background=s.background,a.cell.color=s.color,a.cell.fontFamily=s.fontFamily,a.cell.fontSize=s.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,n.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,n.canNotify=!1,s&&s._changed?(a.cell._styleChanged=!0,a.cell.background=s.background,a.cell.color=s.color,a.cell.fontFamily=s.fontFamily,a.cell.fontSize=s.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,n.canNotify=!0)}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const n={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":n.align="align-left";break;case"center":case"middle":n.align="align-center";break;case"right":n.align="align-right"}switch(a){case"top":n.verticalAlign="align-top";break;case"center":case"middle":n.verticalAlign="align-middle";break;case"bottom":n.verticalAlign="align-bottom"}return n}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});
|
|
51
|
-
Smart.Utilities.Assign("Grid.Resize",class{autoSizeRows(e){const t=this,o=e||t._recyclingRows;t.rows.canNotify=!1;for(let e=0;e<o.length;e++){const i=o[e];i.element=t._rowElements[1],i.grid=t;const l=i._autoSize(i);i.cellHeight!==l&&(i.cellHeight=l),i.height=l}t.rows.canNotify=!0,t.refresh()}autoSizeColumn(e){const t=this.columnByDataField[e];t&&t.autoSize()}autoSizeColumns(e,t){const o=this,i=t||o.columns;let l=[];if(!e){const e=o._recyclingRows;for(let t=0;t<e.length;t++){const o=e[t];for(let e=0;e<i.length;e++){const t=i[e],s=o.getCell(t.dataField);l[t.dataField]||(l[t.dataField]=t.label),s.value&&s.value.toString().length>l[t.dataField].length&&(l[t.dataField]=s.value)}}}const s=[];for(let e=0;e<i.length;e++){const t=i[e],o=l[t.dataField]?l[t.dataField]:t.label;s.push(o)}const n=i[0]._measureSize(s);o.columns.canNotify=!1;for(let e=0;e<i.length;e++)i[e].width=n[e];o.columns.canNotify=!0,o.refresh()}_doubleClickHandler(e){const t=this;if("none"!==t.behavior.rowResizeMode||"none"!==t.behavior.columnResizeMode){if(t._downTime&&new Date-t._downTime<300){const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null,s=null,n=null;for(let e=0;e<o.length;e++){const t=o[e];if(t.getAttribute("data-field")&&(i=t.getAttribute("data-field"),"smart-grid-column"===t.nodeName.toLowerCase())){l=t;break}if(t.getAttribute("data-id")){s=t.getAttribute("data-id"),n=t;break}}const r=t.columnByDataField[i],a=t.rowById[s];if(t.behavior.allowColumnAutoSizeOnDoubleClick&&r&&r.allowResize&&"none"!==t.behavior.columnResizeMode&&l){const t=l.getBoundingClientRect(),o=t.right,i=10;o-i<=e.clientX&&e.clientX<=o+i&&t.top<=e.clientY&&t.bottom>=e.clientY&&(r.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))}if(t.behavior.allowRowAutoSizeOnDoubleClick&&a&&a.allowResize&&"none"!==t.behavior.rowResizeMode){const t=n.getBoundingClientRect().bottom,o=10;t-o<=e.clientY&&e.clientY<=t+o&&(a.computedHeight=null,a.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))}}t._downTime=new Date}}_endResize(){const e=this;e._overlay&&setTimeout((()=>{e._overlay&&(e._overlay.parentNode.removeChild(e._overlay),e._overlay=null)}),100);const t=e.getBoundingRect(e);if(delete e._columnDownPosition,delete e._rowDownPosition,e.classList.remove("smart-grid-resize-mode"),e.$.root.classList.remove("smart-grid-resize-mode"),e.classList.remove("smart-grid-row-resize-mode"),e.classList.remove("smart-grid-column-resize-mode"),e._rowToResize&&e._rowResizeStartLine&&e._rowResizeLine){const t=e.rowById[e._rowToResizeId],o=t.cellHeight+parseFloat(e._rowResizeLine.style.top)-parseFloat(e._rowResizeStartLine.style.top),i=t.cellHeight;if(e.rows.canNotify=!1,t.height=null,"split"===e.behavior.rowResizeMode){const i=e._nextRow(t),l=parseInt(t.height-o+t.cellHeight);t.computedHeight=o,i.computedHeight=parseInt(i.height)+l,i.height=null}else t.computedHeight=o;return e.rows.canNotify=!0,e._rowResizeStartLine.parentNode.removeChild(e._rowResizeStartLine),e._rowResizeLine.parentNode.removeChild(e._rowResizeLine),e.appearance.showResizeTooltips&&e._rowResizeTooltip.parentNode.removeChild(e._rowResizeTooltip),e._rowToResize.header?e._rowToResize.header.style.cursor="":e._rowToResize.style.cursor="",t.header&&(t.header.style.cursor=""),e._rowResizeLine=null,e._rowToResize=null,e._rowToResizeId=null,e._rowResizeStartLine=null,e.refresh(),void e.$.fireEvent("rowResize",{row:t,id:t.id,oldHeight:i,height:o})}if(!e._columnToResizeElement||!e._columnResizeLine)return;const o=e.columnByDataField[e._columnToResizeDataField],i=e._columnToResizeRect;let l=t.left+parseInt(e._columnResizeLine.style.left)-i.left+e.scrollLeft;const s=o.width;if(e.rightToLeft&&(l=t.left-parseFloat(e._columnResizeLine.style.left)+i.right-e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),l<o.minWidth&&(l=o.minWidth),e.columns.canNotify=!1,"split"===e.behavior.columnResizeMode){const t=e._nextColumn(o);if(t){const e=parseInt(o.computedWidth-l);o.width=l,t.width=parseInt(t.computedWidth)+e}}else o.width=l;e.columns.canNotify=!0,e._columnResizeLine.parentNode.removeChild(e._columnResizeLine),e._columnResizeLine=null,e._columnResizeStartLine.parentNode.removeChild(e._columnResizeStartLine),e._columnResizeTooltip.parentNode&&e._columnResizeTooltip.parentNode.removeChild(e._columnResizeTooltip),e._columnResizeStartLine=null,e._columnToResizeElement.style.cursor="",e._columnToResizeElement.sortButton.style.cursor="",e._columnToResizeElement.filterButton.style.cursor="",e._columnToResizeElement=null,e._columnToResizeRect=null,e._columnToResizeDataField=null,e._columnResizeTooltip=null,e.refresh(),o._state||(o._state={label:o.label,dataField:o.dataField,dataType:o.dataType}),o._state.width=o.width,e.$.fireEvent("columnResize",{column:o,dataField:o.dataField,oldWidth:s,width:l}),e.closeMenu()}_columnResizePrepare(){const e=this,t=e._columnToResizeRect,o=e.getBoundingRect(e.$.columnHeader);if(e._dragDetails)return;const i=function(){const i=document.createElement("div");return i.classList.add("smart-grid-resize-line"),e.rightToLeft?i.style.left=-o.left+t.left+"px":i.style.left=-o.left+t.right+"px",e.header.visible?i.style.top=-o.top+o.height+t.top+"px":i.style.top=-o.top+t.top+"px",i.style.height="calc(100% - "+i.style.top+")",i.style.cursor="col-resize",i},l=document.createElement("div");l.classList.add("smart-grid-resize-tooltip"),e._columnResizeTooltip=l,e._columnResizeTooltip.style.left=-o.left+t.right+"px",e.rightToLeft&&(e._columnResizeTooltip.style.left=-o.left+t.left+"px"),e._columnResizeTooltip.innerHTML=e.localize("columnResizeTooltip",{value:t.width}),e._columnResizeLine=i(),e._columnResizeStartLine=i(),"growAndShrink"===e.behavior.columnResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-column-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e.appearance.showResizeTooltips&&e.$.root.appendChild(e._columnResizeTooltip),e.$.root.appendChild(e._columnResizeLine),e.$.root.appendChild(e._columnResizeStartLine),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="col-resize",e.$.root.appendChild(e._overlay)}_columnDownResizeHandler(e){this._columnDownPosition=e.pageX}_columnMoveResizeHandler(e){const t=this;if(t._dragDetails)return;t._columnDownPosition&&Math.abs(e.pageX-t._columnDownPosition)>=3&&!t._columnResizeLine&&t._columnResizePrepare();const o=function(e){const o=t._columnToResizeRect;let i=e.left+parseFloat(t._columnResizeLine.style.left)-o.left+t.scrollLeft;t.rightToLeft&&(i=e.left-parseFloat(t._columnResizeLine.style.left)+o.right-t.scrollLeft-t._scrollView.vScrollBar.offsetWidth);const l=t.columnByDataField[t._columnToResizeDataField];i<l.minWidth&&(i=l.minWidth),t.appearance.showResizeTooltips&&(t._columnResizeTooltip.innerHTML=t.localize("columnResizeTooltip",{value:parseInt(i)}))};if(t._columnResizeLine){const i=t.columnByDataField[t._columnToResizeDataField],l=t._columnToResizeRect,s=i.minWidth,n=i.maxWidth,r=t._nextColumn(i),a=t.getBoundingRect(t);if(t.rightToLeft){if(e.pageX>a.right)return;if("split"===t.behavior.columnResizeMode&&r&&e.pageX<=t.offsetWidth-t.scrollLeft-r.left-r.computedWidth+r.minWidth)return t._columnResizeLine.style.left=t.offsetWidth-t.scrollLeft-r.left-r.computedWidth+r.minWidth+"px",void o(a);if(l.right-s-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-s-t.scrollLeft+"px",void o(a);if(l.left+n-t.scrollLeft>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-n-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+e.pageX+"px",o(a)}else{if(e.pageX<a.left)return;if("split"===t.behavior.columnResizeMode&&r&&e.pageX>=a.left+r.left+r.computedWidth-r.minWidth-t.scrollLeft)return t._columnResizeLine.style.left=-a.left+a.left+r.computedWidth+r.left-r.minWidth-t.scrollLeft+"px",void o(a);if(l.left+s-t.scrollLeft>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+s-t.scrollLeft+"px",void o(a);if(l.left+n-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+n-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+e.pageX+"px",o(a)}}else if(!t._columnDownPosition){const t=this;if(e.composedPath&&-1===e.composedPath().indexOf(this))return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null;if(t._columnResizeLine)return;for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-field")&&t.hasAttribute("header")){i=t.getAttribute("data-field"),l=t;break}}if(t._columnToResizeElement&&(t._columnToResizeElement.style.cursor="",t._columnToResizeElement.sortButton.style.cursor="",t._columnToResizeElement.filterButton.style.cursor="",t._columnToResizeElement=null),i){const o=t.rightToLeft?l.getBoundingClientRect().left:l.getBoundingClientRect().right;if(l.style.cursor="",l.sortButton.style.cursor="",l.filterButton.style.cursor="",o-10<=e.clientX&&e.clientX<=o+10){const e=t.columnByDataField[i];if(!e||e&&!e.allowResize)return;const o=t._isLastVisibleColumn(e);if("split"===t.behavior.columnResizeMode&&o)return;l.style.cursor="col-resize",l.sortButton.style.cursor="col-resize",l.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(l),t._columnToResizeElement=l,t._columnToResizeDataField=i}}}}_rowMoveResizeHandler(e){const t=this;if(t.viewColumns.length&&t.viewColumns[0].rowHeaderColumn&&!t._rowResizeLine){const o=t.offset(t.viewColumns[0].element);if(e.pageX<o.left||e.pageX>o.left+t.viewColumns[0].width)return}const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null;if(t._rowDownPosition&&Math.abs(e.pageY-t._rowDownPosition)>=3&&!t._rowResizeLine&&t._rowDownResizeHandler(e),t._rowResizeLine){const o=t._offsetTop(t.$.scrollView),i={top:o,bottom:t.$.scrollView.offsetHeight+o};if(e.pageY<=i.top)return;if(e.pageY>=i.bottom)return;const l=function(){const e=s.cellHeight+parseFloat(t._rowResizeLine.style.top)-parseFloat(t._rowResizeStartLine.style.top);t.appearance.showResizeTooltips&&(t._rowResizeTooltip.innerHTML=t.localize("rowResizeTooltip",{value:parseInt(e)}))},s=t.rowById[t._rowToResizeId],n=t._nextRow(s),r=t._rowToResizeBounds,a=s.minHeight,c=s.maxHeight;return"split"===t.behavior.rowResizeMode&&n&&r.bottom+n.height-n.minHeight<=e.pageY?(t._rowResizeLine.style.top=r.bottom+n.height-n.minHeight-o+"px",void l()):r.top+a+10>=e.pageY?(t._rowResizeLine.style.top=r.top+a-o+"px",void l()):r.top+c>=e.pageY-o?(t._rowResizeLine.style.top=r.top+c+10-o+"px",void l()):(t._rowResizeLine.style.top=-o+e.pageY-1+"px",void l())}if(!t._rowDownPosition){for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-id")&&t.hasAttribute("header")){l=t,i=t.getAttribute("data-id");break}}if(t._rowToResize&&(t._rowToResize.style.cursor="",t._rowToResize=null),null!==i){const o=t._offsetTop(l)+l.offsetHeight;if(l.style.cursor="",o-10<=e.clientY&&e.clientY<=o+10){const e=t.rowById[i];if(!e||e&&!e.allowResize)return;e.header&&(e.header.style.cursor="row-resize");const o=t._offsetTop(l);t._rowToResizeBounds={top:o,bottom:l.offsetHeight+o,height:l.offsetHeight},t._rowToResize=l,t._rowToResizeId=i}}}}_rowDownResizeHandler(){const e=this,t=e._rowToResizeBounds,o=function(){const o=document.createElement("div");return o.classList.add("smart-grid-resize-line","row"),o.style.width=e.$.scrollView.offsetWidth-e._rowToResize.offsetLeft+"px",o.style.left="0px",o.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",o.style.cursor="row-resize",o},i=document.createElement("div");i.classList.add("smart-grid-resize-tooltip"),e._rowResizeTooltip=i,e._rowResizeTooltip.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",e._rowResizeTooltip.innerHTML=e.localize("rowResizeTooltip",{value:t.height}),e._rowResizeTooltip.style.right="20px",e._rowResizeTooltip.style.bottom="initial","growAndShrink"===e.behavior.rowResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-row-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e._rowResizeLine=o(),e._rowResizeStartLine=o(),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="row-resize",e.$.root.appendChild(e._overlay),e.$.scrollView.appendChild(e._rowResizeLine),e.$.scrollView.appendChild(e._rowResizeStartLine),e.appearance.showResizeTooltips&&e.$.scrollView.appendChild(e._rowResizeTooltip)}_rowResizeHandler(e){const t=this;let o=e.clientX,i=e.clientY;void 0!==o&&void 0!==i||(o=e.touches[0].clientX,i=e.touches[0].clientY);const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,i);let s=null;for(let e=0;e<l.length;e++){const t=l[e];t.getAttribute("data-id")&&(s=t.getAttribute("data-id"))}null===s||!t._rowToResize||t._rowResizeLine||(t._rowDownPosition=e.pageY)}});
|
|
50
|
+
Smart.Utilities.Assign("Grid.Cell",class{constructor(e,t){const l=this;if(l.row=e,l.column=t,l.grid=e.grid,l.rowSpan=1,l.colSpan=1,l.value=void 0,l.fontSize=null,l.fontWeight=null,l.fontFamily=null,l.fontStyle=null,l.color=null,l.background=null,l.textDecoration=null,l.tooltip=null,l.align=null,l.verticalAlign=null,l.readonly=!1,l.oldValue=void 0,l._updating=!1,l.styleChanged=!0,l.editor=null,l.template=null,l.isEditing=!1,l.canNotify=!0,l.selected=!1,l.focused=!1,l.error=!1,e._style){const t=e._style;l.color=t.color,l.background=t.background,l.fontFamily=t.fontFamily,l.fontSize=t.fontSize,l.fontStyle=t.fontStyle,l.textDecoration=t.textDecoration,l.fontWeight=t.fontWeight}return new Proxy(l,{deleteProperty:function(e,t){return delete e[t],!0},get:function(e,t){if("value"===t)return l.column.displayField?l.row.data[l.column.displayField]:l.row.data[l.column.dataField];if("editor"===t||"template"===t)return e[t]||l.column[t];if("focused"===t){if(l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!0;if(l.grid.selection.allowRowSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===l.row.id&&l.grid._selection.focusedCell.dataField===l.column.dataField)return!0;const e=l.parent();return!!(e&&l.grid.selection.allowCellSelection&&l.grid._selection.focusedCell&&l.grid._selection.focusedCell.id===e.row.id&&l.grid._selection.focusedCell.dataField===e.column.dataField)}if("selected"===t)return!0===l.row.getProperty("selected")||!0===l.column.getProperty("selected")||!!l.grid._selection.cells["row"+l.row.id]&&l.grid._selection.cells["row"+l.row.id][l.column.dataField];if("modifiedValue"===t){l.grid._cellsUpdatedValues||(l.grid._cellsUpdatedValues=[]);const t=l.grid._cellsUpdatedValues[l.row.id+"_"+l.column.dataField];return void 0!==t?t:e.value}return e[t]},set:function(e,a,i){const n=this.get(e,a);return n===i||(e[a]=i,!("element"!==a&&"isEditing"!==a&&"oldValue"!==a&&"_updating"!==a&&"notifyFn"!==a&&!a.startsWith("_")&&"canNotify"!==a)||("error"===a||("focused"===a&&(l.grid._selection.focusedCell={id:l.row.id,dataField:l.column.dataField,value:l.value,index:l.row.index}),"colSpan"!==a&&"rowSpan"!==a||i>=0&&-1===l.grid._cellsMerge.indexOf(l)&&l.grid._cellsMerge.push(l),"row"===a||"column"===a||"grid"===a||"styleChanged"===a||("background"!==a&&"fontSize"!==a&&"fontWeight"!==a&&"fontFamily"!==a&&"textDecoration"!==a&&"color"!==a&&"fontStyle"!==a||(l.grid._cellStyles["row"+l.row.id]=!0,l.grid._cellStyles.length++,l._styleChanged=!0),"value"===a&&(void 0===l.oldValue&&(l.oldValue=n),(()=>{l.grid.dataSource.boundSource.canNotify=!1,null===i&&(l.column.allowNull||(i="number"===l.column.dataType||"int"===l.column.dataType||"float"===l.column.dataType||"integer"===l.column.dataType?0:"date"===l.column.dataType?new Date:"boolean"!==l.column.dataType&&"bool"!==t.dataType&&"")),null!==i&&i.label&&i.value?(l.row.data[l.column.displayField]=i.label,l.row.data[l.column.dataField]=i.value):(l.column.valueField&&(l.row.data[l.column.valueField]=i),l.row.data[l.column.dataField]=i);const e=l.grid.dataSource.dataItemById[l.row.id];if(e){const t=e.$.index;l.grid.dataSource&&i!==l.grid.dataSource.boundSource[t][l.column.dataField]&&(l.grid._sortedColumns&&l.grid._sortedColumns.length>0?e[l.column.dataField]=i:l.grid.dataSource.boundSource[t][l.column.dataField]=i)}l.grid.dataSource.boundSource.canNotify=!0})()),"selected"===a&&(l.grid._selection.cells["row"+l.row.id]&&(delete l.grid._selection.cells["row"+l.row.id][l.column.dataField],1===Object.getOwnPropertyNames(l.grid._selection.cells["row"+l.row.id]).length&&delete l.grid._selection.cells["row"+l.row.id]),l.grid._selection.cells["column"+l.column.dataField]&&(delete l.grid._selection.cells["column"+l.column.dataField][l.row.id],1===Object.getOwnPropertyNames(l.grid._selection.cells["column"+l.column.dataField]).length&&delete l.grid._selection.cells["column"+l.column.dataField]),i&&(l.grid._selection.cells["row"+l.row.id]||(l.grid._selection.cells["row"+l.row.id]=[]),l.grid._selection.cells["column"+l.column.dataField]||(l.grid._selection.cells["column"+l.column.dataField]=[]),l.grid._selection.cells["row"+l.row.id][l.column.dataField]=!0,l.grid._selection.cells["column"+l.column.dataField][l.row.id]=!0)),!(!l._updating&&l.canNotify&&(l.grid._recycle(),l.row.canNotify&&(l.propertyChanged&&l.propertyChanged(name.substring(1),n),0)))))))}})}setStyle(e){this.setProperties(e)}_setStyle(e){const t=this;if(t._styleChanged){if(!t.grid._cellStyles.length)return;let l="";const a={background:"background",color:"color",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",fontStyle:"font-style",textDecoration:"text-decoration"},i=e=>{const i=t[e];if(""===i||null===i)return;const n=a[e];l+=`${n}: ${i};`},n=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<n.length;e++)i(n[e]);e.getAttribute("style")!==l&&e.setAttribute("style",l),""!==e.style.paddingBottom&&(e.style.paddingBottom=""),t._styleChanged=!1}t.selected&&(t.background||t.color)&&(e.style.background="",e.style.color="")}getFormattedValue(e,t){const l=this;if(null==e||""===e)return e;if(!t)return""+e;if(l.column._cellsCachedValues||(l.column._cellsCachedValues=[]),l.column._cellsCachedValues[""+e+t+l.column.grid.locale])return l.column._cellsCachedValues[""+e+t+l.column.grid.locale];if("date"===l.column.dataType||"datetime"===l.column.dataType||"time"===l.column.dataType){if("dateRangeInput"===l.column.editor.template){if(Array.isArray(e)){const a=l.formatDate(e[0],t)+" - "+l.formatDate(e[1],t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}{const a=l.formatDate(e,t)+" - "+l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}}const a=l.formatDate(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}if("int"===l.column.dataType||"int64"===l.column.dataType||"float"===l.column.dataType||"number"===l.column.dataType){const a=l.formatNumber(e,t);return l.column._cellsCachedValues[""+e+t+l.column.grid.locale]=a,a}return e}formatDate(e,t){if(!Smart.Utilities.DateTime)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.DateTimeFormat)return new Intl.DateTimeFormat(this.grid.locale,l.column.formatSettings.Intl.DateTimeFormat).format(e);!t&&l.column.formatSettings.dateFormat&&(t=l.column.formatSettings.dateFormat);try{const l=new Smart.Utilities.DateTime(e);l.calendar.locale=a.locale,a.messages[a.locale]&&a.messages[a.locale].calendar&&(a.messages[a.locale].calendar.months&&(l.calendar.months=a.messages[a.locale].calendar.months),a.messages[a.locale].calendar.days&&(l.calendar.days=a.messages[a.locale].calendar.days),void 0!==a.messages[a.locale].calendar.firstDay&&(l.calendar.firstDay=a.messages[a.locale].calendar.firstDay),void 0!==a.messages[a.locale].calendar.eras&&(l.calendar.eras=a.messages[a.locale].calendar.eras),void 0!==a.messages[a.locale].calendar.AM&&(l.calendar.AM=a.messages[a.locale].calendar.AM),void 0!==a.messages[a.locale].calendar.PM&&(l.calendar.PM=a.messages[a.locale].calendar.PM),void 0!==a.messages[a.locale].calendar["/"]&&(l.calendar["/"]=a.messages[a.locale].calendar["/"]),void 0!==a.messages[a.locale].calendar[":"]&&(l.calendar[":"]=a.messages[a.locale].calendar[":"]),l.calendar.today=a.messages[a.locale].today);let i=l.toString(t);return i!==a.messages[a.locale].today||a.showTodayDateAsString||(l.showTodayDateAsString=!1,i=l.toString(t),delete l.showTodayDateAsString),i}catch(t){return e}}formatNumber(e,t){if(!Smart.Utilities.NumberRenderer)return e;const l=this,a=l.grid;if(l.column.formatSettings.Intl&&l.column.formatSettings.Intl.NumberFormat){if(l.column.formatSettings.Intl.NumberFormat.currency&&Smart.Utilities.CurrencyFormatter){const t=void 0!==l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits?l.column.formatSettings.Intl.NumberFormat.maximumFractionDigits:2,a=(new Smart.Utilities.CurrencyFormatter).format(e,{decimalPlaces:t,currency:l.column.formatSettings.Intl.NumberFormat.currency});return"accounting"===l.column.formatSettings.Intl.NumberFormat.currency.currencySign&&e<0?"("+a.replace("-","")+")":a}return l.column.formatSettings.Intl.NumberFormat.locale?new Intl.NumberFormat(l.column.formatSettings.Intl.NumberFormat.locale,l.column.formatSettings.Intl.NumberFormat).format(e):new Intl.NumberFormat(this.grid.locale,l.column.formatSettings.Intl.NumberFormat).format(e)}const i=new Smart.Utilities.NumberRenderer;if(i.localizationObject){const e=l.column.formatSettings,t=a.messages[a.locale]?a.messages[a.locale].calendar:{};e.decimalPlaces&&(i.localizationObject.decimalPlaces=e.decimalPlaces),(e.decimalSeparator||t.decimalSeparator)&&(i.localizationObject.decimalSeparator=e.decimalSeparator||t.decimalSeparator,i.localizationObject.decimalseparator=i.localizationObject.decimalSeparator),(e.thousandsSeparator||t.thousandsSeparator)&&(i.localizationObject.thousandsSeparator=e.thousandsSeparator||t.thousandsSeparator,i.localizationObject.thousandsseparator=i.localizationObject.thousandsSeparator),i.localizationObject.currencysymbol=t.currencySymbol,i.localizationObject.currencysymbolposition=t.currencySymbolPosition,e.prefix&&(i.localizationObject.currencysymbol=e.prefix),e.sufix&&(i.localizationObject.currencysymbol=e.sufix,i.localizationObject.currencysymbolposition="after")}const n=i.formatNumber(e,t);return void 0===n?e:e<0&&l.column.formatSettings.negativeWithBrackets?"("+n+")":n}refresh(){const e=this;if(e.element){const t=e.element.firstChild;e._setStyle(t)}}autoWrap(){const e=this;e.element&&e.element._autoWrap()}setProperties(e){const t=this;t._updating=!0;for(let l in e)t[l]=e[l];t._updating=!1,t.grid._recycle()}createElement(){const e=document.createElement("smart-grid-cell");return e.setAttribute("role","gridcell"),this.element=e,e._initialize(this),e}render(){this.element&&this.element._render()}parent(e){const t=this,l=t.row,a=t.column.dataField,i=t.grid;if(!i._cellsMerge.length)return null;if(t.__parentCells&&void 0!==t.__parentCells["row"+l.id+"_column_"+a])return t.__parentCells["row"+l.id+"_column_"+a];let n=i.getVisibleRows();i.paging.enabled&&"page"===i.selection.selectAllMode&&(n=n.slice(i.paging.pageIndex*i.paging.pageSize,(i.paging.pageIndex+1)*i.paging.pageSize)),t.__parentCells||(t.__parentCells=[]);for(let r=0;r<i._cellsMerge.length;r++){const o=i._cellsMerge[r];let s=[],d=[];if(s.push(o.row),o.rowspan>1){const e=n.indexOf(o.row);if(e>=0)for(let t=e;t<e+o.rowSpan;t++)n[t]&&-1===s.indexOf(n[t])&&s.push(n[t])}if(d.push(o.column.dataField),o.colspan>1){const e=i.columns.indexOf(i.columnByDataField[o.column.dataField]);for(let t=e;t<e+o.colSpan;t++)i.columns[t]&&-1===d.indexOf(i.columns[t].dataField)&&d.push(i.columns[t].dataField)}if(s.indexOf(l)>=0&&d.indexOf(a)>=0){if(e){const e={cell:o.row.getCell(o.column.dataField),rows:s,columns:d,row:o.row,column:o.column,endRow:s[s.length-1],endColumn:i.columnByDataField[d[d.length-1]]};return t.__parentCells["row"+l.id+"_column_"+a]=e,e}const n=o.row.getCell(o.column.dataField);return t.__parentCells["row"+l.id+"_column_"+a]=n,n}}return t.__parentCells["row"+l.id+"_column_"+a]=null,null}}),Smart("smart-grid-cell",class extends Smart.BaseElement{static get properties(){return{}}get hasStyleObserver(){return!1}get enableShadowDOM(){return!1}addThemeClass(){}addDefaultClass(){}get isUtilityElement(){return!0}_refresh(){const e=this;e.innerHTML="",e._initialize(e.cell)}_createToggleButton(e,t){const l=this,a=document.createElement("div"),i=document.createElement("button"),n=document.createElement("div"),r=document.createElement("div"),o=document.createElement("div"),s=document.createElement("span"),d=t.grid;t.row.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled",""),i.tabIndex=-1,l.toggleButton=i,l.checkbox=o,e.appendChild(a),e.appendChild(r),r.setAttribute("content",""),a.setAttribute("indent",""),n.setAttribute("label",""),i.setAttribute("toggle-button",""),o.setAttribute("checkbox",""),o.setAttribute("role","checkbox"),l.setAttribute("has-toggle-button",""),r.appendChild(i),r.appendChild(o),s.classList.add("smart-input"),o.appendChild(s),d.checkBoxes.visible?s.classList.remove("smart-hidden"):s.classList.add("smart-hidden"),r.appendChild(n),l.content=n}_initialize(e){const t=this,l=document.createElement("div"),a=e.column,i=e.grid;t._properties=[],t.cell=e,t.appendChild(l);let n=!1;if(a&&a._treeColumn&&i.dataSource.boundHierarchy&&(n=!0,e.row.filterRow&&(n=!1),!i.grouping.enabled&&i.dataSource.groupBy&&i.dataSource.groupBy.length>0&&(n=!1),i.grouping.enabled&&i.dataSource.groupBy&&0===i.dataSource.groupBy.length&&(n=!1)),n)return t._createToggleButton(l,e),void(t.isRendered=!0);{const e=document.createElement("div");l.appendChild(e)}t.content=l,t.isRendered=!0}_renderCommands(){const e=this,t=e.cell.grid;if(t.__cellsCommandTemplate)return e.firstChild.innerHTML=t.__cellsCommandTemplate,void t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row);const l=t._getCommandColumnCommandsTemplate();e.firstChild.innerHTML=l,t._updateCommandColumnCommandsVisibility(e.firstChild,e.cell.row),t.__cellsCommandTemplate=l}_renderGroupCell(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row;[...e.attributes].forEach((t=>e.removeAttribute(t.name))),e.setAttribute("group","");const i=l===t._firstRenderedColumn;e.style.width!==l.computedWidth+"px"&&(e.style.width=l.computedWidth+"px"),i||(t.rightToLeft?e.style.right!==l.left+"px"&&(e.style.right=l.left+"px"):e.style.left!==l.left+"px"&&(e.style.left=l.left+"px")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),l===t._firstRenderedColumn||a.summaryRow||e.classList.add("smart-hidden"),l.autoGenerated&&(e.style.width="0px");let n=a.label;const r=function(e,t,l){if(!t)return[];for(let a=0;a<t.length;a++){const i=t[a];i.$&&!1===i.$.filtered||(void 0!==i[e]&&l.push(i),i.summaryRow||(i.children||i.data&&i.data.children)&&r(e,i.children,l))}return l};if(void 0!==a.label){let o="",s=[];if(t.grouping.summaryRow.visible){const n=r(l.dataField,a.summaryRow?a.parent.data.children:a.data.children,[]),d={},c=i?l.summary.length>0?l.summary:["count"]:l.summary;d[l.dataField]=c;const m=c.length>0?t.dataSource.summarize([d],n):null;if(m)for(let a=0;a<c.length;a++){const i=c[a];a>0&&(o+=", ");let n=m[l.dataField][i];const r=l.cellsFormat;r&&(n=e.cell.getFormattedValue(n,r)),o+=t.localize(i,{value:n}),s.push(m[l.dataField][i])}}if(t.dataSource.virtualDataSourceOnExpand&&(o=""),i){const l=t.columnByDataField[a.groupDataField],i=l?l.label:"";if("advanced"===t.grouping.renderMode){if(a.summaryRow)n="<div header group-advanced><span group></span><span value></span>",o&&(n+="<div summary>",n+=o,n+="</div>");else{let e=a.label?a.label:t.localize("blankSummary");a.label||"taskStatus"!==a.groupDataField||(e="");let r="";if(l&&l.editor&&l.editor.dataSource){const t=l.editor.dataSource.find((t=>t.value===e));t&&t.color?(r=`--smart-primary: ${t.color}`,t.label&&(e=t.label)):t&&t.label&&(e=t.label)}if(a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),"object"==typeof e&&l.cellsFormat){const t=a.getCell(l.dataField);e=t.getFormattedValue(e,l.cellsFormat)}n=`<div style="${r}" header group-advanced><span group>${i}: </span><span value>${e}</span>`,o&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=""+o,n+="</span>")}n+="</div>",e.classList.add("smart-grid-column-border-collapse")}else if("compact"===t.grouping.renderMode){if(a.summaryRow)n="<div header><span group></span><span value></span>",o&&(n+="<div summary>",n+=o,n+="</div>");else{let e=a.label;"object"==typeof e&&l.cellsFormat&&(e=a.getCell(l.dataField).getFormattedValue(e,l.cellsFormat)),n="<div header><span group>"+i+": </span><span value>"+e+"</span>",o&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=" ("+s+")",n+="</span>")}n+="</div>",e.classList.add("smart-grid-column-border-collapse")}else("basic"===t.grouping.renderMode||"multipleColumns"===t.grouping.renderMode)&&(n=a.label,"object"==typeof n&&l.cellsFormat&&(n=a.getCell(l.dataField).getFormattedValue(n,l.cellsFormat)),a.summaryRow?o&&(n+="<div summary>",n+=o,n+="</div>"):o&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=" ("+s+")",n+="</span>"),e.classList.add("smart-grid-column-border-collapse"));e.setAttribute("has-toggle-button","")}else e.removeAttribute("has-toggle-button",""),n=o}let o=e.firstChild;if(t.dataSource.boundHierarchy&&i){o.children.length<=1&&(e.innerHTML="<div></div>",o=e.firstChild,e._createToggleButton(o,e.cell),o=e.firstChild);const r=o.children[0],s=o.children[1].children[0],d=o.children[1].children[1].firstChild,c=o.children[1].children[2];r.setAttribute("indent",""),a.checked?d.setAttribute("checked",""):!1===a.checked?d.removeAttribute("checked"):null===a.checked&&d.setAttribute("checked","indeterminate"),a.leaf?s.classList.add("smart-visibility-hidden"):(s.classList.remove("smart-visibility-hidden"),a.expanded?s.setAttribute("toggled",""):s.removeAttribute("toggled",""));let m="";if(!l._treeColumn||a.summaryRow||a.filterRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;if(1+e===0)m+="",r.classList.add("smart-hidden");else{if("multipleColumns"===t.grouping.renderMode){let l=0;for(let a=0;a<t.columns.length;a++)a<1+e&&(l+=t.columns[a].computedWidth);m+='<div style="width: '+l+'px;"></div>'}else m+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>';r.classList.remove("smart-hidden")}}else for(let e=0;e<a.level;e++)m+="<div class='smart-indent'></div>";if(void 0===a.label||a.summaryRow||a.filterRow?s.classList.add("smart-hidden"):(s.classList.remove("smart-hidden"),s.style.marginLeft=""),r.innerHTML=m,c.innerHTML=n,i&&t.grouping.formatFunction){const i={row:a,column:l,cell:e.cell,value:n,template:null};t.grouping.formatFunction(i),i.value!==n?c.innerHTML=i.value:i.template&&(c.innerHTML=i.template)}t.appearance.showTooltips?c.setAttribute("title",a.label?a.label:n):c.hasAttribute("title")&&c.removeAttribute("title")}else void 0!==a.label&&t.grouping.enabled&&!i&&(o.innerHTML=n);let s="smart-label";e.style.zIndex="";const d=t.editing.addNewColumn.visible?t._addNewColumn.width-1:0;if(i){const l=t.columnByDataField[a.groupDataField];l.cellsAlign&&(s+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(s+=" align-"+l.cellsVerticalAlign),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)"),void 0!==a.label&&(e.style.zIndex=11)}else l===t._firstRenderedColumn&&(e.style.zIndex=4),e.setAttribute("header",""),a.summaryRow||(e.style.width="calc(100% - "+d+"px)");if(a.summaryRow&&(e.setAttribute("header",""),e.classList.add("smart-grid-column-border-collapse"),l.cellsAlign&&(s+=" align-"+l.cellsAlign),l.cellsVerticalAlign&&(s+=" align-"+l.cellsVerticalAlign)),o.className!==s&&(o.className=s),l.formatFunction){const t={row:a,column:l,cell:e.cell,value:null,template:null,group:{value:n,template:null}};l.formatFunction(t),t.group.value!==n&&(l._treeColumn?o.children[1].children[2].innerHTML=t.group.value:o.innerHTML=t.group.value),null!==t.group.template&&(o.innerHTML=t.group.template)}}_renderFilterCell(e){const t=this,l=t.cell.grid,a=t.cell.column;let i;const n=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={},l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:n,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:n,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:n,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:n,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:n,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:n,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:n,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:n,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:n,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:n,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:n,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:n,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:n,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:n,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}]),i="string"===a.dataType?l._filterInfo.stringConditions:l._filterInfo.numberAndDateConditions;let r="smart-icon-search";if(a._filterInfo||(a._filterInfo={condition:""}),a.filterEditor&&a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor&&a.filterEditor.value&&(a._filterInfo.value=a.filterEditor.value),a._filterInfo.dataSource=i,null===a._filterInfo.condition)a._filterInfo.condition="",r="smart-icon-search";else switch(a._filterInfo.condition.toLowerCase()){case"equal":r="smart-icon-equals";break;case"starts_with":r="smart-icon-starts-with";break;case"ends_with":r="smart-icon-ends-with";break;case"not_equal":r="smart-icon-not-equal";break;case"less_than":r="smart-icon-less-than";break;case"less_than_or_equal":r="smart-icon-less-than-or-equal";break;case"greater_than":r="smart-icon-greater-than";break;case"greater_than_or_equal":r="smart-icon-greater-than-or-equal";break;case"contains":r="smart-icon-contains";break;case"does_not_contain":r="smart-icon-does-not-contain";break;case"range":r="smart-icon-between";break;default:r="smart-icon-search"}let o=`<div class="smart-filter-input-type"><i class="smart-grid-icon ${r} show"></i></div> `;if("string"===a.dataType)o+=`<input class="smart-filter-input-value" data-type="${a.dataType}" /> `,e.innerHTML=o;else if("date"===a.dataType){const i=new Smart.Utilities.DateTime;o+=`<input placeholder = "${i.expandFormat(i.calendar,a.cellsFormat||"d")}" class="smart-filter-input-value" data-type="${a.dataType}"/><div class="smart-filter-input-type"><i class="smart-grid-icon smart-icon-calendar show"></i></div>`,e.innerHTML=o,e.lastElementChild.onpointerdown=function(){l._handleFilterCalendarCellClick(t.cell)}}else if("number"===a.dataType)o+='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div tabindex="-1" class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>',e.innerHTML=o,l._handleFilterNumberCellEditor(this.cell,e);else if("boolean"===a.dataType||"bool"===a.dataType){const a=document.createElement("div");a.classList.add("smart-input"),a.classList.add("smart-grid-check-box-cell-editor"),a.classList.add("smart-filter-input-value"),e.tabIndex=0,e.style.outline="none",t.setAttribute("template","checkBox"),a.setAttribute("checked","indeterminate"),o=a.outerHTML,e.innerHTML=o,e.classList.add("align-center"),e.classList.add("smart-label"),e.onfocus=()=>{e.setAttribute("focus","")},e.onblur=()=>{e.removeAttribute("focus","")},e.onclick=e=>{e.target.classList.contains("smart-input")&&l._handleFilterCellCheckBoxClick(this.cell)}}const s=e.querySelector("input");if(s&&(e.firstElementChild.onpointerdown=function(){l._handleFilterCellIconClick(this.cell)}.bind(this),s.onfocus=function(){l._handleFilterCellFocus(this.cell)}.bind(this),s.onblur=function(){l._handleFilterCellBlur(this.cell)}.bind(this),s.onkeyup=function(e){l._handleFilterCellKeyUp(this.cell,e)}.bind(this),s.onkeydown=function(e){l._handleFilterCellKeyDown(this.cell,e)}.bind(this)),e.classList.add("smart-filter-input-container"),a._filterInfo.input=s,a._filterInfo.cell=t.cell,a._filterInfo.editor=e,a._filterInfo.value&&(s.value=a._filterInfo.value,"date"===a.dataType&&(s.value=t.cell.getFormattedValue(a._filterInfo.value,a.cellsFormat))),a.allowFilter||(s.disabled=!0),a.filterEditor)if(a.filterEditor.template){const t=a.filterEditor.template,l=document.createElement("div");a.filterTemplate instanceof HTMLTemplateElement?l.appendChild(t.content.cloneNode(!0)):t instanceof HTMLElement?l.appendChild(t):l.innerHTML=t,e.innerHTML="",e.appendChild(l),l.style.height="100%",l.style.width="100%";const i=e.querySelector("input");i&&(i.onfocus=()=>{e.setAttribute("focus","")},i.onblur=()=>{e.removeAttribute("focus","")}),a.filterEditor.onInit&&a.filterEditor.onInit(a,l)}else void 0!==a.filterEditor.min&&(s.min=a.filterEditor.min),void 0!==a.filterEditor.max&&(s.max=a.filterEditor.max),void 0!==a.filterEditor.minLength&&(s.minLength=a.filterEditor.minLength),void 0!==a.filterEditor.maxLength&&(s.maxLength=a.filterEditor.maxLength),void 0!==a.filterEditor.placeholder&&(s.placeholder=a.filterEditor.placeholder),void 0!==a.filterEditor.value&&(s.value=a.filterEditor.value),void 0!==a.filterEditor.step&&(s.step=a.filterEditor.step),void 0!==a.filterEditor.disabled&&(s.disabled=a.filterEditor.disabled),void 0!==a.filterEditor.condition&&(a._filterInfo.condition=a.filterEditor.condition),a.filterEditor.onInit&&a.filterEditor.onInit(a,e)}_setTemplate(e,t,l){const a=this,i=a.cell.grid,n=a.cell.column;let r=null;switch((!i.editing.enabled||!n.allowEdit||a.cell.readonly||"none"===i.editing.action||i.editing.enabled&&i.editing.commandColumn.visible&&i.editing.editRow!==a.cell.row)&&a.setAttribute("readonly",""),t){case"checkBox":case"radioButton":case"switchButton":r=document.createElement("span"),r.className="smart-input",e?r.setAttribute("checked",""):null===e?r.setAttribute("checked","indeterminate"):r.removeAttribute("checked"),a.setAttribute("template",a.cell.template);break;case"checklist":if(e&&e.indexOf("[")>=0&&(e=JSON.parse(e)),l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&l.firstElementChild.getAttribute("value")===e.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(e&&Array.isArray(e)&&e.length>0){const t=e.filter((e=>e.completed)).length;e=i.localize("completed",{value:t})+"/"+e.length}else e="";r=document.createElement("span"),r.innerHTML=e,a.setAttribute("template",a.cell.template),r.setAttribute("value",e.length);break;case"createdBy":case"updatedBy":{const e=a.cell.row;let o=null,s=null;if(o="createdBy"===t?e.createdBy:e.updatedBy,l.firstElementChild&&l.firstElementChild.hasAttribute("user-id")&&o===parseInt(l.firstElementChild.getAttribute("user-id")))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const d=document.createElement("div");d.classList.add("smart-multi-combo-input"),d.setAttribute("data-field",n.dataField),d.setAttribute("row-id",a.cell.row.id);let c="";if(null!=o&&-1!==o){s=i.users.find((e=>e.id===o));const e=s,t="string"==typeof e?e:e.name,l="string"==typeof e?null:e.color,a="string"==typeof e?null:e.image,n=document.createElement("span");a&&(n.style.backgroundImage=`url('${e.image}')`,n.className="smart-drop-down-list-selection-image"),c+=l?'<span title="'+t+'" data-item="'+t+'" style="background: '+l+"; color: "+new Smart.Color(l).getInvertedColor()+';" class="smart-truncate smart-token">'+n.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>":'<span title="'+t+'" data-item="'+t+'" class="smart-truncate smart-token">'+n.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+t+"</span></span>"}d.innerHTML=c;const m=document.createElement("div");m.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),d.classList.add("smart-flex-auto"),m.appendChild(d),r=m,r.setAttribute("user-id",o),a.setAttribute("template",a.cell.template);break}case"tags":{let t=[];if("number"==typeof e&&(e=""+e),null!==e&&(t=e.indexOf("{")>=0||"[]"===e?JSON.parse(e):e.split(",").map((e=>e.trim()))),l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&n.editor._items&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const o=document.createElement("div");o.classList.add("smart-multi-combo-input"),o.setAttribute("data-field",n.dataField),o.setAttribute("row-id",a.cell.row.id);let s="";if(e)for(let e=0;e<t.length;e++){const l=t[e];let a=null;if(n.editor.dataSource)if("string"==typeof l&&n.editor._items&&n.editor._items[l])a=n.editor._items[l];else for(let e=0;e<n.editor.dataSource.length;e++){const t=n.editor.dataSource[e];if(void 0!==t.value&&void 0!==l&&void 0!==l.value&&t.value===l.value){a=t,n.editor._items||(n.editor._items=[]),n.editor._items[l]=t;break}if(void 0===t.value&&t===l||void 0!==t.value&&""+t.value===l){a=t,n.editor._items||(n.editor._items=[]),n.editor._items[l]=t;break}}else a=l;if(!a)continue;const i="string"==typeof a?a:a.label,r="string"==typeof a?null:a.color,o="string"==typeof a?null:a.image;if(""===i)continue;const d=document.createElement("span");if(o&&(d.style.backgroundImage=`url('${a.image}')`,d.className="smart-drop-down-list-selection-image"),r&&n.editor.colorItems?s+='<span title="'+i+'" data-item="'+i+'" style="background: '+r+"; color: "+new Smart.Color(r).getInvertedColor()+';" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>":s+='<span title="'+i+'" data-item="'+i+'" class="smart-truncate smart-token">'+d.outerHTML+"<span class='smart-drop-down-list-selection-label' role=\"presentation\">"+i+"</span>",n.editor.dataSource){if(n.editor.singleSelect){s+="</span>";break}s+='<span class=\'smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></span>'}else s+="</span>"}if(o.innerHTML=s,o.onpointerdown=e=>{if(e.target&&"#text"!==e.target.nodeName&&e.target.classList.contains("smart-drop-down-list-unselect-button")){const l=e.target.parentNode.getAttribute("data-item");if(t[0]&&t[0].label){const r=t.map((e=>e.value)).indexOf(l);r>=0&&(t.splice(r,1),i.setCellValue(a.cell.row.id,n.dataField,JSON.stringify(t)),e.preventDefault(),e.stopPropagation())}else t.indexOf(l)>=0&&(t.splice(t.indexOf(l),1),i.setCellValue(a.cell.row.id,n.dataField,t.join(", ")),e.preventDefault(),e.stopPropagation())}else if(e.target.classList.contains("smart-drop-down-list-selection-label")){if(i.editing.enabled){const t=e.target.parentElement.parentElement,l=t.getAttribute("data-field"),a=t.getAttribute("row-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}},!n.cellsWrap&&n.allowEdit&&i.editing.enabled){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const t=document.createElement("div");t.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),o.classList.add("smart-flex-auto"),i.rightToLeft&&(o.style.direction="rtl"),t.appendChild(o),"input"!==n.editor.template&&t.appendChild(e),r=t,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.previousElementSibling,l=t.getAttribute("data-field"),a=t.closest("smart-grid-row").getAttribute("data-id");i.beginEdit(a,l)}e.stopPropagation(),e.preventDefault()}}else n.cellsWrap||n.allowEdit||o.classList.add("smart-flex-auto"),r=o;a.setAttribute("template",a.cell.template),r.setAttribute("value",e);break}case"dropDownList":case"dropdownlist":case"list":{const t=document.createElement("div");if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&l.firstElementChild.getAttribute("value")===e)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(t.innerHTML='<span class="smart-truncate">'+e+"</span>",n.allowEdit&&i.editing.enabled){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),t.classList.add("smart-flex-auto"),l.appendChild(t),l.appendChild(e),l.classList.add(a.cell.template.toLowerCase()),r=l,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),n=t.getAttribute("data-field"),r=l.getAttribute("data-id");if(i.beginEdit(r,n),a.cell.column.editor&&a.cell.column.editor.instance){const e=a.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}else r=t;a.setAttribute("template",a.cell.template.toLowerCase()),r.setAttribute("value",e);break}case"password":l.innerHTML=e?'<span class="smart-truncate">'+e.replace(/./g,"*")+"</span>":"",a.setAttribute("template",a.cell.template);break;case"color":l.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${e};"></span>`,a.setAttribute("template",a.cell.template);break;case"autoNumber":r=document.createElement("span"),r.innerHTML=1+a.cell.row.visibleIndex,a.setAttribute("template",a.cell.template);break;case"createdDate":case"createdTime":l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.createdDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.createdDate,"t")+"</span>",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"updatedDate":case"updatedTime":a.cell.row.updatedDate?l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.updatedDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.updatedDate,"t")+"</span>":l.innerHTML="",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"progress":{const t=e?parseInt(100*e)+"%":"0%";if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&t===l.firstElementChild.getAttribute("value"))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const i="white",n=["#D50000","#F4511E","#F6BF26","#33B679"];let r=n[0];r=e<.25?n[0]:e<.5?n[1]:e<.75?n[2]:n[3],l.innerHTML='<div value="'+t+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+t+';"><div title="'+t+'" style="width: 100%; height: 4px; background: '+r+"; color: "+i+';" class="smart-truncate smart-token"></div></div><span>'+t+"</span></div>",a.setAttribute("template",a.cell.template);break}case"images":{if(""===e)return l.innerHTML="",a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")){const t=l.firstElementChild.getAttribute("value");if(e&&e.indexOf(t)>=0)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild.evaluateScroll&&l.firstElementChild.evaluateScroll());if(t&&e&&Array.isArray(e)&&e[0]&&e[0].value&&t.length===e[0].value.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template)}const t=document.createElement("div"),n=document.createElement("div");t.classList.add("container"),n.classList.add("images");let o=e;if("string"==typeof o&&(o.indexOf("http")>=0||o.indexOf("base64")>=0)){let e="";if(o)try{e=JSON.parse(o)}catch(e){console.log(e)}o=e}Array.isArray(o)&&o.forEach((e=>{const l=document.createElement("img");l.src=e.value,l.title=e.label,t.appendChild(l)}));const s=document.createElement("div");s.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");if(d.classList.add("smart-arrow-right","arrowbtn"),n.onpointerdown=e=>{if("IMG"===e.target.nodeName)i._openImagePreviewDialog(e.target),e.stopPropagation(),e.preventDefault();else if("DIV"===e.target.nodeName&&e.target.classList.contains("arrowbtn")){let l=parseInt(t.style.marginLeft);isNaN(l)&&(l=0);const i=s===e.target,n=t.scrollWidth-a.offsetWidth+30;t.style.marginLeft=i?Math.min(0,l+25)+"px":Math.max(-n,l-25)+"px",l=parseInt(t.style.marginLeft),0===l?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),e.stopPropagation(),e.preventDefault()}},t.children.length){n.appendChild(t);const e=25*o.length;e-a.offsetWidth+30>30&&(n.appendChild(s),n.appendChild(d)),n.evaluateScroll=()=>{const l=e-a.offsetWidth+30;t.style.marginLeft="0px",s.classList.add("smart-hidden"),l<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),l>30&&(n.appendChild(s),n.appendChild(d))},r=n}else r=document.createElement("div");a.setAttribute("template",a.cell.template),e&&e[0]&&e[0].value?r.setAttribute("value",e[0].value):o&&o[0]&&o[0].label?r.setAttribute("value",o[0].label):r.setAttribute("value",e);break}case"email":Smart.Validator&&(r=document.createElement("span"),Smart.Validator.email(e)?r.innerHTML=e:(r.className="url",r.innerHTML='<a href="mailto:'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()})),a.setAttribute("template",a.cell.template);break;case"url":Smart.Validator&&(r=document.createElement("span"),r.className="url",Smart.Validator.url(e)?r.innerHTML='<a href="https://'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>":r.innerHTML='<a href="'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()}),a.setAttribute("template",a.cell.template);break;default:{let t=null;a.setAttribute("template","");const r=a.cell.row,o=l;let s=a.cell.getFormattedValue(e,n.cellsFormat);if(o.style.lineHeight="","function"==typeof a.cell.template){const t={row:r,column:n,cell:a.cell,oldValue:a.cell.oldValue,value:e,template:null};let l=o.querySelector(".smart-grid-cell-template");l&&l.getAttribute("column")===n.dataField?t.template=l.firstElementChild:l=null,a.formattedValue!==s&&(l=null),a.cell.canNotify=!1,r.canNotify=!1;const i=Object.assign({},{background:a.cell.background,color:a.cell.color,fontSize:a.cell.fontSize,fontFamily:a.cell.fontFamily,fontWeight:a.cell.fontWeight,textDecoration:a.cell.textDecoration,fontStyle:a.cell.fontStyle});if(a.cell.template(t),!l&&t.template)if(t.template instanceof HTMLElement){const e=document.createElement("div");e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),o.innerHTML="",o.appendChild(e),e.appendChild(t.template)}else o.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+t.template+"</div>";else l||null!==t.template||(o.innerHTML=e);o.style.background===i.background&&o.style.color===i.color&&o.style.fontSize===i.fontSize&&o.style.fontWeight===i.fontWeight&&o.style.fontStyle===i.fontStyle||(a.cell._styleChanged=!0,a.cell._setStyle(o)),a.cell.background!==i.background||a.cell.color!==i.color||a.cell.fontSize!==i.fontSize||a.cell.fontWeight!==i.fontWeight||a.cell.fontStyle!==i.fontStyle?(a.cell._styleChanged=!0,a.cell._setStyle(o)):a.cell._styleChanged&&a.cell._setStyle(o),void 0===a.cell.oldValue&&(a.cell.oldValue=e),a.formattedValue=s,a.cell.canNotify=!0,r.canNotify=!0}else{if(""!==o.textContent&&(o.textContent=""),a.cell.template instanceof HTMLTemplateElement)t=a.cell.template;else if(a.cell.template instanceof HTMLElement){const t=a.cell.template.innerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);o.innerHTML!==t&&(o.innerHTML=t)}if(a.cell.template.startsWith&&a.cell.template.startsWith("#")&&(t=document.querySelector(a.cell.template)),t){let l=t.content.cloneNode(!0).firstElementChild;const d=e;if(e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),l.querySelector("[smart-if]")){const t=l.querySelector("[smart-else]"),a=l.querySelectorAll("[smart-if]");let i=!1;for(let t=0;t<a.length;t++){const r=a[t],o=r.getAttribute("smart-if").split(" "),s=o[1].trim();let c=o[2].trim(),m=e;switch("Today"===c&&(c=new Date),"date"===n.dataType&&(e=new Date(d).getTime(),c=new Date(c).getTime()),s){case">":e>parseFloat(c)&&(l=r,i=!0);break;case">=":e>=parseFloat(c)&&(l=r,i=!0);break;case"=":case"==":case"===":e===c&&(l=r,i=!0);break;case"<":e<parseFloat(c)&&(l=r,i=!0);break;case"<=":e<=parseFloat(c)&&(l=r,i=!0)}if(e=m,i)break}!i&&t&&(l=t)}let c=l.outerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);for(c.indexOf("{{value=")>=0&&(e?(c=c.substring(0,c.indexOf("{{value="))+e+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const t=c.indexOf("{{value::"),l=c.substring(t+9,c.indexOf("}}")),i=a.cell.getFormattedValue(e,l);c=c.replace(`{{value::${l}}}`,i)}if(n._treeColumn){const e=o.firstChild;if(e&&e.classList&&a.toggleButton&&n._treeColumn&&o.children[1]){const e=o.children[0],t=o.children[1].children[0],l=o.children[1].children[1].firstChild,a=o.children[1].children[2];let n="";if(i.grouping.enabled){let e=r.level-1;"multipleColumns"!==i.grouping.renderMode&&(n+='<div style="width: '+(1+e)*i.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<r.level;e++)n+="<div class='smart-indent'></div>";r.checked?l.setAttribute("checked",""):!1===r.checked?l.removeAttribute("checked"):null===r.checked&&l.setAttribute("checked","indeterminate"),r.leaf?r.allowCheck?l.classList.remove("smart-visibility-hidden"):l.classList.add("smart-visibility-hidden"):r.allowCheck?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"),r.allowCheck?i.checkBoxes.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden"):i.checkBoxes.visible||l.classList.add("smart-hidden"),e.innerHTML=n,t.classList.add("smart-visibility-hidden"),r.leaf?t.classList.add("smart-visibility-hidden"):(t.classList.remove("smart-visibility-hidden"),r.expanded?t.setAttribute("toggled",""):t.removeAttribute("toggled","")),r.data.isEmpty&&t.classList.add("smart-visibility-hidden"),a.innerHTML=c,i.appearance.showTooltips?a.setAttribute("title",s):a.hasAttribute("title")&&a.removeAttribute("title")}}else o.innerHTML!==c&&(o.innerHTML=c)}else if("string"==typeof a.cell.template){""===e&&(e=" ");const t=a.cell.template.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);o.innerHTML!==t&&(o.innerHTML=t)}}if("auto"===a.cell.row.height||i.layout.allowCellsWrap||"auto"===i.layout.rowHeight){const e=o.querySelector(".smart-grid-cell-template");if(e){r._templatesHeight||(r._templatesHeight=[]);const t=(e,t)=>{if(e){const l=i.rowById[e.getAttribute("data-id")];l._templatesHeight[n.dataField]=t,l._isDirty=!0,l.autoSize(),delete l._isDirty}};if(e.firstElementChild){if(!e.firstElementChild.resizeObserver){const l=new ResizeObserver((function(){const e=this.target.closest("smart-grid-row");this.target.offsetHeight&&(t(e,this.target.offsetHeight),i.$.scrollView.scrollTop=0)}));e.firstElementChild.resizeObserver=l,l.target=e.firstElementChild,l.observe(e.firstElementChild)}e.firstElementChild.onblur=e.firstElementChild.onchange=function(){const e=this.closest("smart-grid-row");t(e,this.offsetHeight)}}else{const l=this.closest("smart-grid-row");t(l,e.offsetHeight)}}}}}if(r)return l.innerHTML="",l.appendChild(r),a.cell._setStyle(l),r}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,n=a._isMeasureRow?null:l.cellsFormat,r=t.grouping.enabled&&t.dataSource.groupBy.length>0;if(!1===t._recycleValues&&!r)return e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),void(e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.setAttribute("aria-activedescendant",e.id)):(e.removeAttribute("focus"),a.element.star&&t._selection.focusedCell&&t._selection.focusedCell.id!==a.id&&a.element.star.classList.remove("smart-hidden")));if(t.grouping.enabled&&t.dataSource.groupBy.length>0){if(void 0!==a.label){let t=l.displayField?i[l.displayField]:i[l.dataField];return e._renderGroupCell(t),void(a.summaryRow&&(e.cell.canNotify=!1,a.canNotify=!1,e.cell._styleChanged=!0,e.cell.background=null,e.cell.color=null,e.cell.fontFamily=null,e.cell.fontSize=null,e.cell.element&&e.cell.element.firstElementChild&&e.cell._setStyle(e.cell.element.firstElementChild),e.cell.canNotify=!0,a.canNotify=!0))}e.style.zIndex=""}else if(t.appearance.showTreeRowHeader&&t.rowHierarchy&&!1===a.leaf&&!l.autoGenerated){let t=i[a.groupDataField];return a.label=t,void e._renderGroupCell(t)}if(t.appearance.showTreeRowHeader&&e.removeAttribute("header"),t.grouping.enabled&&t.dataSource.groupBy.length>0&&e.toggleButton&&(e.toggleButton.classList.remove("smart-hidden"),e.toggleButton.classList.remove("smart-visibility-hidden"),e.toggleButton.style.marginLeft="",l._treeColumn&&t.grouping.enabled&&t.grouping.toggleButtonIndent>0&&(e.toggleButton.style.marginLeft=a.level*(t.grouping.toggleButtonIndent-t.grouping.groupIndent)+"px")),t.grouping.enabled&&t.dataSource.groupBy.length>0&&(e.removeAttribute("header"),e.removeAttribute("group")),!l.visible)return void(e.style.width="0px");t.appearance.showSortColumnBackground&&t.sorting.maintainSort&&!a.summaryRow?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button");let o=l.displayField?i[l.displayField]:i[l.dataField];null!==o||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(o=0),"string"===l.dataType&&(o=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(o=!1),"date"===l.dataType&&(o=new Date)),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&(o="",e.setAttribute("header","")),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row");const s=t=>t?t.startsWith("off_")?(e.classList.remove(t.substring(4)),!1):(e.classList.add(t),e.setAttribute("customCSS",t),!0):(e.setAttribute("highlight",""),!0);if((t.highlightedRows||t.highlightedCells)&&e.hasAttribute("customCSS")){const t=e.getAttribute("customCSS");e.removeAttribute("customCSS"),e.classList.remove(t)}if(l.highlight&&!a.summaryRow&&(s(l._highlightCSS||""),e.setAttribute("highlight-data-field",l.dataField)),t.highlightedCells&&t.highlightedCells[a.id]&&!a.summaryRow&&void 0!==t.highlightedCells[a.id][l.dataField]&&s(t.highlightedCells[a.id][l.dataField]),t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]&&s(t.highlightedRows[a.id]),t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),o=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell,t),e.cell._updating=!1,o=e.cell.value),void 0===o&&(o="");let d=o;n?d=e.cell.getFormattedValue(o,n):l.formatSettings&&l.formatSettings.Intl&&(d=e.cell.getFormattedValue(o,l.formatSettings.Intl));const c=e.firstChild;if(e.content=c,l._isDirty&&(c.innerHTML=""),c.hasAttribute("data-field")&&c.getAttribute("data-field")!==l.dataField&&(c.innerHTML=""),c.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?c.appendChild(t):c.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e):l.onCellRender(e.cell,a.visibleIndex,l.dataField,a.data,e),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return c.firstChild&&c.removeChild(c.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void c.appendChild(t)}e.cell.value!==o&&(d=e.cell.value)}if(l.autoGenerated||e.setAttribute("data-field",l.dataField),e.cell.focused?(t.selection.allowCellSelection&&e.setAttribute("focus",""),a.element.setAttribute("focus",""),a.element.toggleDetailButton&&(a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.element.star&&a.element.star.classList.add("smart-hidden")),e.cell.id||(e.id="gridcell_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.setAttribute("aria-activedescendant",e.id)):e.removeAttribute("focus"),e.cell.selected?(e.setAttribute("selected",""),e.setAttribute("aria-selected",!0)):(e.removeAttribute("selected"),e.removeAttribute("aria-selected")),t.dragDrop&&t.dragDrop.row===a?e.classList.add("dragged"):e.classList.remove("dragged"),e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(a._classNames){if(e._rowClassNames)for(let t=0;t<e._rowClassNames.length;t++)e.classList.remove(e._rowClassNames[t]);for(let t=0;t<a._classNames.length;t++)e.classList.add(a._classNames[t]);e._rowClassNames=a._classNames}if(t.onCellClass){const i=t.onCellClass(a.visibleIndex,l.dataField,o,a.data,a,t);if(e.___classNames)for(let t=0;t<e.___classNames.length;t++)e.classList.remove(e.___classNames[t]);if(i){const t=i.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e.___classNames=t}}if(l.cellsClassName)if("string"==typeof l.cellsClassName){const t=l.cellsClassName.trim().split(" ");for(let l=0;l<t.length;l++)e.classList.add(t[l]);e._classNames=t}else{const t=l.cellsClassName(a.visibleIndex,l.dataField,o,a.data,a);if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);if(t){const l=t.trim().split(" ");for(let t=0;t<l.length;t++)e.classList.add(l[t]);e._classNames=l}}if(l.cellsCSSRules){if(e.__classNames)for(let t=0;t<e.__classNames.length;t++)e.classList.remove(e.__classNames[t]);const i=Object.keys(l.cellsCSSRules);for(let n=0;n<i.length;n++){let r=i[n];const s={index:a.visibleIndex,value:o,dataField:l.dataField,row:a,api:t};l.cellsCSSRules[r](s)&&(e.classList.add(r),e.__classNames=[r])}}t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const m=e._getCellAlignment(a,l),u=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let g="";if(m.align&&(g+=m.align+" "),m.verticalAlign&&(g+=m.verticalAlign+" "),l.cellsWrap&&(g+="wrap "),g+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&t.dataSource.groupBy.length>0&&t.dataSource.groupBy.indexOf(l.dataField)>=0&&e.classList.add("smart-grid-column-border-collapse"),t._columnGap>0&&t.appearance.showColumnLines&&e.classList.add("smart-grid-column-border"),t._rowGap>0&&e.classList.add("smart-grid-row-border"),t.appearance.showColumnLines?e.classList.remove("smart-grid-vertical-border-collapse"):e.classList.add("smart-grid-vertical-border-collapse"),t.appearance.showRowLines?e.classList.remove("smart-grid-horizontal-border-collapse"):e.classList.add("smart-grid-horizontal-border-collapse");let p=l.left;if(t.rightToLeft?e.style.right!==p+"px"&&(e.style.right=p+"px"):e.style.left!==p+"px"&&(e.style.left=p+"px"),e.classList.contains("smart-hidden")&&e.classList.remove("smart-hidden"),e.hasAttribute("template")&&e.removeAttribute("template"),e.hasAttribute("freeze")&&e.removeAttribute("freeze"),e.hasAttribute("detail")&&e.removeAttribute("detail"),e.hasAttribute("error")&&e.removeAttribute("error"),e.cell.error&&e.setAttribute("error",e.cell.error),a.filterRow?e.classList.add("smart-grid-filter-row-cell"):a.summaryRow?e.classList.add("smart-grid-summary-row-cell"):(l.freeze||a.freeze)&&(l.selectionColumn&&(e.setAttribute("checkbox",""),g+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command",""),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze","")),l.cellsRotationAngle){if(!e._rotateCellContent(c,l,o))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(c));c.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)c.innerHTML="";else if(l.autoGenerated&&(c.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let n in a){const r=l.cellsFormat;let o=a[n];r&&r.indexOf("p")>=0&&"count"===n?o=a[n]:r&&"date"!==l.dataType&&(o=e.cell.getFormattedValue(o,r)),i.push(t.localize(n,{value:o}))}const n=i.join(", "),r=t.summaryRow.editing?'<span class="smart-arrow-down"></span>':"";let o=`<div title = "${n}" class="smart-truncate summary-value" > <span class="label">${n}</span>${r}</div> `;if(t.columns[0].dataField===l.dataField&&i.length<3){const e=t._recyclingRows.length;o=`<div title = "${n}" class="smart-truncate summary-value" > <span style = "justify-content: flex-start" class="smart-truncate summary-value" > ${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span> <span class="label">${n}</span>${r}</div> `}c.innerHTML!==o&&(c.innerHTML=o)}else if(t.summaryRow.editing&&l.allowSummary)if(t.columns[0].dataField===l.dataField){const e=t._recyclingRows.length,l=`<div class="smart-truncate summary-value" ><span style="justify-content: flex-start" class="smart-truncate summary-value">${1===e?t.localize("oneRow"):t.localize("rows",{value:e})}</span><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;c.innerHTML!==l&&(c.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value" ><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;c.innerHTML!==e&&(c.innerHTML=e)}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?c.firstElementChild.setAttribute("has-summary",""):c.firstElementChild.removeAttribute("has-summary"),c.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),c._clickTarget=e.target},c.onpointerup=l=>{c._clickTarget===l.target&&(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="";if(l=a.showDetail?'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggled toggle-button></button>':'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggle-button></button>',t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,c.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):c.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(c.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else c.innerHTML!==l&&(c.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)c.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let n="";for(let e=0;e<t;e++)n+="A";return n+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?c.textContent="":c.textContent=l(a)}else if(u)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)c.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)c.innerHTML=o;else switch(e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(o,e.cell.template,c);break;case"tags":case"checklist":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(o,e.cell.template,c);break;case"image":e._setTemplate(o,"images",c);break;case"email":e._setTemplate(o,"email",c);break;case"url":e._setTemplate(o,"url",c);break;default:e._setTemplate(o,e.cell.template,c)}else{const i=c.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&c.children[1]){const e=c.children[0],i=c.children[1].children[0],n=c.children[1].children[1].firstChild,r=c.children[1].children[2];let o="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?o="":"multipleColumns"!==t.grouping.renderMode&&(o+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>')}else for(let e=0;e<a.level;e++)o+="<div class='smart-indent'></div>";if(a.checked?n.setAttribute("checked",""):!1===a.checked?n.removeAttribute("checked"):null===a.checked&&n.setAttribute("checked","indeterminate"),a.leaf?a.allowCheck?n.classList.remove("smart-visibility-hidden"):n.classList.add("smart-visibility-hidden"):a.allowCheck?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden"),!l.autoGenerated){const e=a["column_"+l.dataField];e&&e._setStyle(c)}}a.allowCheck?t.checkBoxes.visible?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden"):t.checkBoxes.visible||n.classList.add("smart-hidden"),e.innerHTML=o,i.classList.add("smart-visibility-hidden"),a.leaf?i.classList.add("smart-visibility-hidden"):(i.classList.remove("smart-visibility-hidden"),a.expanded?i.setAttribute("toggled",""):i.removeAttribute("toggled","")),t.grouping.enabled&&i.classList.add("smart-hidden"),a.data.isEmpty&&i.classList.add("smart-visibility-hidden"),r.innerHTML=d,t.appearance.showTooltips?r.setAttribute("title",d):r.hasAttribute("title")&&r.removeAttribute("title")}else{const i=a["column_"+l.dataField];if(e.getAttribute("rowspan")&&(e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),e.style.height=""),e.getAttribute("colspan")&&(e.removeAttribute("colspan"),e.removeAttribute("aria-colspan")),i){if(i.colSpan>1){const a=t.columns.indexOf(l);let n=0;for(let e=a;e<a+i.colSpan;e++){const l=t.columns[e];l&&l.visible&&(n+=l.computedWidth)}e.style.width=n+"px",e.setAttribute("colspan",""),e.setAttribute("aria-colspan",i.colSpan),i._styleChanged=!0}let n=i.rowSpan;if(i.rowSpan>1){const l=t.rows.indexOf(a);let n=0;a.element.setAttribute("rowspan","");for(let e=l;e<=l+i.rowSpan-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(n+=l.cellHeight)}e.style.height=n+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",i.rowSpan),i._styleChanged=!0}else if(l.rowSpan&&!a._isMeasureRow){const r="number"==typeof l.rowSpan?l.rowSpan:l.rowSpan(o,a.visibleIndex,a.data),s=a.visibleIndex;let d=!1;for(let e=0;e<t._cellRowSpan.length;e++){const l=t._cellRowSpan[e];if(s>l[0]&&s<l[1]){d=!0;break}}if(a._rowSpan=r,r&&!d){let o=0;t._cellRowSpan.push([s,s+r,l.dataField]),t._cellRowSpan.maxSpan||(t._cellRowSpan.maxSpan=1),t._cellRowSpan.maxSpan=Math.max(r,t._cellRowSpan.maxSpan),a.element.setAttribute("rowspan","");for(let e=s;e<=s+r-1;e++){const l=t.rows[e];l&&l.visible&&l.filtered&&(o+=l.cellHeight)}e.style.height=o+"px",e.setAttribute("rowspan",""),e.setAttribute("aria-rowspan",r),i._styleChanged=!0,n=r}}1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width="",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===n&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),c.textContent===d||l.formatFunction||(c.textContent=d),i.column.autoGenerated||i._setStyle(c),t.appearance.showTooltips?c.setAttribute("title",i.tooltip||d):c.hasAttribute("title")&&c.removeAttribute("title")}else c.textContent=d}}if(c.className!==g&&(c.className=g),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&c.firstChild&&c.firstChild.classList&&c.firstChild.classList.contains("smart-grid-cell-loading")&&(c.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),c.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const t={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:o,formattedValue:d,template:null};e.cell.canNotify=!1,a.canNotify=!1;const i=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});await l.formatFunction(t),c.style.background===i.background&&c.style.color===i.color&&c.style.fontSize===i.fontSize&&c.style.fontFamily===i.fontFamily&&c.style.textDecoration===i.textDecoration&&c.style.fontWeight===i.fontWeight&&c.style.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c)),e.cell.background===i.background&&e.cell.color===i.color&&e.cell.fontSize===i.fontSize&&e.cell.fontWeight===i.fontWeight&&e.cell.textDecoration===i.textDecoration&&e.cell.fontFamily===i.fontFamily&&e.cell.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(c));let n=!0;if(t.value!==o&&(e.toggleButton?c.children[1].children[2].innerHTML=t.value:c.innerHTML=t.value,n=!1),null!==t.template){if(e.toggleButton){const e=c.children[1].children[2];e.innerHTML!==t.template&&(e.innerHTML=t.template)}else if(c.innerHTML!==t.template){const e=document.createElement("div");e.innerHTML=t.template,e.innerHTML!==c.innerHTML&&(c.innerHTML=t.template)}n=!1}n&&(l.cellsFormat?c.textContent=d:c.textContent=o),e.cell.canNotify=!0,a.canNotify=!0}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,c),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&c.querySelector("[toggle-button]")){const e=c.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),n=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),n.appendChild(l),n.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(n),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const n=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-n.top+"px",i.style.left=a._offsetLeft(l)-n.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,n=e.row,r=e.row.index,o=n._style;if(t._conditionalFormatting&&t._conditionalFormatting[i]){const e=t._conditionalFormatting[i][r];a.cell.canNotify=!1,n.canNotify=!1,e?(a.cell._styleChanged=!0,a.cell.background=e.background,a.cell.color=e.color,a.cell.fontFamily=e.fontFamily,a.cell.fontSize=e.fontSize,a.cell._setStyle(l)):a.cell._styleChanged||(o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l))),a.cell.canNotify=!0,n.canNotify=!0}else t._conditionalFormattingChanged&&!a.cell._styleChanged&&(a.cell.canNotify=!1,n.canNotify=!1,o&&o._changed?(a.cell._styleChanged=!0,a.cell.background=o.background,a.cell.color=o.color,a.cell.fontFamily=o.fontFamily,a.cell.fontSize=o.fontSize,a.cell._setStyle(l)):(a.cell._styleChanged=!0,a.cell.background=null,a.cell.color=null,a.cell.fontFamily=null,a.cell.fontSize=null,a.cell._setStyle(l)),a.cell.canNotify=!0,n.canNotify=!0)}_rotateCellContent(e,t,l){const a=document.createElement("span");return e.innerHTML="",a.innerHTML=l,e.appendChild(a),a.className="rotate",a.style.transform="rotate("+t.cellsRotationAngle+"deg)",this.grid._recycleRotate(e,a,t.cellsAlign,t.cellsVerticalAlign,l)}_getCellAlignment(e,t){const l=e["column_"+t.dataField],a=l&&l.verticalAlign||t.cellsVerticalAlign;let i=l&&l.align||t.cellsAlign;const n={align:"",verticalAlign:""};if(!l)return{align:"align-left",verticalAlign:"align-middle"};switch(l.grid.rightToLeft&&("left"===i?i="right":"right"===i&&(i="left")),i){case"left":n.align="align-left";break;case"center":case"middle":n.align="align-center";break;case"right":n.align="align-right"}switch(a){case"top":n.verticalAlign="align-top";break;case"center":case"middle":n.verticalAlign="align-middle";break;case"bottom":n.verticalAlign="align-bottom"}return n}template(){return""}_detach(){this.element=null,this.cell=null}onDetached(){this._detach()}});
|
|
51
|
+
Smart.Utilities.Assign("Grid.Resize",class{autoSizeRows(e){const t=this,o=e||t._recyclingRows;t.rows.canNotify=!1;for(let e=0;e<o.length;e++){const i=o[e];i.element=t._rowElements[1],i.grid=t;const l=i._autoSize(i);i.cellHeight!==l&&(i.cellHeight=l),i.height=l}t.rows.canNotify=!0,t.refresh()}autoSizeColumn(e){const t=this.columnByDataField[e];t&&t.autoSize()}autoSizeColumns(e,t){const o=this,i=t||o.columns;let l=[];if(!e){const e=o._recyclingRows;for(let t=0;t<e.length;t++){const o=e[t];for(let e=0;e<i.length;e++){const t=i[e],s=o.getCell(t.dataField);l[t.dataField]||(l[t.dataField]=t.label),s.value&&s.value.toString().length>l[t.dataField].length&&(l[t.dataField]=s.value)}}}const s=[];for(let e=0;e<i.length;e++){const t=i[e],o=l[t.dataField]?l[t.dataField]:t.label;s.push(o)}const n=i[0]._measureSize(s);o.columns.canNotify=!1;for(let e=0;e<i.length;e++)i[e].width=n[e];o.columns.canNotify=!0,o.refresh()}_doubleClickHandler(e){const t=this;if("none"!==t.behavior.rowResizeMode||"none"!==t.behavior.columnResizeMode){if(t._downTime&&new Date-t._downTime<300){const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null,s=null,n=null;for(let e=0;e<o.length;e++){const t=o[e];if(t.getAttribute("data-field")&&(i=t.getAttribute("data-field"),"smart-grid-column"===t.nodeName.toLowerCase())){l=t;break}if(t.getAttribute("data-id")){s=t.getAttribute("data-id"),n=t;break}}const r=t.columnByDataField[i],a=t.rowById[s];if(t.behavior.allowColumnAutoSizeOnDoubleClick&&r&&r.allowResize&&"none"!==t.behavior.columnResizeMode&&l){const t=l.getBoundingClientRect(),o=t.right,i=10;o-i<=e.clientX&&e.clientX<=o+i&&t.top<=e.clientY&&t.bottom>=e.clientY&&(r.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))}if(t.behavior.allowRowAutoSizeOnDoubleClick&&a&&a.allowResize&&"none"!==t.behavior.rowResizeMode){const t=n.getBoundingClientRect().bottom,o=10;t-o<=e.clientY&&e.clientY<=t+o&&(a.computedHeight=null,a.autoSize(),e.preventDefault(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation()))}}t._downTime=new Date}}_endResize(){const e=this;e._overlay&&setTimeout((()=>{e._overlay&&(e._overlay.parentNode.removeChild(e._overlay),e._overlay=null)}),100);const t=e.getBoundingRect(e);if(delete e._columnDownPosition,delete e._rowDownPosition,e.classList.remove("smart-grid-resize-mode"),e.$.root.classList.remove("smart-grid-resize-mode"),e.classList.remove("smart-grid-row-resize-mode"),e.classList.remove("smart-grid-column-resize-mode"),e._rowToResize&&e._rowResizeStartLine&&e._rowResizeLine){const t=e.rowById[e._rowToResizeId],o=t.cellHeight+parseFloat(e._rowResizeLine.style.top)-parseFloat(e._rowResizeStartLine.style.top),i=t.cellHeight;if(e.rows.canNotify=!1,t.height=null,"split"===e.behavior.rowResizeMode){const i=e._nextRow(t),l=parseInt(t.height-o+t.cellHeight);t.computedHeight=o,i.computedHeight=parseInt(i.height)+l,i.height=null}else t.computedHeight=o;return e.rows.canNotify=!0,e._rowResizeStartLine.parentNode.removeChild(e._rowResizeStartLine),e._rowResizeLine.parentNode.removeChild(e._rowResizeLine),e.appearance.showResizeTooltips&&e._rowResizeTooltip.parentNode.removeChild(e._rowResizeTooltip),e._rowToResize.header?e._rowToResize.header.style.cursor="":e._rowToResize.style.cursor="",t.header&&(t.header.style.cursor=""),e._rowResizeLine=null,e._rowToResize=null,e._rowToResizeId=null,e._rowResizeStartLine=null,e.refresh(),e.$.fireEvent("rowResize",{row:t,id:t.id,oldHeight:i,height:o}),void(e.onRowResize&&e.onRowResize({row:t,id:t.id,oldHeight:i,height:o}))}if(!e._columnToResizeElement||!e._columnResizeLine)return;const o=e.columnByDataField[e._columnToResizeDataField],i=e._columnToResizeRect;let l=t.left+parseInt(e._columnResizeLine.style.left)-i.left+e.scrollLeft;const s=o.width;if(e.rightToLeft&&(l=t.left-parseFloat(e._columnResizeLine.style.left)+i.right-e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),l<o.minWidth&&(l=o.minWidth),e.columns.canNotify=!1,"split"===e.behavior.columnResizeMode){const t=e._nextColumn(o);if(t){const e=parseInt(o.computedWidth-l);o.width=l,t.width=parseInt(t.computedWidth)+e}}else o.width=l;e.columns.canNotify=!0,e._columnResizeLine.parentNode.removeChild(e._columnResizeLine),e._columnResizeLine=null,e._columnResizeStartLine.parentNode.removeChild(e._columnResizeStartLine),e._columnResizeTooltip.parentNode&&e._columnResizeTooltip.parentNode.removeChild(e._columnResizeTooltip),e._columnResizeStartLine=null,e._columnToResizeElement.style.cursor="",e._columnToResizeElement.sortButton.style.cursor="",e._columnToResizeElement.filterButton.style.cursor="",e._columnToResizeElement=null,e._columnToResizeRect=null,e._columnToResizeDataField=null,e._columnResizeTooltip=null,e.refresh(),o._state||(o._state={label:o.label,dataField:o.dataField,dataType:o.dataType}),o._state.width=o.width,e.$.fireEvent("columnResize",{column:o,dataField:o.dataField,oldWidth:s,width:l}),e.onColumnResize&&e.onColumnResize({column:o,dataField:o.dataField,oldWidth:s,width:l}),e.closeMenu()}_columnResizePrepare(){const e=this,t=e._columnToResizeRect,o=e.getBoundingRect(e.$.columnHeader);if(e._dragDetails)return;const i=function(){const i=document.createElement("div");return i.classList.add("smart-grid-resize-line"),e.rightToLeft?i.style.left=-o.left+t.left+"px":i.style.left=-o.left+t.right+"px",e.header.visible?i.style.top=-o.top+o.height+t.top+"px":i.style.top=-o.top+t.top+"px",i.style.height="calc(100% - "+i.style.top+")",i.style.cursor="col-resize",i},l=document.createElement("div");l.classList.add("smart-grid-resize-tooltip"),e._columnResizeTooltip=l,e._columnResizeTooltip.style.left=-o.left+t.right+"px",e.rightToLeft&&(e._columnResizeTooltip.style.left=-o.left+t.left+"px"),e._columnResizeTooltip.innerHTML=e.localize("columnResizeTooltip",{value:t.width}),e._columnResizeLine=i(),e._columnResizeStartLine=i(),"growAndShrink"===e.behavior.columnResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-column-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e.appearance.showResizeTooltips&&e.$.root.appendChild(e._columnResizeTooltip),e.$.root.appendChild(e._columnResizeLine),e.$.root.appendChild(e._columnResizeStartLine),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="col-resize",e.$.root.appendChild(e._overlay)}_columnDownResizeHandler(e){this._columnDownPosition=e.pageX}_columnMoveResizeHandler(e){const t=this;if(t._dragDetails)return;t._columnDownPosition&&Math.abs(e.pageX-t._columnDownPosition)>=3&&!t._columnResizeLine&&t._columnResizePrepare();const o=function(e){const o=t._columnToResizeRect;let i=e.left+parseFloat(t._columnResizeLine.style.left)-o.left+t.scrollLeft;t.rightToLeft&&(i=e.left-parseFloat(t._columnResizeLine.style.left)+o.right-t.scrollLeft-t._scrollView.vScrollBar.offsetWidth);const l=t.columnByDataField[t._columnToResizeDataField];i<l.minWidth&&(i=l.minWidth),t.appearance.showResizeTooltips&&(t._columnResizeTooltip.innerHTML=t.localize("columnResizeTooltip",{value:parseInt(i)}))};if(t._columnResizeLine){const i=t.columnByDataField[t._columnToResizeDataField],l=t._columnToResizeRect,s=i.minWidth,n=i.maxWidth,r=t._nextColumn(i),a=t.getBoundingRect(t);if(t.rightToLeft){if(e.pageX>a.right)return;if("split"===t.behavior.columnResizeMode&&r&&e.pageX<=t.offsetWidth-t.scrollLeft-r.left-r.computedWidth+r.minWidth)return t._columnResizeLine.style.left=t.offsetWidth-t.scrollLeft-r.left-r.computedWidth+r.minWidth+"px",void o(a);if(l.right-s-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-s-t.scrollLeft+"px",void o(a);if(l.left+n-t.scrollLeft>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.right-n-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+e.pageX+"px",o(a)}else{if(e.pageX<a.left)return;if("split"===t.behavior.columnResizeMode&&r&&e.pageX>=a.left+r.left+r.computedWidth-r.minWidth-t.scrollLeft)return t._columnResizeLine.style.left=-a.left+a.left+r.computedWidth+r.left-r.minWidth-t.scrollLeft+"px",void o(a);if(l.left+s-t.scrollLeft>=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+s-t.scrollLeft+"px",void o(a);if(l.left+n-t.scrollLeft<=e.pageX)return t._columnResizeLine.style.left=-a.left+l.left+n-t.scrollLeft+"px",void o(a);t._columnResizeLine.style.left=-a.left+e.pageX+"px",o(a)}}else if(!t._columnDownPosition){const t=this;if(e.composedPath&&-1===e.composedPath().indexOf(this))return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null;if(t._columnResizeLine)return;for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-field")&&t.hasAttribute("header")){i=t.getAttribute("data-field"),l=t;break}}if(t._columnToResizeElement&&(t._columnToResizeElement.style.cursor="",t._columnToResizeElement.sortButton.style.cursor="",t._columnToResizeElement.filterButton.style.cursor="",t._columnToResizeElement=null),i){const o=t.rightToLeft?l.getBoundingClientRect().left:l.getBoundingClientRect().right;if(l.style.cursor="",l.sortButton.style.cursor="",l.filterButton.style.cursor="",o-10<=e.clientX&&e.clientX<=o+10){const e=t.columnByDataField[i];if(!e||e&&!e.allowResize)return;const o=t._isLastVisibleColumn(e);if("split"===t.behavior.columnResizeMode&&o)return;l.style.cursor="col-resize",l.sortButton.style.cursor="col-resize",l.filterButton.style.cursor="col-resize",t._columnToResizeRect=t.getBoundingRect(l),t._columnToResizeElement=l,t._columnToResizeDataField=i}}}}_rowMoveResizeHandler(e){const t=this;if(t.viewColumns.length&&t.viewColumns[0].rowHeaderColumn&&!t._rowResizeLine){const o=t.offset(t.viewColumns[0].element);if(e.pageX<o.left||e.pageX>o.left+t.viewColumns[0].width)return}const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let i=null,l=null;if(t._rowDownPosition&&Math.abs(e.pageY-t._rowDownPosition)>=3&&!t._rowResizeLine&&t._rowDownResizeHandler(e),t._rowResizeLine){const o=t._offsetTop(t.$.scrollView),i={top:o,bottom:t.$.scrollView.offsetHeight+o};if(e.pageY<=i.top)return;if(e.pageY>=i.bottom)return;const l=function(){const e=s.cellHeight+parseFloat(t._rowResizeLine.style.top)-parseFloat(t._rowResizeStartLine.style.top);t.appearance.showResizeTooltips&&(t._rowResizeTooltip.innerHTML=t.localize("rowResizeTooltip",{value:parseInt(e)}))},s=t.rowById[t._rowToResizeId],n=t._nextRow(s),r=t._rowToResizeBounds,a=s.minHeight,c=s.maxHeight;return"split"===t.behavior.rowResizeMode&&n&&r.bottom+n.height-n.minHeight<=e.pageY?(t._rowResizeLine.style.top=r.bottom+n.height-n.minHeight-o+"px",void l()):r.top+a+10>=e.pageY?(t._rowResizeLine.style.top=r.top+a-o+"px",void l()):r.top+c>=e.pageY-o?(t._rowResizeLine.style.top=r.top+c+10-o+"px",void l()):(t._rowResizeLine.style.top=-o+e.pageY-1+"px",void l())}if(!t._rowDownPosition){for(let e=0;e<o.length;e++){const t=o[e];if(t.hasAttribute("data-id")&&t.hasAttribute("header")){l=t,i=t.getAttribute("data-id");break}}if(t._rowToResize&&(t._rowToResize.style.cursor="",t._rowToResize=null),null!==i){const o=t._offsetTop(l)+l.offsetHeight;if(l.style.cursor="",o-10<=e.clientY&&e.clientY<=o+10){const e=t.rowById[i];if(!e||e&&!e.allowResize)return;e.header&&(e.header.style.cursor="row-resize");const o=t._offsetTop(l);t._rowToResizeBounds={top:o,bottom:l.offsetHeight+o,height:l.offsetHeight},t._rowToResize=l,t._rowToResizeId=i}}}}_rowDownResizeHandler(){const e=this,t=e._rowToResizeBounds,o=function(){const o=document.createElement("div");return o.classList.add("smart-grid-resize-line","row"),o.style.width=e.$.scrollView.offsetWidth-e._rowToResize.offsetLeft+"px",o.style.left="0px",o.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",o.style.cursor="row-resize",o},i=document.createElement("div");i.classList.add("smart-grid-resize-tooltip"),e._rowResizeTooltip=i,e._rowResizeTooltip.style.top=-e._offsetTop(e.$.scrollView)+t.bottom+"px",e._rowResizeTooltip.innerHTML=e.localize("rowResizeTooltip",{value:t.height}),e._rowResizeTooltip.style.right="20px",e._rowResizeTooltip.style.bottom="initial","growAndShrink"===e.behavior.rowResizeMode&&(e.classList.add("smart-grid-resize-mode"),e.classList.add("smart-grid-row-resize-mode"),e.$.root.classList.add("smart-grid-resize-mode")),e._rowResizeLine=o(),e._rowResizeStartLine=o(),e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="row-resize",e.$.root.appendChild(e._overlay),e.$.scrollView.appendChild(e._rowResizeLine),e.$.scrollView.appendChild(e._rowResizeStartLine),e.appearance.showResizeTooltips&&e.$.scrollView.appendChild(e._rowResizeTooltip)}_rowResizeHandler(e){const t=this;let o=e.clientX,i=e.clientY;void 0!==o&&void 0!==i||(o=e.touches[0].clientX,i=e.touches[0].clientY);const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,i);let s=null;for(let e=0;e<l.length;e++){const t=l[e];t.getAttribute("data-id")&&(s=t.getAttribute("data-id"))}null===s||!t._rowToResize||t._rowResizeLine||(t._rowDownPosition=e.pageY)}});
|
|
52
52
|
Smart.Utilities.Assign("Grid.Reorder",class{reorderColumns(e,r,t=!1){const o=this;if(void 0===e||void 0===r)return;const a=o.columnByDataField[e],n=o.columnByDataField[r],d="string"==typeof e?o.columns.indexOf(a):e,i="string"==typeof r?o.columns.indexOf(n):r;"string"==typeof e&&"string"===r?a.columnGroup=n.columnGroup:o.columns[d].columnGroup=o.columns[i].columnGroup,t&&i+1<=o.columns.length?o.columns.move(d,i):o.columns.move(d,i-1)}swapColumns(e,r){const t=this;if(void 0===e||void 0===r)return;const o=t.columnByDataField[e],a=t.columnByDataField[r],n="string"==typeof e?t.columns.indexOf(o):e,d="string"==typeof r?t.columns.indexOf(a):r,i="string"==typeof e?o.columnGroup:t.columns[n].columnGroup;"string"==typeof e&&"string"===r?o.columnGroup=a.columnGroup:t.columns[n].columnGroup=t.columns[d].columnGroup,t.columns.move(n,d),"string"==typeof e&&"string"===r?a.columnGroup=i:t.columns[d-1].columnGroup=i,t.columns.move(d-1,n)}_createLine(e){const r=this;return e.classList.contains("smart-breadcrumb-item")||e.column?function(){const t=document.createElement("div"),o=r.getBoundingRect(e),a=r.getBoundingRect(r.$.columnHeader),n=r.getBoundingRect(r),d=r.$.content.offsetHeight-7-r._scrollView.hScrollBar.offsetHeight-o.top+n.top;return t.classList.add("smart-grid-drag-line"),r.rightToLeft?t.style.left=-a.left+o.left+"px":t.style.left=-a.left+o.right+"px",t.style.top=o.top-n.top+"px",t.style.height=d+"px",t.style.opacity=0,t}():function(){const t=document.createElement("div"),o=r.getBoundingRect(e);return t.classList.add("smart-grid-drag-line","row"),t.style.width=r.$.scrollView.offsetWidth-e.offsetLeft-e.row.header.offsetWidth-r._scrollView.vScrollBar.offsetWidth+"px",t.style.left=e.row.header.offsetWidth+"px",t.style.top=o.bottom-r.offsetTop+"px",t.style.opacity=0,t}()}_drag(e){const r=this,t=e.originalEvent;if(!r._dragDrop)return;let o=r._dragDrop.dragDetails.feedback;if(!o&&r._dragDrop.showFeedback){if(o=r._dragDrop.createFeedback(t),!o)return;if(r._overlay=document.createElement("div"),r._overlay.classList.add("smart-grid-overlay"),r._overlay.style.cursor="",r.$.root.appendChild(r._overlay),r._dragDrop.column)r._dragLine=r._createLine(r._dragDrop.column.element),r.$.root.appendChild(r._dragLine),requestAnimationFrame((()=>{r._dragLine&&(r._dragLine.style.opacity=1)})),r._dragDrop.feedbackLine=r._dragLine,o.classList.add("smart-grid-column-drag-feedback");else{const e=r._dragDrop.row;let t="<div>";for(let o=0;o<r.columns.length;o++){const a=r.columns[o];t+="<div>"+a.label+": "+e["column_"+a.dataField].value+"</div>"}r._dragDrop.items=r._rowElements,r._dragDrop.getItemCoordinates(r._rowElements),t+="</div>",o.innerHTML=t,r._dragLine=r._createLine(r._dragDrop.row.element),r.$.root.appendChild(r._dragLine),requestAnimationFrame((()=>{r._dragLine&&(r._dragLine.style.opacity=1)})),o.classList.add("smart-grid-row-drag-feedback"),r._dragDrop.feedbackLine=r._dragLine}}r._dragDrop.drag(e),r._dragDrop.column?r._dragColumn(e):r._dragRow(e),t.preventDefault()}_dragRow(e){const r=this,t=r._dragDrop.dragDetails,o=r._dragLine,a=e.originalEvent,n=r.getBoundingRect(r);if(e.pageY<n.top||e.pageY>n.bottom||e.pageX<n.left||e.pageX>n.right||t.target&&!t.target.row||!t.target)r._dragDrop.error(),o.style.opacity=0;else{if(r._dragDrop.getItemCoordinates(r._dragDrop.items),o.style.opacity=1,r._dragDrop.success(),!t.target)return;let a=r.getBoundingRect(t.target);o.style.width=r.$.scrollView.offsetWidth-r._dragDrop.row.offsetLeft-r._dragDrop.row.header.offsetWidth-r._scrollView.vScrollBar.offsetWidth+"px",o.style.left=r._dragDrop.row.header.offsetWidth+"px";const d=r.offset(r).top;let i=a.top-d-r.scrollTop;r._recyclingRows[r._recyclingRows.length-1].element===t.target&&e.pageY>n.bottom-10&&(t.before=!1),e.pageY>i+d+a.height-7&&(t.before=!1),o.style.top=t.before?i+"px":i+a.height-7+"px"}r.$.fireEvent("rowDragging",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.visibleIndex,data:r._dragDrop,originalEvent:a})}_dragColumn(e){const r=this,t=r._dragDrop.dragDetails,o=r.getBoundingRect(r),a=e.originalEvent;if(e.pageY<o.top||e.pageY>o.bottom||e.pageX<o.left||e.pageX>o.right?(r._dragDrop.error(),r._dragLine.style.opacity=0):r._dragLine.style.opacity=1,t.target&&r._dragDrop.feedback&&!r._dragDrop.feedback.classList.contains("error")){r._dragDrop.getItemCoordinates(r._dragDrop.items);for(let o=0;o<r._dragDrop._itemCoordinates.coordinates.length;o++){const a=r._dragDrop._itemCoordinates.coordinates[o];if(Array.isArray(a))for(let o=0;o<a.length;o++){let n=a[o];e.pageY>=n.rect.top&&e.pageY<n.rect.bottom&&e.pageX>=n.rect.left&&e.pageX<n.rect.right&&(t.target=r._dragDrop.items[n.index],t.before=!0)}}const a=r.getBoundingRect(t.target),n=r.getBoundingRect(r.$.content);if(r._dragDrop.column){if(r._dragLine.style.opacity=1,!1===t.before?r._dragLine.style.left=a.right-n.left+"px":r._dragLine.style.left=a.left-n.left+"px",r.behavior.allowColumnFreeze&&r.dataSource&&0===r.dataSource.groupBy.length){const o=r._dragDrop._itemCoordinates.coordinates[0][0].rect;r._dragDrop.column.allowFreeze&&(e.pageX>=o.left&&e.pageX<=o.left+10?t.feedback.classList.add("freeze"):t.feedback.classList.remove("freeze"),t.target&&t.target.hasAttribute("freeze")&&t.feedback.classList.add("freeze"),t.item.column.freeze&&!t.target.hasAttribute("freeze")?t.feedback.classList.add("unfreeze"):t.feedback.classList.remove("unfreeze"))}if(t.target.classList.contains("smart-breadcrumb-item"))r._dragLine.style.top=a.top-o.top-r.scrollTop+"px",r._dragLine.style.height=a.height+"px",r.$.breadcrumb.dataSource.forEach((e=>{e.value===t.item.column.dataField&&(r._dragLine.style.opacity=0,r._dragDrop.error())}));else{r._dragLine.style.top=a.top-o.top-r.scrollTop+"px";const e=r.$.content.offsetHeight-7-r._scrollView.hScrollBar.offsetHeight-a.top+n.top;r._dragLine.style.height=e+"px"}parseInt(r._dragLine.style.left)<3?r._dragLine.style.left="3px":parseInt(r._dragLine.style.left)>=r.offsetWidth-3&&(r._dragLine.style.left=r.offsetWidth-7+"px")}}else r._dragLine.style.opacity=0;r.$.fireEvent("columnDragging",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:r.columns.indexOf(r._dragDrop.column),data:r._dragDrop,originalEvent:a})}_beginRowDrag(e,r){const t=this;let o=!1;t.behavior.allowRowReorder&&r.allowReorder&&(o=!0),o&&(t.$.fireEvent("rowDragStart",{row:r,id:r.id,index:r.visibleIndex,data:null,originalEvent:e.originalEvent}).defaultPrevented||(t._dragDrop=new Smart.Utilities.DragDrop(t),t._dragDrop.capture(r.element,e),t._dragDrop.row=r,t._recycle(!1),t._dragInterval&&clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const e=t._dragDrop.dragDetails;if(!e.feedback)return;const r=parseInt(e.feedback.style.left),o=parseInt(e.feedback.style.top),a=t.getBoundingClientRect();t._dragLine&&a.left<=r&&a.left+a.width>=r&&(o>=a.top&&o<=a.top+20?t.scrollTop-=5:o>=a.top+a.height+5&&o<=a.top+a.height+20&&(t.scrollTop+=5))}),10)))}_beginDrag(e,r){const t=this;if(!r.dataField)return void t._beginRowDrag(e,r);const o=r;if(t.behavior.allowColumnReorder&&o.allowReorder&&!o.autoGenerated){if(t.appearance.showColumnHeaderDragIcon&&!e.originalEvent.target.classList.contains("smart-drag-handle"))return;if(!t.$.fireEvent("columnDragStart",{column:o,dataField:o.dataField,index:t.columns.indexOf(o),data:null,originalEvent:e.originalEvent}).defaultPrevented){t._dragDrop=new Smart.Utilities.DragDrop(t),t._dragDrop.capture(o.element,e),t._dragDrop.column=o;const r=()=>{let e=t.columns.map((e=>e.element));t.behavior.allowColumnFreeze||(e=t.columns.filter((e=>!e.freeze)).map((e=>e.element))),t.grouping.enabled&&"multipleColumns"===t.grouping.renderMode&&t.dataSource&&-1===t.dataSource.groupBy.indexOf(o.dataField)&&(e=t.columns.filter((e=>{if(t.dataSource&&-1===t.dataSource.groupBy.indexOf(e.dataField))return!0})).map((e=>e.element))),e=e.filter((e=>!e.classList.contains("smart-visibility-hidden"))),t.$.breadcrumb?t._dragDrop.items=e.concat(t.$.breadcrumb._items):t._dragDrop.items=e};r(),t._dragInterval&&clearInterval(t._dragInterval),t._dragInterval=setInterval((function(){const e=t._dragDrop.dragDetails;if(!e.feedback)return;r();const o=parseInt(e.feedback.style.left),a=t.getBoundingClientRect();t._dragLine&&a.left<=o&&a.left+a.width>=o&&(o>=a.left&&o<=a.left+20?t.scrollLeft-=5:o>=a.left+a.width-20&&o<=a.left+a.width&&(t.scrollLeft+=5))}),3)}}}_cancelDrag(){const e=this;e._dragLine&&(e._dragLine.parentNode&&e._dragLine.parentNode.removeChild(e._dragLine),e._dragLine=null),e._dragDrop&&(e._dragDrop.removeFeedback(),e._dragDrop=null),e._dragInterval&&clearInterval(e._dragInterval),e._recycle()}_endDrag(e){const r=this;if(r._dragDrop){const t=r._dragDrop.dragDetails;if(!t.feedback||t.feedback&&t.feedback.classList.contains("error")&&!t.feedback.classList.contains("data"))return void r._cancelDrag();if(e.key&&"Escape"===e.key)return r._dragDrop.column?r.$.fireEvent("columnDragCancel",{column:t.item.column,dataField:t.item.column.dataField,index:r.columns.indexOf(r._dragDrop.column),data:r._dragDrop}):r._dragDrop.row&&r.$.fireEvent("rowDragCancel",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.row.visibleIndex,data:r._dragDrop}),void r._cancelDrag();r.beginUpdate();let o=t.target;const a=t.before;if(r._dragDrop.column){if(r.filtering.filterRow)for(let e=0;e<r.columns.length;e++)r.columns[e]._filterEditorInitialized=!1;if(o&&o.column&&"Escape"!==e.key&&!t.feedback.classList.contains("data")){if(!r.$.fireEvent("columnDragEnd",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:r.columns.indexOf(r._dragDrop.column),newIndex:r.columns.indexOf(o.column),data:r._dragDrop,originalEvent:e.originalEvent}).defaultPrevented){const t=r.columns.indexOf(r._dragDrop.column);let n=r.columns.indexOf(o.column);const d=r._dragDrop.column.freeze;n+=a?0:1,r._dragDrop.column.columnGroup=o.column.columnGroup,r._dragDrop.column.freeze=o.column.freeze,r.behavior.allowColumnFreeze&&(r._dragDrop.feedback.classList.contains("freeze")&&(r._dragDrop.column.freeze=!0),r._dragDrop.feedback.classList.contains("unfreeze")&&(r._dragDrop.column.freeze=!1)),t<n&&n--,r.columns.move(t,n),d!==r._dragDrop.column.freeze&&r._renderColumns(),r.$.fireEvent("columnReorder",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:t,newIndex:n,data:r._dragDrop,originalEvent:e.originalEvent})}}else r.$.fireEvent("columnDragEnd",{column:r._dragDrop.column,dataField:r._dragDrop.column.dataField,index:r.columns.indexOf(r._dragDrop.column),newIndex:-1,data:r._dragDrop,originalEvent:e.originalEvent});if("Escape"!==e.key&&r.$.breadcrumb){const t=r.getBoundingRect(r.$.breadcrumb);if(e.originalEvent.pageY>=t.top-r.scrollTop&&e.originalEvent.pageY<=t.bottom-r.scrollTop){const e=r.$.breadcrumb._items.indexOf(o),t=r._dragDrop.dragDetails.item.column,n=r.$.breadcrumb.dataSource.slice(0);n.splice(Math.max(0,e+(a?0:1)),0,{label:t.label,value:t.dataField}),r.$.breadcrumb.dataSource=n;const d=r.$.breadcrumb.dataSource.map((e=>e.value));r.dataSource.groupBy=d,r.refresh(!0),r.refreshFilters(),r.$.fireEvent("group",{groups:r.dataSource.groupBy})}}}else if(r._dragDrop.row)if(o&&o.row&&"Escape"!==e.key&&!t.feedback.classList.contains("data")){if(!r.$.fireEvent("rowDragEnd",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.row.visibleIndex,newIndex:o.row.visibleIndex,data:r._dragDrop,originalEvent:e.originalEvent}).defaultPrevented){const a=r._dragDrop.row.visibleIndex;let n=o.row.visibleIndex;t.before||n++,a<n&&n--,r.rows.move(a,n),r.$.fireEvent("rowReorder",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:a,newIndex:n,data:r._dragDrop,originalEvent:e.originalEvent})}}else r.$.fireEvent("rowDragEnd",{row:r._dragDrop.row,id:r._dragDrop.row.id,index:r._dragDrop.row.visibleIndex,newIndex:-1,data:r._dragDrop,originalEvent:e.originalEvent});r._cancelDrag(),r.endUpdate(),r.columnGroups&&r.columnGroups.length>0&&r._renderColumns(!0),r.paging.enabled&&r.grouping.enabled&&r._refreshPagesCount()}}});
|
|
53
|
-
Smart.Utilities.Assign("Grid.Menu",class{_openColumnChooserMenu(e){const t=this;if(e||(e=t._commandColumn),!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t._createColumnChooserMenuItems(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e,t._filterContainer&&("none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"));let l=n.right-n.width+window.pageXOffset,i=n.bottom+window.pageYOffset;l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,t.menu.classList.add("smart-open-right"),l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth)),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open")}_openColumnFilterMenu(e){const t=this;if(!e||t.filterRowMenu&&t.filterRowMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.filterRowMenu||(t.filterRowMenu=document.createElement("div"),t.filterRowMenu.classList.add("smart-grid-column-menu"),t.filterRowMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowMenu.classList.add("smart-animate"):t.filterRowMenu.classList.remove("smart-animate"),t._createColumnFilterMenuItems(e),t.filterRowMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowMenu.column&&t.filterRowMenu.column!==e&&(t.filterRowMenu.column.setProperty("menu",null),t.filterRowMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowMenu):document.body.appendChild(t.filterRowMenu),e.setProperty("filterRowMenu",t.filterRowMenu);const n=e.element.getBoundingClientRect();t.filterRowMenu.column=e;let l=n.left+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowMenu.offsetWidth,l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowMenu.offsetWidth)),t.filterRowMenu.style.left=l+"px",t.filterRowMenu.style.top=i+"px",t.filterRowMenu.classList.remove("smart-hidden"),t.filterRowMenu.classList.add("open"),setTimeout((()=>{t.filterRowMenu.querySelector("smart-menu").focus()}),50),t.filterRowMenu}openContextMenu(e,t){const n=this;if(n.contextMenu.selector){const l=document.querySelector(n.contextMenu.selector);l&&setTimeout((()=>{l.open(e,t)}),100)}else n._closeMenu(n._contextMenu),n._contextMenu||(n._contextMenu=document.createElement("div"),n._contextMenu.classList.add("smart-grid-column-menu"),n._contextMenu.setAttribute("theme",n.getAttribute("theme")),n._contextMenu.id=n.id+"_"+n.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),n.menu=n._contextMenu),n.appearance.allowColumnMenuAnimation?n._contextMenu.classList.add("smart-animate"):n._contextMenu.classList.remove("smart-animate"),n.rightToLeft?n._contextMenu.setAttribute("right-to-left",""):n._contextMenu.removeAttribute("right-to-left"),n.contextMenu.dataField?n._contextMenu.column=n.columnByDataField[n.contextMenu.dataField]:n._contextMenu.column=n.columns[0],n._createContextMenuItems(n._contextMenu),n._contextMenu.style.height=n.contextMenu.height?n.contextMenu.height+"px":"auto",n._contextMenu.style.width=n.contextMenu.width?n.contextMenu.width+"px":"auto",n.isInShadowDOM?n.getRootNode().appendChild(n.menu):document.body.appendChild(n._contextMenu),n._contextMenu.style.left=e+"px",n._contextMenu.style.top=t+"px",n._contextMenu.classList.remove("smart-hidden"),n._contextMenu.classList.add("open"),setTimeout((()=>{n._contextMenu&&n._contextMenu.querySelector("smart-menu").focus()}),50)}_openMenu(e){const t=this;if(!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls")||!1===t.columnMenu.enabled)return void t.closeMenu();t._closeMenu(t.filterRowMenu),t.$.headerBar&&t.header.visible&&t.$.headerBar.closePanel(),t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t.rightToLeft?t.menu.setAttribute("right-to-left",""):t.menu.removeAttribute("right-to-left"),t._createMenuItems(e),t._createFilterPanel(e),t._filterMenuItemsVisibility(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e;let l=n.right-e.element.actionButton.getBoundingClientRect().width+window.pageXOffset,i=n.bottom+window.pageYOffset;t.menu.classList.remove("smart-open-right"),t.rightToLeft&&(l=n.left+window.pageXOffset-t.menu.offsetWidth+e.element.actionButton.getBoundingClientRect().width,l<0&&(l=n.left+window.pageXOffset)),l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth),t.menu.classList.add("smart-open-right")),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.hasColumnMenu(e)?t.menu.classList.remove("smart-hidden"):t.closeMenu(),t.menu.classList.add("open"),setTimeout((()=>{t.menu&&(t.menu.querySelector(".smart-filter-panel-input")?t.menu.querySelector(".smart-filter-panel-input").focus():t.menu.querySelector("smart-menu").focus())}),50)}_menuItemClick(e){const t=this,n=e.detail.value;if(n&&n.properties){const e=n.properties.command;"function"==typeof e?e.apply(t,[n.column,n.properties]):t[e]&&t[e].apply(t,[n.column,n.properties]),n.column&&n.column.autoCloseMenu&&t.closeMenu()}}contextMenuItemDeleteCommand(){const e=this;void 0!==e.contextMenu.id&&e.deleteRow(e.contextMenu.id)}contextMenuItemEditCommand(){const e=this;void 0!==e.contextMenu.id&&e.editing.enabled&&("cell"===e.editing.mode?e.beginEdit(e.contextMenu.id,e.contextMenu.dataField):e.beginEdit(e.contextMenu.id))}removeGroupByCommand(e){this.removeGroup(e.dataField)}groupByCommand(e){const t=this;t.dataSource&&(t.$.headerBar?t.header.visible&&t.header.buttons.indexOf("group")>=0&&t.$.headerBar.openGroupPanel(e):t.addGroup(e.dataField))}sortAscCommand(e){this.sortBy(e.dataField,"asc")}sortDescCommand(e){this.sortBy(e.dataField,"desc")}removeSortCommand(e){this.sortBy(e.dataField,null)}addSortCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openSortPanel(e)}addFilterCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openFilterPanel(e)}removeFilterCommand(e){this.removeFilter(e.dataField)}customizeTypeCommand(e){this._openAddColumnDialog(e,"rename")}hideColumnCommand(e){e.visible=!1}deleteColumnCommand(e){this.columns.splice(this.columns.indexOf(e),1)}duplicateCommand(e,t,n){const l=this,i=new Smart.Grid.Column(e);let o=e.dataField,a=0;if(void 0===n){let t=!1;for(let n=0;n<l.rows.length;n++)if(l.rows[n].data[e.dataField]){t=!0;break}if(t)return void l._openDescriptionDialog(e,"duplicate")}for(let e=0;e<l.columns.length;e++)l.columns[e].dataField.indexOf(o)>=0&&a++;if(i.displayField=i.dataField=e.dataField+"_"+a,"object"==typeof e.editor){const t={};for(let n in e.editor)"instance"!==n&&"cell"!==n&&"column"!==n&&"row"!==n&&"isInitialized"!==n&&(t[n]=e.editor[n]);i.editor=JSON.parse(JSON.stringify(t))}const r=l.columns.indexOf(e);if(n)for(let t=0;t<l.rows.length;t++){const n=l.rows[t],o=n.data[e.dataField];n.data[i.dataField]=o}i.label=e.label+` ${l.localize("copy")} `+a,l.columns.splice(1+r,0,i),l.onColumnClone&&setTimeout((()=>{l.onColumnClone(e.dataField,i.dataField,1+r,n)}),100)}_removeMenu(){const e=this;if(e.menu){const t=e.menu.querySelector("smart-menu");t&&e.menu.removeChild(t)}if(e.filterRowMenu){const t=e.filterRowMenu.querySelector("smart-menu");t&&e.filterRowMenu.removeChild(t)}if(e._contextMenu){const t=e._contextMenu.querySelector("smart-menu");t&&(e._contextMenu.removeChild(t),e._contextMenu.parentNode.removeChild(e._contextMenu))}}_createColumnChooserMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();if(n.mode="vertical",n.dropDownAppendTo="body",n.checkboxes=!0,n.checkable=!0,n.classList.add("smart-grid-column-chooser-menu"),n.rightToLeft=t.rightToLeft,e&&"_addNewColumn"===e.dataField){if(t._kanbanViewColumns&&t._kanbanViewColumns.length>0)for(let e=0;e<t._kanbanViewColumns.length;e++){const n=t._kanbanViewColumns[e],i=t.columnByDataField[n.dataField];if(i&&i.visible)continue;const o=document.createElement("smart-menu-item"),a=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";o.checked=n.visible,n.allowHide&&(n.command=function(e){t.closeMenu();const n=t.columnByDataField[e.dataField];n.visible=!0,delete n._visible;const l=t._kanbanViewColumns.indexOf(e);l>=0&&t._kanbanViewColumns.splice(l,1)},o.label=t.localize(n.label)||n.label||n.dataField,o.value={column:n,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),l.appendChild(o))}const e=document.createElement("smart-menu-item");e.label='<span class="smart-grid-icon smart-icon-plus"></span>'+t.localize("dialogNewColumn"),e.value={properties:{command:()=>{t.closeMenu(),t._openAddColumnDialog()}}},l.appendChild(e)}else for(let e=0;e<t.columns.length;e++){const n=t.columns[e],i=document.createElement("smart-menu-item"),o=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";i.checked=n.visible,n.allowHide&&(n.command=function(e){e.visible=!e.visible},i.label=t.localize(n.label)||n.label||n.dataField,i.value={column:n,properties:n},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),l.appendChild(i))}n.appendChild(l),t.menu.appendChild(n),t.menu.itemCheckChange=t._menuItemClick.bind(t),t.menu.addEventListener("itemCheckChange",t.menu.itemCheckChange),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createColumnFilterMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu"),n.rightToLeft=t.rightToLeft;const i=e._filterInfo.dataSource;for(let t=0;t<i.length;t++){const n=i[t],o=document.createElement("smart-menu-item"),a=n.icon;o.label=n.label,o.value={column:e,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),e._filterInfo.condition===n.value&&o.setAttribute("focus",""),l.appendChild(o)}n.appendChild(l),t.filterRowMenu.appendChild(n),t.filterRowMenu.itemClick=t._menuItemClick.bind(t),t.filterRowMenu.addEventListener("itemClick",t.filterRowMenu.itemClick),t.filterRowMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowMenu)}))}_createMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment(),i=e.menuItems||t.columnMenu.dataSource;n.mode="vertical",n.dropDownAppendTo="body",n.rightToLeft=t.rightToLeft;for(let n in i){const o=i[n],a=document.createElement("smart-menu-item");let r=o.icon;a.label=t.localize(n),a.value={column:e,properties:o};const s=t=>{if(t){if("string"===e.dataType)return"A → Z";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"1 → 9";if("bool"===e.dataType||"boolean"===e.dataType)return"0 → 1"}else{if("string"===e.dataType)return"Z → A";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"9 → 1";if("bool"===e.dataType||"boolean"===e.dataType)return"1 → 0"}};"columnMenuItemSortAsc"===n?(a.label=t.localize(n,{mode:s(!0)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)):"columnMenuItemSortDesc"===n&&(a.label=t.localize(n,{mode:s(!1)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)),r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),l.appendChild(a)}n.appendChild(l),t._filterContainer?t.menu.insertBefore(n,t._filterContainer):t.menu.appendChild(n),t.menu.itemClick=t._menuItemClick.bind(t),t.menu.addEventListener("itemClick",t.menu.itemClick),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createContextMenuItems(){const e=this;e._removeMenu();const t=document.createElement("smart-menu"),n=document.createDocumentFragment(),l=e.contextMenu.dataSource;t.mode="vertical",t.dropDownAppendTo="body",t.rightToLeft=e.rightToLeft;for(let t in l){const i=l[t],o=document.createElement("smart-menu-item");let a=i.icon;!0===i.visible?o.classList.remove("smart-hidden"):!1===i.visible&&o.classList.add("smart-hidden"),"contextMenuItemEdit"===t?(e.editing.enabled||(o.disabled=!0),"{{messages}}"===i.label?"cell"===e.editing.mode?o.label=e.localize("contextMenuItemEditCell"):o.label=e.localize("contextMenuItemEditRow"):o.label=i.label):"{{messages}}"===i.label?o.label=e.localize(t):o.label=i.label,o.value={properties:i},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),n.appendChild(o)}t.appendChild(n),e._contextMenu.appendChild(t),e._contextMenu.itemClick=t=>{t.detail.value.column=t.detail.item.column=e._contextMenu.column,e._menuItemClick(t),e._closeMenu(e._contextMenu),e.$.fireEvent("contextMenuItemClick",{id:e._contextMenu.id,dataField:e._contextMenu.column.dataField,command:t.detail.value.properties.command})},e._contextMenu.style.minHeight="30px",e._contextMenu.addEventListener("itemClick",e._contextMenu.itemClick),e._contextMenu.addEventListener("keydown",e._keyDownHandler.bind(e))}_getFilterType(e){let t="string";switch(e.dataType.endsWith("?")?e.dataType.substring(0,e.dataType.length-1):e.dataType){case"number":case"int":case"float":case"int64":t="numeric";break;case"bool":case"boolean":t="bool";break;case"date":case"time":case"datetime":t="date";break;case"any":t="string"}return t}_createFilterPanel(e){const t=this;if(Smart.FilterPanel)if(t.filtering.enabled&&t.filtering.filterMenu.visible&&e.allowFilter&&!t.filtering.filterRow.visible&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){const n=t._getFilterType(e);t._filterPanel&&t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),t._filterPanel=t._filterPanels[n],t._filterPanel.dataField=e.dataField,t._filterPanel.rightToLeft=t.rightToLeft,t.filtering.filterMenu.messages?t._filterPanel.messages=t.filtering.filterMenu.messages:t._filterPanel.messages=t.messages,"excel"===e.filterMenuMode&&(t._filterPanel.dataField=e.dataField,t.dataSource&&t.dataSource.boundSource&&(t._filterPanel.data=t.dataSource.boundSource.toArray?t.dataSource.boundSource.toArray():t.dataSource.boundSource)),t._filterPanel.mode=e.filterMenuMode,t._filterPanel.locale=t.locale;const l=t._filterPanel.querySelectorAll(".smart-filter-panel-input");for(let e=0;e<l.length;e++)l[e].onkeydown=e=>{"Enter"===e.key&&t._filterPanel.filter()};if(!t._filterContainer){const e=document.createElement("div");e.classList.add("smart-filter-container"),t._filterContainer=e,requestAnimationFrame((function(){t.menu.appendChild(e)})),t._applyFilterHandler=function(){t.addFilter(t._filterPanel.dataField,t._filterPanel.getFilter()),t.columnByDataField[t._filterPanel.dataField]._filterState=t._filterPanel.getState()},t._clearFilterHandler=function(){requestAnimationFrame((()=>{t.removeFilter(t._filterPanel.dataField),t.columnByDataField[t._filterPanel.dataField]._filterState=null}))}}t._filterContainer.appendChild(t._filterPanel),t._filterPanel.classList.remove("smart-hidden"),t._filterPanel.removeEventListener("filter",t._applyFilterHandler),t._filterPanel.removeEventListener("clear",t._clearFilterHandler),t._filterPanel.addEventListener("filter",t._applyFilterHandler),t._filterPanel.addEventListener("clear",t._clearFilterHandler);const i=t._filterContainer.querySelector(".smart-grid-custom-filter-panel");if(i&&t._filterContainer.removeChild(i),"none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"),e.getFilterPanel)if(e._customFilterPanel)e.updateFilterPanel(e._customFilterPanel,e),t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(e._customFilterPanel);else{const n=e.getFilterPanel(e);n&&(n.classList.add("smart-grid-custom-filter-panel"),e._customFilterPanel=n,t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(n))}if(t._filterPanel.reset(),e._filterState)t._filterPanel.loadState(e._filterState);else if(e.filter){const n=e.filter,l=t._getFilterType(e);let i=n.getFilters();for(;i.length>0&&"FilterGroup"===i[0].type;)i=i[0].value;const o=n.getConditions(l),a=i.length>0?o.indexOf(i[0].condition):-1,r=i.length>1?o.indexOf(i[1].condition):-1,s=i.length>0?i[0].value:"",d=i.length>1?i[1].value:"",u=i.length>1?["and","or"].indexOf(i[1].logicalOperator):0;"excel"===e.filterMenuMode?(e._filterState={filters:i},t._filterPanel.loadState(e._filterState)):(e._filterState={firstFilterComparison:a,firstFilterValue:s,logicalOperator:u,secondFilterComparison:r,secondFilterValue:d},t._filterPanel.loadState(e._filterState))}}else t._filterPanel&&(t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),e._filterState=null)}hasColumnMenu(e){const t=this;if(!1===t.columnMenu.enabled)return!1;const n=e.menuItems||t.columnMenu.dataSource;let l=0,i=0;for(let o in n){const a=n[o];i++,!1===a.visible?l++:"auto"===a.visible&&("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))&&l++,"columnMenuItemGroupBy"!==o&&"columnMenuItemRemoveGroupBy"!==o||e.allowGroup&&t.grouping.enabled||l++,"columnMenuItemSort"!==o||e.allowSort||l++,"columnMenuItemFilter"!==o||e.allowFilter||l++,"columnMenuItemRemoveFilter"!==o||e.allowFilter||l++,"columnMenuItemGroupBy"!==o||e.allowGroup||l++,"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||e.allowSort&&t.sorting.enabled||l++)}return!!(t.filtering.enabled&&t.filtering.filterMenu.visible&&"none"!==e.filterMenuMode&&Smart.FilterPanel||Smart.Menu&&!(l>=i))}_filterMenuItemsVisibility(e){const t=this,n=(t.menu.parentElement&&(t.enableShadowDOM||t.isInShadowDOM)?t.menu.firstElementChild.shadowRoot:t.menu).querySelectorAll("smart-menu-item"),l=e.menuItems||t.columnMenu.dataSource;let i=0;for(let o in l){const a=n[i++],r=l[o];if(a.disabled=!r.enabled,a.classList.remove("smart-hidden"),"columnMenuItemDelete"!==o||e.allowDelete)if("columnMenuItemHide"!==o||e.allowHide){if("columnMenuItemRemoveSort"===o&&(e.sortOrder?a.disabled=!1:a.disabled=!0),("columnMenuItemSortAsc"===o&&"asc"===e.sortOrder||"columnMenuItemSortDesc"===o&&"desc"===e.sortOrder)&&(a.disabled=!0),!0===r.visible)a.classList.remove("smart-hidden");else if(!1===r.visible)a.classList.add("smart-hidden");else if("auto"===r.visible){if("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(!1===t.filtering.enabled?a.classList.add("smart-hidden"):((t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("filter")>=0&&a.classList.remove("smart-hidden"),e.filtered||"columnMenuItemRemoveFilter"!==o||a.classList.add("smart-hidden"))),"columnMenuItemSort"===o&&(!1===t.sorting.enabled?a.classList.add("smart-hidden"):t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.remove("smart-hidden")),"columnMenuItemGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n>=0}if("columnMenuItemRemoveGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("group")>=0&&a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n<0}"columnMenuItemFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSort"!==o||e.allowSort||a.classList.add("smart-hidden"),"columnMenuItemRemoveFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||(e.allowSort&&t.sorting.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.add("smart-hidden"))}}else a.classList.add("smart-hidden");else a.classList.add("smart-hidden")}}openMenu(e){const t=this.columnByDataField[e];t&&this._openMenu(t)}hasMenu(){const e=this;return!!(e.menu&&e.menu.column&&e.menu.parentNode)}_closeMenu(e){const t=this;(e=>{e&&e.column&&(e.column&&(e.column.setProperty("menu",null),e.column=null),e.parentNode&&(e.classList.remove("open"),t.appearance.allowColumnMenuAnimation||e.parentNode.removeChild(e)),e.removeEventListener("keydown",t._keyDownHandler.bind(t)),e.removeEventListener("itemClick",e.itemClick),e.removeEventListener("itemCheckChange",e.itemCheckChange),t.focus())})(e)}closeMenu(){const e=this,t=e.menu;if(e._closeMenu(t),e._closeMenu(e.filterRowMenu),e._closeMenu(e._contextMenu),e._filterPanel){const t=e._filterPanel.querySelectorAll("smart-drop-down-list");for(let e=0;e<t.length;e++){const n=t[e];n.opened&&n.close()}}}});
|
|
53
|
+
Smart.Utilities.Assign("Grid.Menu",class{_openColumnChooserMenu(e){const t=this;if(e||(e=t._commandColumn),!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t._createColumnChooserMenuItems(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e,t._filterContainer&&("none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"));let l=n.right-n.width+window.pageXOffset,i=n.bottom+window.pageYOffset;l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,t.menu.classList.add("smart-open-right"),l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth)),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.menu.classList.remove("smart-hidden"),t.menu.classList.add("open")}_openColumnFilterMenu(e){const t=this;if(!e||t.filterRowMenu&&t.filterRowMenu.column===e&&e.element.hasAttribute("aria-controls"))return void t.closeMenu();t.filterRowMenu||(t.filterRowMenu=document.createElement("div"),t.filterRowMenu.classList.add("smart-grid-column-menu"),t.filterRowMenu.setAttribute("theme",t.getAttribute("theme")),t.filterRowMenu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.filterRowMenu.classList.add("smart-animate"):t.filterRowMenu.classList.remove("smart-animate"),t._createColumnFilterMenuItems(e),t.filterRowMenu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.filterRowMenu.column&&t.filterRowMenu.column!==e&&(t.filterRowMenu.column.setProperty("menu",null),t.filterRowMenu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.filterRowMenu):document.body.appendChild(t.filterRowMenu),e.setProperty("filterRowMenu",t.filterRowMenu);const n=e.element.getBoundingClientRect();t.filterRowMenu.column=e;let l=n.left+window.pageXOffset,i=n.bottom+t.layout.rowMinHeight+window.pageYOffset;return l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.filterRowMenu.offsetWidth,l+t.filterRowMenu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.filterRowMenu.offsetWidth)),t.filterRowMenu.style.left=l+"px",t.filterRowMenu.style.top=i+"px",t.filterRowMenu.classList.remove("smart-hidden"),t.filterRowMenu.classList.add("open"),setTimeout((()=>{t.filterRowMenu.querySelector("smart-menu").focus()}),50),t.filterRowMenu}openContextMenu(e,t){const n=this;if(n.contextMenu.selector){const l=document.querySelector(n.contextMenu.selector);l&&setTimeout((()=>{l.open(e,t)}),100)}else n._closeMenu(n._contextMenu),n._contextMenu||(n._contextMenu=document.createElement("div"),n._contextMenu.classList.add("smart-grid-column-menu"),n._contextMenu.setAttribute("theme",n.getAttribute("theme")),n._contextMenu.id=n.id+"_"+n.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),n.menu=n._contextMenu),n.appearance.allowColumnMenuAnimation?n._contextMenu.classList.add("smart-animate"):n._contextMenu.classList.remove("smart-animate"),n.rightToLeft?n._contextMenu.setAttribute("right-to-left",""):n._contextMenu.removeAttribute("right-to-left"),n.contextMenu.dataField?n._contextMenu.column=n.columnByDataField[n.contextMenu.dataField]:n._contextMenu.column=n.columns[0],n._createContextMenuItems(n._contextMenu),n._contextMenu.style.height=n.contextMenu.height?n.contextMenu.height+"px":"auto",n._contextMenu.style.width=n.contextMenu.width?n.contextMenu.width+"px":"auto",n.isInShadowDOM?n.getRootNode().appendChild(n.menu):document.body.appendChild(n._contextMenu),n._contextMenu.style.left=e+"px",n._contextMenu.style.top=t+"px",n._contextMenu.classList.remove("smart-hidden"),n._contextMenu.classList.add("open"),setTimeout((()=>{n._contextMenu&&n._contextMenu.querySelector("smart-menu").focus()}),50)}_openMenu(e){const t=this;if(!e||t.menu&&t.menu.column===e&&e.element.hasAttribute("aria-controls")||!1===t.columnMenu.enabled)return void t.closeMenu();t._closeMenu(t.filterRowMenu),t.$.headerBar&&t.header.visible&&t.$.headerBar.closePanel(),t.menu||(t.menu=document.createElement("div"),t.menu.classList.add("smart-grid-column-menu"),t.menu.setAttribute("theme",t.getAttribute("theme")),t.menu.id=t.id+"_"+t.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),t.appearance.allowColumnMenuAnimation?t.menu.classList.add("smart-animate"):t.menu.classList.remove("smart-animate"),t.rightToLeft?t.menu.setAttribute("right-to-left",""):t.menu.removeAttribute("right-to-left"),t._createMenuItems(e),t._createFilterPanel(e),t._filterMenuItemsVisibility(e),t.menu.style.height=t.columnMenu.height?t.columnMenu.height+"px":"auto",t.menu.column&&t.menu.column!==e&&(t.menu.column.setProperty("menu",null),t.menu.column=null),t.isInShadowDOM?t.getRootNode().appendChild(t.menu):document.body.appendChild(t.menu),e.setProperty("menu",t.menu);const n=e.element.getBoundingClientRect();t.menu.column=e;let l=n.right-e.element.actionButton.getBoundingClientRect().width+window.pageXOffset,i=n.bottom+window.pageYOffset;t.menu.classList.remove("smart-open-right"),t.rightToLeft&&(l=n.left+window.pageXOffset-t.menu.offsetWidth+e.element.actionButton.getBoundingClientRect().width,l<0&&(l=n.left+window.pageXOffset)),l+t.menu.offsetWidth>window.innerWidth&&(l=n.right+window.pageXOffset-t.menu.offsetWidth,l+t.menu.offsetWidth>window.innerWidth&&(l=window.innerWidth-t.menu.offsetWidth),t.menu.classList.add("smart-open-right")),t.menu.style.left=l+"px",t.menu.style.top=i+"px",t.hasColumnMenu(e)?t.menu.classList.remove("smart-hidden"):t.closeMenu(),t.menu.classList.add("open"),setTimeout((()=>{t.menu&&(t.menu.querySelector(".smart-filter-panel-input")?t.menu.querySelector(".smart-filter-panel-input").focus():t.menu.querySelector("smart-menu").focus())}),50)}_menuItemClick(e){const t=this,n=e.detail.value;if(n&&n.properties){const e=n.properties.command;"function"==typeof e?e.apply(t,[n.column,n.properties]):t[e]&&t[e].apply(t,[n.column,n.properties]),n.column&&n.column.autoCloseMenu&&t.closeMenu()}}contextMenuItemDeleteCommand(){const e=this;void 0!==e.contextMenu.id&&e.deleteRow(e.contextMenu.id)}contextMenuItemEditCommand(){const e=this;void 0!==e.contextMenu.id&&e.editing.enabled&&("cell"===e.editing.mode?e.beginEdit(e.contextMenu.id,e.contextMenu.dataField):e.beginEdit(e.contextMenu.id))}removeGroupByCommand(e){this.removeGroup(e.dataField)}groupByCommand(e){const t=this;t.dataSource&&(t.$.headerBar?t.header.visible&&t.header.buttons.indexOf("group")>=0&&t.$.headerBar.openGroupPanel(e):t.addGroup(e.dataField))}sortAscCommand(e){this.sortBy(e.dataField,"asc")}sortDescCommand(e){this.sortBy(e.dataField,"desc")}removeSortCommand(e){this.sortBy(e.dataField,null)}addSortCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openSortPanel(e)}addFilterCommand(e){const t=this;t.$.headerBar&&t.$.headerBar.openFilterPanel(e)}removeFilterCommand(e){this.removeFilter(e.dataField)}customizeTypeCommand(e){this._openAddColumnDialog(e,"rename")}hideColumnCommand(e){e.visible=!1}deleteColumnCommand(e){this.columns.splice(this.columns.indexOf(e),1)}duplicateCommand(e,t,n){const l=this,i=new Smart.Grid.Column(e);let o=e.dataField,a=0;if(void 0===n){let t=!1;for(let n=0;n<l.rows.length;n++)if(l.rows[n].data[e.dataField]){t=!0;break}if(t)return void l._openDescriptionDialog(e,"duplicate")}for(let e=0;e<l.columns.length;e++)l.columns[e].dataField.indexOf(o)>=0&&a++;if(i.displayField=i.dataField=e.dataField+"_"+a,"object"==typeof e.editor){const t={};for(let n in e.editor)"instance"!==n&&"cell"!==n&&"column"!==n&&"row"!==n&&"isInitialized"!==n&&(t[n]=e.editor[n]);i.editor=JSON.parse(JSON.stringify(t))}const r=l.columns.indexOf(e);if(n)for(let t=0;t<l.rows.length;t++){const n=l.rows[t],o=n.data[e.dataField];n.data[i.dataField]=o}i.label=e.label+` ${l.localize("copy")} `+a,l.columns.splice(1+r,0,i),l.onColumnClone&&setTimeout((()=>{l.onColumnClone(e.dataField,i.dataField,1+r,n)}),100)}_removeMenu(){const e=this;if(e.menu){const t=e.menu.querySelector("smart-menu");t&&e.menu.removeChild(t)}if(e.filterRowMenu){const t=e.filterRowMenu.querySelector("smart-menu");t&&e.filterRowMenu.removeChild(t)}if(e._contextMenu){const t=e._contextMenu.querySelector("smart-menu");t&&(e._contextMenu.removeChild(t),e._contextMenu.parentNode.removeChild(e._contextMenu))}}_createColumnChooserMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();if(n.mode="vertical",n.dropDownAppendTo="body",n.checkboxes=!0,n.checkable=!0,n.classList.add("smart-grid-column-chooser-menu"),n.rightToLeft=t.rightToLeft,e&&"_addNewColumn"===e.dataField){if(t._kanbanViewColumns&&t._kanbanViewColumns.length>0)for(let e=0;e<t._kanbanViewColumns.length;e++){const n=t._kanbanViewColumns[e],i=t.columnByDataField[n.dataField];if(i&&i.visible)continue;const o=document.createElement("smart-menu-item"),a=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";o.checked=n.visible,n.allowHide&&(n.command=function(e){t.closeMenu();const n=t.columnByDataField[e.dataField];n.visible=!0,delete n._visible;const l=t._kanbanViewColumns.indexOf(e);l>=0&&t._kanbanViewColumns.splice(l,1)},o.label=t.localize(n.label)||n.label||n.dataField,o.value={column:n,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),l.appendChild(o))}const e=document.createElement("smart-menu-item");e.label='<span class="smart-grid-icon smart-icon-plus"></span>'+t.localize("dialogNewColumn"),e.value={properties:{command:()=>{t.closeMenu(),t._openAddColumnDialog()}}},l.appendChild(e)}else for(let e=0;e<t.columns.length;e++){const n=t.columns[e],i=document.createElement("smart-menu-item"),o=n.showIcon?n.icon:n.visible?"smart-icon-eye":"smart-icon-eye-off";i.checked=n.visible,n.allowHide&&(n.command=function(e){e.visible=!e.visible},i.label=t.localize(n.label)||n.label||n.dataField,i.value={column:n,properties:n},o&&(i.label='<span class="smart-grid-icon '+o+'"></span>'+i.label),l.appendChild(i))}n.appendChild(l),t.menu.appendChild(n),t.menu.itemCheckChange=t._menuItemClick.bind(t),t.menu.addEventListener("itemCheckChange",t.menu.itemCheckChange),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createColumnFilterMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment();n.mode="vertical",n.dropDownAppendTo="body",n.classList.add("smart-grid-column-filter-menu"),n.rightToLeft=t.rightToLeft;const i=e._filterInfo.dataSource;for(let t=0;t<i.length;t++){const n=i[t],o=document.createElement("smart-menu-item"),a=n.icon;o.label=n.label,o.value={column:e,properties:n},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),e._filterInfo.condition===n.value&&o.setAttribute("focus",""),l.appendChild(o)}n.appendChild(l),t.filterRowMenu.appendChild(n),t.filterRowMenu.itemClick=t._menuItemClick.bind(t),t.filterRowMenu.addEventListener("itemClick",t.filterRowMenu.itemClick),t.filterRowMenu.addEventListener("keydown",(e=>{"Escape"===e.key&&t._closeMenu(t.filterRowMenu)}))}_createMenuItems(e){const t=this;t._removeMenu();const n=document.createElement("smart-menu"),l=document.createDocumentFragment(),i=e.menuItems||t.columnMenu.dataSource;n.mode="vertical",n.dropDownAppendTo="body",n.rightToLeft=t.rightToLeft;for(let n in i){const o=i[n],a=document.createElement("smart-menu-item");let r=o.icon;a.label=t.localize(n),a.value={column:e,properties:o};const s=t=>{if(t){if("string"===e.dataType)return"A → Z";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"1 → 9";if("bool"===e.dataType||"boolean"===e.dataType)return"0 → 1"}else{if("string"===e.dataType)return"Z → A";if("number"===e.dataType||"date"===e.dataType||"time"===e.dataType)return"9 → 1";if("bool"===e.dataType||"boolean"===e.dataType)return"1 → 0"}};"columnMenuItemSortAsc"===n?(a.label=t.localize(n,{mode:s(!0)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)):"columnMenuItemSortDesc"===n&&(a.label=t.localize(n,{mode:s(!1)}),"string"!==e.dataType&&o.iconAlt&&(r=o.iconAlt)),r&&(a.label='<span class="smart-grid-icon '+r+'"></span>'+a.label),l.appendChild(a)}n.appendChild(l),t._filterContainer?t.menu.insertBefore(n,t._filterContainer):t.menu.appendChild(n),t.menu.itemClick=t._menuItemClick.bind(t),t.menu.addEventListener("itemClick",t.menu.itemClick),t.menu.addEventListener("keydown",t._keyDownHandler.bind(t))}_createContextMenuItems(){const e=this;e._removeMenu();const t=document.createElement("smart-menu"),n=document.createDocumentFragment(),l=e.contextMenu.dataSource;t.mode="vertical",t.dropDownAppendTo="body",t.rightToLeft=e.rightToLeft;for(let t in l){const i=l[t],o=document.createElement("smart-menu-item");let a=i.icon;!0===i.visible?o.classList.remove("smart-hidden"):!1===i.visible&&o.classList.add("smart-hidden"),"contextMenuItemEdit"===t?(e.editing.enabled||(o.disabled=!0),"{{messages}}"===i.label?"cell"===e.editing.mode?o.label=e.localize("contextMenuItemEditCell"):o.label=e.localize("contextMenuItemEditRow"):o.label=i.label):"{{messages}}"===i.label?o.label=e.localize(t):o.label=i.label,o.value={properties:i},a&&(o.label='<span class="smart-grid-icon '+a+'"></span>'+o.label),n.appendChild(o)}t.appendChild(n),e._contextMenu.appendChild(t),e._contextMenu.itemClick=t=>{t.detail.value.column=t.detail.item.column=e._contextMenu.column,e._menuItemClick(t),e._closeMenu(e._contextMenu),e.$.fireEvent("contextMenuItemClick",{id:e._contextMenu.id,dataField:e._contextMenu.column.dataField,command:t.detail.value.properties.command})},e._contextMenu.style.minHeight="30px",e._contextMenu.addEventListener("itemClick",e._contextMenu.itemClick),e._contextMenu.addEventListener("keydown",e._keyDownHandler.bind(e))}_getFilterType(e){let t="string";switch(e.dataType.endsWith("?")?e.dataType.substring(0,e.dataType.length-1):e.dataType){case"number":case"int":case"float":case"int64":t="numeric";break;case"bool":case"boolean":t="bool";break;case"date":case"time":case"datetime":t="date";break;case"any":t="string"}return t}_createFilterPanel(e){const t=this;if(Smart.FilterPanel)if(t.filtering.enabled&&t.filtering.filterMenu.visible&&e.allowFilter&&!t.filtering.filterRow.visible&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))){const n=t._getFilterType(e);t._filterPanel&&t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),t._filterPanel=t._filterPanels[n],t._filterPanel.dataField=e.dataField,t._filterPanel.rightToLeft=t.rightToLeft,t.filtering.filterMenu.messages?t._filterPanel.messages=t.filtering.filterMenu.messages:t._filterPanel.messages=t.messages,"excel"===e.filterMenuMode&&(t._filterPanel.dataField=e.dataField,t.dataSource&&t.dataSource.boundSource&&(t._filterPanel.data=t.dataSource.boundSource.toArray?t.dataSource.boundSource.toArray():t.dataSource.boundSource)),t._filterPanel.mode=e.filterMenuMode,t._filterPanel.locale=t.locale;const l=t._filterPanel.querySelectorAll(".smart-filter-panel-input");for(let e=0;e<l.length;e++)l[e].onkeydown=e=>{"Enter"===e.key&&t._filterPanel.filter()};if(!t._filterContainer){const e=document.createElement("div");e.classList.add("smart-filter-container"),t._filterContainer=e,requestAnimationFrame((function(){t.menu.appendChild(e)})),t._applyFilterHandler=function(){t.addFilter(t._filterPanel.dataField,t._filterPanel.getFilter()),t.columnByDataField[t._filterPanel.dataField]._filterState=t._filterPanel.getState()},t._clearFilterHandler=function(){requestAnimationFrame((()=>{t.removeFilter(t._filterPanel.dataField),t.columnByDataField[t._filterPanel.dataField]._filterState=null}))}}t._filterContainer.appendChild(t._filterPanel),t._filterPanel.classList.remove("smart-hidden"),t._filterPanel.removeEventListener("filter",t._applyFilterHandler),t._filterPanel.removeEventListener("clear",t._clearFilterHandler),t._filterPanel.addEventListener("filter",t._applyFilterHandler),t._filterPanel.addEventListener("clear",t._clearFilterHandler);const i=t._filterContainer.querySelector(".smart-grid-custom-filter-panel");if(i&&t._filterContainer.removeChild(i),"none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"),e.getFilterPanel)if(e._customFilterPanel)e.updateFilterPanel(e._customFilterPanel,e),t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(e._customFilterPanel);else{const n=e.getFilterPanel(e);n&&(n.classList.add("smart-grid-custom-filter-panel"),e._customFilterPanel=n,t._filterContainer.removeChild(t._filterPanel),t._filterContainer.appendChild(n))}if(t._filterPanel.reset(),e._filterState)t._filterPanel.loadState(e._filterState);else if(e.filter){const n=e.filter,l=t._getFilterType(e);let i=n.getFilters();for(;i.length>0&&"FilterGroup"===i[0].type;)i=i[0].value;const o=n.getConditions(l),a=i.length>0?o.indexOf(i[0].condition):-1,r=i.length>1?o.indexOf(i[1].condition):-1,s=i.length>0?i[0].value:"",d=i.length>1?i[1].value:"",u=i.length>1?["and","or"].indexOf(i[1].logicalOperator):0;"excel"===e.filterMenuMode?(e._filterState={filters:i},t._filterPanel.loadState(e._filterState)):(e._filterState={firstFilterComparison:a,firstFilterValue:s,logicalOperator:u,secondFilterComparison:r,secondFilterValue:d},t._filterPanel.loadState(e._filterState))}}else t._filterPanel&&(t._filterPanel.parentNode&&t._filterPanel.parentNode.removeChild(t._filterPanel),e._filterState=null)}hasColumnMenu(e){const t=this;if(!1===t.columnMenu.enabled)return!1;const n=e.menuItems||t.columnMenu.dataSource;let l=0,i=0;for(let o in n){const a=n[o];i++,!1===a.visible?l++:"auto"===a.visible&&("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&(!t.header.visible||t.header.visible&&-1===t.header.buttons.indexOf("filter"))&&l++,"columnMenuItemGroupBy"!==o&&"columnMenuItemRemoveGroupBy"!==o||e.allowGroup&&t.grouping.enabled||l++,"columnMenuItemSort"!==o||e.allowSort&&t.sorting.enabled||l++,"columnMenuItemFilter"!==o||e.allowFilter&&t.filtering.enabled||l++,"columnMenuItemRemoveFilter"!==o||e.allowFilter&&t.filtering.enabled||l++,"columnMenuItemGroupBy"!==o||e.allowGroup||l++,"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||e.allowSort&&t.sorting.enabled||l++)}return!!(t.filtering.enabled&&t.filtering.filterMenu.visible&&"none"!==e.filterMenuMode&&Smart.FilterPanel||Smart.Menu&&!(l>=i))}_filterMenuItemsVisibility(e){const t=this,n=(t.menu.parentElement&&(t.enableShadowDOM||t.isInShadowDOM)?t.menu.firstElementChild.shadowRoot:t.menu).querySelectorAll("smart-menu-item"),l=e.menuItems||t.columnMenu.dataSource;let i=0;for(let o in l){const a=n[i++],r=l[o];if(a.disabled=!r.enabled,a.classList.remove("smart-hidden"),"columnMenuItemDelete"!==o||e.allowDelete)if("columnMenuItemHide"!==o||e.allowHide){if("columnMenuItemRemoveSort"===o&&(e.sortOrder?a.disabled=!1:a.disabled=!0),("columnMenuItemSortAsc"===o&&"asc"===e.sortOrder||"columnMenuItemSortDesc"===o&&"desc"===e.sortOrder)&&(a.disabled=!0),!0===r.visible)a.classList.remove("smart-hidden");else if(!1===r.visible)a.classList.add("smart-hidden");else if("auto"===r.visible){if("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(!1===t.filtering.enabled?a.classList.add("smart-hidden"):((t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("filter")>=0&&a.classList.remove("smart-hidden"),e.filtered||"columnMenuItemRemoveFilter"!==o||a.classList.add("smart-hidden"))),"columnMenuItemSort"===o&&(!1===t.sorting.enabled?a.classList.add("smart-hidden"):t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.remove("smart-hidden")),"columnMenuItemGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n>=0}if("columnMenuItemRemoveGroupBy"===o){t.grouping.enabled&&e.allowGroup?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("group")>=0&&a.classList.add("smart-hidden");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n<0}"columnMenuItemFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSort"!==o||e.allowSort||a.classList.add("smart-hidden"),"columnMenuItemRemoveFilter"!==o||e.allowFilter||a.classList.add("smart-hidden"),"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemSort"!==o&&"columnMenuItemRemoveSort"!==o||(e.allowSort&&t.sorting.enabled?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("sort")>=0&&a.classList.add("smart-hidden"))}}else a.classList.add("smart-hidden");else a.classList.add("smart-hidden")}}openMenu(e){const t=this.columnByDataField[e];t&&this._openMenu(t)}hasMenu(){const e=this;return!!(e.menu&&e.menu.column&&e.menu.parentNode)}_closeMenu(e){const t=this;(e=>{e&&e.column&&(e.column&&(e.column.setProperty("menu",null),e.column=null),e.parentNode&&(e.classList.remove("open"),t.appearance.allowColumnMenuAnimation||e.parentNode.removeChild(e)),e.removeEventListener("keydown",t._keyDownHandler.bind(t)),e.removeEventListener("itemClick",e.itemClick),e.removeEventListener("itemCheckChange",e.itemCheckChange),t.focus())})(e)}closeMenu(){const e=this,t=e.menu;if(e._closeMenu(t),e._closeMenu(e.filterRowMenu),e._closeMenu(e._contextMenu),e._filterPanel){const t=e._filterPanel.querySelectorAll("smart-drop-down-list");for(let e=0;e<t.length;e++){const n=t[e];n.opened&&n.close()}}}});
|
|
54
54
|
Smart.Utilities.Assign("Grid.Pager",class{_refreshPaging(e){const a=this;requestAnimationFrame((()=>{if(a.filtering.filterRow)for(let e=0;e<a.columns.length;e++)a.columns[e]._filterEditorInitialized=!1;a._refreshLayout(),a._refreshSelection(),e||(a._initializeRowElements(),a._refreshLayout()),a.dataSource&&a.dataSource.virtualDataSource?a._virtualDataRequest(e?"pageIndexChange":"pageSizeChange"):(a._recycle(),a._scrollUpdate&&clearTimeout(a._scrollUpdate),a._scrollUpdate=setTimeout((function(){a.isScrolling||(a.$.rowContainer.style.top=parseInt(a.$.rowContainer.style.top)+.01+"px")}),50));const t=a.paging.pageIndex*a._pageSize,r=t+a._pageSize;a.$.fireEvent("page",{data:{first:t,last:r,size:r-t}})}))}firstPage(){const e=this;e.paging.enabled&&(e.paging.pageIndex>0&&(e.paging.pageIndex=0),e._refreshPaging(!0))}lastPage(){const e=this;if(!e.paging.enabled)return;const a=e.$.headerPager.querySelector("smart-pager");e.paging.pageIndex<a.pagesCount-1&&(e.paging.pageIndex=a.pagesCount-1),e._refreshPaging(!0)}prevPage(){const e=this;e.paging.enabled&&(e.paging.pageIndex>0&&e.paging.pageIndex--,e._refreshPaging(!0))}nextPage(){const e=this,a=e.$.headerPager.querySelector("smart-pager");e.paging.enabled&&(e.paging.pageIndex<a.pagesCount-1&&e.paging.pageIndex++,e._refreshPaging(!0))}goToPage(e){const a=this,t=a.$.headerPager.querySelector("smart-pager");!a.paging.enabled||e<0||e>t.pagesCount-1||(a.paging.pageIndex=e,a._refreshPaging(!0))}_refreshPagesCount(){const e=this;if(!e.paging.enabled)return;const a=e.$.headerPager.querySelector("smart-pager"),t=function(){const a=e.getVisibleRows();let t=a.length;if(void 0!==e.dataSource.virtualDataSourceLength&&(t=e.dataSource.virtualDataSourceLength),e.rowHierarchy){t=0;for(let e=0;e<a.length;e++){const r=a[e];0!==r.level||r.parent||t++}if(void 0!==e.dataSource.virtualDataSourceLength)t=e.dataSource.virtualDataSourceLength;else{e._refreshRowHierarchy(!1,!0),t=0;const a=t=>{let r=[];if(0===e.dataSource.groupBy.length)return t;for(let e=0;e<t.length;e++){const i=t[e];(!i.$||void 0===i.$.filtered||i.$.filtered)&&(r.push(i),i.children&&(r=r.concat(a(i.children))))}return r};if(e.rowHierarchy)for(let r=0;r<e.rowHierarchy.length;r++){const i=e.rowHierarchy[r];if(0===i.level&&!i.parent){if(0===a(i.children).length)continue;t++}}else e._visibleRows=null,e.__viewRows=null,t=e.getVisibleRows().length;e._refreshRowHierarchy(),e._recycle(!1)}}return{pagesCount:Math.ceil(t/e._pageSize),totalRecords:t}}();a&&(a.pagesCount=t.pagesCount,a.totalRecords=t.totalRecords);const r=e.$.footerPager.querySelector("smart-pager");a&&(r.pagesCount=t.pagesCount,r.totalRecords=t.totalRecords,a.$.pageSizeSelector.disabled=t.totalRecords<e.pager.pageSizeSelector.dataSource[0],r.$.pageSizeSelector.disabled=t.totalRecords<e.pager.pageSizeSelector.dataSource[0]),e.paging.pageIndex>=t.pagesCount&&t.pagesCount>0&&(e.paging.pageIndex=t.pagesCount-1,e._refreshPaging(e.paging.pageIndex))}_renderPagers(){const e=this;e.pager.visible&&requestAnimationFrame((()=>{const a=document.createElement("smart-pager"),t=document.createElement("smart-pager");e.$.headerPager.innerHTML="",e.$.footerPager.innerHTML="",e.$.headerPager.appendChild(a),e.$.footerPager.appendChild(t);const r=function(a){a.messages[e.locale]||(a.messages[e.locale]={}),Object.assign(a.messages[e.locale],{firstButton:e.localize("pagerFirstButton"),lastButton:e.localize("pagerLastButton"),previousButton:e.localize("pagerPreviousButton"),nextButton:e.localize("pagerNextButton"),navigateToLabel:e.localize("pagerNavigateToLabel"),pageSizeLabel:e.localize("pagerPageSizeLabel"),navigateToInputPlaceholder:e.localize("pagerNavigateToInputPlaceholder"),ellipsis:e.localize("pagerEllipsis"),summaryString:e.localize("pagerSummaryString"),summaryPrefix:e.localize("pagerSummaryPrefix"),summarySuffix:e.localize("pagerSummarySuffix")}),a.locale=e.locale},i=function(){const a=e.getVisibleRows();let t=a.length;if(void 0!==e.dataSource.virtualDataSourceLength&&(t=e.dataSource.virtualDataSourceLength),e.rowHierarchy){t=0;for(let e=0;e<a.length;e++){const r=a[e];0!==r.level||r.parent||t++}if(void 0!==e.dataSource.virtualDataSourceLength)t=e.dataSource.virtualDataSourceLength;else{e._refreshRowHierarchy(!1,!0),t=0;const a=t=>{let r=[];if(0===e.dataSource.groupBy.length)return t;for(let e=0;e<t.length;e++){const i=t[e];(!i.$||void 0===i.$.filtered||i.$.filtered)&&(r.push(i),i.children&&(r=r.concat(a(i.children))))}return r};for(let r=0;r<e.rowHierarchy.length;r++){const i=e.rowHierarchy[r];if(0===i.level&&!i.parent){if(0===a(i.children).length)continue;t++}}e._refreshRowHierarchy(),e._recycle(!1)}}return{pagesCount:Math.ceil(t/e._pageSize),totalRecords:t}},n=function(r,n){const o=n+"GridPager",g=i();r.setAttribute("smart-id",o),e.$[o]=r,e["$"+o]=Smart.Utilities.Extend(r),r.beginUpdate(),e.addPropertyBinding("[[pager_navigationButtons_position]]","navigationButtonsPosition",r),e.addPropertyBinding("[[pager_navigationButtons_firstLastButtons_visible]]","showFirstLastNavigationButtons",r),e.addPropertyBinding("[[pager_navigationButtons_prevNextButtons_visible]]","showPrevNextNavigationButtons",r),e.addPropertyBinding("[[pager_navigationButtons_labels_visible]]","showNavigationButtonLabels",r),e.addPropertyBinding("[[pager_pageIndexSelectors_visible]]","showPageIndexSelectors",r),e.addPropertyBinding("[[pager_pageIndexSelectors_dataSource]]","pageIndexSelectors",r),e.addPropertyBinding("[[pager_summary_visible]]","showSummary",r),e.addPropertyBinding("[[pager_summary_position]]","summaryPosition",r),e.addPropertyBinding("[[pager_navigationInput_visible]]","showNavigationInput",r),e.addPropertyBinding("[[pager_navigationInput_position]]","navigationInputPosition",r),e.addPropertyBinding("[[pager_pageSizeSelector_visible]]","showPageSizeSelector",r),e.addPropertyBinding("[[pager_pageSizeSelector_dataSource]]","pageSizeSelectorDataSource",r),e.addPropertyBinding("[[pager_pageSizeSelector_position]]","pageSizeSelectorPosition",r),e.addPropertyBinding("[[pager_autoEllipsis]]","autoEllipsis",r),e.addPropertyBinding("[[!paging_enabled]]","disabled",r),e.addPropertyBinding("{{paging_pageIndex}}","pageIndex",r),e.addPropertyBinding("{{paging_pageSize}}","pageSize",r),e.addPropertyBinding("{{rightToLeft}}","rightToLeft",r),r.pagesCount=g.pagesCount,r.totalRecords=g.totalRecords,r.$&&r.$.pageSizeSelector&&(r.$.pageSizeSelector.dropDownAppendTo="body",r.$.pageSizeSelector.selectedIndexes=[0],r.totalRecords<e.pager.pageSizeSelector.dataSource[0]&&(r.$.pageSizeSelector.disabled=!0)),e["$"+o].listen("change",(function(n){const o=i();r.pagesCount=o.pagesCount,r.totalRecords=o.totalRecords,e.paging.pageIndex>r.pagesCount&&(e.paging.pageIndex=r.pagesCount-1),a.refresh(),t.refresh();const g=n.detail&&void 0!==n.detail.index||void 0!==n.target.value;e._refreshPaging(g)})),r.endUpdate()};n(a,"header"),n(t,"footer"),r(a),r(t)}))}});
|
|
55
55
|
Smart.Utilities.Assign("Grid.Filter",class{addFilter(e,t,l){const i=this,a=i.columnByDataField[e];if("string"==typeof t?t=i.dataSource._createFilter(a.dataType,[t]):t&&Array.isArray(t)&&(t=i.dataSource._createFilter(a.dataType,t)),a&&a.canNotify){if(a.setProperty("filter",t),i._isUpdating)return;!1!==l&&i.refreshFilters()}}removeFilter(e,t){const l=this,i=l.columnByDataField[e];if(i&&i.canNotify){if(i.setProperty("filter",null),l._isUpdating)return;!1!==t&&l.refreshFilters()}i&&delete i._filterState}findCells(e){const t=this,l=t.find(e,null,null,"or"),i=[];"string"==typeof e&&e.indexOf(",")>=0&&(e=e.split(","));for(let a=0;a<l.length;a++){const n=l[a];for(let l=0;l<t.columns.length;l++){const a=t.columns[l],r=n[a.dataField];if(Array.isArray(e))for(let t=0;t<e.length;t++)(""+r).trim().toLowerCase()===(""+e[t]).trim().toLowerCase()&&i.push([n.$.id,a.dataField,e[t]]);else(""+r).trim().toLowerCase()===(""+e).trim().toLowerCase()&&i.push([n.$.id,a.dataField,e])}}return i}find(e,t,l,i="and"){const a=this;let n=[];if(l){const e={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};e[l]&&(l=e[l])}const r=(e,i="or")=>{let n=[];for(let r=0;r<a.columns.length;r++){const o=a.columns[r],s=new Smart.Utilities.FilterGroup;let d;t&&o.dataField!==t||("string"===o.dataType?(l||(l="CONTAINS"),d=s.createFilter("string",e,l)):"number"===o.dataType?(l||(l="EQUAL"),d=s.createFilter("number",e,l)):"date"===o.dataType&&(l||(l="EQUAL"),d=s.createFilter("date",e,l)),s.addFilter(i,d),n.push([o.dataField,s]))}return n};void 0!==e&&"string"==typeof e&&e.indexOf(",")>=0&&(e=e.split(","));let o=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)o.push(r(e[t].trim()));else n=r(e);const s=a.dataSource;if(!s)return[];let d=[];const u=(e,t)=>{let l=!1;for(let i=0;i<t.length;i++){const a=t[i],n=e[a[0]];l=l||a[1].evaluate(n)}return l};for(let e=0;e<s.length;e++){const t=s[e];if(o.length)if("and"===i){let e=!0;for(let l=0;l<o.length;l++)e=e&&u(t,o[l]);e&&d.push(t)}else{let e=!1;for(let l=0;l<o.length;l++)e=e||u(t,o[l]);e&&d.push(t)}else u(t,n)&&d.push(t)}return d}clearFilter(){const e=this;for(let t=0;t<e.columns.length;t++)e.columns[t].setProperty("filter",null);e.refreshFilters()}getFilteredColumns(){const e=this;if(e._filters){const t=[];for(let l=0;l<e._filters.length;l++){const i=e._filters[l];t[i[0]]=i[1],t.length++}return t}return[]}getVisibleRows(){const e=this;if(e._visibleRows)return e._visibleRows;const t=[],l=e._viewRows,i=e.editing.addNewRow.visible&&"far"!==e.editing.addNewRow.position&&"button"!==e.editing.addNewRow.displayMode?1:0,a=e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0;let n=0;for(let e=0;e<l.length;e++){const r=l[e];r.canNotify=!1,r.visibleIndex=-1,!r.visible||!1===r.filtered&&void 0!==r.filtered||(a?r.leaf?r.visibleIndex=n++:r.visibleIndex=-1:r.visibleIndex=t.length-i,t.push(r)),r.canNotify=!0}return e._visibleRows=t,t}_refreshFilterRowEditors(){const e=this;if(e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1)}refreshSortAndFilters(){this._refreshDataFilters()}_refreshDataFilters(){const e=this;!1!==e.editing.autoUpdateFilterAndSort&&(e._supressFilter||(!e._filters||e._filters&&0===e._filters.length)&&(!e._sortedColumns||e._sortedColumns&&0===e._sortedColumns.length)||(e.beginUpdate(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort(),e._filters&&e._filters.length>0&&e.refreshFilters(!0),e.endUpdate()))}refreshFilters(e){const t=this,l=[];t._filters||(t._filters=[]);for(let e=0;e<t.columns.length;e++){const i=t.columns[e];i.filter&&l.push([i.dataField,i.filter])}if(t.scrollTop=0,t.closeMenu(),t.dataSource&&!t.dataSource.onFilter&&(t.dataSource.onFilter=function(){const e=t._viewRows;for(let t=0;t<e.length;t++){const l=e[t];if(l.data&&!l.addNewRow){if(!l.data.$){l.filtered=!0;continue}l.filtered=void 0===l.data.$.filtered||l.data.$.filtered}}t.refresh()}),JSON.stringify(t._filters)===JSON.stringify(l)&&!0!==e)return void(t._visibleRows=null);if(t._filters=l,t._visibleRows=null,t.dataSource&&t.dataSource.virtualDataSource)t.closeMenu(),t._virtualDataRequest("filter");else{const e=t._filterOperator||t.filtering.operator;t.dataSource._filter(l,e)}t.paging.enabled&&t.dataSource&&!t.dataSource.virtualDataSource&&t._refreshPagesCount();let i=[];for(let e=0;e<t.columns.length;e++){const l=t.columns[e];l.filter&&i.push(l)}let a=[],n=[],r=[];if(t._filters)for(let e=0;e<t._filters.length;e++){const l=t._filters[e];r.push(l[0]);let i="";const o=t.columnByDataField[l[0]];for(let e=0;e<l[1].filters.length;e++){const t=l[1].filters[e].condition,a=l[1].filters[e].value,n=l[1].logicalOperators[e],r=1===n||"or"===n?"or":"and";"string"===o.dataType?i+=`"${t}" "${a}"`:i+=`"${t}" ${a}`,e<l[1].filters.length-1&&(i+=` ${r} `)}n.push([l[0],i]),a.push({dataField:l[0],filter:l[1]})}t.summaryRow.visible&&(t._calculateSummary(),t._recycle(!1)),e||t.$.fireEvent("filter",{columns:i,expressions:JSON.parse(JSON.stringify(n)),dataFields:r,data:JSON.parse(JSON.stringify(a))}),t._onFilter&&t._onFilter()}_handleFilterCellFocus(e){const t=this,l=e.column._filterInfo,i=l.editor,a=l.input,n=e.column,r=n.dataType;i.setAttribute("focus",""),t.filtering.filterRow.cell=e,"RANGE"===l.condition?t._openFilterCellDialog(e,(e=>{const l=e._filterInfo,i=l.editor,a=l.range,n=l.input,r=l.cell;if(a){const l=new Smart.FilterGroup;l.addFilter("and",l.createFilter(e.dataType,a.min,"GREATER_THAN_OR_EQUAL")),l.addFilter("and",l.createFilter(e.dataType,a.max,"LESS_THAN_OR_EQUAL")),t.addFilter(e.dataField,l)}else t.removeFilter(e.dataField);if(i&&n)if(n.type="",a){const t=r.getFormattedValue(a.min,e.cellsFormat),l=r.getFormattedValue(a.max,e.cellsFormat);n.value=t+" - "+l}else n.value=""})):(a.type="number"===r||"int"===r||"float"===r?"number":"",l.value&&(a.value=l.value,"date"===r&&(a.value=e.getFormattedValue(l.value,n.cellsFormat))))}_handleFilterCellBlur(e){const t=this,l=e.column._filterInfo,i=l.editor,a=l.input,n=e.column,r=l.condition;t.filtering.filterRow.cell=null,n.filterRowMenu&&n.filterRowMenu.classList.contains("open")||(""!==a.value&&"RANGE"!==r&&("date"===n.dataType?(l.value=new Date(a.value),a.value=e.getFormattedValue(l.value,n.cellsFormat)):"number"===n.dataType||"int"===n.dataType||"float"===n.dataType?(l.value=parseFloat(a.value),a.type="",a.value=e.getFormattedValue(l.value,n.cellsFormat)):l.value=a.value),"auto"===t.filtering.filterRow.applyMode&&t._handleFilterCellValue(e)),i.removeAttribute("focus")}_handleFilterCellValue(e){const t=this,l=e.column._filterInfo,i=e.column;if("RANGE"===l.condition){const e=l.range;if(e){const l=new Smart.FilterGroup;l.addFilter("and",l.createFilter(i.dataType,e.min,"GREATER_THAN_OR_EQUAL")),l.addFilter("and",l.createFilter(i.dataType,e.max,"LESS_THAN_OR_EQUAL")),t.addFilter(i.dataField,l)}else t.removeFilter(i.dataField)}else{const e=l.value;if(""!==e&&void 0!==e){const a=new Smart.FilterGroup;a.addFilter("and",a.createFilter(i.dataType,e,l.condition||("string"===i.dataType?"CONTAINS":"EQUAL"))),t.addFilter(i.dataField,a)}else t.removeFilter(i.dataField)}}_handleFilterCellKeyDown(e,t){const l=this,i=e.column._filterInfo.input;t.ctrlKey&&"a"===t.key?i.select():t.altKey&&"ArrowDown"===t.key&&l._handleFilterCellIconClick(e)}_handleFilterCellKeyUp(e,t){const l=e.column,i=l._filterInfo.input,a=this,n=l._filterInfo,r=t.key;n.value=i.value,"Escape"===r&&(n.value="",n.range=null,i.value=""),"Enter"===r||"Escape"===r||""===i.value?a._handleFilterCellValue(e):"auto"===a.filtering.filterRow.applyMode&&"Ctrl"!==r&&"Shift"!==r&&(a._filterRowTimer&&clearTimeout(a._filterRowTimer),a._filterRowTimer=setTimeout((()=>{a._handleFilterCellValue(e)}),a.filtering.filterRow.autoApplyModeDelay)),t.ctrlKey&&"a"===r&&i.select()}_handleFilterCellCheckBoxClick(e){const t=this,l=e.column,i=l._filterInfo;void 0===i.value&&(i.value=null),!0===i.value?i.value=!1:!1===i.value?i.value=null:null===i.value&&(i.value=!0);const a=e.element.querySelector(".smart-input");if(i.value?a.setAttribute("checked",i.value):null===i.value?a.setAttribute("checked","indeterminate"):a.removeAttribute("checked"),null===i.value)return void t.removeFilter(l.dataField);const n=new Smart.FilterGroup;n.addFilter("and",n.createFilter(l.dataType,!0===i.value,"EQUAL")),t.addFilter(l.dataField,n)}_handleFilterCellIconClick(e){const t=this,l=e.column;l.filterRowMenu&&l.filterRowMenu.classList.contains("open")?t._closeMenu(l.filterRowMenu):t._openColumnFilterMenu(l)}_handleFilterCalendarCellClick(e){const t=this;t._openFilterCellDialog(e,(l=>{const i=l._filterInfo,a=i.editor.querySelector("input"),n=i.value;if(a)if(n){a.value=e.getFormattedValue(n,l.cellsFormat||"");const r=new Smart.FilterGroup;r.addFilter("and",r.createFilter(l.dataType,n,i.condition||"EQUAL")),t.addFilter(l.dataField,r)}else a.value="",t.removeFilter(l.dataField)}))}_handleFilterMenuClick(e,t){const l=this,i=e._filterInfo,a=i.editor,n=i.input;if(a.firstElementChild.innerHTML=`<i class="smart-grid-icon ${t.icon} show"></i>`,"CLEAR_FILTER"===t.value&&(n.value="",a.firstElementChild.innerHTML='<i class="smart-grid-icon smart-icon-search show"></i>',i.condition=null,i.value="",i.range=null),n.type="","RANGE"===i.condition&&"RANGE"!==t.value){let e=i.range;i.value=e.min}else if("RANGE"===t.value&&"RANGE"!==i.condition&&null!==i.condition){let e=i.range;i.value&&(e={min:i.value,max:i.value},i.range=e)}if("RANGE"!==t.value){if(n.readonly=!1,"CLEAR_FILTER"!==t.value&&(i.condition=t.value),""===n.value)l.removeFilter(e.dataField);else{const t=new Smart.FilterGroup,a=i.value;t.addFilter("and",t.createFilter(e.dataType,a,i.condition||"EQUAL")),l.addFilter(e.dataField,t),n.value=i.cell.getFormattedValue(a,e.cellsFormat)}setTimeout((()=>{n.focus()}),25)}else{n.readonly=!0;const a=new Smart.FilterGroup,r=i.range;if(r){a.addFilter("and",a.createFilter(e.dataType,r.min,"GREATER_THAN_OR_EQUAL")),a.addFilter("and",a.createFilter(e.dataType,r.max,"LESS_THAN_OR_EQUAL")),l.addFilter(e.dataField,a);const t=i.cell.getFormattedValue(r.min,e.cellsFormat),o=i.cell.getFormattedValue(r.max,e.cellsFormat);n.value=t+" - "+o}else n.value="";i.condition=t.value}}_handleFilterNumberCellEditor(e,t,l){const i=t.querySelector("input"),a=t.querySelector(".up"),n=t.querySelector(".down"),r=e.column,o=this;let s=t=>{const l=r._filterInfo;if("RANGE"===l.condition)return void i.focus();let a=parseFloat(l.value);if(isNaN(a))return l.value=0,void(i.value=0);(t<0?a>i.min||""===i.min:a<i.max||""===i.max)&&(i.value=a+t,l.value=i.value,i.focus(),o._handleFilterCellValue(e))};l&&(s=l);const d=(e,t)=>{let l,i;e.onpointerdown=function(e){s(t),l&&clearTimeout(l),l=setTimeout((()=>{i&&clearInterval(i),i=setInterval((()=>{s(t)}),50)}),300),e.preventDefault(),e.stopPropagation()},e.onpointerup=()=>{i&&clearInterval(i),l&&clearTimeout(l),i=null},e.onpointerenter=()=>{i&&(clearInterval(i),i=setInterval((()=>{s(1)}),50))},e.onpointerleave=()=>{clearInterval(i)},document.addEventListener("pointerup",(()=>{i&&clearInterval(i),i=null,l&&clearTimeout(l)}))};d(a,1),d(n,-1)}_openFilterCellDialog(e,t){const l=this,i=l._dialogFilter||l._createDialog(),a=l.localize("dialogFilterHeader")+" "+e.column.label,n=i.content;i.header.innerHTML=a,i.confirm=t;let r=null,o=0;l._cellEditors||(l._cellEditors=[]),l._dialogFilter||(i.modal=!0,i.btnConfirm.innerHTML=l.localize("dialogFilterButtonConfirm"),i.btnCancel.innerHTML=l.localize("dialogFilterButtonCancel"),i.onOpen=function(){i.focus();const e=l._dialogFilterCell,t=e.column._filterInfo.range,a=e.column._filterInfo.value;if("date"===e.column.dataType){const i=n.querySelector("smart-calendar");i.locale=l.locale,setTimeout((()=>{"RANGE"===e.column._filterInfo.condition&&t?(i.selectedDates=[new Date(t.min.getTime()),new Date(t.max.getTime())],i._selectMultipleDates(new Date(t.min.getTime()),new Date(t.max.getTime()))):a&&(i.selectedDates=[new Date(a.getTime())]),i.focus()}),100),i.focus()}else{const e=n.querySelectorAll("input");e[0].focus(),t&&(e[0].value=t.min,e[1].value=t.max)}},i.onClose=function(){},i.btnCancel.onclick=function(){i.close();const e=l._dialogFilterCell;e.column._filterInfo.range=null,e.column._filterInfo.value=null,i.confirm(e.column)},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){const e=l._dialogFilterCell;if(e.column._filterInfo.range=null,e.column._filterInfo.value=null,"date"===e.column.dataType){const t=n.querySelector("smart-calendar"),l=t.selectedDates;"range"===t.selectionMode?e.column._filterInfo.range={min:new Date(l[0].getTime()),max:new Date(l[l.length-1].getTime())}:e.column._filterInfo.value=new Date(l[0].getTime())}else{const t=n.querySelectorAll("input");let l=t[0].value,i=t[1].value;""===i&&(i=100),""===l&&(l=0),e.column._filterInfo.range={min:l,max:i}}i.confirm(e.column),i.close()},i.onkeydown=function(e){const t=e.key;"Enter"===t?i.btnConfirm.onclick():"Escape"===t&&i.close()}),n.classList.remove("smart-grid-layout"),n.innerHTML="";const s=()=>{const e=n.querySelectorAll("input");i.btnConfirm.disabled=!0,""===e[0].value&&(e[0].value=0),""===e[1].value&&(e[1].value=100),parseFloat(e[0].value)<=parseFloat(e[1].value)&&(i.btnConfirm.disabled=!1)};"date"!==e.column.dataType&&n.classList.add("smart-grid-layout");for(let t=0;t<2;t++){const i=e.column;if("date"===i.dataType){const e=document.createElement("div");"RANGE"===i._filterInfo.condition?e.innerHTML='<smart-calendar selection-mode="range"></smart-calendar>':e.innerHTML="<smart-calendar></smart-calendar>",n.appendChild(e);break}o%2==0&&(r=document.createElement("div"),r.classList.add("row"),n.appendChild(r));const a=document.createElement("div");a.classList.add("col-sm-6");const d=document.createElement("div");d.classList.add("column");const u=document.createElement("label");u.innerHTML=0===t?l.localize("dialogFilterMinLabel"):l.localize("dialogFilterMaxLabel");const c=document.createElement("div");c.classList.add("smart-grid-dialog-editor"),c.setAttribute("editor",i.dataField),c.setAttribute("template",i.editor.template),a.appendChild(d),r.appendChild(a),d.appendChild(u),d.appendChild(c),o++,c.innerHTML='<div class="smart-grid-cell-editor smart-filter-input-value smart-grid-number-input-cell-editor"><input class="smart-input" type="number"><div class="nav"><div tabindex="-1" class="up"></div><div tabindex="-1" class="down"></div></div></div>';const f=c.querySelector("input");f.onchange=()=>{s()},l._handleFilterNumberCellEditor(e,c,(e=>{let t=parseFloat(f.value);isNaN(t)?f.value=0:((e<0?t>f.min||""===f.min:t<f.max||""===f.max)&&(f.value=t+e),s())}))}l._dialogFilter=i,l._dialogFilterCell=e;const d=e.column.element.getBoundingClientRect(),u=l.offset(l);let c=d.left+window.pageXOffset-u.left,f=d.bottom+l.layout.rowMinHeight+window.pageYOffset-u.top,m=Math.max(i.offsetWidth,314);c+m>u.left+l.offsetWidth&&(c=d.left+d.width+window.pageXOffset-u.left-m),e.column.filterRowMenu&&e.column.filterRowMenu.classList.contains("open")&&l._closeMenu(e.column.filterRowMenu),i.open(c,f)}});
|
|
56
56
|
Smart.Utilities.Assign("Grid.Sort",class{clearSort(){const t=this;if(!t._isSorting&&t.dataSource){t._isSorting=!0,t.dataSource.clearSort(),t._sortedColumns||(t._sortedColumns=[]);for(let r=0;r<t._sortedColumns.length;r++){const o=t._sortedColumns[r],e=t.columnByDataField[o.dataField];e&&(e.setProperty("sortOrder",null),e.setProperty("sortIndex",null))}t._sortedColumns=[],t.rowById=[];for(let r=0;r<t.dataSource.length;r++){const o=t.rows[r],e=t.dataSource[r];o&&(o.data=e,e&&e.$&&(o.id=e.$.id,o._updateData()),t.rowById[o.id]=o)}t._recycle(),t._refreshHeaderBar(),t._isSorting=!1}}getSortedColumns(){const t=this,r=[];if(t._sortedColumns)for(let o=0;o<t._sortedColumns.length;o++){const e=t._sortedColumns[o];r[e.dataField]={sortOrder:e.sortOrder,sortIndex:e.sortIndex},r.length++}return r}addSort(t,r){this.sortBy(t,r)}removeSort(t){this.sortBy(t,null)}refreshSort(){this._refreshSort(this._sortedColumns)}_refreshSort(t){const r=this;if(r._isSorting||!t)return;if(r._suppressSort)return;if(!1===r.sorting.maintainSort)return;const o=[],e=[],s=[];r._isSorting=!0;let a=[];for(let n=0;n<t.length;n++){const d=t[n],i=r.columnByDataField[d.dataField];i&&(i.setProperty("sortOrder",d.sortOrder),i.sortComparator&&(a[i.dataField]=i.sortComparator),o.push(d.dataField),e.push(d.sortOrder),s.push(d.dataType))}!function(){if(r.dataSource&&(r.dataSource.sortComparators=a),r.dataSource&&r.dataSource.virtualDataSource)r._virtualDataRequest("sort");else{if(r.dataSource.sortBy(o,s,e),r.dataSource.boundHierarchy)r._refreshRowHierarchy(),r.dataSource.groupBy.length>0&&(r._refreshRowHierarchy(!0,!0),r.refresh());else{r.rowById=[];for(let t=0;t<r.dataSource.length;t++){const o=r.rows[t],e=r.dataSource[t];o.data=e,o.id=e.$.id,o._updateData(),r.rowById[o.id]=o}}r._recycle()}}(),r._refreshHeaderBar(),r._isSorting=!1,r._sortedColumns=t}sortBy(t,r){const o=this,e=o.columnByDataField[t],s=[],a=[],n=[],d=void 0===r;if(o._isSorting||!e)return;o._isSorting=!0,"descending"===r&&(r="desc"),void 0!==r&&"ascending"!==r||(r="asc");const i=function(t){t&&(t.setProperty("sortOrder",null),t.setProperty("sortIndex",null))},l=function(){if(o._sortedColumns.length>0)for(let t=0;t<o._sortedColumns.length;t++){const r=o._sortedColumns[t],e=o.columnByDataField[r.dataField];i(e)}o._sortedColumns=[]};if(null===e)return l(),void(o._isSorting=!1);if(!o.sorting.enabled||!o.dataSource||!e.allowSort||o._sortAnimation)return void(o._isSorting=!1);i(e),o._sortedColumns||(o._sortedColumns=[]);let u="string";for(let r=0;r<o.dataSource.dataFields.length;r++){const e=o.dataSource.dataFields[r];if(e.name===t){u=e.dataType;break}}let c=!0;for(let s=0;s<o._sortedColumns.length;s++){const a=o._sortedColumns[s];if(a.dataField===t)if(c=!1,a.sortIndex=e.sortIndex,d){if("asc"===a.sortOrder)a.sortOrder="desc",r="desc";else if("desc"===a.sortOrder){o.sorting.sortToggleThreeStates?(o._sortedColumns.splice(s,1),i(e),r=null):(a.sortOrder="asc",r="asc");break}}else a.sortOrder=r,null===r&&(o._sortedColumns.splice(s,1),i(e))}c&&("one"===o.sorting.mode&&l(),"many"===o.sorting.mode&&!1===o._canSort&&l(),null!==r&&o._sortedColumns.push({dataField:t,sortOrder:r,sortIndex:e.sortIndex,dataType:u})),e.setProperty("sortOrder",r),o._sortedColumns.sort(((t,r)=>"string"==typeof t.sortIndex&&"string"==typeof r.sortIndex?0:"number"==typeof t.sortIndex&&"string"==typeof r.sortIndex?-1:"string"==typeof t.sortIndex&&"number"==typeof r.sortIndex?1:"number"==typeof t.sortIndex&&"number"==typeof r.sortIndex?t.sortIndex-r.sortIndex:void 0));const m=[];for(let t=0;t<o._sortedColumns.length;t++){const r=o._sortedColumns[t];s.push(r.dataField),a.push(r.sortOrder),n.push(r.dataType);const e=o.columnByDataField[r.dataField];e.sortComparator&&(m[e.dataField]=e.sortComparator)}const f=function(){if(o.dataSource.sortComparators=m,o.dataSource&&o.dataSource.virtualDataSource)o._virtualDataRequest("sort");else{if(o.dataSource.sortBy(s,n,a),o.dataSource.boundHierarchy)o._refreshRowHierarchy(),o.dataSource.groupBy.length>0&&o._refreshRowHierarchy(!0,!0),o.refresh();else{o.rowById=[];for(let t=0;t<o.dataSource.length;t++){const r=o.rows[t],e=o.dataSource[t];r&&(r.data=e,e&&e.$&&(r.id=e.$.id,r._updateData()),o._filters&&o._filters.length>0&&(r.filtered=void 0===r.data.$.filtered||r.data.$.filtered),o.rowById[r.id]=r)}o._filters&&o._filters.length>0&&o.refresh()}o._recycle()}const t=[],r=[];for(let e=0;e<o._sortedColumns.length;e++){const s=o.columnByDataField[o._sortedColumns[e].dataField];s&&(s.setProperty("sortIndex",e),t.push(s),r.push(s.sortIndex),o._sortedColumns[e].sortIndex=e)}o._refreshHeaderBar(),o.$.fireEvent("sort",{sortDataFields:s,sortOrders:a,sortDataTypes:n,sortIndexes:r,columns:t,data:o._sortedColumns}),o._onSort&&o._onSort()};if(o.appearance.allowSortAnimation){let t=[],r=[];o.rows.canNotify=!1,o._sortAnimation=!0;const e=function(){for(let r=0;r<o._rowElements.length;r++){const e=o._rowElements[r];e.classList.remove("smart-grid-sort-animation"),o.removeTransformMoveStyle(e),e.offsetHeight>0&&t.push(e.offsetTop)}};e(),o._sortTimer=setTimeout((function(){e(),o._sortAnimation=!1,o.rows.canNotify=!0}),o.appearance.sortAnimationDuration),o._sortTimer2=setTimeout((function(){f()}),o.appearance.sortAnimationDuration/2);for(let e=0;e<t.length;e++){const s=o._rowElements[e];s.classList.remove("smart-grid-sort-animation"),o.removeTransformMoveStyle(s);let a=Math.floor(Math.random()*t.length-1+1);for(;r[a];)a=Math.floor(Math.random()*t.length-1+1);r[a]=!0,o.addTransformMoveStyle(s,"0ms",0,-s.offsetTop+t[a],0,.5),s.classList.add("smart-grid-sort-animation"),setTimeout((function(){o.addTransformMoveStyle(s,o.appearance.sortAnimationDuration+"ms",0,0,0,1)})),setTimeout((function(){s.classList.remove("smart-grid-sort-animation")}),o.appearance.sortAnimationDuration)}}else f();o._isSorting=!1}});
|
|
57
57
|
(()=>{"use strict";class e{_renderGroupBar(){const e=this;if(!e.grouping.groupBar.visible)return;const r=e.$.groupHeader;if(!r.firstElementChild){const a=document.createElement("smart-breadcrumb"),t=e.localize("groupBarLabel");r.appendChild(a),e.$.breadcrumb=a,a.placeholder=t,a.classList.add("smart-hidden")}const a=e.dataSource.groupBy,t=[];for(let r=0;r<a.length;r++){const o=a[r],n=e.columns.find((e=>e.dataField===o));if(!n)continue;let d="";n.sortOrder&&(d+='<span class="smart-grid-icon show '+("asc"===n.sortOrder?"smart-icon-sort-up":"smart-icon-sort-down")+'"></span>'),n.filter&&(d+='<span class="smart-grid-icon smart-icon-filter show"></span>'),t.push({label:n.label+d,value:n.dataField})}e.$.breadcrumb.closeButtons=e.grouping.groupBar.allowColumnCloseButtons,e.$.breadcrumb.allowDrag=e.$.breadcrumb.allowDrop=e.grouping.groupBar.allowColumnDragDrop,e.$.breadcrumb.dataSource=t,e.$.breadcrumb.minimizeWidth=350,e.offsetWidth<350&&(e.$.breadcrumb.parentElement.style.zIndex=9999,e.$.breadcrumb.parentElement.style.overflow="visible"),e.$.breadcrumb.onminimize=()=>{e.$.breadcrumb.parentElement.style.zIndex=9999,e.$.breadcrumb.parentElement.style.overflow="visible"},e.$.breadcrumb.onitemclick=r=>{const a=r.detail.item;if(!a)return;const t=e.columnByDataField[a.value];t.allowSortToggleOnClick&&e.sorting.enabled&&e.sortBy(t.dataField)},e.$.breadcrumb.onmaximize=()=>{e.$.breadcrumb.parentElement.style.zIndex="",e.$.breadcrumb.parentElement.style.overflow=""},e.$.breadcrumb.ondragstart=function(r){const a=e.$.breadcrumb._dragDrop,o=e.$.breadcrumb._items.indexOf(r.detail.item),n=e.columnByDataField[e.$.breadcrumb.dataSource[o].value];if(e.$.fireEvent("columnDragStart",{column:n,dataField:n.dataField,index:e.columns.indexOf(n),data:a,originalEvent:r.detail.originalEvent}).defaultPrevented)return;const d=e.columns.map((e=>(e.dataField===t[o].value&&e.element.classList.add("dragged"),e.element)));a.items=a.items.concat(d),a.getItemCoordinates(a.items),a.column=n,e._overlay=document.createElement("div"),e._overlay.classList.add("smart-grid-overlay"),e._overlay.style.cursor="",e.$.root.appendChild(e._overlay),e._dragLine=e._createLine(a.dragDetails.item),e.$.root.appendChild(e._dragLine),e._dragLine.style.height=a.dragDetails.item.offsetHeight+"px",requestAnimationFrame((()=>{e._dragLine.style.opacity=1}))},e.$.breadcrumb.ondragging=function(r){const a=e.$.breadcrumb._dragDrop,t=a.dragDetails;if(e._dragLine&&t.target){const o=e.getBoundingRect(t.target),n=e.getBoundingRect(e),d=e.getBoundingRect(e.$.columnHeader);t.before?e._dragLine.style.left=-d.left+o.left+"px":e._dragLine.style.left=-d.left+o.right+"px",parseInt(e._dragLine.style.left)<3&&(e._dragLine.style.left="3px"),e._dragLine.style.top=o.top-n.top+"px",t.target.classList.contains("smart-breadcrumb-item")?e._dragLine.style.height=o.height+"px":e._dragLine.style.height="calc(100% - 7px - "+e._dragLine.style.top+")",e.$.fireEvent("columnDragging",{column:a.column,dataField:a.column.dataField,index:e.columns.indexOf(a.column),data:a,originalEvent:r.detail.originalEvent})}},e.$.breadcrumb.ondragcancel=function(){e._dragLine&&e._dragLine.parentNode.removeChild(e._dragLine),e.columns.forEach((e=>{e.element&&e.element.classList.remove("dragged")}));const r=e.$.breadcrumb._dragDrop;e.$.fireEvent("columnDragCancel",{column:r.column,dataField:r.column.dataField,index:e.columns.indexOf(r.column),data:r})},e.$.breadcrumb.ondragend=function(r){e.beginUpdate();const a=e.getBoundingRect(e.$.breadcrumb);if(r.detail.originalEvent.pageY>a.bottom){const a=e.$.breadcrumb._dragDrop,t=r.detail.item.data.value,o=a.dragDetails.target,n=e.columnByDataField[t],d=e.$.breadcrumb.dataSource.findIndex((e=>e.value===n.dataField)),i=e.$.breadcrumb.dataSource.slice(0);if(i.splice(d,1),e.$.breadcrumb.dataSource=i,o&&o.column){if(!e.$.fireEvent("columnDragEnd",{column:a.column,dataField:a.column.dataField,index:e.columns.indexOf(a.column),newIndex:e.columns.indexOf(o.column),data:a,originalEvent:r.detail.originalEvent}).defaultPrevented){const r=e.columns.indexOf(n),a=e.columns.indexOf(o.column);e.columns.move(r,a)}}}const t=e.$.breadcrumb.dataSource.map((e=>e.value));e._dragLine&&e._dragLine.parentNode.removeChild(e._dragLine),e.columns.forEach((e=>{e.element&&e.element.classList.remove("dragged")})),e.dataSource.groupBy=t,e.refresh(!0),e.refreshFilters(),e.refreshSort(),e._refreshPagesCount(),e.endUpdate(),e.$.fireEvent("group",{groups:e.dataSource.groupBy})},e.$.breadcrumb.onclose=function(r){const a=r.detail.item;e.removeGroup(a.value),e.$.fireEvent("group",{groups:e.dataSource.groupBy})}}getGroups(){return this.dataSource.groupBy.toArray()}addGroup(e){const r=this;if(!r.dataSource||!r.grouping.enabled)return;-1===r.dataSource.groupBy.indexOf(e)&&(r._groups.push(e),r.dataSource&&r.dataSource.virtualDataSource?(r.dataSource.groupBy.push(e),r._virtualDataRequest("group")):r.dataSource.groupBy.push(e),r._refreshFilterRowEditors(),r.refresh(!0),r.refreshFilters(),r.refreshSort(),r._refreshPagesCount())}removeGroup(e){const r=this;if(!r.dataSource||!r.grouping.enabled)return;const a=r.dataSource.groupBy.indexOf(e);a>=0&&(r._groups.splice(a,1),r.dataSource&&r.dataSource.virtualDataSource?(r.dataSource.groupBy.splice(a,1),r._virtualDataRequest("group")):r.dataSource.groupBy.splice(a,1),r._refreshFilterRowEditors(),r.refresh(!0),r.refreshFilters(),r.refreshSort(),r._refreshPagesCount())}clearGroups(){const e=this;e.dataSource&&e.grouping.enabled&&(e._groups=[],e.dataSource&&e.dataSource.virtualDataSource?(e.dataSource.clearGroup(),e._virtualDataRequest("group")):e.dataSource.clearGroup(),e._refreshFilterRowEditors(),e.refresh(!0),e.refreshFilters(),e.refreshSort(),e._refreshPagesCount())}}Smart.Utilities.Grid.Group=e})();
|
|
58
|
-
Smart.Utilities.Assign("Grid.Select",class{_refreshSelection(){const e=this;if(e.selection.enabled&&(e._selectionColumn.refresh(),!e._isVirtualMode()&&e._selection&&e._selection.rows))for(let t in e._selection.rows)e.rowById[t]||delete e._selection.rows[t];e._refreshCellSelectionRect()}_toggleColumnSelection(e){const t=this;if(!t.selection.enabled||"none"===t.selection.checkBoxes.selectAllMode)return void(t._inputOverlay&&t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay));let l=e.element.getAttribute("selected");l="indeterminate"===l||""!==l;let n=t._recyclingRows;t._selectionColumn._selecting=!0,t.beginUpdate(),t._selection.indexes=[];for(let e=0;e<n.length;e++)n[e].selected=l;if(t._selectionColumn._selecting=!1,t.endUpdate(!1),t._isVirtualMode())if(l)for(let e=0;e<t.dataSource.virtualDataSourceLength;e++)l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e);else t._selection.indexes=[],t._selection.rows=[];if(t._recycle(!1),t.$.fireEvent("change",{started:!1,finished:!0}),t.selection.enabled&&t.selection.checkBoxes.enabled&&"none"!==t.selection.checkBoxes.selectAllMode){const l=e.element,n=l.querySelector(".smart-input");t._inputOverlay?t._inputOverlay.parentNode!==t.$.columnHeader&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)):(t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)),t._inputOverlay.column=e,t._inputOverlay.onpointerdown=function(){t._inputOverlay||(t._inputOverlay.onpointerdown=null);const e=t._inputOverlay.column;t._inputOverlay.classList.remove("smart-animate"),t._selectionColumn._selecting=!0,t.beginUpdate();let l=e.element.hasAttribute("selected"),n=t._recyclingRows;for(let e=0;e<n.length;e++)n[e].selected=!l;t._selectionColumn._selecting=!1;const o=t._inputOverlay;if(t.endUpdate(!1),t._isVirtualMode())if(l)t._selection.indexes=[],t._selection.rows=[];else for(let e=0;e<t.dataSource.virtualDataSourceLength;e++)l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e);return t._recycle(),t.$.fireEvent("change",{started:!1,finished:!0}),t.$.fireEvent("columnClick",{column:e,dataField:e.dataField}),t.$.columnHeader.appendChild(o),t._inputOverlay=o,t._inputOverlay.classList.add("smart-animate"),!1},t._inputOverlay.classList.add("smart-input-overlay"),t._inputOverlay.classList.add("smart-input-overlay-column"),t.appearance.allowCheckBoxesSelectionAnimation&&t._inputOverlay.classList.add("smart-animate"),t._inputOverlay.style.top=(l.offsetHeight-n.offsetHeight)/4+1+"px";const o=t._selectionColumn.element.parentElement.offsetLeft+t._selectionColumn.element.offsetLeft;t.rightToLeft?t._inputOverlay.style.right=o+"px":t._inputOverlay.style.left=o+"px",t._inputOverlay.style.height=l.offsetWidth+"px",t._inputOverlay.style.width=l.offsetWidth+"px",t._inputOverlay.onmousedown=null,t._inputOverlay.classList.add("smart-input-overlay-on"),t._selectionColumn.refresh()}}_refreshCheckBoxColumnSelection(){const e=this;if(e.selection.enabled&&e.selection.checkBoxes.enabled){const t=e._selectionColumn.element;"none"===e.selection.checkBoxes.selectAllMode?(t.removeAttribute("checkbox"),t.label.classList.remove("smart-input")):(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")),e._selectionColumn.refresh()}}_handleExtendedRowSelection(e,t){const l=this;if(!e)return;let n=l._recyclingRows;if(l.paging.enabled&&"page"===l.selection.selectAllMode&&(n=n.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize)),!t||t.ctrlKey||t.metaKey||(l._selection.rows=[],l._selection.indexes=[]),t&&!t.shiftKey&&(l._rangeSelectionStartRow=e,l._rangeSelectionEndRow=e),t&&t.shiftKey){l._rangeSelectionEndRow=e;const t=n.indexOf(l._rangeSelectionStartRow),o=n.indexOf(l._rangeSelectionEndRow),i=Math.min(t,o),a=Math.max(t,o);if(-1===t||-1===o)return;for(let e=i;e<=a;e++){const t=n[e];t.allowSelect&&t.setProperty("selected",!0)}}else!1!==e.allowSelect&&(t&&(t.ctrlKey||t.metaKey)?null===e.selected?e.setProperty("selected",!0):e.setProperty("selected",!e.selected):e.setProperty("selected",!0))}_setSelection(e,t,l){const n=this;if(!n.selection.enabled)return;if(n._lastColumnSelectionRange=null,n._lastRowSelectionRange=null,n.closeMenu(),null===e&&null===t)return void n.clearSelection();const o=function(){if(l&&!l.ctrlKey&&!l.metaKey&&!l.shiftKey||"one"===n.selection.mode){if("many"!==n.selection.mode){for(let e in n._selection.rows){const t=n.rowById[e];t&&(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}n._selection.indexes=[],n._selection.rows=[],n._selection.columns=[],n._selection.cells=[]}n._selection.focusedCell=null}if(n._selection.selectionRect){const e=n._selection.selectionRect;e.parentNode.removeChild(e);const t={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(t.down="touchstart",t.move="touchmove",t.up="touchend"),document.removeEventListener(t.move,e.onMove),document.removeEventListener(t.up,e.onUp),document.removeEventListener(t.down,e.onDown),n._selection.selectionRect=null}};n.beginUpdate();const i=n.columnByDataField[t],a=()=>{const t=n.rowById[e];t&&(t.allowSelect||null===t.allowSelect&&!l)&&(n.selection.checkBoxes.enabled&&l&&l.originalEvent&&l.originalEvent.target&&l.originalEvent.target.parentNode&&l.originalEvent.target.parentNode.hasAttribute("checkbox")&&(l.ctrlKey=!0),o(),n._selectRow(e,l))};if(n.selection.allowCellSelection&&null!=e&&i&&!i.autoGenerated){const i=n.rowById[e];if(!i)return n.endUpdate(!1),void n._recycle();let a=i.getCell(t);const s=n._getParentCell(i,t);s&&(a=s.row.getCell(s.column.dataField)),a&&a.column.allowSelect&&(o(),!l||l.ctrlKey||l.metaKey||(n._selection.rows=[],n._selection.indexes=[],n._selection.columns=[],"many"!==n.selection.mode&&(n._selection.cells=[])),"extended"===n.selection.mode?l&&(l.ctrlKey||l.metaKey)?a.selected=!a.selected:a.selected=!0:"one"===n.selection.mode?a.selected=!0:a.selected=!a.selected,(l&&!l.shiftKey||!n._selection.focusedCell)&&(n._selection.focusedCell={id:a.row.id,value:a.value,index:a.row.index,dataField:a.column.dataField}),l&&(l.shiftKey||n._selection.focusedCell.id===a.row.id&&n._selection.focusedCell.dataField===a.column.dataField&&"extended"===n.selection.mode)&&(s?n._renderCellSelectionRect(a.row,a.column,s.endRow,s.endColumn):n._renderCellSelectionRect(a.row,a.column,a.row,a.column)))}else n.selection.allowRowHeaderSelection&&null!=e&&void 0===n.columnByDataField[t]||n.selection.checkBoxes.enabled&&null!=e&&"_checkBoxColumn"===t&&void 0===n.columnByDataField[t]?a():null==e||null!=t&&void 0===n.columnByDataField[t]||!n.selection.allowRowSelection?n.selection.allowColumnHeaderSelection&&i&&(o(),n._selectColumn(t,l||new KeyboardEvent("keydown"))):a();n.endUpdate(!1,!1),n._recycle(!1,!0,!1),null==e||i||n._renderInputOverlay(e,l),n.__selectionStarted=new Date}_renderCellSelectionRect(e,t,l,n){const o=this;let i=o._recyclingRows;const a=i.indexOf(e),s=i.indexOf(l);if(!(o.grouping.enabled&&"advanced"===o.grouping.renderMode&&o.dataSource&&o.dataSource.groupBy.length>0)&&a>=0&&s>=0){if(!o._selection.selectionRect){const e=function(e){const t=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div");return n.classList.add("smart-selection-overlay"),n.appendChild(l),l.appendChild(t),t.classList.add("smart-selection-overlay-content"),l.classList.add("smart-selection-overlay-border-content"),o.selection.allowCellDragSelectionHandle&&e&&l.classList.add("handle"),o.$.scrollView.appendChild(n),n},t=o._selection.selectionRect=e(!0);if(o.selection.allowCellDragSelectionHandle){let e=null,l=null,n=null;t.onMove=function(t){const a=o._selection.selectionRect;let s=t.clientX,r=t.clientY;t.touches&&(s=t.touches[0].clientX,r=t.touches[0].clientY);const d=function(e){const t=(o.enableShadowDOM?o.shadowRoot:o.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null;for(let e=0;e<t.length;e++){const n=t[e];if(n.getAttribute("data-field")){l=n.getAttribute("data-field");break}}let n=null;for(let e=0;e<t.length;e++){const l=t[e];if(l.getAttribute("data-id")){n=l.row;break}}return{column:o.columnByDataField[l],row:n}};if(a&&a.capturedDrag){let e=d({clientX:s,clientY:r}),l=d({clientX:s,clientY:r+a.top}).row,n=d({clientX:s+a.left,clientY:r}).column;if(l||(l=i[i.length-1]),n||(n=e.column),l&&n&&e.row&&e.column){a.row=e.row,a.rowId=a.row.id,a.column=e.column,a.endDragRow=a.endRow=l,a.endDragColumn=a.endColumn=n,a.endDragRowId=a.endDragRow.id,o._dragSelectionStartDataField=a.column.dataField,o._dragSelectionStartRow=a.row;const t=a.row.getCell(a.column.dataField);o._selection.focusedCell={index:t.row.index,id:t.row.id,dataField:t.column.dataField,value:t.value}}o._resizeSelectionRect(),t.preventDefault()}else if(a&&a.captured)if(o._dragSelectionStartDataField=o._selection.focusedCell.dataField,o._dragSelectionStartRow=o.rowById[o._selection.focusedCell.id],null===l&&null===n&&(Math.abs(s-e.left)>=30?l=!0:Math.abs(r-e.top)>=30&&(n=!0)),a.lastPoint&&Math.abs(a.lastPoint.top-r)>=40?(l=null,n=!0):a.lastPoint&&Math.abs(a.lastPoint.left-s)>=40&&(n=null,l=!0),l){const t=a.endDragColumn.dataField,l=d({clientX:s,clientY:e.top-5});l.row&&l.column&&(a.endDragRow=a.endRow,a.endDragColumn=l.column,a.endDragColumn.dataField!==t&&(a.lastPoint={left:s,top:r}),o._resizeSelectionRect())}else if(n){const t=a.endDragRow,l=d({clientX:e.left-5,clientY:r});l.row&&l.column&&(a.endDragRow=l.row,a.endDragColumn=a.endColumn,a.endDragRow.id&&a.endDragRow.id!==t.id&&(a.lastPoint={left:s,top:r}),o._resizeSelectionRect())}a&&a.captured&&o.selection.allowDragSelectionAutoScroll&&(o._autoScrollSelectionDragInterval&&clearInterval(o._autoScrollSelectionDragInterval),o.selection.isDragging=!0,o._autoScrollSelectionDragInterval=setInterval((function(){const e=o.$.scrollView.getBoundingClientRect();s<=e.left+20?(o.scrollLeft-=15,o._resizeSelectionRect()):s>=e.left+e.width-20&&(o.scrollLeft+=15,o._resizeSelectionRect()),r<=e.top+20?(o.scrollTop-=15,o._resizeSelectionRect()):r>=e.top+e.height-20&&(o.scrollTop+=15,o._resizeSelectionRect())}),25))},t.onUp=function(){if(!t.captured)return;o._autoScrollSelectionDragInterval&&clearInterval(o._autoScrollSelectionDragInterval),o.editing.editCell||o.editing.editRow||o.focus(),t.capturedDrag=!1,t.captured=!1,l=null,n=null,e=null,t.lastPoint=null;const i=t.cellValues;t.minRow&&t.maxRow&&t.maxRow&&t.maxColumn&&(o._selectCellsRange(t.minRow,t.maxRow,t.minColumn.dataField,t.maxColumn.dataField),t.row=t.minRow,t.rowId=t.row.id,t.column=t.minColumn,t.endColumn=t.maxColumn,t.endRow=t.maxRow,t.endRowId=t.maxRow.id,t.cellValues=i,o._resizeSelectionRect(),o.selection.allowCellDragSelectionAutoFill&&o._pasteSelectedCells({row:t.row,endRow:t.endDragRow,column:t.column,endColumn:t.endColumn},i)),t.endDragColumn=null,t.endDragRow=null,t.minColumn=null,t.minRow=null,t.maxColumn=null,t.maxRow=null},t.onDown=function(l){if(t.captured&&!e){let t=l.clientX,n=l.clientY;l.touches&&(t=l.touches[0].clientX,n=l.touches[0].clientY),e={left:t,top:n}}};const a={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(a.down="touchstart",a.move="touchmove",a.up="touchend"),t["on"+a.down]=function(e){const l=t.getBoundingClientRect();let n=e.clientX,i=e.clientY;e.touches&&(n=e.touches[0].clientX,i=e.touches[0].clientY),n>=l.right-5&&i>=l.bottom-5?(t.captured=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn):o.selection.allowCellDragDropSelectionHandle&&i>=l.bottom-5?(t.captured=!0,t.capturedDrag=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn,t.left=t.endColumn.left-t.column.left,t.top=t.endRow.top-t.row.top):t.captured||o._rowDownHandler(e)},document.addEventListener(a.move,t.onMove,{passive:!1}),document.addEventListener(a.up,t.onUp,{passive:!1}),document.addEventListener(a.down,t.onDown,{passive:!1})}}const e=o._selection.selectionRect;e.row=o.rowById[o._selection.focusedCell.id],e.rowId=o._selection.focusedCell.id,e.column=o.columnByDataField[o._selection.focusedCell.dataField],e.endRow=l,e.endRowId=l.id,e.endDragRow=l,e.endColumn=n,e.endDragColumn=n,o._refreshCellSelectionRect()}}_resizeSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t)return;let l=e._recyclingRows,n=t.row,o=t.endDragRow,i=t.column,a=t.endDragColumn;const s=e.viewColumns,r=l.indexOf(n),d=l.indexOf(o),c=l.indexOf(t.endRow),u=s.indexOf(i),f=s.indexOf(a),_=s.indexOf(t.endColumn),g=Math.min(c,Math.min(r,d)),m=Math.max(c,Math.max(r,d)),w=Math.min(_,Math.min(u,f)),p=Math.max(_,Math.max(u,f));c<=Math.min(r,d)?t.minRow=t.endRow:t.minRow=r<=d?n:o,c>=Math.max(r,d)?t.maxRow=t.endRow:t.maxRow=r>=d?n:o,_<=Math.min(u,f)?t.minColumn=t.endColumn:t.minColumn=u<=f?i:a,_>=Math.max(u,f)?t.maxColumn=t.endColumn:t.maxColumn=u>=f?i:a;let h=0,y=0,S=0,v=0;for(let e=g;e<=m;e++){const t=l[e];if(t){e===g&&(h=t.top),e===m&&(y=t.top+t.height-h);for(let e=w;e<=p;e++){const l=s[e].dataField,n=t.getCell(l);e===w&&(S=n.column.left),e===p&&(v=n.column.left+n.column.computedWidth-S)}}}t.style.top=h-e.scrollTop-1+"px",e._isVirtualMode()&&(t.style.top=h+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft?t.style.right=S-e.scrollLeft+"px":t.style.left=S-e.scrollLeft+"px",t.style.height=y+1+"px",t.style.width=v+1+"px"}_getPatternValue(e,t,l){let n=[],o=0,i=[],a=[],s=[],r=[];const d={names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},c={names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},u=function(e){if(void 0!==e&&!(e.toString().indexOf("GMT+")>=0||e.toString().indexOf("GMT-")>=0)){if(!isNaN(parseFloat(e)))return/[A-Za-z]/.test(e.toString())?void 0:parseFloat(e);if(d.names.indexOf(e)>=0)return r=d.names,d.names.indexOf(e);if(d.namesAbbr.indexOf(e)>=0)return r=d.namesAbbr,d.namesAbbr.indexOf(e);if(d.namesShort.indexOf(e)>=0)return r=d.namesShort,d.namesShort.indexOf(e);if(c.names.indexOf(e)>=0)return r=c.names,c.names.indexOf(e);if(c.namesAbbr.indexOf(e)>=0)return r=c.namesAbbr,c.namesAbbr.indexOf(e);if(void 0!==e&&(null===e&&(e=""),/\d+/.test(e.toString()))){s.push(e.toString().replace(/[0-9]/,"#")),s[s.length-1]=s[s.length-1].replace(/[0-9]/g,"");const t=parseFloat(e.toString().replace(/\D/g,""));return isNaN(t)?0:t}}};let f=0;for(let e in l){let t=l[e];n[o]=[],f=0;for(let e in t){let l=u(t[e]);void 0!==l&&(n[o].push(l),f++)}if(0===n[o].length)continue;let a=n[o][0],d=0;for(let e=0;e<n[o].length;e++){let t=u(n[o][e-1]),l=u(n[o][e]);0===e&&(t=l),a+=l,d+=l-t}a/=n[o].length,a-=n[o][0],a+=n[o][n[o].length-1],0!==d&&(d/=n[o].length-1),(r.length>0||s.length>0)&&(d=1,a=n[o][0]),n[o].length<=2&&(a=n[o][n[o].length-1]+d),i.push({step:d,stepStart:a}),o++}for(let e=0;e<f;e++){let t=n[0][e],l=0;for(let o=1;o<n.length;o++){const i=u(n[o-1][e]),a=u(n[o][e]);t+=a,l+=a-i}t/=n.length,t-=n[0][e],t+=n[n.length-1][e],0!==l&&(l/=n.length-1),(r.length>0||s.length>0)&&(l=1,t=n[0][e]),n.length<=2&&(t=n[n.length-1][e]+l),a.push({step:l,stepStart:t})}if(!n[e]){let l=n.length;for(let o=l;o<=e;o++){n[o]=[];for(let e=0;e<=t;e++)a[e]||(a[e]=a[e-1]),a[e]&&(o===l?n[o][e]=a[e].stepStart:(n[o][e]=n[o-1][e]+a[e].step,r.length>1&&n[o][e]>=r.length&&(n[o][e]=0)))}return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}if(!n[e][t]){let l=f;for(let o=l;o<=t;o++)i[e]&&(o===l?n[e].push(i[e].stepStart):(n[e][o]=n[e][o-1]+i[e].step,r.length>1&&n[e][o]>=r.length&&(n[e][o]=0)));return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}return n[e]&&n[e][t]?s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]:0}_pasteDataType(e){const t=this.dataSource&&"number"==typeof this.dataSource.dataSource,l=e.cell,n=e.value;let o=l.column.dataType;return o&&!t||(o=isNaN(parseFloat(n))?"string":n instanceof Date?"date":"true"===n||"false"===n?"boolean":"number"),o}_pasteModeCopy(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell;let i=e.value;if(o.column.editor&&o.column.editor.dataSource&&i)for(let e=0;e<o.column.editor.dataSource.length;e++){const t=o.column.editor.dataSource[e];if("string"!=typeof t&&t.label===i){i=t.value;break}}const a=i,s=e.dataField;let r=a,d=!1;if("string"===n)r=a,d=!0;else if("bool"===n||"boolean"===n)1!==a&&"1"!==a&&!0!==a&&"true"!==a&&"TRUE"!==a&&"True"!==a||(r=!0,d=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):(r=a,d=!0)}else if("number"===n||"float"===n||"int"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):null!==a?"int"===n||"integer"===n?(r=parseInt(a),d=!0):(r=parseFloat(a),isNaN(r)&&(r=null),d=!0):(r=null,d=!0)}if(d)if(t.dataSource&&t.dataSource.virtualDataSource){const e={};e[o.column.dataField]=r,t.updateRow(o.row.id,e)}else{const e=o.value;if(t._setCellUndoRedo(o,e,r),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]),t._pasteTempValues.push({id:o.row.id,cell:o,dataField:o.column.dataField,oldValue:e,newValue:r}),t._pasteTimer&&clearTimeout(t._pasteTimer);const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};t._pasteTimer=setTimeout((()=>{if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1)}}),t)}else t.onCellUpdate([o],[e],[r],(function(e){e&&(l(o,r),o.value=r)}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const e=Object.assign({},o.row.data),l=Object.assign({},o.row.data);l[o.column.dataField]=r,o.row.updatedDate=new Date,o.row.updatedBy=t.currentUser,t.onRowUpdate([o.row.index],[o.row],[e],[l],(function(e){e&&(o.value=r)}),t)}else o.value=r}}_pasteModeFill(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell,i=e.selectedValues,a=e.minRowIndex,s=e.minColumnIndex,r=e.currentRowIndex,d=e.currentColumnIndex,c=e.dataField;let u=e.value;if("string"===n)/\d+/.test(u.toString())?(u=t._getPatternValue(r-a,d-s,i),void 0===u&&i[r-a]&&i[r-a][d-s]&&(u=i[r-a][d-s])):(u=t._getPatternValue(r-a,d-s,i),void 0===u&&(u=i[r-a]?i[r-a][d-s]:e.value),void 0===u&&(u=e.value)),void 0!==u&&(o.value=u);else if("bool"===n||"boolean"===n)1!==u&&"1"!==u&&!0!==u&&"true"!==u&&"TRUE"!==u&&"True"!==u||(o.value=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n&&(o.value=null),i[r-a]&&(u=i[r-a][d-s],void 0!==u&&(o.value=u))}else if("number"===n||"float"===n||"int"===n){u=t._getPatternValue(r-a,d-s,i);const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n?o.value=null:o.value=null!==u?"int"===n||"integer"===n?parseInt(u):parseFloat(u):null}}_pasteSelectedCells(e,t){const l=this;l.beginUpdate();let n=l._recyclingRows,o=e.row,i=e.endRow,a=e.column,s=e.endColumn;const r=n.indexOf(o),d=n.indexOf(i),c=n.indexOf(e.endRow),u=l.viewColumns,f=u.indexOf(a),_=u.indexOf(s),g=u.indexOf(e.endColumn),m=Math.min(c,Math.min(r,d)),w=Math.max(c,Math.max(r,d)),p=Math.min(g,Math.min(f,_)),h=Math.max(g,Math.max(f,_));let y=0,S=0,v=0,R=0;for(let e in t)0===y&&(S+=Object.keys(t[e]).length),y++;for(let e=m;e<=w;e++){const o=n[e];v=0;for(let n=p;n<=h;n++){if(!u[n])continue;const i=u[n].dataField,a=o.getCell(i);let s=0;for(let r in t){if(s===R){let s=0,d=t[r];for(let r in d){if(v===s){let s=d[r],c=!0;if(t[o.id]&&t[o.id][i]&&(c=!1),c&&"none"!==l.clipboard.autoFillMode){const o={value:s,targetValue:a.value,dataField:r,index:a.row.visibleIndex,targetDataField:i,targetRowIndex:e};if(l.clipboard.onPasteValue){l.clipboard.onPasteValue(o);const e=a.value;a.value=o.value,l._setCellUndoRedo(a,e,o.value)}else o.cell=a,o.selectedValues=t,o.minRowIndex=m,o.maxRowIndex=w,o.minColumnIndex=p,o.maxColumnIndex=h,o.currentColumnIndex=n,o.currentRowIndex=e,"copy"===l.clipboard.autoFillMode?l._pasteModeCopy(o):"fillSeries"===l.clipboard.autoFillMode&&l._pasteModeFill(o)}}s++}}s++}v++,v>=S&&(v=0)}R++,R>=y&&(R=0)}l.endUpdate(!1),l._recycle(!1),l._refreshDataFilters()}_refreshCellSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t||t&&t.captured)return;let l=e._recyclingRows,n=t.row,o=t.endRow,i=t.column,a=t.endColumn;const s=e.viewColumns;if(!a||!i)return;if(e._isVirtualMode()){if(n.id!==t.rowId&&!e.rowById[t.rowId])return t.style.height="0px",void(t.style.width="0px");n=e.rowById[t.rowId],o=e.rowById[t.endRowId]}if(!i.allowSelect||!a.allowSelect){if(i===a)return t.style.width="0px",void(t.style.height="0px");{const e=s.indexOf(i),l=s.indexOf(a);i=null,a=null;for(let t=e;t<l;t++){const e=s[t];e.allowSelect&&!i&&(i=e),a=e}if(!i||!a)return t.style.width="0px",void(t.style.height="0px")}}const r=l.indexOf(n),d=l.indexOf(o),c=s.indexOf(i),u=s.indexOf(a);let f=Math.min(r,d),_=Math.max(r,d),g=Math.min(c,u),m=Math.max(c,u);g=Math.max(0,g),f=Math.max(0,f);const w=function(e){const t=l.indexOf(e.row),n=l.indexOf(e.endRow),o=s.indexOf(e.column),i=s.indexOf(e.endColumn);f=Math.min(f,t),f=Math.min(f,n),f=Math.max(0,f),_=Math.max(_,t),_=Math.max(_,n),g=Math.min(g,o),g=Math.min(g,i),g=Math.max(0,g),m=Math.max(m,o),m=Math.max(m,i)},p=e._getParentCell(n,i.dataField),h=e._getParentCell(n,a.dataField),y=e._getParentCell(o,a.dataField),S=e._getParentCell(o,i.dataField);p&&w(p),h&&w(h),y&&w(y),S&&w(S);let v=0,R=0,C=0,x=0;t.cellValues=[];for(let n=f;n<=_;n++){const o=l[n];if(n===f&&(v=o.top,!0!==o.freeze&&"near"!==o.freeze&&(v+=e.__frozenNearHeight),"far"===o.freeze&&(v=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight)),n===_){let t=o.top;"far"===o.freeze&&(t=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight),R=t+o.height-v,!0!==o.freeze&&"near"!==o.freeze&&(R+=e.__frozenNearHeight)}t.cellValues[o.id]=[];const i=e._isUpdating;e._isUpdating=!0;for(let l=g;l<=m;l++){const n=s[l].dataField,i=o.getCell(n);let a=i.element?i.element.textContent:i.value;if(void 0===a&&(a=""),t.cellValues[o.id][n]=a,l===g&&(C=i.column.left,i.column.freeze&&"far"===i.column.freeze&&(C=e.__clientSize.width-e.__frozenFarWidth+C+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth)),l===m){let t=i.column.left;i.column.freeze&&"far"===i.column.freeze&&(t=e.__clientSize.width-e.__frozenFarWidth+t+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),x=t+i.column.computedWidth-C}i.selected=!0}e._isUpdating=i}if(v-e.scrollTop<e.layout.rowMinHeight&&e.filtering.enabled&&e.filtering.filterRow.visible){const t=v;v=e.layout.rowMinHeight+e.scrollTop,R-=v-t}if(R<=0)t.classList.add("smart-visibility-hidden");else{if(t.classList.remove("smart-visibility-hidden"),t.style.top=v-e.scrollTop-1+"px",e._isVirtualMode()&&(t.style.top=v+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft)t.style.right=C-e.scrollLeft+"px";else if(t.style.left=C-e.scrollLeft+"px",C-e.scrollLeft<e.__frozenNearWidth-1){let l=0;for(let t=0;t<e._frozenNearColumns.length;t++){const n=e._frozenNearColumns[t];n&&n.autoGenerated&&n.visible&&(l+=n.width)}if(C-e.scrollLeft<l){const n=l-C+e.scrollLeft;x-=n,t.style.left=n+C-e.scrollLeft+"px"}}t.style.height=R+1+"px",t.style.width=x+1+"px"}}_renderInputOverlay(e,t,l){const n=this,o=n.rowById[e];if(o&&!1!==o.allowSelect&&!o.label&&t&&n.selection.checkBoxes.enabled){n._inputOverlay&&n._inputOverlay.classList.contains("smart-input-overlay-column")&&(n._inputOverlay.parentNode&&n._inputOverlay.parentNode.removeChild(n._inputOverlay),n._inputOverlay=null),n._inputOverlay||(n._inputOverlay=document.createElement("div"),n.$.scrollView.appendChild(n._inputOverlay),n._inputOverlay.classList.add("smart-input-overlay"));let e=o.freeze?o.top:n.__frozenNearHeight+o.top;const t=Math.round((o.cellHeight-n._selectionColumn.computedWidth)/2),i=n._selectionColumn.element.parentElement.offsetLeft+n._selectionColumn.element.offsetLeft;if(n._inputOverlay.style.left=i+"px",n._inputOverlay.style.height=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.width=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.top=e+t-n.scrollTop+"px",o&&o.element){const e=o.element.querySelector("smart-grid-cell");e&&(n._inputOverlay.cell=e.cell)}n._inputOverlay.row=o,n._inputOverlay.onpointerdown=function(e){n._inputOverlay||(n._inputOverlay.onpointerdown=null);const t=n._inputOverlay.row,l=n._inputOverlay.cell;n.beginUpdate(),t.selected=!t.selected,n.endUpdate(!1),n.$.fireEvent("change",{started:!1,finished:!0}),n._refreshSummary(!1);const o=e.originalEvent?e.originalEvent:e,i=3===o.which;n.$.fireEvent("rowClick",{row:t,id:t.id,isRightClick:i,originalEvent:o,pageX:o.pageX,pageY:o.pageY}),l&&n.$.fireEvent("cellClick",{cell:l,id:t.id,dataField:l.column.dataField,isRightClick:i,originalEvent:o,pageX:o.pageX,pageY:o.pageY}),n._recycle(),n._renderInputOverlay(t.id,e,!0)},n.appearance.allowCheckBoxesSelectionAnimation&&void 0===l&&n._inputOverlay.classList.add("smart-animate"),requestAnimationFrame((()=>{n._inputOverlay&&n._inputOverlay.classList.add("smart-input-overlay-on")}))}}_selectRow(e,t){const l=this,n=l.rowById[e];if(n&&l.selection.enabled&&(!n.header||"row-resize"!==n.header.style.cursor)){if(t&&(!t.shiftKey||!l._selection.focusedCell)){const t=n.getCell(l.columns[0].dataField);l._selection.focusedCell={index:t.row.index,id:e,dataField:t.column.dataField,value:t.value}}l._lastRowsSelectionRange=null,"extended"===l.selection.mode?l._handleExtendedRowSelection(n,t):"one"===l.selection.mode?n.select():n.selected?n.unselect():n.select()}}_getParentCell(e,t){const l=this;let n=l._recyclingRows;for(let o=0;o<l._cellsMerge.length;o++){const i=l._cellsMerge[o];let a=[],s=[];if(a.push(i.row),i.rowSpan>1){const e=n.indexOf(i.row);if(e>=0)for(let t=e;t<e+i.rowSpan;t++)n[t]&&-1===a.indexOf(n[t])&&a.push(n[t])}if(s.push(i.column.dataField),i.colSpan>1){const e=l.viewColumns.indexOf(l.columnByDataField[i.column.dataField]);for(let t=e;t<e+i.colSpan;t++)s[t]&&-1===s.indexOf(s[t].dataField)&&s.push(s[t].dataField)}if(a.indexOf(e)>=0&&s.indexOf(t)>=0)return{row:i.row,column:i.column,endRow:a[a.length-1],endColumn:l.columnByDataField[s[s.length-1]]}}if(l._cellRowSpan)for(let o=0;o<l._cellRowSpan.length;o++){const o=e.visibleIndex;let i=-1,a=null;for(let e=0;e<l._cellRowSpan.length;e++){const t=l._cellRowSpan[e];if(o>t[0]&&o<t[1]){i=t[0],a=t[2];break}}if(i>=0&&a===t){const e=n[i];if(e)return{row:e,column:l.columnByDataField[t],endRow:e,endColumn:l.columnByDataField[t]}}}return null}_selectCellsRange(e,t,l,n){const o=this,i=o._selection.selectionRect;if(o._lastRowsSelectionRange&&o._lastRowsSelectionRange.id===e.id&&o._lastRowsSelectionRange.endId===t.id&&o._lastColumnSelectionRange&&o._lastColumnSelectionRange.dataField===l&&o._lastColumnSelectionRange.endDataField===n)return;o.beginUpdate(),o._clearSelection(),o._lastRowsSelectionRange={id:e.id,endId:t.id},o._lastColumnSelectionRange={dataField:l,endDataField:n},(!i||i&&!i.captured)&&o._selection.focusedCell&&o._renderCellSelectionRect(o.rowById[o._selection.focusedCell.id],o.columnByDataField[o._selection.focusedCell.dataField],o.rowById[o._lastRowsSelectionRange.endId],o.columnByDataField[o._lastColumnSelectionRange.endDataField]);let a=o._recyclingRows;const s=o.viewColumns;let r=-1,d=-1,c=a.indexOf(e),u=a.indexOf(t),f=-1;for(let e=0;e<s.length;e++){const t=s[e];t.allowSelect&&(-1===f&&(f=e),t.dataField===l&&(r=e),t.dataField===n&&(d=e))}if(-1===f)return o.endUpdate(!1),void o._recycle();-1===r?r=f:-1===d&&(d=f);let _=Math.min(c,u),g=Math.max(c,u),m=Math.min(r,d),w=Math.max(r,d);const p=function(e){const t=a.indexOf(e.row),l=a.indexOf(e.endRow),n=s.indexOf(e.column),o=s.indexOf(e.endColumn);_=Math.min(_,t),_=Math.min(_,l),g=Math.max(g,t),g=Math.max(g,l),m=Math.min(m,n),m=Math.min(m,o),w=Math.max(w,n),w=Math.max(w,o)},h=o._getParentCell(e,l),y=o._getParentCell(t,n);if(h&&p(h),y&&p(y),g<0||_<0||m<0||w<0)return o.endUpdate(!1),void o._recycle();for(let e=_;e<=g;e++){const t=a[e];if(t.allowSelect)for(let e=0;e<s.length;e++){const l=s[e];l.allowSelect&&e>=m&&e<=w&&(t.getCell(l.dataField).selected=!0)}}o.endUpdate(!1,!1),o._recycle(!1,!0,!1),o._selectionTimer&&clearTimeout(o._selectionTimer),o._selectionTimer=setTimeout((()=>{o._recycle(!1,!0,!1)}),50)}_selectRowsRange(e,t,l){const n=this;if(n._lastRowsSelectionRange&&n._lastRowsSelectionRange.id===e.id&&n._lastRowsSelectionRange.endId===t.id)return;if(n._dragDrop&&n._dragDrop.dragDetails)return;n.beginUpdate(),n._clearSelection(),n._lastRowsSelectionRange={id:e.id,endId:t.id};let o=n._recyclingRows;const i=o.indexOf(e),a=o.indexOf(t),s=Math.min(i,a),r=Math.max(i,a);if(r<0)return n.endUpdate(!1),void n._recycle();for(let e=s;e<=r;e++){const t=o[e];t&&t.allowSelect&&(t.selected=!1!==l)}n.endUpdate(!1),n._recycle()}_selectColumnsRange(e,t){const l=this;if(l._lastColumnSelectionRange&&l._lastColumnSelectionRange.dataField===e&&l._lastColumnSelectionRange.endDataField===t)return;if(l._dragDrop&&l._dragDrop.dragDetails)return;l.beginUpdate(),l._clearSelection(),l._lastColumnSelectionRange={dataField:e,endDataField:t};const n=l.viewColumns;let o=-1,i=n.length;for(let l=0;l<n.length;l++){const a=n[l];a.allowSelect&&(a.dataField===e&&(o=l),a.dataField===t&&(i=l))}const a=Math.min(o,i),s=Math.max(o,i);for(let e=0;e<n.length;e++){const t=n[e];t.allowSelect&&e>=a&&e<=s&&(t.selected=!0)}l.endUpdate(!1),l._recycle()}_selectColumn(e,t){const l=this,n=l.columnByDataField[e],o=l.viewColumns;if(!n||!l.selection.enabled||!1===n.allowSelect||!l.selection.allowColumnHeaderSelection)return;if(n&&"col-resize"===n.element.style.cursor)return;let i=!1;if(n&&(n.allowSelect||null===n.allowSelect&&!t)&&(i=!0),i&&t)if("extended"===l.selection.mode){if(t.ctrlKey||t.metaKey||t.shiftKey||(l._rangeSelectionStartColumn=n,l._rangeSelectionEndColumn=n),t.ctrlKey||t.metaKey?n.selected=!n.selected:n.selected=!0,t&&t.shiftKey){l._rangeSelectionStartColumn||(l._rangeSelectionStartColumn=n),l._rangeSelectionEndColumn=n,l._selection.columns=[];const e=o.indexOf(l._rangeSelectionStartColumn),t=o.indexOf(l._rangeSelectionEndColumn),i=Math.min(e,t),a=Math.max(e,t);for(let e=i;e<=a;e++){const t=o[e];t&&!1!==t.allowSelect&&(t.selected=!0)}}}else"one"===l.selection.mode||null===n.selected?n.selected=!0:n.selected=!n.selected}selectAllRows(){const e=this;let t=e.rows;e._selectionColumn._selecting=!0,e.beginUpdate();for(let e=0;e<t.length;e++)t[e].selected=!0;e._selectionColumn._selecting=!1,e.endUpdate(!1),e._refreshSummary(!1),e._recycle(!1),e._refreshCheckBoxColumnSelection(),e.$.fireEvent("change",{started:!1,finished:!0})}hasSelectedRows(){const e=this.getVisibleRows(),t=this._getSelectedRows(!0,!1);return t.length===e.length||t.length>0&&t.length<e.length||0!==t.length&&0!==e.length&&void 0}areAllRowsSelected(){const e=this.getVisibleRows(),t=this._getSelectedRows(!0,!1);return t.length>0&&t.length===e.length}_getSelectedRows(e,t){const l=this,n=[];let o=l.rows;if(l.rows.canNotify=!1,e&&(o=l.getVisibleRows()),l._isVirtualMode()){let e=l._selection.indexes;return l.paging.enabled&&t&&l._isVirtualMode()&&(e=e.slice(0,l.paging.pageSize)),l.rows.canNotify=!0,Object.keys(e).length}l.paging.enabled&&t&&(o=l._isVirtualMode()?o.slice(0,l.paging.pageSize):o.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize));for(let e=0;e<o.length;e++){const t=o[e];t.getProperty("selected")?n.push(t):(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}return l.rows.canNotify=!0,n}_dragSelectionEnd(e){const t=this;t._dragSelectionStartDataField=null,t._dragSelectionStartRow=null,t.__selectionStarted&&(t.$.fireEvent("change",{started:!1,finished:!0,originalEvent:e}),t._refreshSummary(),delete t.__selectionStarted,delete t.__selectionStartedFired),t.selection.allowDragSelection&&t.selection.isDragging&&(t.selection.isDragging=!1,t._autoScrollSelectionDragInterval&&(clearInterval(t._autoScrollSelectionDragInterval),t.editing.isEditing||t._recycle()))}_dragSelection(e){const t=this;if("extended"!==t.selection.mode||!1===t.selection.allowDragSelection)return;if(!t._dragSelectionStartDataField&&!t._dragSelectionStartRow)return;const l=()=>{t.__selectionStarted&&!t.__selectionStartedFired&&(t.$.fireEvent("change",{started:!0,finished:!1,originalEvent:e}),t.__selectionStartedFired=!0),t.$.fireEvent("change",{started:!1,finished:!1,originalEvent:e})};if(!t.selection.allowCellSelection||!t._dragSelectionStartDataField||t._columnResizeLine||t._dragSelectionStartDataField.startsWith("_")||!t._dragSelectionStartRow||t._rowResizeLine){if(t._dragSelectionStartRow&&!t._rowResizeLine&&(t.selection.allowRowSelection&&!t._dragSelectionStartDataField.startsWith("_")||t.selection.allowRowHeaderSelection&&t._dragSelectionStartDataField.startsWith("_"))){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){o=t.row,!o&&t.cell&&(o=t.cell.row);break}}let i=!0;t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&o&&t._lastRowsSelectionRange.endId===o.id&&(i=!1),o&&!o.allowSelect&&(i=!1),o&&o.allowSelect&&t._selectRowsRange(t._dragSelectionStartRow,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,i&&l(),t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25)}else if(t._dragSelectionStartDataField&&!t._columnResizeLine&&!t._dragSelectionStartDataField.startsWith("_")&&t.selection.allowColumnHeaderSelection){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}o&&t._selectColumnsRange(t._dragSelectionStartDataField,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval);let i=!0;t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(i=!1),i&&l(),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15)}),25)}}else{const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}let i=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){i=t.row;break}}if(!i&&n.length&&n[0].classList.contains("smart-grid-scroll-view")){i=t._recyclingRows[t._recyclingRows.length-1];const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,i.element.getBoundingClientRect().top);for(let e=0;e<l.length;e++){const t=l[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}}if(o&&i){if(i.id===t._dragSelectionStartRow.id&&t._dragSelectionStartDataField===o)return;if(o&&o.startsWith("_"))return;let e=!0;t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(e=!1),t._selectCellsRange(t._dragSelectionStartRow,i,t._dragSelectionStartDataField,o),t._removeCellContentPopup(),e&&l()}t.selection.allowDragSelectionAutoScroll&&(t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15),e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25))}}select(e,t){const l=this;l.isInitialized&&(!t&&void 0!==e&&l._selection&&l._selection.rows[e]||(l._setSelection(e,t),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary()))}selectRowsByIndex(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._isVirtualMode()){let l=[];for(let t=0;t<e.length;t++)l[e[t]]=!0;return t._selection.indexes=l,void t._recycle()}t.beginUpdate();for(let l in e){const e=t.rows[l];e&&t._setSelection(e.id)}t.endUpdate(!1),t._recycle()}))}selectRowsRange(e,t){const l=this,n=l.rowById[e],o=l.rowById[t];n&&o&&(l._selectRowsRange(n,o),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}selectCellsByQuery(e){const t=this,l=t.findCells(e);requestAnimationFrame((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t.beginUpdate();for(let e in l){const n=l[e][0],o=l[e][1];t._setSelection(n,o)}t.endUpdate(!1),t._recycle()}))}selectRowsByQuery(e,t,l){const n=this,o=n.find(e,t,l).map((e=>e.$.id));o.length&&n.selectRows(o)}selectRows(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t.beginUpdate();for(let l in e)t._setSelection(e[l]);t.endUpdate(!1),t._recycle()}))}selectCells(e,t){const l=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let n in e)for(let o=0;o<t.length;o++)l._setSelection(e[n],t[o]);l.endUpdate(!1),l._recycle()}))}selectRange(e,t,l,n){const o=this;!function(){const i=new KeyboardEvent("keydown",{shiftKey:!0});requestAnimationFrame((()=>{"extended"!==o.selection.mode&&"many"!==o.selection.mode&&o._clearSelection(),o.beginUpdate(),o._setSelection(e,t),o._setSelection(l,n,i),o.ensureVisible(e,t),o.endUpdate(!1),o._refreshSummary(!1),o._recycle()}))}(),o.$.fireEvent("change",{started:!1,finished:!0})}unselect(e,t){const l=this;l._selection&&(l._selection.rows&&l._selection.rows[e]&&delete l._selection.rows[e],l._selection.columns&&l._selection.columns[t]&&delete l._selection.columns[t],l._selection.cells&&(l._selection.cells["row"+e]&&(delete l._selection.cells["row"+e][t],1===Object.getOwnPropertyNames(l._selection.cells["row"+e]).length&&delete l._selection.cells["row"+e]),l._selection.cells["column"+t]&&(delete l._selection.cells["column"+t][e],1===Object.getOwnPropertyNames(l._selection.cells["column"+t]).length&&delete l._selection.cells["column"+t])),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}getSelectedRows(){const e=this;let t=[];if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);if(e._isVirtualMode()){for(let e in l){const n=l[e];t.push([n,{}])}return t}for(let n in l){const o=l[n],i=e.rowById[o];if(!i)continue;const a={};for(let e in i.data)switch(e){case"$":case"parent":case"level":case"leaf":case"children":continue;default:a[e]=i.data[e]}t.push([i.id,a])}}return t}getSelectedRowIndexes(){const e=this;return e._selection.indexes&&Object.keys(e._selection.indexes).length>0?e._selection.indexes:[]}getSelectedRowIds(){const e=this;let t=[];if(e._isVirtualMode())return e._selection.rows&&Object.keys(e._selection.rows).length>0?e._selection.rows:void 0;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);for(let n in l){const o=l[n],i=e.rowById[o];i&&t.push(i.id)}}return t}getSelectedCells(e){const t=this;let l=[];if(t._selection.cells)for(let n in t._selection.cells)if(n.startsWith("row")){let o=n.replace("row",""),i=null;for(let a in t._selection.cells[n])if(i=a.replace("column",""),l||(l=[]),!1===e)l.push([o,i]);else{const e=t.getCellValue(o,i);l.push([o,i,e])}}return l}getSelection(){const e=this;let t=null,l=null,n=null,o=null;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);t=[];for(let n=0;n<l.length;n++){const o=l[n];t.push({id:o,row:e.rowById[o]})}}if(e._selection.columns&&Object.keys(e._selection.columns).length>0){const t=Object.keys(e._selection.columns);l=[];for(let n=0;n<t.length;n++){const o=t[n];l.push({dataField:o,column:e.columnByDataField[o]})}}if(e._selection.cells)for(let t in e._selection.cells)if(t.startsWith("row")){let l=t.replace("row",""),o=null;for(let i in e._selection.cells[t])o=i.replace("column",""),n||(n=[]),n.push({id:l,dataField:o,column:e.columnByDataField[o],row:e.rowById[l]})}return e._selection.focusedCell&&(e._isVirtualMode(),o={index:e._selection.focusedCell.index,id:e._selection.focusedCell.id,dataField:e._selection.focusedCell.dataField}),{rows:t,columns:l,cells:n,focused:o}}focusAndSelect(e,t){const l=this;if(l.focus(),l.selection.enabled&&l.selection.allowCellSelection)l._focusCell(e,t);else{const t=l.rowById[e];if(!t)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e),l._selection.focusedCell={id:t.id,value:null,index:t.index,dataField:l.columns[0].dataField},l.endUpdate(!1)}}_focusCell(e,t){const l=this;if(l.selection.enabled&&l.selection.allowCellSelection){const n=l.rowById[e];if(!n)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e,t);const o=n.getCell(t);o&&(l._selection.focusedCell={id:o.row.id,value:o.value,dataField:t,index:o.row.index}),l.endUpdate(!1)}}_clearSelection(e){const t=this;if(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[],e&&(t._selection.focusedCell=null,t._selection.selectionRect)){const e=t._selection.selectionRect;e.parentNode.removeChild(e);const l={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(l.down="touchstart",l.move="touchmove",l.up="touchend"),document.removeEventListener(l.move,e.onMove),document.removeEventListener(l.up,e.onUp),document.removeEventListener(l.down,e.onDown),t._selection.selectionRect=null}t._recycle(),t._refreshCheckBoxColumnSelection()}_getSelectionCellValues(){const e=this;if(e._selection.selectionRect)return e._selection.selectionRect.cellValues;const t=e.viewColumns;if(e._selection.rows.length>0){let l=[];for(let n in e._selection.rows){const o=e.rowById[n];for(let e=0;e<t.length;e++){const i=t[e];i&&(l[n]||(l[n]=[]),i.autoGenerated||(l[n][i.dataField]=o.data[i.dataField]))}}return l}if(e._selection.columns.length>0){let t=[];for(let l in e._selection.columns){const n=e.columnByDataField[l];if(n)for(let l=0;l<e._recyclingRows.length;l++){const o=e._recyclingRows[l];o&&(t[o.id]||(t[o.id]=[]),t[o.id][n.dataField]=o.data[n.dataField])}}return t}if(e._selection.cells&&Object.keys(e._selection.cells).length>0){const t=e.getSelection();if(t.cells){let e=[];for(let l in t.cells){const n=t.cells[l],o=n.id;e[o]||(e[o]=[]),e[o][n.column.dataField]=n.row.data[n.column.dataField]}return e}}}_clipboardHandler(e,t){const l=this;if(l.clipboard.enabled){if((t.ctrlKey||t.metaKey)&&("c"===e||"x"===e)){const t=l._getSelectionCellValues();let n="",o=Object.keys(t).length,i=0;for(let a in t){let s="",r=Object.keys(t[a]).length,d=0;for(let e in t[a])s+=t[a][e],d++,d<r&&(s+="\t");if(n+=s,i++,i<o&&(n+="\r\n"),"x"===e){const e=l.getSelection();if(e.cells){l.beginUpdate();for(let t=0;t<e.cells.length;t++){const n=e.cells[t],o=l.rowById[n.id];if(o){const e=o.getCell(n.dataField),t=l._pasteDataType({cell:e,value:e.value});let i=null;"int"!==t&&"number"!==t||(i=0),"string"===t&&(i=""),"boolean"!==t&&"bool"!==t||(i=!1),"date"===t&&(i=new Date),e.column.allowNull&&(i=null);const a=e.oldValue;if(l.onCellUpdate)l.onCellUpdate([e],[a],[i],(function(t){t&&(e.value=i)}),l);else if(l.onRowUpdate){const t=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,l.onRowUpdate([e.row.index],[e.row],[t],[n],(function(t){t&&(e.value=i)}),l)}else e.value=i}}l.endUpdate(!1),l._recycle()}}}if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(n).then((function(){}),(function(){})),Smart.Utilities.Core.Browser.Firefox&&(l._clipboardText=n);else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),e.remove(),l._clipboardText=n}),25)}}if(t.shiftKey&&" "===e&&(l._keyboardAdd=!0,l._addNewGridRow(),l._keyboardAddTimer&&clearTimeout(l._keyboardAddTimer),l._keyboardAddTimer=setTimeout((()=>{l._keyboardAdd=!1}),300)),(t.ctrlKey||t.metaKey)&&"v"===e){const e=window.Smart.Utilities.Core.Browser.Firefox;if(navigator.clipboard&&!navigator.clipboard.readText&&!e)return;const t=e=>{if(!e)return;const t=[],n=e.split("\r");for(let e=0;e<n.length;e++){const l=n[e].split("\t");let o={};for(let e=0;e<l.length;e++)o[e]=l[e].trim(),void 0!==o[e]&&"undefined"!==o[e]||(o[e]="");t[e]=o}const o=l._selection.selectionRect;if(o)l._pasteSelectedCells({row:o.row,endRow:o.endDragRow,column:o.column,endColumn:o.endColumn},t);else{let e=null,n=null;for(let t in l._selection.rows){const o=l.rowById[t];e||(e=o),n||(n=o),e.visibleIndex>o.visibleIndex&&(e=o),n.visibleIndex<o.visibleIndex&&(n=o)}if(e&&n&&l._pasteSelectedCells({row:e,endRow:n,column:l.firstColumn(),endColumn:l.lastColumn()},t),0===l._selection.rows.length){const o=l.getSelectedCells();let i=null,a=null;for(let t=0;t<o.length;t++){const s=l.rowById[o[t][0]];if(!s)continue;e||(e=s),n||(n=s);const r=l.columnByDataField[o[t][1]];i||(i=a=r),i&&i.visibleIndex>r.visibleIndex&&(i=r),a&&a.visibleIndex<r.visibleIndex&&(a=r),e.visibleIndex>s.visibleIndex&&(e=s),n.visibleIndex<s.visibleIndex&&(n=s)}l._pasteSelectedCells({row:e,endRow:n,column:i,endColumn:a},t)}}};if(!window.isSecureContext||e)return void t(l._clipboardText);navigator.clipboard.readText().then((e=>{t(e)}))}}}_setRemoveUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){t._removeUndoRedoHigherIndexes();const n=t.getRowData(e.id);t._undoRedo.push({action:"remove",data:n,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_setAddUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){let n=!1;for(let l=0;l<t._undoRedo.length;l++){const o=t._undoRedo[l];"add"===o.action&&o.index===e.index&&(n=!0)}if(n)return;t._removeUndoRedoHigherIndexes();const o=t.getRowData(e.id);t._undoRedo.push({action:"add",data:o,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_removeUndoRedoHigherIndexes(){const e=this,t=e._undoRedoIndex;t>=0?e._undoRedo.splice(t+1,e._undoRedo.length-t):-1===t&&(e._undoRedo=[])}_setCellUndoRedo(e,t,l){const n=this;if(!n.isInitialized)return;const o=Smart.Utilities.Core.createGUID().replace(/-/gi,"");n._setCellUndoRedoTimer&&clearTimeout(n._setCellUndoRedoTimer),n._undoRedoAction||(n._pasteUndoRedoValues||(n._pasteUndoRedoValues=[]),void 0===t&&(t=null),n._pasteUndoRedoValues.push({cell:e,index:e.row.index,dataField:e.column.dataField,oldValue:t,newValue:l}),n._setCellUndoRedoTimer=setTimeout((()=>{delete n._setCellUndoRedoTimer,n._removeUndoRedoHigherIndexes(),n._pasteUndoRedoValues.length>1?n._undoRedo.push({action:"updateMultiple",items:n._pasteUndoRedoValues,uid:o}):n._undoRedo.push({action:"update",index:e.row.visibleIndex,cell:e,dataField:e.column.dataField,oldValue:t,newValue:l,uid:o}),n._undoRedoIndex=n._undoRedo.length-1,n._pasteUndoRedoValues=[]}),50))}_undoRedoHandler(e){const t=this,l=e.key;if(e.ctrlKey||e.metaKey){if("z"===l)return t.undo(),void e.preventDefault();if("y"===l)return t.redo(),void e.preventDefault()}}_updateMultiple(e,t){const l=this;let n=9999999,o=0,i=999999,a=0,s=l._recyclingRows;l.beginUpdate();for(let r=0;r<e.items.length;r++){const d=e.items[r],c=s[d.index];if(c){const e=c.id,s=d.dataField,r=t?d.oldValue:d.newValue,u=l.columnByDataField[s],f=l.viewColumns.indexOf(u);i=Math.min(i,f),a=Math.max(a,f),n=Math.min(n,c.visibleIndex),o=Math.max(o,c.visibleIndex),l.setCellValue(e,s,r)}}l._focusCell(s[n].id,l.viewColumns[i].dataField),l._selectCellsRange(s[n],s[o],l.viewColumns[i].dataField,l.viewColumns[a].dataField),delete l._undoRedoAction,l.endUpdate(!1)}redo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t+1];if(l)switch(e._undoRedoIndex++,e._undoRedoAction=!0,l.action){case"add":e.addRow(l.data,!0);break;case"remove":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.newValue;e.setCellValue(n,o,i),e._focusCell(n,o)}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!1)}else delete e._undoRedoAction}undo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t];if(l)switch(e._undoRedoIndex--,e._undoRedoAction=!0,l.action){case"add":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"remove":{const t=l.data;t&&(e._recyclingRows[l.index]?e.insertRow(t,l.index):e.addRow(t,!0));break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.oldValue;void 0!==(e._cellsUpdatedValues?e._cellsUpdatedValues[n+"_"+o]:void 0)&&delete e._cellsUpdatedValues[n+"_"+o],e.setCellValue(n,o,i),e._focusCell(n,o)}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!0)}else e._currentUndoRedo=e._undoRedo[0],delete e._undoRedoAction}_keyDownHandler(e){const t=this;if("grid"!==t.view)return;if(t.onKey&&(t.onKey(e),e.defaultPrevented))return;let l=e.key;if(t.disabled||t.displayLoadingIndicator)return;if(t._undoRedoHandler(e),0===t.dataSource.length)return;if(t.editing.editRow||t.editing.editCell||t.filtering.filterRow.cell)return;t.rightToLeft&&("ArrowLeft"===l?l="ArrowRight":"ArrowRight"===l&&(l="ArrowLeft")),t._refreshCellSelectionRect();const n=t.getSelection();let o=n.focused;if(!n.focused){if(t.editing.enabled&&!0!==t.editing.isEditing&&("F2"===l||"Enter"===l)&&n.columns&&n.columns.length>0){const e=n.columns[n.columns.length-1];e.column.allowHeaderEdit&&t._beginColumnEdit(e.column)}return void(t.menu&&t.menu.classList.contains("open")&&"Escape"===l&&t.closeMenu())}if(e.shiftKey&&e.ctrlKey&&" "===l){const e=t.rowById[o.id];if(e){const t=e.getCell(o.dataField);if(t)return void t.autoWrap()}}const i=t._getParentCell(t.rowById[o.id],o.dataField);if(i&&("ArrowLeft"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowRight"===l?(o.id=i.row.id,o.dataField=i.endColumn.dataField):"ArrowUp"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowDown"===l&&(o.id=i.endRow.id,o.dataField=i.column.dataField)),t._selection.selectionRect&&e.shiftKey&&!e.ctrlKey&&!e.metaKey?(t._selection.selectionRect.endRow&&(o.id=t._selection.selectionRect.endRow.id),t._selection.selectionRect.endColumn&&(o.dataField=t._selection.selectionRect.endColumn.dataField)):t.selection.allowRowSelection&&!t.selection.allowCellSelection&&void 0!==t._rangeSelectionEndRow&&(o.id=t._rangeSelectionEndRow.id),t._clipboardHandler(l,e),((e.ctrlKey||e.metaKey)&&"x"!==l&&"c"!==l&&"v"!==l&&"Control"!==l||"Tab"===l)&&(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[]),"Escape"===l)return t.closeMenu(),t.cancelEdit(),void t._setSelection(o.id,o.dataField,e);if(t.hasMenu())return;if(e.shiftKey&&"Enter"===l&&t.rowDetail.dialog.enabled&&!t.rowDetail.dialog.visible){const l=t.rowById[o.id];if(l)return l.showDetail=!0,e.preventDefault(),void e.stopPropagation()}if(e.ctrlKey||e.metaKey){let n=!1;"f"===l&&(t.$.headerBar&&t.$.headerBar.openSearchPanel(),n=!0),"s"===l&&(t.$.headerBar&&t.$.headerBar.openSortPanel(),n=!0),"d"===l&&(t.$.headerBar&&t.$.headerBar._openDownloadMenu(),n=!0),"u"===l&&(t.$.headerBar&&t.$.headerBar.openFilterPanel(),n=!0),"w"===l&&(t.$.headerBar&&t.$.headerBar._openViewsMenu(),n=!0),n&&(e.stopPropagation(),e.preventDefault())}if(e.altKey){if("ArrowDown"===l){const l=t.columnByDataField[o.dataField];l&&t.hasColumnMenu(l)&&(l.element._showActionButton(),l.onAction(),t.menu&&t.menu.querySelector("smart-menu").$.dispatch(e))}else"ArrowUp"===l&&t.closeMenu();if("s"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.sorted?"asc"===e.sortOrder?t.sortBy(e.dataField,"desc"):t.sortBy(e.dataField,null):t.sortBy(e.dataField,"asc"))}if("g"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.group=!e.group)}return}const a=function(l,n){const o=(l,n)=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(!0),"many"===t.selection.mode){if(" "===e.key)t._setSelection(l,n,e);else{const e=t.rowById[l].getCell(n);t._selection.focusedCell={id:e.row.id,value:e.value,dataField:n,index:e.row.index}}return t.ensureVisible(l,n),void t._recycle()}t.beginUpdate(),t._setSelection(l,n,e),t.ensureVisible(l,n),t.endUpdate(!1,!1),"ArrowDown"===e.key||"ArrowUp"===e.key?t._recycle(!1,!0):t._recycle(),e.shiftKey?t.__selectionStarted&&!t.__selectionStartedFired?(t.$.fireEvent("change",{started:!0,finished:!1}),t.__selectionStartedFired=!0):t.$.fireEvent("change",{started:!1,finished:!1}):(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())};if(t._isVirtualMode()){t._keyboardNavigationTimer&&clearTimeout(t._keyboardNavigationTimer);const e=e=>{for(let l=0;l<t.rows.length;l++){const n=t.rows[l];if(n.index===e)return n.id}return null},i=l,a=JSON.parse(JSON.stringify(t._selection.focusedCell));t._selection.focusedCell.index=i,t._selection.focusedCell.dataField=n;const s=t.rows[0],r=s.height;if(-1===i)return;const d=t._scrollView.hScrollBar,c="virtual"!==t.scrolling?s.top:i*r;let u=0;if(t.paging.enabled||(c+d.offsetHeight+t.__frozenNearHeight>t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight?(t._scrollView.scrollTop=c-t.$.scrollView.offsetHeight-t.__frozenFarHeight+d.offsetHeight,u=50):c<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=c,u=50)),t._onDataUpdated||(t._onDataUpdated=()=>{t._recycle();const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t.paging.enabled&&(t._selection.focusedCell=a),t._onDataUpdated=null}),t.paging.enabled){const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t._selection.focusedCell=a}else t._keyboardNavigationTimer=setTimeout((()=>{const l=e(t._selection.focusedCell.index);t.rowById[l]&&o(l,t._selection.focusedCell.dataField)}),u)}else requestAnimationFrame((()=>{o(l,n)})),e.stopPropagation(),e.preventDefault()};switch(l){case"Tab":{if("none"===t.selection.tabKeyBehavior)return;const l=e.shiftKey?t.prevColumn(o.dataField):t.nextColumn(o.dataField);if(l&&t.selection.allowCellSelection){const n=t.rowById[o.id].getCell(l.dataField);t._selection.focusedCell={id:n.row.id,value:n.value,dataField:l.dataField,index:n.row.index},t._setSelection(o.id,l.dataField,e),t.ensureVisible(o.id,l.dataField),t.focus(),e.stopPropagation(),e.preventDefault()}else{let l=e.shiftKey?t.prevRow(o.id):t.nextRow(o.id),n=e.shiftKey?t.lastColumn().dataField:t.firstColumn().dataField;if(t.editing.addNewRow.autoCreate&&!e.shiftKey&&o.id===t.lastRow().id&&(t.addUnboundRow(1),l=t.lastRow()),!l)return;e.shiftKey&&(t._selection.focusedCell=null),a(t._isVirtualMode()?l.index:l.id,n)}break}case" ":case"F2":{const n=t.rowById[o.id];if(!n||t.editing.editCell)return;if(e.ctrlKey||e.metaKey)return;if(" "===l&&t.dataSource.boundHierarchy&&(n.checked=!n.checked),t.editing.enabled&&!e.shiftKey){const e=t.getSelectedCells();let i=!1;if(e.length>0){let l=[];for(let n=0;n<e.length;n++){const o=e[n],i=o[1],a=t.columnByDataField[i];!a||"bool"!==a.dataType&&"boolean"!==a.dataType||l.push(o)}if(l.length>0){i=!0,t.beginUpdate();for(let e=0;e<l.length;e++){const n=l[e],o=n[1],i=n[0],a=n[2];t.setCellValue(i,o,!a)}t.endUpdate(!1)}}i||(t._beginEdit(n,o.dataField),setTimeout((function(){if(t.editing.editCell&&t.editing.editCell.column.dataType.indexOf("bool")>=0){const e=t.editing.editCell.editor.instance,n=e.getValue();" "===l&&e.setValue(!n)}}),50))}else t.selection.enabled&&"many"===t.selection.mode&&(t._isVirtualMode()?a(o.index,o.dataField):a(o.id,o.dataField));break}case"Delete":case"Backspace":{const e=t.rowById[o.id];if(!e||t.editing.editCell)return;const i=e.getCell(o.dataField),a=i.value;if(n.cells){t.beginUpdate();for(let e=0;e<n.cells.length;e++){const l=n.cells[e],o=t.rowById[l.id];if(o){const e=o.getCell(l.dataField);if(!e.column.allowEdit)continue;const n=t._pasteDataType({cell:e,value:e.value});let i=null;"int"!==n&&"number"!==n||(i=0),"string"===n&&(i=""),"boolean"!==n&&"bool"!==n||(i=!1),"date"===n&&(i=new Date),e.column.allowNull&&(i=null);const a=e.value;if(t.dataSource&&t.dataSource.virtualDataSource){const l={};l[e.column.dataField]=i,t.updateRow(e.row.id,l)}else if(t._setCellUndoRedo(e,a,i),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]);const n=i;t._pasteTempValues.push({id:e.row.id,cell:e,dataField:l.column.dataField,oldValue:a,newValue:n}),t._pasteTimer&&clearTimeout(t._pasteTimer),t._pasteTimer=setTimeout((()=>{const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1)}}),t)}else t.onCellUpdate([e],[a],[n],(function(t){t&&(l(e,n),e.value=n)}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else e.value=i}}t.endUpdate(!1),t._recycle(),t._refreshDataFilters()}"Backspace"===l&&(t._beginEdit(e,o.dataField),i.canNotify=!1,i.value=a,i.canNotify=!0);break}default:if(t.editing.enabled&&!t.editing.editCell&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!t.editing.editRow){const e=t.rowById[o.id];if(!e)return;if(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)>=0)return;t._beginEdit(e,o.dataField),setTimeout((function(){if(t.editing.editCell)t.editing.editCell.editor.instance.setValue(l);else if(t.editing.editRow){const e=t.editing.editRow.getCell(o.dataField);if(!e)return;e.editor.instance.setValue(l)}}),50)}break;case"Home":{const l=t.firstRow();if(t.paging.enabled&&e.shiftKey)return t.firstPage(),e.stopPropagation(),void e.preventDefault();if(!l)return;a(l.id,o.dataField);break}case"End":{if(t.paging.enabled&&e.shiftKey)return t.lastPage(),e.stopPropagation(),void e.preventDefault();const l=t.lastRow();if(!l)return;a(l.id,o.dataField);break}case"PageUp":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.prevPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.max(o.index-e,0),o.dataField)}else{for(let e=i;e>=0;e--){const i=l[e];if(n.top-i.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.firstRow().id,o.dataField)}break}case"PageDown":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.nextPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.min(o.index+e,t.dataSource.virtualDataSourceLength-1),o.dataField)}else{for(let e=i;e<l.length;e++){const i=l[e];if(i.top-n.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.lastRow().id,o.dataField)}break}case"ArrowDown":case"Enter":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():o.index+1,o.dataField);else{let n=e.ctrlKey||e.metaKey?t.lastRow():t.nextRow(o.id);if(!t.editing.addNewRow.autoCreate||"Enter"!==l||o.id!==t.lastRow().id||e.ctrlKey||e.metaKey||(t.addUnboundRow(1),n=t.lastRow()),!n)return;let i=!0;"Enter"===l&&(e.ctrlKey||e.metaKey)&&(i=!1),i&&a(n.id,o.dataField)}break;case"ArrowUp":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():Math.max(0,o.index-1),o.dataField);else{const l=e.ctrlKey||e.metaKey?t.firstRow():t.prevRow(o.id);if(!l)return;a(l.id,o.dataField)}break;case"ArrowRight":{const l=t.rowById[o.id],n=t.columnByDataField[o.dataField]._treeColumn;if((!t.selection.allowCellSelection||n)&&!1===l.leaf){if(!l.expanded)return l.expand(),e.stopPropagation(),void e.preventDefault();{const e=t.nextRow(o.id);if(e)return void a(e.id,o.dataField)}}const i=e.ctrlKey||e.metaKey?t.lastColumn():t.nextColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}case"ArrowLeft":{const l=t.rowById[o.id],n=t.columnByDataField[o.dataField]._treeColumn;if(!t.selection.allowCellSelection||n){if(!1===l.leaf)return void(l.expanded?(l.collapse(),e.stopPropagation(),e.preventDefault()):l.parent&&a(l.parent.id,o.dataField));if(!0===l.leaf&&l.parent)return void a(l.parent.id,o.dataField)}const i=e.ctrlKey||e.metaKey?t.firstColumn():t.prevColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}}["Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)<0||(e.stopPropagation(),e.preventDefault())}_keyUpHandler(e){const t=this;"Escape"===e.key&&t._dragDrop&&t._endDrag(e),t._focused&&"Shift"===e.key&&(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())}firstRow(){const e=this._recyclingRows;if(this._isVirtualMode())return{id:0};if(e&&e.length>0){if(!e[0].autoGenerated&&e[0].allowSelect)return e[0];for(let t=0;t<e.length;t++)if(!e[t].autoGenerated&&e[t].allowSelect)return e[t]}return null}lastRow(){const e=this,t=e._recyclingRows;if(e._isVirtualMode())return{id:e.dataSource.virtualDataSourceLength-1};if(t&&t.length>0){const e=t[t.length-1];if(!e.autoGenerated&&e.allowSelect)return e;for(let e=t.length-1;e>=0;e--)if(!t[e].autoGenerated&&t[e].allowSelect)return t[e]}return null}nextRow(e){const t=this._recyclingRows,l=this.rowById[e],n=t.indexOf(l);let o=1;if(l&&void 0!==l._rowSpan&&(o=l._rowSpan),n>=0&&t[n+o]&&!t[n+o].autoGenerated){const e=t[n+o];if(e.allowSelect&&!e.disabled)return e;for(let e=n+o;e<t.length;e++){const l=t[e];if(l.allowSelect&&!l.disabled)return l}}return null}_isVirtualMode(){const e=this;return e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling}prevRow(e){const t=this,l=t._recyclingRows,n=t.rowById[e],o=l.indexOf(n);if(t._isVirtualMode())return 0===e?null:{id:n.index-1};if(o>=0&&l[o-1]&&!l[o-1].autoGenerated){const e=l[o-1];if(e.allowSelect&&!e.disabled)return e;for(let e=o-1;e>=0;e--){const t=l[e];if(t.allowSelect&&!t.disabled)return t}}return null}firstColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=0;t<e.length;t++){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}lastColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=e.length-1;t>=0;t--){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}nextColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n<t.length;){const e=t[n+1];if(e.autoGenerated)return null;if(e.visible)return e;n++}return null}prevColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n>0;){const e=t[n-1];if(e.autoGenerated)return null;if(e.visible)return e;n--}return null}isVisible(e,t){const l=this,n=l._scrollView.vScrollBar,o=l._scrollView.hScrollBar,i=l.rowById[e],a=l.columnByDataField[t];return{row:function(e){if(!e)return!1;const t=e.visibleIndex;if(-1===t)return!1;const n=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&l.dataSource.length>l.virtualModeCachedRowsCount&&"infinite"!==l.scrolling;let i=e.top;return n&&(i=t*l.rows[0].height),!(i+e.height+o.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight||i<=l._scrollView.scrollTop)}(i),column:function(e){return!!t&&!(-1===e.visibleIndex||e.left+e.computedWidth+n.offsetWidth>=l._scrollView.scrollLeft+l._clientSize.width||e.left<=l._scrollView.scrollLeft)}(a)}}_ensureRowVisible(e){const t=this;if(!t._scrollView)return;const l=t._scrollView.hScrollBar;if(!e)return;const n=e.visibleIndex;if(-1===n)return;const o="virtual"!==t.scrolling?e.top:n*t.rows[0].height,i=t.summaryRow.visible?t.layout.rowMinHeight:0;if(o+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight-i&&(t._scrollView.scrollTop=o+e.height-t.$.scrollView.offsetHeight+t.__frozenNearHeight+t.__frozenFarHeight+l.offsetHeight+i),o<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=o),t.paging.enabled){const o=t.paging.pageSize,i=Math.floor(n/o);if(t.paging.pageIndex!==i)return t.goToPage(i),t._scrollView.scrollTop=0,void setTimeout((()=>{e.top+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight&&(t._scrollView.scrollTop=e.top+e.height),e.top<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=e.top)}),50)}0===n?t._scrollView.scrollTop=0:n===t.dataSource.length-1&&(t._scrollView.scrollTop=t._scrollView.scrollHeight)}_ensureColumnVisible(e){const t=this,l=t._scrollView.vScrollBar;if(!e)return;const n=e.visibleIndex;-1!==n&&(e.left+e.computedWidth+l.offsetWidth>=t._scrollView.scrollLeft+t._clientSize.width&&(t._scrollView.scrollLeft=t._scrollView.scrollLeft+e.computedWidth),e.left<=t._scrollView.scrollLeft&&(t._scrollView.scrollLeft=e.left),0===n?t._scrollView.scrollLeft=0:n===t.columns.length-1&&(t._scrollView.scrollLeft=t._scrollView.scrollWidth))}ensureVisible(e,t){const l=this,n=l.rowById[e],o=l.columnByDataField[t];if("virtual"===l.scrolling){const e=l._scrollView.hScrollBar,t=n.visibleIndex*l.rows[0].height,i=l.summaryRow.visible?l.layout.rowMinHeight:0;return t+n.height+e.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight-i&&l.setVerticalScrollValue(t),void l._ensureColumnVisible(o)}l._ensureRowVisible(n),l._ensureColumnVisible(o)}clearSelection(){const e=this;delete e._rangeSelectionStartRow,delete e._rangeSelectionEndRow,e._clearSelection(!0),e.$.fireEvent("change",{started:!1,finished:!0}),e._refreshSummary()}});
|
|
59
|
-
(()=>{Smart.Utilities.Assign("Grid.Edit",class{_renderCommandBar(){const e=this,t=e.editing.commandBar.dataSource,i="icon"!==e.editing.commandBar.displayMode,n="label"!==e.editing.commandBar.displayMode,o=o=>{for(let l in t){const a=t[l],d=document.createElement("div");d.classList.add("smart-grid-command-item"),d.label=e.localize(l);const r=d.label;let s="";n&&i?(s+='<span class="smart-grid-icon '+a.icon+'"></span>',s+='<span class="smart-grid-label">'+r+"</span>"):n&&!i?s+='<span title="'+r+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(s+='<span class="smart-grid-label">'+r+"</span>"),d.innerHTML=s,a.visible||d.classList.add("smart-hidden"),d.command=a.command,d.onclick=function(){const t=d.command;e._applyCommand(t,[])},o.appendChild(d)}};e.editing.enabled&&e.editing.commandBar.visible&&(e.$.headerCommandBar.innerHTML="",e.$.footerCommandBar.innerHTML="","far"!==e.editing.commandBar.position&&o(e.$.headerCommandBar),"near"!==e.editing.commandBar.position&&o(e.$.footerCommandBar))}commandKeyEditCommand(){const e=this;if(e._selection&&e._selection.focusedCell&&void 0!==e._selection.focusedCell.id){const t=e.rowById[e._selection.focusedCell.id];e.beginEdit(t.id)}}commandKeyCancelCommand(){this.cancelEdit()}commandKeyUpdateCommand(){this.endEdit()}commandColumnMenuCommand(){this._openColumnChooserMenu(this._commandColumn)}commandColumnEditCommand(e){this.beginEdit(e.id)}commandColumnUpdateCommand(){this.endEdit()}commandColumnRowMenuCommand(){}commandColumnCancelCommand(e){const t=this;if(t.editing.batch){const i=t._rowsDeleted?t._rowsDeleted.indexOf(e):-1;i>=0&&t._rowsDeleted.splice(i,1);for(let i=0;i<t.columns.length;i++){const n=t.columns[i].dataField;t._cellsUpdatedValues&&t._cellsUpdatedValues[e.id+"_"+n]&&(delete t._cellsUpdatedValues[e.id+"_"+n],t._cellsUpdatedValues.length--)}t._recycle(!1)}t.cancelEdit()}commandColumnDeleteCommand(e){this.deleteRow(e.id)}_renderAddNewRow(){const e=this;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[];const t=new Smart.Grid.Row({data:{},index:-1,grid:e,freeze:"near",visible:"far"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0}),i=new Smart.Grid.Row({data:{},index:-2,grid:e,freeze:"far",visible:"near"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0});if(e._newNearRow){const t=e._frozenNearRows.indexOf(e._newNearRow);if(t>=0&&(e._frozenNearRows.splice(t,1),e.$.rowNearContainer.children.length>0)){const t=e.$.rowNearContainer.children[0];t.parentNode.removeChild(t)}}if(e._newFarRow){const t=e._frozenFarRows.indexOf(e._newFarRow);if(t>=0&&(e._frozenFarRows.splice(t,1),e.$.rowFarContainer.children.length>0)){const t=e.$.rowFarContainer.children[e.$.rowFarContainer.children.length-1];t.parentNode.removeChild(t)}}e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode&&(e._frozenNearDefaultRows.push(t),e._frozenFarDefaultRows.push(i),e._frozenNearRows.splice(0,0,t),e._frozenFarRows.push(i));const n=()=>{e.editing.addNewRow.autoCreate&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e.addUnboundRow(1),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),"button"===e.editing.addNewRow.displayMode&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e._add({}),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max)};if(e._addRowOnButtonClickHandler||(e._addRowOnButtonClickHandler=n),e._scrollView&&e._scrollView.vScrollBar&&(e._scrollView.vScrollBar.$.farButton.removeEventListener("click",e._addRowOnButtonClickHandler),e._scrollView.vScrollBar.$.farButton.addEventListener("click",e._addRowOnButtonClickHandler)),e._newNearRow=t,e._newFarRow=i,e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){if(!e._newNearRow.element){const t=e._newNearRow,i=t.createElement();t.visible="far"!==e.editing.addNewRow.position,t.element=i,e.$.rowNearContainer.children.length>0?e.$.rowNearContainer.insertBefore(i,e.$.rowNearContainer.children[0]):e.$.rowNearContainer.appendChild(i)}if(!e._newFarRow.element){const t=e._newFarRow,i=t.createElement();t.visible="near"!==e.editing.addNewRow.position,t.element=i,e.$.rowFarContainer.children.length>0?e.$.rowFarContainer.insertBefore(i,e.$.rowFarContainer.children[0]):e.$.rowFarContainer.appendChild(i)}}}_insertNewRowAfter(e){return this._insertNewRowBefore(e,!0)}_insertNewRowBefore(e,t=!1){const i=this,n=new Smart.Grid.Row({index:t?0:-1,id:Smart.Utilities.Core.createGUID(),grid:i}),o={};for(let e=0;e<i.columns.length;e++){const t=i.columns[e];void 0!==t.defaultValue&&(o[t.dataField]=t.defaultValue)}n.data=o;const l=function(t,n){i._suppressSort=i._suppressFilter=!0;const o=e=>{i._supressEnter=!0,i.scrollTop=n?i.scrollHeight:0,i.editing.addDialog.enabled||setTimeout((function(){if(i.editing.enabled&&i.editing.addNewRow.autoEdit){i.ensureVisible(e.id);let t=null;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=()=>{i._selection.focusedCell={id:e.id,dataField:t,index:e.index},i._selection.rows=[],i._selection.columns=[],i._selection.cells=[],i._setSelection(e.id,t)};i.paging.enabled?setTimeout((()=>{if(!e.element){const t=e.createElement();e.element=t}n(),i._beginEdit(e)}),200):(n(),i._beginEdit(e))}}),100),i._suppressSort=i._suppressFilter=!1};!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("add")>=0?(i._batchAddRow(t,n?i.rows.length:0),o(t),e&&e(t)):i.addRow(t.data,n,(t=>{o(t),e&&e(t)}))}.bind(this);return i.editing.addDialog.enabled?i._openAddRowDialog(n,l):l(n,t),!0}commandBarBatchSaveCommand(){this._saveBatchEdit()}commandBarAddRowCommand(){this._insertNewRowAfter()}commandBarAddTopRowCommand(){this._insertNewRowBefore()}commandBarDeleteRowCommand(){const e=this;let t=1,i=e.rows[e.rows.length-t];for(e._rowsDeleted||(e._rowsDeleted=[]);e._rowsDeleted.indexOf(e.rows[e.rows.length-t])>=0;)t++;if(i=e.rows[e.rows.length-t],e.selection.enabled)if(e.selection.allowCellSelection){const t=e.getSelectedCells();if(t.length>0){const n=t[0][0];i=e.rowById[n]}}else{const t=e.getSelectedRowIds();t.length>0&&(i=e.rowById[t[0]])}i&&e.commandColumnDeleteCommand(i)}commandBarBatchRevertCommand(){this.revertBatchEdit()}_beginEdit(e,t){const i=this;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=i.columnByDataField[t];if(i.editing.allowColumnHeaderEdit&&!e&&n)return void i._beginColumnEdit(n);if(!e||!n||n&&n.autoGenerated)return!1;const o=e.getCell(t);if(!o)return!1;i.$.fireEvent("beginEdit",{id:e.id,dataField:n.dataField,row:e,column:n,cell:o,data:o.row.data,value:o.value}).defaultPrevented||("cell"===i.editing.mode?i._beginCellEdit(o):"row"===i.editing.mode&&i._beginRowEdit(e,o))}_saveUnboundRows(e){const t=this;if(t._unboundRows&&t._unboundRows.length>0&&t.editing.addNewRow.autoSave){const i=t.rowById[e];if(!i.unbound)return;const n=t._unboundRows.indexOf(i);if(n<0)return;const o=n+1;t.beginUpdate();for(let e=0;e<o;e++){const i=t._unboundRows[e];if(!i)continue;delete t.rowById[i.id],i.unbound=!1;let n=!1;t._selection.focusedCell&&t._selection.focusedCell.id===i.id&&(n=!0),t._nearRowsAdded&&t._nearRowsAdded.indexOf(i)>=0?(t._nearRowsAdded.splice(t._nearRowsAdded.indexOf(i),1),t._add(0,i.data),n&&(t._selection.focusedCell.id=t.rows[0].id,t._selection.focusedCell.index=t.rows[0].index)):t._farRowsAdded&&t._farRowsAdded.indexOf(i)>=0&&(t._farRowsAdded.splice(t._farRowsAdded.indexOf(i),1),t._add(i.data),n&&(t._selection.focusedCell.id=t.rows[t.rows.length-1].id,t._selection.focusedCell.id=t.rows[t.rows.length-1].index))}t._unboundRows.splice(0,o),t.endUpdate()}}_validateCell(e,t,n){const o=this;if(o._errorOverlay&&(o._errorOverlay.remove(),o._errorMessage.remove(),o._isUpdating=!1),e.column.validationRules||n||e.column.editor&&e.column.editor.onValidate){let l={},a=e._updating;if(e._updating=!0,e.error="",n){for(let i in n)n[i]&&"valid"!==i&&(e.error=n.message),"custom"===i&&n[i].minLength?e.error=o.localize("invalidCellValue",{value:t,validationRule:"minLength: "+n[i].value}):"custom"===i&&n[i].maxLength&&(e.error=o.localize("invalidCellValue",{value:t,validationRule:"maxLength: "+n[i].value}));e.error&&(o._isUpdating=!0)}for(let n of e.column.validationRules){switch(n.type){case"min":l.min=i.min(t,n.value);break;case"max":l.max=i.max(t,n.value);break;case"minLength":l.minLength=i.minLength(t,n.value);break;case"maxLength":l.maxLength=i.maxLength(t,n.value);break;case"minDate":l.minDate=i.minDate(t,n.value);break;case"maxDate":l.maxDate=i.maxDate(t,n.value);break;case"required":l.required=i.required(t);break;case"requiredTrue":l.requiredTrue=i.requiredTrue(t);break;case"pattern":l.pattern=i.pattern(t,n.value);break;case"email":l.email=i.email(t);break;case"null":l.null=i.null(t)}l[n.type]&&(n.message?e.error=n.message:e.error=o.localize("invalidCellValue",{value:t,validationRule:void 0!==n.value?n.type+": "+n.value:n.type}),e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""),o.clearSelection())}if(e.column.editor&&e.column.editor.onValidate){const i=e.column.editor.onValidate(t,e.row.data);"string"==typeof i&&(e.error=i,e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""),o.clearSelection())}if(e._updating=a,e.error){o._errorOverlay=o._createOverlay(),o._errorOverlay.onpointerdown=function(){o.endEdit()};const t=document.createElement("div");t.innerHTML=e.error,t.classList.add("smart-grid-validation-error");const i=o.offset(e.element),n=e.element.getBoundingClientRect(),l=o.offset(o);return i.left=i.left-l.left,i.top=i.top-l.top,i.top+n.height+5-o.offsetTop>o.offsetHeight?t.style.top=i.top-n.height-5-o.offsetTop+"px":t.style.top=i.top+n.height+5-o.offsetTop+"px",t.style.left=i.left-o.offsetLeft+"px",o._errorMessage=t,o.$.root.appendChild(o._errorOverlay),o.$.root.appendChild(o._errorMessage),!1}o._isUpdating=!1}return!0}_endCellEdit(e){const t=this,i=e||t.editing.editCell;if(!i||i&&!i.isEditing)return null;let n=t._getEditorValue(i),o=null;n&&n.error&&(i.canNotify=!1,i.element.setAttribute("error",""),i.row.element.setAttribute("error",""),i.error=!0,i.canNotify=!0,o=n.validity,n=n.value);const l=function(e,t){return"date"===i.column.dataType?e&&t?e.valueOf()===t.valueOf():!e&&!t:!("any"!==i.column.dataType||void 0===e||void 0===t||!Array.isArray(e)||0!==e.length||""!==t)||e===t},a=function(){const e=t._getEditorId(i);t._cellEditors[e].detach(),i.row.element.removeAttribute("edit"),i.element&&(i.element.removeAttribute("editor"),i.element.removeAttribute("error")),i.row.element.removeAttribute("error"),i.isEditing=!1,i.element&&(i.element.content.innerHTML="");const o=function(){t.editing.editRow||(t.dataSource&&t.dataSource.boundHierarchy?(t.dataSource.refreshHierarchy(),t._refreshRowHierarchy(),t.refresh()):t.layout.allowCellsWrap?t.refresh():t._recycle(!1))},a=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,d=void 0!==a?a:i.value,r=()=>{if(t._fireEndEdit){let e=i.value;if(t.editing.batch&&i.row&&i.column){const t=i.modifiedValue;void 0!==t&&(e=t)}t.$.fireEvent("endEdit",{id:i.row.id,dataField:i.column.dataField,row:i.row,column:i.column,cell:i,data:i.row.data,value:e}),t._fireEndEdit=!1}};if(l(n,d))r(),t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1,o());else{const e=function(){t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1),delete t._editInfo};if(!0===t.editing.batch||t.editing.batch&&t.editing.batch.indexOf("update")>=0)e(),t._batchUpdateCell(i.row,i.column,n,i.value),o(),r();else{const l=function(){e(),i._updating=!0,i.value=n,i._updating=!1,o(),r()};if(!t.editing.editRow&&t.dataSource&&t.dataSource.virtualDataSource){const e={};e[i.column.dataField]=n,t.updateRow(i.row.id,e,(()=>{l()}))}else l()}}return t.editing.commandColumn.visible&&!t.editing.commandColumn.width&&"cell"===t.editing.mode&&t.refresh(),t.focus(),!0};let d=t._validateCell(i,n,o);if(!d)return i.editor.instance&&!i.editor.autoOpen&&setTimeout((()=>{i.editor.instance.focus()}),50),!1;const r=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,s=void 0!==r?r:i.value;if(l(n,s))return a(),!!d;if(t._setCellUndoRedo(i,s,n),t.onCellUpdate&&!t.editing.editRow){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e),t.onCellUpdate([i],[s],[n],(function(o){o?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[s],[n],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,s,n)}),t)}else if(t.onRowUpdate){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e);const o=i.column.dataField,l=Object.assign({},i.row.data),d=Object.assign({},i.row.data);d[o]=n,t.onRowUpdate([i.row.index],[i.row],[l],[d],(function(n){n?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onRowUpdated&&t.onRowUpdated([i.row.index],[i.row],[i.row.data],t),t._onRowUpdated&&t._onRowUpdated(i.row.index,i.row,i.row.data)}),t)}else a();return!!d}_endRowEdit(){const e=this,t=e.editing.editRow;if(!t)return!1;let i=!0;const n=t.cells;let o={},l={};t.element.removeAttribute("error");for(let a=0;a<n.length;a++){const d=n[a];let r=e._getEditorValue(d),s=null;r&&r.error&&(d.canNotify=!1,d.element.setAttribute("error",""),d.row.element.setAttribute("error",""),d.error=!0,d.canNotify=!0,s=r.validity,r=r.value),o[d.column.dataField]=d.value,l[d.column.dataField]=r;if(!e._validateCell(d,r,s))return i=!1,t.element.setAttribute("error",""),e._isUpdating=!0,d.editor.instance&&setTimeout((()=>{d.editor.instance.focus()}),50),!1}if(i){const i=function(){const i=e._fireEndEdit;e._fireEndEdit=!1;for(let t=0;t<n.length;t++){const i=n[t];e._endCellEdit(i)}e._fireEndEdit=i,e.onRowUpdate||null===e.onRowUpdated||e.onRowUpdated([t.index],[t],[t.data],e),e.editing.isEditing=!1,e.editing.editRow=null,e.editing.commandColumn.visible&&!e.editing.commandColumn.width?e.refresh():e._recycle(!1)};if(!0===e.editing.batch||e.editing.batch&&e.editing.batch.indexOf("update")>=0)i();else if(e.onRowUpdate){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const n=e._createOverlay();e.$.root.appendChild(n);const a=e.onRowHistory;e.onRowHistory=null,t.updatedDate=new Date,t.updatedBy=e.currentUser,e.storeHistory&&e._updateRowHistory(t,o,l),setTimeout((()=>{e.onRowHistory=a}),100),e.onRowUpdate([t.index],[t],[o],[l],(function(o){const l=e.onRowUpdate,a=e.onCellUpdate;e.onRowUpdate=null,e.onCellUpdate=null,o?i():e.cancelEdit(),e.onRowUpdate=l,e.onCellUpdate=a,e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),n.parentNode.removeChild(n),e.endUpdate(),e.onRowUpdated&&e.onRowUpdated([t.index],[t],[t.data])}),e)}else if(e.dataSource&&e.dataSource.virtualDataSource&&e.editing.isEditing){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const t=e._createOverlay();e.$.root.appendChild(t);let n=Object.assign({},e.editing.editRow.data);for(let t=0;t<e.editing.editRow.cells.length;t++){const i=e.editing.editRow.cells[t];if(!i.column.allowEdit)continue;const o=e._getEditorValue(i);void 0!==o&&(n[i.column.dataField]=o)}e._editInfo={row:n},e._virtualDataRequest("update",(function(n){n?i():e.cancelEdit(),e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),t.parentNode.removeChild(t),e.endUpdate()}))}else i();return!0}return e.focus(),!1}_batchDeleteRow(e){const t=this;t._rowsDeleted||(t._rowsDeleted=[]),t._rowsDeleted.push(e.id),t._recycle(!1)}_batchAddRow(e,t){const i=this;i._rowsAdded||(i._rowsAdded=[]),i._rowsAdded.push(e.id),i.rowById[e.id]=e,e.index=i.rows.length+(i._rowsAdded?i._rowsAdded.length:0),0===t?i._nearRowsAdded.splice(0,0,e):i._farRowsAdded.push(e);i.isInitialized&&i._rowElements&&i._rowElements.length<i.rows.length+i._rowsAdded.length&&i._initializeRowElements(),i.refresh()}_batchUpdateCell(e,t,i,n){const o=this;o._cellsUpdatedValues||(o._cellsUpdatedValues=[]);!function(e,i){return"date"===t.dataType?!(!e&&i)&&(!(e&&!i)&&e.valueOf()===i.valueOf()):e===i}(i,n)?o._cellsUpdatedValues[e.id+"_"+t.dataField]=i:delete o._cellsUpdatedValues[e.id+"_"+t.dataField],o._cellsUpdatedValues.length++}_saveBatchEdit(){const e=this;for(let t in e._cellsUpdatedValues){const i=e._cellsUpdatedValues[t],n=t.substring(0,t.indexOf("_")),o=t.substring(t.indexOf("_")+1),l=e.rowById[n],a=l.getCell(o);if(e.dataSource.virtualDataSource){const t={};t[a.column.dataField]=i,l.data.$&&l.data.$.id?e.updateRow(l.data.$.id,t):(a._updating=!0,a.value=i,a._updating=!1)}else a._updating=!0,a.value=i,a._updating=!1}const t=e._rowsDeleted&&e._rowsDeleted.length>0||e._rowsAdded&&e._rowsAdded.length>0;if(t&&e.beginUpdate(),e._rowsAdded&&e._rowsAdded.length>0)for(let t in e._rowsAdded){const i=e._rowsAdded[t],n=e.rowById[i];if(n){if(e._rowsDeleted&&e._rowsDeleted.length>0){let t=!1;for(let n=0;n<e._rowsDeleted.length;n++){if(e._rowsDeleted[n].id===i){t=!0;break}}if(t)continue}e.dataSource.virtualDataSource?e.addRow(n.data,!0):e._nearRowsAdded.indexOf(n)>=0?e.rows.splice(0,0,n):e._farRowsAdded.indexOf(n)>=0&&e.rows.push(n)}}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const i=e._rowsDeleted[t],n=e.rowById[i];if(n)if(e.dataSource&&e.dataSource.virtualDataSource)e._editInfo={row:n.data},e._virtualDataRequest("remove",(function(t){if(t){const t=e.rows.indexOf(n);e.rows.splice(t,1),delete e.rowById[n.id]}}));else{const t=e.rows.indexOf(n);e.rows.splice(t,1)}}t&&e.endUpdate(),e._clearBatchEdit(!1),e.$.fireEvent("saveBatchEdit")}_clearBatchEdit(){const e=this;let t=!1;e._rowsAdded&&e._rowsAdded.length>0&&(t=!0),e._cellsUpdatedValues=[],e._rowsAdded=[],e._rowsDeleted=[],e._nearRowsAdded=[],e._farRowsAdded=[],t?e.refresh():e._recycle(!1),e.$.fireEvent("clearBatchEdit")}_getEditorId(e){const t=e.column._editorId?e.column._editorId:"";return e.editor!==e.column.editor?e.editor.template+"_"+e.column.dataField+"_"+e.row.id+t:e.editor.template+"_"+e.column.dataField+t}_applyCommand(e,t){const i=this;t||(t=[]);const n=function(){"function"==typeof e?e.apply(i,t):i[e]?i[e].apply(i,t):Smart[e]?Smart[e].apply(i,t):window[e]&&window[e].apply(i,t)};if(i.onCommand){t||(t=[]),t[1]||(t[1]=null);const o={name:e,command:n,details:t[0],event:t[1],handled:!1};setTimeout((()=>{i.onCommand.apply(i,[o]),o.handled||n()}),200)}else n()}_getCommandColumnCommandsTemplate(){const e=this,t=e.editing.commandColumn.dataSource,i="icon"!==e.editing.commandColumn.displayMode,n="label"!==e.editing.commandColumn.displayMode;let o="";for(let l in t){const a=t[l];let d="<div",r=!1;if("commandColumnMenu"===l)continue;r||(d+=' item="'+l+'" command="'+a.command+'" class="smart-grid-command-item">',r=!0);const s="{{messages}}"===a.label?e.localize(l):a.label;n&&i?(d+='<span class="smart-grid-icon '+a.icon+'"></span>',d+='<span class="smart-grid-label">'+s+"</span>"):n&&!i?d+='<span title="'+s+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(d+='<span class="smart-grid-label">'+s+"</span>"),d+="</div>",o+=d}return o}_updateCommandColumnCommandsVisibility(e,t){const i=this,n=e.children,o=i.editing.commandColumn.dataSource;for(let e=0;e<n.length;e++){const l=n[e],a=l.getAttribute("item"),d=o[a].visible;!0===d?l.classList.remove("smart-hidden"):!1===d?l.classList.add("smart-hidden"):"auto"===d&&(!i.editing.dialog.enabled&&(i.editing.editRow===t||i.editing.editCell&&i.editing.editCell.row===t)?"commandColumnEdit"===a?l.classList.add("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.remove("smart-hidden"):"commandColumnEdit"===a?l.classList.remove("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.add("smart-hidden"))}}_handleEditKeyDown(e){const t=this,i=e.key,n=t.editing.commandKeys;if(!t.editing.dialog.enabled)for(let o in n){const l=n[o],a=l.key.replace(/ /gi,"").split("|");if(("Tab"!==i||!t.editing.editRow)&&a.indexOf(i)>=0){if(t._applyCommand(l.command),"Enter"===i&&e){if(e.stopPropagation(),t._supressEnter)return void delete t._supressEnter;t.selection.enabled&&t.selection.allowCellSelection&&t._keyDownHandler(e)}break}}}_getCustomCellEditor(e){const t=this;e.editor.selector=e.editor.template,e.editor.template="custom";const i=t._getEditorId(e);if(!t._cellEditors[i]){let n=document.createElement("div");t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){const t=e.editor.instance.element.firstElementChild;Smart.Utilities.Core.isMobile||(e.editor.focus?setTimeout((function(){e.editor.focus.apply(e.editor.instance.element,[])}),50):setTimeout((function(){t.focus()}),50))},a=function(t){const i=e.editor.instance.element.firstElementChild;e.editor.blur?e.editor.blur.apply(e.editor.instance.element,[t]):i.blur()},d=function(t){const i=e.editor.instance.element.firstElementChild;if(!e.editor.isInitialized&&e.editor.settings&&i)for(let t in e.editor.settings)i[t]=e.editor.settings[t];if(e.editor.setValue)e.editor.setValue.apply(e.editor.instance.element,[t]);else{if(i.innerHTML.indexOf("{{")>=0){const n=i.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,e.row.id);i.innerHTML=n}i.value=t,t instanceof Date&&(i.value=t.toISOString().split("T")[0]),e.editor.instance.element.value=i.value}},r=function(){const t=e.editor.instance.element.firstElementChild;if(e.editor.getValue){const i=t.querySelector("input");return i&&i.blur(),e.editor.getValue.apply(e.editor.instance.element,[t.value])}const i=t.value;return e.editor.settings&&e.editor.settings.valueProperty?i?Array.isArray(i)&&i.length>0?i[0][e.editor.settings.valueProperty]:i[e.editor.settings.valueProperty]:"":i||""},s=function(){n.removeEventListener("keydown",o),e.editor.detach&&e.editor.detach.apply(n,[])},c=function(){n.addEventListener("keydown",o),e.editor.attach&&e.editor.attach.apply(n,[])};let u=null;if((e.editor.selector.startsWith("#")||e.editor.selector.startsWith("."))&&(u=document.querySelector(e.editor.selector)),u)n.appendChild(u.content.cloneNode(!0).firstElementChild);else{const i=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e.editor.selector);if(i){if("#text"===i.nodeName)return t._getInputCellEditor(e);n.appendChild(i)}}t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getSliderCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=document.createElement("input"),l=document.createElement("div"),a=document.createElement("smart-number-input");if(o.type="range",o.step="0.01",t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(a.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);a.numberFormat=i}e.editor.min&&(o.min=a.min=e.editor.min),e.editor.max&&(o.max=a.max=e.editor.max),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-slider-cell-editor"),l.classList.add("nav"),a.classList.add("smart-flex"),a.style.paddingLeft="6px",l.classList.add("smart-icon-resize-full","smart-grid-icon");const d=function(e){if("keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey))return l.click(),void e.preventDefault()};l.onclick=function(){const i=document.createElement("div"),n=document.createElement("input");n.type="range";const d=e.editor.instance.element,r=document.createElement("div");r.classList.add("smart-slider-editor"),i.setAttribute("theme",t.theme),r.appendChild(n);const s=Smart.Utilities.Core.createGUID().replace(/-/gi,"");i.id="Slider"+s,d.setAttribute("aria-owns",i.id),r.classList.add("smart-grid-slider-container"),n.value=o.value,o.min&&(n.min=o.min),o.max&&(n.max=o.max),l.sliderEditorDialog=i,l.popupSlider=n,n.onchange=n.oninput=function(){a.value=parseFloat(n.value)};const c=e=>{e&&e.key&&("Enter"===e.key&&(i.parentNode.removeChild(i),o.value=parseFloat(n.value),t.endEdit()),"Escape"===e.key&&(i.parentNode.removeChild(i),t.cancelEdit()))};a.onchange=a.onkeyup=e=>{n.value=a.value,c(e)},n.onkeydown=function(e){c(e)},i.classList.add("smart-grid-slider-dialog"),i.appendChild(r),document.body.appendChild(i),i.style.top=t._offsetTop(d)+d.offsetHeight+"px",i.style.left=t._offsetLeft(d)+15+d.offsetWidth-i.offsetHeight+"px",i.style.width=d.offsetWidth+"px";const u=t._offsetLeft(t)+t.offsetWidth;t._offsetLeft(d)+i.offsetWidth>u&&(i.style.left=u-i.offsetWidth-10+"px")};let r=e.value;void 0===r&&(r=0),a.value=r,o.value=r,n.appendChild(a);const s=e=>{"Escape"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),t.cancelEdit()),"Enter"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),o.value=parseFloat(a.value),t.endEdit())};return t._cellEditors[i]={element:n,focus:function(){l.click(),Smart.Utilities.Core.isMobile||setTimeout((function(){a.focus(),t.$.scrollView.scrollTop=0}),50)},blur:function(){},setValue:function(e){o.value=void 0!==e&&""!==e?parseFloat(e):0,a.isReady&&a.setValue(e)},getValue:function(){const e=parseFloat(o.value);return l.sliderEditorDialog&&l.sliderEditorDialog.parentNode?(o.value=parseFloat(l.popupSlider.value),o.value):e},attach:function(){o.addEventListener("keydown",d),a.addEventListener("keydown",s)},detach:function(){o.removeEventListener("keydown",d),a.removeEventListener("keydown",s),l.sliderEditorDialog&&l.sliderEditorDialog.parentNode&&(o.value=l.popupSlider.value,l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog))}},t._cellEditors[i]}_getTextAreaCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=document.createElement("textarea"),l=document.createElement("div");t._applyCellEditorUserSettings(n,e),o.style.direction="",t.rightToLeft&&(o.style.direction="rtl"),e.editor.min&&(o.minLength=e.editor.min),e.editor.max&&(o.maxLength=e.editor.max),o.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-text-area-cell-editor"),l.classList.add("nav"),l.classList.add("smart-icon-resize-full","smart-grid-icon");const a=function(e){if("keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey))return l.click(),void e.preventDefault()};l.onclick=function(){const n=document.createElement("div"),a=document.createElement("textarea"),d=e.editor.instance.element,r=document.createElement("div"),s=document.createElement("smart-scroll-bar");n.id="TextArea"+i,d.setAttribute("aria-owns",n.id),t.rightToLeft&&(a.style.direction="rtl"),s.orientation="vertical",s.onpointerdown=e=>{e.preventDefault(),e.stopPropagation()},n.setAttribute("theme",t.theme),r.appendChild(a),r.classList.add("smart-grid-text-area-container"),r.appendChild(s),a.value=o.value,a.classList.add("smart-input"),o.minLength>=0&&(a.minLength=o.minLength),o.maxLength>=0&&(a.maxLength=o.maxLength),l.textAreaEditorDialog=n,l.popupTextArea=a;const c=function(){s.value=a.scrollTop,s.max=a.scrollHeight-a.offsetHeight,s.onChange=null,a.offsetHeight>=a.scrollHeight?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),s.onChange=function(){a.scrollTop=s.value}};if(a.onkeyup=function(){c()},a.onscroll=function(){c()},a.onkeydown=function(e){if(a._key=e.key,"Escape"===e.key){try{n.parentNode.contains(n)&&n.parentNode.removeChild(n)}catch(e){n.error=e}t.editing.editCell&&t.cancelEdit()}("Tab"===e.key||"Enter"===e.key&&e.shiftKey)&&(o.value=a.value,t.editing.editCell?t.endEdit():a.blur(),e.preventDefault(),e.stopPropagation())},n.classList.add("smart-grid-text-area-dialog"),n.appendChild(r),document.body.appendChild(n),setTimeout((function(){Smart.Utilities.Core.isMobile||a.select(),c()}),50),c(),n.style.top=t._offsetTop(d)+"px",n.style.left=t._offsetLeft(d)+"px",n.style.width=d.offsetWidth+"px",t.grouping.enabled&&e.column._treeColumn){const e=d.parentNode.parentNode;n.style.top=t._offsetTop(e)+"px",n.style.left=t._offsetLeft(e)+"px",n.style.width=e.offsetWidth+"px"}a.onblur=()=>{"Escape"!==a._key&&(o.value=l.popupTextArea.value),o.focus();try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}},n.appendChild(o);return t._cellEditors[i]={element:n,focus:function(){l.click()},blur:function(){},setValue:function(e){o.value=e,l.popupTextArea&&(l.popupTextArea.value=o.value)},getValue:function(){const e=o.value;return l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode?(o.value=l.popupTextArea.value,o.value):e},attach:function(){o.addEventListener("keydown",a)},detach:function(){if(o.removeEventListener("keydown",a),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode){o.value=l.popupTextArea.value;try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}}},t._cellEditors[i]}_getColorInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=t._getColorInput();t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-color-input-cell-editor"),n.dropDownWidth=50,n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.rightToLeft=!0);const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(e){n.value=e},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("input");t._applyCellEditorUserSettings(n,e),e.editor.min&&(n.minLength=e.editor.min),e.editor.max&&(n.maxLength=e.editor.max),n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-input-cell-editor"),n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.style.direction="rtl");const o=function(i){if("keydown"===i.type)return"number"!==e.column.dataType&&"int"!==e.column.dataType&&"float"!==e.column.dataType||t.editing.editColumn||i.key.match(/[0-9]/)||"-"===i.key||1!==i.key.length?void t._handleEditKeyDown(i):(i.preventDefault(),void i.stopPropagation())},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(t){if(!e.column.rowHeaderColumn||t){if("number"===e.column.dataType||"int"===e.column.dataType||"float"===e.column.dataType){if(""===t)return;if(t&&!t.toString().match(/[0-9]/)&&"-"!==t)return}n.value=t}else n.value=e.editor.row.visibleIndex+1},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_applyCellEditorUserSettings(e,t){for(let i in t.editor)"template"!==i&&("list"!==i?"onInit"!==i&&"onRender"!==i&&(e[i]=t.editor[i]):e.setAttribute(i,t.editor[i]));if(t.editor.settings)for(let i in t.editor.settings)e[i]=t.editor.settings[i]}_getCheckInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-check-input")}_getMultiInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-multi-input")}_getMultiComboInputCellEditor(e){const t=this._getAutoCompleteCellEditor(e,"smart-multi-combo-input");return"tags"===e.column.template&&(t.getValue=()=>{const e=t.element.selectedItems;if(e&&0===e.length)return"";let i=[];for(let t=0;t<e.length;t++){const n=e[t];"string"==typeof n?i.push(n):i.push(n.value)}return i.toString()},t.setValue=e=>{if(e&&e.indexOf("{")>=0||e&&e.indexOf("[")>=0)t.element.selectedItems=JSON.parse(e);else if(e&&e.indexOf(",")>=0)if(e=e.split(",").map((e=>e.trim())),t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{for(let n=0;n<e.length;n++){const o=e[n];("string"==typeof t&&""+t===o||t&&void 0!==t.label&&""+t.value===o)&&i.push(t)}})),t.element.selectedItems=i}else t.element.selectedItems=e;else if(t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{("string"==typeof t&&""+t===e||t&&void 0!==t.label&&""+t.value===e)&&i.push(t)})),t.element.selectedItems=i}else t.element.value=e},t.focus=function(){if(Smart.Utilities.Core.isMobile)return;const e=t.element;setTimeout((()=>{t.element.readonly?t.element.focus():e&&e.select&&e.select()}),50)}),t}_getAutoCompleteCellEditor(e,t){const i=this,n=i._getEditorId(e);if(i._cellEditors[n]&&e.column.editor.isDirty&&(delete e.column.editor.isDirty,delete i._cellEditors[n]),!i._cellEditors[n]){let o=document.createElement("smart-input");t&&(o=document.createElement(t)),i._applyCellEditorUserSettings(o,e),o.readonly&&(o.dropDownButtonPosition="right");const l=function(e){o.opened||"keydown"!==e.type||i._handleEditKeyDown(e)};o.rightToLeft=i.rightToLeft,o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-auto-complete-cell-editor");const a=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{o&&o.select&&o.select()}),50)},d=function(e){e&&1===e.length&&o.readonly||(o.value=e)},r=function(){return o.value},s=function(){o&&o.close&&(o.value="",o.close(),o.removeEventListener("keydown",l))},c=function(){},u=function(){o.addEventListener("keydown",l)};i._cellEditors[n]={element:o,focus:a,blur:c,setValue:d,getValue:r,attach:u,detach:s}}if(!e.editor.dataSource&&!e.editor.isInitialized){const t=i.getVisibleRows(),o=[];for(let n=0;n<t.length;n++){let l=i.dataSource[t[n].index];if(l){if(l=l[e.column.dataField],!l)continue;-1===o.indexOf(l)&&o.push(l)}}i._cellEditors[n].element.dataSource=o}return i._cellEditors[n]}_getDateRangeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-range-input");n.dropDownButtonPosition="right",n.dropDownAppendTo="body",n.autoClose=!0,n.selectionMode="default",n.rightToLeft=t.rightToLeft,n.timepicker=!0,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},d=function(){return n._performSelect(),n.selectedDates},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getDateTimePickerCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-time-picker");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,e.column.cellsFormat&&(n.formatString=e.column.cellsFormat),t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(n.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){if("string"==typeof e&&1===e.length){if("string"==typeof e&&n.autoOpen&&"Invalid Date"===(e=new Date(e)).toString())return;n.$.input.value=e}else n.value=e},d=function(){return n.value&&n.value instanceof Smart.Utilities.DateTime?(n._validateValue(n.$.input.value),n.value.toDate()):n.value},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getTimeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-time-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},d=function(){const e=new Date;return e.setHours(n.value[0]),e.setMinutes(n.value[1]),"Invalid Date"===e.toString()?new Date:e},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getDateInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,n.formatString=(!e.column.cellsFormat||1!==e.column.cellsFormat.length&&"d"!==e.column.cellsFormat)&&e.column.cellsFormat?e.column.cellsFormat:"MM/dd/yyyy",t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened?"Enter"!==e.key&&"Escape"!==e.key||t._handleEditKeyDown(e):"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(e.editor.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){"string"==typeof e&&e.length>1&&"Invalid Date"===(e=new Date(e)).toString()||(n.value=e)},d=function(){return n.getValue()},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getImageCellEditor(e){const t=this,i=t._getEditorId(e);if(t._dialogImage&&(t._dialogImage.cell=e),!t._cellEditors[i]){const n=document.createElement("div");n.innerHTML=`\n <div style="display: grid;"><div title="${t.localize("addImages")}" class="smart-grid-icon smart-icon-plus show"></div><div class="images"><div class="container"></div></div></div>\n `,n.rightToLeft=t.rightToLeft,n.tabIndex=0,n.firstElementChild.style.gridTemplateColumns="25px 1fr",t.rightToLeft&&(n.style.direction="rtl");const o=n.querySelector(".smart-grid-icon"),l=n.querySelector(".images");o.onpointerdown=()=>{t._openImageDialog(t._dialogImage?t._dialogImage.cell:e)},l.onclick=e=>{"IMG"===e.target.nodeName&&t._openImagePreviewDialog(e.target)},n.ondrop=i=>{i.preventDefault(),t._openImageDialog(t._dialogImage?t._dialogImage.cell:e),t._dialogImage.dropZone.dropHere(i)},n.ondragover=e=>{e.preventDefault()},t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const a=function(){n.focus(),setTimeout((()=>{n.focus()}),50)},d=function(e){n.value=e,l.innerHTML=`<div class="container"><div style="justify-content: center; align-items: center; display: flex; margin-top: 3px;" class="smart-drop-image smart-micro smart-quiet">${t.localize("dropImages")}</div></div>`;const i=l.firstElementChild;if("string"==typeof e&&(e.indexOf("http")>=0||e.indexOf("base64")>=0)){let t="";try{t=JSON.parse(e)}catch(e){console.log(e)}e=t}Array.isArray(e)&&(i.innerHTML="",e.forEach((e=>{const t=document.createElement("img");t.src=e.value,i.appendChild(t)})))},r=function(){let e=n.value;return e&&(Array.isArray(e)||("string"==typeof e&&e.indexOf("base64"))>=0)&&Array.isArray(e)&&(e=JSON.stringify(e)),e},s=i=>{("+"===i.key||i.altKey&&"ArrowDown"===i.key)&&t._openImageDialog(t._dialogImage?t._dialogImage.cell:e),"Escape"===i.key&&t.cancelEdit(),"Enter"===i.key&&t.endEdit()},c=function(){n.value="",t._dialogImage&&t._dialogImage.close(),t._dialogImagePreview&&t._dialogImagePreview.close(),n.removeEventListener("keydown",s)},u=function(){},m=function(){n.addEventListener("keydown",s)};t._cellEditors[i]={element:n,focus:a,blur:u,setValue:d,getValue:r,attach:m,detach:c}}return t._cellEditors[i]}_getPhoneCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-phone-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-phone-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.value=e,n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1),t._phoneNumbers&&t._phoneNumbers[e]&&(n.selectedCountry=t._phoneNumbers[e])},d=function(){return t._phoneNumbers||(t._phoneNumbers=[]),n.value&&(t._phoneNumbers[n.value]=n.selectedCountry),n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getPasswordCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-password-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-password-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},d=function(){return n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getMaskCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-masked-text-box");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-masked-text-box-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},d=function(){return n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getNumberInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-number-input");if(t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(n.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t,i.minimumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("d")>=0){i={style:"decimal"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("f")>=0||e.column.cellsFormat.indexOf("n")>=0){i={};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.minimumFractionDigits=t,i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);n.numberFormat=i}n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-number-input-cell-editor");const o=function(e){t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.focus(),t.$.scrollView.scrollTop=0}),50)},a=function(){},d=function(e){n.isReady&&("string"==typeof e&&n.numberFormat&&n.numberFormat.style&&"percent"===n.numberFormat.style&&(e=parseFloat(e),e=""+(e/=100)),null!==e&&""!==e||(e=0),n.setValue(e))},r=function(){return n.getValue()},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getCheckBoxCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const e=document.createElement("div");e.classList.add("smart-input"),e.classList.add("smart-grid-cell-editor"),e.classList.add("smart-grid-check-box-cell-editor"),e.tabIndex=0;const n=function(){!0!==e.value&&!1!==e.value&&null!==e.value&&(e.value=!1),null===e.value?e.value=!1:e.value=!e.value,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},o=function(e){if(" "!==e.key){switch(e.key){case"ArrowLeft":case"ArrowDown":case"ArrowRight":case"ArrowUp":if(t.editing.dialog.enabled)return;t.endEdit()}t._handleEditKeyDown(e)}else n()},l=function(t){e.value="string"==typeof t?"false"!==t&&"0"!==t&&"null"!==t&&"undefined"!==t:t,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},a=function(){Smart.Utilities.Core.isMobile||(e.focus(),setTimeout((function(){e.focus()}),25))},d=function(){return e.value},r=function(){e.value=!1,e.removeEventListener("click",n),e.removeEventListener("keydown",o)},s=function(){},c=function(){e.addEventListener("keydown",o),e.addEventListener("click",n)};t._cellEditors[i]={getValue:d,setValue:l,focus:a,blur:s,element:e,detach:r,attach:c}}return t._cellEditors[i]}_getEditorValue(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors)return;const n=t._cellEditors[i];if(!n)return;const o=function(t){switch(e.column.dataType){case"string":t=null==t?"":void 0!==t&&"number"==typeof t?parseFloat(t):t&&"object"==typeof t&&t[0]&&t[0].label?t[0].label.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):t&&"object"==typeof t&&t instanceof Date?t.toLocaleString():t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""");break;case"float":case"int":case"number":t="int"===e.column.dataType?parseInt(t):parseFloat(t),isNaN(t)&&(t=0);break;case"bool":case"boolean":"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1);break;case"date":if(t instanceof Date)return t;"string"==typeof t&&(t=new Date(t));break;case"dateTime":t=new Smart.Utilities.DateTime(t)}return t};let l=null;switch(e.editor.template){case"dateRangeInput":try{l=n.getValue()}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"input":case"autoComplete":case"numberInput":case"slider":case"dateInput":case"timeInput":case"deteTimePicker":case"checkBox":try{l=o(n.getValue())}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"multiComboInput":case"image":l=n.getValue();break;default:l=o(n.getValue())}let a=!0,d=!1,r=!1;if(e.column.validator)a=e.column.validator.evaluate(l,e.row.data);else if("string"==typeof l){const t=e.editor.minLength||e.editor.min||0,i=e.editor.maxLength||e.editor.max||999999;(l.length<t||l>i)&&(a=!1),l.length<t&&(d=!0),l.length>i&&(r=!0),e.editor.required&&0===l.length&&(a=!1),e.editor.instance.element&&e.editor.instance.element.checkValidity&&(a=e.editor.instance.element.checkValidity())}if(a)return l;let s=null;const c=e.editor.instance.element;return c&&(s=c.validity,s&&(s.custom&&delete s.custom,d&&(s.custom={minLength:!0,value:e.editor.min}),r&&(s.custom={maxLength:!0,value:e.editor.max}),s.message=c.validationMessage)),{error:!0,validity:s,value:l}}_beginRowEdit(e,t){const i=this;if(e===i.editing.editRow)return!1;if(i.editing.editRow){if(!i.endEdit())return!1}const n=e.cells;i.editing.editRow=e,i.editing.commandColumn.visible&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),e.isEditing=!0;let o=!1;for(let e=0;e<n.length;e++){const l=n[e],a=l.column;if(!a.allowEdit||!1===a._visible)continue;const d=i._beginCellEdit(l);if(d){if(!0!==i.editing.recordNavigation&&i.editing.enabled){if(Smart.Utilities.Core.isMobile)return;let e=!0;switch(l.editor.template){case"textarea":case"slider":e=!1}e&&(t?l===t&&l.editor.instance.focus():d&&!o&&(o=!0,l.editor.instance.focus()))}i.editing.commandColumn.visible&&l.column.commandColumn&&l.render()}}return!0}_beginCellEdit(e,t){const i=this;if(e.isEditing)return!1;if(i._isUpdating)return!1;if(i.onCellBeginEdit){if(!i.onCellBeginEdit(e.row.id,e.column.dataField,e.value,i))return!1}let n=!1;if(e.column.autoGenerated&&e.column.rowHeaderColumn&&i.editing.allowRowHeaderEdit&&new Date-i._clickTime<i.behavior.doubleClickTimingDelay&&i._clickedCell===e.element&&(n=!0),(!e.column.allowEdit||e.column.autoGenerated||e.readonly)&&!n)return!1;if(i.editing.editCell&&!i.editing.editRow){i._fireEndEdit=!0;if(!1===i._endCellEdit())return!1}if(i._cellEditors||(i._cellEditors=[]),i.editing.editRow||(i.editing.editCell=e),i.editing.commandColumn.visible&&!i.editing.editRow&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),!e.row.element)return!1;e.row.element.setAttribute("edit",""),i.editing.isEditing=!0,i._selection.selectionRect&&i._selection.selectionRect.classList.add("smart-visibility-hidden");const o=t=>{const n=t.element;i.editing.dialog.enabled?i._openEditDialog(e,t):(e.element||e.createElement(),e.element.setAttribute("editor","string"==typeof e.editor.template?e.editor.template:"template"),e.element.content.innerHTML="",e.element.content.appendChild(n),e.column.cellsWrap||e.element.content.classList.add("nowrap"),i.editing.editRow&&e.element.setAttribute("row-editor","")),t.attach(),e.editor.row=e.row,e.editor.column=e.column,e.editor.cell=e,e.editor.instance=t,e.isEditing=!0},l=i._cellsUpdatedValues?i._cellsUpdatedValues[e.row.id+"_"+e.column.dataField]:void 0;let a=void 0!==l?l:e.value;if(void 0===a){a="";const t=e.column;"number"===t.dataType||"int"===t.dataType||"float"===t.dataType?a=0:"date"===t.dataType&&(a=new Date,a.setHours(0,0,0))}switch(e.editor||(e.editor="input"),"string"==typeof e.editor&&(e.canNotify=!1,e.editor={template:e.editor,autoFocus:!0},e.canNotify=!0),e.editor.template){default:case"custom":{const t=i._getCustomCellEditor(e);o(t),t.setValue(a);break}case"image":{const t=i._getImageCellEditor(e);o(t),t.setValue(a);break}case"checkBox":{const n=i._getCheckBoxCellEditor(e);o(n);const l=!0===a||1===a;if("checkBox"===e.template&&t){(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY)[0].classList.contains("smart-input")?n.setValue(!l):n.setValue(l)}else n.setValue(l);break}case"autoComplete":{const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"list":case"dropDownList":{e.editor.autoOpen=!0,e.editor.readonly=!0,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"comboBox":{e.editor.readonly=!1,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"password":{const t=i._getPasswordCellEditor(e);o(t),t.setValue(a);break}case"phone":{const t=i._getPhoneCellEditor(e);o(t),t.setValue(a);break}case"maskedTextBox":{const t=i._getMaskCellEditor(e);o(t),t.setValue(a);break}case"multiInput":{const t=i._getAutoCompleteCellEditor(e,"smart-multi-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"checkInput":{const t=i._getAutoCompleteCellEditor(e,"smart-check-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"multiComboInput":{e.editor.readonly=!0,e.editor.autoOpen=!0;const t=i._getMultiComboInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"timeInput":{const t=i._getTimeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateInput":{const t=i._getDateInputCellEditor(e);o(t),t.setValue(a);break}case"dateRangeInput":{const t=i._getDateRangeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateTimePicker":{const t=i._getDateTimePickerCellEditor(e);o(t),t.setValue(a);break}case"slider":{const t=i._getSliderCellEditor(e);o(t),t.setValue(a);break}case"colorInput":{const t=i._getColorInputCellEditor(e);o(t),t.setValue(a);break}case"textarea":case"textArea":{const t=i._getTextAreaCellEditor(e);o(t),t.setValue(a);break}case"numberInput":case"text":case"input":{const t="numberInput"===e.editor.template?i._getNumberInputCellEditor(e):i._getInputCellEditor(e);o(t),t.setValue(a);break}}if(!e.editor.isInitialized&&(e.editor.isInitialized=!0,e.editor.onInit)){const t=e.editor.onInit(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}if(e.editor.onRender){const t=e.editor.onRender(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}return i.editing.editCell&&e.editor.instance.focus(),!0}_onColumnDoubleClick(e){this._beginColumnEdit(e)}_beginColumnEdit(e){const t=this;if(t.editing.enabled&&t.editing.allowColumnHeaderEdit&&e.allowHeaderEdit){t.editing.isEditing&&t.endEdit(),t.editing.editColumn=e,t._cellEditors||(t._cellEditors=[]);const i=t._getInputCellEditor({column:e,row:t.rows[0],editor:{template:"input"}});i.element.value=e.label,i.focus(),e.headerEditor=i,e.element.setAttribute("edit",""),e.element.label.appendChild(i.element),i.attach(),t.editing.isEditing=!0,t.$.fireEvent("beginEdit",{id:null,dataField:e.dataField,row:null,column:e,cell:null,data:null,value:null})}}_endColumnEdit(e){const t=this;if(!1===t.editing.isEditing||t.editing.isEditing&&null===t.editing.editColumn)return!1;const i=t.editing.editColumn;return i.canNotify=!1,i.headerEditor.detach(),i.headerEditor.element.parentNode.removeChild(i.headerEditor.element),!0!==e&&(i.label=i.headerEditor.getValue()),i.headerEditor=null,t.editing.isEditing=!1,i.element.removeAttribute("edit"),i.element.scrollLeft=0,t.editing.editColumn=null,i.canNotify=!0,i.refresh(),t._recycle(),!0}_cancelColumnEdit(){this._endColumnEdit(!0)}_onCellClick(e,t){const i=this;if(e.row.addNewRow)e.row.inline||"far"===e.row.freeze?i._insertNewRowAfter():i._insertNewRowBefore();else if(!e.row.filterRow&&i.editing.enabled)if(i.editing.editColumn)i.endEdit();else{if(i.editing.commandColumn.visible)if(e.column.commandColumn){const n=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY);let o=null;for(let e=0;e<n.length;e++)if(n[e].classList.contains("smart-grid-command-item")){o=n[e];break}if(o||(o=e.element.querySelector(".smart-grid-command-item")),o&&!o.classList.contains("smart-hidden")){const n=o.getAttribute("command");return void i._applyCommand(n,[e.row,t])}}else if(i.editing.commandColumn.inline){const e=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.pageX,t.pageY);for(let t=0;t<e.length;t++)if(e[t].classList.contains("smart-grid-command-item"))return}if("none"===i.editing.action&&i.editing.isEditing){let t=!1;i.editing.editCell&&i.editing.editCell.row!==e.row&&(t=!0),i.editing.editRow&&i.editing.editRow!==e.row&&(t=!0),i.editing.editColumn&&(t=!0),t&&i.endEdit()}if(e.column.autoGenerated){if(i.editing.allowRowHeaderEdit&&e.column.rowHeaderColumn){if(i.editing.isEditing&&i.endEdit(),void 0!==e.row.label)return;i._beginCellEdit(e,t),i.editing.isEditing&&i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value})}}else if("click"===i.editing.action&&(!i.selection.enabled||e.selected||"extended"!==i.selection.mode))if("cell"===i.editing.mode){const n=e.parent();if(void 0!==e.row.label)return;i.ensureVisible(e.row.id,e.column.dataField),setTimeout((function(){n?(i._beginCellEdit(n,t),i.$.fireEvent("beginEdit",{id:n.row.id,dataField:n.column.dataField,row:n.row,column:n.column,cell:n,data:n.row.data,value:n.value})):(i._beginCellEdit(e,t),i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value}))}),25)}else if("row"===i.editing.mode){if(void 0!==e.row.label)return;i._beginRowEdit(e.row,e,t),i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value})}}}_onCellDoubleClick(e,t){const i=this;i.editing.enabled&&("doubleClick"!==i.editing.action||i.editing.isEditing||e.column.autoGenerated||("cell"===i.editing.mode?i._beginCellEdit(e,t):"row"===i.editing.mode&&i._beginRowEdit(e.row,e,t)))}_onRowClick(){}_onRowDoubleClick(){}beginEdit(e,t){const i=this,n=i.rowById[e];n&&i._beginEdit(n,t)}cancelEdit(){const e=this;if(e.editing.isEditing){if(e._errorOverlay){if(e._errorOverlay.remove(),e._errorMessage.remove(),e.editing.editCell&&(e.editing.editCell.error=""),e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){t[e].error=""}e.editing.editRow.element.removeAttribute("error"),e.editing.editRow.error=null}e._isUpdating=!1}if(e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){const i=t[e],n=i.element;0===e&&i.row.element.removeAttribute("edit"),n&&(n.removeAttribute("editor"),n.removeAttribute("error"),n.content.innerHTML=""),i.isEditing=!1}e.editing.editRow=null}else e.editing.editCell?(e.editing.editCell.row.element.removeAttribute("edit"),e.editing.editCell.row.element.removeAttribute("error"),e.editing.editCell.element.removeAttribute("editor"),e.editing.editCell.element.removeAttribute("error"),e.editing.editCell.element.content.innerHTML="",e.editing.editCell.isEditing=!1,e.editing.editCell=null):e.editing.editColumn&&e._cancelColumnEdit();e.editing.dialog.visible&&e.editing.dialog.enabled&&e._dialogEdit.close(),e.editing.isEditing=!1,e._recycle(!1),e.editing.commandColumn.visible&&e.refresh(),e.$.fireEvent("cancelEdit"),e.focus()}}removeRow(e,t){return this.deleteRow(e,t)}deleteRow(e,t){const i=this;if(e&&Array.isArray(e)){if(i.onRowRemove){if(!1===i.onRowRemove(e,i))return}i.beginUpdate();const n=i.dataSource.canNotify,o=i.rows.canNotify;i.rows.canNotify=!1,i.dataSource.canNotify=!1;const l=i.onRowRemoved;i.onRowRemoved=null;let a=[];for(let n in e){const o=i.rowById[e[n]];a.push(o.data.$.index),i.deleteRow(e[n],t),i.dataSource.removeAt(o.data.$.index)}return i.rows.canNotify=o,i.dataSource.canNotify=n,i.onRowRemoved=l,i.endUpdate(),i._refreshSummary(),void(l&&l(e,a,i))}const n=i.rowById[e];if(!n)return!1;const o=function(e){if(!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("delete")>=0)i._batchDeleteRow(e);else{if(i.dataSource&&i.dataSource.virtualDataSource)return i._editInfo={row:e.data},void i._virtualDataRequest("remove",(function(n){if(n){const n=i.rows.indexOf(e);i.rows.splice(n,1),delete i.rowById[e.id],t&&t(e)}}));const n=i.rows.indexOf(e);i._removeAt(n)}t&&t(e)};return i.editing.deleteDialog.enabled?i._openDeleteRowDialog(n,o):o(n),!0}addRow(e,t,i){const n=this;e||(e={});for(let t=0;t<n.columns.length;t++){const i=n.columns[t];void 0!==i.defaultValue&&void 0===e[i.dataField]&&(e[i.dataField]=i.defaultValue)}if(void 0===t&&(t=!0),n.dataSource&&n.dataSource.virtualDataSource)n._editInfo={row:e},n._virtualDataRequest("add",(o=>{o&&(n._add(e,t?n.rows.length:0),i&&i(t?n.rows[n.rows.length-1]:n.rows[0]))}));else{if(n.editing.batch)return void(t?n._insertNewRowAfter(i):n._insertNewRowBefore(i));"number"==typeof t?n._add(e,t,i):n._add(e,t?n.rows.length:0,i)}}insertRow(e,t,i){this.addRow(e,t,i)}flashCell(e,t){const i=this;i._flashTimer&&clearTimeout(i._flastTimer),i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell"),i.highlightCell(e,t,"smart-flash-cell"),i._flashTimer=setTimeout((()=>{i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell",delete i.highlightedCells[e][t])}),2e3)}highlightCell(e,t,i){const n=this,o=n.rowById[e],l=n.columnByDataField[t];o&&l&&(n.highlightedCells||(n.highlightedCells=[]),n.highlightedCells[e]||(n.highlightedCells[e]=[]),void 0!==n.highlightedCells[e][t]?i?n.highlightedCells[e][t].startsWith("off")?n.highlightedCells[e][t]=i||"":n.highlightedCells[e][t]="off_"+i:delete n.highlightedCells[e][t]:n.highlightedCells[e][t]=i||"",n._recycle(!1))}highlightRow(e,t){const i=this;i.rowById[e]&&(i.highlightedRows||(i.highlightedRows=[]),void 0!==i.highlightedRows[e]?t?i.highlightedRows[e].startsWith("off")?i.highlightedRows[e]=t||"":i.highlightedRows[e]="off_"+t:delete i.highlightedRows[e]:i.highlightedRows[e]=t||"",i._recycle(!1))}highlightColumn(e,t){const i=this.columnByDataField[e];i.highlight=!i.highlight,i._highlightCSS=t,this._recycle(!1)}setRowProperty(e,t,i){const n=this.rowById[e];n&&(n[t]=i)}getRowProperty(e,t){const i=this.rowById[e];if(i)return i[t]}getColumn(e){const t=this.columnByDataField[e];return t||null}getColumnProperty(e,t){const i=this.columnByDataField[e];if(i)return i[t]}setColumnProperty(e,t,i){const n=this.columnByDataField[e];n&&(n[t]=i)}getCellValue(e,t){const i=this.rowById[e],n=this.columnByDataField[t];if(!i||!n)return;return i.getCell(t).value}setCellValue(e,t,n,o){const l=this,a=l.rowById[e],d=l.columnByDataField[t];if(!a||!d)return!1;let r=[];if(d.validationRules&&d.validationRules.length>0&&(r=((e,t)=>{let n=[];for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}return n})(d.validationRules,n),Object.keys(r).length>0))return!1;const s=()=>{l.beginUpdate();const e=a.getCell(t);l._setCellUndoRedo(e,e.value,n),e.value=n,l.endUpdate(),o&&o(a)};if(l.dataSource&&l.dataSource.virtualDataSource){l.dataSource.id?a[l.dataSource.id]=e:a.id||(a.id=e);const i={};for(let e=0;e<l.columns.length;e++){const o=l.columns[e],d=a.getCell(o.dataField);i[o.dataField]=d.value,o.dataField===t&&(i[o.dataField]=n)}l._editInfo={row:i},l._virtualDataRequest("update",(function(e){e&&s(),l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility()}))}else s()}setRowData(e,t){this.updateRow(e,t,null)}getRowData(e){const t=this.rowById[e];if(!t)return null;const i=JSON.parse(JSON.stringify((e=>{const t={};for(let i in e)"leaf"!==i&&"$"!==i&&"parent"!==i&&"history"!==i&&"comments"!==i&&"style"!==i&&(t[i]=e[i]);return t})(t.data)));return delete i.$,i}getRow(e){const t=this.rowById[e];return t||null}forEachRow(e){const t=this;if(e)for(let i=0;i<t.rows.length;i++)e(t.rows[i])}forEachRowAfterFilterAndSort(e){const t=this;if(e)for(let i=0;i<t._recyclingRows.length;i++)e(t._recyclingRows[i])}getRowById(e){return this.rowById[e]}getRowByIndex(e){const t=this.rows[e];return t||null}getRowId(e){const t=this.rows[e];if(!t)return null;return t.id}validateRow(e,t){const n=this;if(!n.rowById[e])return!1;const o=(e,t)=>{let n=[];for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}return n.filter((e=>{}))},l=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];let a=[];if(void 0!==t[i.dataField])if(i.validationRules&&i.validationRules.length>0){let e=t[i.dataField];e&&e.error&&(e=e.value),a=o(i.validationRules,e),Object.keys(a).length>0&&(l[i.dataField]=a)}else{let e=null,n=t[i.dataField];n&&n.error&&(e=n.validity,n=n.value);for(let t in e)e[t]&&"valid"!==t&&"message"!==t&&(a[t]=!0),("custom"===t&&e[t].minLength||"custom"===t&&e[t].maxLength)&&(a[t]=!0);Object.keys(a).length>0&&(l[i.dataField]=a)}}return l}_updateRow(e,t,i){const n=this,o=n.rowById?n.rowById[e]:n.dataSource.dataItemById[e];if(!o)return;let l=[];n.dataSource&&n.dataSource.groupBy&&n.dataSource.groupBy.toArray&&(l=n.dataSource.groupBy.toArray().slice(0));const a=n.dataSource.boundSource.canNotify;n.dataSource.boundSource.canNotify=!1;const d=e=>{if(o.data[e]=t[e],n.dataSource.id&&o&&o.data&&o.data.$&&(o.data.$.id=t[n.dataSource.id]),o&&o.data.$&&void 0!==o.data.$.index){const i=o.data.$.index,a=n.dataSource.dataSource,d=()=>{const i=t[e];if(null==i){const t=n.columnByDataField[e];return t?"number"===t.dataType?0:"boolean"!==t.dataType&&("date"===t.dataType?new Date:""):""}return i};if(a&&a[i]&&(a[i][e]=d()),n.dataSource[i]){if(l.length>0&&!n._dirtyHierarchy){if(n.dataSource[i][e]!==d()&&l.indexOf(e)>=0){const e=n._getExpandedGroups(n.dataSource.boundHierarchy);n._dirtyHierarchy=e}}n.dataSource[i][e]=d()}}};let r=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];void 0!==t[i.dataField]&&(r[i.dataField]=!0,d(i.dataField))}if(i){const e=n.dataSource.dataFields;if(e)for(let t=0;t<e.length;t++)r[e[t].name]||(e[t].map?d(e[t].map):d(e[t].name))}n.dataSource.boundSource.canNotify=a,n.__updating||n.dataSource.refreshHierarchy()}updateRow(e,t,i){const n=this,o=n.rowById[e];if(!o)return!1;const l=n.validateRow(e,t);if(Object.keys(l).length>0)return!1;const a=()=>{n.beginUpdate();for(let e in t){if("$"===e)continue;const i=o.getCell(e);i?i.value=t[e]:o.data[e]&&(o.data[e]=t[e])}n.endUpdate(),i&&i(o)};n.dataSource&&n.dataSource.virtualDataSource?(n.dataSource.id?t[n.dataSource.id]=e:t.id||(t.id=e),n._editInfo={row:t},n._virtualDataRequest("update",(function(e){e&&a(),n.appearance.displayLoadingIndicator=!1,n._setLoadingIndicatorVisibility()}))):n.onRowUpdate?n.onRowUpdate([e],[o],[o.data],[t],(e=>{e&&a()}),n):a()}addUnboundRow(e,t){const i=this;void 0===e&&(e=1),void 0===t&&(t="far"),i._nearRowsAdded||(i._nearRowsAdded=[],i._farRowsAdded=[]),i._unboundRows||(i._unboundRows=[]),i.beginUpdate();for(let n=0;n<e;n++){const e=Smart.Utilities.Core.createGUID().replace(/-/gi,""),n=new Smart.Grid.Row({index:-1,unbound:!0,id:e,grid:i});i.rowById[n.id]=n,"far"===t?i._farRowsAdded.push(n):i._nearRowsAdded.push(n),i._unboundRows.push(n)}i.endUpdate()}addNewRow(e){const t=this;"near"===e?t._insertNewRowBefore():t._insertNewRowAfter()}_updateRowHistory(e,t,i){const n=this;if(!n._currentUser||n._currentUser&&!n._currentUser.info)return;const o="taskChecklist",l="taskColor",a="taskDueDate",d="taskPriority",r="taskProgress",s="taskStartDate",c="taskStatus",u="taskTags",m="taskText",g="taskDescription",f="taskUserId",p=()=>({user:n._currentUser.info.id,date:e.updatedDate}),h=[];if(i[f]!==t[f]){const n=p();n.action="user";let o=!0;t[f]||i[f]||(o=!1),o&&(n.details={oldValue:t[f],value:i[f]},e.addHistory(n)),h.push(f)}if(""+i[a]!=""+t[a]){const n=p();n.action="deadline",n.details={oldValue:t[a]?new Date(t[a]).toLocaleDateString():"",value:new Date(i[a]).toLocaleDateString()},e.addHistory(n),h.push(a)}if(""+i[s]!=""+t[s]){const n=p();n.action="deadline",n.details={oldValue:t[s]?new Date(t[s]).toLocaleDateString():"",value:new Date(i[s]).toLocaleDateString()},e.addHistory(n),h.push(s)}if(i[l]!==t[l]){const n=p();n.action="color",n.details={oldValue:t[l],value:i[l]},e.addHistory(n),h.push(c)}if(i[c]!==t[c]){const n=p();n.action="status",n.details={oldValue:t[c],value:i[c]},e.addHistory(n),h.push(c)}if(JSON.stringify(i[o])!==JSON.stringify(t[o])){const n=p();n.action="subtasks",n.details={oldValue:t[o],value:i[o]},e.addHistory(n),h.push(o)}else h.push(o);if(void 0!==i[r]&&parseFloat(i[r])!==parseFloat(t[r])){let n=!0;if(null===t[r]&&0===parseFloat(i[r])&&(n=!1),null===(null===t[r]&&i[r])&&(n=!1),n){const n=p();n.action="progress",n.details={oldValue:t[r]?100*t[r]+"%":"0%",value:100*i[r]+"%"},e.addHistory(n)}h.push(r)}if(i[g]!==t[g]){const n=p();n.action="description",n.details={oldValue:t[g],value:i[g]},e.addHistory(n),h.push(g)}if(i[d]!==t[d]){const n=p();n.action="priority",n.details={oldValue:t[d],value:i[d]},e.addHistory(n),h.push(d)}if(i[u]!==t[u]){const n=p();n.action="tags",n.details={oldValue:t[u],value:i[u]},e.addHistory(n),h.push(u)}if(i[m]!==t[m]){const n=p();n.action="text",n.details={oldValue:t[m],value:i[m]},e.addHistory(n),h.push(m)}for(let o=0;o<n.columns.length;o++){const l=n.columns[o].dataField;let a=t[l],d=i[l];if(-1===h.indexOf(l)&&a!==d){const t=p();"date"===n.columns[o].dataType&&(d&&"string"==typeof d&&(d=new Date(d)),a&&"string"==typeof a&&(a=new Date(a))),t.action=l,t.details={oldValue:a,value:d},e.addHistory(t)}}n.onRowHistory&&(n._tempRowHistory||(n._tempRowHistory=[]),n._tempRowHistory[e.index]={index:e.index,row:e,history:e.history},n._tempRowHistoryTimer&&clearTimeout(n._tempRowHistoryTimer),n._tempRowHistoryTimer=setTimeout((()=>{const e=[],t=[],i=[];for(let o in n._tempRowHistory)t.push(o),e.push(n._tempRowHistory[o].row),i.push(n._tempRowHistory[o].history);n.onRowHistory(t,e,i,n),delete n._tempRowHistory}),50))}_stringifyRow(e){const t=this;let i={};for(let n=0;n<t.columns.length;n++){const o=t.columns[n];i[o.dataField]=e.data[o.dataField]}return i=JSON.parse(JSON.stringify(i)),i}endEdit(){const e=this;let t=!1,i=null;e.editing.dialog.enabled&&e.editing.dialog.visible&&e._dialogEdit&&e._dialogEdit.close();let n=null,o=null,l=null;e._fireEndEdit=!0;let a=null,d=null,r=null;if(e.editing.editRow){o=e.editing.editRow,i=e.editing.editRow.id;let n=null;if(e.storeHistory&&(n=e._stringifyRow(o)),t=e._endRowEdit(),a=n,t&&!e.onRowUpdate&&(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory)){const t=e._stringifyRow(o);e._updateRowHistory(o,n,t)}}else if(e.editing.editCell){o=e.editing.editCell.row,l=e.editing.editCell.column,n=e.editing.editCell,i=e.editing.editCell.row.id,r=!0;let s=null;e.storeHistory&&(s=e._stringifyRow(o));const c=void 0!==n.value?n.value:"";d=c,a=s;let u=!1;const m=t=>{if(t!==c){if(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory){const i=e._stringifyRow(o);i[n.column.dataField]=t,e._updateRowHistory(o,s,i)}u=!0}};if(e.onCellUpdate&&e.onRowHistory){const t=e.onRowHistory;e.onRowHistory=null;m(e._getEditorValue(n)),setTimeout((()=>{e.onRowHistory=t}),100)}t=e._endCellEdit(),t&&!u&&e.cell&&m(e.cell.value)}else e.editing.editColumn&&(i=null,l=e.editing.editColumn,t=e._endColumnEdit());if(e._saveUnboundRows(i),e._selection.selectionRect&&e._selection.selectionRect.classList.remove("smart-visibility-hidden"),e.$.scrollView.scrollTop=0,e._fireEndEdit){e.$.fireEvent("endEdit",{id:o?o.id:null,dataField:l?l.dataField:null,row:o,column:l,cell:n,data:o?o.data:null,value:n?n.value:l?l.label:null}).defaultPrevented&&(r?e.setCellValue(o.id,l.dataField,d):e.setRowData(o.id,a))}return e.summaryRow.visible&&t&&(e.editing.isEditing=!1,e._calculateSummary(),e._recycle(!1)),e._refreshDataFilters(),e._renderConditionalFormatting(),t}getEditCells(){const e=this;return e.editing.editRow?e.editing.editRow.cells:e.editing.editCell?[e.editing.editCell]:[]}getBatchEditChanges(){const e=this,t=[],i=[],n=[];for(let i in e._cellsUpdatedValues){const n=e._cellsUpdatedValues[i],o=i.substring(0,i.indexOf("_")),l=i.substring(i.indexOf("_")+1),a=e.rowById[o].getCell(l);t.push({id:o,dataField:l,oldValue:a.value,newValue:n})}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const n=e._rowsDeleted[t],o=e.rowById[n];i.push({id:o.id,data:o.data})}if(e._rowsAdded&&e._rowsAdded.length>0)for(let t=0;t<e._rowsAdded.length;t++){const i=e._rowsAdded[t],o=e.rowById[i];n.push({id:o.id,data:o.data})}return{updated:t,deleted:i,added:n}}saveBatchEdit(){this._saveBatchEdit()}revertBatchEdit(){this._clearBatchEdit(!0)}});const e=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;function t(e){return null==e||0===e.length}class i{static null(e){return null===e}static email(i){return t(i)||e.test(i)?null:{email:!0}}static min(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static max(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static minDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static maxDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static required(e){return t(e)?{required:!0}:null}static requiredTrue(e){return!0===e?null:{required:!0}}static minLength(e,i){return(e=>{if(t(e))return null;const n=e?e.length:0;return n<i?{minlength:{requiredLength:i,actualLength:n}}:null})(e)}static maxLength(e,t){return(e=>{const i=e?e.length:0;return i>t?{maxlength:{requiredLength:t,actualLength:i}}:null})(e)}static url(e){return/^(ftp|http|https):\/\/[^ "]+$/.test(e)?null:{pattern:{requiredPattern:'^(ftp|http|https)://[^ "]+$',actualValue:e}}}static pattern(e,n){if(!n)return i.null;let o,l;return"string"==typeof n?(l="","^"!==n.charAt(0)&&(l+="^"),l+=n,"$"!==n.charAt(n.length-1)&&(l+="$"),o=new RegExp(l)):(l=n.toString(),o=n),(e=>t(e)||o.test(e)?null:{pattern:{requiredPattern:l,actualValue:e}})(e)}}window.Smart.Validator=i})();
|
|
60
|
-
Smart.Utilities.Assign("Grid.Dialog",class{_openImagePreviewDialog(e){const t=this,a=e?[...e.parentNode.parentNode.querySelectorAll("img")]:[];if(e=e.cloneNode(),!t._dialogImagePreview){t._dialogImagePreview=t._createDialog({modal:!0,screenModal:!0,left:"screenMiddle",top:"screenCenter",width:"80%",height:"80%"}),t._dialogImagePreview.content.innerHTML='<div style="width: 100%; height: 100%;"><div class="images-container"></div><div class="image-preview"></div></div>';const e=t._dialogImagePreview.content.firstElementChild;e.style.display="grid",e.style.gridTemplateColumns="50px 1fr"}const i=t._dialogImagePreview.querySelector(".images-container");i.innerHTML="";const l=(e,a)=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const i=150+Math.min(850,e.width),l=150+Math.min(650,e.height);t._dialogImagePreview.style.width=i+"px",t._dialogImagePreview.style.height=l+"px",!1!==a&&(t._dialogImagePreview.style.left="calc(50% - "+Math.min(850,t._dialogImagePreview.offsetWidth/2)+"px)",t._dialogImagePreview.style.top="calc(50% - "+Math.min(650,t._dialogImagePreview.offsetHeight/2)+"px)");const n=getComputedStyle(t._dialogImagePreview),o=parseInt(n.top),r=parseInt(n.left);(window.offsetWidth<i||window.offsetHeight<l||o<0||r<0)&&(t._dialogImagePreview.style.left="0px",t._dialogImagePreview.style.top="0px",t._dialogImagePreview.style.width="100%",t._dialogImagePreview.style.height="100%"),e.style.maxWidth="100%"},n=()=>{const e=t._dialogImagePreview.querySelector(".images-container");let a=-1;return e.querySelectorAll("img").forEach(((e,t)=>{if(e.hasAttribute("active"))return a=t,!0})),a},o=e=>{const a=t._dialogImagePreview.querySelector(".images-container");e&&a.querySelectorAll("img").forEach((t=>{if(t.style.borderColor="transparent",t.removeAttribute("active"),t.src===e.src){t.style.borderColor="var(--smart-primary)",t.setAttribute("active",""),r.innerHTML=`<img src="${t.src}"/>`;const e=r.querySelector("img");e.onload=()=>{l(e,!1)}}}))};if(a.length>1)for(let t=0;t<a.length;t++){const l=a[t].cloneNode();l.style.width="40px",l.style.height="40px",l.style.cursor="pointer",l.style.borderStyle="solid",l.style.borderWidth="1px",l.style.borderColor="transparent",l.style.borderRadius="var(--smart-border)",l.style.marginTop="10px",l.title=a[t].title||a[t].parentNode.title,a[t].src===e.src&&(l.style.borderColor="var(--smart-primary)",l.setAttribute("active","")),i.appendChild(l),l.onmouseenter=()=>{l.style.borderColor="var(--smart-primary)"},l.onmouseleave=()=>{l.hasAttribute("active")||(l.style.borderColor="transparent")},l.onclick=()=>{o(l)}}const r=t._dialogImagePreview.content.querySelector(".image-preview");r.innerHTML="",r.appendChild(e),t._dialogImagePreview.btnClose.onclick=e=>{t._dialogImagePreview.close(),e.preventDefault(),e.stopPropagation()},e.style.marginLeft="auto",e.style.marginRight="auto",e.style.maxWidth="",e.onload=()=>{l(e)},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){if("Escape"===e.key&&t._dialogImagePreview.close(),"ArrowUp"===e.key||"ArrowLeft"===e.key){const t=n();o(a[t-1]),e.stopPropagation(),e.preventDefault()}else if("ArrowDown"===e.key||"ArrowRight"===e.key){const t=n();o(a[t+1]),e.stopPropagation(),e.preventDefault()}},t._dialogImagePreview.btnClose.tabIndex=0,t._dialogImagePreview.onOpen=()=>{setTimeout((()=>{t._dialogImagePreview.btnClose.focus()}),100)},t._dialogImagePreview.footer.remove(),t._dialogImagePreview.header.parentNode.style.backgroundColor="var(--smart-background)",t._dialogImagePreview.open()}_openImageDialog(e,t){const a=this,i=a._dialogImage||a._createDialog(),l='<span class="smart-grid-icon smart-icon-image show"></span>'+a.localize("dialogImageHeader");if(i.cell||(i.cell=e),i.header.innerHTML=l,i.column=e.column,i.command=t,i.classList.add("smart-grid-image-dialog"),!a._dialogImage){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){i.fileUpload.value="",i.input.value="";let e=i.cell.editor.instance.getValue();if("[]"!==e)if(e&&"string"==typeof e&&e.indexOf("http")>=0)i.input.value=JSON.parse(e)[0].value,i.tabs[1].click(),n("input");else{i.tabs[0].click();const t=(e,t)=>{let a=e.split(","),i=a[0].match(/:(.*?);/)[1],l=atob(a[1]),n=l.length,o=new Uint8Array(n);for(;n--;)o[n]=l.charCodeAt(n);return new File([o],t,{type:i})},a=new DataTransfer;"string"==typeof e&&e.indexOf("base64")>=0&&(e=JSON.parse(e)),Array.isArray(e)&&(e.forEach((e=>{a.items.add(t(e.value,e.label))})),i.fileUpload.files=a.files,n())}else i.tabs[0].click()},i.onClose=function(){},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){if(i.tabs[1].classList.contains("active"))i.input.value?e.editor.instance.setValue([{label:i.input.value,value:i.input.value}]):e.editor.instance.setValue([]),a._endCellEdit(i.cell);else{const t=(e,t)=>{var a=new FileReader;a.readAsDataURL(e),a.onload=function(){t(a.result)},a.onerror=function(){t("error")}},l=[];if(i.fileUpload.files.length)for(let n=0;n<i.fileUpload.files.length;n++){const o=i.fileUpload.files[n];t(o,(t=>{"error"===t&&console.log("Image load error"),l.push({value:t,label:o.name}),l.length===i.fileUpload.files.length&&(e.editor.instance.setValue(l),a._endCellEdit(i.cell))}))}else e.editor.instance.setValue([]),a._endCellEdit(i.cell)}i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogImage=i,i.content.innerHTML=`\n <div>\n <div>\n <div class="tabs">\n <div class="active tab">\n <span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogImageDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${a.localize("dialogImageLink")}</label>\n </div>\n </div>\n </div>\n <div class="smart-grid-drop-zone">\n <div>\n <div class="title"><span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogImageUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${a.localize("dialogImageDrop")}</label></div>\n </div> \n <input accept=".jpg, .jpeg, .png" type="file" multiple="multiple" style="display: none;">\n </div>\n <div class="smart-hidden url-zone">\n <div class="url-title">\n ${a.localize("dialogImageURL")}\n </div>\n <div class="upload">\n <smart-input placeholder="https://example.com/image.png" class="underlined"></smart-input>\n <br/>\n <smart-button disabled class="success">${a.localize("dialogImageURLUpload")}</smart-button>\n </div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,i.input=i.querySelector("smart-input"),i.dropZone=i.querySelector(".smart-grid-drop-zone"),i.upload=i.querySelector(".title"),i.fileUpload=i.querySelector("input"),i.preview=i.querySelector(".preview"),i.tabs=i.querySelectorAll(".tab"),i.urlZone=i.querySelector(".url-zone"),i.uploadButton=i.querySelector("smart-button");const t=["image/apng","image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon"],l=e=>t.includes(e.type);i.dropZone.ondrop=i.dropZone.dropHere=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;const a=i.column.editor.maxImages||5;for(let a=0;a<e.dataTransfer.items.length;a++)if("file"===e.dataTransfer.items[a].kind){const i=e.dataTransfer.items[a].getAsFile();l(i)&&t++}if(t===e.dataTransfer.files.length||t===a){const t=new DataTransfer;let l=[...e.dataTransfer.files],o=[...i.fileUpload.files];l.length>a&&(l=l.slice(0,5)),o.length>a&&(o=o.slice(0,5)),o.forEach(((e,i)=>{i<a&&t.items.add(e)})),l.forEach(((e,i)=>{i<a&&t.items.add(e)})),i.fileUpload.files=t.files,n()}}else i.fileUpload.files=e.dataTransfer.files,n()},i.dropZone.ondragover=e=>{e.preventDefault()},i.tabs[0].onclick=()=>{i.tabs[0].classList.add("active"),i.tabs[1].classList.remove("active"),i.dropZone.classList.remove("smart-hidden"),i.urlZone.classList.add("smart-hidden"),i.updatePreview()},i.tabs[1].onclick=()=>{i.tabs[0].classList.remove("active"),i.tabs[1].classList.add("active"),i.dropZone.classList.add("smart-hidden"),i.urlZone.classList.remove("smart-hidden"),i.updatePreview("input")},i.uploadButton.onclick=()=>{i.updatePreview("input")};const n=e=>{const t=i.preview,o=i.fileUpload;function r(e){return e<1024?e+"bytes":e>=1024&&e<1048576?((e/1024).toFixed(1)+"KB").replace(".0",""):e>=1048576?(e/1048576).toFixed(1)+"MB":void 0}for(;t.firstChild;)t.removeChild(t.firstChild);const s=()=>{const e=document.createElement("div");return e.classList.add("item"),e.onpointerdown=t=>{const l=e.getBoundingClientRect();if(i.input.value="",t.clientY>=l.bottom-12){if(t.clientX>l.left+l.width/2-13&&t.clientX<l.left+l.width/2+13){e.remove();const t=i.preview.querySelectorAll(".item"),a=new DataTransfer;t.forEach((e=>{a.items.add(e.file)})),o.files=a.files,i.clearButton&&0===t.length&&i.clearButton.classList.remove("show")}}else a._openImagePreviewDialog(e.querySelector("img"))},e},d=()=>{const e=document.createElement("div");e.classList.add("list");const l=document.createElement("div");l.classList.add("smart-grid-icon","show","smart-icon-delete"),l.title=a.localize("clear"),t.appendChild(l),l.onclick=()=>{o.value="",i.input.value="",n()},i.clearButton=l,t.appendChild(e)};if("input"===e){const e=i.input.value;if(e){const t=s();if(d(),e.endsWith("png")||e.endsWith("jpeg")||e.endsWith("jpg")){const a=document.createElement("img");a.src=e,t.appendChild(a)}i.preview.lastChild.appendChild(t)}else{const e=document.createElement("p");e.textContent=a.localize("dialogImageFileUpload"),t.appendChild(e)}}else{const e=o.files;if(0===e.length){const e=document.createElement("p");e.textContent=a.localize("dialogImageFileUpload"),t.appendChild(e)}else{d();const n=new DataTransfer,c=i.column.editor.maxImages||5,m=i.column.editor.maxImageSize||524288;let u=0,b=[];for(const o of e){const e=s();if(u>=c){b.push(o.name);continue}const d=document.createElement("div");if(l(o)){d.textContent=`${o.name}, ${r(o.size)}.`,d.textContent.length>20&&(d.textContent=`${o.name.substring(0,5)}...${o.name.substring(o.name.length-4)}, ${r(o.size)}.`);const i=document.createElement("img");if(i.src=URL.createObjectURL(o),o.size>m){const e=document.createElement("p");e.textContent=a.localize("dialogImageSize",{value:o.name,fileSize:r(m)}),t.appendChild(e);continue}n.items.add(o),e.file=o,e.title=d.textContent,e.appendChild(i),e.appendChild(d)}i.preview.querySelector(".list").appendChild(e),u++}if(b.length>0){const e=document.createElement("p");e.textContent=a.localize("dialogImageCount",{files:b.toString(),fileCount:c}),t.appendChild(e)}o.files=n.files}}};i.updatePreview=n,i.fileUpload.onchange=()=>{if(0===i.fileUpload.files.length&&i._tempFiles)i.fileUpload.files=i._tempFiles;else if(i._tempFiles){const e=new DataTransfer,t=[...i.fileUpload.files];[...i._tempFiles].forEach((t=>{e.items.add(t)})),t.forEach((t=>{e.items.add(t)})),i.fileUpload.files=e.files}n()},i.input.onchange=i.input.onblur=i.input.onkeyup=()=>{i.uploadButton.disabled=!i.input.value||!i.input.value.startsWith("https://")},i.upload.onclick=()=>{i._tempFiles=[];const e=new DataTransfer;[...i.fileUpload.files].forEach((t=>{e.items.add(t)})),i._tempFiles=e.files,i.fileUpload.click()}}i.open(),setTimeout((function(){i.btnConfirm.focus()}),100)}_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}_createDialog(e){const t=this;let a=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(a.modal=e.modal),void 0!==e.screenModal&&(a.screenModal=e.screenModal),a.setAttribute("animation","none"),a.classList.add("smart-window","smart-grid-dialog"),a.style.width="auto"===e.width?e.width:e.width+"px",a.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(a.style.width=e.width),e.height&&"string"==typeof e.height&&(a.style.height=e.height),a.style.left="",a.style.top="",a.innerHTML='<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div id="headerSection" class="smart-header-section">\n <div class="smart-header"></div>\n <div class="smart-buttons-container">\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-prev-button" aria-label="Previous Record" smart-id="prevButton"></button>\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-next-button" aria-label="Next Record" smart-id="nextButton"></button>\n <button class ="smart-button smart-element smart-close-button" aria-label="Close" smart-id="closeButton"></button>\n </div>\n </div>\n <div class="smart-content"><div class="smart-content-container"></div></div>\n <div class ="smart-footer">\n <div class ="smart-stack-layout right spacing">\n <smart-button class ="smart-confirm-button item primary">Ok</smart-button>\n <smart-button class ="smart-cancel-button item">Cancel</smart-button>\n </div>\n </div>\n </div>\n </div>\n ',a.querySelector&&a.querySelector(".smart-content")&&(a.content=a.querySelector(".smart-content").firstChild),a.footer=a.querySelector(".smart-footer"),a.header=a.querySelector(".smart-header"),a.btnConfirm=a.querySelector(".smart-confirm-button"),a.btnCancel=a.querySelector(".smart-cancel-button"),a.btnClose=a.querySelector(".smart-close-button"),a.btnNext=a.querySelector(".smart-next-button"),a.btnPrev=a.querySelector(".smart-prev-button");const i=document.createElement("div");return i.classList.add("smart-grid-dialog-overlay"),i.onclick=function(){},a.overlay=i,a.remove=function(){a.parentNode&&a.parentNode.removeChild(a)},a.close=function(){a.classList.remove("open"),delete t._resizeHandling,a.addEventListener("transitionend",a.remove),a.addEventListener("transitioncancel",a.remove),a.modal&&a.overlay.parentNode&&a.overlay.parentNode.removeChild(a.overlay),a.onClose&&a.onClose()},a.open=function(i,l){a.removeEventListener("transitionend",a.remove),a.removeEventListener("transitioncancel",a.remove),t.isInShadowDOM?t.getRootNode().appendChild(a):document.body.appendChild(a),t._resizeHandling=!1,void 0===i&&(i=e.left),void 0===l&&(l=e.top),requestAnimationFrame((function(){a.classList.add("open");const e=a.querySelector('[bind="name"]');if(e){const t=e.querySelector("smart-input");t&&t.focus()}const n=function(e,i){const l=t.offset(t);switch("center"===e&&"horizontal"===i&&(e="middle"),e){case"top":return l.top;case"bottom":return Math.max(l.top,l.top+t.offsetHeight-a.offsetHeight);case"center":return Math.max(l.top,l.top+t.offsetHeight/2-a.offsetHeight/2);case"left":return l.left;case"middle":return l.left+t.offsetWidth/2-a.offsetWidth/2;case"right":return l.left+t.offsetWidth-a.offsetWidth}return"horizontal"===i?parseInt(e)+l.left:"vertical"===i?parseInt(e)+l.top:"number"==typeof e?e:parseInt(e)};a.style.left=n(i,"horizontal")+"px",a.style.top=n(l,"vertical")+"px",a.setPosition=(e,t)=>{t?a.style.left=n(e,"horizontal")+"px":a.style.top=n(e,"vertical")+"px"},"screenMiddle"===i&&(a.style.left="calc(50% - "+a.offsetWidth/2+"px)"),"screenCenter"===l&&(a.style.top="calc(50% - "+a.offsetHeight/2+"px)")})),a.modal&&(a.screenModal?t.isInShadowDOM?t.getRootNode().appendChild(a.overlay):document.body.appendChild(a.overlay):t.appendChild(a.overlay)),a.onOpen&&a.onOpen()},a}_openAddRowDialog(e,t){const a=this;if(!a.editing.addDialog.enabled)return!1;const i=a._dialogAddRow||a._createDialog(),l="{{message}}"===a.editing.dialog.header?a.localize("dialogAddHeader"):a.editing.dialog.header,n=i.content;i.header.innerHTML=l,e.grid=a,void 0===e.index&&(e.index=a.rows.length,a._rowsAdded&&(e.index+=a._rowsAdded.length));const o=e.cells;let r=null,s=0;if(a._cellEditors||(a._cellEditors=[]),!a._dialogAddRow){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogAddButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogAddButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0},i.onClose=function(){a.editing.dialog.visible=!1},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){const e={};for(let t=0;t<o.length;t++){const i=o[t],l=a._getEditorValue(i),n=a._getEditorId(i),r=a._cellEditors[n];r&&(l&&l.error?(e[i.column.dataField]=l.value,r.detach()):(e[i.column.dataField]=l,r.detach()))}const l=a._rowsAdded?a._rowsAdded.length:0,n=new Smart.Grid.Row({index:a.rows.length+l,id:Smart.Utilities.Core.createGUID(),grid:a,data:e});i.close(),t(n,0===i.index)},i.onkeydown=function(e){const t=e.key;"Enter"===t?i.btnConfirm.onclick():"Escape"===t&&i.close()},n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;s%2==0&&(r=document.createElement("div"),r.classList.add("smart-grid-edit-dialog-row"),n.appendChild(r));const i=document.createElement("div");i.classList.add("col-sm-6");const l=document.createElement("div");l.classList.add("column");const o=document.createElement("label");o.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),i.appendChild(l),r.appendChild(i),l.appendChild(o),l.appendChild(d),s++}}i.open(),i.index=e.index;let d=0;for(let e=0;e<o.length;e++){const t=o[e],l=t.column,n=l.dataField,r=i.querySelector("[editor="+n+"]");if(!r)continue;r.innerHTML="";let s="";void 0!==t.value&&(s=t.value),"int64"!==l.dataType&&"number"!==l.dataType&&"int"!==l.dataType&&"float"!==l.dataType||(s=0),"date"===l.dataType&&(s=new Date),"bool"!==l.dataType&&"boolean"!==l.dataType||(s=!1);let c=null;switch(t.editor.template){default:case"custom":c=a._getCustomCellEditor(t);break;case"image":c=a._getImageCellEditor(t);break;case"checkBox":c=a._getCheckBoxCellEditor(t);break;case"autoComplete":c=a._getAutoCompleteCellEditor(t);break;case"dropDownList":c=a._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=a._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=a._getMaskCellEditor(t);break;case"checkInput":c=a._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=a._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=a._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=a._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=a._getDateInputCellEditor(t);break;case"dateRangeInput":c=a._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=a._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=a._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?a._getNumberInputCellEditor(t):a._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(s),0===d&&setTimeout((()=>{c.focus()}),100),!t.editor.isInitialized&&(t.editor.isInitialized=!0,t.editor.onInit)){const e=t.editor.onInit(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,i="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)i[e]=a[e]}}if(t.editor.onRender){const e=t.editor.onRender(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,i="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)i[e]=a[e]}}r.appendChild(c.element),c.element.onfocus=()=>{r.setAttribute("focus","")},c.element.onblur=()=>{r.removeAttribute("focus")},d++}a._dialogAddRow=i}_openEditDialog(e,t){const a=this;if(!a.editing.dialog.enabled)return!1;const i=a._dialogEdit||a._createDialog();let l="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeader",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header;const n=i.content;!1===a.editing.enabled?(i.classList.add("disable-edit"),l="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeaderDisabled",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header):i.classList.remove("disable-edit"),i.header.innerHTML=l,i.row=a.editing.editRow,a.editing.recordNavigation&&i.classList.add("disable-animation");let o=null,r=0;if(void 0!==a._settingsDialogRowId){i.btnPrev.classList.remove("smart-hidden"),i.btnNext.classList.remove("smart-hidden");const e=e=>{const t=a.editing.editRow,l=a._recyclingRows.indexOf(t);let n=e?a._recyclingRows[l+1]:a._recyclingRows[l-1];if(a.grouping.enabled&&a.dataSource.groupBy&&a.dataSource.groupBy.length>0){let t=1;for(;n&&!n.leaf;)n=e?a._recyclingRows[l+t]:a._recyclingRows[l-t],t++}if(n){i.classList.add("disable-animation"),a.editing.recordNavigation=!0;const e=i.querySelector("[focus]");if(e){const t=e.closest(".smart-grid-edit-dialog-row"),i=t.closest(".smart-grid-edit-dialog-editors-container");let l=-1;if(i&&(l=[...i.children].indexOf(t)),a.cancelEdit(),a._openRowSettingsDialog(n.id),a._dialogEdit&&l>=0){const e=a._dialogEdit.querySelectorAll(".smart-grid-edit-dialog-row")[l];if(e&&a.editing.enabled){const t=e.querySelector(".smart-grid-dialog-editor");t.setAttribute("focus",""),t.querySelector(".smart-grid-cell-editor").focus()}}}else a.cancelEdit(),a._openRowSettingsDialog(n.id)}};i.btnNext.onmousedown=t=>{e(!0),t.preventDefault(),t.stopPropagation()},i.btnPrev.onmousedown=t=>{e(!1),t.preventDefault(),t.stopPropagation()}}if(!a._dialogEdit)if(i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0,a._settingsDialogRowId&&i.editorsContent&&i.editorsContent.offsetHeight&&(i.editorsContent.style.maxHeight=i.editorsContent.offsetHeight+40+"px")},i.onClose=function(){a.editing.dialog.visible=!1,i.row&&(i.row.showDetail=!1)},i.btnCancel.onclick=function(){a.cancelEdit()},i.btnClose.onclick=function(){a.cancelEdit()},i.btnConfirm.onclick=function(){if(void 0!==a._settingsDialogRowId){if(a.rowById[a._settingsDialogRowId]){const e=a.editing.editRow;if(!e)return!1;const t=e.cells;let l={};e.element.removeAttribute("error");for(let e=0;e<t.length;e++){const i=t[e],n=a._getEditorValue(i);l[i.column.dataField]=n}const n=a.validateRow(e.id,l);if(Object.keys(n).length>0){let e=!0;for(let l=0;l<t.length;l++){const o=t[l],r=n[o.column.dataField],s=i.querySelector(`[label-for="${o.column.dataField}"]`);if(s&&(s.innerHTML=""),r)for(let t in r){const i=r[t];let l="";if(!i)continue;let n=i[t];"minLength"!==t&&"maxLength"!==t||(n=i[t.toLowerCase()]),l=i.message?i.message:"required"===t||"valueMissing"===t?a.localize("requiredValue",{value:o.column.label}):"min"===t?a.localize("invalidMinValue",{value:o.column.label,min:n.min}):"max"===t?a.localize("invalidMaxValue",{value:o.column.label,max:n.max}):"minLength"===t?a.localize("invalidMinLengthValue",{value:o.column.label,min:n.requiredLength}):"maxLength"===t?a.localize("invalidMaxLengthValue",{value:o.column.label,max:n.requiredLength}):a.localize("invalidValue"),e=!1,s&&(s.innerHTML=l)}}if(!e)return}const o=e.style;e.updatedDate=new Date,e.updatedBy=a.currentUser,e.style=i._rowStyle,e.comments=i._rowComments;const r=a.dataSource.dataItemById[e.id];if(r){const t=r.$.index;a.dataSource&&e.comments!==a.dataSource.boundSource[t].comments&&(a._sortedColumns&&a._sortedColumns.length>0?r.comments=e.comments:a.dataSource.boundSource[t].comments=e.comments)}e.style=i._rowStyle,a.onRowStyle&&o!==e.style&&(null===o?a.onRowStyle(e.index,e,e.style):o.background===e.style.background&&o.color===e.style.color&&o.fontSize===e.style.fontSize&&o.fontStyle===e.style.fontStyle&&o.fontFamily===e.style.fontFamily&&o.fontWeight===e.style.fontWeight&&o.status===e.style.status&&o.textDecoration===e.style.textDecoration||a.onRowStyle(e.index,e,e.style))}if(i.columnVisibility){let e=!1;const t=a.columns.canNotify;a.columns.canNotify=!1;for(let t in i.columnVisibility){const l=a.columnByDataField[t];l.visible!==i.columnVisibility[t]&&(l.visible=i.columnVisibility[t],e=!0)}if(a.columns.canNotify=t,e)return a.endEdit(),a.refresh(!1),void(a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh()))}}a.endEdit(),a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh())},i.onkeydown=function(e){const t=e.key,i=a.editing.commandKeys;for(let e in i){const l=i[e];if(t===l.key){a._applyCommand(l.command);break}}},a.editing.editRow)if(void 0!==a._settingsDialogRowId)a._applySettingsDialogLayout(i,n,a.editing.editRow);else{n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;r%2==0&&(o=document.createElement("div"),o.classList.add("smart-grid-edit-dialog-row"),n.appendChild(o));const i=document.createElement("div");i.classList.add("col-sm-6");const l=document.createElement("div");l.classList.add("column");const s=a._settingsDialogRowId?document.createElement("div"):document.createElement("label");s.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),i.appendChild(l),o.appendChild(i),l.appendChild(s),l.appendChild(d),r++}}else{const t=e.column,a=document.createElement("div");a.classList.add("smart-grid-dialog-editor"),a.setAttribute("editor",""),a.setAttribute("template",t.editor.template),n.appendChild(a)}if(i.open(),a.editing.editRow){const a=i.querySelector("[editor="+e.column.dataField+"]");a&&(a.innerHTML="",a.appendChild(t.element),t.element.onfocus=()=>{a.setAttribute("focus","")},t.element.onblur=()=>{a.removeAttribute("focus")})}else{const a=e.column,l=i.querySelector("[editor]");l.innerHTML="",l.setAttribute("template",a.editor.template),l.appendChild(t.element),t.element.onfocus=()=>{l.setAttribute("focus","")},t.element.onblur=()=>{l.removeAttribute("focus")}}a._dialogEdit=i}_refreshCurrentUser(){const e=this,t=e.users;let a=e.currentUser,i=!0,l=!0,n=e.editing.enabled,o=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(i=!1!==a.allowAdd,l=!1!==a.allowComment,n=n&&!1!==a.allowEdit,o=!1!==a.allowRemove)),e._currentUser={allowAdd:i,allowComment:l,allowEdit:n,allowRemove:o,info:a}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-grid-color-input")},e}_applySettingsDialogLayout(e,t,a){const i=this;e.classList.add("smart-grid-dialog-expand-row");const l=e._rowStyle=JSON.parse(JSON.stringify(a._style)),n=e._rowComments=JSON.parse(JSON.stringify(a.comments)),o=[];e.columnVisibility=o;const r=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div");d.appendChild(r),d.appendChild(s),t.appendChild(d),d.classList.add("smart-grid-edit-dialog-layout"),r.classList.add("smart-grid-edit-dialog-editors-container"),s.classList.add("smart-grid-edit-dialog-activity-container");let c=0;for(let e=0;e<i.columns.length;e++){const t=i.columns[e];t.allowEdit&&!1!==t._visible&&c++}c>=8?r.classList.add("many"):r.classList.remove("many"),e.editorsContent=r,e.activityContent=s;const m=document.createElement("div"),u=document.createElement("div");s.appendChild(m),s.appendChild(u);let b=n&&n.length?" ("+n.length+")":"";m.innerHTML=`\n <div class="tabs">\n <div view="details" class="active tab"><div class="tab-label">${i.localize("detailsTab")}</div></div>\n <div view="comments" class="tab"><div class="tab-label">${i.localize("commentsTab")}${b}</div></div>\n <div view="history" class="tab smart-hidden"><div class="tab-label">${i.localize("historyTab")}</div></div>\n </div>\n <div class="details-tab">\n <div class="smart-grid-edit-dialog-row"><div class="column"><div class="header smart-grid-edit-dialog-column-info">${i.localize("format").replace(":","")}\n <span title="${i.localize("resetFormat")}" class="reset-format smart-grid-icon smart-icon-reload show"></span>\n </div>\n </div>\n <div class="format-layout">\n <div title="${i.localize("background")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-color-background show"></span><div class="background"></div>\n </div>\n <div title="${i.localize("color")}" class="format smart-grid-edit-dialog-column-info">\n <span style="border-bottom: 2px solid #46CA78;" color="#46CA78" class="format smart-grid-icon smart-icon-font show"></span><div class="color"></div>\n </div>\n <div class="format-layout button-group">\n <span title="${i.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${i.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${i.localize("underline")}" class="formatbtn underline smart-grid-icon smart-icon-underline show"></span>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("fontFamily").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-font show"></span><div class="font-family"></div>\n </div>\n <div title="${i.localize("fontSize").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-fontsize show"></span><div class="font-size"></div>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("status").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span color="#F1C58B" class="smart-grid-icon smart-icon-star show"></span><div class="status"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="comments-tab smart-hidden">\n <div class="column"><div class="comments-header smart-grid-edit-dialog-column-info">${i.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments">${i.localize("noComments")}</span></div>\n <div class="footer">\n <smart-text-area hint="${i.localize("comment")}" placeholder="${i.localize("comment")}" class="success underlined"></smart-text-area>\n <smart-button class="success">${i.localize("send")}</smart-button>\n </div>\n </div>\n </div>\n <div class="history-tab smart-hidden">\n <div class="history-layout">\n </div>\n </div>\n `;const g=m.querySelectorAll(".tab");i.storeHistory&&(!i._currentUser||i._currentUser&&!i._currentUser.info?g[g.length-1].classList.add("smart-hidden"):g[g.length-1].classList.remove("smart-hidden")),!i.users||i.users&&0===i.users.length||!i._currentUser||i._currentUser&&!i._currentUser.info?g[g.length-2].classList.add("smart-hidden"):g[g.length-2].classList.remove("smart-hidden"),m.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),a=m.querySelector(".details-tab"),l=m.querySelector(".comments-tab"),n=m.querySelector(".history-tab");a.classList.add("smart-hidden"),l.classList.add("smart-hidden"),n.classList.add("smart-hidden");for(let e=0;e<g.length;e++)g[e].classList.remove("active");switch(t.classList.add("active"),e){case"details":a.classList.remove("smart-hidden");break;case"comments":l.classList.remove("smart-hidden");break;case"history":n.classList.remove("smart-hidden"),i._refreshHistory()}}};const p=i._getColorInput();m.querySelector(".background").appendChild(p),p.onchange=()=>{l.background=p.value},l.background&&(p.value=l.background);const y=i._getColorInput();m.querySelector(".color").appendChild(y),y.onchange=()=>{l.color=y.value},l.color&&(y.value=l.color);const v=i._getColorInput();m.querySelector(".status").appendChild(v),v.onchange=()=>{l.status=v.value},l.status&&(v.value=l.status);const f=document.createElement("smart-input");f.style.width="auto",f.classList.add("underlined"),f.dropDownButtonPosition="right",f.readonly=!0,f.dropDownHeight="auto",f.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],f.onchange=()=>{l.fontFamily=f.value},l.fontFamily?f.value=l.fontFamily:f.selectedIndex=0,m.querySelector(".font-family").appendChild(f);const h=document.createElement("smart-input");h.style.width="auto",h.classList.add("underlined"),h.dropDownButtonPosition="right",h.readonly=!0,h.dropDownHeight="auto",h.dataSource=["-","8px","10px","12px","14px","18px","24px","36px"],h.onchange=()=>{l.fontSize=h.value},l.fontSize?h.value=l.fontSize:h.selectedIndex=0,m.querySelector(".font-size").appendChild(h);const C=m.querySelector(".button-group");C.onclick=e=>{const t=e.target.closest(".formatbtn");let a;t.classList.contains("checked")?(t.classList.remove("checked"),a=!1):(t.classList.add("checked"),a=!0),t.classList.contains("bold")?l.fontWeight=a?"bold":null:t.classList.contains("italic")?l.fontStyle=a?"italic":null:t.classList.contains("underline")&&(l.textDecoration=a?"underline":null)},l.fontWeight?C.children[0].classList.add("checked"):C.children[0].classList.remove("checked"),l.fontStyle?C.children[1].classList.add("checked"):C.children[1].classList.remove("checked"),l.textDecoration?C.children[2].classList.add("checked"):C.children[2].classList.remove("checked"),m.querySelector(".reset-format").onclick=()=>{for(let e=0;e<C.children.length;e++)C.children[e].classList.remove("checked");f.selectedIndex=0,h.selectedIndex=0,y.value="",p.value="",v.value="",l.fontWeight=null,l.fontStyle=null,l.textDecoration=null,l.fontSize=null,l.fontFamily=null};const w=m.querySelector(".comments-header"),S=m.querySelector('[view="comments"]'),A=m.querySelector(".comments-layout smart-text-area"),D=m.querySelector(".comments-layout smart-button"),L=m.querySelector(".comments-layout .footer"),_=m.querySelector(".comments-layout .comments");D.disabled=!0,_.innerHTML=`<span class="no-comments">${i.localize("noComments")}</span>`;const k=()=>{const e=_.querySelector(".no-comments");0===n.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},x=e=>{e.querySelector(".remove-button").onclick=e=>{const t=e.target,l=n.indexOf(t.comment);if(l>-1){const e=n[l];n.splice(l,1),i.$.fireEvent("commentRemove",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,n),t.element.remove();const o=n.length?"("+n.length+")":"";w.innerHTML=S.innerHTML=`${i.localize("comments").replace(":","")} ${o}`}}};for(let e=0;e<n.length;e++){const t=n[e],a=i._createComment(t);x(a),_.appendChild(a)}w.innerHTML=`${i.localize("comments").replace(":","")} ${b}`,k(),A.onfocus=()=>{L.classList.add("focus")},A.onblur=()=>{L.classList.remove("focus")},A.onkeyup=()=>{D.disabled=""===A.value},D.onclick=()=>{if(""===A.value)return;i._refreshCurrentUser();const e={text:A.value,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:i._currentUser.info?i._currentUser.info.id:-1,time:new Date},t=i._createComment(e);x(t),n.push(e),i.$.fireEvent("commentAdd",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,n),A.value="",D.disabled=!0,k(),_.appendChild(t);const l=n.length?"("+n.length+")":"";w.innerHTML=S.innerHTML=`${i.localize("comments").replace(":","")} ${l}`};for(let e=0;e<i.columns.length;e++){const t=i.columns[e];if(!t.allowEdit||!1===t._visible)continue;const a=document.createElement("div");a.classList.add("smart-grid-edit-dialog-row"),r.appendChild(a);const l=document.createElement("div"),n=i._settingsDialogRowId?document.createElement("div"):document.createElement("label"),s=t.validationRules&&t.validationRules.length>0?"*":"";n.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${i.columns[e].icon} show"></span><label>`+i.columns[e].label+s+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template);const c=n.querySelector("[toggle]");c.column=t,o[t.dataField]=t.visible,c.title=i.localize("columnMenuItemHide"),!1===i.editing.enabled&&c.classList.add("smart-visibility-hidden"),c.onclick=()=>{o[c.column.dataField]=!c.column.visible,c.classList.contains("smart-icon-visibility-on")?(c.classList.remove("smart-icon-visibility-on"),c.classList.add("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemShow")):(c.classList.add("smart-icon-visibility-on"),c.classList.remove("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemHide"))},t.visible||(c.classList.remove("smart-icon-visibility-on"),c.title=i.localize("columnMenuItemShow")),t.visible?c.classList.add("smart-icon-visibility-on"):c.classList.add("smart-icon-visibility-off"),l.appendChild(n),l.appendChild(d);const m=document.createElement("label");m.classList.add("smart-field-editor-error-label"),m.setAttribute("label-for",t.dataField),l.appendChild(m),a.appendChild(l)}}_refreshHistory(){const e=this,t=e._dialogEdit;if(!t)return;const a=t.querySelector(".history-layout");if(!e.storeHistory)return void a.classList.add("smart-hidden");if(!e._currentUser||e._currentUser&&!e._currentUser.info)return void a.classList.add("smart-hidden");a.classList.remove("smart-hidden");const i=t.row.history;if(!i)return;let l="\n ";for(let t=i.length-1;t>=0;t--){const a=i[t];let n="";if(e._kanban)n=e._kanban._getHistoryItemLabel(a);else if("created"===a.action)n=e.localize("rowCreated",{value:a.action});else{const t=e.columnByDataField[a.action];n=e.localize("propertyUpdated",{value:t?t.label:a.action})}if(l+='<div class="history-row">',void 0!==a.user){const t=(t=>{const a=t?t.image:null;return{image:a?`background-image: url('${a}');`:"",label:t?t.name||t.id:e.localize("guestUser"),cssClass:a?"image":""}})(e.users.find((e=>e.id===a.user)));l+=`<div class="history-user"><div class="user-icon smart-user ${t.cssClass}" style="${t.image}"></div><div class="user-name">${t.label}</div><div class="time">${new Smart.Utilities.DateTime(a.date).toString("dd/MM/yyyy hh:mm")}</div></div>`}else l+="<div></div>";if(l+='<div class="history-action">',l+=`<div>${n}</div>`,"created"!==a.action){let t=a.details.oldValue,i=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t||e.id===parseFloat(t))),l=e.users.find((e=>e.id===i||e.id===parseFloat(i)));a?t=a.name:(t="",t||(t=e.localize("unassigned"))),l?i=l.name:(i="",i||(i=e.localize("unassigned")))}if("subtasks"===a.action){const t=a.details.value.filter((e=>e.completed));e._kanban?l+=`<span class="detail smart-truncate">${e._kanban.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span>`:l+=`<span class="detail smart-truncate">${e.localize("nullRange",{value:t.length})}</span>`}else{t&&"object"==typeof t&&t instanceof Date&&(t=t.toLocaleString()),i&&"object"==typeof i&&i instanceof Date&&(i=i.toLocaleString());let n=e.columnByDataField[a.action];n||(n=e.columnByDataField["task"+a.action.substring(0,1).toUpperCase()+a.action.substring(1)]),"user"===a.action&&(n=e.columnByDataField.taskUserId);let o="";n&&n.label&&(o='"'+n.label+'"'),n&&"date"===n.dataType&&(t&&"string"==typeof t&&(t=new Date(t).toLocaleString()),i&&"string"==typeof i&&(i=new Date(i).toLocaleString())),l+=t?`<span class="detail smart-truncate">${e.localize("range",{column:o,oldValue:t,newValue:i})}</span>`:`<span class="detail smart-truncate">${e.localize("nullRange",{column:o,oldValue:t,newValue:i})}</span>`}}else l+=`<div>${a.details.value}</div>`;l+="</div>\n </div>"}l+="",a.innerHTML=l}_createComment(e){const t=this,a=t.users.find((t=>t.id===e.userId)),i=document.createElement("div"),l=a?a.name||a.id:t.localize("guestUser"),n=a?a.name:t.localize("guestUser"),o=a.image?a.image:"";if(i.className="comment",i.setAttribute("role","listitem"),i.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${l}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${n}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n</div>\n<div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,o){const e=i.querySelector(".user-icon");e.style.backgroundImage=`url('${o}')`,e.classList.add("image")}i.comment=e;const r=i.querySelector(".remove-button");return r.comment=e,r.element=i,e.userId!==t._currentUser.info.id&&r.classList.add("smart-visibility-hidden"),i}_openSummaryRowDialog(e){const t=this,a=t._summaryRowDialog||t._createDialog(),i="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(a.header.innerHTML=i,!a.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",a.content.innerHTML="",a.listBox=e}const l=a.listBox;a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser");const n=e.element.querySelector(".summary-value");if(!n)return;n.classList.add("summary-chooser"),a.summaryValueElement=n;let o=[];a.dataField=e.column.dataField,o="string"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:"boolean"===e.column.dataType||"any"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"}]:"date"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:[{label:t.localize("countSummary"),value:"count"},{label:t.localize("minSummary"),value:"min"},{label:t.localize("maxSummary"),value:"max"},{label:t.localize("sumSummary"),value:"sum"},{label:t.localize("avgSummary"),value:"avg"}],l.dataSource=o,l.style.position="absolute",l.style.visibility="hidden",l.style.height="auto",t.isInShadowDOM?t.getRootNode().appendChild(l):document.body.appendChild(l);const r=e.column;r.summary&&r.summary.forEach((e=>{l.select(e)}));const s=l.offsetHeight;a.column=r,a.content.appendChild(l),a.classList.add("smart-grid-dialog-summary"),a.header.parentElement.classList.add("smart-hidden"),a.footer.classList.add("smart-hidden"),l.style.visibility="",l.style.position="",l.style.width="100%",t._summaryRowDialog||(a.btnConfirm.innerHTML=t.localize("apply"),a.btnCancel.innerHTML=t.localize("cancel"),a.style.width=a.style.minWidth="120px",a.onOpen=function(){t.editing.dialog.visible=!0},a.onClose=function(){t.editing.dialog.visible=!1,a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser")},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e=a.column.summary;a.column.summary=l.selectedValues,t.$.fireEvent("columnSummaryChange",{column:a.column,dataField:r.dataField,oldSummary:[...e],summary:[...a.column.summary]}),a.close(),t._calculateSummary(),t._recycle(!1)},a.confirm=function(){a.btnConfirm.click()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},t._summaryRowDialog=a);const d=e.element,c=t.offset(d),m=t.offset(t);let u=d.offsetWidth+c.left-m.left-120;u<0&&(u=c.left-m.left),a.open(u,c.top-m.top-s-0),setTimeout((function(){a.btnConfirm.focus()}),100)}_openDescriptionDialog(e,t){const a=this,i=a._dialogDescription||a._createDialog(),l=a.localize("dialogDescriptionHeader",{value:e.label});if(i.header.innerHTML=l,i.column=e,i.command=t,i.classList.add("smart-grid-dialog-add-column"),!a._dialogDescription){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){const e=i.querySelector("smart-input");"duplicate"!==t&&setTimeout((()=>{e.select()}),250)},i.onClose=function(){},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){const e=i.querySelector("smart-input");switch(i.command){case"duplicate":0===e.selectedIndex?a.duplicateCommand(i.column,null,!0):a.duplicateCommand(i.column,null,!1);break;case"rename":i.column.label=e.value;break;case"editDescription":i.column.description=e.value}i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogDescription=i;const e=document.createElement("smart-input");e.classList.add("underlined"),e.dataSource="duplicate"!==t?[]:[{label:a.localize("duplicateCells"),value:"cells"},{label:a.localize("duplicateSettings"),value:"settings"}],i.content.appendChild(e)}const n=e.element,o=a.offset(n),r=a.offset(a);i.open(o.left-r.left,o.top+n.offsetHeight-r.top);const s=i.querySelector("smart-input");switch(s.selectedIndex=0,s.readonly=!0,s.dropDownButtonPosition="right",t){case"rename":s.value=e.label;break;case"editDescription":s.value=e.description}setTimeout((function(){i.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const a=this;if(!a.editing.deleteDialog.enabled)return!1;const i=a._dialogDelete||a._createDialog(),l="{{message}}"===a.editing.dialog.header?a.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):a.editing.dialog.header;i.header.innerHTML=l,i.content.innerHTML=a.localize("dialogDeleteContent"),i.row=e,a._dialogDelete||(i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogDeleteButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogDeleteButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0},i.onClose=function(){a.editing.dialog.visible=!1},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){t(i.row),i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogDelete=i),i.open(),setTimeout((function(){i.btnConfirm.focus()}),100)}_getTypesList(){const e=this,t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"image",prefix:'<span class="smart-grid-icon visible smart-icon-image"></span>',label:e.localize("dialogAddColumnTypeImage")},{value:"number",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeNumber")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")},{value:"boolean",prefix:'<span class="smart-grid-icon visible smart-icon-check-squared"></span>',label:e.localize("dialogAddColumnTypeCheckBox")},{value:"date",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDate")},{value:"createdTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeCreatedTime")},{value:"updatedTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedTime")},{value:"createdBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCreatedBy")},{value:"updatedBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedBy")},{value:"collaborator",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCollaborator")},{value:"slider",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeSlider")},{value:"autoNumber",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeAutoNumber")},{value:"url",prefix:'<span class="smart-grid-icon visible smart-icon-link"></span>',label:e.localize("dialogAddColumnTypeURL")},{value:"email",prefix:'<span class="smart-grid-icon visible smart-icon-mail"></span>',label:e.localize("dialogAddColumnTypeEmail")},{value:"phone",prefix:'<span class="smart-grid-icon visible smart-icon-phone"></span>',label:e.localize("dialogAddColumnTypePhone")},{value:"password",prefix:'<span class="smart-grid-icon visible smart-icon-lock"></span>',label:e.localize("dialogAddColumnTypePassword")}];if(e.header.visible&&e.header.buttons.indexOf("views")>=0){const a={value:"startDate",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeStartDate")},i={value:"dueDate",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDueDate")},l={value:"progress",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeProgress")},n={value:"priority",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypePriority")},o={value:"status",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("status")},r={value:"name",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeName")},s={value:"description",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeDescription")},d={value:"tags",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeTags")},c={value:"checklist",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeChecklist")},m={value:"color",prefix:'<span class="smart-grid-icon visible smart-icon-color-background"></span>',label:e.localize("dialogAddColumnTypeColor")};t.push(a),t.push(i),t.push(l),t.push(n),t.push(r),t.push(s),t.push(d),t.push(c),t.push(m),t.push(o)}return t}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),a=new Date(t,6,30);return[{bind:"kanban",name:"kanban",type:"radio",label:e.localize("kanbanNoneDescription"),filter:"kanban",options:[{value:"blank",checked:!0,label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"description",type:"input",label:e.localize("dialogAddColumnDescription"),filter:"any",placeholder:e.localize("dialogAddColumnDescriptionPlaceholder"),info:e.localize("dialogAddColumnDescriptionInfo")},{bind:"type",name:"typeslist",type:"dropDownList",filter:"any",label:e.localize("dialogAddColumnType"),icon:"smart-icon-font",options:e._getTypesList(),info:e.localize("dialogAddColumnTypeInfo")},{bind:"dateFormat",name:"dateformat",type:"dropDownList",label:e.localize("dialogAddColumnDateFormat"),options:[{value:"M/d/yyyy",label:e.localize("dialogAddColumnDateFormatShort")+" ("+new Smart.Utilities.DateTime(a).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(a).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(a).toString("ISO8601")+")"},{value:"d/M/yyyy",label:e.localize("dialogAddColumnDateFormatEU")+" (30/7/"+t+")"},{value:"yyyy-MM-dd",label:e.localize("dialogAddColumnDateFormatAS")+" ("+t+"-30-07)"},{value:"MMMM, dd, yyyy",label:e.localize("dialogAddColumnDateFormatFull")+" (July, 30, "+t+")"}],filter:"date",info:e.localize("dialogAddColumnDateFormatInfo")},{bind:"timeFormat",name:"timeformat",type:"dropDownList",label:e.localize("dialogAddColumnTimeFormat"),filter:"time",width:"50%",options:[{value:"hh:mm",label:"12 "+e.localize("dialogAddColumnTimeFormatHour")},{value:"HH:mm",label:"24 "+e.localize("dialogAddColumnTimeFormatHour")}],info:e.localize("dialogAddColumnTimeFormatInfo")},{bind:"allowTimeFormat",type:"boolean",label:e.localize("dialogAddColumnAllowTimeFormat"),filter:"date",value:!1,info:""},{bind:"allowCustomDateSeparator",type:"boolean",label:e.localize("dialogAddColumnCustomDateSeparator"),filter:"date",value:!1,info:""},{bind:"dateFormatSeparator",name:"dateFormatSeparator",type:"radio",label:"",filter:"date",columns:3,options:[{value:"/",label:e.localize("dialogAddColumnDateFormatSlash")+" (/)"},{value:"-",label:e.localize("dialogAddColumnDateFormatHyphen")+" (-)"},{value:".",label:e.localize("dialogAddColumnDateFormatDot")+" (.)"}]},{bind:"numberFormat",name:"numberFormat",type:"dropDownList",label:e.localize("dialogAddColumnNumberFormat"),filter:"number",options:[{value:{style:"decimal",maximumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatInteger")+" 1,000"},{value:{style:"decimal",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatNumber")+" 1,000.12"},{value:{style:"percent",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatPercent")+" 10.12%"},{value:{style:"percent",maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatPercentRounded")+" 10%"},{value:{style:"decimal",notation:"scientific"},label:e.localize("dialogAddColumnNumberFormatScientific")+" 1.01E+03"},{value:{style:"decimal",notation:"engineering"},label:e.localize("dialogAddColumnNumberFormatEngineering")+" 34.284 x 10^9"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,currencySign:"accounting"},label:e.localize("dialogAddColumnNumberFormatAccounting")+" $(1,000.12)"},{value:{style:"unit",unit:"kilogram"},label:e.localize("dialogAddColumnNumberFormatUnit")+" 10.12 kg"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency},label:e.localize("dialogAddColumnNumberFormatCurrency")+" $1,000.12"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatCurrencyRounded")+" $1,000"}],required:!1,info:e.localize("dialogAddColumnNumberFormatInfo")},{bind:"currency",name:"currency",type:"dropDownList",filter:"number",required:!1,options:e._getCurrencies(),label:e.localize("dialogAddColumnNumberFormatCurrency"),info:e.localize("dialogAddColumnNumberFormatCurrencyInfo")},{bind:"unit",name:"unit",type:"dropDownList",filter:"number",required:!1,options:[{value:"acre",label:e.localize("dialogAddColumnNumberFormatUnitAcre")},{value:"percent",label:e.localize("dialogAddColumnNumberFormatUnitPercent")},{value:"degree",label:e.localize("dialogAddColumnNumberFormatUnitDegree")},{value:"megabyte",label:e.localize("dialogAddColumnNumberFormatUnitMegaByte")},{value:"centimeter",label:e.localize("dialogAddColumnNumberFormatUnitCentimeter")},{value:"meter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")},{value:"kilometer",label:e.localize("dialogAddColumnNumberFormatUnitKilometer")},{value:"mile",label:e.localize("dialogAddColumnNumberFormatUnitMile")},{value:"celsius",label:e.localize("dialogAddColumnNumberFormatUnitCelsius")},{value:"fahrenheit",label:e.localize("dialogAddColumnNumberFormatUnitFahrenheit")},{value:"kilogram",label:e.localize("dialogAddColumnNumberFormatUnitKilogram")},{value:"pound",label:e.localize("dialogAddColumnNumberFormatUnitPound")},{value:"liter",label:e.localize("dialogAddColumnNumberFormatUnitLiter")},{value:"gallon",label:e.localize("dialogAddColumnNumberFormatUnitGallon")},{value:"second",label:e.localize("dialogAddColumnNumberFormatUnitSecond")},{value:"minute",label:e.localize("dialogAddColumnNumberFormatUnitMinute")},{value:"hour",label:e.localize("dialogAddColumnNumberFormatUnitHour")},{value:"day",label:e.localize("dialogAddColumnNumberFormatUnitDay")},{value:"week",label:e.localize("dialogAddColumnNumberFormatUnitWeek")},{value:"month",label:e.localize("dialogAddColumnNumberFormatUnitMonth")},{value:"year",label:e.localize("dialogAddColumnNumberFormatUnitYear")}],label:e.localize("dialogAddColumnNumberFormatUnit"),info:e.localize("dialogAddColumnNumberFormatUnitInfo")},{bind:"minLength",name:"minlength",width:"50%",type:"number",filter:"text",required:!1,label:e.localize("dialogAddColumnMinLength"),info:e.localize("dialogAddColumnMinLengthInfo")},{bind:"maxLength",name:"maxlength",width:"50%",filter:"text",type:"number",required:!1,label:e.localize("dialogAddColumnMaxLength"),info:e.localize("dialogAddColumnMaxLengthInfo")},{bind:"minValue",name:"minvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMinValue"),info:e.localize("dialogAddColumnMinValueInfo")},{bind:"maxValue",name:"maxvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMaxValue"),info:e.localize("dialogAddColumnMaxValueInfo")},{bind:"minDateTime",name:"mindatetime",type:"datetime",filter:"date",width:"50%",label:e.localize("dialogAddColumnMinDate"),info:e.localize("dialogAddColumnMinDateInfo")},{bind:"maxDateTime",name:"maxdatetime",type:"datetime",width:"50%",filter:"date",label:e.localize("dialogAddColumnMaxDate"),info:e.localize("dialogAddColumnMaxDateInfo")},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"allowCheckItems",type:"boolean",filter:"hidden",value:!1,label:e.localize("dialogAddColumnCheckItems"),info:""},{bind:"allowMultipleCollaborators",type:"boolean",filter:"collaborator",value:!1,label:e.localize("dialogAddColumnMultipleCollaborators"),info:e.localize("dialogAddColumnMultipleCollaboratorsInfo")},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""},{bind:"users",name:"users",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"collaborator",info:""},{name:"align",bind:"cellsAlign",type:"dropDownList",label:e.localize("dialogAddColumnAlign"),required:!1,options:[{value:"left",label:e.localize("dialogAddColumnAlignLeft")},{value:"right",label:e.localize("dialogAddColumnAlignRight")},{value:"center",label:e.localize("dialogAddColumnAlignCenter")}],filter:"any",info:e.localize("dialogAddColumnAlignInfo")},{bind:"allowResize",type:"boolean",filter:"any",width:"50%",label:e.localize("dialogAddColumnResizable"),info:e.localize("dialogAddColumnResizableInfo")},{bind:"required",type:"boolean",width:"50%",filter:"text",value:!1,label:e.localize("dialogAddColumnRequired"),info:e.localize("dialogAddColumnRequiredInfo")},{bind:"allowSort",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnSortable"),info:e.localize("dialogAddColumnSortableInfo")},{bind:"allowFilter",type:"boolean",align:"left",width:"50%",filter:"any",label:e.localize("dialogAddColumnFilterable"),info:e.localize("dialogAddColumnFilterableInfo")},{bind:"allowEdit",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnEditable"),info:e.localize("dialogAddColumnEditableInfo")}]}_getKanbanFields(){return["startDate","dueDate","progress","checklist","priority","tags","name","color","description","status"]}_addColumnDialogShowHideEditors(e){const t=this,a=t._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input").getSelectedItem().value,i=t._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),l=t._getKanbanFields(),n=t._dialogAddColumn.querySelector('[field-name="kanbanNotes"]');n&&("kanban"!==t.view?n.classList.add("smart-hidden"):n.classList.remove("smart-hidden"));let o=!!e;for(let n=0;n<i.length;n++){const r=i[n],s=r.getAttribute("filter"),d=r.getAttribute("bind"),c=r.parentNode;if(c.classList.add("smart-hidden"),"cellsAlign"===d&&("boolean"===a||"image"===a||"email"===a||"url"===a||"collaborator"===a||"createdBy"===a||"password"===a||"phone"===a||"createdTime"===a||"updatedBy"===a||"updatedTime"===a||l.indexOf(a)>=0))c.classList.add("smart-hidden");else if("type"===d&&o)c.classList.add("smart-hidden");else if("allowEdit"===d&&(!1===t.editing.enabled||"autoNumber"===a||"createdBy"===a||"updatedBy"===a||"createdTime"===a||"updatedTime"===a||l.indexOf(a)>=0))c.classList.add("smart-hidden");else if("allowResize"!==d||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==d||!1!==t.filtering.enabled)if("allowSort"!==d||!1!==t.sorting.enabled)if("required"!==d||!1!==t.editing.enabled&&("string"===a||"multiText"===a))if(e&&e.disabledDialogOptions&&e.disabledDialogOptions.length>0&&e.disabledDialogOptions.indexOf(d)>=0)c.classList.add("smart-hidden");else{if(e&&"kanban"===t.view){switch(d){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":c.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===s&&c.classList.remove("smart-hidden")}if("any"!==s)switch(a){default:case"text":"text"===s&&c.classList.remove("smart-hidden"),e&&"any"===e.dataType&&c.classList.add("smart-hidden");break;case"slider":case"number":if("number"===s&&c.classList.remove("smart-hidden"),"unit"===d||"currency"===d){c.classList.add("smart-hidden");const e=t._dialogAddColumn.querySelector('[field-name="numberFormat"]'),a=t._dialogAddColumn.querySelector('[field-name="unit"]'),i=t._dialogAddColumn.querySelector('[field-name="currency"]'),l=e.querySelector("smart-input"),n=()=>{const e=l.getSelectedItem();i.classList.add("smart-hidden"),e&&"unit"===e.value.style?a.classList.remove("smart-hidden"):e&&"currency"===e.value.style?i.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};e.onchange=()=>{n()},n()}break;case"select":case"multiSelect":s.indexOf("list")>=0&&c.classList.remove("smart-hidden");break;case"collaborator":s.indexOf("collaborator")>=0&&c.classList.remove("smart-hidden");break;case"createdBy":case"updatedBy":case"autoNumber":case"createdTime":case"updatedTime":case"url":case"email":case"image":case"phone":case"password":case"startDate":case"dueDate":case"progress":case"checklist":case"priority":case"tags":case"name":case"description":case"assigned":case"status":case"boolean":break;case"date":{const e=t._dialogAddColumn.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;"date"===s&&c.classList.remove("smart-hidden");const a=e=>{const a=t._dialogAddColumn.querySelector('[field-filter="time"]'),i=t._dialogAddColumn.querySelector('[field-name="dateFormat"]');e?(a.classList.remove("smart-hidden"),i.style.width="50%",i.style.float="left"):(a.classList.add("smart-hidden"),i.style.width="",i.style.float="")},i=e=>{const a=t._dialogAddColumn.querySelector('[field-name="allowTimeFormat"]'),i=a.querySelector(".smart-grid-dialog-editor");e.indexOf("T")>=0?(a.classList.add("smart-hidden"),i.uncheck()):a.classList.remove("smart-hidden")},l=e=>{const a=t._dialogAddColumn.querySelector('[field-name="dateFormatSeparator"]');e?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};if("allowTimeFormat"===d){const e=r.querySelector(".smart-input").value;r.onchange=e=>{a(e)},a(e)}if("dateFormat"===d){const e=r.querySelector(".smart-input").value;r.onchange=e=>{i(e.detail.value)},i(e)}if("dateFormatSeparator"===d){const e=t._dialogAddColumn.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;l(e)}if("allowCustomDateSeparator"===d){e.indexOf("T")>=0&&e.indexOf("-")>0&&r.uncheck();const t=r.querySelector(".smart-input").value;r.onchange=e=>{l(e)},l(t)}i(e);break}}else c.classList.remove("smart-hidden")}else c.classList.add("smart-hidden");else c.classList.add("smart-hidden");else c.classList.add("smart-hidden");else c.classList.add("smart-hidden")}}_addColumnDialogInitEditors(){const e=this,t=e._dialogAddColumn.editColumn,a=e._getAddColumnDialogTemplate();for(let i in e._addColumnDialogEditors){const l=e._addColumnDialogEditors[i],n=l.querySelector("input"),o=l.querySelector("smart-input");switch(i){case"allowTimeFormat":{const e=l.querySelector(".smart-input");t&&t.editor?"dateInput"===t.editor.template?(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowCustomDateSeparator":{const a=l.querySelector(".smart-input");a.value=!1,a.removeAttribute("checked");let i=0;t&&t.cellsFormat&&(t.cellsFormat.indexOf(".")>=0?(a.value=!0,a.setAttribute("checked",""),i=2):(t.cellsFormat.indexOf("M-d-yyyy")>=0||t.cellsFormat.indexOf("d-M-yyyy")>=0||t.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(a.value=!0,a.setAttribute("checked",""),i=1));const n=e._addColumnDialogEditors.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");n.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n[i].setAttribute("checked",""),n[i].value=!0;break}case"kanban":{const t=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let a=0;a<t.length;a++)t[a].onchange=t=>{const a=[...t.parentElement.children].indexOf(t),i=t.parentElement.parentElement.previousElementSibling,l=e._dialogAddColumn.querySelector('[field-name="options"]'),n=e._dialogAddColumn.querySelector('[field-name="allowColorItems"]'),o=e._addColumnDialogEditors.name,r=()=>{const t=l.querySelector("smart-sortable");t&&(t._validate(),e._dialogAddColumn&&e._dialogAddColumn.offsetHeight&&e._dialogAddColumn.setPosition("center"))};switch(a){case 0:i.innerHTML=e.localize("kanbanNoneDescription"),n.classList.add("smart-hidden"),l.classList.add("smart-hidden"),o.querySelector("input").value=e.localize("dialogNewColumn"),r();break;case 1:i.innerHTML=e.localize("kanbanBasicDescription"),n.classList.remove("smart-hidden"),l.classList.remove("smart-hidden"),o.querySelector("input").value=e.localize("status"),r()}};break}case"dateFormat":t&&t.cellsFormat?t.cellsFormat.indexOf("M/d/yyyy")>=0?o.selectedIndex=0:t.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?o.selectedIndex=1:t.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?o.selectedIndex=2:t.cellsFormat.indexOf("d/M/yyyy")>=0?o.selectedIndex=3:t.cellsFormat.indexOf("yyyy-MM-dd")>=0?o.selectedIndex=4:t.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(o.selectedIndex=5):o.selectedIndex=0;break;case"timeFormat":t&&t.cellsFormat&&t.cellsFormat.indexOf("HH")>=0&&-1===t.cellsFormat.indexOf("T")?o.selectedIndex=1:o.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!0;t&&t.editor&&t.editor.singleSelect&&(e=!1);const a=l.querySelector(".smart-input");t?e?(a.value=!0,a.setAttribute("checked","")):(a.value=!1,a.removeAttribute("checked")):(a.value=!0,a.setAttribute("checked",""));break}case"numberFormat":if(t&&"numberInput"===t.editor.template&&t.editor.numberFormat)if("decimal"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=0;else if("decimal"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=1;else if("percent"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=2;else if("percent"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=3;else if("decimal"===t.editor.numberFormat.style&&"scientific"===t.editor.numberFormat.notation)o.selectedIndex=4;else if("decimal"===t.editor.numberFormat.style&&"engineering"===t.editor.numberFormat.notation)o.selectedIndex=5;else if("currency"===t.editor.numberFormat.style&&"accounting"===t.editor.numberFormat.currencySign)o.selectedIndex=6;else if("unit"===t.editor.numberFormat.style){o.selectedIndex=7;const a=t.editor.numberFormat.unit,i=e._addColumnDialogEditors.unit.querySelector("smart-input");i.dataSource.forEach(((e,t)=>{if(e.value===a)return i.selectedIndex=t,!0}))}else"currency"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits&&0===t.editor.numberFormat.minimumFractionDigits?o.selectedIndex=9:"currency"===t.editor.numberFormat.style&&(o.selectedIndex=8);else o.selectedIndex=0;break;case"currency":if(t&&"numberInput"===t.editor.template&&t.editor.numberFormat){if("currency"===t.editor.numberFormat.style){const a=e._getCurrencies().findIndex((e=>e.value===t.editor.numberFormat.currency));a>=0&&(o.selectedIndex=a)}}else o.selectedIndex=0;break;case"allowCheckItems":{const e=l.querySelector(".smart-input");t?t.editor&&!t.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowColorItems":{const e=l.querySelector(".smart-input");t?t.editor&&t.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowResize":case"allowSort":case"allowEdit":case"allowFilter":case"required":{const e=l.querySelector(".smart-input"),n=a.find((e=>{if(e.bind===i)return e}));t?t[i]?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,n&&void 0!==n.value&&(e.value=n.value),e.value&&e.setAttribute("checked",""));break}}if(!t||"options"!==i&&"users"!==i){const t=l.querySelector("smart-sortable");if(t&&t._init)if("users"===i){let a=[];for(let t=0;t<e.users.length;t++)a.push({color:e.users[t].color,label:e.users[t].name,id:e.users[t].id,image:e.users[t].image});t._init(a)}else t._init()}else{const e=l.querySelector("smart-sortable");if(e&&e._init)if(t.editor.singleSelect){const a=t.editor.dataSource.filter((e=>""!==e));e._init(a)}else"multiComboInput"===t.editor.template&&e._init(JSON.parse(JSON.stringify(t.editor.dataSource)))}if(t&&"type"===i?("number"===t.dataType||"int"===t.dataType?o.selectedIndex=3:"date"===t.dataType?o.selectedIndex=7:"bool"!==t.dataType&&"boolean"!==t.dataType||(o.selectedIndex=6),t.editor&&t.editor.template&&o.dataSource.forEach(((e,a)=>{switch(e.value){case"string":"input"===t.editor.template&&(o.selectedIndex=a);break;case"number":"numberInput"===t.editor.template&&(o.selectedIndex=a);break;case"select":"multiComboInput"===t.editor.template&&t.editor.singleSelect&&"tags"===t.template&&(o.selectedIndex=a);break;case"multiSelect":"multiComboInput"!==t.editor.template||t.editor.singleSelect||"tags"!==t.template||(o.selectedIndex=a);break;case"multiText":"textarea"===t.editor.template&&(o.selectedIndex=a);break;case"date":"dateInput"!==t.editor.template&&"dateTimePicker"!==t.editor.template||(o.selectedIndex=a);break;case"checkBox":"checkBox"===t.editor.template&&(o.selectedIndex=a);break;case"slider":"slider"===t.editor.template&&(o.selectedIndex=a);break;case"image":"image"===t.editor.template&&(o.selectedIndex=a);break;case"updatedTime":"updatedTime"===t.template&&(o.selectedIndex=a);break;case"createdTime":"createdTime"===t.template&&(o.selectedIndex=a);break;case"createdBy":"createdBy"===t.template&&(o.selectedIndex=a);break;case"updatedBy":"updatedBy"===t.template&&(o.selectedIndex=a);break;case"collaborator":"collaborator"===t.template&&t.editor&&t.editor.collaborator&&(o.selectedIndex=a);break;case"autoNumber":"autoNumber"===t.template&&(o.selectedIndex=a);break;case"phone":"phone"===t.template&&(o.selectedIndex=a);break;case"password":"password"===t.template&&(o.selectedIndex=a);break;case"url":"url"===t.template&&(o.selectedIndex=a);break;case"email":"email"===t.template&&(o.selectedIndex=a)}}))):"type"===i&&(o.selectedIndex=0,o.dataSource=e._getTypesList()),"cellsAlign"===i&&t&&("center"===t.cellsAlign||"middle"===t.cellsAlign?o.selectedIndex=2:"right"===t.cellsAlign&&(o.selectedIndex=1)),!n)continue;"dataField"!==i&&"type"!==i&&"timeFormat"!==i&&"dateFormat"!==i&&"numberFormat"!==i&&"currency"!==i&&"unit"!==i&&"cellsAlign"!==i&&o&&(o.selectedIndex=0),"name"===i&&(o.value=t?t.label:"",o.placeholder=a.find((e=>{if(e.bind===i)return e})).placeholder),"description"===i&&(o.value=t?t.description:"",o.placeholder=a.find((e=>{if(e.bind===i)return e})).placeholder);const r=(e,a)=>{t&&t.validationRules.forEach((t=>"minDate"===t.type&&"minDateTime"===e||"maxDate"===t.type&&"maxDateTime"===e||"min"===t.type&&"minValue"===e||"max"===t.type&&"maxValue"===e||t.type===e?(a.value=t.value,!0):void 0))};if("minValue"===i?(n.value=0,r(i,n)):"maxValue"===i?(n.value=100,r(i,n)):"minLength"===i?(n.value=0,r(i,n)):"maxLength"===i&&(n.value=500,r(i,n)),"minDateTime"===i){const e=l.querySelector("smart-date-input");e.value=new Date(1900,0,1),r(i,e)}else if("maxDateTime"===i){const e=l.querySelector("smart-date-input");e.value=new Date(2100,0,1),r(i,e)}}}_createColumnBooleanEditor(e,t,a,i,l){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const n=document.createElement("div");return n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),n.setAttribute("checked",""),n.value=!0,t.width&&(a.style.width=t.width,a.style.float="left"),!1===t.value&&(n.value=!1,n.removeAttribute("checked")),e.appendChild(n),e.getValue=function(){return n.value},e.check=function(){n.setAttribute("checked",""),n.value=!0,e.onchange&&e.onchange(n.value)},e.uncheck=function(){n.removeAttribute("checked"),n.value=!1,e.onchange&&e.onchange(n.value)},e.toggle=function(){!0!==n.value&&!1!==n.value&&null!==n.value&&(n.value=!1),null===n.value?n.value=!1:n.value=!n.value,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),e.onchange&&e.onchange(n.value)},e.onclick=l.onclick=()=>{e.toggle()},i.appendChild(a),a.classList.add("smart-grid-dialog-boolean-field"),a.appendChild(e),a.appendChild(l),e}_getColumnTemplateByType(e){switch(e){case"boolean":case"bool":return"checkBox";case"image":return"image";case"createdBy":case"updatedBy":return e;case"collaborator":case"select":case"multiSelect":return"tags";case"url":return"url";case"email":return"email";case"autoNumber":return"autoNumber";case"password":return"password";case"createdTime":return"createdTime";case"updatedTime":return"updatedTime";default:return""}}_confirmAddColumnDialog(){const e=this,t=e._dialogAddColumn,a=e._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),i=[];let l,n,o={};for(let t=0;t<a.length;t++){const i=a[t],l=i.querySelector(".smart-input"),n=i.getAttribute("bind"),r=i.parentElement;if("kanban"!==n)if("minLength"!==n&&"maxLength"!==n&&"minValue"!==n&&"maxValue"!==n&&"minDateTime"!==n&&"maxDateTime"!==n)if("options"!==n&&"users"!==n){if("allowEdit"===n&&r.classList.contains("smart-hidden"))l.value=!1;else if("required"===n&&r.classList.contains("smart-hidden"))l.value=!1;else if("dateFormatSeparator"===n){const e=i.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.dateFormatSeparatorType="/";break;case 1:o.dateFormatSeparatorType="-";break;case 2:o.dateFormatSeparatorType="."}break}}l&&(l.getSelectedItem?o[n]=l.getSelectedItem().value:o[n]=l.value)}else{const t=[],a=i.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),l=i.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<a.length;e++){const i=a[e],n={label:i.value,value:i.getAttribute("data-item-value"),id:parseInt(i.getAttribute("data-id")),color:l[e].value};n.color=l[e].value,t.push(n)}if("users"===n&&"collaborator"===o.type){e.users||(e.users=[]);for(let a=0;a<t.length;a++){const i=t[a],l=e.users.find((e=>e.id===i.id));l&&(l.name=i.label,l.color=i.color)}}o[n]=t}else o[n]=l.getValue();else{const e=i.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.kanban="blank";break;case 1:o.kanban="basic"}break}}}t.data=o;let r={},s={},d="";if(l=o.minDateTime,n=o.maxDateTime,"date"===o.type){r={template:"dateInput",min:l,max:n};let e=!1;"-"!==o.dateFormat&&(d=o.dateFormat,o.allowCustomDateSeparator&&(d.indexOf("/")>=0?d=d.replaceAll("/",o.dateFormatSeparatorType):d.indexOf("-")>=0?d=d.replaceAll("-",o.dateFormatSeparatorType):d.indexOf(".")>=0&&(d=d.replaceAll(".",o.dateFormatSeparatorType))),o.dateFormat.indexOf("T")>=0&&(r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),e=!0),r.autoOpen=!0,o.allowTimeFormat&&"-"!==o.timeFormat&&(e&&(d+=" "),d+=o.timeFormat,r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),i.push({type:"minDate",value:l}),i.push({type:"maxDate",value:n})}else if("number"===o.type||"slider"===o.type){l=parseInt(o.minValue),n=parseInt(o.maxValue),o.numberFormat=JSON.parse(JSON.stringify(o.numberFormat)),"unit"===o.numberFormat.style&&(o.numberFormat.unit=o.unit);let t=null,a=null;"currency"===o.numberFormat.style&&(o.numberFormat.currency=o.currency,o.numberFormat.locale=e._getLocaleByCurrency(o.currency)),r={template:"number"===o.type?"numberInput":"slider",min:l,max:n,numberFormat:o.numberFormat},s={Intl:{NumberFormat:o.numberFormat}},a&&(s=a),d="d",t&&(d=t),i.push({type:"min",value:l}),i.push({type:"max",value:n})}else if("boolean"===o.type)r={template:"checkBox"};else if("image"===o.type)r={template:"image"};else if("select"===o.type||"multiSelect"===o.type){let e=o.options;if("select"===o.type)if(t.editColumn&&!t.editColumn.editor.allowEmptyItem)e=o.options;else{let t=!1;for(let e=0;e<o.options.length;e++)if(""===o.options[e].label){t=!0,o.options[e].value="";break}e=t?o.options:[""].concat(o.options)}r={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:o.allowColorItems,autoOpen:!0,pills:!0,singleSelect:"select"===o.type,dataSource:e}}else if("collaborator"===o.type){let t=o.users;o.allowMultipleCollaborators||(t=[""].concat(o.users));for(let a=0;a<e.users.length;a++)t.forEach((t=>{t.value===e.users[a].id&&(t.image=e.users[a].image,t.id=e.users[a].id)}));r={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:o.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!o.allowMultipleCollaborators,dataSource:t}}else"multiText"===o.type?(l=o.minLength,n=o.maxLength,r={template:"textarea",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n})):"password"===o.type?(l=o.minLength,n=o.maxLength,r={template:"password",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n})):"phone"===o.type?r={template:"phone",required:o.required}:(l=o.minLength,n=o.maxLength,r={template:"input",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n}));let c="string";switch(o.type){case"boolean":case"bool":c="boolean";break;case"createdTime":case"updatedTime":case"date":c="date";break;case"autoNumber":case"slider":case"number":c="number"}if(e._dialogAddColumn.editColumn){const t=e._dialogAddColumn.editColumn;t.canNotify=!1,t.label=o.name,t.description=o.description,t.showDescriptionButton=!0,t.allowResize=o.allowResize,t.allowSort=o.allowSort,t.allowFilter=o.allowFilter,t.allowEdit=o.allowEdit,t.align=t.cellsAlign=o.cellsAlign,t.cellsFormat=d;const a=t._editorId?t._editorId:"",l=r.template+"_"+t.dataField+a;e._cellEditors[l]&&delete e._cellEditors[l];let n=!0;"list"!==t.template&&"dropDownList"!==t.template||(n=!1),"autoNumber"!==t.template&&"createdBy"!==t.template&&"updatedBy"!==t.template&&"createdTime"!==t.template&&"updatedTime"!==t.template||(n=!1),t.editor&&t.editor.template.indexOf("custom")>=0&&(n=!1),t.editor&&t.editor.disabledDialogOptions&&(n=!1),n&&(t.editor=JSON.parse(JSON.stringify(r)),t.template=e._getColumnTemplateByType(o.type),t._cellsCachedValues=[]),t.formatSettings=s,t._isDirty=!0,o.required&&i.push({type:"required"}),t.validationRules=i,t._state&&["label","description","showDescriptionButton","dataType","editor","formatSettings","template","summary","validationRules","allowResize","allowSort","allowFilter","allowEdit","align","cellsAlign","cellsFormat"].forEach((e=>{t._state[e]=t[e]})),t.canNotify=!0,e.$.fireEvent("closeColumnDialog",{dataField:t.dataField}),e.onColumnUpdated&&e.onColumnUpdated(e.columns.indexOf(t),t),e._onColumnUpdated&&e._onColumnUpdated(t,o),e._recycle(!0),t.refresh(),t._isDirty=!1}else{let t=[];"number"===c&&(t=["sum"]);const a=e._getColumnLabel(o),l=new Smart.Grid.Column({label:a,description:o.description,dataField:o.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:o.allowResize,allowSort:o.allowSort,allowFilter:o.allowFilter,allowEdit:o.allowEdit,showDescriptionButton:!0,dataType:c,editor:r,summary:t,template:e._getColumnTemplateByType(o.type),formatSettings:s,cellsAlign:o.cellsAlign,align:o.cellsAlign,cellsFormat:d,visibleIndex:e.columns.length-1,grid:e});if("autoNumber"===l.template&&(l.autoGenerated=!0,t=[]),o.required&&(i.push({type:"required"}),l.validationRules=i),e._getKanbanFields().indexOf(o.type)>=0){const t=e._getKanbanTaskField(o.type);o.description&&(t.description=o.description),o.name&&(t.label=o.name),t.allowFilter=o.allowFilter,t.allowResize=o.allowResize,t.allowSort=o.allowSort,e.columnByDataField[t.dataField]&&(t.dataField=t.displayField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),"object"==typeof t.editor&&t.editor.dataSource&&(t.editor.dataSource=JSON.parse(JSON.stringify(t.editor.dataSource))),t.label=t.label+" "+e.localize("copy")),e.columns.push(t)}else e.columns.push(l);e._refreshHeaderBar(),e.$.fireEvent("closeColumnDialog",{dataField:l.dataField})}}_getColumnLabel(e){const t=this;let a=e.name;if(!a){let a="";switch(e.type){case"string":a=t.localize("dialogAddColumnTypeText");break;case"multiText":a=t.localize("dialogAddColumnTypeMultilineText");break;case"image":a=t.localize("dialogAddColumnTypeImage");break;case"number":a=t.localize("dialogAddColumnTypeNumber");break;case"select":a=t.localize("dialogAddColumnTypeSelect");break;case"multiSelect":a=t.localize("dialogAddColumnTypeMultipleSelect");break;case"boolean":a=t.localize("dialogAddColumnTypeCheckBox");break;case"date":a=t.localize("dialogAddColumnTypeDate");break;case"createdTime":a=t.localize("dialogAddColumnTypeCreatedTime");break;case"updatedTime":a=t.localize("dialogAddColumnTypeLastUpdatedTime");break;case"createdBy":a=t.localize("dialogAddColumnTypeCreatedBy");break;case"updatedBy":a=t.localize("dialogAddColumnTypeLastUpdatedBy");break;case"collaborator":a=t.localize("dialogAddColumnTypeCollaborator");break;case"slider":a=t.localize("dialogAddColumnTypeSlider");break;case"autoNumber":a=t.localize("dialogAddColumnTypeAutoNumber");break;case"url":a=t.localize("dialogAddColumnTypeURL");break;case"email":a=t.localize("dialogAddColumnTypeEmail");break;case"phone":a=t.localize("dialogAddColumnTypePhone");break;case"password":a=t.localize("dialogAddColumnTypePassword")}let i=1;for(let e=0;e<t.columns.length;e++)t.columns[e].label.indexOf(a)>=0&&i++;return 1===i?a:a+" "+i}return a}_openAddColumnDialog(e,t,a){const i=this,l=i._dialogAddColumn||i._createDialog(i.editing.addColumnDialog),n=e?i.localize("dialogEditColumn",{value:e.label}):i.localize("dialogAddColumn"),o=l.querySelector(".smart-footer").querySelector(".smart-stack-layout");l.classList.add("smart-grid-dialog-add-column"),l.type=e?"customize":"add",l.editColumn=e||null,e&&e.element&&e.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),i._cellEditors||(i._cellEditors=[]);const r=i._getAddColumnDialogTemplate();if(l.header.innerHTML=n,l.header.parentElement.classList.add("smart-hidden"),l.callback=a,!0===t&&(l.header.parentElement.classList.remove("smart-hidden"),"kanban"===i.view?(l.header.innerHTML=i.localize("dialogAddColumnStatus"),l.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),l.classList.add("view")):l.classList.remove("kanban")),l.stackLabel&&l.stackLabel.classList.add("smart-hidden"),"kanban"===i.view?l.btnCancel.classList.add("smart-hidden"):l.btnCancel.classList.remove("smart-hidden"),i.cancelEdit(),!i._dialogAddColumn){l.modal=!0,l.btnConfirm.innerHTML=i.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=i.localize("dialogEditButtonCancel"),l.onOpen=function(){i._addColumnDialogInitEditors(),i._addColumnDialogShowHideEditors(l.editColumn),i.$.fireEvent("openColumnDialog",{dataField:l.editColumn?l.editColumn.dataField:null});const e=i.offset(l),t=i.offset(i);if(e.top+l.offsetHeight>window.innerHeight-t.top){const a=e.top+l.offsetHeight-window.innerHeight+t.top;l.style.maxHeight=Math.max(250,l.offsetHeight-a)+"px",l.style.minHeight="250px"}else l.style.maxHeight="",l.style.minHeight=""},l.onClose=function(){l.editColumn&&l.editColumn.element&&l.editColumn.element.removeAttribute("focus"),l.classList.remove("view"),l.callback&&l.callback(l.result)},l.btnCancel.onclick=function(){l.result=!1,l.close()},l.btnClose.onclick=function(){l.result=!1,l.close()},l.btnConfirm.onclick=function(){i._confirmAddColumnDialog(),l.result=!0,l.close()},l.onkeydown=function(e){"Escape"===e.key&&"kanban"!==i.view&&(l.result=!1,l.close())},i._dialogAddColumn=l;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),l.content.appendChild(e),i._addColumnDialogEditors=[];for(let t=0;t<r.length;t++){const a=r[t],n=document.createElement("div"),o=document.createElement("label");o.innerHTML=a.label;const s=document.createElement("div");if(s.classList.add("smart-grid-dialog-editor","add-column"),s.innerHTML="",s.setAttribute("filter",a.filter),s.setAttribute("bind",a.bind),n.setAttribute("field-name",a.bind),n.setAttribute("field-filter",a.filter),i._addColumnDialogEditors[a.bind]=s,"type"===a.bind&&s.addEventListener("change",(()=>{i._addColumnDialogShowHideEditors(l.editColumn);const e=i._dialogAddColumn.querySelector('[bind="type"]'),t=e.querySelector("smart-input"),a=t.getSelectedItem().value;let n="smart-icon-font";switch(a){case"multiText":n="smart-icon-fontsize";break;case"image":n="smart-icon-image";break;case"number":case"progress":n="smart-icon-number";break;case"priority":case"status":case"select":n="smart-icon-sort-down";break;case"multiSelect":n="smart-icon-list-unordered";break;case"boolean":n="smart-icon-check-squared";break;case"date":case"startDate":case"dueDate":n="smart-icon-calendar";break;case"createdTime":case"updatedTime":n="smart-icon-clock";break;case"createdBy":case"updatedBy":case"collaborator":n="smart-icon-user";break;case"slider":n="smart-icon-number";break;case"autoNumber":case"checklist":n="smart-icon-list-ordered";break;case"url":n="smart-icon-link";break;case"email":n="smart-icon-mail";break;case"password":n="smart-icon-lock";break;case"phone":n="smart-icon-phone";break;case"name":n="smart-icon-font";break;case"description":n="smart-icon-fontsize";break;case"tags":n="smart-icon-font";break;case"color":n="smart-icon-color-background";break;case"assigned":n="smart-icon-user"}if(i._addColumnDialogEditors.type.icon=n,i._addColumnDialogEditors.name.querySelector("input").setAttribute("data-label",t.value),e.firstElementChild.className="smart-grid-icon show smart-description-button "+n,"select"===a||"multiSelect"===a){const e=i._addColumnDialogEditors.options.querySelector("smart-sortable");e&&e._validate&&e._validate()}else l.btnConfirm.disabled=!1})),"boolean"===a.type)i._createColumnBooleanEditor(s,a,n,e,o);else{if("label"===a.type){e.appendChild(n),n.classList.add("smart-grid-dialog-field"),n.appendChild(o);const t=document.createElement("div");t.style.height="10px",n.appendChild(t);continue}{let d=document.createElement("smart-input");if(d.classList.add("underlined","edit-column-input"),d.style.width="100%",d.style.height="30px",a.width&&(n.style.width=a.width,n.style.float="left"),"items"===a.type){const e=document.createElement("smart-button");e.classList.add("primary"),e.innerHTML='<div style="align-items: center; white-space: nowrap; display: flex;"><span class="smart-grid-icon show smart-icon-plus"></span><span>'+i.localize("commandBarAddRow")+"</span></div>";const t=document.createElement("div");t.classList.add("smart-grid-add-column-dialog-color-panel");const n=document.createElement("smart-sortable");n.disableMode="manual",n.dragMode="handle",n.handleVisibility="visible",n.handlePosition="left";const o=()=>{if(l.btnConfirm.disabled=!1,0===t.offsetHeight)return;let e=0;t.querySelectorAll(".edit-column-input").forEach((t=>{""===t.value&&e++,e>1&&(l.btnConfirm.disabled=!0)}))},r=(t,l,r,s)=>{const d=document.createElement("div"),c=i._getColorInput(),m=document.createElement("div"),u=document.createElement("smart-input"),b=i._addColumnDialogEditors.allowColorItems;if(void 0!==r)u.setAttribute("data-id",r),u.setAttribute("data-item-value",r);else{const e=n.querySelectorAll(".smart-sortable-item").length;u.setAttribute("data-id",e),u.setAttribute("data-item-value",e)}return void 0!==s&&u.setAttribute("data-item-value",s),c.disabled=!b.querySelector(".smart-input").value,m.className="smart-grid-icon smart-icon-close show",m.setAttribute("role","button"),m.setAttribute("aria-label","button"),u.classList.add("underlined","edit-column-input"),u.style.width="100%",u.style.height="30px",u.required=!0,t&&(u.value=t),l&&(c.value=l),u.onkeyup=u.onchange=u.onblur=t=>{o(),"Enter"===t.key&&(u.parentElement.nextElementSibling||(e.click(),o()))},d.appendChild(c),d.appendChild(u),"users"!==a.bind&&d.appendChild(m),m.onclick=()=>{d.remove(),n.updateItems(),o()},d.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),d};n._init=e=>{n.clearContent(),e&&(e.forEach(((e,t)=>{const a=void 0!==e.id?e.id:t,i=r(e.label,e.color,a,e.value);n.$.container.appendChild(i)})),n.updateItems())},n._validate=o,i._addColumnDialogEditors.allowColorItems.onchange=e=>{let t=i._addColumnDialogEditors.allowColorItems.parentElement.nextElementSibling,a=null;for(;t;){if("options"===t.getAttribute("field-name")){a=t;break}t=t.nextElementSibling}a&&a.querySelectorAll("smart-color-input").forEach((t=>{t.disabled=!e}))},t.appendChild(n),"users"!==a.bind&&(t.appendChild(e),e.onclick=()=>{const e=r();n.$.container.appendChild(e),n.updateItems(),e.querySelector(".edit-column-input").focus(),l.btnConfirm.disabled=!0}),d=t,s.style.height="auto"}else if("number"===a.type)d=document.createElement("smart-number-input"),d.classList.add("underlined"),d.style.width="100%",d.style.height="30px","minValue"===a.bind?(d.value=0,d.min=-9999999,d.max=9999999):"maxValue"===a.bind?(d.value=1e6,d.min=-9999999,d.max=9999999):"minLength"===a.bind?d.value=0:"maxLength"===a.bind&&(d.value=500);else if("datetime"===a.type)d=document.createElement("smart-date-input"),d.classList.add("underlined"),d.style.width="100%",d.style.height="30px","minDateTime"===a.bind?d.value=new Date(1900,0,1):"maxDateTime"===a.bind&&(d.value=new Date(2100,0,1));else if("radio"===a.type){const e=(e,t,a)=>{const i=document.createElement("div"),l=document.createElement("label"),n=document.createElement("div");return l.innerHTML=e,n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),t&&n.setAttribute("checked",""),n.value=void 0!==t&&t,s.appendChild(n),i.onclick=function(){if(n.value=!0,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),i.onchange&&i.onchange(i),n.value){const e=n.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n.value=!0,n.setAttribute("checked",n.value?"":"indeterminate"),e.value=a}},i.appendChild(n),i.appendChild(l),i.classList.add("smart-grid-dialog-boolean-field"),i.setAttribute("template","checkBox"),i.setAttribute("editor",""),i},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),s.classList.add("radio-group");for(let i=0;i<a.options.length;i++){const l=a.options[i],n=e(l.label,l.checked);if(a.columns){const e=100/a.columns;n.style.width=e+"%",n.style.float="left"}t.appendChild(n),l.checked&&(s.value=l.value)}const i=document.createElement("div");i.style.clear="both",t.appendChild(i),d=t}if(a.options){d.readonly=!0;let e=a.options;"type"===a.bind&&(void 0!==i.currentUser&&null!==i.currentUser||(e=e.filter((e=>"updatedBy"!==e.value&&"createdBy"!==e.value))),(void 0===i.users||null===i.users||i.users&&0===i.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),d.dataSource=e,d.dropDownButtonPosition="right","dataField"!==a.bind&&(d.selectedIndex=0),a.options.length<15?d.dropDownHeight="auto":d.dropDownHeight=300}if(a.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",a.icon,"show","smart-description-button"),s.appendChild(e),d.style.width="calc(100% - 25px)"}if(s.appendChild(d),a.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=a.info,s.appendChild(e),d.style.width="calc(100% - 25px)"}if(e.appendChild(n),n.classList.add("smart-grid-dialog-field"),n.appendChild(o),n.appendChild(s),a.width&&!r[t+1].width){const t=document.createElement("div");t.style.clear="both",e.appendChild(t)}}}}}const s=()=>{const t=parseInt(l.style.width),a=i.offset(i);if(window.screen.availWidth<400)return l.open("left","top"),l.style.width=i.offsetWidth+"px",void(l.style.height=i.offsetHeight+"px");{const e=i.editing.addColumnDialog;l.style.width="auto"===e.width?e.width:e.width+"px",l.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const n=e.element;if(n){const e=i.offset(n),o=e.left-a.left,r=a.left,s=Math.max(r,o);if(s+t+n.offsetWidth>a.left+i.offsetWidth){const i=s-t+n.offsetWidth;i<0?l.open("center",e.top+n.offsetHeight-a.top):l.open(Math.max(r,i),e.top+n.offsetHeight-a.top)}else l.open(s,e.top+n.offsetHeight-a.top)}else l.classList.add("center"),l.open("center","center")}else if(i._addNewColumn){let e=i._addNewColumn.element,n=i.offset(e),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o);i.editing.addNewColumn._addButton&&i.editing.addNewColumn._addButton.classList.contains("show")&&(e=i.editing.addNewColumn._addButton,n=i.offset(i.editing.addNewColumn._addButton),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o)),l.open(s,n.top+e.offsetHeight-a.top)}else l.open("center","center"),l.classList.add("center")};s(),l.refresh=()=>{s()}}_getLocaleByCurrency(e){const t={AED:"ar_AE",AFN:"fa_AF",ALL:"sq",AMD:"hy",ANG:"nl",AOA:"pt_AO",ARS:"es_AR",AUD:"en",AWG:"nl_AW",AZN:"az",BAM:"bs",BBD:"en_BB",BDT:"bn_BD",BGN:"bg",BHD:"ar_BH",BIF:"fr_BI",BMD:"en_BM",BND:"ms_BN",BOB:"es_BO",BRL:"pt_BR",BSD:"en_BS",BTN:"dz",BWP:"en_BW",BYN:"be",BYR:"be",BZD:"en_BZ",CAD:"en_CA",CDF:"fr_CD",CHF:"de_CH",CLP:"es_CL",CNY:"zh_Hans_CN",COP:"es_CO",CRC:"es_CR",CUP:"es_CU",CVE:"pt_CV",CZK:"cs",DJF:"fr_DJ",DKK:"da_DK",DOP:"es_DO",DZD:"ar_DZ",EGP:"ar_EG",ERN:"ti_ER",ETB:"am",EUR:"de",FJD:"en_FJ",FKP:"en_FK",GBP:"en",GEL:"ka",GHS:"en_GH",GIP:"en_GI",GMD:"en_GM",GNF:"fr_GN",GTQ:"es_GT",GYD:"en_GY",HKD:"zh_Hans_HK",HNL:"es_HN",HRK:"hr_HR",HTG:"en",HUF:"hu_HU",IDR:"id",ILS:"he",INR:"en_IN",IQD:"ar_IQ",IRR:"fa_IR",ISK:"is",JMD:"en_JM",JOD:"ar_JO",JPY:"ja",KES:"en_KE",KGS:"ky",KHR:"km",KMF:"ar",KPW:"ko_KP",KRW:"ko_KR",KWD:"ar_KW",KYD:"en_KY",KZT:"kk",LAK:"lo",LBP:"ar_LB",LKR:"si",LRD:"en_LR",LSL:"en_LS",LYD:"ar_LY",MAD:"ar",MDL:"ro",MGA:"fr_MG",MKD:"mk",MMK:"my",MNT:"mn",MOP:"zh",MRO:"ar_MR",MRU:"ar_MR",MUR:"en_MU",MVR:"en",MWK:"en",MXN:"es_MX",MYR:"ms_MY",MZN:"pt_MZ",NAD:"en_NA",NGN:"en_NG",NIO:"es_NI",NOK:"nb_NO",NPR:"ne",NZD:"en_NZ",OMR:"ar_OM",PAB:"es_PA",PEN:"es_PE",PGK:"en_PG",PHP:"fil",PKR:"ur_PK",PLN:"pl",PYG:"es_PY",QAR:"ar_QA",RON:"ro",RSD:"sr",RUB:"ru",RWF:"rw",SAR:"ar_SA",SBD:"en_SB",SCR:"en_SC",SDG:"ar_SD",SEK:"sv_SE",SGD:"en_SG",SHP:"en_SH",SLL:"en_SL",SOS:"so_SO",SRD:"nl_SR",SSP:"en",STD:"pt_ST",STN:"pt_ST",SYP:"ar_SY",SZL:"en_SZ",THB:"th",TJS:"en",TMT:"tk",TND:"ar_TN",TOP:"to",TRY:"tr_TR",TTD:"en_TT",TWD:"zh_Hant_TW",TZS:"sw_TZ",UAH:"uk",UGX:"en_UG",USD:"en_US",UYU:"es_UY",UZS:"uz",VEF:"es_VE",VND:"vi",VUV:"en_BI",WST:"en_AS",XAF:"fr",XCD:"en",XOF:"fr",XPF:"fr_PF",YER:"ar_YE",ZAR:"zu",ZMW:"en_ZM",ZWL:"en_ZW"};return t[e]?t[e].replace("_","-"):"en-US"}_getCurrencies(){return[{currency:"US Dollar",sign:"$",abbreviation:"USD"},{currency:"Afghan Afghani",sign:"Af.",abbreviation:"AFN"},{currency:"Albanian Lek",sign:"Lek",abbreviation:"ALL"},{currency:"Algerian Dinar",sign:"din",abbreviation:"DZD"},{currency:"Angolan Kwanza",sign:"Kz",abbreviation:"AOA"},{currency:"Argentine Peso",sign:"$",abbreviation:"ARS"},{currency:"Armenian Dram",sign:"Dram",abbreviation:"AMD"},{currency:"Aruban Florin",sign:"Afl.",abbreviation:"AWG"},{currency:"Australian Dollar",sign:"$",abbreviation:"AUD"},{currency:"Azerbaijani Manat",sign:"₼",abbreviation:"AZN"},{currency:"Bahamian Dollar",sign:"$",abbreviation:"BSD"},{currency:"Bahraini Dinar",sign:"din",abbreviation:"BHD"},{currency:"Bangladeshi Taka",sign:"৳",abbreviation:"BDT"},{currency:"Barbadian Dollar",sign:"$",abbreviation:"BBD"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYN"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYR"},{currency:"Belize Dollar",sign:"$",abbreviation:"BZD"},{currency:"Bermudan Dollar",sign:"$",abbreviation:"BMD"},{currency:"Bhutanese Ngultrum",sign:"Nu.",abbreviation:"BTN"},{currency:"Bolivian Boliviano",sign:"Bs",abbreviation:"BOB"},{currency:"Bosnia-Herzegovina Convertible Mark",sign:"KM",abbreviation:"BAM"},{currency:"Botswanan Pula",sign:"P",abbreviation:"BWP"},{currency:"Brazilian Real",sign:"R$",abbreviation:"BRL"},{currency:"British Pound Sterling",sign:"£",abbreviation:"GBP"},{currency:"Brunei Dollar",sign:"$",abbreviation:"BND"},{currency:"Bulgarian Lev",sign:"лв.",abbreviation:"BGN"},{currency:"Burundian Franc",sign:"FBu",abbreviation:"BIF"},{currency:"Cambodian Riel",sign:"Riel",abbreviation:"KHR"},{currency:"Canadian Dollar",sign:"$",abbreviation:"CAD"},{currency:"Cape Verdean Escudo",sign:"CVE",abbreviation:"CVE"},{currency:"Cayman Islands Dollar",sign:"$",abbreviation:"KYD"},{currency:"CFA Franc BCEAO",sign:"CFA",abbreviation:"XOF"},{currency:"CFA Franc BEAC",sign:"FCFA",abbreviation:"XAF"},{currency:"CFP Franc",sign:"FCFP",abbreviation:"XPF"},{currency:"Chilean Peso",sign:"$",abbreviation:"CLP"},{currency:"Chinese Yuan",sign:"¥",abbreviation:"CNY"},{currency:"Chinese Yuan (offshore)",sign:"¥",abbreviation:"RMB"},{currency:"Colombian Peso",sign:"$",abbreviation:"COP"},{currency:"Comorian Franc",sign:"CF",abbreviation:"KMF"},{currency:"Congolese Franc",sign:"FrCD",abbreviation:"CDF"},{currency:"Costa Rican Colon",sign:"₡",abbreviation:"CRC"},{currency:"Croatian Kuna",sign:"kn",abbreviation:"HRK"},{currency:"Cuban Convertible Peso",sign:"$",abbreviation:"CUC"},{currency:"Cuban Peso",sign:"$",abbreviation:"CUP"},{currency:"Czech Republic Koruna",sign:"Kč",abbreviation:"CZK"},{currency:"Danish Krone",sign:"kr.",abbreviation:"DKK"},{currency:"Djiboutian Franc",sign:"Fdj",abbreviation:"DJF"},{currency:"Dominican Peso",sign:"RD$",abbreviation:"DOP"},{currency:"East Caribbean Dollar",sign:"$",abbreviation:"XCD"},{currency:"Egyptian Pound",sign:"£",abbreviation:"EGP"},{currency:"Eritrean Nakfa",sign:"Nfk",abbreviation:"ERN"},{currency:"Ethiopian Birr",sign:"Birr",abbreviation:"ETB"},{currency:"Euro",sign:"€",abbreviation:"EUR"},{currency:"Falkland Islands Pound",sign:"£",abbreviation:"FKP"},{currency:"Fijian Dollar",sign:"$",abbreviation:"FJD"},{currency:"Gambian Dalasi",sign:"GMD",abbreviation:"GMD"},{currency:"Georgian Lari",sign:"GEL",abbreviation:"GEL"},{currency:"Ghanaian Cedi",sign:"GHS",abbreviation:"GHS"},{currency:"Gibraltar Pound",sign:"£",abbreviation:"GIP"},{currency:"Guatemalan Quetzal",sign:"Q",abbreviation:"GTQ"},{currency:"Guinean Franc",sign:"FG",abbreviation:"GNF"},{currency:"Guyanaese Dollar",sign:"$",abbreviation:"GYD"},{currency:"Haitian Gourde",sign:"HTG",abbreviation:"HTG"},{currency:"Honduran Lempira",sign:"L",abbreviation:"HNL"},{currency:"Hong Kong Dollar",sign:"$",abbreviation:"HKD"},{currency:"Hungarian Forint",sign:"Ft",abbreviation:"HUF"},{currency:"Icelandic Krona",sign:"kr",abbreviation:"ISK"},{currency:"Indian Rupee",sign:"₹",abbreviation:"INR"},{currency:"Indonesian Rupiah",sign:"Rp",abbreviation:"IDR"},{currency:"Iranian Rial",sign:"Rial",abbreviation:"IRR"},{currency:"Iraqi Dinar",sign:"din",abbreviation:""},{currency:"Israeli New Sheqel",sign:" ₪",abbreviation:"ILS"},{currency:"Jamaican Dollar",sign:"$",abbreviation:"JMD"},{currency:"Japanese Yen",sign:"¥",abbreviation:"JPY"},{currency:"Jordanian Dinar",sign:"din",abbreviation:"JOD"},{currency:"Kazakhstani Tenge",sign:"₸",abbreviation:"KZT"},{currency:"Kenyan Shilling",sign:"Ksh",abbreviation:"KES"},{currency:"Kuwaiti Dinar",sign:"din",abbreviation:"KWD"},{currency:"Kyrgystani Som",sign:"KGS",abbreviation:"KGS"},{currency:"Laotian Kip",sign:"₭",abbreviation:"LAK"},{currency:"Lebanese Pound",sign:"L£",abbreviation:"LBP"},{currency:"Lesotho Loti",sign:"LSL",abbreviation:"LSL"},{currency:"Liberian Dollar",sign:"$",abbreviation:"LRD"},{currency:"Libyan Dinar",sign:"din",abbreviation:"LYD"},{currency:"Lithuanian Litas",sign:"Lt",abbreviation:"LTL"},{currency:"Macanese Pataca",sign:"MOP",abbreviation:"MOP"},{currency:"Macedonian Denar",sign:"din",abbreviation:"MKD"},{currency:"Malagasy Ariary",sign:"Ar",abbreviation:"MGA"},{currency:"Malawian Kwacha",sign:"MWK",abbreviation:"MWK"},{currency:"Malaysian Ringgit",sign:"RM",abbreviation:"MYR"},{currency:"Maldivian Rufiyaa",sign:"Rf",abbreviation:"MVR"},{currency:"Mauritanian Ouguiya",sign:"MRO",abbreviation:"MRO"},{currency:"Mauritian Rupee",sign:"MURs",abbreviation:"MUR"},{currency:"Mexican Peso",sign:"$",abbreviation:"MXN"},{currency:"Moldovan Leu",sign:"MDL",abbreviation:"MDL"},{currency:"Mongolian Tugrik",sign:"₮",abbreviation:"MNT"},{currency:"Moroccan Dirham",sign:"dh",abbreviation:"MAD"},{currency:"Mozambican Metical",sign:"MTn",abbreviation:"MZN"},{currency:"Myanma Kyat",sign:"K",abbreviation:"MMK"},{currency:"Namibian Dollar",sign:"$",abbreviation:"NAD"},{currency:"Nepalese Rupee",sign:"Rs",abbreviation:"NPR"},{currency:"Netherlands Antillean Guilder",sign:"NAf.",abbreviation:"ANG"},{currency:"New Taiwan Dollar",sign:"NT$",abbreviation:"TWD"},{currency:"New Zealand Dollar",sign:"$",abbreviation:"NZD"},{currency:"Nicaraguan Cordoba",sign:"C$",abbreviation:"NIO"},{currency:"Nigerian Naira",sign:"₦",abbreviation:"NGN"},{currency:"North Korean Won",sign:"₩KP",abbreviation:"KPW"},{currency:"Norwegian Krone",sign:"kr",abbreviation:"NOK"},{currency:"Omani Rial",sign:"Rial",abbreviation:"OMR"},{currency:"Pakistani Rupee",sign:"Rs",abbreviation:"PKR"},{currency:"Panamanian Balboa",sign:"B/.",abbreviation:"PAB"},{currency:"Papua New Guinean Kina",sign:"PGK",abbreviation:"PGK"},{currency:"Paraguayan Guarani",sign:"Gs.",abbreviation:"PYG"},{currency:"Peruvian Nuevo Sol",sign:"S/.",abbreviation:"PEN"},{currency:"Philippine Peso",sign:"₱",abbreviation:"PHP"},{currency:"Polish Zloty",sign:"zł",abbreviation:"PLN"},{currency:"Qatari Rial",sign:"Rial",abbreviation:"QAR"},{currency:"Romanian Leu",sign:"RON",abbreviation:"RON"},{currency:"Russian Ruble",sign:"₽",abbreviation:"RUB"},{currency:"Rwandan Franc",sign:"RF",abbreviation:"RWF"},{currency:"Saint Helena Pound",sign:"£",abbreviation:"SHP"},{currency:"Samoan Tala",sign:"WST",abbreviation:"WST"},{currency:"Sao Tomean Dobra",sign:"Db",abbreviation:"STD"},{currency:"Saudi Riyal",sign:"Rial",abbreviation:"SAR"},{currency:"Serbian Dinar",sign:"din",abbreviation:"RSD"},{currency:"Seychellois Rupee",sign:"SCR",abbreviation:"SCR"},{currency:"Sierra Leonean Leone",sign:"SLL",abbreviation:"SLL"},{currency:"Singapore Dollar",sign:"$",abbreviation:"SGD"},{currency:"Solomon Islands Dollar",sign:"$",abbreviation:"SBD"},{currency:"Somali Shilling",sign:"SOS",abbreviation:"SOS"},{currency:"South African Rand",sign:"R",abbreviation:"ZAR"},{currency:"South Korean Won",sign:"₩",abbreviation:"KRW"},{currency:"South Sudanese Pound",sign:"£",abbreviation:"SSP"},{currency:"Sri Lankan Rupee",sign:"Rs",abbreviation:"LKR"},{currency:"Sudanese Pound",sign:"SDG",abbreviation:"SDG"},{currency:"Surinamese Dollar",sign:"$",abbreviation:"SRD"},{currency:"Swazi Lilangeni",sign:"SZL",abbreviation:"SZL"},{currency:"Swedish Krona",sign:"kr",abbreviation:"SEK"},{currency:"Swiss Franc",sign:"CHF",abbreviation:"CHF"},{currency:"Syrian Pound",sign:"£",abbreviation:"SYP"},{currency:"Tajikistani Somoni",sign:"Som",abbreviation:"TJS"},{currency:"Tanzanian Shilling",sign:"TSh",abbreviation:"TZS"},{currency:"Thai Baht",sign:"฿",abbreviation:"THB"},{currency:"Tongan Pa'anga",sign:"T$",abbreviation:"TOP"},{currency:"Trinidad and Tobago Dollar",sign:"$",abbreviation:"TTD"},{currency:"Tunisian Dinar",sign:"din",abbreviation:"TND"},{currency:"Turkish Lira",sign:"₺",abbreviation:"TRY"},{currency:"Turkmenistani Manat",sign:"m",abbreviation:"TMT"},{currency:"Ugandan Shilling",sign:"UGX",abbreviation:"UGX"},{currency:"Ukrainian Hryvnia",sign:"грн.",abbreviation:"UAH"},{currency:"United Arab Emirates Dirham",sign:"dh",abbreviation:"AED"},{currency:"Uruguayan Peso",sign:"$",abbreviation:"UYU"},{currency:"Uzbekistan Som",sign:"soʼm",abbreviation:"UZS"},{currency:"Vanuatu Vatu",sign:"VUV",abbreviation:"VUV"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VEF"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VES"},{currency:"Vietnamese Dong",sign:"₫",abbreviation:"VND"},{currency:"Yemeni Rial",sign:"Rial",abbreviation:"YER"},{currency:"Zambian Kwacha",sign:"ZMW",abbreviation:"ZMW"},{currency:"Zimbabwean Dollar",sign:"$",abbreviation:"ZWD"}].map((e=>(e.label=e.currency,e.menuLabel='<div style="display: flex; justify-content: space-between;"><span>'+e.currency+'</span><span style="opacity: 0.7;">'+e.sign+" 1,000.00</span></div>",e.value=e.abbreviation,e)))}});
|
|
58
|
+
Smart.Utilities.Assign("Grid.Select",class{_refreshSelection(){const e=this;if(e.selection.enabled&&(e._selectionColumn.refresh(),!e._isVirtualMode()&&e._selection&&e._selection.rows))for(let t in e._selection.rows)e.rowById[t]||delete e._selection.rows[t];e._refreshCellSelectionRect()}_toggleColumnSelection(e){const t=this;if(!t.selection.enabled||"none"===t.selection.checkBoxes.selectAllMode)return void(t._inputOverlay&&t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay));let l=e.element.getAttribute("selected");l="indeterminate"===l||""!==l;let n=t._recyclingRows;t._selectionColumn._selecting=!0,t.beginUpdate(),t._selection.indexes=[];for(let e=0;e<n.length;e++)n[e].selected=l;if(t._selectionColumn._selecting=!1,t.endUpdate(!1),t._isVirtualMode())if(l)for(let e=0;e<t.dataSource.virtualDataSourceLength;e++)l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e);else t._selection.indexes=[],t._selection.rows=[];if(t._recycle(!1),t.$.fireEvent("change",{started:!1,finished:!0}),t.selection.enabled&&t.selection.checkBoxes.enabled&&"none"!==t.selection.checkBoxes.selectAllMode){const l=e.element,n=l.querySelector(".smart-input");t._inputOverlay?t._inputOverlay.parentNode!==t.$.columnHeader&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)):(t._inputOverlay=document.createElement("div"),t.$.columnHeader.appendChild(t._inputOverlay)),t._inputOverlay.column=e,t._inputOverlay.onpointerdown=function(){t._inputOverlay||(t._inputOverlay.onpointerdown=null);const e=t._inputOverlay.column;t._inputOverlay.classList.remove("smart-animate"),t._selectionColumn._selecting=!0,t.beginUpdate();let l=e.element.hasAttribute("selected"),n=t._recyclingRows;for(let e=0;e<n.length;e++)n[e].selected=!l;t._selectionColumn._selecting=!1;const o=t._inputOverlay;if(t.endUpdate(!1),t._isVirtualMode())if(l)t._selection.indexes=[],t._selection.rows=[];else for(let e=0;e<t.dataSource.virtualDataSourceLength;e++)l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e);return t._recycle(),t.$.fireEvent("change",{started:!1,finished:!0}),t.$.fireEvent("columnClick",{column:e,dataField:e.dataField}),t.$.columnHeader.appendChild(o),t._inputOverlay=o,t._inputOverlay.classList.add("smart-animate"),!1},t._inputOverlay.classList.add("smart-input-overlay"),t._inputOverlay.classList.add("smart-input-overlay-column"),t.appearance.allowCheckBoxesSelectionAnimation&&t._inputOverlay.classList.add("smart-animate"),t._inputOverlay.style.top=(l.offsetHeight-n.offsetHeight)/4+1+"px";const o=t._selectionColumn.element.parentElement.offsetLeft+t._selectionColumn.element.offsetLeft;t.rightToLeft?t._inputOverlay.style.right=o+"px":t._inputOverlay.style.left=o+"px",t._inputOverlay.style.height=l.offsetWidth+"px",t._inputOverlay.style.width=l.offsetWidth+"px",t._inputOverlay.onmousedown=null,t._inputOverlay.classList.add("smart-input-overlay-on"),t._selectionColumn.refresh()}}_refreshCheckBoxColumnSelection(){const e=this;if(e.selection.enabled&&e.selection.checkBoxes.enabled){const t=e._selectionColumn.element;"none"===e.selection.checkBoxes.selectAllMode?(t.removeAttribute("checkbox"),t.label.classList.remove("smart-input")):(t.setAttribute("checkbox",""),t.label.classList.add("smart-input")),e._selectionColumn.refresh()}}_handleExtendedRowSelection(e,t){const l=this;if(!e)return;let n=l._recyclingRows;if(l.paging.enabled&&"page"===l.selection.selectAllMode&&(n=n.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize)),!t||t.ctrlKey||t.metaKey||(l._selection.rows=[],l._selection.indexes=[]),t&&!t.shiftKey&&(l._rangeSelectionStartRow=e,l._rangeSelectionEndRow=e),t&&t.shiftKey){l._rangeSelectionEndRow=e;const t=n.indexOf(l._rangeSelectionStartRow),o=n.indexOf(l._rangeSelectionEndRow),i=Math.min(t,o),a=Math.max(t,o);if(-1===t||-1===o)return;for(let e=i;e<=a;e++){const t=n[e];t.allowSelect&&t.setProperty("selected",!0)}}else!1!==e.allowSelect&&(t&&(t.ctrlKey||t.metaKey)?null===e.selected?e.setProperty("selected",!0):e.setProperty("selected",!e.selected):e.setProperty("selected",!0))}_setSelection(e,t,l){const n=this;if(!n.selection.enabled)return;if(n._lastColumnSelectionRange=null,n._lastRowSelectionRange=null,n.closeMenu(),null===e&&null===t)return void n.clearSelection();const o=function(){if(l&&!l.ctrlKey&&!l.metaKey&&!l.shiftKey||"one"===n.selection.mode){if("many"!==n.selection.mode){for(let e in n._selection.rows){const t=n.rowById[e];t&&(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}n._selection.indexes=[],n._selection.rows=[],n._selection.columns=[],n._selection.cells=[]}n._selection.focusedCell=null}if(n._selection.selectionRect){const e=n._selection.selectionRect;e.parentNode.removeChild(e);const t={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(t.down="touchstart",t.move="touchmove",t.up="touchend"),document.removeEventListener(t.move,e.onMove),document.removeEventListener(t.up,e.onUp),document.removeEventListener(t.down,e.onDown),n._selection.selectionRect=null}};n.beginUpdate();const i=n.columnByDataField[t],a=()=>{const t=n.rowById[e];t&&(t.allowSelect||null===t.allowSelect&&!l)&&(n.selection.checkBoxes.enabled&&l&&l.originalEvent&&l.originalEvent.target&&l.originalEvent.target.parentNode&&l.originalEvent.target.parentNode.hasAttribute("checkbox")&&(l.ctrlKey=!0),o(),n._selectRow(e,l))};if(n.selection.allowCellSelection&&null!=e&&i&&!i.autoGenerated){const i=n.rowById[e];if(!i)return n.endUpdate(!1),void n._recycle();let a=i.getCell(t);const s=n._getParentCell(i,t);s&&(a=s.row.getCell(s.column.dataField)),a&&a.column.allowSelect&&(o(),!l||l.ctrlKey||l.metaKey||(n._selection.rows=[],n._selection.indexes=[],n._selection.columns=[],"many"!==n.selection.mode&&(n._selection.cells=[])),"extended"===n.selection.mode?l&&(l.ctrlKey||l.metaKey)?a.selected=!a.selected:a.selected=!0:"one"===n.selection.mode?a.selected=!0:a.selected=!a.selected,(l&&!l.shiftKey||!n._selection.focusedCell)&&(n._selection.focusedCell={id:a.row.id,value:a.value,index:a.row.index,dataField:a.column.dataField}),l&&(l.shiftKey||n._selection.focusedCell.id===a.row.id&&n._selection.focusedCell.dataField===a.column.dataField&&"extended"===n.selection.mode)&&(s?n._renderCellSelectionRect(a.row,a.column,s.endRow,s.endColumn):n._renderCellSelectionRect(a.row,a.column,a.row,a.column)))}else n.selection.allowRowHeaderSelection&&null!=e&&void 0===n.columnByDataField[t]||n.selection.checkBoxes.enabled&&null!=e&&"_checkBoxColumn"===t&&void 0===n.columnByDataField[t]?a():null==e||null!=t&&void 0===n.columnByDataField[t]||!n.selection.allowRowSelection?n.selection.allowColumnHeaderSelection&&i&&(o(),n._selectColumn(t,l||new KeyboardEvent("keydown"))):a();n.endUpdate(!1,!1),n._recycle(!1,!0,!1),null==e||i||n._renderInputOverlay(e,l),n.__selectionStarted=new Date}_renderCellSelectionRect(e,t,l,n){const o=this;let i=o._recyclingRows;const a=i.indexOf(e),s=i.indexOf(l);if(!(o.grouping.enabled&&"advanced"===o.grouping.renderMode&&o.dataSource&&o.dataSource.groupBy.length>0)&&a>=0&&s>=0){if(!o._selection.selectionRect){const e=function(e){const t=document.createElement("div"),l=document.createElement("div"),n=document.createElement("div");return n.classList.add("smart-selection-overlay"),n.appendChild(l),l.appendChild(t),t.classList.add("smart-selection-overlay-content"),l.classList.add("smart-selection-overlay-border-content"),o.selection.allowCellDragSelectionHandle&&e&&l.classList.add("handle"),o.$.scrollView.appendChild(n),n},t=o._selection.selectionRect=e(!0);if(o.selection.allowCellDragSelectionHandle){let e=null,l=null,n=null;t.onMove=function(t){const a=o._selection.selectionRect;let s=t.clientX,r=t.clientY;t.touches&&(s=t.touches[0].clientX,r=t.touches[0].clientY);const d=function(e){const t=(o.enableShadowDOM?o.shadowRoot:o.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null;for(let e=0;e<t.length;e++){const n=t[e];if(n.getAttribute("data-field")){l=n.getAttribute("data-field");break}}let n=null;for(let e=0;e<t.length;e++){const l=t[e];if(l.getAttribute("data-id")){n=l.row;break}}return{column:o.columnByDataField[l],row:n}};if(a&&a.capturedDrag){let e=d({clientX:s,clientY:r}),l=d({clientX:s,clientY:r+a.top}).row,n=d({clientX:s+a.left,clientY:r}).column;if(l||(l=i[i.length-1]),n||(n=e.column),l&&n&&e.row&&e.column){a.row=e.row,a.rowId=a.row.id,a.column=e.column,a.endDragRow=a.endRow=l,a.endDragColumn=a.endColumn=n,a.endDragRowId=a.endDragRow.id,o._dragSelectionStartDataField=a.column.dataField,o._dragSelectionStartRow=a.row;const t=a.row.getCell(a.column.dataField);o._selection.focusedCell={index:t.row.index,id:t.row.id,dataField:t.column.dataField,value:t.value}}o._resizeSelectionRect(),t.preventDefault()}else if(a&&a.captured)if(o._dragSelectionStartDataField=o._selection.focusedCell.dataField,o._dragSelectionStartRow=o.rowById[o._selection.focusedCell.id],null===l&&null===n&&(Math.abs(s-e.left)>=30?l=!0:Math.abs(r-e.top)>=30&&(n=!0)),a.lastPoint&&Math.abs(a.lastPoint.top-r)>=40?(l=null,n=!0):a.lastPoint&&Math.abs(a.lastPoint.left-s)>=40&&(n=null,l=!0),l){const t=a.endDragColumn.dataField,l=d({clientX:s,clientY:e.top-5});l.row&&l.column&&(a.endDragRow=a.endRow,a.endDragColumn=l.column,a.endDragColumn.dataField!==t&&(a.lastPoint={left:s,top:r}),o._resizeSelectionRect())}else if(n){const t=a.endDragRow,l=d({clientX:e.left-5,clientY:r});l.row&&l.column&&(a.endDragRow=l.row,a.endDragColumn=a.endColumn,a.endDragRow.id&&a.endDragRow.id!==t.id&&(a.lastPoint={left:s,top:r}),o._resizeSelectionRect())}a&&a.captured&&o.selection.allowDragSelectionAutoScroll&&(o._autoScrollSelectionDragInterval&&clearInterval(o._autoScrollSelectionDragInterval),o.selection.isDragging=!0,o._autoScrollSelectionDragInterval=setInterval((function(){const e=o.$.scrollView.getBoundingClientRect();s<=e.left+20?(o.scrollLeft-=15,o._resizeSelectionRect()):s>=e.left+e.width-20&&(o.scrollLeft+=15,o._resizeSelectionRect()),r<=e.top+20?(o.scrollTop-=15,o._resizeSelectionRect()):r>=e.top+e.height-20&&(o.scrollTop+=15,o._resizeSelectionRect())}),25))},t.onUp=function(){if(!t.captured)return;o._autoScrollSelectionDragInterval&&clearInterval(o._autoScrollSelectionDragInterval),o.editing.editCell||o.editing.editRow||o.focus(),t.capturedDrag=!1,t.captured=!1,l=null,n=null,e=null,t.lastPoint=null;const i=t.cellValues;t.minRow&&t.maxRow&&t.maxRow&&t.maxColumn&&(o._selectCellsRange(t.minRow,t.maxRow,t.minColumn.dataField,t.maxColumn.dataField),t.row=t.minRow,t.rowId=t.row.id,t.column=t.minColumn,t.endColumn=t.maxColumn,t.endRow=t.maxRow,t.endRowId=t.maxRow.id,t.cellValues=i,o._resizeSelectionRect(),o.selection.allowCellDragSelectionAutoFill&&o._pasteSelectedCells({row:t.row,endRow:t.endDragRow,column:t.column,endColumn:t.endColumn},i)),t.endDragColumn=null,t.endDragRow=null,t.minColumn=null,t.minRow=null,t.maxColumn=null,t.maxRow=null},t.onDown=function(l){if(t.captured&&!e){let t=l.clientX,n=l.clientY;l.touches&&(t=l.touches[0].clientX,n=l.touches[0].clientY),e={left:t,top:n}}};const a={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(a.down="touchstart",a.move="touchmove",a.up="touchend"),t["on"+a.down]=function(e){const l=t.getBoundingClientRect();let n=e.clientX,i=e.clientY;e.touches&&(n=e.touches[0].clientX,i=e.touches[0].clientY),n>=l.right-5&&i>=l.bottom-5?(t.captured=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn):o.selection.allowCellDragDropSelectionHandle&&i>=l.bottom-5?(t.captured=!0,t.capturedDrag=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn,t.left=t.endColumn.left-t.column.left,t.top=t.endRow.top-t.row.top):t.captured||o._rowDownHandler(e)},document.addEventListener(a.move,t.onMove,{passive:!1}),document.addEventListener(a.up,t.onUp,{passive:!1}),document.addEventListener(a.down,t.onDown,{passive:!1})}}const e=o._selection.selectionRect;e.row=o.rowById[o._selection.focusedCell.id],e.rowId=o._selection.focusedCell.id,e.column=o.columnByDataField[o._selection.focusedCell.dataField],e.endRow=l,e.endRowId=l.id,e.endDragRow=l,e.endColumn=n,e.endDragColumn=n,o._refreshCellSelectionRect()}}_resizeSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t)return;let l=e._recyclingRows,n=t.row,o=t.endDragRow,i=t.column,a=t.endDragColumn;const s=e.viewColumns,r=l.indexOf(n),d=l.indexOf(o),c=l.indexOf(t.endRow),u=s.indexOf(i),f=s.indexOf(a),_=s.indexOf(t.endColumn),g=Math.min(c,Math.min(r,d)),m=Math.max(c,Math.max(r,d)),w=Math.min(_,Math.min(u,f)),p=Math.max(_,Math.max(u,f));c<=Math.min(r,d)?t.minRow=t.endRow:t.minRow=r<=d?n:o,c>=Math.max(r,d)?t.maxRow=t.endRow:t.maxRow=r>=d?n:o,_<=Math.min(u,f)?t.minColumn=t.endColumn:t.minColumn=u<=f?i:a,_>=Math.max(u,f)?t.maxColumn=t.endColumn:t.maxColumn=u>=f?i:a;let h=0,y=0,S=0,v=0;for(let e=g;e<=m;e++){const t=l[e];if(t){e===g&&(h=t.top),e===m&&(y=t.top+t.height-h);for(let e=w;e<=p;e++){const l=s[e].dataField,n=t.getCell(l);e===w&&(S=n.column.left),e===p&&(v=n.column.left+n.column.computedWidth-S)}}}t.style.top=h-e.scrollTop-1+"px",e._isVirtualMode()&&(t.style.top=h+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft?t.style.right=S-e.scrollLeft+"px":t.style.left=S-e.scrollLeft+"px",t.style.height=y+1+"px",t.style.width=v+1+"px"}_getPatternValue(e,t,l){let n=[],o=0,i=[],a=[],s=[],r=[];const d={names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},c={names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},u=function(e){if(void 0!==e&&!(e.toString().indexOf("GMT+")>=0||e.toString().indexOf("GMT-")>=0)){if(!isNaN(parseFloat(e)))return/[A-Za-z]/.test(e.toString())?void 0:parseFloat(e);if(d.names.indexOf(e)>=0)return r=d.names,d.names.indexOf(e);if(d.namesAbbr.indexOf(e)>=0)return r=d.namesAbbr,d.namesAbbr.indexOf(e);if(d.namesShort.indexOf(e)>=0)return r=d.namesShort,d.namesShort.indexOf(e);if(c.names.indexOf(e)>=0)return r=c.names,c.names.indexOf(e);if(c.namesAbbr.indexOf(e)>=0)return r=c.namesAbbr,c.namesAbbr.indexOf(e);if(void 0!==e&&(null===e&&(e=""),/\d+/.test(e.toString()))){s.push(e.toString().replace(/[0-9]/,"#")),s[s.length-1]=s[s.length-1].replace(/[0-9]/g,"");const t=parseFloat(e.toString().replace(/\D/g,""));return isNaN(t)?0:t}}};let f=0;for(let e in l){let t=l[e];n[o]=[],f=0;for(let e in t){let l=u(t[e]);void 0!==l&&(n[o].push(l),f++)}if(0===n[o].length)continue;let a=n[o][0],d=0;for(let e=0;e<n[o].length;e++){let t=u(n[o][e-1]),l=u(n[o][e]);0===e&&(t=l),a+=l,d+=l-t}a/=n[o].length,a-=n[o][0],a+=n[o][n[o].length-1],0!==d&&(d/=n[o].length-1),(r.length>0||s.length>0)&&(d=1,a=n[o][0]),n[o].length<=2&&(a=n[o][n[o].length-1]+d),i.push({step:d,stepStart:a}),o++}for(let e=0;e<f;e++){let t=n[0][e],l=0;for(let o=1;o<n.length;o++){const i=u(n[o-1][e]),a=u(n[o][e]);t+=a,l+=a-i}t/=n.length,t-=n[0][e],t+=n[n.length-1][e],0!==l&&(l/=n.length-1),(r.length>0||s.length>0)&&(l=1,t=n[0][e]),n.length<=2&&(t=n[n.length-1][e]+l),a.push({step:l,stepStart:t})}if(!n[e]){let l=n.length;for(let o=l;o<=e;o++){n[o]=[];for(let e=0;e<=t;e++)a[e]||(a[e]=a[e-1]),a[e]&&(o===l?n[o][e]=a[e].stepStart:(n[o][e]=n[o-1][e]+a[e].step,r.length>1&&n[o][e]>=r.length&&(n[o][e]=0)))}return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}if(!n[e][t]){let l=f;for(let o=l;o<=t;o++)i[e]&&(o===l?n[e].push(i[e].stepStart):(n[e][o]=n[e][o-1]+i[e].step,r.length>1&&n[e][o]>=r.length&&(n[e][o]=0)));return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}return n[e]&&n[e][t]?s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]:0}_pasteDataType(e){const t=this.dataSource&&"number"==typeof this.dataSource.dataSource,l=e.cell,n=e.value;let o=l.column.dataType;return o&&!t||(o=isNaN(parseFloat(n))?"string":n instanceof Date?"date":"true"===n||"false"===n?"boolean":"number"),o}_pasteModeCopy(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell;let i=e.value;if(o.column.editor&&o.column.editor.dataSource&&i)for(let e=0;e<o.column.editor.dataSource.length;e++){const t=o.column.editor.dataSource[e];if("string"!=typeof t&&t.label===i){i=t.value;break}}const a=i,s=e.dataField;let r=a,d=!1;if("string"===n)r=a,d=!0;else if("bool"===n||"boolean"===n)1!==a&&"1"!==a&&!0!==a&&"true"!==a&&"TRUE"!==a&&"True"!==a||(r=!0,d=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):(r=a,d=!0)}else if("number"===n||"float"===n||"int"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):null!==a?"int"===n||"integer"===n?(r=parseInt(a),d=!0):(r=parseFloat(a),isNaN(r)&&(r=null),d=!0):(r=null,d=!0)}if(d)if(t.dataSource&&t.dataSource.virtualDataSource){const e={};e[o.column.dataField]=r,t.updateRow(o.row.id,e)}else{const e=o.value;if(t._setCellUndoRedo(o,e,r),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]),t._pasteTempValues.push({id:o.row.id,cell:o,dataField:o.column.dataField,oldValue:e,newValue:r}),t._pasteTimer&&clearTimeout(t._pasteTimer);const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};t._pasteTimer=setTimeout((()=>{if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1)}}),t)}else t.onCellUpdate([o],[e],[r],(function(e){e&&(l(o,r),o.value=r)}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const e=Object.assign({},o.row.data),l=Object.assign({},o.row.data);l[o.column.dataField]=r,o.row.updatedDate=new Date,o.row.updatedBy=t.currentUser,t.onRowUpdate([o.row.index],[o.row],[e],[l],(function(e){e&&(o.value=r)}),t)}else o.value=r}}_pasteModeFill(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell,i=e.selectedValues,a=e.minRowIndex,s=e.minColumnIndex,r=e.currentRowIndex,d=e.currentColumnIndex,c=e.dataField;let u=e.value;if("string"===n)/\d+/.test(u.toString())?(u=t._getPatternValue(r-a,d-s,i),void 0===u&&i[r-a]&&i[r-a][d-s]&&(u=i[r-a][d-s])):(u=t._getPatternValue(r-a,d-s,i),void 0===u&&(u=i[r-a]?i[r-a][d-s]:e.value),void 0===u&&(u=e.value)),void 0!==u&&(o.value=u);else if("bool"===n||"boolean"===n)1!==u&&"1"!==u&&!0!==u&&"true"!==u&&"TRUE"!==u&&"True"!==u||(o.value=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n&&(o.value=null),i[r-a]&&(u=i[r-a][d-s],void 0!==u&&(o.value=u))}else if("number"===n||"float"===n||"int"===n){u=t._getPatternValue(r-a,d-s,i);const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n?o.value=null:o.value=null!==u?"int"===n||"integer"===n?parseInt(u):parseFloat(u):null}}_pasteSelectedCells(e,t){const l=this;l.beginUpdate();let n=l._recyclingRows,o=e.row,i=e.endRow,a=e.column,s=e.endColumn;const r=n.indexOf(o),d=n.indexOf(i),c=n.indexOf(e.endRow),u=l.viewColumns,f=u.indexOf(a),_=u.indexOf(s),g=u.indexOf(e.endColumn),m=Math.min(c,Math.min(r,d)),w=Math.max(c,Math.max(r,d)),p=Math.min(g,Math.min(f,_)),h=Math.max(g,Math.max(f,_));let y=0,S=0,v=0,R=0;for(let e in t)0===y&&(S+=Object.keys(t[e]).length),y++;for(let e=m;e<=w;e++){const o=n[e];v=0;for(let n=p;n<=h;n++){if(!u[n])continue;const i=u[n].dataField,a=o.getCell(i);let s=0;for(let r in t){if(s===R){let s=0,d=t[r];for(let r in d){if(v===s){let s=d[r],c=!0;if(t[o.id]&&t[o.id][i]&&(c=!1),c&&"none"!==l.clipboard.autoFillMode){const o={value:s,targetValue:a.value,dataField:r,index:a.row.visibleIndex,targetDataField:i,targetRowIndex:e};if(l.clipboard.onPasteValue){l.clipboard.onPasteValue(o);const e=a.value;a.value=o.value,l._setCellUndoRedo(a,e,o.value)}else o.cell=a,o.selectedValues=t,o.minRowIndex=m,o.maxRowIndex=w,o.minColumnIndex=p,o.maxColumnIndex=h,o.currentColumnIndex=n,o.currentRowIndex=e,"copy"===l.clipboard.autoFillMode?l._pasteModeCopy(o):"fillSeries"===l.clipboard.autoFillMode&&l._pasteModeFill(o)}}s++}}s++}v++,v>=S&&(v=0)}R++,R>=y&&(R=0)}l.endUpdate(!1),l._recycle(!1),l._refreshDataFilters()}_refreshCellSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t||t&&t.captured)return;let l=e._recyclingRows,n=t.row,o=t.endRow,i=t.column,a=t.endColumn;const s=e.viewColumns;if(!a||!i)return;if(e._isVirtualMode()){if(n.id!==t.rowId&&!e.rowById[t.rowId])return t.style.height="0px",void(t.style.width="0px");n=e.rowById[t.rowId],o=e.rowById[t.endRowId]}if(!i.allowSelect||!a.allowSelect){if(i===a)return t.style.width="0px",void(t.style.height="0px");{const e=s.indexOf(i),l=s.indexOf(a);i=null,a=null;for(let t=e;t<l;t++){const e=s[t];e.allowSelect&&!i&&(i=e),a=e}if(!i||!a)return t.style.width="0px",void(t.style.height="0px")}}const r=l.indexOf(n),d=l.indexOf(o),c=s.indexOf(i),u=s.indexOf(a);let f=Math.min(r,d),_=Math.max(r,d),g=Math.min(c,u),m=Math.max(c,u);g=Math.max(0,g),f=Math.max(0,f);const w=function(e){const t=l.indexOf(e.row),n=l.indexOf(e.endRow),o=s.indexOf(e.column),i=s.indexOf(e.endColumn);f=Math.min(f,t),f=Math.min(f,n),f=Math.max(0,f),_=Math.max(_,t),_=Math.max(_,n),g=Math.min(g,o),g=Math.min(g,i),g=Math.max(0,g),m=Math.max(m,o),m=Math.max(m,i)},p=e._getParentCell(n,i.dataField),h=e._getParentCell(n,a.dataField),y=e._getParentCell(o,a.dataField),S=e._getParentCell(o,i.dataField);p&&w(p),h&&w(h),y&&w(y),S&&w(S);let v=0,R=0,C=0,x=0;t.cellValues=[];for(let n=f;n<=_;n++){const o=l[n];if(n===f&&(v=o.top,!0!==o.freeze&&"near"!==o.freeze&&(v+=e.__frozenNearHeight),"far"===o.freeze&&(v=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight)),n===_){let t=o.top;"far"===o.freeze&&(t=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight),R=t+o.height-v,!0!==o.freeze&&"near"!==o.freeze&&(R+=e.__frozenNearHeight)}t.cellValues[o.id]=[];const i=e._isUpdating;e._isUpdating=!0;for(let l=g;l<=m;l++){const n=s[l].dataField,i=o.getCell(n);let a=i.element?i.element.textContent:i.value;if(void 0===a&&(a=""),t.cellValues[o.id][n]=a,l===g&&(C=i.column.left,i.column.freeze&&"far"===i.column.freeze&&(C=e.__clientSize.width-e.__frozenFarWidth+C+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth)),l===m){let t=i.column.left;i.column.freeze&&"far"===i.column.freeze&&(t=e.__clientSize.width-e.__frozenFarWidth+t+e.scrollLeft-e._scrollView.vScrollBar.offsetWidth),x=t+i.column.computedWidth-C}i.selected=!0}e._isUpdating=i}if(v-e.scrollTop<e.layout.rowMinHeight&&e.filtering.enabled&&e.filtering.filterRow.visible){const t=v;v=e.layout.rowMinHeight+e.scrollTop,R-=v-t}if(R<=0)t.classList.add("smart-visibility-hidden");else{if(t.classList.remove("smart-visibility-hidden"),t.style.top=v-e.scrollTop-1+"px",e._isVirtualMode()&&(t.style.top=v+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft)t.style.right=C-e.scrollLeft+"px";else if(t.style.left=C-e.scrollLeft+"px",C-e.scrollLeft<e.__frozenNearWidth-1){let l=0;for(let t=0;t<e._frozenNearColumns.length;t++){const n=e._frozenNearColumns[t];n&&n.autoGenerated&&n.visible&&(l+=n.width)}if(C-e.scrollLeft<l){const n=l-C+e.scrollLeft;x-=n,t.style.left=n+C-e.scrollLeft+"px"}}t.style.height=R+1+"px",t.style.width=x+1+"px"}}_renderInputOverlay(e,t,l){const n=this,o=n.rowById[e];if(o&&!1!==o.allowSelect&&!o.label&&t&&n.selection.checkBoxes.enabled){n._inputOverlay&&n._inputOverlay.classList.contains("smart-input-overlay-column")&&(n._inputOverlay.parentNode&&n._inputOverlay.parentNode.removeChild(n._inputOverlay),n._inputOverlay=null),n._inputOverlay||(n._inputOverlay=document.createElement("div"),n.$.scrollView.appendChild(n._inputOverlay),n._inputOverlay.classList.add("smart-input-overlay"));let e=o.freeze?o.top:n.__frozenNearHeight+o.top;const t=Math.round((o.cellHeight-n._selectionColumn.computedWidth)/2),i=n._selectionColumn.element.parentElement.offsetLeft+n._selectionColumn.element.offsetLeft;if(n._inputOverlay.style.left=i+"px",n._inputOverlay.style.height=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.width=n._selectionColumn.computedWidth+"px",n._inputOverlay.style.top=e+t-n.scrollTop+"px",o&&o.element){const e=o.element.querySelector("smart-grid-cell");e&&(n._inputOverlay.cell=e.cell)}n._inputOverlay.row=o,n._inputOverlay.onpointerdown=function(e){n._inputOverlay||(n._inputOverlay.onpointerdown=null);const t=n._inputOverlay.row,l=n._inputOverlay.cell;n.beginUpdate(),t.selected=!t.selected,n.endUpdate(!1),n.$.fireEvent("change",{started:!1,finished:!0}),n._refreshSummary(!1);const o=e.originalEvent?e.originalEvent:e,i=3===o.which;n.$.fireEvent("rowClick",{row:t,id:t.id,isRightClick:i,originalEvent:o,pageX:o.pageX,pageY:o.pageY}),l&&n.$.fireEvent("cellClick",{cell:l,id:t.id,dataField:l.column.dataField,isRightClick:i,originalEvent:o,pageX:o.pageX,pageY:o.pageY}),n._recycle(),n._renderInputOverlay(t.id,e,!0)},n.appearance.allowCheckBoxesSelectionAnimation&&void 0===l&&n._inputOverlay.classList.add("smart-animate"),requestAnimationFrame((()=>{n._inputOverlay&&n._inputOverlay.classList.add("smart-input-overlay-on")}))}}_selectRow(e,t){const l=this,n=l.rowById[e];if(n&&l.selection.enabled&&(!n.header||"row-resize"!==n.header.style.cursor)){if(t&&(!t.shiftKey||!l._selection.focusedCell)){const t=n.getCell(l.columns[0].dataField);l._selection.focusedCell={index:t.row.index,id:e,dataField:t.column.dataField,value:t.value}}l._lastRowsSelectionRange=null,"extended"===l.selection.mode?l._handleExtendedRowSelection(n,t):"one"===l.selection.mode?n.select():n.selected?n.unselect():n.select()}}_getParentCell(e,t){const l=this;let n=l._recyclingRows;for(let o=0;o<l._cellsMerge.length;o++){const i=l._cellsMerge[o];let a=[],s=[];if(a.push(i.row),i.rowSpan>1){const e=n.indexOf(i.row);if(e>=0)for(let t=e;t<e+i.rowSpan;t++)n[t]&&-1===a.indexOf(n[t])&&a.push(n[t])}if(s.push(i.column.dataField),i.colSpan>1){const e=l.viewColumns.indexOf(l.columnByDataField[i.column.dataField]);for(let t=e;t<e+i.colSpan;t++)s[t]&&-1===s.indexOf(s[t].dataField)&&s.push(s[t].dataField)}if(a.indexOf(e)>=0&&s.indexOf(t)>=0)return{row:i.row,column:i.column,endRow:a[a.length-1],endColumn:l.columnByDataField[s[s.length-1]]}}if(l._cellRowSpan)for(let o=0;o<l._cellRowSpan.length;o++){const o=e.visibleIndex;let i=-1,a=null;for(let e=0;e<l._cellRowSpan.length;e++){const t=l._cellRowSpan[e];if(o>t[0]&&o<t[1]){i=t[0],a=t[2];break}}if(i>=0&&a===t){const e=n[i];if(e)return{row:e,column:l.columnByDataField[t],endRow:e,endColumn:l.columnByDataField[t]}}}return null}_selectCellsRange(e,t,l,n){const o=this,i=o._selection.selectionRect;if(o._lastRowsSelectionRange&&o._lastRowsSelectionRange.id===e.id&&o._lastRowsSelectionRange.endId===t.id&&o._lastColumnSelectionRange&&o._lastColumnSelectionRange.dataField===l&&o._lastColumnSelectionRange.endDataField===n)return;o.beginUpdate(),o._clearSelection(),o._lastRowsSelectionRange={id:e.id,endId:t.id},o._lastColumnSelectionRange={dataField:l,endDataField:n},(!i||i&&!i.captured)&&o._selection.focusedCell&&o._renderCellSelectionRect(o.rowById[o._selection.focusedCell.id],o.columnByDataField[o._selection.focusedCell.dataField],o.rowById[o._lastRowsSelectionRange.endId],o.columnByDataField[o._lastColumnSelectionRange.endDataField]);let a=o._recyclingRows;const s=o.viewColumns;let r=-1,d=-1,c=a.indexOf(e),u=a.indexOf(t),f=-1;for(let e=0;e<s.length;e++){const t=s[e];t.allowSelect&&(-1===f&&(f=e),t.dataField===l&&(r=e),t.dataField===n&&(d=e))}if(-1===f)return o.endUpdate(!1),void o._recycle();-1===r?r=f:-1===d&&(d=f);let _=Math.min(c,u),g=Math.max(c,u),m=Math.min(r,d),w=Math.max(r,d);const p=function(e){const t=a.indexOf(e.row),l=a.indexOf(e.endRow),n=s.indexOf(e.column),o=s.indexOf(e.endColumn);_=Math.min(_,t),_=Math.min(_,l),g=Math.max(g,t),g=Math.max(g,l),m=Math.min(m,n),m=Math.min(m,o),w=Math.max(w,n),w=Math.max(w,o)},h=o._getParentCell(e,l),y=o._getParentCell(t,n);if(h&&p(h),y&&p(y),g<0||_<0||m<0||w<0)return o.endUpdate(!1),void o._recycle();for(let e=_;e<=g;e++){const t=a[e];if(t.allowSelect)for(let e=0;e<s.length;e++){const l=s[e];l.allowSelect&&e>=m&&e<=w&&(t.getCell(l.dataField).selected=!0)}}o.endUpdate(!1,!1),o._recycle(!1,!0,!1),o._selectionTimer&&clearTimeout(o._selectionTimer),o._selectionTimer=setTimeout((()=>{o._recycle(!1,!0,!1)}),50)}_selectRowsRange(e,t,l){const n=this;if(n._lastRowsSelectionRange&&n._lastRowsSelectionRange.id===e.id&&n._lastRowsSelectionRange.endId===t.id)return;if(n._dragDrop&&n._dragDrop.dragDetails)return;n.beginUpdate(),n._clearSelection(),n._lastRowsSelectionRange={id:e.id,endId:t.id};let o=n._recyclingRows;const i=o.indexOf(e),a=o.indexOf(t),s=Math.min(i,a),r=Math.max(i,a);if(r<0)return n.endUpdate(!1),void n._recycle();for(let e=s;e<=r;e++){const t=o[e];t&&t.allowSelect&&(t.selected=!1!==l)}n.endUpdate(!1),n._recycle()}_selectColumnsRange(e,t){const l=this;if(l._lastColumnSelectionRange&&l._lastColumnSelectionRange.dataField===e&&l._lastColumnSelectionRange.endDataField===t)return;if(l._dragDrop&&l._dragDrop.dragDetails)return;l.beginUpdate(),l._clearSelection(),l._lastColumnSelectionRange={dataField:e,endDataField:t};const n=l.viewColumns;let o=-1,i=n.length;for(let l=0;l<n.length;l++){const a=n[l];a.allowSelect&&(a.dataField===e&&(o=l),a.dataField===t&&(i=l))}const a=Math.min(o,i),s=Math.max(o,i);for(let e=0;e<n.length;e++){const t=n[e];t.allowSelect&&e>=a&&e<=s&&(t.selected=!0)}l.endUpdate(!1),l._recycle()}_selectColumn(e,t){const l=this,n=l.columnByDataField[e],o=l.viewColumns;if(!n||!l.selection.enabled||!1===n.allowSelect||!l.selection.allowColumnHeaderSelection)return;if(n&&"col-resize"===n.element.style.cursor)return;let i=!1;if(n&&(n.allowSelect||null===n.allowSelect&&!t)&&(i=!0),i&&t)if("extended"===l.selection.mode){if(t.ctrlKey||t.metaKey||t.shiftKey||(l._rangeSelectionStartColumn=n,l._rangeSelectionEndColumn=n),t.ctrlKey||t.metaKey?n.selected=!n.selected:n.selected=!0,t&&t.shiftKey){l._rangeSelectionStartColumn||(l._rangeSelectionStartColumn=n),l._rangeSelectionEndColumn=n,l._selection.columns=[];const e=o.indexOf(l._rangeSelectionStartColumn),t=o.indexOf(l._rangeSelectionEndColumn),i=Math.min(e,t),a=Math.max(e,t);for(let e=i;e<=a;e++){const t=o[e];t&&!1!==t.allowSelect&&(t.selected=!0)}}}else"one"===l.selection.mode||null===n.selected?n.selected=!0:n.selected=!n.selected}selectAllRows(){const e=this;let t=e.rows;e._selectionColumn._selecting=!0,e.beginUpdate();for(let e=0;e<t.length;e++)t[e].selected=!0;e._selectionColumn._selecting=!1,e.endUpdate(!1),e._refreshSummary(!1),e._recycle(!1),e._refreshCheckBoxColumnSelection(),e.$.fireEvent("change",{started:!1,finished:!0})}hasSelectedRows(){const e=this.getVisibleRows(),t=this._getSelectedRows(!0,!1);return t.length===e.length||t.length>0&&t.length<e.length||0!==t.length&&0!==e.length&&void 0}areAllRowsSelected(){const e=this.getVisibleRows(),t=this._getSelectedRows(!0,!1);return t.length>0&&t.length===e.length}_getSelectedRows(e,t){const l=this,n=[];let o=l.rows;if(l.rows.canNotify=!1,e&&(o=l.getVisibleRows()),l._isVirtualMode()){let e=l._selection.indexes;return l.paging.enabled&&t&&l._isVirtualMode()&&(e=e.slice(0,l.paging.pageSize)),l.rows.canNotify=!0,Object.keys(e).length}l.paging.enabled&&t&&(o=l._isVirtualMode()?o.slice(0,l.paging.pageSize):o.slice(l.paging.pageIndex*l.paging.pageSize,(l.paging.pageIndex+1)*l.paging.pageSize));for(let e=0;e<o.length;e++){const t=o[e];t.getProperty("selected")?n.push(t):(t.canNotify=!1,t.selected=!1,t.canNotify=!0)}return l.rows.canNotify=!0,n}_dragSelectionEnd(e){const t=this;t._dragSelectionStartDataField=null,t._dragSelectionStartRow=null,t.__selectionStarted&&(t.$.fireEvent("change",{started:!1,finished:!0,originalEvent:e}),t._refreshSummary(),delete t.__selectionStarted,delete t.__selectionStartedFired),t.selection.allowDragSelection&&t.selection.isDragging&&(t.selection.isDragging=!1,t._autoScrollSelectionDragInterval&&(clearInterval(t._autoScrollSelectionDragInterval),t.editing.isEditing||t._recycle()))}_dragSelection(e){const t=this;if("extended"!==t.selection.mode||!1===t.selection.allowDragSelection)return;if(!t._dragSelectionStartDataField&&!t._dragSelectionStartRow)return;const l=()=>{t.__selectionStarted&&!t.__selectionStartedFired&&(t.$.fireEvent("change",{started:!0,finished:!1,originalEvent:e}),t.__selectionStartedFired=!0),t.$.fireEvent("change",{started:!1,finished:!1,originalEvent:e})};if(!t.selection.allowCellSelection||!t._dragSelectionStartDataField||t._columnResizeLine||t._dragSelectionStartDataField.startsWith("_")||!t._dragSelectionStartRow||t._rowResizeLine){if(t._dragSelectionStartRow&&!t._rowResizeLine&&(t.selection.allowRowSelection&&!t._dragSelectionStartDataField.startsWith("_")||t.selection.allowRowHeaderSelection&&t._dragSelectionStartDataField.startsWith("_"))){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){o=t.row,!o&&t.cell&&(o=t.cell.row);break}}let i=!0;t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&o&&t._lastRowsSelectionRange.endId===o.id&&(i=!1),o&&!o.allowSelect&&(i=!1),o&&o.allowSelect&&t._selectRowsRange(t._dragSelectionStartRow,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,i&&l(),t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25)}else if(t._dragSelectionStartDataField&&!t._columnResizeLine&&!t._dragSelectionStartDataField.startsWith("_")&&t.selection.allowColumnHeaderSelection){const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}o&&t._selectColumnsRange(t._dragSelectionStartDataField,o),t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval);let i=!0;t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(i=!1),i&&l(),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15)}),25)}}else{const n=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let o=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}let i=null;for(let e=0;e<n.length;e++){const t=n[e];if(t.getAttribute("data-id")){i=t.row;break}}if(!i&&n.length&&n[0].classList.contains("smart-grid-scroll-view")){i=t._recyclingRows[t._recyclingRows.length-1];const l=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,i.element.getBoundingClientRect().top);for(let e=0;e<l.length;e++){const t=l[e];if(t.getAttribute("data-field")){o=t.getAttribute("data-field");break}}}if(o&&i){if(i.id===t._dragSelectionStartRow.id&&t._dragSelectionStartDataField===o)return;if(o&&o.startsWith("_"))return;let e=!0;t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o&&(e=!1),t._selectCellsRange(t._dragSelectionStartRow,i,t._dragSelectionStartDataField,o),t._removeCellContentPopup(),e&&l()}t.selection.allowDragSelectionAutoScroll&&(t._autoScrollSelectionDragInterval&&clearInterval(t._autoScrollSelectionDragInterval),t.selection.isDragging=!0,t._autoScrollSelectionDragInterval=setInterval((function(){const l=t.$.scrollView.getBoundingClientRect();e.clientX<=l.left+20?t.scrollLeft-=15:e.clientX>=l.left+l.width-20&&(t.scrollLeft+=15),e.clientY<=l.top+20?t.scrollTop-=15:e.clientY>=l.top+l.height-20&&(t.scrollTop+=15)}),25))}}select(e,t){const l=this;l.isInitialized&&(!t&&void 0!==e&&l._selection&&l._selection.rows[e]||(l._setSelection(e,t),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary()))}selectRowsByIndex(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._isVirtualMode()){let l=[];for(let t=0;t<e.length;t++)l[e[t]]=!0;return t._selection.indexes=l,void t._recycle()}t.beginUpdate();for(let l in e){const e=t.rows[l];e&&t._setSelection(e.id)}t.endUpdate(!1),t._recycle()}))}selectRowsRange(e,t){const l=this,n=l.rowById[e],o=l.rowById[t];n&&o&&(l._selectRowsRange(n,o),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}selectCellsByQuery(e){const t=this,l=t.findCells(e);requestAnimationFrame((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t.beginUpdate();for(let e in l){const n=l[e][0],o=l[e][1];t._setSelection(n,o)}t.endUpdate(!1),t._recycle()}))}selectRowsByQuery(e,t,l){const n=this,o=n.find(e,t,l).map((e=>e.$.id));o.length&&n.selectRows(o)}selectRows(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t.beginUpdate();for(let l in e)t._setSelection(e[l]);t.endUpdate(!1),t._recycle()}))}selectCells(e,t){const l=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let n in e)for(let o=0;o<t.length;o++)l._setSelection(e[n],t[o]);l.endUpdate(!1),l._recycle()}))}selectRange(e,t,l,n){const o=this;!function(){const i=new KeyboardEvent("keydown",{shiftKey:!0});requestAnimationFrame((()=>{"extended"!==o.selection.mode&&"many"!==o.selection.mode&&o._clearSelection(),o.beginUpdate(),o._setSelection(e,t),o._setSelection(l,n,i),o.ensureVisible(e,t),o.endUpdate(!1),o._refreshSummary(!1),o._recycle()}))}(),o.$.fireEvent("change",{started:!1,finished:!0})}unselect(e,t){const l=this;l._selection&&(l._selection.rows&&l._selection.rows[e]&&delete l._selection.rows[e],l._selection.columns&&l._selection.columns[t]&&delete l._selection.columns[t],l._selection.cells&&(l._selection.cells["row"+e]&&(delete l._selection.cells["row"+e][t],1===Object.getOwnPropertyNames(l._selection.cells["row"+e]).length&&delete l._selection.cells["row"+e]),l._selection.cells["column"+t]&&(delete l._selection.cells["column"+t][e],1===Object.getOwnPropertyNames(l._selection.cells["column"+t]).length&&delete l._selection.cells["column"+t])),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}getSelectedRows(){const e=this;let t=[];if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);if(e._isVirtualMode()){for(let e in l){const n=l[e];t.push([n,{}])}return t}for(let n in l){const o=l[n],i=e.rowById[o];if(!i)continue;const a={};for(let e in i.data)switch(e){case"$":case"parent":case"level":case"leaf":case"children":continue;default:a[e]=i.data[e]}t.push([i.id,a])}}return t}getSelectedRowIndexes(){const e=this;return e._selection.indexes&&Object.keys(e._selection.indexes).length>0?e._selection.indexes:[]}getSelectedRowIds(){const e=this;let t=[];if(e._isVirtualMode())return e._selection.rows&&Object.keys(e._selection.rows).length>0?e._selection.rows:void 0;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);for(let n in l){const o=l[n],i=e.rowById[o];i&&t.push(i.id)}}return t}getSelectedCells(e){const t=this;let l=[];if(t._selection.cells)for(let n in t._selection.cells)if(n.startsWith("row")){let o=n.replace("row",""),i=null;for(let a in t._selection.cells[n])if(i=a.replace("column",""),l||(l=[]),!1===e)l.push([o,i]);else{const e=t.getCellValue(o,i);l.push([o,i,e])}}return l}getSelection(){const e=this;let t=null,l=null,n=null,o=null;if(e._selection.rows&&Object.keys(e._selection.rows).length>0){const l=Object.keys(e._selection.rows);t=[];for(let n=0;n<l.length;n++){const o=l[n];t.push({id:o,row:e.rowById[o]})}}if(e._selection.columns&&Object.keys(e._selection.columns).length>0){const t=Object.keys(e._selection.columns);l=[];for(let n=0;n<t.length;n++){const o=t[n];l.push({dataField:o,column:e.columnByDataField[o]})}}if(e._selection.cells)for(let t in e._selection.cells)if(t.startsWith("row")){let l=t.replace("row",""),o=null;for(let i in e._selection.cells[t])o=i.replace("column",""),n||(n=[]),n.push({id:l,dataField:o,column:e.columnByDataField[o],row:e.rowById[l]})}return e._selection.focusedCell&&(e._isVirtualMode(),o={index:e._selection.focusedCell.index,id:e._selection.focusedCell.id,dataField:e._selection.focusedCell.dataField}),{rows:t,columns:l,cells:n,focused:o}}focusAndSelect(e,t){const l=this;if(l.focus(),l.selection.enabled&&l.selection.allowCellSelection)l._focusCell(e,t);else{const t=l.rowById[e];if(!t)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e),l._selection.focusedCell={id:t.id,value:null,index:t.index,dataField:l.columns[0].dataField},l.endUpdate(!1)}}_focusCell(e,t){const l=this;if(l.selection.enabled&&l.selection.allowCellSelection){const n=l.rowById[e];if(!n)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e,t);const o=n.getCell(t);o&&(l._selection.focusedCell={id:o.row.id,value:o.value,dataField:t,index:o.row.index}),l.endUpdate(!1)}}_clearSelection(e){const t=this;if(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[],e&&(t._selection.focusedCell=null,t._selection.selectionRect)){const e=t._selection.selectionRect;e.parentNode.removeChild(e);const l={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(l.down="touchstart",l.move="touchmove",l.up="touchend"),document.removeEventListener(l.move,e.onMove),document.removeEventListener(l.up,e.onUp),document.removeEventListener(l.down,e.onDown),t._selection.selectionRect=null}t._recycle(),t._refreshCheckBoxColumnSelection()}_getSelectionCellValues(){const e=this;if(e._selection.selectionRect)return e._selection.selectionRect.cellValues;const t=e.viewColumns;if(e._selection.rows.length>0){let l=[];for(let n in e._selection.rows){const o=e.rowById[n];for(let e=0;e<t.length;e++){const i=t[e];i&&(l[n]||(l[n]=[]),i.autoGenerated||(l[n][i.dataField]=o.data[i.dataField]))}}return l}if(e._selection.columns.length>0){let t=[];for(let l in e._selection.columns){const n=e.columnByDataField[l];if(n)for(let l=0;l<e._recyclingRows.length;l++){const o=e._recyclingRows[l];o&&(t[o.id]||(t[o.id]=[]),t[o.id][n.dataField]=o.data[n.dataField])}}return t}if(e._selection.cells&&Object.keys(e._selection.cells).length>0){const t=e.getSelection();if(t.cells){let e=[];for(let l in t.cells){const n=t.cells[l],o=n.id;e[o]||(e[o]=[]),e[o][n.column.dataField]=n.row.data[n.column.dataField]}return e}}}_clipboardHandler(e,t){const l=this;if(l.clipboard.enabled){if((t.ctrlKey||t.metaKey)&&("c"===e||"x"===e)){const t=l._getSelectionCellValues();let n="",o=Object.keys(t).length,i=0;for(let a in t){let s="",r=Object.keys(t[a]).length,d=0;for(let e in t[a])s+=t[a][e],d++,d<r&&(s+="\t");if(n+=s,i++,i<o&&(n+="\r\n"),"x"===e&&l.editing.enabled){const e=l.getSelection();if(e.cells){l.beginUpdate();for(let t=0;t<e.cells.length;t++){const n=e.cells[t],o=l.rowById[n.id];if(o){const e=o.getCell(n.dataField),t=l._pasteDataType({cell:e,value:e.value});let i=null;"int"!==t&&"number"!==t||(i=0),"string"===t&&(i=""),"boolean"!==t&&"bool"!==t||(i=!1),"date"===t&&(i=new Date),e.column.allowNull&&(i=null);const a=e.oldValue;if(l.onCellUpdate)l.onCellUpdate([e],[a],[i],(function(t){t&&(e.value=i)}),l);else if(l.onRowUpdate){const t=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,l.onRowUpdate([e.row.index],[e.row],[t],[n],(function(t){t&&(e.value=i)}),l)}else e.value=i}}l.endUpdate(!1),l._recycle()}}}if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(n).then((function(){}),(function(){})),Smart.Utilities.Core.Browser.Firefox&&(l._clipboardText=n);else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),e.remove(),l._clipboardText=n}),25)}}if(t.shiftKey&&" "===e&&l.editing.addNewRow.visible&&(l._keyboardAdd=!0,l._addNewGridRow(),l._keyboardAddTimer&&clearTimeout(l._keyboardAddTimer),l._keyboardAddTimer=setTimeout((()=>{l._keyboardAdd=!1}),300)),(t.ctrlKey||t.metaKey)&&"v"===e&&l.editing.enabled){const e=window.Smart.Utilities.Core.Browser.Firefox;if(navigator.clipboard&&!navigator.clipboard.readText&&!e)return;const t=e=>{if(!e)return;const t=[],n=e.split("\r");for(let e=0;e<n.length;e++){const l=n[e].split("\t");let o={};for(let e=0;e<l.length;e++)o[e]=l[e].trim(),void 0!==o[e]&&"undefined"!==o[e]||(o[e]="");t[e]=o}const o=l._selection.selectionRect;if(o)l._pasteSelectedCells({row:o.row,endRow:o.endDragRow,column:o.column,endColumn:o.endColumn},t);else{let e=null,n=null;for(let t in l._selection.rows){const o=l.rowById[t];e||(e=o),n||(n=o),e.visibleIndex>o.visibleIndex&&(e=o),n.visibleIndex<o.visibleIndex&&(n=o)}if(e&&n&&l._pasteSelectedCells({row:e,endRow:n,column:l.firstColumn(),endColumn:l.lastColumn()},t),0===l._selection.rows.length){const o=l.getSelectedCells();let i=null,a=null;for(let t=0;t<o.length;t++){const s=l.rowById[o[t][0]];if(!s)continue;e||(e=s),n||(n=s);const r=l.columnByDataField[o[t][1]];i||(i=a=r),i&&i.visibleIndex>r.visibleIndex&&(i=r),a&&a.visibleIndex<r.visibleIndex&&(a=r),e.visibleIndex>s.visibleIndex&&(e=s),n.visibleIndex<s.visibleIndex&&(n=s)}l._pasteSelectedCells({row:e,endRow:n,column:i,endColumn:a},t)}}};if(!window.isSecureContext||e)return void t(l._clipboardText);navigator.clipboard.readText().then((e=>{t(e)}))}}}_setRemoveUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){t._removeUndoRedoHigherIndexes();const n=t.getRowData(e.id);t._undoRedo.push({action:"remove",data:n,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_setAddUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){let n=!1;for(let l=0;l<t._undoRedo.length;l++){const o=t._undoRedo[l];"add"===o.action&&o.index===e.index&&(n=!0)}if(n)return;t._removeUndoRedoHigherIndexes();const o=t.getRowData(e.id);t._undoRedo.push({action:"add",data:o,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_removeUndoRedoHigherIndexes(){const e=this,t=e._undoRedoIndex;t>=0?e._undoRedo.splice(t+1,e._undoRedo.length-t):-1===t&&(e._undoRedo=[])}_setCellUndoRedo(e,t,l){const n=this;if(!n.isInitialized)return;const o=Smart.Utilities.Core.createGUID().replace(/-/gi,"");n._setCellUndoRedoTimer&&clearTimeout(n._setCellUndoRedoTimer),n._undoRedoAction||(n._pasteUndoRedoValues||(n._pasteUndoRedoValues=[]),void 0===t&&(t=null),n._pasteUndoRedoValues.push({cell:e,index:e.row.index,dataField:e.column.dataField,oldValue:t,newValue:l}),n._setCellUndoRedoTimer=setTimeout((()=>{delete n._setCellUndoRedoTimer,n._removeUndoRedoHigherIndexes(),n._pasteUndoRedoValues.length>1?n._undoRedo.push({action:"updateMultiple",items:n._pasteUndoRedoValues,uid:o}):n._undoRedo.push({action:"update",index:e.row.visibleIndex,cell:e,dataField:e.column.dataField,oldValue:t,newValue:l,uid:o}),n._undoRedoIndex=n._undoRedo.length-1,n._pasteUndoRedoValues=[]}),50))}_undoRedoHandler(e){const t=this,l=e.key;if(e.ctrlKey||e.metaKey){if("z"===l)return t.undo(),void e.preventDefault();if("y"===l)return t.redo(),void e.preventDefault()}}_updateMultiple(e,t){const l=this;let n=9999999,o=0,i=999999,a=0,s=l._recyclingRows;l.beginUpdate();for(let r=0;r<e.items.length;r++){const d=e.items[r],c=s[d.index];if(c){const e=c.id,s=d.dataField,r=t?d.oldValue:d.newValue,u=l.columnByDataField[s],f=l.viewColumns.indexOf(u);i=Math.min(i,f),a=Math.max(a,f),n=Math.min(n,c.visibleIndex),o=Math.max(o,c.visibleIndex),l.setCellValue(e,s,r)}}l._focusCell(s[n].id,l.viewColumns[i].dataField),l._selectCellsRange(s[n],s[o],l.viewColumns[i].dataField,l.viewColumns[a].dataField),delete l._undoRedoAction,l.endUpdate(!1)}redo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t+1];if(l)switch(e._undoRedoIndex++,e._undoRedoAction=!0,l.action){case"add":e.addRow(l.data,!0);break;case"remove":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.newValue;e.setCellValue(n,o,i),e._focusCell(n,o)}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!1)}else delete e._undoRedoAction}undo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t];if(l)switch(e._undoRedoIndex--,e._undoRedoAction=!0,l.action){case"add":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"remove":{const t=l.data;t&&(e._recyclingRows[l.index]?e.insertRow(t,l.index):e.addRow(t,!0));break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.oldValue;void 0!==(e._cellsUpdatedValues?e._cellsUpdatedValues[n+"_"+o]:void 0)&&delete e._cellsUpdatedValues[n+"_"+o],e.setCellValue(n,o,i),e._focusCell(n,o)}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!0)}else e._currentUndoRedo=e._undoRedo[0],delete e._undoRedoAction}_keyDownHandler(e){const t=this;if("grid"!==t.view)return;if(t.onKey&&(t.onKey(e),e.defaultPrevented))return;let l=e.key;if(t.disabled||t.displayLoadingIndicator)return;if(t._undoRedoHandler(e),0===t.dataSource.length)return;if(t.editing.editRow||t.editing.editCell||t.filtering.filterRow.cell)return;t.rightToLeft&&("ArrowLeft"===l?l="ArrowRight":"ArrowRight"===l&&(l="ArrowLeft")),t._refreshCellSelectionRect();const n=t.getSelection();let o=n.focused;if(!n.focused){if(t.editing.enabled&&!0!==t.editing.isEditing&&("F2"===l||"Enter"===l)&&n.columns&&n.columns.length>0){const e=n.columns[n.columns.length-1];e.column.allowHeaderEdit&&t._beginColumnEdit(e.column)}return void(t.menu&&t.menu.classList.contains("open")&&"Escape"===l&&t.closeMenu())}if(e.shiftKey&&e.ctrlKey&&" "===l){const e=t.rowById[o.id];if(e){const t=e.getCell(o.dataField);if(t)return void t.autoWrap()}}const i=t._getParentCell(t.rowById[o.id],o.dataField);if(i&&("ArrowLeft"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowRight"===l?(o.id=i.row.id,o.dataField=i.endColumn.dataField):"ArrowUp"===l?(o.id=i.row.id,o.dataField=i.column.dataField):"ArrowDown"===l&&(o.id=i.endRow.id,o.dataField=i.column.dataField)),t._selection.selectionRect&&e.shiftKey&&!e.ctrlKey&&!e.metaKey?(t._selection.selectionRect.endRow&&(o.id=t._selection.selectionRect.endRow.id),t._selection.selectionRect.endColumn&&(o.dataField=t._selection.selectionRect.endColumn.dataField)):t.selection.allowRowSelection&&!t.selection.allowCellSelection&&void 0!==t._rangeSelectionEndRow&&(o.id=t._rangeSelectionEndRow.id),t._clipboardHandler(l,e),((e.ctrlKey||e.metaKey)&&"x"!==l&&"c"!==l&&"v"!==l&&"Control"!==l||"Tab"===l)&&(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[]),"Escape"===l)return t.closeMenu(),t.cancelEdit(),void t._setSelection(o.id,o.dataField,e);if(t.hasMenu())return;if(e.shiftKey&&"Enter"===l&&t.rowDetail.dialog.enabled&&!t.rowDetail.dialog.visible){const l=t.rowById[o.id];if(l)return l.showDetail=!0,e.preventDefault(),void e.stopPropagation()}if(e.ctrlKey||e.metaKey){let n=!1;"f"===l&&(t.$.headerBar&&t.$.headerBar.openSearchPanel(),n=!0),"s"===l&&(t.$.headerBar&&t.$.headerBar.openSortPanel(),n=!0),"d"===l&&(t.$.headerBar&&t.$.headerBar._openDownloadMenu(),n=!0),"u"===l&&(t.$.headerBar&&t.$.headerBar.openFilterPanel(),n=!0),"w"===l&&(t.$.headerBar&&t.$.headerBar._openViewsMenu(),n=!0),n&&(e.stopPropagation(),e.preventDefault())}if(e.altKey){if("ArrowDown"===l){const l=t.columnByDataField[o.dataField];l&&t.hasColumnMenu(l)&&(l.element._showActionButton(),l.onAction(),t.menu&&t.menu.querySelector("smart-menu").$.dispatch(e))}else"ArrowUp"===l&&t.closeMenu();if("s"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.sorted?"asc"===e.sortOrder?t.sortBy(e.dataField,"desc"):t.sortBy(e.dataField,null):t.sortBy(e.dataField,"asc"))}if("g"===l.toLowerCase()){const e=t.columnByDataField[o.dataField];e&&(e.group=!e.group)}return}const a=function(l,n){const o=(l,n)=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(!0),"many"===t.selection.mode){if(" "===e.key)t._setSelection(l,n,e);else{const e=t.rowById[l].getCell(n);t._selection.focusedCell={id:e.row.id,value:e.value,dataField:n,index:e.row.index}}return t.ensureVisible(l,n),void t._recycle()}t.beginUpdate(),t._setSelection(l,n,e),t.ensureVisible(l,n),t.endUpdate(!1,!1),"ArrowDown"===e.key||"ArrowUp"===e.key?t._recycle(!1,!0):t._recycle(),e.shiftKey?t.__selectionStarted&&!t.__selectionStartedFired?(t.$.fireEvent("change",{started:!0,finished:!1}),t.__selectionStartedFired=!0):t.$.fireEvent("change",{started:!1,finished:!1}):(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())};if(t._isVirtualMode()){t._keyboardNavigationTimer&&clearTimeout(t._keyboardNavigationTimer);const e=e=>{for(let l=0;l<t.rows.length;l++){const n=t.rows[l];if(n.index===e)return n.id}return null},i=l,a=JSON.parse(JSON.stringify(t._selection.focusedCell));t._selection.focusedCell.index=i,t._selection.focusedCell.dataField=n;const s=t.rows[0],r=s.height;if(-1===i)return;const d=t._scrollView.hScrollBar,c="virtual"!==t.scrolling?s.top:i*r;let u=0;if(t.paging.enabled||(c+d.offsetHeight+t.__frozenNearHeight>t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight?(t._scrollView.scrollTop=c-t.$.scrollView.offsetHeight-t.__frozenFarHeight+d.offsetHeight,u=50):c<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=c,u=50)),t._onDataUpdated||(t._onDataUpdated=()=>{t._recycle();const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t.paging.enabled&&(t._selection.focusedCell=a),t._onDataUpdated=null}),t.paging.enabled){const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t._selection.focusedCell=a}else t._keyboardNavigationTimer=setTimeout((()=>{const l=e(t._selection.focusedCell.index);t.rowById[l]&&o(l,t._selection.focusedCell.dataField)}),u)}else requestAnimationFrame((()=>{o(l,n)})),e.stopPropagation(),e.preventDefault()};switch(l){case"Tab":{if("none"===t.selection.tabKeyBehavior)return;const l=e.shiftKey?t.prevColumn(o.dataField):t.nextColumn(o.dataField);if(l&&t.selection.allowCellSelection){const n=t.rowById[o.id].getCell(l.dataField);t._selection.focusedCell={id:n.row.id,value:n.value,dataField:l.dataField,index:n.row.index},t._setSelection(o.id,l.dataField,e),t.ensureVisible(o.id,l.dataField),t.focus(),e.stopPropagation(),e.preventDefault()}else{let l=e.shiftKey?t.prevRow(o.id):t.nextRow(o.id),n=e.shiftKey?t.lastColumn().dataField:t.firstColumn().dataField;if(t.editing.addNewRow.autoCreate&&!e.shiftKey&&o.id===t.lastRow().id&&(t.addUnboundRow(1),l=t.lastRow()),!l)return;e.shiftKey&&(t._selection.focusedCell=null),a(t._isVirtualMode()?l.index:l.id,n)}break}case" ":case"F2":{const n=t.rowById[o.id];if(!n||t.editing.editCell)return;if(e.ctrlKey||e.metaKey)return;if(" "===l&&t.dataSource.boundHierarchy&&(n.checked=!n.checked),t.editing.enabled&&!e.shiftKey){const e=t.getSelectedCells();let i=!1;if(e.length>0){let l=[];for(let n=0;n<e.length;n++){const o=e[n],i=o[1],a=t.columnByDataField[i];!a||"bool"!==a.dataType&&"boolean"!==a.dataType||l.push(o)}if(l.length>0){i=!0,t.beginUpdate();for(let e=0;e<l.length;e++){const n=l[e],o=n[1],i=n[0],a=n[2];t.setCellValue(i,o,!a)}t.endUpdate(!1)}}i||(t._beginEdit(n,o.dataField),setTimeout((function(){if(t.editing.editCell&&t.editing.editCell.column.dataType.indexOf("bool")>=0){const e=t.editing.editCell.editor.instance,n=e.getValue();" "===l&&e.setValue(!n)}}),50))}else t.selection.enabled&&"many"===t.selection.mode&&(t._isVirtualMode()?a(o.index,o.dataField):a(o.id,o.dataField));break}case"Delete":case"Backspace":{const e=t.rowById[o.id];if(!e||t.editing.editCell)return;if(t.editing.enabled){const i=e.getCell(o.dataField),a=i.value;if(n.cells){t.beginUpdate();for(let e=0;e<n.cells.length;e++){const l=n.cells[e],o=t.rowById[l.id];if(o){const e=o.getCell(l.dataField);if(!e.column.allowEdit)continue;const n=t._pasteDataType({cell:e,value:e.value});let i=null;"int"!==n&&"number"!==n||(i=0),"string"===n&&(i=""),"boolean"!==n&&"bool"!==n||(i=!1),"date"===n&&(i=new Date),e.column.allowNull&&(i=null);const a=e.value;if(t.dataSource&&t.dataSource.virtualDataSource){const l={};l[e.column.dataField]=i,t.updateRow(e.row.id,l)}else if(t._setCellUndoRedo(e,a,i),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]);const n=i;t._pasteTempValues.push({id:e.row.id,cell:e,dataField:l.column.dataField,oldValue:a,newValue:n}),t._pasteTimer&&clearTimeout(t._pasteTimer),t._pasteTimer=setTimeout((()=>{const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1)}}),t)}else t.onCellUpdate([e],[a],[n],(function(t){t&&(l(e,n),e.value=n)}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else e.value=i}}t.endUpdate(!1),t._recycle(),t._refreshDataFilters()}"Backspace"===l&&(t._beginEdit(e,o.dataField),i.canNotify=!1,i.value=a,i.canNotify=!0)}break}default:if(t.editing.enabled&&!t.editing.editCell&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!t.editing.editRow){const e=t.rowById[o.id];if(!e)return;if(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)>=0)return;t._beginEdit(e,o.dataField),setTimeout((function(){if(t.editing.editCell)t.editing.editCell.editor.instance.setValue(l);else if(t.editing.editRow){const e=t.editing.editRow.getCell(o.dataField);if(!e)return;e.editor.instance.setValue(l)}}),50)}break;case"Home":{const l=t.firstRow();if(t.paging.enabled&&e.shiftKey)return t.firstPage(),e.stopPropagation(),void e.preventDefault();if(!l)return;a(l.id,o.dataField);break}case"End":{if(t.paging.enabled&&e.shiftKey)return t.lastPage(),e.stopPropagation(),void e.preventDefault();const l=t.lastRow();if(!l)return;a(l.id,o.dataField);break}case"PageUp":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.prevPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.max(o.index-e,0),o.dataField)}else{for(let e=i;e>=0;e--){const i=l[e];if(n.top-i.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.firstRow().id,o.dataField)}break}case"PageDown":{const l=t._recyclingRows,n=t.rowById[o.id],i=l.indexOf(n);if(t.paging.enabled&&e.shiftKey)return t.nextPage(),e.stopPropagation(),void e.preventDefault();if(t._isVirtualMode()){const e=Math.round(t.$.scrollView.offsetHeight/t.rows[0].height);a(Math.min(o.index+e,t.dataSource.virtualDataSourceLength-1),o.dataField)}else{for(let e=i;e<l.length;e++){const i=l[e];if(i.top-n.top>=t.$.scrollView.offsetHeight)return void a(i.id,o.dataField)}a(t.lastRow().id,o.dataField)}break}case"ArrowDown":case"Enter":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():o.index+1,o.dataField);else{let n=e.ctrlKey||e.metaKey?t.lastRow():t.nextRow(o.id);if(!t.editing.addNewRow.autoCreate||"Enter"!==l||o.id!==t.lastRow().id||e.ctrlKey||e.metaKey||(t.addUnboundRow(1),n=t.lastRow()),!n)return;let i=!0;"Enter"===l&&(e.ctrlKey||e.metaKey)&&(i=!1),i&&a(n.id,o.dataField)}break;case"ArrowUp":if(t._isVirtualMode())a(e.ctrlKey||e.metaKey?t.lastRow():Math.max(0,o.index-1),o.dataField);else{const l=e.ctrlKey||e.metaKey?t.firstRow():t.prevRow(o.id);if(!l)return;a(l.id,o.dataField)}break;case"ArrowRight":{const l=t.rowById[o.id],n=t.columnByDataField[o.dataField]._treeColumn;if((!t.selection.allowCellSelection||n)&&!1===l.leaf){if(!l.expanded)return l.expand(),e.stopPropagation(),void e.preventDefault();{const e=t.nextRow(o.id);if(e)return void a(e.id,o.dataField)}}const i=e.ctrlKey||e.metaKey?t.lastColumn():t.nextColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}case"ArrowLeft":{const l=t.rowById[o.id],n=t.columnByDataField[o.dataField]._treeColumn;if(!t.selection.allowCellSelection||n){if(!1===l.leaf)return void(l.expanded?(l.collapse(),e.stopPropagation(),e.preventDefault()):l.parent&&a(l.parent.id,o.dataField));if(!0===l.leaf&&l.parent)return void a(l.parent.id,o.dataField)}const i=e.ctrlKey||e.metaKey?t.firstColumn():t.prevColumn(o.dataField);if(!i)return;a(t._isVirtualMode()?o.index:o.id,i.dataField);break}}["Shift","Up","Down","Left","Right","Control","F2","Esc"," ","Home","End","PageUp","PageDown"].indexOf(l)<0||(e.stopPropagation(),e.preventDefault())}_keyUpHandler(e){const t=this;"Escape"===e.key&&t._dragDrop&&t._endDrag(e),t._focused&&"Shift"===e.key&&(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())}firstRow(){const e=this._recyclingRows;if(this._isVirtualMode())return{id:0};if(e&&e.length>0){if(!e[0].autoGenerated&&e[0].allowSelect)return e[0];for(let t=0;t<e.length;t++)if(!e[t].autoGenerated&&e[t].allowSelect)return e[t]}return null}lastRow(){const e=this,t=e._recyclingRows;if(e._isVirtualMode())return{id:e.dataSource.virtualDataSourceLength-1};if(t&&t.length>0){const e=t[t.length-1];if(!e.autoGenerated&&e.allowSelect)return e;for(let e=t.length-1;e>=0;e--)if(!t[e].autoGenerated&&t[e].allowSelect)return t[e]}return null}nextRow(e){const t=this._recyclingRows,l=this.rowById[e],n=t.indexOf(l);let o=1;if(l&&void 0!==l._rowSpan&&(o=l._rowSpan),n>=0&&t[n+o]&&!t[n+o].autoGenerated){const e=t[n+o];if(e.allowSelect&&!e.disabled)return e;for(let e=n+o;e<t.length;e++){const l=t[e];if(l.allowSelect&&!l.disabled)return l}}return null}_isVirtualMode(){const e=this;return e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling}prevRow(e){const t=this,l=t._recyclingRows,n=t.rowById[e],o=l.indexOf(n);if(t._isVirtualMode())return 0===e?null:{id:n.index-1};if(o>=0&&l[o-1]&&!l[o-1].autoGenerated){const e=l[o-1];if(e.allowSelect&&!e.disabled)return e;for(let e=o-1;e>=0;e--){const t=l[e];if(t.allowSelect&&!t.disabled)return t}}return null}firstColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=0;t<e.length;t++){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}lastColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=e.length-1;t>=0;t--){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}nextColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n<t.length;){const e=t[n+1];if(e.autoGenerated)return null;if(e.visible)return e;n++}return null}prevColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n>0;){const e=t[n-1];if(e.autoGenerated)return null;if(e.visible)return e;n--}return null}isVisible(e,t){const l=this,n=l._scrollView.vScrollBar,o=l._scrollView.hScrollBar,i=l.rowById[e],a=l.columnByDataField[t];return{row:function(e){if(!e)return!1;const t=e.visibleIndex;if(-1===t)return!1;const n=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&l.dataSource.length>l.virtualModeCachedRowsCount&&"infinite"!==l.scrolling;let i=e.top;return n&&(i=t*l.rows[0].height),!(i+e.height+o.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight||i<=l._scrollView.scrollTop)}(i),column:function(e){return!!t&&!(-1===e.visibleIndex||e.left+e.computedWidth+n.offsetWidth>=l._scrollView.scrollLeft+l._clientSize.width||e.left<=l._scrollView.scrollLeft)}(a)}}_ensureRowVisible(e){const t=this;if(!t._scrollView)return;const l=t._scrollView.hScrollBar;if(!e)return;const n=e.visibleIndex;if(-1===n)return;const o="virtual"!==t.scrolling?e.top:n*t.rows[0].height,i=t.summaryRow.visible?t.layout.rowMinHeight:0;if(o+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight-i&&(t._scrollView.scrollTop=o+e.height-t.$.scrollView.offsetHeight+t.__frozenNearHeight+t.__frozenFarHeight+l.offsetHeight+i),o<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=o),t.paging.enabled){const o=t.paging.pageSize,i=Math.floor(n/o);if(t.paging.pageIndex!==i)return t.goToPage(i),t._scrollView.scrollTop=0,void setTimeout((()=>{e.top+e.height+l.offsetHeight+t.__frozenNearHeight>=t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight&&(t._scrollView.scrollTop=e.top+e.height),e.top<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=e.top)}),50)}0===n?t._scrollView.scrollTop=0:n===t.dataSource.length-1&&(t._scrollView.scrollTop=t._scrollView.scrollHeight)}_ensureColumnVisible(e){const t=this,l=t._scrollView.vScrollBar;if(!e)return;const n=e.visibleIndex;-1!==n&&(e.left+e.computedWidth+l.offsetWidth>=t._scrollView.scrollLeft+t._clientSize.width&&(t._scrollView.scrollLeft=t._scrollView.scrollLeft+e.computedWidth),e.left<=t._scrollView.scrollLeft&&(t._scrollView.scrollLeft=e.left),0===n?t._scrollView.scrollLeft=0:n===t.columns.length-1&&(t._scrollView.scrollLeft=t._scrollView.scrollWidth))}ensureVisible(e,t){const l=this,n=l.rowById[e],o=l.columnByDataField[t];if("virtual"===l.scrolling){const e=l._scrollView.hScrollBar,t=n.visibleIndex*l.rows[0].height,i=l.summaryRow.visible?l.layout.rowMinHeight:0;return t+n.height+e.offsetHeight+l.__frozenNearHeight>=l._scrollView.scrollTop+l.$.scrollView.offsetHeight-l.__frozenFarHeight-i&&l.setVerticalScrollValue(t),void l._ensureColumnVisible(o)}l._ensureRowVisible(n),l._ensureColumnVisible(o)}clearSelection(){const e=this;delete e._rangeSelectionStartRow,delete e._rangeSelectionEndRow,e._clearSelection(!0),e.$.fireEvent("change",{started:!1,finished:!0}),e._refreshSummary()}});
|
|
59
|
+
(()=>{Smart.Utilities.Assign("Grid.Edit",class{_renderCommandBar(){const e=this,t=e.editing.commandBar.dataSource,i="icon"!==e.editing.commandBar.displayMode,n="label"!==e.editing.commandBar.displayMode,o=o=>{for(let l in t){const a=t[l],d=document.createElement("div");d.classList.add("smart-grid-command-item"),d.label=e.localize(l);const r=d.label;let s="";n&&i?(s+='<span class="smart-grid-icon '+a.icon+'"></span>',s+='<span class="smart-grid-label">'+r+"</span>"):n&&!i?s+='<span title="'+r+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(s+='<span class="smart-grid-label">'+r+"</span>"),d.innerHTML=s,a.visible||d.classList.add("smart-hidden"),d.command=a.command,d.onclick=function(){const t=d.command;e._applyCommand(t,[])},o.appendChild(d)}};e.editing.enabled&&e.editing.commandBar.visible&&(e.$.headerCommandBar.innerHTML="",e.$.footerCommandBar.innerHTML="","far"!==e.editing.commandBar.position&&o(e.$.headerCommandBar),"near"!==e.editing.commandBar.position&&o(e.$.footerCommandBar))}commandKeyEditCommand(){const e=this;if(e._selection&&e._selection.focusedCell&&void 0!==e._selection.focusedCell.id){const t=e.rowById[e._selection.focusedCell.id];e.beginEdit(t.id)}}commandKeyCancelCommand(){this.cancelEdit()}commandKeyUpdateCommand(){this.endEdit()}commandColumnMenuCommand(){this._openColumnChooserMenu(this._commandColumn)}commandColumnEditCommand(e){this.beginEdit(e.id)}commandColumnUpdateCommand(){this.endEdit()}commandColumnRowMenuCommand(){}commandColumnCancelCommand(e){const t=this;if(t.editing.batch){const i=t._rowsDeleted?t._rowsDeleted.indexOf(e):-1;i>=0&&t._rowsDeleted.splice(i,1);for(let i=0;i<t.columns.length;i++){const n=t.columns[i].dataField;t._cellsUpdatedValues&&t._cellsUpdatedValues[e.id+"_"+n]&&(delete t._cellsUpdatedValues[e.id+"_"+n],t._cellsUpdatedValues.length--)}t._recycle(!1)}t.cancelEdit()}commandColumnDeleteCommand(e){this.deleteRow(e.id)}_renderAddNewRow(){const e=this;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[];const t=new Smart.Grid.Row({data:{},index:-1,grid:e,freeze:"near",visible:"far"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0}),i=new Smart.Grid.Row({data:{},index:-2,grid:e,freeze:"far",visible:"near"!==e.editing.addNewRow.position,autoGenerated:!0,addNewRow:!0});if(e._newNearRow){const t=e._frozenNearRows.indexOf(e._newNearRow);if(t>=0&&(e._frozenNearRows.splice(t,1),e.$.rowNearContainer.children.length>0)){const t=e.$.rowNearContainer.children[0];t.parentNode.removeChild(t)}}if(e._newFarRow){const t=e._frozenFarRows.indexOf(e._newFarRow);if(t>=0&&(e._frozenFarRows.splice(t,1),e.$.rowFarContainer.children.length>0)){const t=e.$.rowFarContainer.children[e.$.rowFarContainer.children.length-1];t.parentNode.removeChild(t)}}e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode&&(e._frozenNearDefaultRows.push(t),e._frozenFarDefaultRows.push(i),e._frozenNearRows.splice(0,0,t),e._frozenFarRows.push(i));const n=()=>{e.editing.addNewRow.autoCreate&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e.addUnboundRow(1),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max),"button"===e.editing.addNewRow.displayMode&&e._scrollView.vScrollBar.value===e._scrollView.vScrollBar.max&&(e._add({}),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max)};if(e._addRowOnButtonClickHandler||(e._addRowOnButtonClickHandler=n),e._scrollView&&e._scrollView.vScrollBar&&(e._scrollView.vScrollBar.$.farButton.removeEventListener("click",e._addRowOnButtonClickHandler),e._scrollView.vScrollBar.$.farButton.addEventListener("click",e._addRowOnButtonClickHandler)),e._newNearRow=t,e._newFarRow=i,e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){if(!e._newNearRow.element){const t=e._newNearRow,i=t.createElement();t.visible="far"!==e.editing.addNewRow.position,t.element=i,e.$.rowNearContainer.children.length>0?e.$.rowNearContainer.insertBefore(i,e.$.rowNearContainer.children[0]):e.$.rowNearContainer.appendChild(i)}if(!e._newFarRow.element){const t=e._newFarRow,i=t.createElement();t.visible="near"!==e.editing.addNewRow.position,t.element=i,e.$.rowFarContainer.children.length>0?e.$.rowFarContainer.insertBefore(i,e.$.rowFarContainer.children[0]):e.$.rowFarContainer.appendChild(i)}}}_insertNewRowAfter(e){return this._insertNewRowBefore(e,!0)}_insertNewRowBefore(e,t=!1){const i=this,n=new Smart.Grid.Row({index:t?0:-1,id:Smart.Utilities.Core.createGUID(),grid:i}),o={};for(let e=0;e<i.columns.length;e++){const t=i.columns[e];void 0!==t.defaultValue&&(o[t.dataField]=t.defaultValue)}n.data=o;const l=function(t,n){i._suppressSort=i._suppressFilter=!0;const o=e=>{i._supressEnter=!0,i.scrollTop=n?i.scrollHeight:0,i.editing.addDialog.enabled||setTimeout((function(){if(i.editing.enabled&&i.editing.addNewRow.autoEdit){i.ensureVisible(e.id);let t=null;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=()=>{i._selection.focusedCell={id:e.id,dataField:t,index:e.index},i._selection.rows=[],i._selection.columns=[],i._selection.cells=[],i._setSelection(e.id,t)};i.paging.enabled?setTimeout((()=>{if(!e.element){const t=e.createElement();e.element=t}n(),i._beginEdit(e)}),200):(n(),i._beginEdit(e))}}),100),i._suppressSort=i._suppressFilter=!1};!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("add")>=0?(i._batchAddRow(t,n?i.rows.length:0),o(t),e&&e(t)):i.addRow(t.data,n,(t=>{o(t),e&&e(t)}))}.bind(this);return i.editing.addDialog.enabled?i._openAddRowDialog(n,l):l(n,t),!0}commandBarBatchSaveCommand(){this._saveBatchEdit()}commandBarAddRowCommand(){this._insertNewRowAfter()}commandBarAddTopRowCommand(){this._insertNewRowBefore()}commandBarDeleteRowCommand(){const e=this;let t=1,i=e.rows[e.rows.length-t];for(e._rowsDeleted||(e._rowsDeleted=[]);e._rowsDeleted.indexOf(e.rows[e.rows.length-t])>=0;)t++;if(i=e.rows[e.rows.length-t],e.selection.enabled)if(e.selection.allowCellSelection){const t=e.getSelectedCells();if(t.length>0){const n=t[0][0];i=e.rowById[n]}}else{const t=e.getSelectedRowIds();t.length>0&&(i=e.rowById[t[0]])}i&&e.commandColumnDeleteCommand(i)}commandBarBatchRevertCommand(){this.revertBatchEdit()}_beginEdit(e,t){const i=this;if(!t)if(i.columns[0]&&i.columns[0].allowEdit&&i.columns[0].visible)t=i.columns[0].dataField;else for(let e=0;e<i.columns.length;e++)if(i.columns[e].allowEdit&&i.columns[e].visible){t=i.columns[e].dataField;break}const n=i.columnByDataField[t];if(i.editing.allowColumnHeaderEdit&&!e&&n)return void i._beginColumnEdit(n);if(!e||!n||n&&n.autoGenerated)return!1;const o=e.getCell(t);if(!o)return!1;i.$.fireEvent("beginEdit",{id:e.id,dataField:n.dataField,row:e,column:n,cell:o,data:o.row.data,value:o.value}).defaultPrevented||("cell"===i.editing.mode?i._beginCellEdit(o):"row"===i.editing.mode&&i._beginRowEdit(e,o))}_saveUnboundRows(e){const t=this;if(t._unboundRows&&t._unboundRows.length>0&&t.editing.addNewRow.autoSave){const i=t.rowById[e];if(!i.unbound)return;const n=t._unboundRows.indexOf(i);if(n<0)return;const o=n+1;t.beginUpdate();for(let e=0;e<o;e++){const i=t._unboundRows[e];if(!i)continue;delete t.rowById[i.id],i.unbound=!1;let n=!1;t._selection.focusedCell&&t._selection.focusedCell.id===i.id&&(n=!0),t._nearRowsAdded&&t._nearRowsAdded.indexOf(i)>=0?(t._nearRowsAdded.splice(t._nearRowsAdded.indexOf(i),1),t._add(0,i.data),n&&(t._selection.focusedCell.id=t.rows[0].id,t._selection.focusedCell.index=t.rows[0].index)):t._farRowsAdded&&t._farRowsAdded.indexOf(i)>=0&&(t._farRowsAdded.splice(t._farRowsAdded.indexOf(i),1),t._add(i.data),n&&(t._selection.focusedCell.id=t.rows[t.rows.length-1].id,t._selection.focusedCell.id=t.rows[t.rows.length-1].index))}t._unboundRows.splice(0,o),t.endUpdate()}}_validateCell(e,t,n){const o=this;if(o._errorOverlay&&(o._errorOverlay.remove(),o._errorMessage.remove(),o._isUpdating=!1),e.column.validationRules||n||e.column.editor&&e.column.editor.onValidate){let l={},a=e._updating;if(e._updating=!0,e.error="",n){for(let i in n)n[i]&&"valid"!==i&&(e.error=n.message),"custom"===i&&n[i].minLength?e.error=o.localize("invalidCellValue",{value:t,validationRule:"minLength: "+n[i].value}):"custom"===i&&n[i].maxLength&&(e.error=o.localize("invalidCellValue",{value:t,validationRule:"maxLength: "+n[i].value}));e.error&&(o._isUpdating=!0)}for(let n of e.column.validationRules){switch(n.type){case"min":l.min=i.min(t,n.value);break;case"max":l.max=i.max(t,n.value);break;case"minLength":l.minLength=i.minLength(t,n.value);break;case"maxLength":l.maxLength=i.maxLength(t,n.value);break;case"minDate":l.minDate=i.minDate(t,n.value);break;case"maxDate":l.maxDate=i.maxDate(t,n.value);break;case"required":l.required=i.required(t);break;case"requiredTrue":l.requiredTrue=i.requiredTrue(t);break;case"pattern":l.pattern=i.pattern(t,n.value);break;case"email":l.email=i.email(t);break;case"null":l.null=i.null(t)}l[n.type]&&(n.message?e.error=n.message:e.error=o.localize("invalidCellValue",{value:t,validationRule:void 0!==n.value?n.type+": "+n.value:n.type}),e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""),o.clearSelection())}if(e.column.editor&&e.column.editor.onValidate){const i=e.column.editor.onValidate(t,e.row.data);"string"==typeof i&&(e.error=i,e._updating=a,o._isUpdating=!0,e.element&&e.element.setAttribute("error",e.error),e.row.element.setAttribute("error",""),o.clearSelection())}if(e._updating=a,e.error){o._errorOverlay=o._createOverlay(),o._errorOverlay.onpointerdown=function(){o.endEdit()};const t=document.createElement("div");t.innerHTML=e.error,t.classList.add("smart-grid-validation-error");const i=o.offset(e.element),n=e.element.getBoundingClientRect(),l=o.offset(o);return i.left=i.left-l.left,i.top=i.top-l.top,i.top+n.height+5-o.offsetTop>o.offsetHeight?t.style.top=i.top-n.height-5-o.offsetTop+"px":t.style.top=i.top+n.height+5-o.offsetTop+"px",t.style.left=i.left-o.offsetLeft+"px",o._errorMessage=t,o.$.root.appendChild(o._errorOverlay),o.$.root.appendChild(o._errorMessage),!1}o._isUpdating=!1}return!0}_endCellEdit(e){const t=this,i=e||t.editing.editCell;if(!i||i&&!i.isEditing)return null;let n=t._getEditorValue(i),o=null;n&&n.error&&(i.canNotify=!1,i.element.setAttribute("error",""),i.row.element.setAttribute("error",""),i.error=!0,i.canNotify=!0,o=n.validity,n=n.value);const l=function(e,t){return"date"===i.column.dataType?e&&t?e.valueOf()===t.valueOf():!e&&!t:!("any"!==i.column.dataType||void 0===e||void 0===t||!Array.isArray(e)||0!==e.length||""!==t)||e===t},a=function(){const e=t._getEditorId(i);t._cellEditors[e].detach(),i.row.element.removeAttribute("edit"),i.element&&(i.element.removeAttribute("editor"),i.element.removeAttribute("error")),i.row.element.removeAttribute("error"),i.isEditing=!1,i.element&&(i.element.content.innerHTML="");const o=function(){t.editing.editRow||(t.dataSource&&t.dataSource.boundHierarchy?(t.dataSource.refreshHierarchy(),t._refreshRowHierarchy(),t.refresh()):t.layout.allowCellsWrap?t.refresh():t._recycle(!1))},a=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,d=void 0!==a?a:i.value,r=()=>{if(t._fireEndEdit){let e=i.value;if(t.editing.batch&&i.row&&i.column){const t=i.modifiedValue;void 0!==t&&(e=t)}t.$.fireEvent("endEdit",{id:i.row.id,dataField:i.column.dataField,row:i.row,column:i.column,cell:i,data:i.row.data,value:e}),t._fireEndEdit=!1}};if(l(n,d))r(),t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1,o());else{const e=function(){t.editing.editCell=null,t.editing.editRow||(t.editing.isEditing=!1),delete t._editInfo};if(!0===t.editing.batch||t.editing.batch&&t.editing.batch.indexOf("update")>=0)e(),t._batchUpdateCell(i.row,i.column,n,i.value),o(),r();else{const l=function(){e(),i._updating=!0,i.value=n,i._updating=!1,o(),r()};if(!t.editing.editRow&&t.dataSource&&t.dataSource.virtualDataSource){const e={};e[i.column.dataField]=n,t.updateRow(i.row.id,e,(()=>{l()}))}else l()}}return t.editing.commandColumn.visible&&!t.editing.commandColumn.width&&"cell"===t.editing.mode&&t.refresh(),t.focus(),!0};let d=t._validateCell(i,n,o);if(!d)return i.editor.instance&&!i.editor.autoOpen&&setTimeout((()=>{i.editor.instance.focus()}),50),!1;const r=t._cellsUpdatedValues?t._cellsUpdatedValues[i.row.id+"_"+i.column.dataField]:void 0,s=void 0!==r?r:i.value;if(l(n,s))return a(),!!d;if(t._setCellUndoRedo(i,s,n),t.onCellUpdate&&!t.editing.editRow){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e),t.onCellUpdate([i],[s],[n],(function(o){o?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onCellUpdated&&t.onCellUpdated([i.row.index],[i.row],[i.column],[i.row.data],[s],[n],t),t._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,s,n)}),t)}else if(t.onRowUpdate){t.beginUpdate(),t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility();const e=t._createOverlay();t.$.root.appendChild(e);const o=i.column.dataField,l=Object.assign({},i.row.data),d=Object.assign({},i.row.data);d[o]=n,t.onRowUpdate([i.row.index],[i.row],[l],[d],(function(n){n?a():t.cancelEdit(),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility(),e.parentNode.removeChild(e),t.endUpdate(),t.onRowUpdated&&t.onRowUpdated([i.row.index],[i.row],[i.row.data],t),t._onRowUpdated&&t._onRowUpdated(i.row.index,i.row,i.row.data)}),t)}else a();return!!d}_endRowEdit(){const e=this,t=e.editing.editRow;if(!t)return!1;let i=!0;const n=t.cells;let o={},l={};t.element.removeAttribute("error");for(let a=0;a<n.length;a++){const d=n[a];let r=e._getEditorValue(d),s=null;r&&r.error&&(d.canNotify=!1,d.element.setAttribute("error",""),d.row.element.setAttribute("error",""),d.error=!0,d.canNotify=!0,s=r.validity,r=r.value),o[d.column.dataField]=d.value,l[d.column.dataField]=r;if(!e._validateCell(d,r,s))return i=!1,t.element.setAttribute("error",""),e._isUpdating=!0,d.editor.instance&&setTimeout((()=>{d.editor.instance.focus()}),50),!1}if(i){const i=function(){const i=e._fireEndEdit;e._fireEndEdit=!1;for(let t=0;t<n.length;t++){const i=n[t];e._endCellEdit(i)}e._fireEndEdit=i,e.onRowUpdate||null===e.onRowUpdated||e.onRowUpdated([t.index],[t],[t.data],e),e.editing.isEditing=!1,e.editing.editRow=null,e.editing.commandColumn.visible&&!e.editing.commandColumn.width?e.refresh():e._recycle(!1)};if(!0===e.editing.batch||e.editing.batch&&e.editing.batch.indexOf("update")>=0)i();else if(e.onRowUpdate){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const n=e._createOverlay();e.$.root.appendChild(n);const a=e.onRowHistory;e.onRowHistory=null,t.updatedDate=new Date,t.updatedBy=e.currentUser,e.storeHistory&&e._updateRowHistory(t,o,l),setTimeout((()=>{e.onRowHistory=a}),100),e.onRowUpdate([t.index],[t],[o],[l],(function(o){const l=e.onRowUpdate,a=e.onCellUpdate;e.onRowUpdate=null,e.onCellUpdate=null,o?i():e.cancelEdit(),e.onRowUpdate=l,e.onCellUpdate=a,e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),n.parentNode.removeChild(n),e.endUpdate(),e.onRowUpdated&&e.onRowUpdated([t.index],[t],[t.data])}),e)}else if(e.dataSource&&e.dataSource.virtualDataSource&&e.editing.isEditing){e.beginUpdate(),e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility();const t=e._createOverlay();e.$.root.appendChild(t);let n=Object.assign({},e.editing.editRow.data);for(let t=0;t<e.editing.editRow.cells.length;t++){const i=e.editing.editRow.cells[t];if(!i.column.allowEdit)continue;const o=e._getEditorValue(i);void 0!==o&&(n[i.column.dataField]=o)}e._editInfo={row:n},e._virtualDataRequest("update",(function(n){n?i():e.cancelEdit(),e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),t.parentNode.removeChild(t),e.endUpdate()}))}else i();return!0}return e.focus(),!1}_batchDeleteRow(e){const t=this;t._rowsDeleted||(t._rowsDeleted=[]),t._rowsDeleted.push(e.id),t._recycle(!1)}_batchAddRow(e,t){const i=this;i._rowsAdded||(i._rowsAdded=[]),i._rowsAdded.push(e.id),i.rowById[e.id]=e,e.index=i.rows.length+(i._rowsAdded?i._rowsAdded.length:0),0===t?i._nearRowsAdded.splice(0,0,e):i._farRowsAdded.push(e);i.isInitialized&&i._rowElements&&i._rowElements.length<i.rows.length+i._rowsAdded.length&&i._initializeRowElements(),i.refresh()}_batchUpdateCell(e,t,i,n){const o=this;o._cellsUpdatedValues||(o._cellsUpdatedValues=[]);!function(e,i){return"date"===t.dataType?!(!e&&i)&&(!(e&&!i)&&e.valueOf()===i.valueOf()):e===i}(i,n)?o._cellsUpdatedValues[e.id+"_"+t.dataField]=i:delete o._cellsUpdatedValues[e.id+"_"+t.dataField],o._cellsUpdatedValues.length++}_saveBatchEdit(){const e=this;for(let t in e._cellsUpdatedValues){const i=e._cellsUpdatedValues[t],n=t.substring(0,t.indexOf("_")),o=t.substring(t.indexOf("_")+1),l=e.rowById[n],a=l.getCell(o);if(e.dataSource.virtualDataSource){const t={};t[a.column.dataField]=i,l.data.$&&l.data.$.id?e.updateRow(l.data.$.id,t):(a._updating=!0,a.value=i,a._updating=!1)}else a._updating=!0,a.value=i,a._updating=!1}const t=e._rowsDeleted&&e._rowsDeleted.length>0||e._rowsAdded&&e._rowsAdded.length>0;if(t&&e.beginUpdate(),e._rowsAdded&&e._rowsAdded.length>0)for(let t in e._rowsAdded){const i=e._rowsAdded[t],n=e.rowById[i];if(n){if(e._rowsDeleted&&e._rowsDeleted.length>0){let t=!1;for(let n=0;n<e._rowsDeleted.length;n++){if(e._rowsDeleted[n].id===i){t=!0;break}}if(t)continue}e.dataSource.virtualDataSource?e.addRow(n.data,!0):e._nearRowsAdded.indexOf(n)>=0?e.rows.splice(0,0,n):e._farRowsAdded.indexOf(n)>=0&&e.rows.push(n)}}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const i=e._rowsDeleted[t],n=e.rowById[i];if(n)if(e.dataSource&&e.dataSource.virtualDataSource)e._editInfo={row:n.data},e._virtualDataRequest("remove",(function(t){if(t){const t=e.rows.indexOf(n);e.rows.splice(t,1),delete e.rowById[n.id]}}));else{const t=e.rows.indexOf(n);e.rows.splice(t,1)}}t&&e.endUpdate(),e._clearBatchEdit(!1),e.$.fireEvent("saveBatchEdit")}_clearBatchEdit(){const e=this;let t=!1;e._rowsAdded&&e._rowsAdded.length>0&&(t=!0),e._cellsUpdatedValues=[],e._rowsAdded=[],e._rowsDeleted=[],e._nearRowsAdded=[],e._farRowsAdded=[],t?e.refresh():e._recycle(!1),e.$.fireEvent("clearBatchEdit")}_getEditorId(e){const t=e.column._editorId?e.column._editorId:"";return e.editor!==e.column.editor?e.editor.template+"_"+e.column.dataField+"_"+e.row.id+t:e.editor.template+"_"+e.column.dataField+t}_applyCommand(e,t){const i=this;t||(t=[]);const n=function(){"function"==typeof e?e.apply(i,t):i[e]?i[e].apply(i,t):Smart[e]?Smart[e].apply(i,t):window[e]&&window[e].apply(i,t)};if(i.onCommand){t||(t=[]),t[1]||(t[1]=null);const o={name:e,command:n,details:t[0],event:t[1],handled:!1};setTimeout((()=>{i.onCommand.apply(i,[o]),o.handled||n()}),200)}else n()}_getCommandColumnCommandsTemplate(){const e=this,t=e.editing.commandColumn.dataSource,i="icon"!==e.editing.commandColumn.displayMode,n="label"!==e.editing.commandColumn.displayMode;let o="";for(let l in t){const a=t[l];let d="<div",r=!1;if("commandColumnMenu"===l)continue;r||(d+=' item="'+l+'" command="'+a.command+'" class="smart-grid-command-item">',r=!0);const s="{{messages}}"===a.label?e.localize(l):a.label;n&&i?(d+='<span class="smart-grid-icon '+a.icon+'"></span>',d+='<span class="smart-grid-label">'+s+"</span>"):n&&!i?d+='<span title="'+s+'" class="smart-grid-icon '+a.icon+'"></span>':i&&!n&&(d+='<span class="smart-grid-label">'+s+"</span>"),d+="</div>",o+=d}return o}_updateCommandColumnCommandsVisibility(e,t){const i=this,n=e.children,o=i.editing.commandColumn.dataSource;for(let e=0;e<n.length;e++){const l=n[e],a=l.getAttribute("item"),d=o[a].visible;!0===d?l.classList.remove("smart-hidden"):!1===d?l.classList.add("smart-hidden"):"auto"===d&&(!i.editing.dialog.enabled&&(i.editing.editRow===t||i.editing.editCell&&i.editing.editCell.row===t)?"commandColumnEdit"===a?l.classList.add("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.remove("smart-hidden"):"commandColumnEdit"===a?l.classList.remove("smart-hidden"):"commandColumnUpdate"!==a&&"commandColumnCancel"!==a||n[e].classList.add("smart-hidden"))}}_handleEditKeyDown(e){const t=this,i=e.key,n=t.editing.commandKeys;if(!t.editing.dialog.enabled)for(let o in n){const l=n[o],a=l.key.replace(/ /gi,"").split("|");if(("Tab"!==i||!t.editing.editRow)&&a.indexOf(i)>=0){if(t._applyCommand(l.command),"Enter"===i&&e){if(e.stopPropagation(),t._supressEnter)return void delete t._supressEnter;t.selection.enabled&&t.selection.allowCellSelection&&t._keyDownHandler(e)}break}}}_getCustomCellEditor(e){const t=this;e.editor.selector=e.editor.template,e.editor.template="custom";const i=t._getEditorId(e);if(!t._cellEditors[i]){let n=document.createElement("div");t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){const t=e.editor.instance.element.firstElementChild;Smart.Utilities.Core.isMobile||(e.editor.focus?setTimeout((function(){e.editor.focus.apply(e.editor.instance.element,[])}),50):setTimeout((function(){t.focus()}),50))},a=function(t){const i=e.editor.instance.element.firstElementChild;e.editor.blur?e.editor.blur.apply(e.editor.instance.element,[t]):i.blur()},d=function(t){const i=e.editor.instance.element.firstElementChild;if(!e.editor.isInitialized&&e.editor.settings&&i)for(let t in e.editor.settings)i[t]=e.editor.settings[t];if(e.editor.setValue)e.editor.setValue.apply(e.editor.instance.element,[t]);else{if(i.innerHTML.indexOf("{{")>=0){const n=i.innerHTML.replace(/{{value}}/gi,t).replace(/{{id}}/gi,e.row.id);i.innerHTML=n}i.value=t,t instanceof Date&&(i.value=t.toISOString().split("T")[0]),e.editor.instance.element.value=i.value}},r=function(){const t=e.editor.instance.element.firstElementChild;if(e.editor.getValue){const i=t.querySelector("input");return i&&i.blur(),e.editor.getValue.apply(e.editor.instance.element,[t.value])}const i=t.value;return e.editor.settings&&e.editor.settings.valueProperty?i?Array.isArray(i)&&i.length>0?i[0][e.editor.settings.valueProperty]:i[e.editor.settings.valueProperty]:"":i||""},s=function(){n.removeEventListener("keydown",o),e.editor.detach&&e.editor.detach.apply(n,[])},c=function(){n.addEventListener("keydown",o),e.editor.attach&&e.editor.attach.apply(n,[])};let u=null;if((e.editor.selector.startsWith("#")||e.editor.selector.startsWith("."))&&(u=document.querySelector(e.editor.selector)),u)n.appendChild(u.content.cloneNode(!0).firstElementChild);else{const i=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e.editor.selector);if(i){if("#text"===i.nodeName)return t._getInputCellEditor(e);n.appendChild(i)}}t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getSliderCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=document.createElement("input"),l=document.createElement("div"),a=document.createElement("smart-number-input");if(o.type="range",o.step="0.01",t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(a.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);a.numberFormat=i}e.editor.min&&(o.min=a.min=e.editor.min),e.editor.max&&(o.max=a.max=e.editor.max),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-slider-cell-editor"),l.classList.add("nav"),a.classList.add("smart-flex"),a.style.paddingLeft="6px",l.classList.add("smart-icon-resize-full","smart-grid-icon");const d=function(e){if("keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey))return l.click(),void e.preventDefault()};l.onclick=function(){const i=document.createElement("div"),n=document.createElement("input");n.type="range";const d=e.editor.instance.element,r=document.createElement("div");r.classList.add("smart-slider-editor"),i.setAttribute("theme",t.theme),r.appendChild(n);const s=Smart.Utilities.Core.createGUID().replace(/-/gi,"");i.id="Slider"+s,d.setAttribute("aria-owns",i.id),r.classList.add("smart-grid-slider-container"),n.value=o.value,o.min&&(n.min=o.min),o.max&&(n.max=o.max),l.sliderEditorDialog=i,l.popupSlider=n,n.onchange=n.oninput=function(){a.value=parseFloat(n.value)};const c=e=>{e&&e.key&&("Enter"===e.key&&(i.parentNode.removeChild(i),o.value=parseFloat(n.value),t.endEdit()),"Escape"===e.key&&(i.parentNode.removeChild(i),t.cancelEdit()))};a.onchange=a.onkeyup=e=>{n.value=a.value,c(e)},n.onkeydown=function(e){c(e)},i.classList.add("smart-grid-slider-dialog"),i.appendChild(r),document.body.appendChild(i),i.style.top=t._offsetTop(d)+d.offsetHeight+"px",i.style.left=t._offsetLeft(d)+15+d.offsetWidth-i.offsetHeight+"px",i.style.width=d.offsetWidth+"px";const u=t._offsetLeft(t)+t.offsetWidth;t._offsetLeft(d)+i.offsetWidth>u&&(i.style.left=u-i.offsetWidth-10+"px")};let r=e.value;void 0===r&&(r=0),a.value=r,o.value=r,n.appendChild(a);const s=e=>{"Escape"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),t.cancelEdit()),"Enter"===e.key&&(l.sliderEditorDialog&&l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog),o.value=parseFloat(a.value),t.endEdit())};return t._cellEditors[i]={element:n,focus:function(){l.click(),Smart.Utilities.Core.isMobile||setTimeout((function(){a.focus(),t.$.scrollView.scrollTop=0}),50)},blur:function(){},setValue:function(e){o.value=void 0!==e&&""!==e?parseFloat(e):0,a.isReady&&a.setValue(e)},getValue:function(){const e=parseFloat(o.value);return l.sliderEditorDialog&&l.sliderEditorDialog.parentNode?(o.value=parseFloat(l.popupSlider.value),o.value):e},attach:function(){o.addEventListener("keydown",d),a.addEventListener("keydown",s)},detach:function(){o.removeEventListener("keydown",d),a.removeEventListener("keydown",s),l.sliderEditorDialog&&l.sliderEditorDialog.parentNode&&(o.value=l.popupSlider.value,l.sliderEditorDialog.parentNode.removeChild(l.sliderEditorDialog))}},t._cellEditors[i]}_getTextAreaCellEditor(e){const t=this,i=t._getEditorId(e),n=document.createElement("div"),o=document.createElement("textarea"),l=document.createElement("div");t._applyCellEditorUserSettings(n,e),o.style.direction="",t.rightToLeft&&(o.style.direction="rtl"),e.editor.min&&(o.minLength=e.editor.min),e.editor.max&&(o.maxLength=e.editor.max),o.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-text-area-cell-editor"),l.classList.add("nav"),l.classList.add("smart-icon-resize-full","smart-grid-icon");const a=function(e){if("keydown"===e.type&&(t._handleEditKeyDown(e),"Backspace"!==e.key&&"Delete"!==e.key&&"Tab"!==e.key&&"Escape"!==e.key&&!e.altKey&&!e.shiftKey))return l.click(),void e.preventDefault()};l.onclick=function(){const n=document.createElement("div"),a=document.createElement("textarea"),d=e.editor.instance.element,r=document.createElement("div"),s=document.createElement("smart-scroll-bar");n.id="TextArea"+i,d.setAttribute("aria-owns",n.id),t.rightToLeft&&(a.style.direction="rtl"),s.orientation="vertical",s.onpointerdown=e=>{e.preventDefault(),e.stopPropagation()},n.setAttribute("theme",t.theme),r.appendChild(a),r.classList.add("smart-grid-text-area-container"),r.appendChild(s),a.value=o.value,a.classList.add("smart-input"),o.minLength>=0&&(a.minLength=o.minLength),o.maxLength>=0&&(a.maxLength=o.maxLength),l.textAreaEditorDialog=n,l.popupTextArea=a;const c=function(){s.value=a.scrollTop,s.max=a.scrollHeight-a.offsetHeight,s.onChange=null,a.offsetHeight>=a.scrollHeight?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),s.onChange=function(){a.scrollTop=s.value}};if(a.onkeyup=function(){c()},a.onscroll=function(){c()},a.onkeydown=function(e){if(a._key=e.key,"Escape"===e.key){try{n.parentNode.contains(n)&&n.parentNode.removeChild(n)}catch(e){n.error=e}t.editing.editCell&&t.cancelEdit()}("Tab"===e.key||"Enter"===e.key&&e.shiftKey)&&(o.value=a.value,t.editing.editCell?t.endEdit():a.blur(),e.preventDefault(),e.stopPropagation())},n.classList.add("smart-grid-text-area-dialog"),n.appendChild(r),document.body.appendChild(n),setTimeout((function(){Smart.Utilities.Core.isMobile||a.select(),c()}),50),c(),n.style.top=t._offsetTop(d)+"px",n.style.left=t._offsetLeft(d)+"px",n.style.width=d.offsetWidth+"px",t.grouping.enabled&&e.column._treeColumn){const e=d.parentNode.parentNode;n.style.top=t._offsetTop(e)+"px",n.style.left=t._offsetLeft(e)+"px",n.style.width=e.offsetWidth+"px"}a.onblur=()=>{"Escape"!==a._key&&(o.value=l.popupTextArea.value),o.focus();try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}},n.appendChild(o);return t._cellEditors[i]={element:n,focus:function(){l.click()},blur:function(){},setValue:function(e){o.value=e,l.popupTextArea&&(l.popupTextArea.value=o.value)},getValue:function(){const e=o.value;return l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode?(o.value=l.popupTextArea.value,o.value):e},attach:function(){o.addEventListener("keydown",a)},detach:function(){if(o.removeEventListener("keydown",a),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode){o.value=l.popupTextArea.value;try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}}},t._cellEditors[i]}_getColorInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=t._getColorInput();t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-color-input-cell-editor"),n.dropDownWidth=50,n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.rightToLeft=!0);const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(e){n.value=e},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("input");t._applyCellEditorUserSettings(n,e),e.editor.min&&(n.minLength=e.editor.min),e.editor.max&&(n.maxLength=e.editor.max),n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-input-cell-editor"),n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.style.direction="rtl");const o=function(i){if("keydown"===i.type)return"number"!==e.column.dataType&&"int"!==e.column.dataType&&"float"!==e.column.dataType||t.editing.editColumn||i.key.match(/[0-9]/)||"-"===i.key||1!==i.key.length?void t._handleEditKeyDown(i):(i.preventDefault(),void i.stopPropagation())},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(t){if(!e.column.rowHeaderColumn||t){if("number"===e.column.dataType||"int"===e.column.dataType||"float"===e.column.dataType){if(""===t)return;if(t&&!t.toString().match(/[0-9]/)&&"-"!==t)return}n.value=t}else n.value=e.editor.row.visibleIndex+1},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_applyCellEditorUserSettings(e,t){for(let i in t.editor)"template"!==i&&("list"!==i?"onInit"!==i&&"onRender"!==i&&(e[i]=t.editor[i]):e.setAttribute(i,t.editor[i]));if(t.editor.settings)for(let i in t.editor.settings)e[i]=t.editor.settings[i]}_getCheckInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-check-input")}_getMultiInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-multi-input")}_getMultiComboInputCellEditor(e){const t=this._getAutoCompleteCellEditor(e,"smart-multi-combo-input");return"tags"===e.column.template&&(t.getValue=()=>{const e=t.element.selectedItems;if(e&&0===e.length)return"";let i=[];for(let t=0;t<e.length;t++){const n=e[t];"string"==typeof n?i.push(n):i.push(n.value)}return i.toString()},t.setValue=e=>{if(e&&e.indexOf("{")>=0||e&&e.indexOf("[")>=0)t.element.selectedItems=JSON.parse(e);else if(e&&e.indexOf(",")>=0)if(e=e.split(",").map((e=>e.trim())),t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{for(let n=0;n<e.length;n++){const o=e[n];("string"==typeof t&&""+t===o||t&&void 0!==t.label&&""+t.value===o)&&i.push(t)}})),t.element.selectedItems=i}else t.element.selectedItems=e;else if(t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{("string"==typeof t&&""+t===e||t&&void 0!==t.label&&""+t.value===e)&&i.push(t)})),t.element.selectedItems=i}else t.element.value=e},t.focus=function(){if(Smart.Utilities.Core.isMobile)return;const e=t.element;setTimeout((()=>{t.element.readonly?t.element.focus():e&&e.select&&e.select()}),50)}),t}_getAutoCompleteCellEditor(e,t){const i=this,n=i._getEditorId(e);if(i._cellEditors[n]&&e.column.editor.isDirty&&(delete e.column.editor.isDirty,delete i._cellEditors[n]),!i._cellEditors[n]){let o=document.createElement("smart-input");t&&(o=document.createElement(t)),i._applyCellEditorUserSettings(o,e),o.readonly&&(o.dropDownButtonPosition="right");const l=function(e){o.opened||"keydown"!==e.type||i._handleEditKeyDown(e)};o.rightToLeft=i.rightToLeft,o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-auto-complete-cell-editor");const a=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{o&&o.select&&o.select()}),50)},d=function(e){e&&1===e.length&&o.readonly||(o.value=null!==e?e:"")},r=function(){return o.value},s=function(){o&&o.close&&(o.value="",o.close(),o.removeEventListener("keydown",l))},c=function(){},u=function(){o.addEventListener("keydown",l)};i._cellEditors[n]={element:o,focus:a,blur:c,setValue:d,getValue:r,attach:u,detach:s}}if(!e.editor.dataSource&&!e.editor.isInitialized){const t=i.getVisibleRows(),o=[];for(let n=0;n<t.length;n++){let l=i.dataSource[t[n].index];if(l){if(l=l[e.column.dataField],!l)continue;-1===o.indexOf(l)&&o.push(l)}}i._cellEditors[n].element.dataSource=o}return i._cellEditors[n]}_getDateRangeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-range-input");n.dropDownButtonPosition="right",n.dropDownAppendTo="body",n.autoClose=!0,n.selectionMode="default",n.rightToLeft=t.rightToLeft,n.timepicker=!0,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},d=function(){return n._performSelect(),n.selectedDates},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getDateTimePickerCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-time-picker");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,e.column.cellsFormat&&(n.formatString=e.column.cellsFormat),t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(n.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){if("string"==typeof e&&1===e.length){if("string"==typeof e&&n.autoOpen&&"Invalid Date"===(e=new Date(e)).toString())return;n.$.input.value=e}else n.value=e},d=function(){return n.value&&n.value instanceof Smart.Utilities.DateTime?(n._validateValue(n.$.input.value),n.value.toDate()):n.value},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getTimeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-time-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},d=function(){const e=new Date;return e.setHours(n.value[0]),e.setMinutes(n.value[1]),"Invalid Date"===e.toString()?new Date:e},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getDateInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-input");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,n.formatString=(!e.column.cellsFormat||1!==e.column.cellsFormat.length&&"d"!==e.column.cellsFormat)&&e.column.cellsFormat?e.column.cellsFormat:"MM/dd/yyyy",t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened?"Enter"!==e.key&&"Escape"!==e.key||t._handleEditKeyDown(e):"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){setTimeout((()=>{if(e.editor.autoOpen&&!t.editing.editRow)n.open();else{if(Smart.Utilities.Core.isMobile)return;n.select()}}),50)},a=function(e){"string"==typeof e&&e.length>1&&"Invalid Date"===(e=new Date(e)).toString()||(n.value=e)},d=function(){return n.getValue()},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getImageCellEditor(e){const t=this,i=t._getEditorId(e);if(t._dialogImage&&(t._dialogImage.cell=e),!t._cellEditors[i]){const n=document.createElement("div");n.innerHTML=`\n <div style="display: grid;"><div title="${t.localize("addImages")}" class="smart-grid-icon smart-icon-plus show"></div><div class="images"><div class="container"></div></div></div>\n `,n.rightToLeft=t.rightToLeft,n.tabIndex=0,n.firstElementChild.style.gridTemplateColumns="25px 1fr",t.rightToLeft&&(n.style.direction="rtl");const o=n.querySelector(".smart-grid-icon"),l=n.querySelector(".images");o.onpointerdown=()=>{t._openImageDialog(t._dialogImage?t._dialogImage.cell:e)},l.onclick=e=>{"IMG"===e.target.nodeName&&t._openImagePreviewDialog(e.target)},n.ondrop=i=>{i.preventDefault(),t._openImageDialog(t._dialogImage?t._dialogImage.cell:e),t._dialogImage.dropZone.dropHere(i)},n.ondragover=e=>{e.preventDefault()},t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor");const a=function(){n.focus(),setTimeout((()=>{n.focus()}),50)},d=function(e){n.value=e,l.innerHTML=`<div class="container"><div style="justify-content: center; align-items: center; display: flex; margin-top: 3px;" class="smart-drop-image smart-micro smart-quiet">${t.localize("dropImages")}</div></div>`;const i=l.firstElementChild;if("string"==typeof e&&(e.indexOf("http")>=0||e.indexOf("base64")>=0)){let t="";try{t=JSON.parse(e)}catch(e){console.log(e)}e=t}Array.isArray(e)&&(i.innerHTML="",e.forEach((e=>{const t=document.createElement("img");t.src=e.value,i.appendChild(t)})))},r=function(){let e=n.value;return e&&(Array.isArray(e)||("string"==typeof e&&e.indexOf("base64"))>=0)&&Array.isArray(e)&&(e=JSON.stringify(e)),e},s=i=>{("+"===i.key||i.altKey&&"ArrowDown"===i.key)&&t._openImageDialog(t._dialogImage?t._dialogImage.cell:e),"Escape"===i.key&&t.cancelEdit(),"Enter"===i.key&&t.endEdit()},c=function(){n.value="",t._dialogImage&&t._dialogImage.close(),t._dialogImagePreview&&t._dialogImagePreview.close(),n.removeEventListener("keydown",s)},u=function(){},m=function(){n.addEventListener("keydown",s)};t._cellEditors[i]={element:n,focus:a,blur:u,setValue:d,getValue:r,attach:m,detach:c}}return t._cellEditors[i]}_getPhoneCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-phone-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-phone-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.value=e,n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1),t._phoneNumbers&&t._phoneNumbers[e]&&(n.selectedCountry=t._phoneNumbers[e])},d=function(){return t._phoneNumbers||(t._phoneNumbers=[]),n.value&&(t._phoneNumbers[n.value]=n.selectedCountry),n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getPasswordCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-password-input");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-password-input-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},d=function(){return n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getMaskCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-masked-text-box");n.rightToLeft=t.rightToLeft,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-masked-text-box-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e,1===e.length&&(n.$.input.selectionStart=n.$.input.selectionEnd=n.$.input.value.indexOf(e)+1)},d=function(){return n.value},r=function(){n.value="",n.removeEventListener("keydown",o)},s=function(){},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getNumberInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-number-input");if(t._applyCellEditorUserSettings(n,e),"{}"===JSON.stringify(n.numberFormat)){let i={};if(e.column.cellsFormat)if(e.column.cellsFormat.indexOf("c")>=0){i={style:"currency",currency:t.messages[t.locale].calendar.currency};let n=parseInt(e.column.cellsFormat.substring(1));isNaN(n)||(i.maximumFractionDigits=n)}else if(e.column.cellsFormat.indexOf("p")>=0){i={style:"percent"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t,i.minimumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("d")>=0){i={style:"decimal"};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.maximumFractionDigits=t)}else if(e.column.cellsFormat.indexOf("f")>=0||e.column.cellsFormat.indexOf("n")>=0){i={};let t=parseInt(e.column.cellsFormat.substring(1));isNaN(t)||(i.minimumFractionDigits=t,i.maximumFractionDigits=t)}else e.column.Intl&&e.column.Intl.NumberFormat&&(i=e.column.Intl.NumberFormat);n.numberFormat=i}n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-number-input-cell-editor");const o=function(e){t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.focus(),t.$.scrollView.scrollTop=0}),50)},a=function(){},d=function(e){n.isReady&&("string"==typeof e&&n.numberFormat&&n.numberFormat.style&&"percent"===n.numberFormat.style&&(e=parseFloat(e),e=""+(e/=100)),null!==e&&""!==e||(e=0),n.setValue(e))},r=function(){return n.getValue()},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getCheckBoxCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const e=document.createElement("div");e.classList.add("smart-input"),e.classList.add("smart-grid-cell-editor"),e.classList.add("smart-grid-check-box-cell-editor"),e.tabIndex=0;const n=function(){!0!==e.value&&!1!==e.value&&null!==e.value&&(e.value=!1),null===e.value?e.value=!1:e.value=!e.value,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},o=function(e){if(" "!==e.key){switch(e.key){case"ArrowLeft":case"ArrowDown":case"ArrowRight":case"ArrowUp":if(t.editing.dialog.enabled)return;t.endEdit()}t._handleEditKeyDown(e)}else n()},l=function(t){e.value="string"==typeof t?"false"!==t&&"0"!==t&&"null"!==t&&"undefined"!==t:t,!1===e.value?e.removeAttribute("checked"):e.setAttribute("checked",e.value?"":"indeterminate")},a=function(){Smart.Utilities.Core.isMobile||(e.focus(),setTimeout((function(){e.focus()}),25))},d=function(){return e.value},r=function(){e.value=!1,e.removeEventListener("click",n),e.removeEventListener("keydown",o)},s=function(){},c=function(){e.addEventListener("keydown",o),e.addEventListener("click",n)};t._cellEditors[i]={getValue:d,setValue:l,focus:a,blur:s,element:e,detach:r,attach:c}}return t._cellEditors[i]}_getEditorValue(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors)return;const n=t._cellEditors[i];if(!n)return;const o=function(t){switch(e.column.dataType){case"string":t=null==t?"":void 0!==t&&"number"==typeof t?parseFloat(t):t&&"object"==typeof t&&t[0]&&t[0].label?t[0].label.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):t&&"object"==typeof t&&t instanceof Date?t.toLocaleString():t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""");break;case"float":case"int":case"number":t="int"===e.column.dataType?parseInt(t):parseFloat(t),isNaN(t)&&(t=0);break;case"bool":case"boolean":"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1);break;case"date":if(t instanceof Date)return t;"string"==typeof t&&(t=new Date(t));break;case"dateTime":t=new Smart.Utilities.DateTime(t)}return t};let l=null;switch(e.editor.template){case"dateRangeInput":try{l=n.getValue()}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"input":case"autoComplete":case"numberInput":case"slider":case"dateInput":case"timeInput":case"deteTimePicker":case"checkBox":try{l=o(n.getValue())}catch(t){l=e.value}if(e.editor.getValue){const t=e.editor.getValue(e,l);void 0!==t&&(l=t)}break;case"multiComboInput":case"image":l=n.getValue();break;default:l=o(n.getValue())}let a=!0,d=!1,r=!1;if(e.column.validator)a=e.column.validator.evaluate(l,e.row.data);else if("string"==typeof l){const t=e.editor.minLength||e.editor.min||0,i=e.editor.maxLength||e.editor.max||999999;(l.length<t||l>i)&&(a=!1),l.length<t&&(d=!0),l.length>i&&(r=!0),e.editor.required&&0===l.length&&(a=!1),e.editor.instance.element&&e.editor.instance.element.checkValidity&&(a=e.editor.instance.element.checkValidity())}if(a)return l;let s=null;const c=e.editor.instance.element;return c&&(s=c.validity,s&&(s.custom&&delete s.custom,d&&(s.custom={minLength:!0,value:e.editor.min}),r&&(s.custom={maxLength:!0,value:e.editor.max}),s.message=c.validationMessage)),{error:!0,validity:s,value:l}}_beginRowEdit(e,t){const i=this;if(e===i.editing.editRow)return!1;if(i.editing.editRow){if(!i.endEdit())return!1}const n=e.cells;i.editing.editRow=e,i.editing.commandColumn.visible&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),e.isEditing=!0;let o=!1;for(let e=0;e<n.length;e++){const l=n[e],a=l.column;if(!a.allowEdit||!1===a._visible)continue;const d=i._beginCellEdit(l);if(d){if(!0!==i.editing.recordNavigation&&i.editing.enabled){if(Smart.Utilities.Core.isMobile)return;let e=!0;switch(l.editor.template){case"textarea":case"slider":e=!1}e&&(t?l===t&&l.editor.instance.focus():d&&!o&&(o=!0,l.editor.instance.focus()))}i.editing.commandColumn.visible&&l.column.commandColumn&&l.render()}}return!0}_beginCellEdit(e,t){const i=this;if(e.isEditing)return!1;if(i._isUpdating)return!1;if(i.onCellBeginEdit){if(!i.onCellBeginEdit(e.row.id,e.column.dataField,e.value,i))return!1}let n=!1;if(e.column.autoGenerated&&e.column.rowHeaderColumn&&i.editing.allowRowHeaderEdit&&new Date-i._clickTime<i.behavior.doubleClickTimingDelay&&i._clickedCell===e.element&&(n=!0),(!e.column.allowEdit||e.column.autoGenerated||e.readonly)&&!n)return!1;if(i.editing.editCell&&!i.editing.editRow){i._fireEndEdit=!0;if(!1===i._endCellEdit())return!1}if(i._cellEditors||(i._cellEditors=[]),i.editing.editRow||(i.editing.editCell=e),i.editing.commandColumn.visible&&!i.editing.editRow&&(i.editing.isEditing=!1,i.refresh(),i.editing.isEditing=!0),!e.row.element)return!1;e.row.element.setAttribute("edit",""),i.editing.isEditing=!0,i._selection.selectionRect&&i._selection.selectionRect.classList.add("smart-visibility-hidden");const o=t=>{const n=t.element;i.editing.dialog.enabled?i._openEditDialog(e,t):(e.element||e.createElement(),e.element.setAttribute("editor","string"==typeof e.editor.template?e.editor.template:"template"),e.element.content.innerHTML="",e.element.content.appendChild(n),e.column.cellsWrap||e.element.content.classList.add("nowrap"),i.editing.editRow&&e.element.setAttribute("row-editor","")),t.attach(),e.editor.row=e.row,e.editor.column=e.column,e.editor.cell=e,e.editor.instance=t,e.isEditing=!0},l=i._cellsUpdatedValues?i._cellsUpdatedValues[e.row.id+"_"+e.column.dataField]:void 0;let a=void 0!==l?l:e.value;if(void 0===a){a="";const t=e.column;"number"===t.dataType||"int"===t.dataType||"float"===t.dataType?a=0:"date"===t.dataType&&(a=new Date,a.setHours(0,0,0))}switch(e.editor||(e.editor="input"),"string"==typeof e.editor&&(e.canNotify=!1,e.editor={template:e.editor,autoFocus:!0},e.canNotify=!0),e.editor.template){default:case"custom":{const t=i._getCustomCellEditor(e);o(t),t.setValue(a);break}case"image":{const t=i._getImageCellEditor(e);o(t),t.setValue(a);break}case"checkBox":{const n=i._getCheckBoxCellEditor(e);o(n);const l=!0===a||1===a;if("checkBox"===e.template&&t){(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY)[0].classList.contains("smart-input")?n.setValue(!l):n.setValue(l)}else n.setValue(l);break}case"autoComplete":{const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"list":case"dropDownList":{e.editor.autoOpen=!0,e.editor.readonly=!0,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"comboBox":{e.editor.readonly=!1,e.editor.dropDownButtonPosition="right";const t=i._getAutoCompleteCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"password":{const t=i._getPasswordCellEditor(e);o(t),t.setValue(a);break}case"phone":{const t=i._getPhoneCellEditor(e);o(t),t.setValue(a);break}case"maskedTextBox":{const t=i._getMaskCellEditor(e);o(t),t.setValue(a);break}case"multiInput":{const t=i._getAutoCompleteCellEditor(e,"smart-multi-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"checkInput":{const t=i._getAutoCompleteCellEditor(e,"smart-check-input");o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"multiComboInput":{e.editor.readonly=!0,e.editor.autoOpen=!0;const t=i._getMultiComboInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"timeInput":{const t=i._getTimeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateInput":{const t=i._getDateInputCellEditor(e);o(t),t.setValue(a);break}case"dateRangeInput":{const t=i._getDateRangeInputCellEditor(e);o(t),t.setValue(a),e.editor.autoOpen&&!i.editing.editRow&&t.element.open();break}case"dateTimePicker":{const t=i._getDateTimePickerCellEditor(e);o(t),t.setValue(a);break}case"slider":{const t=i._getSliderCellEditor(e);o(t),t.setValue(a);break}case"colorInput":{const t=i._getColorInputCellEditor(e);o(t),t.setValue(a);break}case"textarea":case"textArea":{const t=i._getTextAreaCellEditor(e);o(t),t.setValue(a);break}case"numberInput":case"text":case"input":{const t="numberInput"===e.editor.template?i._getNumberInputCellEditor(e):i._getInputCellEditor(e);o(t),t.setValue(a);break}}if(!e.editor.isInitialized&&(e.editor.isInitialized=!0,e.editor.onInit)){const t=e.editor.onInit(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}if(e.editor.onRender){const t=e.editor.onRender(e.row.index,e.column.dataField,e.editor.instance.element,e.row.data);if(t&&t instanceof Promise)t.then((t=>{const i="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in t)i[e]=t[e]}));else if(t){const i=t,n="custom"===e.editor.template?e.editor.instance.element.firstElementChild:e.editor.instance.element;for(let e in i)n[e]=i[e]}}return i.editing.editCell&&e.editor.instance.focus(),!0}_onColumnDoubleClick(e){this._beginColumnEdit(e)}_beginColumnEdit(e){const t=this;if(t.editing.enabled&&t.editing.allowColumnHeaderEdit&&e.allowHeaderEdit){t.editing.isEditing&&t.endEdit(),t.editing.editColumn=e,t._cellEditors||(t._cellEditors=[]);const i=t._getInputCellEditor({column:e,row:t.rows[0],editor:{template:"input"}});i.element.value=e.label,i.focus(),e.headerEditor=i,e.element.setAttribute("edit",""),e.element.label.appendChild(i.element),i.attach(),t.editing.isEditing=!0,t.$.fireEvent("beginEdit",{id:null,dataField:e.dataField,row:null,column:e,cell:null,data:null,value:null})}}_endColumnEdit(e){const t=this;if(!1===t.editing.isEditing||t.editing.isEditing&&null===t.editing.editColumn)return!1;const i=t.editing.editColumn;return i.canNotify=!1,i.headerEditor.detach(),i.headerEditor.element.parentNode.removeChild(i.headerEditor.element),!0!==e&&(i.label=i.headerEditor.getValue()),i.headerEditor=null,t.editing.isEditing=!1,i.element.removeAttribute("edit"),i.element.scrollLeft=0,t.editing.editColumn=null,i.canNotify=!0,i.refresh(),t._recycle(),!0}_cancelColumnEdit(){this._endColumnEdit(!0)}_onCellClick(e,t){const i=this;if(e.row.addNewRow)e.row.inline||"far"===e.row.freeze?i._insertNewRowAfter():i._insertNewRowBefore();else if(!e.row.filterRow&&i.editing.enabled)if(i.editing.editColumn)i.endEdit();else{if(i.editing.commandColumn.visible)if(e.column.commandColumn){const n=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.clientX,t.clientY);let o=null;for(let e=0;e<n.length;e++)if(n[e].classList.contains("smart-grid-command-item")){o=n[e];break}if(o||(o=e.element.querySelector(".smart-grid-command-item")),o&&!o.classList.contains("smart-hidden")){const n=o.getAttribute("command");return void i._applyCommand(n,[e.row,t])}}else if(i.editing.commandColumn.inline){const e=(i.enableShadowDOM?i.shadowRoot:i.getRootNode()).elementsFromPoint(t.pageX,t.pageY);for(let t=0;t<e.length;t++)if(e[t].classList.contains("smart-grid-command-item"))return}if("none"===i.editing.action&&i.editing.isEditing){let t=!1;i.editing.editCell&&i.editing.editCell.row!==e.row&&(t=!0),i.editing.editRow&&i.editing.editRow!==e.row&&(t=!0),i.editing.editColumn&&(t=!0),t&&i.endEdit()}if(e.column.autoGenerated){if(i.editing.allowRowHeaderEdit&&e.column.rowHeaderColumn){if(i.editing.isEditing&&i.endEdit(),void 0!==e.row.label)return;i._beginCellEdit(e,t),i.editing.isEditing&&i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value})}}else if("click"===i.editing.action&&(!i.selection.enabled||e.selected||"extended"!==i.selection.mode))if("cell"===i.editing.mode){const n=e.parent();if(void 0!==e.row.label)return;i.ensureVisible(e.row.id,e.column.dataField),setTimeout((function(){n?(i._beginCellEdit(n,t),i.$.fireEvent("beginEdit",{id:n.row.id,dataField:n.column.dataField,row:n.row,column:n.column,cell:n,data:n.row.data,value:n.value})):(i._beginCellEdit(e,t),i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value}))}),25)}else if("row"===i.editing.mode){if(void 0!==e.row.label)return;i._beginRowEdit(e.row,e,t),i.$.fireEvent("beginEdit",{id:e.row.id,dataField:e.column.dataField,row:e.row,column:e.column,cell:e,data:e.row.data,value:e.value})}}}_onCellDoubleClick(e,t){const i=this;i.editing.enabled&&("doubleClick"!==i.editing.action||i.editing.isEditing||e.column.autoGenerated||("cell"===i.editing.mode?i._beginCellEdit(e,t):"row"===i.editing.mode&&i._beginRowEdit(e.row,e,t)))}_onRowClick(){}_onRowDoubleClick(){}beginEdit(e,t){const i=this,n=i.rowById[e];n&&i._beginEdit(n,t)}cancelEdit(){const e=this;if(e.editing.isEditing){if(e._errorOverlay){if(e._errorOverlay.remove(),e._errorMessage.remove(),e.editing.editCell&&(e.editing.editCell.error=""),e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){t[e].error=""}e.editing.editRow.element.removeAttribute("error"),e.editing.editRow.error=null}e._isUpdating=!1}if(e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){const i=t[e],n=i.element;0===e&&i.row.element.removeAttribute("edit"),n&&(n.removeAttribute("editor"),n.removeAttribute("error"),n.content.innerHTML=""),i.isEditing=!1}e.editing.editRow=null}else e.editing.editCell?(e.editing.editCell.row.element.removeAttribute("edit"),e.editing.editCell.row.element.removeAttribute("error"),e.editing.editCell.element.removeAttribute("editor"),e.editing.editCell.element.removeAttribute("error"),e.editing.editCell.element.content.innerHTML="",e.editing.editCell.isEditing=!1,e.editing.editCell=null):e.editing.editColumn&&e._cancelColumnEdit();e.editing.dialog.visible&&e.editing.dialog.enabled&&e._dialogEdit.close(),e.editing.isEditing=!1,e._recycle(!1),e.editing.commandColumn.visible&&e.refresh(),e.$.fireEvent("cancelEdit"),e.focus()}}removeRow(e,t){return this.deleteRow(e,t)}deleteRow(e,t){const i=this;if(e&&Array.isArray(e)){if(i.onRowRemove){if(!1===i.onRowRemove(e,i))return}i.beginUpdate();const n=i.dataSource.canNotify,o=i.rows.canNotify;i.rows.canNotify=!1,i.dataSource.canNotify=!1;const l=i.onRowRemoved;i.onRowRemoved=null;let a=[];for(let n in e){const o=i.rowById[e[n]];a.push(o.data.$.index),i.deleteRow(e[n],t),i.dataSource.removeAt(o.data.$.index)}return i.rows.canNotify=o,i.dataSource.canNotify=n,i.onRowRemoved=l,i.endUpdate(),i._refreshSummary(),void(l&&l(e,a,i))}const n=i.rowById[e];if(!n)return!1;const o=function(e){if(!0===i.editing.batch||i.editing.batch&&i.editing.batch.indexOf("delete")>=0)i._batchDeleteRow(e);else{if(i.dataSource&&i.dataSource.virtualDataSource)return i._editInfo={row:e.data},void i._virtualDataRequest("remove",(function(n){if(n){const n=i.rows.indexOf(e);i.rows.splice(n,1),delete i.rowById[e.id],t&&t(e)}}));const n=i.rows.indexOf(e);i._removeAt(n)}t&&t(e)};return i.editing.deleteDialog.enabled?i._openDeleteRowDialog(n,o):o(n),!0}addRow(e,t,i){const n=this;e||(e={});for(let t=0;t<n.columns.length;t++){const i=n.columns[t];void 0!==i.defaultValue&&void 0===e[i.dataField]&&(e[i.dataField]=i.defaultValue)}if(void 0===t&&(t=!0),n.dataSource&&n.dataSource.virtualDataSource)n._editInfo={row:e},n._virtualDataRequest("add",(o=>{o&&(n._add(e,t?n.rows.length:0),i&&i(t?n.rows[n.rows.length-1]:n.rows[0]))}));else{if(n.editing.batch)return void(t?n._insertNewRowAfter(i):n._insertNewRowBefore(i));"number"==typeof t?n._add(e,t,i):n._add(e,t?n.rows.length:0,i)}}insertRow(e,t,i){this.addRow(e,t,i)}flashCell(e,t){const i=this;i._flashTimer&&clearTimeout(i._flastTimer),i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell"),i.highlightCell(e,t,"smart-flash-cell"),i._flashTimer=setTimeout((()=>{i.highlightedCells&&i.highlightedCells[e]&&(i.highlightedCells[e][t]="off_smart-flash-cell",delete i.highlightedCells[e][t])}),2e3)}highlightCell(e,t,i){const n=this,o=n.rowById[e],l=n.columnByDataField[t];o&&l&&(n.highlightedCells||(n.highlightedCells=[]),n.highlightedCells[e]||(n.highlightedCells[e]=[]),void 0!==n.highlightedCells[e][t]?i?n.highlightedCells[e][t].startsWith("off")?n.highlightedCells[e][t]=i||"":n.highlightedCells[e][t]="off_"+i:delete n.highlightedCells[e][t]:n.highlightedCells[e][t]=i||"",n._recycle(!1))}highlightRow(e,t){const i=this;i.rowById[e]&&(i.highlightedRows||(i.highlightedRows=[]),void 0!==i.highlightedRows[e]?t?i.highlightedRows[e].startsWith("off")?i.highlightedRows[e]=t||"":i.highlightedRows[e]="off_"+t:delete i.highlightedRows[e]:i.highlightedRows[e]=t||"",i._recycle(!1))}highlightColumn(e,t){const i=this.columnByDataField[e];i.highlight=!i.highlight,i._highlightCSS=t,this._recycle(!1)}setRowProperty(e,t,i){const n=this.rowById[e];n&&(n[t]=i)}getRowProperty(e,t){const i=this.rowById[e];if(i)return i[t]}getColumn(e){const t=this.columnByDataField[e];return t||null}getColumnProperty(e,t){const i=this.columnByDataField[e];if(i)return i[t]}setColumnProperty(e,t,i){const n=this.columnByDataField[e];n&&(n[t]=i)}getCellValue(e,t){const i=this.rowById[e],n=this.columnByDataField[t];if(!i||!n)return;return i.getCell(t).value}setCellValue(e,t,n,o){const l=this,a=l.rowById[e],d=l.columnByDataField[t];if(!a||!d)return!1;let r=[];if(d.validationRules&&d.validationRules.length>0&&(r=((e,t)=>{let n=[];for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}return n})(d.validationRules,n),Object.keys(r).length>0))return!1;const s=()=>{l.beginUpdate();const e=a.getCell(t);l._setCellUndoRedo(e,e.value,n),e.value=n,l.endUpdate(),o&&o(a)};if(l.dataSource&&l.dataSource.virtualDataSource){l.dataSource.id?a[l.dataSource.id]=e:a.id||(a.id=e);const i={};for(let e=0;e<l.columns.length;e++){const o=l.columns[e],d=a.getCell(o.dataField);i[o.dataField]=d.value,o.dataField===t&&(i[o.dataField]=n)}l._editInfo={row:i},l._virtualDataRequest("update",(function(e){e&&s(),l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility()}))}else s()}setRowData(e,t){this.updateRow(e,t,null)}getRowData(e){const t=this.rowById[e];if(!t)return null;const i=JSON.parse(JSON.stringify((e=>{const t={};for(let i in e)"leaf"!==i&&"$"!==i&&"parent"!==i&&"history"!==i&&"comments"!==i&&"style"!==i&&(t[i]=e[i]);return t})(t.data)));return delete i.$,i}getRow(e){const t=this.rowById[e];return t||null}forEachRow(e){const t=this;if(e)for(let i=0;i<t.rows.length;i++)e(t.rows[i])}forEachRowAfterFilterAndSort(e){const t=this;if(e)for(let i=0;i<t._recyclingRows.length;i++)e(t._recyclingRows[i])}getRowById(e){return this.rowById[e]}getRowByIndex(e){const t=this.rows[e];return t||null}getRowId(e){const t=this.rows[e];if(!t)return null;return t.id}validateRow(e,t){const n=this;if(!n.rowById[e])return!1;const o=(e,t)=>{let n=[];for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}return n.filter((e=>{}))},l=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];let a=[];if(void 0!==t[i.dataField])if(i.validationRules&&i.validationRules.length>0){let e=t[i.dataField];e&&e.error&&(e=e.value),a=o(i.validationRules,e),Object.keys(a).length>0&&(l[i.dataField]=a)}else{let e=null,n=t[i.dataField];n&&n.error&&(e=n.validity,n=n.value);for(let t in e)e[t]&&"valid"!==t&&"message"!==t&&(a[t]=!0),("custom"===t&&e[t].minLength||"custom"===t&&e[t].maxLength)&&(a[t]=!0);Object.keys(a).length>0&&(l[i.dataField]=a)}}return l}_updateRow(e,t,i){const n=this,o=n.rowById?n.rowById[e]:n.dataSource.dataItemById[e];if(!o)return;let l=[];n.dataSource&&n.dataSource.groupBy&&n.dataSource.groupBy.toArray&&(l=n.dataSource.groupBy.toArray().slice(0));const a=n.dataSource.boundSource.canNotify;n.dataSource.boundSource.canNotify=!1;const d=e=>{if(o.data[e]=t[e],n.dataSource.id&&o&&o.data&&o.data.$&&(o.data.$.id=t[n.dataSource.id]),o&&o.data.$&&void 0!==o.data.$.index){const i=o.data.$.index,a=n.dataSource.dataSource,d=()=>{const i=t[e];if(null==i){const t=n.columnByDataField[e];return t?"number"===t.dataType?0:"boolean"!==t.dataType&&("date"===t.dataType?new Date:""):""}return i};if(a&&a[i]&&(a[i][e]=d()),n.dataSource[i]){if(l.length>0&&!n._dirtyHierarchy){if(n.dataSource[i][e]!==d()&&l.indexOf(e)>=0){const e=n._getExpandedGroups(n.dataSource.boundHierarchy);n._dirtyHierarchy=e}}n.dataSource[i][e]=d()}}};let r=[];for(let e=0;e<n.columns.length;e++){const i=n.columns[e];void 0!==t[i.dataField]&&(r[i.dataField]=!0,d(i.dataField))}if(i){const e=n.dataSource.dataFields;if(e)for(let t=0;t<e.length;t++)r[e[t].name]||(e[t].map?d(e[t].map):d(e[t].name))}n.dataSource.boundSource.canNotify=a,n.__updating||n.dataSource.refreshHierarchy()}updateRow(e,t,i){const n=this,o=n.rowById[e];if(!o)return!1;const l=n.validateRow(e,t);if(Object.keys(l).length>0)return!1;const a=()=>{n.beginUpdate();for(let e in t){if("$"===e)continue;const i=o.getCell(e);i?i.value=t[e]:o.data[e]&&(o.data[e]=t[e])}n.endUpdate(),i&&i(o)};n.dataSource&&n.dataSource.virtualDataSource?(n.dataSource.id?t[n.dataSource.id]=e:t.id||(t.id=e),n._editInfo={row:t},n._virtualDataRequest("update",(function(e){e&&a(),n.appearance.displayLoadingIndicator=!1,n._setLoadingIndicatorVisibility()}))):n.onRowUpdate?n.onRowUpdate([e],[o],[o.data],[t],(e=>{e&&a()}),n):a()}addUnboundRow(e,t){const i=this;void 0===e&&(e=1),void 0===t&&(t="far"),i._nearRowsAdded||(i._nearRowsAdded=[],i._farRowsAdded=[]),i._unboundRows||(i._unboundRows=[]),i.beginUpdate();for(let n=0;n<e;n++){const e=Smart.Utilities.Core.createGUID().replace(/-/gi,""),n=new Smart.Grid.Row({index:-1,unbound:!0,id:e,grid:i});i.rowById[n.id]=n,"far"===t?i._farRowsAdded.push(n):i._nearRowsAdded.push(n),i._unboundRows.push(n)}i.endUpdate()}addNewRow(e){const t=this;"near"===e?t._insertNewRowBefore():t._insertNewRowAfter()}_updateRowHistory(e,t,i){const n=this;if(!n._currentUser||n._currentUser&&!n._currentUser.info)return;const o="taskChecklist",l="taskColor",a="taskDueDate",d="taskPriority",r="taskProgress",s="taskStartDate",c="taskStatus",u="taskTags",m="taskText",g="taskDescription",f="taskUserId",p=()=>({user:n._currentUser.info.id,date:e.updatedDate}),h=[];if(i[f]!==t[f]){const n=p();n.action="user";let o=!0;t[f]||i[f]||(o=!1),o&&(n.details={oldValue:t[f],value:i[f]},e.addHistory(n)),h.push(f)}if(""+i[a]!=""+t[a]){const n=p();n.action="deadline",n.details={oldValue:t[a]?new Date(t[a]).toLocaleDateString():"",value:new Date(i[a]).toLocaleDateString()},e.addHistory(n),h.push(a)}if(""+i[s]!=""+t[s]){const n=p();n.action="deadline",n.details={oldValue:t[s]?new Date(t[s]).toLocaleDateString():"",value:new Date(i[s]).toLocaleDateString()},e.addHistory(n),h.push(s)}if(i[l]!==t[l]){const n=p();n.action="color",n.details={oldValue:t[l],value:i[l]},e.addHistory(n),h.push(c)}if(i[c]!==t[c]){const n=p();n.action="status",n.details={oldValue:t[c],value:i[c]},e.addHistory(n),h.push(c)}if(JSON.stringify(i[o])!==JSON.stringify(t[o])){const n=p();n.action="subtasks",n.details={oldValue:t[o],value:i[o]},e.addHistory(n),h.push(o)}else h.push(o);if(void 0!==i[r]&&parseFloat(i[r])!==parseFloat(t[r])){let n=!0;if(null===t[r]&&0===parseFloat(i[r])&&(n=!1),null===(null===t[r]&&i[r])&&(n=!1),n){const n=p();n.action="progress",n.details={oldValue:t[r]?100*t[r]+"%":"0%",value:100*i[r]+"%"},e.addHistory(n)}h.push(r)}if(i[g]!==t[g]){const n=p();n.action="description",n.details={oldValue:t[g],value:i[g]},e.addHistory(n),h.push(g)}if(i[d]!==t[d]){const n=p();n.action="priority",n.details={oldValue:t[d],value:i[d]},e.addHistory(n),h.push(d)}if(i[u]!==t[u]){const n=p();n.action="tags",n.details={oldValue:t[u],value:i[u]},e.addHistory(n),h.push(u)}if(i[m]!==t[m]){const n=p();n.action="text",n.details={oldValue:t[m],value:i[m]},e.addHistory(n),h.push(m)}for(let o=0;o<n.columns.length;o++){const l=n.columns[o].dataField;let a=t[l],d=i[l];if(-1===h.indexOf(l)&&a!==d){const t=p();"date"===n.columns[o].dataType&&(d&&"string"==typeof d&&(d=new Date(d)),a&&"string"==typeof a&&(a=new Date(a))),t.action=l,t.details={oldValue:a,value:d},e.addHistory(t)}}n.onRowHistory&&(n._tempRowHistory||(n._tempRowHistory=[]),n._tempRowHistory[e.index]={index:e.index,row:e,history:e.history},n._tempRowHistoryTimer&&clearTimeout(n._tempRowHistoryTimer),n._tempRowHistoryTimer=setTimeout((()=>{const e=[],t=[],i=[];for(let o in n._tempRowHistory)t.push(o),e.push(n._tempRowHistory[o].row),i.push(n._tempRowHistory[o].history);n.onRowHistory(t,e,i,n),delete n._tempRowHistory}),50))}_stringifyRow(e){const t=this;let i={};for(let n=0;n<t.columns.length;n++){const o=t.columns[n];i[o.dataField]=e.data[o.dataField]}return i=JSON.parse(JSON.stringify(i)),i}endEdit(){const e=this;let t=!1,i=null;e.editing.dialog.enabled&&e.editing.dialog.visible&&e._dialogEdit&&e._dialogEdit.close();let n=null,o=null,l=null;e._fireEndEdit=!0;let a=null,d=null,r=null;if(e.editing.editRow){o=e.editing.editRow,i=e.editing.editRow.id;let n=null;if(e.storeHistory&&(n=e._stringifyRow(o)),t=e._endRowEdit(),a=n,t&&!e.onRowUpdate&&(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory)){const t=e._stringifyRow(o);e._updateRowHistory(o,n,t)}}else if(e.editing.editCell){o=e.editing.editCell.row,l=e.editing.editCell.column,n=e.editing.editCell,i=e.editing.editCell.row.id,r=!0;let s=null;e.storeHistory&&(s=e._stringifyRow(o));const c=void 0!==n.value?n.value:"";d=c,a=s;let u=!1;const m=t=>{if(t!==c){if(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory){const i=e._stringifyRow(o);i[n.column.dataField]=t,e._updateRowHistory(o,s,i)}u=!0}};if(e.onCellUpdate&&e.onRowHistory){const t=e.onRowHistory;e.onRowHistory=null;m(e._getEditorValue(n)),setTimeout((()=>{e.onRowHistory=t}),100)}t=e._endCellEdit(),t&&!u&&e.cell&&m(e.cell.value)}else e.editing.editColumn&&(i=null,l=e.editing.editColumn,t=e._endColumnEdit());if(e._saveUnboundRows(i),e._selection.selectionRect&&e._selection.selectionRect.classList.remove("smart-visibility-hidden"),e.$.scrollView.scrollTop=0,e._fireEndEdit){e.$.fireEvent("endEdit",{id:o?o.id:null,dataField:l?l.dataField:null,row:o,column:l,cell:n,data:o?o.data:null,value:n?n.value:l?l.label:null}).defaultPrevented&&(r?e.setCellValue(o.id,l.dataField,d):e.setRowData(o.id,a))}return e.summaryRow.visible&&t&&(e.editing.isEditing=!1,e._calculateSummary(),e._recycle(!1)),e._refreshDataFilters(),e._renderConditionalFormatting(),t}getEditCells(){const e=this;return e.editing.editRow?e.editing.editRow.cells:e.editing.editCell?[e.editing.editCell]:[]}getBatchEditChanges(){const e=this,t=[],i=[],n=[];for(let i in e._cellsUpdatedValues){const n=e._cellsUpdatedValues[i],o=i.substring(0,i.indexOf("_")),l=i.substring(i.indexOf("_")+1),a=e.rowById[o].getCell(l);t.push({id:o,dataField:l,oldValue:a.value,newValue:n})}if(e._rowsDeleted&&e._rowsDeleted.length>0)for(let t=0;t<e._rowsDeleted.length;t++){const n=e._rowsDeleted[t],o=e.rowById[n];i.push({id:o.id,data:o.data})}if(e._rowsAdded&&e._rowsAdded.length>0)for(let t=0;t<e._rowsAdded.length;t++){const i=e._rowsAdded[t],o=e.rowById[i];n.push({id:o.id,data:o.data})}return{updated:t,deleted:i,added:n}}saveBatchEdit(){this._saveBatchEdit()}revertBatchEdit(){this._clearBatchEdit(!0)}});const e=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;function t(e){return null==e||0===e.length}class i{static null(e){return null===e}static email(i){return t(i)||e.test(i)?null:{email:!0}}static min(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static max(e,i){return(e=>{if(t(e)||t(i))return null;const n=parseFloat(e);return!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static minDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n<i?{min:{min:i,actual:n}}:null})(e)}static maxDate(e,i){return(e=>{if(t(e)||t(i))return null;let n=e;return e&&e instanceof Smart.Utilities.DateTime&&(n=e.toDate()),!isNaN(n)&&n>i?{max:{max:i,actual:n}}:null})(e)}static required(e){return t(e)?{required:!0}:null}static requiredTrue(e){return!0===e?null:{required:!0}}static minLength(e,i){return(e=>{if(t(e))return null;const n=e?e.length:0;return n<i?{minlength:{requiredLength:i,actualLength:n}}:null})(e)}static maxLength(e,t){return(e=>{const i=e?e.length:0;return i>t?{maxlength:{requiredLength:t,actualLength:i}}:null})(e)}static url(e){return/^(ftp|http|https):\/\/[^ "]+$/.test(e)?null:{pattern:{requiredPattern:'^(ftp|http|https)://[^ "]+$',actualValue:e}}}static pattern(e,n){if(!n)return i.null;let o,l;return"string"==typeof n?(l="","^"!==n.charAt(0)&&(l+="^"),l+=n,"$"!==n.charAt(n.length-1)&&(l+="$"),o=new RegExp(l)):(l=n.toString(),o=n),(e=>t(e)||o.test(e)?null:{pattern:{requiredPattern:l,actualValue:e}})(e)}}window.Smart.Validator=i})();
|
|
60
|
+
Smart.Utilities.Assign("Grid.Dialog",class{_openImagePreviewDialog(e){const t=this,a=e?[...e.parentNode.parentNode.querySelectorAll("img")]:[];if(e=e.cloneNode(),!t._dialogImagePreview){t._dialogImagePreview=t._createDialog({modal:!0,screenModal:!0,left:"screenMiddle",top:"screenCenter",width:"80%",height:"80%"}),t._dialogImagePreview.content.innerHTML='<div style="width: 100%; height: 100%;"><div class="images-container"></div><div class="image-preview"></div></div>';const e=t._dialogImagePreview.content.firstElementChild;e.style.display="grid",e.style.gridTemplateColumns="50px 1fr"}const i=t._dialogImagePreview.querySelector(".images-container");i.innerHTML="";const l=(e,a)=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const i=150+Math.min(850,e.width),l=150+Math.min(650,e.height);t._dialogImagePreview.style.width=i+"px",t._dialogImagePreview.style.height=l+"px",!1!==a&&(t._dialogImagePreview.style.left="calc(50% - "+Math.min(850,t._dialogImagePreview.offsetWidth/2)+"px)",t._dialogImagePreview.style.top="calc(50% - "+Math.min(650,t._dialogImagePreview.offsetHeight/2)+"px)");const n=getComputedStyle(t._dialogImagePreview),o=parseInt(n.top),r=parseInt(n.left);(window.offsetWidth<i||window.offsetHeight<l||o<0||r<0)&&(t._dialogImagePreview.style.left="0px",t._dialogImagePreview.style.top="0px",t._dialogImagePreview.style.width="100%",t._dialogImagePreview.style.height="100%"),e.style.maxWidth="100%"},n=()=>{const e=t._dialogImagePreview.querySelector(".images-container");let a=-1;return e.querySelectorAll("img").forEach(((e,t)=>{if(e.hasAttribute("active"))return a=t,!0})),a},o=e=>{const a=t._dialogImagePreview.querySelector(".images-container");e&&a.querySelectorAll("img").forEach((t=>{if(t.style.borderColor="transparent",t.removeAttribute("active"),t.src===e.src){t.style.borderColor="var(--smart-primary)",t.setAttribute("active",""),r.innerHTML=`<img src="${t.src}"/>`;const e=r.querySelector("img");e.onload=()=>{l(e,!1)}}}))};if(a.length>1)for(let t=0;t<a.length;t++){const l=a[t].cloneNode();l.style.width="40px",l.style.height="40px",l.style.cursor="pointer",l.style.borderStyle="solid",l.style.borderWidth="1px",l.style.borderColor="transparent",l.style.borderRadius="var(--smart-border)",l.style.marginTop="10px",l.title=a[t].title||a[t].parentNode.title,a[t].src===e.src&&(l.style.borderColor="var(--smart-primary)",l.setAttribute("active","")),i.appendChild(l),l.onmouseenter=()=>{l.style.borderColor="var(--smart-primary)"},l.onmouseleave=()=>{l.hasAttribute("active")||(l.style.borderColor="transparent")},l.onclick=()=>{o(l)}}const r=t._dialogImagePreview.content.querySelector(".image-preview");r.innerHTML="",r.appendChild(e),t._dialogImagePreview.btnClose.onclick=e=>{t._dialogImagePreview.close(),e.preventDefault(),e.stopPropagation()},e.style.marginLeft="auto",e.style.marginRight="auto",e.style.maxWidth="",e.onload=()=>{l(e)},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){if("Escape"===e.key&&t._dialogImagePreview.close(),"ArrowUp"===e.key||"ArrowLeft"===e.key){const t=n();o(a[t-1]),e.stopPropagation(),e.preventDefault()}else if("ArrowDown"===e.key||"ArrowRight"===e.key){const t=n();o(a[t+1]),e.stopPropagation(),e.preventDefault()}},t._dialogImagePreview.btnClose.tabIndex=0,t._dialogImagePreview.onOpen=()=>{setTimeout((()=>{t._dialogImagePreview.btnClose.focus()}),100)},t._dialogImagePreview.footer.remove(),t._dialogImagePreview.header.parentNode.style.backgroundColor="var(--smart-background)",t._dialogImagePreview.open()}_openImageDialog(e,t){const a=this,i=a._dialogImage||a._createDialog(),l='<span class="smart-grid-icon smart-icon-image show"></span>'+a.localize("dialogImageHeader");if(i.cell||(i.cell=e),i.header.innerHTML=l,i.column=e.column,i.command=t,i.classList.add("smart-grid-image-dialog"),!a._dialogImage){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){i.fileUpload.value="",i.input.value="";let e=i.cell.editor.instance.getValue();if("[]"!==e)if(e&&"string"==typeof e&&e.indexOf("http")>=0)i.input.value=JSON.parse(e)[0].value,i.tabs[1].click(),n("input");else{i.tabs[0].click();const t=(e,t)=>{let a=e.split(","),i=a[0].match(/:(.*?);/)[1],l=atob(a[1]),n=l.length,o=new Uint8Array(n);for(;n--;)o[n]=l.charCodeAt(n);return new File([o],t,{type:i})},a=new DataTransfer;"string"==typeof e&&e.indexOf("base64")>=0&&(e=JSON.parse(e)),Array.isArray(e)&&(e.forEach((e=>{a.items.add(t(e.value,e.label))})),i.fileUpload.files=a.files,n())}else i.tabs[0].click()},i.onClose=function(){},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){if(i.tabs[1].classList.contains("active"))i.input.value?e.editor.instance.setValue([{label:i.input.value,value:i.input.value}]):e.editor.instance.setValue([]),a._endCellEdit(i.cell);else{const t=(e,t)=>{var a=new FileReader;a.readAsDataURL(e),a.onload=function(){t(a.result)},a.onerror=function(){t("error")}},l=[];if(i.fileUpload.files.length)for(let n=0;n<i.fileUpload.files.length;n++){const o=i.fileUpload.files[n];t(o,(t=>{"error"===t&&console.log("Image load error"),l.push({value:t,label:o.name}),l.length===i.fileUpload.files.length&&(e.editor.instance.setValue(l),a._endCellEdit(i.cell))}))}else e.editor.instance.setValue([]),a._endCellEdit(i.cell)}i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogImage=i,i.content.innerHTML=`\n <div>\n <div>\n <div class="tabs">\n <div class="active tab">\n <span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogImageDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${a.localize("dialogImageLink")}</label>\n </div>\n </div>\n </div>\n <div class="smart-grid-drop-zone">\n <div>\n <div class="title"><span class="smart-grid-icon smart-icon-plus show"></span><label>${a.localize("dialogImageUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${a.localize("dialogImageDrop")}</label></div>\n </div> \n <input accept=".jpg, .jpeg, .png" type="file" multiple="multiple" style="display: none;">\n </div>\n <div class="smart-hidden url-zone">\n <div class="url-title">\n ${a.localize("dialogImageURL")}\n </div>\n <div class="upload">\n <smart-input placeholder="https://example.com/image.png" class="underlined"></smart-input>\n <br/>\n <smart-button disabled class="success">${a.localize("dialogImageURLUpload")}</smart-button>\n </div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,i.input=i.querySelector("smart-input"),i.dropZone=i.querySelector(".smart-grid-drop-zone"),i.upload=i.querySelector(".title"),i.fileUpload=i.querySelector("input"),i.preview=i.querySelector(".preview"),i.tabs=i.querySelectorAll(".tab"),i.urlZone=i.querySelector(".url-zone"),i.uploadButton=i.querySelector("smart-button");const t=["image/apng","image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon"],l=e=>t.includes(e.type);i.dropZone.ondrop=i.dropZone.dropHere=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;const a=i.column.editor.maxImages||5;for(let a=0;a<e.dataTransfer.items.length;a++)if("file"===e.dataTransfer.items[a].kind){const i=e.dataTransfer.items[a].getAsFile();l(i)&&t++}if(t===e.dataTransfer.files.length||t===a){const t=new DataTransfer;let l=[...e.dataTransfer.files],o=[...i.fileUpload.files];l.length>a&&(l=l.slice(0,5)),o.length>a&&(o=o.slice(0,5)),o.forEach(((e,i)=>{i<a&&t.items.add(e)})),l.forEach(((e,i)=>{i<a&&t.items.add(e)})),i.fileUpload.files=t.files,n()}}else i.fileUpload.files=e.dataTransfer.files,n()},i.dropZone.ondragover=e=>{e.preventDefault()},i.tabs[0].onclick=()=>{i.tabs[0].classList.add("active"),i.tabs[1].classList.remove("active"),i.dropZone.classList.remove("smart-hidden"),i.urlZone.classList.add("smart-hidden"),i.updatePreview()},i.tabs[1].onclick=()=>{i.tabs[0].classList.remove("active"),i.tabs[1].classList.add("active"),i.dropZone.classList.add("smart-hidden"),i.urlZone.classList.remove("smart-hidden"),i.updatePreview("input")},i.uploadButton.onclick=()=>{i.updatePreview("input")};const n=e=>{const t=i.preview,o=i.fileUpload;function r(e){return e<1024?e+"bytes":e>=1024&&e<1048576?((e/1024).toFixed(1)+"KB").replace(".0",""):e>=1048576?(e/1048576).toFixed(1)+"MB":void 0}for(;t.firstChild;)t.removeChild(t.firstChild);const s=()=>{const e=document.createElement("div");return e.classList.add("item"),e.onpointerdown=t=>{const l=e.getBoundingClientRect();if(i.input.value="",t.clientY>=l.bottom-12){if(t.clientX>l.left+l.width/2-13&&t.clientX<l.left+l.width/2+13){e.remove();const t=i.preview.querySelectorAll(".item"),a=new DataTransfer;t.forEach((e=>{a.items.add(e.file)})),o.files=a.files,i.clearButton&&0===t.length&&i.clearButton.classList.remove("show")}}else a._openImagePreviewDialog(e.querySelector("img"))},e},d=()=>{const e=document.createElement("div");e.classList.add("list");const l=document.createElement("div");l.classList.add("smart-grid-icon","show","smart-icon-delete"),l.title=a.localize("clear"),t.appendChild(l),l.onclick=()=>{o.value="",i.input.value="",n()},i.clearButton=l,t.appendChild(e)};if("input"===e){const e=i.input.value;if(e){const t=s();if(d(),e.endsWith("png")||e.endsWith("jpeg")||e.endsWith("jpg")){const a=document.createElement("img");a.src=e,t.appendChild(a)}i.preview.lastChild.appendChild(t)}else{const e=document.createElement("p");e.textContent=a.localize("dialogImageFileUpload"),t.appendChild(e)}}else{const e=o.files;if(0===e.length){const e=document.createElement("p");e.textContent=a.localize("dialogImageFileUpload"),t.appendChild(e)}else{d();const n=new DataTransfer,c=i.column.editor.maxImages||5,m=i.column.editor.maxImageSize||524288;let u=0,b=[];for(const o of e){const e=s();if(u>=c){b.push(o.name);continue}const d=document.createElement("div");if(l(o)){d.textContent=`${o.name}, ${r(o.size)}.`,d.textContent.length>20&&(d.textContent=`${o.name.substring(0,5)}...${o.name.substring(o.name.length-4)}, ${r(o.size)}.`);const i=document.createElement("img");if(i.src=URL.createObjectURL(o),o.size>m){const e=document.createElement("p");e.textContent=a.localize("dialogImageSize",{value:o.name,fileSize:r(m)}),t.appendChild(e);continue}n.items.add(o),e.file=o,e.title=d.textContent,e.appendChild(i),e.appendChild(d)}i.preview.querySelector(".list").appendChild(e),u++}if(b.length>0){const e=document.createElement("p");e.textContent=a.localize("dialogImageCount",{files:b.toString(),fileCount:c}),t.appendChild(e)}o.files=n.files}}};i.updatePreview=n,i.fileUpload.onchange=()=>{if(0===i.fileUpload.files.length&&i._tempFiles)i.fileUpload.files=i._tempFiles;else if(i._tempFiles){const e=new DataTransfer,t=[...i.fileUpload.files];[...i._tempFiles].forEach((t=>{e.items.add(t)})),t.forEach((t=>{e.items.add(t)})),i.fileUpload.files=e.files}n()},i.input.onchange=i.input.onblur=i.input.onkeyup=()=>{i.uploadButton.disabled=!i.input.value||!i.input.value.startsWith("https://")},i.upload.onclick=()=>{i._tempFiles=[];const e=new DataTransfer;[...i.fileUpload.files].forEach((t=>{e.items.add(t)})),i._tempFiles=e.files,i.fileUpload.click()}}i.open(),setTimeout((function(){i.btnConfirm.focus()}),100)}_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}_createDialog(e){const t=this;let a=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(a.modal=e.modal),void 0!==e.screenModal&&(a.screenModal=e.screenModal),a.setAttribute("animation","none"),a.classList.add("smart-window","smart-grid-dialog"),a.style.width="auto"===e.width?e.width:e.width+"px",a.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(a.style.width=e.width),e.height&&"string"==typeof e.height&&(a.style.height=e.height),a.style.left="",a.style.top="",a.innerHTML='<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div id="headerSection" class="smart-header-section">\n <div class="smart-header"></div>\n <div class="smart-buttons-container">\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-prev-button" aria-label="Previous Record" smart-id="prevButton"></button>\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-next-button" aria-label="Next Record" smart-id="nextButton"></button>\n <button class ="smart-button smart-element smart-close-button" aria-label="Close" smart-id="closeButton"></button>\n </div>\n </div>\n <div class="smart-content"><div class="smart-content-container"></div></div>\n <div class ="smart-footer">\n <div class ="smart-stack-layout right spacing">\n <smart-button class ="smart-confirm-button item primary">Ok</smart-button>\n <smart-button class ="smart-cancel-button item">Cancel</smart-button>\n </div>\n </div>\n </div>\n </div>\n ',a.querySelector&&a.querySelector(".smart-content")&&(a.content=a.querySelector(".smart-content").firstChild),a.footer=a.querySelector(".smart-footer"),a.header=a.querySelector(".smart-header"),a.btnConfirm=a.querySelector(".smart-confirm-button"),a.btnCancel=a.querySelector(".smart-cancel-button"),a.btnClose=a.querySelector(".smart-close-button"),a.btnNext=a.querySelector(".smart-next-button"),a.btnPrev=a.querySelector(".smart-prev-button");const i=document.createElement("div");return i.classList.add("smart-grid-dialog-overlay"),i.onclick=function(){},a.overlay=i,a.remove=function(){a.parentNode&&a.parentNode.removeChild(a)},a.close=function(){a.classList.remove("open"),delete t._resizeHandling,a.addEventListener("transitionend",a.remove),a.addEventListener("transitioncancel",a.remove),a.modal&&a.overlay.parentNode&&a.overlay.parentNode.removeChild(a.overlay),a.onClose&&a.onClose()},a.open=function(i,l){a.removeEventListener("transitionend",a.remove),a.removeEventListener("transitioncancel",a.remove),t.isInShadowDOM?t.getRootNode().appendChild(a):document.body.appendChild(a),t._resizeHandling=!1,void 0===i&&(i=e.left),void 0===l&&(l=e.top),requestAnimationFrame((function(){a.classList.add("open");const e=a.querySelector('[bind="name"]');if(e){const t=e.querySelector("smart-input");t&&t.focus()}const n=function(e,i){const l=t.offset(t);switch("center"===e&&"horizontal"===i&&(e="middle"),e){case"top":return l.top;case"bottom":return Math.max(l.top,l.top+t.offsetHeight-a.offsetHeight);case"center":return Math.max(l.top,l.top+t.offsetHeight/2-a.offsetHeight/2);case"left":return l.left;case"middle":return l.left+t.offsetWidth/2-a.offsetWidth/2;case"right":return l.left+t.offsetWidth-a.offsetWidth}return"horizontal"===i?parseInt(e)+l.left:"vertical"===i?parseInt(e)+l.top:"number"==typeof e?e:parseInt(e)};a.style.left=n(i,"horizontal")+"px",a.style.top=n(l,"vertical")+"px",a.setPosition=(e,t)=>{t?a.style.left=n(e,"horizontal")+"px":a.style.top=n(e,"vertical")+"px"},"screenMiddle"===i&&(a.style.left="calc(50% - "+a.offsetWidth/2+"px)"),"screenCenter"===l&&(a.style.top="calc(50% - "+a.offsetHeight/2+"px)")})),a.modal&&(a.screenModal?t.isInShadowDOM?t.getRootNode().appendChild(a.overlay):document.body.appendChild(a.overlay):t.appendChild(a.overlay)),a.onOpen&&a.onOpen()},a}_openAddRowDialog(e,t){const a=this;if(!a.editing.addDialog.enabled)return!1;const i=a._dialogAddRow||a._createDialog(),l="{{message}}"===a.editing.dialog.header?a.localize("dialogAddHeader"):a.editing.dialog.header,n=i.content;i.header.innerHTML=l,e.grid=a,void 0===e.index&&(e.index=a.rows.length,a._rowsAdded&&(e.index+=a._rowsAdded.length));const o=e.cells;let r=null,s=0;if(a._cellEditors||(a._cellEditors=[]),!a._dialogAddRow){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogAddButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogAddButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0},i.onClose=function(){a.editing.dialog.visible=!1},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){const e={};for(let t=0;t<o.length;t++){const i=o[t],l=a._getEditorValue(i),n=a._getEditorId(i),r=a._cellEditors[n];r&&(l&&l.error?(e[i.column.dataField]=l.value,r.detach()):(e[i.column.dataField]=l,r.detach()))}const l=a._rowsAdded?a._rowsAdded.length:0,n=new Smart.Grid.Row({index:a.rows.length+l,id:Smart.Utilities.Core.createGUID(),grid:a,data:e});i.close(),t(n,0===i.index)},i.onkeydown=function(e){const t=e.key;"Enter"===t?i.btnConfirm.onclick():"Escape"===t&&i.close()},n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;s%2==0&&(r=document.createElement("div"),r.classList.add("smart-grid-edit-dialog-row"),n.appendChild(r));const i=document.createElement("div");i.classList.add("col-sm-6");const l=document.createElement("div");l.classList.add("column");const o=document.createElement("label");o.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),i.appendChild(l),r.appendChild(i),l.appendChild(o),l.appendChild(d),s++}}i.open(),i.index=e.index;let d=0;for(let e=0;e<o.length;e++){const t=o[e],l=t.column,n=l.dataField,r=i.querySelector("[editor="+n+"]");if(!r)continue;r.innerHTML="";let s="";void 0!==t.value&&(s=t.value),"int64"!==l.dataType&&"number"!==l.dataType&&"int"!==l.dataType&&"float"!==l.dataType||(s=0),"date"===l.dataType&&(s=new Date),"bool"!==l.dataType&&"boolean"!==l.dataType||(s=!1);let c=null;switch(t.editor.template){default:case"custom":c=a._getCustomCellEditor(t);break;case"image":c=a._getImageCellEditor(t);break;case"checkBox":c=a._getCheckBoxCellEditor(t);break;case"autoComplete":c=a._getAutoCompleteCellEditor(t);break;case"dropDownList":c=a._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=a._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=a._getMaskCellEditor(t);break;case"checkInput":c=a._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=a._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=a._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=a._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=a._getDateInputCellEditor(t);break;case"dateRangeInput":c=a._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=a._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=a._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?a._getNumberInputCellEditor(t):a._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(s),0===d&&setTimeout((()=>{c.focus()}),100),!t.editor.isInitialized&&(t.editor.isInitialized=!0,t.editor.onInit)){const e=t.editor.onInit(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,i="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)i[e]=a[e]}}if(t.editor.onRender){const e=t.editor.onRender(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)a[t]=e[t]}));else if(e){const a=e,i="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in a)i[e]=a[e]}}r.appendChild(c.element),c.element.onfocus=()=>{r.setAttribute("focus","")},c.element.onblur=()=>{r.removeAttribute("focus")},d++}a._dialogAddRow=i}_openEditDialog(e,t){const a=this;if(!a.editing.dialog.enabled)return!1;const i=a._dialogEdit||a._createDialog();let l="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeader",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header;const n=i.content;!1===a.editing.enabled?(i.classList.add("disable-edit"),l="{{message}}"===a.editing.dialog.header?a.localize("dialogEditHeaderDisabled",{value:a.editing.editRow?e.row.visibleIndex+1:e.column.label}):a.editing.dialog.header):i.classList.remove("disable-edit"),i.header.innerHTML=l,i.row=a.editing.editRow,a.editing.recordNavigation&&i.classList.add("disable-animation");let o=null,r=0;if(void 0!==a._settingsDialogRowId){i.btnPrev.classList.remove("smart-hidden"),i.btnNext.classList.remove("smart-hidden");const e=e=>{const t=a.editing.editRow,l=a._recyclingRows.indexOf(t);let n=e?a._recyclingRows[l+1]:a._recyclingRows[l-1];if(a.grouping.enabled&&a.dataSource.groupBy&&a.dataSource.groupBy.length>0){let t=1;for(;n&&!n.leaf;)n=e?a._recyclingRows[l+t]:a._recyclingRows[l-t],t++}if(n){i.classList.add("disable-animation"),a.editing.recordNavigation=!0;const e=i.querySelector("[focus]");if(e){const t=e.closest(".smart-grid-edit-dialog-row"),i=t.closest(".smart-grid-edit-dialog-editors-container");let l=-1;if(i&&(l=[...i.children].indexOf(t)),a.cancelEdit(),a._openRowSettingsDialog(n.id),a._dialogEdit&&l>=0){const e=a._dialogEdit.querySelectorAll(".smart-grid-edit-dialog-row")[l];if(e&&a.editing.enabled){const t=e.querySelector(".smart-grid-dialog-editor");t.setAttribute("focus",""),t.querySelector(".smart-grid-cell-editor").focus()}}}else a.cancelEdit(),a._openRowSettingsDialog(n.id)}};i.btnNext.onmousedown=t=>{e(!0),t.preventDefault(),t.stopPropagation()},i.btnPrev.onmousedown=t=>{e(!1),t.preventDefault(),t.stopPropagation()}}if(!a._dialogEdit)if(i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0,a._settingsDialogRowId&&i.editorsContent&&i.editorsContent.offsetHeight&&(i.editorsContent.style.maxHeight=i.editorsContent.offsetHeight+40+"px")},i.onClose=function(){a.editing.dialog.visible=!1,i.row&&(i.row.showDetail=!1)},i.btnCancel.onclick=function(){a.cancelEdit()},i.btnClose.onclick=function(){a.cancelEdit()},i.btnConfirm.onclick=function(){if(void 0!==a._settingsDialogRowId){if(a.rowById[a._settingsDialogRowId]){const e=a.editing.editRow;if(!e)return!1;const t=e.cells;let l={};e.element.removeAttribute("error");for(let e=0;e<t.length;e++){const i=t[e],n=a._getEditorValue(i);l[i.column.dataField]=n}const n=a.validateRow(e.id,l);if(Object.keys(n).length>0){let e=!0;for(let l=0;l<t.length;l++){const o=t[l],r=n[o.column.dataField],s=i.querySelector(`[label-for="${o.column.dataField}"]`);if(s&&(s.innerHTML=""),r)for(let t in r){const i=r[t];let l="";if(!i)continue;let n=i[t];"minLength"!==t&&"maxLength"!==t||(n=i[t.toLowerCase()]),l=i.message?i.message:"required"===t||"valueMissing"===t?a.localize("requiredValue",{value:o.column.label}):"min"===t?a.localize("invalidMinValue",{value:o.column.label,min:n.min}):"max"===t?a.localize("invalidMaxValue",{value:o.column.label,max:n.max}):"minLength"===t?a.localize("invalidMinLengthValue",{value:o.column.label,min:n.requiredLength}):"maxLength"===t?a.localize("invalidMaxLengthValue",{value:o.column.label,max:n.requiredLength}):a.localize("invalidValue"),e=!1,s&&(s.innerHTML=l)}}if(!e)return}const o=e.style;e.updatedDate=new Date,e.updatedBy=a.currentUser,e.style=i._rowStyle,e.comments=i._rowComments;const r=a.dataSource.dataItemById[e.id];if(r){const t=r.$.index;a.dataSource&&e.comments!==a.dataSource.boundSource[t].comments&&(a._sortedColumns&&a._sortedColumns.length>0?r.comments=e.comments:a.dataSource.boundSource[t].comments=e.comments)}e.style=i._rowStyle,a.onRowStyle&&o!==e.style&&(null===o?a.onRowStyle(e.index,e,e.style):o.background===e.style.background&&o.color===e.style.color&&o.fontSize===e.style.fontSize&&o.fontStyle===e.style.fontStyle&&o.fontFamily===e.style.fontFamily&&o.fontWeight===e.style.fontWeight&&o.status===e.style.status&&o.textDecoration===e.style.textDecoration||a.onRowStyle(e.index,e,e.style))}if(i.columnVisibility){let e=!1;const t=a.columns.canNotify;a.columns.canNotify=!1;for(let t in i.columnVisibility){const l=a.columnByDataField[t];l.visible!==i.columnVisibility[t]&&(l.visible=i.columnVisibility[t],e=!0)}if(a.columns.canNotify=t,e)return a.endEdit(),a.refresh(!1),void(a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh()))}}a.endEdit(),a.dataSource&&a.dataSource.boundHierarchy&&(a.dataSource.refreshHierarchy(),a._refreshRowHierarchy(),a.refresh())},i.onkeydown=function(e){const t=e.key,i=a.editing.commandKeys;for(let e in i){const l=i[e];if(t===l.key){a._applyCommand(l.command);break}}},a.editing.editRow)if(void 0!==a._settingsDialogRowId)a._applySettingsDialogLayout(i,n,a.editing.editRow);else{n.classList.add("smart-grid-layout");for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;r%2==0&&(o=document.createElement("div"),o.classList.add("smart-grid-edit-dialog-row"),n.appendChild(o));const i=document.createElement("div");i.classList.add("col-sm-6");const l=document.createElement("div");l.classList.add("column");const s=a._settingsDialogRowId?document.createElement("div"):document.createElement("label");s.innerHTML=a.columns[e].label;const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template),i.appendChild(l),o.appendChild(i),l.appendChild(s),l.appendChild(d),r++}}else{const t=e.column,a=document.createElement("div");a.classList.add("smart-grid-dialog-editor"),a.setAttribute("editor",""),a.setAttribute("template",t.editor.template),n.appendChild(a)}if(i.open(),a.editing.editRow){const a=i.querySelector("[editor="+e.column.dataField+"]");a&&(a.innerHTML="",a.appendChild(t.element),t.element.onfocus=()=>{a.setAttribute("focus","")},t.element.onblur=()=>{a.removeAttribute("focus")})}else{const a=e.column,l=i.querySelector("[editor]");l.innerHTML="",l.setAttribute("template",a.editor.template),l.appendChild(t.element),t.element.onfocus=()=>{l.setAttribute("focus","")},t.element.onblur=()=>{l.removeAttribute("focus")}}a._dialogEdit=i}_refreshCurrentUser(){const e=this,t=e.users;let a=e.currentUser,i=!0,l=!0,n=e.editing.enabled,o=!0;t&&null!==a&&(a=t.find((e=>e.id===a)),a&&(i=!1!==a.allowAdd,l=!1!==a.allowComment,n=n&&!1!==a.allowEdit,o=!1!==a.allowRemove)),e._currentUser={allowAdd:i,allowComment:l,allowEdit:n,allowRemove:o,info:a}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-grid-color-input")},e}_applySettingsDialogLayout(e,t,a){const i=this;e.classList.add("smart-grid-dialog-expand-row");const l=e._rowStyle=JSON.parse(JSON.stringify(a._style)),n=e._rowComments=JSON.parse(JSON.stringify(a.comments)),o=[];e.columnVisibility=o;const r=document.createElement("div"),s=document.createElement("div"),d=document.createElement("div");d.appendChild(r),d.appendChild(s),t.appendChild(d),d.classList.add("smart-grid-edit-dialog-layout"),r.classList.add("smart-grid-edit-dialog-editors-container"),s.classList.add("smart-grid-edit-dialog-activity-container");let c=0;for(let e=0;e<i.columns.length;e++){const t=i.columns[e];t.allowEdit&&!1!==t._visible&&c++}c>=8?r.classList.add("many"):r.classList.remove("many"),e.editorsContent=r,e.activityContent=s;const m=document.createElement("div"),u=document.createElement("div");s.appendChild(m),s.appendChild(u);let b=n&&n.length?" ("+n.length+")":"";m.innerHTML=`\n <div class="tabs">\n <div view="details" class="active tab"><div class="tab-label">${i.localize("detailsTab")}</div></div>\n <div view="comments" class="tab"><div class="tab-label">${i.localize("commentsTab")}${b}</div></div>\n <div view="history" class="tab smart-hidden"><div class="tab-label">${i.localize("historyTab")}</div></div>\n </div>\n <div class="details-tab">\n <div class="smart-grid-edit-dialog-row"><div class="column"><div class="header smart-grid-edit-dialog-column-info">${i.localize("format").replace(":","")}\n <span title="${i.localize("resetFormat")}" class="reset-format smart-grid-icon smart-icon-reload show"></span>\n </div>\n </div>\n <div class="format-layout">\n <div title="${i.localize("background")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-color-background show"></span><div class="background"></div>\n </div>\n <div title="${i.localize("color")}" class="format smart-grid-edit-dialog-column-info">\n <span style="border-bottom: 2px solid #46CA78;" color="#46CA78" class="format smart-grid-icon smart-icon-font show"></span><div class="color"></div>\n </div>\n <div class="format-layout button-group">\n <span title="${i.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${i.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${i.localize("underline")}" class="formatbtn underline smart-grid-icon smart-icon-underline show"></span>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("fontFamily").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-font show"></span><div class="font-family"></div>\n </div>\n <div title="${i.localize("fontSize").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-fontsize show"></span><div class="font-size"></div>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${i.localize("status").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span color="#F1C58B" class="smart-grid-icon smart-icon-star show"></span><div class="status"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="comments-tab smart-hidden">\n <div class="column"><div class="comments-header smart-grid-edit-dialog-column-info">${i.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments">${i.localize("noComments")}</span></div>\n <div class="footer">\n <smart-text-area hint="${i.localize("comment")}" placeholder="${i.localize("comment")}" class="success underlined"></smart-text-area>\n <smart-button class="success">${i.localize("send")}</smart-button>\n </div>\n </div>\n </div>\n <div class="history-tab smart-hidden">\n <div class="history-layout">\n </div>\n </div>\n `;const g=m.querySelectorAll(".tab");i.storeHistory&&(!i._currentUser||i._currentUser&&!i._currentUser.info?g[g.length-1].classList.add("smart-hidden"):g[g.length-1].classList.remove("smart-hidden")),!i.users||i.users&&0===i.users.length||!i._currentUser||i._currentUser&&!i._currentUser.info?g[g.length-2].classList.add("smart-hidden"):g[g.length-2].classList.remove("smart-hidden"),m.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),a=m.querySelector(".details-tab"),l=m.querySelector(".comments-tab"),n=m.querySelector(".history-tab");a.classList.add("smart-hidden"),l.classList.add("smart-hidden"),n.classList.add("smart-hidden");for(let e=0;e<g.length;e++)g[e].classList.remove("active");switch(t.classList.add("active"),e){case"details":a.classList.remove("smart-hidden");break;case"comments":l.classList.remove("smart-hidden");break;case"history":n.classList.remove("smart-hidden"),i._refreshHistory()}}};const p=i._getColorInput();m.querySelector(".background").appendChild(p),p.onchange=()=>{l.background=p.value},l.background&&(p.value=l.background);const y=i._getColorInput();m.querySelector(".color").appendChild(y),y.onchange=()=>{l.color=y.value},l.color&&(y.value=l.color);const v=i._getColorInput();m.querySelector(".status").appendChild(v),v.onchange=()=>{l.status=v.value},l.status&&(v.value=l.status);const f=document.createElement("smart-input");f.style.width="auto",f.classList.add("underlined"),f.dropDownButtonPosition="right",f.readonly=!0,f.dropDownHeight="auto",f.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],f.onchange=()=>{l.fontFamily=f.value},l.fontFamily?f.value=l.fontFamily:f.selectedIndex=0,m.querySelector(".font-family").appendChild(f);const h=document.createElement("smart-input");h.style.width="auto",h.classList.add("underlined"),h.dropDownButtonPosition="right",h.readonly=!0,h.dropDownHeight="auto",h.dataSource=["-","8px","10px","12px","14px","18px","24px","36px"],h.onchange=()=>{l.fontSize=h.value},l.fontSize?h.value=l.fontSize:h.selectedIndex=0,m.querySelector(".font-size").appendChild(h);const C=m.querySelector(".button-group");C.onclick=e=>{const t=e.target.closest(".formatbtn");let a;t.classList.contains("checked")?(t.classList.remove("checked"),a=!1):(t.classList.add("checked"),a=!0),t.classList.contains("bold")?l.fontWeight=a?"bold":null:t.classList.contains("italic")?l.fontStyle=a?"italic":null:t.classList.contains("underline")&&(l.textDecoration=a?"underline":null)},l.fontWeight?C.children[0].classList.add("checked"):C.children[0].classList.remove("checked"),l.fontStyle?C.children[1].classList.add("checked"):C.children[1].classList.remove("checked"),l.textDecoration?C.children[2].classList.add("checked"):C.children[2].classList.remove("checked"),m.querySelector(".reset-format").onclick=()=>{for(let e=0;e<C.children.length;e++)C.children[e].classList.remove("checked");f.selectedIndex=0,h.selectedIndex=0,y.value="",p.value="",v.value="",l.fontWeight=null,l.fontStyle=null,l.textDecoration=null,l.fontSize=null,l.fontFamily=null};const w=m.querySelector(".comments-header"),S=m.querySelector('[view="comments"]'),A=m.querySelector(".comments-layout smart-text-area"),D=m.querySelector(".comments-layout smart-button"),L=m.querySelector(".comments-layout .footer"),_=m.querySelector(".comments-layout .comments");D.disabled=!0,_.innerHTML=`<span class="no-comments">${i.localize("noComments")}</span>`;const k=()=>{const e=_.querySelector(".no-comments");0===n.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},x=e=>{e.querySelector(".remove-button").onclick=e=>{const t=e.target,l=n.indexOf(t.comment);if(l>-1){const e=n[l];n.splice(l,1),i.$.fireEvent("commentRemove",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,n),t.element.remove();const o=n.length?"("+n.length+")":"";w.innerHTML=S.innerHTML=`${i.localize("comments").replace(":","")} ${o}`}}};for(let e=0;e<n.length;e++){const t=n[e],a=i._createComment(t);x(a),_.appendChild(a)}w.innerHTML=`${i.localize("comments").replace(":","")} ${b}`,k(),A.onfocus=()=>{L.classList.add("focus")},A.onblur=()=>{L.classList.remove("focus")},A.onkeyup=()=>{D.disabled=""===A.value},D.onclick=()=>{if(""===A.value)return;i._refreshCurrentUser();const e={text:A.value,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:i._currentUser.info?i._currentUser.info.id:-1,time:new Date},t=i._createComment(e);x(t),n.push(e),i.$.fireEvent("commentAdd",{id:a.id,value:e}),i.onComment&&i.onComment(a.id,n),A.value="",D.disabled=!0,k(),_.appendChild(t);const l=n.length?"("+n.length+")":"";w.innerHTML=S.innerHTML=`${i.localize("comments").replace(":","")} ${l}`};for(let e=0;e<i.columns.length;e++){const t=i.columns[e];if(!t.allowEdit||!1===t._visible)continue;const a=document.createElement("div");a.classList.add("smart-grid-edit-dialog-row"),r.appendChild(a);const l=document.createElement("div"),n=i._settingsDialogRowId?document.createElement("div"):document.createElement("label"),s=t.validationRules&&t.validationRules.length>0?"*":"";n.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${i.columns[e].icon} show"></span><label>`+i.columns[e].label+s+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const d=document.createElement("div");d.classList.add("smart-grid-dialog-editor"),d.setAttribute("editor",t.dataField),d.setAttribute("template",t.editor.template);const c=n.querySelector("[toggle]");c.column=t,o[t.dataField]=t.visible,c.title=i.localize("columnMenuItemHide"),!1===i.editing.enabled&&c.classList.add("smart-visibility-hidden"),c.onclick=()=>{o[c.column.dataField]=!c.column.visible,c.classList.contains("smart-icon-visibility-on")?(c.classList.remove("smart-icon-visibility-on"),c.classList.add("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemShow")):(c.classList.add("smart-icon-visibility-on"),c.classList.remove("smart-icon-visibility-off"),c.title=i.localize("columnMenuItemHide"))},t.visible||(c.classList.remove("smart-icon-visibility-on"),c.title=i.localize("columnMenuItemShow")),t.visible?c.classList.add("smart-icon-visibility-on"):c.classList.add("smart-icon-visibility-off"),l.appendChild(n),l.appendChild(d);const m=document.createElement("label");m.classList.add("smart-field-editor-error-label"),m.setAttribute("label-for",t.dataField),l.appendChild(m),a.appendChild(l)}}_refreshHistory(){const e=this,t=e._dialogEdit;if(!t)return;const a=t.querySelector(".history-layout");if(!e.storeHistory)return void a.classList.add("smart-hidden");if(!e._currentUser||e._currentUser&&!e._currentUser.info)return void a.classList.add("smart-hidden");a.classList.remove("smart-hidden");const i=t.row.history;if(!i)return;let l="\n ";for(let t=i.length-1;t>=0;t--){const a=i[t];let n="";if(e._kanban)n=e._kanban._getHistoryItemLabel(a);else if("created"===a.action)n=e.localize("rowCreated",{value:a.action});else{const t=e.columnByDataField[a.action];n=e.localize("propertyUpdated",{value:t?t.label:a.action})}if(l+='<div class="history-row">',void 0!==a.user){const t=(t=>{const a=t?t.image:null;return{image:a?`background-image: url('${a}');`:"",label:t?t.name||t.id:e.localize("guestUser"),cssClass:a?"image":""}})(e.users.find((e=>e.id===a.user)));l+=`<div class="history-user"><div class="user-icon smart-user ${t.cssClass}" style="${t.image}"></div><div class="user-name">${t.label}</div><div class="time">${new Smart.Utilities.DateTime(a.date).toString("dd/MM/yyyy hh:mm")}</div></div>`}else l+="<div></div>";if(l+='<div class="history-action">',l+=`<div>${n}</div>`,"created"!==a.action){let t=a.details.oldValue,i=a.details.value;if("user"===a.action){const a=e.users.find((e=>e.id===t||e.id===parseFloat(t))),l=e.users.find((e=>e.id===i||e.id===parseFloat(i)));a?t=a.name:(t="",t||(t=e.localize("unassigned"))),l?i=l.name:(i="",i||(i=e.localize("unassigned")))}if("subtasks"===a.action){const t=a.details.value.filter((e=>e.completed));e._kanban?l+=`<span class="detail smart-truncate">${e._kanban.localize("taskSubtasksCompleted",{value:t.length+"/"+a.details.value.length})}</span>`:l+=`<span class="detail smart-truncate">${e.localize("nullRange",{value:t.length})}</span>`}else{t&&"object"==typeof t&&t instanceof Date&&(t=t.toLocaleString()),i&&"object"==typeof i&&i instanceof Date&&(i=i.toLocaleString());let n=e.columnByDataField[a.action];n||(n=e.columnByDataField["task"+a.action.substring(0,1).toUpperCase()+a.action.substring(1)]),"user"===a.action&&(n=e.columnByDataField.taskUserId);let o="";n&&n.label&&(o='"'+n.label+'"'),n&&"date"===n.dataType&&(t&&"string"==typeof t&&(t=new Date(t).toLocaleString()),i&&"string"==typeof i&&(i=new Date(i).toLocaleString())),l+=t?`<span class="detail smart-truncate">${e.localize("range",{column:o,oldValue:t,newValue:i})}</span>`:`<span class="detail smart-truncate">${e.localize("nullRange",{column:o,oldValue:t,newValue:i})}</span>`}}else l+=`<div>${a.details.value}</div>`;l+="</div>\n </div>"}l+="",a.innerHTML=l}_createComment(e){const t=this,a=t.users.find((t=>t.id===e.userId)),i=document.createElement("div"),l=a?a.name||a.id:t.localize("guestUser"),n=a?a.name:t.localize("guestUser"),o=a.image?a.image:"";if(i.className="comment",i.setAttribute("role","listitem"),i.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${l}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${n}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser.info&&a.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n</div>\n<div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,o){const e=i.querySelector(".user-icon");e.style.backgroundImage=`url('${o}')`,e.classList.add("image")}i.comment=e;const r=i.querySelector(".remove-button");return r.comment=e,r.element=i,e.userId!==t._currentUser.info.id&&r.classList.add("smart-visibility-hidden"),i}_openSummaryRowDialog(e){const t=this,a=t._summaryRowDialog||t._createDialog(),i="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(a.header.innerHTML=i,!a.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",a.content.innerHTML="",a.listBox=e}const l=a.listBox;a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser");const n=e.element.querySelector(".summary-value");if(!n)return;n.classList.add("summary-chooser"),a.summaryValueElement=n;let o=[];a.dataField=e.column.dataField,o="string"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:"boolean"===e.column.dataType||"any"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"}]:"date"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:[{label:t.localize("countSummary"),value:"count"},{label:t.localize("minSummary"),value:"min"},{label:t.localize("maxSummary"),value:"max"},{label:t.localize("sumSummary"),value:"sum"},{label:t.localize("avgSummary"),value:"avg"}],l.dataSource=o,l.style.position="absolute",l.style.visibility="hidden",l.style.height="auto",t.isInShadowDOM?t.getRootNode().appendChild(l):document.body.appendChild(l);const r=e.column;r.summary&&r.summary.forEach((e=>{l.select(e)}));const s=l.offsetHeight;a.column=r,a.content.appendChild(l),a.classList.add("smart-grid-dialog-summary"),a.header.parentElement.classList.add("smart-hidden"),a.footer.classList.add("smart-hidden"),l.style.visibility="",l.style.position="",l.style.width="100%",t._summaryRowDialog||(a.btnConfirm.innerHTML=t.localize("apply"),a.btnCancel.innerHTML=t.localize("cancel"),a.style.width=a.style.minWidth="120px",a.onOpen=function(){t.editing.dialog.visible=!0},a.onClose=function(){t.editing.dialog.visible=!1,a.summaryValueElement&&a.summaryValueElement.classList.remove("summary-chooser")},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e=a.column.summary;a.column.summary=l.selectedValues,t.$.fireEvent("columnSummaryChange",{column:a.column,dataField:r.dataField,oldSummary:[...e],summary:[...a.column.summary]}),a.close(),t._calculateSummary(),t._recycle(!1)},a.confirm=function(){a.btnConfirm.click()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},t._summaryRowDialog=a);const d=e.element,c=t.offset(d),m=t.offset(t);let u=d.offsetWidth+c.left-m.left-120;u<0&&(u=c.left-m.left),a.open(u,c.top-m.top-s-0),setTimeout((function(){a.btnConfirm.focus()}),100)}_openDescriptionDialog(e,t){const a=this,i=a._dialogDescription||a._createDialog(),l=a.localize("dialogDescriptionHeader",{value:e.label});if(i.header.innerHTML=l,i.column=e,i.command=t,i.classList.add("smart-grid-dialog-add-column"),!a._dialogDescription){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){const e=i.querySelector("smart-input");"duplicate"!==t&&setTimeout((()=>{e.select()}),250)},i.onClose=function(){},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){const e=i.querySelector("smart-input");switch(i.command){case"duplicate":0===e.selectedIndex?a.duplicateCommand(i.column,null,!0):a.duplicateCommand(i.column,null,!1);break;case"rename":i.column.label=e.value;break;case"editDescription":i.column.description=e.value}i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogDescription=i;const e=document.createElement("smart-input");e.classList.add("underlined"),e.dataSource="duplicate"!==t?[]:[{label:a.localize("duplicateCells"),value:"cells"},{label:a.localize("duplicateSettings"),value:"settings"}],i.content.appendChild(e)}const n=e.element,o=a.offset(n),r=a.offset(a);i.open(o.left-r.left,o.top+n.offsetHeight-r.top);const s=i.querySelector("smart-input");switch(s.selectedIndex=0,s.readonly=!0,s.dropDownButtonPosition="right",t){case"rename":s.value=e.label;break;case"editDescription":s.value=e.description}setTimeout((function(){i.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const a=this;if(!a.editing.deleteDialog.enabled)return!1;const i=a._dialogDelete||a._createDialog(),l="{{message}}"===a.editing.dialog.header?a.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):a.editing.dialog.header;i.header.innerHTML=l,i.content.innerHTML=a.localize("dialogDeleteContent"),i.row=e,a._dialogDelete||(i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogDeleteButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogDeleteButtonCancel"),i.onOpen=function(){a.editing.dialog.visible=!0},i.onClose=function(){a.editing.dialog.visible=!1},i.btnCancel.onclick=function(){i.close()},i.btnClose.onclick=function(){i.close()},i.btnConfirm.onclick=function(){t(i.row),i.close()},i.onkeydown=function(e){"Escape"===e.key&&i.close()},a._dialogDelete=i),i.open(),setTimeout((function(){i.btnConfirm.focus()}),100)}_getTypesList(){const e=this,t=[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"image",prefix:'<span class="smart-grid-icon visible smart-icon-image"></span>',label:e.localize("dialogAddColumnTypeImage")},{value:"number",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeNumber")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")},{value:"boolean",prefix:'<span class="smart-grid-icon visible smart-icon-check-squared"></span>',label:e.localize("dialogAddColumnTypeCheckBox")},{value:"date",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDate")},{value:"createdTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeCreatedTime")},{value:"updatedTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedTime")},{value:"createdBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCreatedBy")},{value:"updatedBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeLastUpdatedBy")},{value:"collaborator",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCollaborator")},{value:"slider",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeSlider")},{value:"autoNumber",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeAutoNumber")},{value:"url",prefix:'<span class="smart-grid-icon visible smart-icon-link"></span>',label:e.localize("dialogAddColumnTypeURL")},{value:"email",prefix:'<span class="smart-grid-icon visible smart-icon-mail"></span>',label:e.localize("dialogAddColumnTypeEmail")},{value:"phone",prefix:'<span class="smart-grid-icon visible smart-icon-phone"></span>',label:e.localize("dialogAddColumnTypePhone")},{value:"password",prefix:'<span class="smart-grid-icon visible smart-icon-lock"></span>',label:e.localize("dialogAddColumnTypePassword")}];if(e.header.visible&&e.header.buttons.indexOf("views")>=0){const a={value:"startDate",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeStartDate")},i={value:"dueDate",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDueDate")},l={value:"progress",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeProgress")},n={value:"priority",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypePriority")},o={value:"status",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("status")},r={value:"name",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeName")},s={value:"description",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeDescription")},d={value:"tags",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeTags")},c={value:"checklist",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeChecklist")},m={value:"color",prefix:'<span class="smart-grid-icon visible smart-icon-color-background"></span>',label:e.localize("dialogAddColumnTypeColor")};t.push(a),t.push(i),t.push(l),t.push(n),t.push(r),t.push(s),t.push(d),t.push(c),t.push(m),t.push(o)}return t}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),a=new Date(t,6,30);return[{bind:"kanban",name:"kanban",type:"radio",label:e.localize("kanbanNoneDescription"),filter:"kanban",options:[{value:"blank",checked:!0,label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]},{bind:"kanbanNotes",name:"kanbanNotes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",placeholder:e.localize("dialogAddColumnNamePlaceholder"),info:e.localize("dialogAddColumnNameInfo")},{bind:"description",type:"input",label:e.localize("dialogAddColumnDescription"),filter:"any",placeholder:e.localize("dialogAddColumnDescriptionPlaceholder"),info:e.localize("dialogAddColumnDescriptionInfo")},{bind:"type",name:"typeslist",type:"dropDownList",filter:"any",label:e.localize("dialogAddColumnType"),icon:"smart-icon-font",options:e._getTypesList(),info:e.localize("dialogAddColumnTypeInfo")},{bind:"dateFormat",name:"dateformat",type:"dropDownList",label:e.localize("dialogAddColumnDateFormat"),options:[{value:"M/d/yyyy",label:e.localize("dialogAddColumnDateFormatShort")+" ("+new Smart.Utilities.DateTime(a).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(a).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(a).toString("ISO8601")+")"},{value:"d/M/yyyy",label:e.localize("dialogAddColumnDateFormatEU")+" (30/7/"+t+")"},{value:"yyyy-MM-dd",label:e.localize("dialogAddColumnDateFormatAS")+" ("+t+"-30-07)"},{value:"MMMM, dd, yyyy",label:e.localize("dialogAddColumnDateFormatFull")+" (July, 30, "+t+")"}],filter:"date",info:e.localize("dialogAddColumnDateFormatInfo")},{bind:"timeFormat",name:"timeformat",type:"dropDownList",label:e.localize("dialogAddColumnTimeFormat"),filter:"time",width:"50%",options:[{value:"hh:mm",label:"12 "+e.localize("dialogAddColumnTimeFormatHour")},{value:"HH:mm",label:"24 "+e.localize("dialogAddColumnTimeFormatHour")}],info:e.localize("dialogAddColumnTimeFormatInfo")},{bind:"allowTimeFormat",type:"boolean",label:e.localize("dialogAddColumnAllowTimeFormat"),filter:"date",value:!1,info:""},{bind:"allowCustomDateSeparator",type:"boolean",label:e.localize("dialogAddColumnCustomDateSeparator"),filter:"date",value:!1,info:""},{bind:"dateFormatSeparator",name:"dateFormatSeparator",type:"radio",label:"",filter:"date",columns:3,options:[{value:"/",label:e.localize("dialogAddColumnDateFormatSlash")+" (/)"},{value:"-",label:e.localize("dialogAddColumnDateFormatHyphen")+" (-)"},{value:".",label:e.localize("dialogAddColumnDateFormatDot")+" (.)"}]},{bind:"numberFormat",name:"numberFormat",type:"dropDownList",label:e.localize("dialogAddColumnNumberFormat"),filter:"number",options:[{value:{style:"decimal",maximumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatInteger")+" 1,000"},{value:{style:"decimal",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatNumber")+" 1,000.12"},{value:{style:"percent",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatPercent")+" 10.12%"},{value:{style:"percent",maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatPercentRounded")+" 10%"},{value:{style:"decimal",notation:"scientific"},label:e.localize("dialogAddColumnNumberFormatScientific")+" 1.01E+03"},{value:{style:"decimal",notation:"engineering"},label:e.localize("dialogAddColumnNumberFormatEngineering")+" 34.284 x 10^9"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,currencySign:"accounting"},label:e.localize("dialogAddColumnNumberFormatAccounting")+" $(1,000.12)"},{value:{style:"unit",unit:"kilogram"},label:e.localize("dialogAddColumnNumberFormatUnit")+" 10.12 kg"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency},label:e.localize("dialogAddColumnNumberFormatCurrency")+" $1,000.12"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatCurrencyRounded")+" $1,000"}],required:!1,info:e.localize("dialogAddColumnNumberFormatInfo")},{bind:"currency",name:"currency",type:"dropDownList",filter:"number",required:!1,options:e._getCurrencies(),label:e.localize("dialogAddColumnNumberFormatCurrency"),info:e.localize("dialogAddColumnNumberFormatCurrencyInfo")},{bind:"unit",name:"unit",type:"dropDownList",filter:"number",required:!1,options:[{value:"acre",label:e.localize("dialogAddColumnNumberFormatUnitAcre")},{value:"percent",label:e.localize("dialogAddColumnNumberFormatUnitPercent")},{value:"degree",label:e.localize("dialogAddColumnNumberFormatUnitDegree")},{value:"megabyte",label:e.localize("dialogAddColumnNumberFormatUnitMegaByte")},{value:"centimeter",label:e.localize("dialogAddColumnNumberFormatUnitCentimeter")},{value:"meter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")},{value:"kilometer",label:e.localize("dialogAddColumnNumberFormatUnitKilometer")},{value:"mile",label:e.localize("dialogAddColumnNumberFormatUnitMile")},{value:"celsius",label:e.localize("dialogAddColumnNumberFormatUnitCelsius")},{value:"fahrenheit",label:e.localize("dialogAddColumnNumberFormatUnitFahrenheit")},{value:"kilogram",label:e.localize("dialogAddColumnNumberFormatUnitKilogram")},{value:"pound",label:e.localize("dialogAddColumnNumberFormatUnitPound")},{value:"liter",label:e.localize("dialogAddColumnNumberFormatUnitLiter")},{value:"gallon",label:e.localize("dialogAddColumnNumberFormatUnitGallon")},{value:"second",label:e.localize("dialogAddColumnNumberFormatUnitSecond")},{value:"minute",label:e.localize("dialogAddColumnNumberFormatUnitMinute")},{value:"hour",label:e.localize("dialogAddColumnNumberFormatUnitHour")},{value:"day",label:e.localize("dialogAddColumnNumberFormatUnitDay")},{value:"week",label:e.localize("dialogAddColumnNumberFormatUnitWeek")},{value:"month",label:e.localize("dialogAddColumnNumberFormatUnitMonth")},{value:"year",label:e.localize("dialogAddColumnNumberFormatUnitYear")}],label:e.localize("dialogAddColumnNumberFormatUnit"),info:e.localize("dialogAddColumnNumberFormatUnitInfo")},{bind:"minLength",name:"minlength",width:"50%",type:"number",filter:"text",required:!1,label:e.localize("dialogAddColumnMinLength"),info:e.localize("dialogAddColumnMinLengthInfo")},{bind:"maxLength",name:"maxlength",width:"50%",filter:"text",type:"number",required:!1,label:e.localize("dialogAddColumnMaxLength"),info:e.localize("dialogAddColumnMaxLengthInfo")},{bind:"minValue",name:"minvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMinValue"),info:e.localize("dialogAddColumnMinValueInfo")},{bind:"maxValue",name:"maxvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMaxValue"),info:e.localize("dialogAddColumnMaxValueInfo")},{bind:"minDateTime",name:"mindatetime",type:"datetime",filter:"date",width:"50%",label:e.localize("dialogAddColumnMinDate"),info:e.localize("dialogAddColumnMinDateInfo")},{bind:"maxDateTime",name:"maxdatetime",type:"datetime",width:"50%",filter:"date",label:e.localize("dialogAddColumnMaxDate"),info:e.localize("dialogAddColumnMaxDateInfo")},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"allowCheckItems",type:"boolean",filter:"hidden",value:!1,label:e.localize("dialogAddColumnCheckItems"),info:""},{bind:"allowMultipleCollaborators",type:"boolean",filter:"collaborator",value:!1,label:e.localize("dialogAddColumnMultipleCollaborators"),info:e.localize("dialogAddColumnMultipleCollaboratorsInfo")},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""},{bind:"users",name:"users",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"collaborator",info:""},{name:"align",bind:"cellsAlign",type:"dropDownList",label:e.localize("dialogAddColumnAlign"),required:!1,options:[{value:"left",label:e.localize("dialogAddColumnAlignLeft")},{value:"right",label:e.localize("dialogAddColumnAlignRight")},{value:"center",label:e.localize("dialogAddColumnAlignCenter")}],filter:"any",info:e.localize("dialogAddColumnAlignInfo")},{bind:"allowResize",type:"boolean",filter:"any",width:"50%",label:e.localize("dialogAddColumnResizable"),info:e.localize("dialogAddColumnResizableInfo")},{bind:"required",type:"boolean",width:"50%",filter:"text",value:!1,label:e.localize("dialogAddColumnRequired"),info:e.localize("dialogAddColumnRequiredInfo")},{bind:"allowSort",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnSortable"),info:e.localize("dialogAddColumnSortableInfo")},{bind:"allowFilter",type:"boolean",align:"left",width:"50%",filter:"any",label:e.localize("dialogAddColumnFilterable"),info:e.localize("dialogAddColumnFilterableInfo")},{bind:"allowEdit",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnEditable"),info:e.localize("dialogAddColumnEditableInfo")}]}_getKanbanFields(){return["startDate","dueDate","progress","checklist","priority","tags","name","color","description","status"]}_addColumnDialogShowHideEditors(e){const t=this,a=t._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input").getSelectedItem().value,i=t._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),l=t._getKanbanFields(),n=t._dialogAddColumn.querySelector('[field-name="kanbanNotes"]');n&&("kanban"!==t.view?n.classList.add("smart-hidden"):n.classList.remove("smart-hidden"));let o=!!e;for(let n=0;n<i.length;n++){const r=i[n],s=r.getAttribute("filter"),d=r.getAttribute("bind"),c=r.parentNode;if(c.classList.add("smart-hidden"),"cellsAlign"===d&&("boolean"===a||"image"===a||"email"===a||"url"===a||"collaborator"===a||"createdBy"===a||"password"===a||"phone"===a||"createdTime"===a||"updatedBy"===a||"updatedTime"===a||l.indexOf(a)>=0))c.classList.add("smart-hidden");else if("type"===d&&o)c.classList.add("smart-hidden");else if("allowEdit"===d&&(!1===t.editing.enabled||"autoNumber"===a||"createdBy"===a||"updatedBy"===a||"createdTime"===a||"updatedTime"===a||l.indexOf(a)>=0))c.classList.add("smart-hidden");else if("allowResize"!==d||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==d||!1!==t.filtering.enabled)if("allowSort"!==d||!1!==t.sorting.enabled)if("required"!==d||!1!==t.editing.enabled&&("string"===a||"multiText"===a))if(e&&e.disabledDialogOptions&&e.disabledDialogOptions.length>0&&e.disabledDialogOptions.indexOf(d)>=0)c.classList.add("smart-hidden");else{if(e&&"kanban"===t.view){switch(d){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":c.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===s&&c.classList.remove("smart-hidden")}if("any"!==s)switch(a){default:case"text":"text"===s&&c.classList.remove("smart-hidden"),e&&"any"===e.dataType&&c.classList.add("smart-hidden");break;case"slider":case"number":if("number"===s&&c.classList.remove("smart-hidden"),"unit"===d||"currency"===d){c.classList.add("smart-hidden");const e=t._dialogAddColumn.querySelector('[field-name="numberFormat"]'),a=t._dialogAddColumn.querySelector('[field-name="unit"]'),i=t._dialogAddColumn.querySelector('[field-name="currency"]'),l=e.querySelector("smart-input"),n=()=>{const e=l.getSelectedItem();i.classList.add("smart-hidden"),e&&"unit"===e.value.style?a.classList.remove("smart-hidden"):e&&"currency"===e.value.style?i.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};e.onchange=()=>{n()},n()}break;case"select":case"multiSelect":s.indexOf("list")>=0&&c.classList.remove("smart-hidden");break;case"collaborator":s.indexOf("collaborator")>=0&&c.classList.remove("smart-hidden");break;case"createdBy":case"updatedBy":case"autoNumber":case"createdTime":case"updatedTime":case"url":case"email":case"image":case"phone":case"password":case"startDate":case"dueDate":case"progress":case"checklist":case"priority":case"tags":case"name":case"description":case"assigned":case"status":case"boolean":break;case"date":{const e=t._dialogAddColumn.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;"date"===s&&c.classList.remove("smart-hidden");const a=e=>{const a=t._dialogAddColumn.querySelector('[field-filter="time"]'),i=t._dialogAddColumn.querySelector('[field-name="dateFormat"]');e?(a.classList.remove("smart-hidden"),i.style.width="50%",i.style.float="left"):(a.classList.add("smart-hidden"),i.style.width="",i.style.float="")},i=e=>{const a=t._dialogAddColumn.querySelector('[field-name="allowTimeFormat"]'),i=a.querySelector(".smart-grid-dialog-editor");e.indexOf("T")>=0?(a.classList.add("smart-hidden"),i.uncheck()):a.classList.remove("smart-hidden")},l=e=>{const a=t._dialogAddColumn.querySelector('[field-name="dateFormatSeparator"]');e?a.classList.remove("smart-hidden"):a.classList.add("smart-hidden")};if("allowTimeFormat"===d){const e=r.querySelector(".smart-input").value;r.onchange=e=>{a(e)},a(e)}if("dateFormat"===d){const e=r.querySelector(".smart-input").value;r.onchange=e=>{i(e.detail.value)},i(e)}if("dateFormatSeparator"===d){const e=t._dialogAddColumn.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;l(e)}if("allowCustomDateSeparator"===d){e.indexOf("T")>=0&&e.indexOf("-")>0&&r.uncheck();const t=r.querySelector(".smart-input").value;r.onchange=e=>{l(e)},l(t)}i(e);break}}else c.classList.remove("smart-hidden")}else c.classList.add("smart-hidden");else c.classList.add("smart-hidden");else c.classList.add("smart-hidden");else c.classList.add("smart-hidden")}}_addColumnDialogInitEditors(){const e=this,t=e._dialogAddColumn.editColumn,a=e._getAddColumnDialogTemplate();for(let i in e._addColumnDialogEditors){const l=e._addColumnDialogEditors[i],n=l.querySelector("input"),o=l.querySelector("smart-input");switch(i){case"allowTimeFormat":{const e=l.querySelector(".smart-input");t&&t.editor?"dateInput"===t.editor.template?(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowCustomDateSeparator":{const a=l.querySelector(".smart-input");a.value=!1,a.removeAttribute("checked");let i=0;t&&t.cellsFormat&&(t.cellsFormat.indexOf(".")>=0?(a.value=!0,a.setAttribute("checked",""),i=2):(t.cellsFormat.indexOf("M-d-yyyy")>=0||t.cellsFormat.indexOf("d-M-yyyy")>=0||t.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(a.value=!0,a.setAttribute("checked",""),i=1));const n=e._addColumnDialogEditors.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");n.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n[i].setAttribute("checked",""),n[i].value=!0;break}case"kanban":{const t=l.querySelectorAll(".smart-grid-dialog-boolean-field");for(let a=0;a<t.length;a++)t[a].onchange=t=>{const a=[...t.parentElement.children].indexOf(t),i=t.parentElement.parentElement.previousElementSibling,l=e._dialogAddColumn.querySelector('[field-name="options"]'),n=e._dialogAddColumn.querySelector('[field-name="allowColorItems"]'),o=e._addColumnDialogEditors.name,r=()=>{const t=l.querySelector("smart-sortable");t&&(t._validate(),e._dialogAddColumn&&e._dialogAddColumn.offsetHeight&&e._dialogAddColumn.setPosition("center"))};switch(a){case 0:i.innerHTML=e.localize("kanbanNoneDescription"),n.classList.add("smart-hidden"),l.classList.add("smart-hidden"),o.querySelector("input").value=e.localize("dialogNewColumn"),r();break;case 1:i.innerHTML=e.localize("kanbanBasicDescription"),n.classList.remove("smart-hidden"),l.classList.remove("smart-hidden"),o.querySelector("input").value=e.localize("status"),r()}};break}case"dateFormat":t&&t.cellsFormat?t.cellsFormat.indexOf("M/d/yyyy")>=0?o.selectedIndex=0:t.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?o.selectedIndex=1:t.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?o.selectedIndex=2:t.cellsFormat.indexOf("d/M/yyyy")>=0?o.selectedIndex=3:t.cellsFormat.indexOf("yyyy-MM-dd")>=0?o.selectedIndex=4:t.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(o.selectedIndex=5):o.selectedIndex=0;break;case"timeFormat":t&&t.cellsFormat&&t.cellsFormat.indexOf("HH")>=0&&-1===t.cellsFormat.indexOf("T")?o.selectedIndex=1:o.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!0;t&&t.editor&&t.editor.singleSelect&&(e=!1);const a=l.querySelector(".smart-input");t?e?(a.value=!0,a.setAttribute("checked","")):(a.value=!1,a.removeAttribute("checked")):(a.value=!0,a.setAttribute("checked",""));break}case"numberFormat":if(t&&"numberInput"===t.editor.template&&t.editor.numberFormat)if("decimal"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=0;else if("decimal"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=1;else if("percent"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=2;else if("percent"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=3;else if("decimal"===t.editor.numberFormat.style&&"scientific"===t.editor.numberFormat.notation)o.selectedIndex=4;else if("decimal"===t.editor.numberFormat.style&&"engineering"===t.editor.numberFormat.notation)o.selectedIndex=5;else if("currency"===t.editor.numberFormat.style&&"accounting"===t.editor.numberFormat.currencySign)o.selectedIndex=6;else if("unit"===t.editor.numberFormat.style){o.selectedIndex=7;const a=t.editor.numberFormat.unit,i=e._addColumnDialogEditors.unit.querySelector("smart-input");i.dataSource.forEach(((e,t)=>{if(e.value===a)return i.selectedIndex=t,!0}))}else"currency"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits&&0===t.editor.numberFormat.minimumFractionDigits?o.selectedIndex=9:"currency"===t.editor.numberFormat.style&&(o.selectedIndex=8);else o.selectedIndex=0;break;case"currency":if(t&&"numberInput"===t.editor.template&&t.editor.numberFormat){if("currency"===t.editor.numberFormat.style){const a=e._getCurrencies().findIndex((e=>e.value===t.editor.numberFormat.currency));a>=0&&(o.selectedIndex=a)}}else o.selectedIndex=0;break;case"allowCheckItems":{const e=l.querySelector(".smart-input");t?t.editor&&!t.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowColorItems":{const e=l.querySelector(".smart-input");t?t.editor&&t.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowResize":case"allowSort":case"allowEdit":case"allowFilter":case"required":{const e=l.querySelector(".smart-input"),n=a.find((e=>{if(e.bind===i)return e}));t?t[i]?(e.value=!0,e.setAttribute("checked","")):!1===t[i]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,n&&void 0!==n.value&&(e.value=n.value),e.value&&e.setAttribute("checked",""));break}}if(!t||"options"!==i&&"users"!==i){const t=l.querySelector("smart-sortable");if(t&&t._init)if("users"===i){let a=[];for(let t=0;t<e.users.length;t++)a.push({color:e.users[t].color,label:e.users[t].name,id:e.users[t].id,image:e.users[t].image});t._init(a)}else t._init()}else{const e=l.querySelector("smart-sortable");if(e&&e._init)if(t.editor.singleSelect){const a=t.editor.dataSource.filter((e=>""!==e));e._init(a)}else"multiComboInput"===t.editor.template&&e._init(JSON.parse(JSON.stringify(t.editor.dataSource)))}if(t&&"type"===i?("number"===t.dataType||"int"===t.dataType?o.selectedIndex=3:"date"===t.dataType?o.selectedIndex=7:"bool"!==t.dataType&&"boolean"!==t.dataType||(o.selectedIndex=6),t.editor&&t.editor.template&&o.dataSource.forEach(((e,a)=>{switch(e.value){case"string":"input"===t.editor.template&&(o.selectedIndex=a);break;case"number":"numberInput"===t.editor.template&&(o.selectedIndex=a);break;case"select":"multiComboInput"===t.editor.template&&t.editor.singleSelect&&"tags"===t.template&&(o.selectedIndex=a);break;case"multiSelect":"multiComboInput"!==t.editor.template||t.editor.singleSelect||"tags"!==t.template||(o.selectedIndex=a);break;case"multiText":"textarea"===t.editor.template&&(o.selectedIndex=a);break;case"date":"dateInput"!==t.editor.template&&"dateTimePicker"!==t.editor.template||(o.selectedIndex=a);break;case"checkBox":"checkBox"===t.editor.template&&(o.selectedIndex=a);break;case"slider":"slider"===t.editor.template&&(o.selectedIndex=a);break;case"image":"image"===t.editor.template&&(o.selectedIndex=a);break;case"updatedTime":"updatedTime"===t.template&&(o.selectedIndex=a);break;case"createdTime":"createdTime"===t.template&&(o.selectedIndex=a);break;case"createdBy":"createdBy"===t.template&&(o.selectedIndex=a);break;case"updatedBy":"updatedBy"===t.template&&(o.selectedIndex=a);break;case"collaborator":"collaborator"===t.template&&t.editor&&t.editor.collaborator&&(o.selectedIndex=a);break;case"autoNumber":"autoNumber"===t.template&&(o.selectedIndex=a);break;case"phone":"phone"===t.template&&(o.selectedIndex=a);break;case"password":"password"===t.template&&(o.selectedIndex=a);break;case"url":"url"===t.template&&(o.selectedIndex=a);break;case"email":"email"===t.template&&(o.selectedIndex=a)}}))):"type"===i&&(o.selectedIndex=0,o.dataSource=e._getTypesList()),"cellsAlign"===i&&t&&("center"===t.cellsAlign||"middle"===t.cellsAlign?o.selectedIndex=2:"right"===t.cellsAlign&&(o.selectedIndex=1)),!n)continue;"dataField"!==i&&"type"!==i&&"timeFormat"!==i&&"dateFormat"!==i&&"numberFormat"!==i&&"currency"!==i&&"unit"!==i&&"cellsAlign"!==i&&o&&(o.selectedIndex=0),"name"===i&&(o.value=t?t.label:"",o.placeholder=a.find((e=>{if(e.bind===i)return e})).placeholder),"description"===i&&(o.value=t?t.description:"",o.placeholder=a.find((e=>{if(e.bind===i)return e})).placeholder);const r=(e,a)=>{t&&t.validationRules.forEach((t=>"minDate"===t.type&&"minDateTime"===e||"maxDate"===t.type&&"maxDateTime"===e||"min"===t.type&&"minValue"===e||"max"===t.type&&"maxValue"===e||t.type===e?(a.value=t.value,!0):void 0))};if("minValue"===i?(n.value=0,r(i,n)):"maxValue"===i?(n.value=100,r(i,n)):"minLength"===i?(n.value=0,r(i,n)):"maxLength"===i&&(n.value=500,r(i,n)),"minDateTime"===i){const e=l.querySelector("smart-date-input");e.value=new Date(1900,0,1),r(i,e)}else if("maxDateTime"===i){const e=l.querySelector("smart-date-input");e.value=new Date(2100,0,1),r(i,e)}}}_createColumnBooleanEditor(e,t,a,i,l){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const n=document.createElement("div");return n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),n.setAttribute("checked",""),n.value=!0,t.width&&(a.style.width=t.width,a.style.float="left"),!1===t.value&&(n.value=!1,n.removeAttribute("checked")),e.appendChild(n),e.getValue=function(){return n.value},e.check=function(){n.setAttribute("checked",""),n.value=!0,e.onchange&&e.onchange(n.value)},e.uncheck=function(){n.removeAttribute("checked"),n.value=!1,e.onchange&&e.onchange(n.value)},e.toggle=function(){!0!==n.value&&!1!==n.value&&null!==n.value&&(n.value=!1),null===n.value?n.value=!1:n.value=!n.value,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),e.onchange&&e.onchange(n.value)},e.onclick=l.onclick=()=>{e.toggle()},i.appendChild(a),a.classList.add("smart-grid-dialog-boolean-field"),a.appendChild(e),a.appendChild(l),e}_getColumnTemplateByType(e){switch(e){case"boolean":case"bool":return"checkBox";case"image":return"image";case"createdBy":case"updatedBy":return e;case"collaborator":case"select":case"multiSelect":return"tags";case"url":return"url";case"email":return"email";case"autoNumber":return"autoNumber";case"password":return"password";case"createdTime":return"createdTime";case"updatedTime":return"updatedTime";default:return""}}_confirmAddColumnDialog(){const e=this,t=e._dialogAddColumn,a=e._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),i=[];let l,n,o={};for(let t=0;t<a.length;t++){const i=a[t],l=i.querySelector(".smart-input"),n=i.getAttribute("bind"),r=i.parentElement;if("kanban"!==n)if("minLength"!==n&&"maxLength"!==n&&"minValue"!==n&&"maxValue"!==n&&"minDateTime"!==n&&"maxDateTime"!==n)if("options"!==n&&"users"!==n){if("allowEdit"===n&&r.classList.contains("smart-hidden"))l.value=!1;else if("required"===n&&r.classList.contains("smart-hidden"))l.value=!1;else if("dateFormatSeparator"===n){const e=i.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.dateFormatSeparatorType="/";break;case 1:o.dateFormatSeparatorType="-";break;case 2:o.dateFormatSeparatorType="."}break}}l&&(l.getSelectedItem?o[n]=l.getSelectedItem().value:o[n]=l.value)}else{const t=[],a=i.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),l=i.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<a.length;e++){const i=a[e],n={label:i.value,value:i.getAttribute("data-item-value"),id:parseInt(i.getAttribute("data-id")),color:l[e].value};n.color=l[e].value,t.push(n)}if("users"===n&&"collaborator"===o.type){e.users||(e.users=[]);for(let a=0;a<t.length;a++){const i=t[a],l=e.users.find((e=>e.id===i.id));l&&(l.name=i.label,l.color=i.color)}}o[n]=t}else o[n]=l.getValue();else{const e=i.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:o.kanban="blank";break;case 1:o.kanban="basic"}break}}}t.data=o;let r={},s={},d="";if(l=o.minDateTime,n=o.maxDateTime,"date"===o.type){r={template:"dateInput",min:l,max:n};let e=!1;"-"!==o.dateFormat&&(d=o.dateFormat,o.allowCustomDateSeparator&&(d.indexOf("/")>=0?d=d.replaceAll("/",o.dateFormatSeparatorType):d.indexOf("-")>=0?d=d.replaceAll("-",o.dateFormatSeparatorType):d.indexOf(".")>=0&&(d=d.replaceAll(".",o.dateFormatSeparatorType))),o.dateFormat.indexOf("T")>=0&&(r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),e=!0),r.autoOpen=!0,o.allowTimeFormat&&"-"!==o.timeFormat&&(e&&(d+=" "),d+=o.timeFormat,r.template="dateTimePicker",r.dropDownDisplayMode="auto",r.formatString=d),i.push({type:"minDate",value:l}),i.push({type:"maxDate",value:n})}else if("number"===o.type||"slider"===o.type){l=parseInt(o.minValue),n=parseInt(o.maxValue),o.numberFormat=JSON.parse(JSON.stringify(o.numberFormat)),"unit"===o.numberFormat.style&&(o.numberFormat.unit=o.unit);let t=null,a=null;"currency"===o.numberFormat.style&&(o.numberFormat.currency=o.currency,o.numberFormat.locale=e._getLocaleByCurrency(o.currency)),r={template:"number"===o.type?"numberInput":"slider",min:l,max:n,numberFormat:o.numberFormat},s={Intl:{NumberFormat:o.numberFormat}},a&&(s=a),d="d",t&&(d=t),i.push({type:"min",value:l}),i.push({type:"max",value:n})}else if("boolean"===o.type)r={template:"checkBox"};else if("image"===o.type)r={template:"image"};else if("select"===o.type||"multiSelect"===o.type){let e=o.options;if("select"===o.type)if(t.editColumn&&!t.editColumn.editor.allowEmptyItem)e=o.options;else{let t=!1;for(let e=0;e<o.options.length;e++)if(""===o.options[e].label){t=!0,o.options[e].value="";break}e=t?o.options:[""].concat(o.options)}r={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:o.allowColorItems,autoOpen:!0,pills:!0,singleSelect:"select"===o.type,dataSource:e}}else if("collaborator"===o.type){let t=o.users;o.allowMultipleCollaborators||(t=[""].concat(o.users));for(let a=0;a<e.users.length;a++)t.forEach((t=>{t.value===e.users[a].id&&(t.image=e.users[a].image,t.id=e.users[a].id)}));r={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:o.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!o.allowMultipleCollaborators,dataSource:t}}else"multiText"===o.type?(l=o.minLength,n=o.maxLength,r={template:"textarea",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n})):"password"===o.type?(l=o.minLength,n=o.maxLength,r={template:"password",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n})):"phone"===o.type?r={template:"phone",required:o.required}:(l=o.minLength,n=o.maxLength,r={template:"input",min:l,max:n,required:o.required},i.push({type:"minLength",value:l}),i.push({type:"maxLength",value:n}));let c="string";switch(o.type){case"boolean":case"bool":c="boolean";break;case"createdTime":case"updatedTime":case"date":c="date";break;case"autoNumber":case"slider":case"number":c="number"}if(e._dialogAddColumn.editColumn){const t=e._dialogAddColumn.editColumn;t.canNotify=!1,t.label=o.name,t.description=o.description,t.showDescriptionButton=!0,t.allowResize=o.allowResize,t.allowSort=o.allowSort,t.allowFilter=o.allowFilter,t.allowEdit=o.allowEdit,t.align=t.cellsAlign=o.cellsAlign,t.cellsFormat=d;const a=t._editorId?t._editorId:"",l=r.template+"_"+t.dataField+a;e._cellEditors[l]&&delete e._cellEditors[l];let n=!0;"list"!==t.template&&"dropDownList"!==t.template||(n=!1),"autoNumber"!==t.template&&"createdBy"!==t.template&&"updatedBy"!==t.template&&"createdTime"!==t.template&&"updatedTime"!==t.template||(n=!1),t.editor&&t.editor.template.indexOf("custom")>=0&&(n=!1),t.editor&&t.editor.disabledDialogOptions&&(n=!1),n&&(t.editor=JSON.parse(JSON.stringify(r)),t.template=e._getColumnTemplateByType(o.type),t._cellsCachedValues=[]),t.formatSettings=s,t._isDirty=!0,o.required&&i.push({type:"required"}),t.validationRules=i,t._state&&["label","description","showDescriptionButton","dataType","editor","formatSettings","template","summary","validationRules","allowResize","allowSort","allowFilter","allowEdit","align","cellsAlign","cellsFormat"].forEach((e=>{t._state[e]=t[e]})),t.canNotify=!0,e.$.fireEvent("closeColumnDialog",{dataField:t.dataField}),e.onColumnUpdated&&e.onColumnUpdated(e.columns.indexOf(t),t),e._onColumnUpdated&&e._onColumnUpdated(t,o),e._recycle(!0),t.refresh(),t._isDirty=!1}else{let t=[];"number"===c&&(t=["sum"]);const a=e._getColumnLabel(o),l=new Smart.Grid.Column({label:a,description:o.description,dataField:o.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:o.allowResize,allowSort:o.allowSort,allowFilter:o.allowFilter,allowEdit:o.allowEdit,showDescriptionButton:!0,dataType:c,editor:r,summary:t,template:e._getColumnTemplateByType(o.type),formatSettings:s,cellsAlign:o.cellsAlign,align:o.cellsAlign,cellsFormat:d,visibleIndex:e.columns.length-1,grid:e});if("autoNumber"===l.template&&(l.autoGenerated=!0,t=[]),o.required&&(i.push({type:"required"}),l.validationRules=i),e._getKanbanFields().indexOf(o.type)>=0){const t=e._getKanbanTaskField(o.type);o.description&&(t.description=o.description),o.name&&(t.label=o.name),t.allowFilter=o.allowFilter,t.allowResize=o.allowResize,t.allowSort=o.allowSort;const a=e.columnByDataField[t.dataField];a&&!1===a._visible?(a.visible=!0,delete a._visible):(a&&(t.dataField=t.displayField="dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),"object"==typeof t.editor&&t.editor.dataSource&&(t.editor.dataSource=JSON.parse(JSON.stringify(t.editor.dataSource))),t.label=t.label+" "+e.localize("copy")),e.columns.push(t))}else e.columns.push(l);e._refreshHeaderBar(),e.$.fireEvent("closeColumnDialog",{dataField:l.dataField})}}_getColumnLabel(e){const t=this;let a=e.name;if(!a){let a="";switch(e.type){case"string":a=t.localize("dialogAddColumnTypeText");break;case"multiText":a=t.localize("dialogAddColumnTypeMultilineText");break;case"image":a=t.localize("dialogAddColumnTypeImage");break;case"number":a=t.localize("dialogAddColumnTypeNumber");break;case"select":a=t.localize("dialogAddColumnTypeSelect");break;case"multiSelect":a=t.localize("dialogAddColumnTypeMultipleSelect");break;case"boolean":a=t.localize("dialogAddColumnTypeCheckBox");break;case"date":a=t.localize("dialogAddColumnTypeDate");break;case"createdTime":a=t.localize("dialogAddColumnTypeCreatedTime");break;case"updatedTime":a=t.localize("dialogAddColumnTypeLastUpdatedTime");break;case"createdBy":a=t.localize("dialogAddColumnTypeCreatedBy");break;case"updatedBy":a=t.localize("dialogAddColumnTypeLastUpdatedBy");break;case"collaborator":a=t.localize("dialogAddColumnTypeCollaborator");break;case"slider":a=t.localize("dialogAddColumnTypeSlider");break;case"autoNumber":a=t.localize("dialogAddColumnTypeAutoNumber");break;case"url":a=t.localize("dialogAddColumnTypeURL");break;case"email":a=t.localize("dialogAddColumnTypeEmail");break;case"phone":a=t.localize("dialogAddColumnTypePhone");break;case"password":a=t.localize("dialogAddColumnTypePassword")}let i=1;for(let e=0;e<t.columns.length;e++)t.columns[e].label.indexOf(a)>=0&&i++;return 1===i?a:a+" "+i}return a}_openAddColumnDialog(e,t,a){const i=this,l=i._dialogAddColumn||i._createDialog(i.editing.addColumnDialog),n=e?i.localize("dialogEditColumn",{value:e.label}):i.localize("dialogAddColumn"),o=l.querySelector(".smart-footer").querySelector(".smart-stack-layout");l.classList.add("smart-grid-dialog-add-column"),l.type=e?"customize":"add",l.editColumn=e||null,e&&e.element&&e.element.setAttribute("focus",""),o.classList.remove("right"),o.classList.add("center"),i._cellEditors||(i._cellEditors=[]);const r=i._getAddColumnDialogTemplate();if(l.header.innerHTML=n,l.header.parentElement.classList.add("smart-hidden"),l.callback=a,!0===t&&(l.header.parentElement.classList.remove("smart-hidden"),"kanban"===i.view?(l.header.innerHTML=i.localize("dialogAddColumnStatus"),l.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"),l.classList.add("view")):l.classList.remove("kanban")),l.stackLabel&&l.stackLabel.classList.add("smart-hidden"),"kanban"===i.view?l.btnCancel.classList.add("smart-hidden"):l.btnCancel.classList.remove("smart-hidden"),i.cancelEdit(),!i._dialogAddColumn){l.modal=!0,l.btnConfirm.innerHTML=i.localize("dialogEditButtonConfirm"),l.btnCancel.innerHTML=i.localize("dialogEditButtonCancel"),l.onOpen=function(){i._addColumnDialogInitEditors(),i._addColumnDialogShowHideEditors(l.editColumn),i.$.fireEvent("openColumnDialog",{dataField:l.editColumn?l.editColumn.dataField:null});const e=i.offset(l),t=i.offset(i);if(e.top+l.offsetHeight>window.innerHeight-t.top){const a=e.top+l.offsetHeight-window.innerHeight+t.top;l.style.maxHeight=Math.max(250,l.offsetHeight-a)+"px",l.style.minHeight="250px"}else l.style.maxHeight="",l.style.minHeight=""},l.onClose=function(){l.editColumn&&l.editColumn.element&&l.editColumn.element.removeAttribute("focus"),l.classList.remove("view"),l.callback&&l.callback(l.result)},l.btnCancel.onclick=function(){l.result=!1,l.close()},l.btnClose.onclick=function(){l.result=!1,l.close()},l.btnConfirm.onclick=function(){i._confirmAddColumnDialog(),l.result=!0,l.close()},l.onkeydown=function(e){"Escape"===e.key&&"kanban"!==i.view&&(l.result=!1,l.close())},i._dialogAddColumn=l;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),l.content.appendChild(e),i._addColumnDialogEditors=[];for(let t=0;t<r.length;t++){const a=r[t],n=document.createElement("div"),o=document.createElement("label");o.innerHTML=a.label;const s=document.createElement("div");if(s.classList.add("smart-grid-dialog-editor","add-column"),s.innerHTML="",s.setAttribute("filter",a.filter),s.setAttribute("bind",a.bind),n.setAttribute("field-name",a.bind),n.setAttribute("field-filter",a.filter),i._addColumnDialogEditors[a.bind]=s,"type"===a.bind&&s.addEventListener("change",(()=>{i._addColumnDialogShowHideEditors(l.editColumn);const e=i._dialogAddColumn.querySelector('[bind="type"]'),t=e.querySelector("smart-input"),a=t.getSelectedItem().value;let n="smart-icon-font";switch(a){case"multiText":n="smart-icon-fontsize";break;case"image":n="smart-icon-image";break;case"number":case"progress":n="smart-icon-number";break;case"priority":case"status":case"select":n="smart-icon-sort-down";break;case"multiSelect":n="smart-icon-list-unordered";break;case"boolean":n="smart-icon-check-squared";break;case"date":case"startDate":case"dueDate":n="smart-icon-calendar";break;case"createdTime":case"updatedTime":n="smart-icon-clock";break;case"createdBy":case"updatedBy":case"collaborator":n="smart-icon-user";break;case"slider":n="smart-icon-number";break;case"autoNumber":case"checklist":n="smart-icon-list-ordered";break;case"url":n="smart-icon-link";break;case"email":n="smart-icon-mail";break;case"password":n="smart-icon-lock";break;case"phone":n="smart-icon-phone";break;case"name":n="smart-icon-font";break;case"description":n="smart-icon-fontsize";break;case"tags":n="smart-icon-font";break;case"color":n="smart-icon-color-background";break;case"assigned":n="smart-icon-user"}if(i._addColumnDialogEditors.type.icon=n,i._addColumnDialogEditors.name.querySelector("input").setAttribute("data-label",t.value),e.firstElementChild.className="smart-grid-icon show smart-description-button "+n,"select"===a||"multiSelect"===a){const e=i._addColumnDialogEditors.options.querySelector("smart-sortable");e&&e._validate&&e._validate()}else l.btnConfirm.disabled=!1})),"boolean"===a.type)i._createColumnBooleanEditor(s,a,n,e,o);else{if("label"===a.type){e.appendChild(n),n.classList.add("smart-grid-dialog-field"),n.appendChild(o);const t=document.createElement("div");t.style.height="10px",n.appendChild(t);continue}{let d=document.createElement("smart-input");if(d.classList.add("underlined","edit-column-input"),d.style.width="100%",d.style.height="30px",a.width&&(n.style.width=a.width,n.style.float="left"),"items"===a.type){const e=document.createElement("smart-button");e.classList.add("primary"),e.innerHTML='<div style="align-items: center; white-space: nowrap; display: flex;"><span class="smart-grid-icon show smart-icon-plus"></span><span>'+i.localize("commandBarAddRow")+"</span></div>";const t=document.createElement("div");t.classList.add("smart-grid-add-column-dialog-color-panel");const n=document.createElement("smart-sortable");n.disableMode="manual",n.dragMode="handle",n.handleVisibility="visible",n.handlePosition="left";const o=()=>{if(l.btnConfirm.disabled=!1,0===t.offsetHeight)return;let e=0;t.querySelectorAll(".edit-column-input").forEach((t=>{""===t.value&&e++,e>1&&(l.btnConfirm.disabled=!0)}))},r=(t,l,r,s)=>{const d=document.createElement("div"),c=i._getColorInput(),m=document.createElement("div"),u=document.createElement("smart-input"),b=i._addColumnDialogEditors.allowColorItems;if(void 0!==r)u.setAttribute("data-id",r),u.setAttribute("data-item-value",r);else{const e=n.querySelectorAll(".smart-sortable-item").length;u.setAttribute("data-id",e),u.setAttribute("data-item-value",e)}return void 0!==s&&u.setAttribute("data-item-value",s),c.disabled=!b.querySelector(".smart-input").value,m.className="smart-grid-icon smart-icon-close show",m.setAttribute("role","button"),m.setAttribute("aria-label","button"),u.classList.add("underlined","edit-column-input"),u.style.width="100%",u.style.height="30px",u.required=!0,t&&(u.value=t),l&&(c.value=l),u.onkeyup=u.onchange=u.onblur=t=>{o(),"Enter"===t.key&&(u.parentElement.nextElementSibling||(e.click(),o()))},d.appendChild(c),d.appendChild(u),"users"!==a.bind&&d.appendChild(m),m.onclick=()=>{d.remove(),n.updateItems(),o()},d.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),d};n._init=e=>{n.clearContent(),e&&(e.forEach(((e,t)=>{const a=void 0!==e.id?e.id:t,i=r(e.label,e.color,a,e.value);n.$.container.appendChild(i)})),n.updateItems())},n._validate=o,i._addColumnDialogEditors.allowColorItems.onchange=e=>{let t=i._addColumnDialogEditors.allowColorItems.parentElement.nextElementSibling,a=null;for(;t;){if("options"===t.getAttribute("field-name")){a=t;break}t=t.nextElementSibling}a&&a.querySelectorAll("smart-color-input").forEach((t=>{t.disabled=!e}))},t.appendChild(n),"users"!==a.bind&&(t.appendChild(e),e.onclick=()=>{const e=r();n.$.container.appendChild(e),n.updateItems(),e.querySelector(".edit-column-input").focus(),l.btnConfirm.disabled=!0}),d=t,s.style.height="auto"}else if("number"===a.type)d=document.createElement("smart-number-input"),d.classList.add("underlined"),d.style.width="100%",d.style.height="30px","minValue"===a.bind?(d.value=0,d.min=-9999999,d.max=9999999):"maxValue"===a.bind?(d.value=1e6,d.min=-9999999,d.max=9999999):"minLength"===a.bind?d.value=0:"maxLength"===a.bind&&(d.value=500);else if("datetime"===a.type)d=document.createElement("smart-date-input"),d.classList.add("underlined"),d.style.width="100%",d.style.height="30px","minDateTime"===a.bind?d.value=new Date(1900,0,1):"maxDateTime"===a.bind&&(d.value=new Date(2100,0,1));else if("radio"===a.type){const e=(e,t,a)=>{const i=document.createElement("div"),l=document.createElement("label"),n=document.createElement("div");return l.innerHTML=e,n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-check-box-cell-editor"),t&&n.setAttribute("checked",""),n.value=void 0!==t&&t,s.appendChild(n),i.onclick=function(){if(n.value=!0,!1===n.value?n.removeAttribute("checked"):n.setAttribute("checked",n.value?"":"indeterminate"),i.onchange&&i.onchange(i),n.value){const e=n.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),n.value=!0,n.setAttribute("checked",n.value?"":"indeterminate"),e.value=a}},i.appendChild(n),i.appendChild(l),i.classList.add("smart-grid-dialog-boolean-field"),i.setAttribute("template","checkBox"),i.setAttribute("editor",""),i},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),s.classList.add("radio-group");for(let i=0;i<a.options.length;i++){const l=a.options[i],n=e(l.label,l.checked);if(a.columns){const e=100/a.columns;n.style.width=e+"%",n.style.float="left"}t.appendChild(n),l.checked&&(s.value=l.value)}const i=document.createElement("div");i.style.clear="both",t.appendChild(i),d=t}if(a.options){d.readonly=!0;let e=a.options;"type"===a.bind&&(void 0!==i.currentUser&&null!==i.currentUser||(e=e.filter((e=>"updatedBy"!==e.value&&"createdBy"!==e.value))),(void 0===i.users||null===i.users||i.users&&0===i.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),d.dataSource=e,d.dropDownButtonPosition="right","dataField"!==a.bind&&(d.selectedIndex=0),a.options.length<15?d.dropDownHeight="auto":d.dropDownHeight=300}if(a.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",a.icon,"show","smart-description-button"),s.appendChild(e),d.style.width="calc(100% - 25px)"}if(s.appendChild(d),a.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=a.info,s.appendChild(e),d.style.width="calc(100% - 25px)"}if(e.appendChild(n),n.classList.add("smart-grid-dialog-field"),n.appendChild(o),n.appendChild(s),a.width&&!r[t+1].width){const t=document.createElement("div");t.style.clear="both",e.appendChild(t)}}}}}const s=()=>{const t=parseInt(l.style.width),a=i.offset(i);if(window.screen.availWidth<400)return l.open("left","top"),l.style.width=i.offsetWidth+"px",void(l.style.height=i.offsetHeight+"px");{const e=i.editing.addColumnDialog;l.style.width="auto"===e.width?e.width:e.width+"px",l.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const n=e.element;if(n){const e=i.offset(n),o=e.left-a.left,r=a.left,s=Math.max(r,o);if(s+t+n.offsetWidth>a.left+i.offsetWidth){const i=s-t+n.offsetWidth;i<0?l.open("center",e.top+n.offsetHeight-a.top):l.open(Math.max(r,i),e.top+n.offsetHeight-a.top)}else l.open(s,e.top+n.offsetHeight-a.top)}else l.classList.add("center"),l.open("center","center")}else if(i._addNewColumn){let e=i._addNewColumn.element,n=i.offset(e),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o);i.editing.addNewColumn._addButton&&i.editing.addNewColumn._addButton.classList.contains("show")&&(e=i.editing.addNewColumn._addButton,n=i.offset(i.editing.addNewColumn._addButton),o=n.left-a.left-t+e.offsetWidth,r=a.left,s=Math.max(r,o)),l.open(s,n.top+e.offsetHeight-a.top)}else l.open("center","center"),l.classList.add("center")};s(),l.refresh=()=>{s()}}_getLocaleByCurrency(e){const t={AED:"ar_AE",AFN:"fa_AF",ALL:"sq",AMD:"hy",ANG:"nl",AOA:"pt_AO",ARS:"es_AR",AUD:"en",AWG:"nl_AW",AZN:"az",BAM:"bs",BBD:"en_BB",BDT:"bn_BD",BGN:"bg",BHD:"ar_BH",BIF:"fr_BI",BMD:"en_BM",BND:"ms_BN",BOB:"es_BO",BRL:"pt_BR",BSD:"en_BS",BTN:"dz",BWP:"en_BW",BYN:"be",BYR:"be",BZD:"en_BZ",CAD:"en_CA",CDF:"fr_CD",CHF:"de_CH",CLP:"es_CL",CNY:"zh_Hans_CN",COP:"es_CO",CRC:"es_CR",CUP:"es_CU",CVE:"pt_CV",CZK:"cs",DJF:"fr_DJ",DKK:"da_DK",DOP:"es_DO",DZD:"ar_DZ",EGP:"ar_EG",ERN:"ti_ER",ETB:"am",EUR:"de",FJD:"en_FJ",FKP:"en_FK",GBP:"en",GEL:"ka",GHS:"en_GH",GIP:"en_GI",GMD:"en_GM",GNF:"fr_GN",GTQ:"es_GT",GYD:"en_GY",HKD:"zh_Hans_HK",HNL:"es_HN",HRK:"hr_HR",HTG:"en",HUF:"hu_HU",IDR:"id",ILS:"he",INR:"en_IN",IQD:"ar_IQ",IRR:"fa_IR",ISK:"is",JMD:"en_JM",JOD:"ar_JO",JPY:"ja",KES:"en_KE",KGS:"ky",KHR:"km",KMF:"ar",KPW:"ko_KP",KRW:"ko_KR",KWD:"ar_KW",KYD:"en_KY",KZT:"kk",LAK:"lo",LBP:"ar_LB",LKR:"si",LRD:"en_LR",LSL:"en_LS",LYD:"ar_LY",MAD:"ar",MDL:"ro",MGA:"fr_MG",MKD:"mk",MMK:"my",MNT:"mn",MOP:"zh",MRO:"ar_MR",MRU:"ar_MR",MUR:"en_MU",MVR:"en",MWK:"en",MXN:"es_MX",MYR:"ms_MY",MZN:"pt_MZ",NAD:"en_NA",NGN:"en_NG",NIO:"es_NI",NOK:"nb_NO",NPR:"ne",NZD:"en_NZ",OMR:"ar_OM",PAB:"es_PA",PEN:"es_PE",PGK:"en_PG",PHP:"fil",PKR:"ur_PK",PLN:"pl",PYG:"es_PY",QAR:"ar_QA",RON:"ro",RSD:"sr",RUB:"ru",RWF:"rw",SAR:"ar_SA",SBD:"en_SB",SCR:"en_SC",SDG:"ar_SD",SEK:"sv_SE",SGD:"en_SG",SHP:"en_SH",SLL:"en_SL",SOS:"so_SO",SRD:"nl_SR",SSP:"en",STD:"pt_ST",STN:"pt_ST",SYP:"ar_SY",SZL:"en_SZ",THB:"th",TJS:"en",TMT:"tk",TND:"ar_TN",TOP:"to",TRY:"tr_TR",TTD:"en_TT",TWD:"zh_Hant_TW",TZS:"sw_TZ",UAH:"uk",UGX:"en_UG",USD:"en_US",UYU:"es_UY",UZS:"uz",VEF:"es_VE",VND:"vi",VUV:"en_BI",WST:"en_AS",XAF:"fr",XCD:"en",XOF:"fr",XPF:"fr_PF",YER:"ar_YE",ZAR:"zu",ZMW:"en_ZM",ZWL:"en_ZW"};return t[e]?t[e].replace("_","-"):"en-US"}_getCurrencies(){return[{currency:"US Dollar",sign:"$",abbreviation:"USD"},{currency:"Afghan Afghani",sign:"Af.",abbreviation:"AFN"},{currency:"Albanian Lek",sign:"Lek",abbreviation:"ALL"},{currency:"Algerian Dinar",sign:"din",abbreviation:"DZD"},{currency:"Angolan Kwanza",sign:"Kz",abbreviation:"AOA"},{currency:"Argentine Peso",sign:"$",abbreviation:"ARS"},{currency:"Armenian Dram",sign:"Dram",abbreviation:"AMD"},{currency:"Aruban Florin",sign:"Afl.",abbreviation:"AWG"},{currency:"Australian Dollar",sign:"$",abbreviation:"AUD"},{currency:"Azerbaijani Manat",sign:"₼",abbreviation:"AZN"},{currency:"Bahamian Dollar",sign:"$",abbreviation:"BSD"},{currency:"Bahraini Dinar",sign:"din",abbreviation:"BHD"},{currency:"Bangladeshi Taka",sign:"৳",abbreviation:"BDT"},{currency:"Barbadian Dollar",sign:"$",abbreviation:"BBD"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYN"},{currency:"Belarusian Ruble",sign:"р.",abbreviation:"BYR"},{currency:"Belize Dollar",sign:"$",abbreviation:"BZD"},{currency:"Bermudan Dollar",sign:"$",abbreviation:"BMD"},{currency:"Bhutanese Ngultrum",sign:"Nu.",abbreviation:"BTN"},{currency:"Bolivian Boliviano",sign:"Bs",abbreviation:"BOB"},{currency:"Bosnia-Herzegovina Convertible Mark",sign:"KM",abbreviation:"BAM"},{currency:"Botswanan Pula",sign:"P",abbreviation:"BWP"},{currency:"Brazilian Real",sign:"R$",abbreviation:"BRL"},{currency:"British Pound Sterling",sign:"£",abbreviation:"GBP"},{currency:"Brunei Dollar",sign:"$",abbreviation:"BND"},{currency:"Bulgarian Lev",sign:"лв.",abbreviation:"BGN"},{currency:"Burundian Franc",sign:"FBu",abbreviation:"BIF"},{currency:"Cambodian Riel",sign:"Riel",abbreviation:"KHR"},{currency:"Canadian Dollar",sign:"$",abbreviation:"CAD"},{currency:"Cape Verdean Escudo",sign:"CVE",abbreviation:"CVE"},{currency:"Cayman Islands Dollar",sign:"$",abbreviation:"KYD"},{currency:"CFA Franc BCEAO",sign:"CFA",abbreviation:"XOF"},{currency:"CFA Franc BEAC",sign:"FCFA",abbreviation:"XAF"},{currency:"CFP Franc",sign:"FCFP",abbreviation:"XPF"},{currency:"Chilean Peso",sign:"$",abbreviation:"CLP"},{currency:"Chinese Yuan",sign:"¥",abbreviation:"CNY"},{currency:"Chinese Yuan (offshore)",sign:"¥",abbreviation:"RMB"},{currency:"Colombian Peso",sign:"$",abbreviation:"COP"},{currency:"Comorian Franc",sign:"CF",abbreviation:"KMF"},{currency:"Congolese Franc",sign:"FrCD",abbreviation:"CDF"},{currency:"Costa Rican Colon",sign:"₡",abbreviation:"CRC"},{currency:"Croatian Kuna",sign:"kn",abbreviation:"HRK"},{currency:"Cuban Convertible Peso",sign:"$",abbreviation:"CUC"},{currency:"Cuban Peso",sign:"$",abbreviation:"CUP"},{currency:"Czech Republic Koruna",sign:"Kč",abbreviation:"CZK"},{currency:"Danish Krone",sign:"kr.",abbreviation:"DKK"},{currency:"Djiboutian Franc",sign:"Fdj",abbreviation:"DJF"},{currency:"Dominican Peso",sign:"RD$",abbreviation:"DOP"},{currency:"East Caribbean Dollar",sign:"$",abbreviation:"XCD"},{currency:"Egyptian Pound",sign:"£",abbreviation:"EGP"},{currency:"Eritrean Nakfa",sign:"Nfk",abbreviation:"ERN"},{currency:"Ethiopian Birr",sign:"Birr",abbreviation:"ETB"},{currency:"Euro",sign:"€",abbreviation:"EUR"},{currency:"Falkland Islands Pound",sign:"£",abbreviation:"FKP"},{currency:"Fijian Dollar",sign:"$",abbreviation:"FJD"},{currency:"Gambian Dalasi",sign:"GMD",abbreviation:"GMD"},{currency:"Georgian Lari",sign:"GEL",abbreviation:"GEL"},{currency:"Ghanaian Cedi",sign:"GHS",abbreviation:"GHS"},{currency:"Gibraltar Pound",sign:"£",abbreviation:"GIP"},{currency:"Guatemalan Quetzal",sign:"Q",abbreviation:"GTQ"},{currency:"Guinean Franc",sign:"FG",abbreviation:"GNF"},{currency:"Guyanaese Dollar",sign:"$",abbreviation:"GYD"},{currency:"Haitian Gourde",sign:"HTG",abbreviation:"HTG"},{currency:"Honduran Lempira",sign:"L",abbreviation:"HNL"},{currency:"Hong Kong Dollar",sign:"$",abbreviation:"HKD"},{currency:"Hungarian Forint",sign:"Ft",abbreviation:"HUF"},{currency:"Icelandic Krona",sign:"kr",abbreviation:"ISK"},{currency:"Indian Rupee",sign:"₹",abbreviation:"INR"},{currency:"Indonesian Rupiah",sign:"Rp",abbreviation:"IDR"},{currency:"Iranian Rial",sign:"Rial",abbreviation:"IRR"},{currency:"Iraqi Dinar",sign:"din",abbreviation:""},{currency:"Israeli New Sheqel",sign:" ₪",abbreviation:"ILS"},{currency:"Jamaican Dollar",sign:"$",abbreviation:"JMD"},{currency:"Japanese Yen",sign:"¥",abbreviation:"JPY"},{currency:"Jordanian Dinar",sign:"din",abbreviation:"JOD"},{currency:"Kazakhstani Tenge",sign:"₸",abbreviation:"KZT"},{currency:"Kenyan Shilling",sign:"Ksh",abbreviation:"KES"},{currency:"Kuwaiti Dinar",sign:"din",abbreviation:"KWD"},{currency:"Kyrgystani Som",sign:"KGS",abbreviation:"KGS"},{currency:"Laotian Kip",sign:"₭",abbreviation:"LAK"},{currency:"Lebanese Pound",sign:"L£",abbreviation:"LBP"},{currency:"Lesotho Loti",sign:"LSL",abbreviation:"LSL"},{currency:"Liberian Dollar",sign:"$",abbreviation:"LRD"},{currency:"Libyan Dinar",sign:"din",abbreviation:"LYD"},{currency:"Lithuanian Litas",sign:"Lt",abbreviation:"LTL"},{currency:"Macanese Pataca",sign:"MOP",abbreviation:"MOP"},{currency:"Macedonian Denar",sign:"din",abbreviation:"MKD"},{currency:"Malagasy Ariary",sign:"Ar",abbreviation:"MGA"},{currency:"Malawian Kwacha",sign:"MWK",abbreviation:"MWK"},{currency:"Malaysian Ringgit",sign:"RM",abbreviation:"MYR"},{currency:"Maldivian Rufiyaa",sign:"Rf",abbreviation:"MVR"},{currency:"Mauritanian Ouguiya",sign:"MRO",abbreviation:"MRO"},{currency:"Mauritian Rupee",sign:"MURs",abbreviation:"MUR"},{currency:"Mexican Peso",sign:"$",abbreviation:"MXN"},{currency:"Moldovan Leu",sign:"MDL",abbreviation:"MDL"},{currency:"Mongolian Tugrik",sign:"₮",abbreviation:"MNT"},{currency:"Moroccan Dirham",sign:"dh",abbreviation:"MAD"},{currency:"Mozambican Metical",sign:"MTn",abbreviation:"MZN"},{currency:"Myanma Kyat",sign:"K",abbreviation:"MMK"},{currency:"Namibian Dollar",sign:"$",abbreviation:"NAD"},{currency:"Nepalese Rupee",sign:"Rs",abbreviation:"NPR"},{currency:"Netherlands Antillean Guilder",sign:"NAf.",abbreviation:"ANG"},{currency:"New Taiwan Dollar",sign:"NT$",abbreviation:"TWD"},{currency:"New Zealand Dollar",sign:"$",abbreviation:"NZD"},{currency:"Nicaraguan Cordoba",sign:"C$",abbreviation:"NIO"},{currency:"Nigerian Naira",sign:"₦",abbreviation:"NGN"},{currency:"North Korean Won",sign:"₩KP",abbreviation:"KPW"},{currency:"Norwegian Krone",sign:"kr",abbreviation:"NOK"},{currency:"Omani Rial",sign:"Rial",abbreviation:"OMR"},{currency:"Pakistani Rupee",sign:"Rs",abbreviation:"PKR"},{currency:"Panamanian Balboa",sign:"B/.",abbreviation:"PAB"},{currency:"Papua New Guinean Kina",sign:"PGK",abbreviation:"PGK"},{currency:"Paraguayan Guarani",sign:"Gs.",abbreviation:"PYG"},{currency:"Peruvian Nuevo Sol",sign:"S/.",abbreviation:"PEN"},{currency:"Philippine Peso",sign:"₱",abbreviation:"PHP"},{currency:"Polish Zloty",sign:"zł",abbreviation:"PLN"},{currency:"Qatari Rial",sign:"Rial",abbreviation:"QAR"},{currency:"Romanian Leu",sign:"RON",abbreviation:"RON"},{currency:"Russian Ruble",sign:"₽",abbreviation:"RUB"},{currency:"Rwandan Franc",sign:"RF",abbreviation:"RWF"},{currency:"Saint Helena Pound",sign:"£",abbreviation:"SHP"},{currency:"Samoan Tala",sign:"WST",abbreviation:"WST"},{currency:"Sao Tomean Dobra",sign:"Db",abbreviation:"STD"},{currency:"Saudi Riyal",sign:"Rial",abbreviation:"SAR"},{currency:"Serbian Dinar",sign:"din",abbreviation:"RSD"},{currency:"Seychellois Rupee",sign:"SCR",abbreviation:"SCR"},{currency:"Sierra Leonean Leone",sign:"SLL",abbreviation:"SLL"},{currency:"Singapore Dollar",sign:"$",abbreviation:"SGD"},{currency:"Solomon Islands Dollar",sign:"$",abbreviation:"SBD"},{currency:"Somali Shilling",sign:"SOS",abbreviation:"SOS"},{currency:"South African Rand",sign:"R",abbreviation:"ZAR"},{currency:"South Korean Won",sign:"₩",abbreviation:"KRW"},{currency:"South Sudanese Pound",sign:"£",abbreviation:"SSP"},{currency:"Sri Lankan Rupee",sign:"Rs",abbreviation:"LKR"},{currency:"Sudanese Pound",sign:"SDG",abbreviation:"SDG"},{currency:"Surinamese Dollar",sign:"$",abbreviation:"SRD"},{currency:"Swazi Lilangeni",sign:"SZL",abbreviation:"SZL"},{currency:"Swedish Krona",sign:"kr",abbreviation:"SEK"},{currency:"Swiss Franc",sign:"CHF",abbreviation:"CHF"},{currency:"Syrian Pound",sign:"£",abbreviation:"SYP"},{currency:"Tajikistani Somoni",sign:"Som",abbreviation:"TJS"},{currency:"Tanzanian Shilling",sign:"TSh",abbreviation:"TZS"},{currency:"Thai Baht",sign:"฿",abbreviation:"THB"},{currency:"Tongan Pa'anga",sign:"T$",abbreviation:"TOP"},{currency:"Trinidad and Tobago Dollar",sign:"$",abbreviation:"TTD"},{currency:"Tunisian Dinar",sign:"din",abbreviation:"TND"},{currency:"Turkish Lira",sign:"₺",abbreviation:"TRY"},{currency:"Turkmenistani Manat",sign:"m",abbreviation:"TMT"},{currency:"Ugandan Shilling",sign:"UGX",abbreviation:"UGX"},{currency:"Ukrainian Hryvnia",sign:"грн.",abbreviation:"UAH"},{currency:"United Arab Emirates Dirham",sign:"dh",abbreviation:"AED"},{currency:"Uruguayan Peso",sign:"$",abbreviation:"UYU"},{currency:"Uzbekistan Som",sign:"soʼm",abbreviation:"UZS"},{currency:"Vanuatu Vatu",sign:"VUV",abbreviation:"VUV"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VEF"},{currency:"Venezuelan Bolivar",sign:"Bs",abbreviation:"VES"},{currency:"Vietnamese Dong",sign:"₫",abbreviation:"VND"},{currency:"Yemeni Rial",sign:"Rial",abbreviation:"YER"},{currency:"Zambian Kwacha",sign:"ZMW",abbreviation:"ZMW"},{currency:"Zimbabwean Dollar",sign:"$",abbreviation:"ZWD"}].map((e=>(e.label=e.currency,e.menuLabel='<div style="display: flex; justify-content: space-between;"><span>'+e.currency+'</span><span style="opacity: 0.7;">'+e.sign+" 1,000.00</span></div>",e.value=e.abbreviation,e)))}});
|
|
61
61
|
(()=>{"use strict";class e{_setRowProperty(e,r,o){const t=this.rowById[e];t&&(t[r]=o)}_setRowsProperty(e,r,o){const t=this;t._refreshLayout(),t._refreshRowHierarchy(!0);const s=t._recyclingRows;t.rows.canNotify=!1;for(let t=0;t<s.length;t++){const c=s[t];o&&-1===o.indexOf(c.id)||(c[e]=r)}t.rows.canNotify=!0,t.refresh()}expandRowsToGroupLevel(e){this._expandCollapseGroupsToLevel(!0,e)}_expandCollapseGroupsToLevel(e,r){const o=this;o._refreshLayout(),o._refreshRowHierarchy(!0);const t=o._recyclingRows;o.rows.canNotify=!1;for(let s=0;s<t.length;s++){const c=t[s];c.data.level<r&&(c.expanded=c.data.expanded=e,o.dataSource&&(e?o.dataSource._expandedRowIds[c.data.$.id]=!0:delete o.dataSource._expandedRowIds[c.data.$.id]))}o.rows.canNotify=!0,o.refresh()}_applyThreeStates(e){const r=this,o=e!==r.rowHierarchy;if(!r.rowHierarchy)return;const t=o?e.children:r.rowHierarchy.filter((e=>{if(0===e.level)return e}));let s=0,c=0;for(let n=0;n<t.length;n++){const a=t[n];e.checked&&(a.checked=!0),!1===a.leaf&&r._applyThreeStates(a),o&&(a.checked?s++:null===a.checked&&c++)}o&&(s===e.children.length?e.checked=!0:0===s&&0===c?e.checked=!1:r.checkBoxes.hasThreeStates?e.checked=null:e.checked=!1)}_hasThreeStates(e,r){const o=this;let t=e;for(e!==r&&(e.checked?e.checked=!1:e.checked=!0);t.parent;){const e=t.parent,r=e.children;let s=0,c=0;for(let e=0;e<r.length;e++)r[e].checked?s++:o.checkBoxes.hasThreeStates&&null===r[e].checked&&c++;s===e.children.length?e.checked=!0:0===s&&0===c?e.checked=!1:o.checkBoxes.hasThreeStates?e.checked=null:e.checked=!1,t=e}e.leaf||function e(r,o){const t=r.children;for(let r=0;r<t.length;r++){const s=t[r];s.checked=o,!1===s.leaf&&e(s,o)}}(e,e.checked)}_expandCollapseGroup(e,r){const o=this;if(!o.grouping.enabled)return;const t=(""+e).split(".");let s=o.rowHierarchy[t[0]];if(!s)return;const c=o.rows.canNotify;o.rows.canNotify=!1,null===r&&(r=!s.expanded),s.expanded=s.data.expanded=r;for(let e=1;e<t.length&&(s=s.children[t[e]],s&&!s.leaf);e++)s.expanded=s.data.expanded=r;o.rows.canNotify=c,o._refresh()}expandRow(e){const r=this;r.grouping.enabled?r._expandCollapseGroup(e,!0):e&&Array.isArray(e)?r._setRowsProperty("expanded",!0,e):r._setRowProperty(e,"expanded",!0)}expandAllRows(){const e=this;e.grouping.enabled?e._expandCollapseGroupsToLevel(!0,99):e._setRowsProperty("expanded",!0)}collapseAllRows(){const e=this;e.grouping.enabled?e._expandCollapseGroupsToLevel(!1,99):e._setRowsProperty("expanded",!1)}toggleRow(e){const r=this;if(r.grouping.enabled)return void r._expandCollapseGroup(e,null);const o=r.rowById[e];o&&(o.expanded?o.expanded=!1:o.expanded=!0)}collapseRow(e){const r=this;r.grouping.enabled?r._expandCollapseGroup(e,!1):e&&Array.isArray(e)?r._setRowsProperty("expanded",!1,e):r._setRowProperty(e,"expanded",!1)}checkRow(e){const r=this;e&&Array.isArray(e)?r._setRowsProperty("checked",!0,e):r._setRowProperty(e,"checked",!0)}uncheckRow(e){const r=this;e&&Array.isArray(e)?r._setRowsProperty("checked",!1,e):r._setRowProperty(e,"checked",!1)}checkAllRows(){this._setRowsProperty("checked",!0)}uncheckAllRows(){this._setRowsProperty("checked",!1)}}Smart.Utilities.Grid.Tree=e})();
|
|
62
62
|
Smart.Utilities.Assign("Grid.Export",class{exportData(t,e){const o=this,a=new Smart.Utilities.DataExporter({exportHeader:o.dataExport.header}),r=[];a.expandChar=o.dataExport.expandChar,a.collapseChar=o.dataExport.collapseChar,a.pageOrientation=o.dataExport.pageOrientation,a.style=o.dataExport.style,a.filterBy=o.dataExport.filterBy,a.groupBy=o.dataExport.groupBy;const n=o.columns.toArray().slice(0).filter((t=>!1!==t.allowExport));if(a.header={columns:n,columngroups:o.columnGroups.slice(0)},!o.dataExport.style){const e=window.getComputedStyle(o),n=window.getComputedStyle(o.columns.length>0&&o.columns[0].element?o.columns[0].element:o.$.columnHeader),l=window.getComputedStyle(o.$.columnHeader);if(0!==o.offsetWidth&&0!==o.offsetHeight){const i=t=>{const e=t.fontSize,o=t.borderRightColor,a=t.backgroundColor,r=t.color,n=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");function l(t){return(t=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))?"#"+i(t[1])+i(t[2])+i(t[3]).toUpperCase():"#ffffff"}function i(t){return isNaN(t)?"00":n[(t-t%16)/16]+n[t%16]}return{borderColor:l(o),fontSize:e,fontFamily:"Helvetica",color:l(r),backgroundColor:l(a)}},d=i(e),s=i(n),c=i(l),p={height:o.$.columnHeader.offsetHeight+"px",border:"1px solid "+d.borderColor,fontFamily:c.fontFamily,fontSize:c.fontSize,color:c.color,backgroundColor:s.backgroundColor,fontWeight:"400"},f={border:"1px solid "+d.borderColor,fontFamily:d.fontFamily,fontSize:d.fontSize},u={height:o.rowMinHeight+"px"};for(let e=0;e<o.columns.length;e++){const a=o.columns[e];if(!a.allowExport)continue;if(!a.visible)continue;p[a.dataField]={textAlign:a.align,width:a.computedWidth+"px",format:a.cellsFormat||""};let n=a.cellsFormat||"";"date"===a.dataType?n="d":"dateTime"===a.dataType?n="D":"time"===a.dataType&&(n="t");const l={textAlign:a.cellsAlign,format:n};if(f[a.dataField]=l,o.dataExport.view&&-1!==["html","jpeg","pdf","png"].indexOf(t)&&(a.template||a.formatFunction))for(let t=0;t<o.rows.length;t++){const e=o.rows[t];let n=o.rows[t]["column_"+a.dataField];if(o.dataExport.viewStart&&t<o.dataExport.viewStart||o.dataExport.viewEnd&&t>o.dataExport.viewEnd)continue;if(!n||e&&e.element&&e.element.classList.contains("smart-hidden")){const t=o._rowElements[0];if(!t)continue;if(e.element=t,e.grid=o,e.render(),n=e["column_"+a.dataField],!n)continue}const i={};i.border=n.borderColor,i.background=n.background,i.color=n.color;const d=void 0!==o.dataExport.viewStart?t-o.dataExport.viewStart:t;r[t]=Object.assign({},e.data),r[t][a.dataField]=n.element.textContent,l[d]=i}}o.appearance.alternationCount>0&&(u.alternationCount=o.appearance.alternationCount,u.alternationStart=o.appearance.alternationStart,u.alternationEnd=o.appearance.alternationEnd,u.alternationIndex0Color=d.color,u.alternationIndex0BackgroundColor=d.backgroundColor,u.alternationIndex1Color=d.color,u.alternationIndex1BackgroundColor="#F5F5F5"),a.style={border:"1px solid "+d.borderColor,borderCollapse:"collapse",header:p,columns:f,rows:u}}}const l=!o.rowHierarchy||o.grouping.enabled?o.rows.toArray():o.rowHierarchy,i=o.dataExport.rowIds,d=null!==i;let s=[];if(o.dataExport.view)o._recyclingRows.forEach(((t,e)=>{if(o.dataExport.viewStart&&e<o.dataExport.viewStart||o.dataExport.viewEnd&&e>o.dataExport.viewEnd)return!0;r[e]?s.push(r[e]):s.push(t.data)}));else{for(let e=0;e<l.length;e++){const a=l[e];if(a.visible&&(!1!==a.filtered||void 0===a.filtered)){if(d&&-1===i.indexOf(a.id))continue;const e={};for(let r=0;r<o.columns.length;r++){const n=o.columns[r];if(!n.allowExport)continue;const l=n.dataField;let i=a.data[l];if("taskChecklist"===l)if(i){const t=i.map((t=>{let e=t.text;return t.completed?e="✓ "+e:e+="X "+e,e}));i=t.toString()}else i="";if("taskUserId"===l){const t=o.users.find((t=>t.id===parseInt(i)||parseInt(t.id)===parseInt(i)));t&&(i=t.name)}if(void 0===i)if("createdBy"===n.template){const t=o.users.find((t=>t.id===a.createdBy));if(t){const o=t,a="string"==typeof o?o:o.name;e[l]=a}else e[l]=""}else if("createdTime"===n.template){const t=a.getCell(l).getFormattedValue(a.createdTime,"d")+" "+a.getCell(l).getFormattedValue(a.createdTime,"t");e[l]=t}else if("modifiedBy"===n.template){const t=o.users.find((t=>t.id===a.modifiedBy));if(t){const o=t,a="string"==typeof o?o:o.name;e[l]=a}else e[l]=""}else if("modifiedTime"===n.template){const t=a.getCell(l).getFormattedValue(a.modifiedTime,"d")+" "+a.getCell(l).getFormattedValue(a.modifiedTime,"t");e[l]=t}else e[l]="";else if(i&&i.indexOf&&(i.indexOf("{")>=0||"[]"===i)){const t=i.indexOf("{")>=0||"[]"===i?JSON.parse(i):i.split(", "),o=[];for(let e=0;e<t.length;e++)"string"==typeof t[e]?o.push(t[e]):o.push(t[e].label);e[l]=o.join(",")}else if("csv"===t||"tsv"===t)if(n.cellsFormat){const t=a.getCell(l).getFormattedValue(i,n.cellsFormat);e[l]=t}else e[l]=i;else e[l]=i}s.push(e)}}l!==o.rowHierarchy||d||(s=o.dataSource.boundHierarchy,a.hierarchical=!0)}!o.dataExport.groupBy&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy&&(a.groupBy=o.dataSource.groupBy&&o.dataSource.groupBy.toArray?o.dataSource.groupBy.toArray():null),o.checkLicense(!0);const c=a.exportData(s,t,o.dataExport.fileName,e);return o.dataExport.view&&o._recycle(!1),c}print(){const t=this,e=t.dataExport.fileName;t.dataExport.fileName=null;const o=t.exportData("html"),a=window.open("","","width=800,height=500"),r=a.document.open(),n='<!DOCTYPE html><html><head><meta charset="utf-8" /><title>'+e+"</title></head><body>"+o+"</body></html>";try{r.write(n),r.close(),setTimeout((function(){a.print(),a.close()}),100)}catch(t){}t.dataExport.fileName=e}});
|
|
63
63
|
Smart.Utilities.Assign("Grid.Chart",class{_getChartDataFields(e){const t=this,i=e[0];let a,n=!0,o=[];for(let e in i)"$"!==e&&("string"===t.dataSource.dataFields.find((t=>t.name===e)).dataType?0===t.columns.findIndex((t=>t.dataField===e))&&(a=e):(n=!1,o.push({dataField:e,displayText:e})));return{xAxisDataField:a,series:o,stringOnly:n}}createChart(e,t){const i=this,a=i.getSelection(),n=a.rows,o=a.columns,s=a.cells,l=document.createElement("smart-chart"),r=[],d={};let c,h=[],g=[];if(s&&s.length>1&&s.forEach((e=>{-1===h.indexOf(e.row.index)&&h.push(e.row.index),-1===g.indexOf(e.dataField)&&g.push(e.dataField)})),t)r.concat(t);else for(let e=0;e<i.dataSource.length;e++){const t={};if(n){if(!n.find((t=>t.row.index===e)))continue}else{if(o){o.forEach((a=>{t[a.dataField]=i.dataSource[e][a.dataField]})),r.push(t);continue}if(s&&s.length>1){if(-1===h.indexOf(e))continue;g.forEach((a=>{t[a]=i.dataSource[e][a]})),r.push(t);continue}}i.columns.forEach((a=>t[a.dataField]=i.dataSource[e][a.dataField])),r.push(t)}const f=i._getChartDataFields(r);if(f.stringOnly){if(i.header.visible&&i.$.header.firstElementChild){const t=i.enableShadowDOM?i.shadowRoot.getElementById(e):i.querySelector("#"+e);i.$.header.firstElementChild.classList.add("warning"),t&&t.classList.add("warning"),setTimeout((function(){i.$.header.firstElementChild.classList.remove("warning"),t&&t.classList.remove("warning")}),1e3)}}else{if(c=f.series,l.caption="",l.description="",l.clip=!1,l.showLegend=!0,l.showBorderLine=!1,l.padding={left:5,top:10,right:5,bottom:5},l.dataSource=r,l.xAxis={dataField:f.xAxisDataField,gridLines:{visible:!0}},l.valueAxis={displayValueAxis:!0,description:i.charting.description,axisSize:"auto",formatSettings:i.charting.formatSettings},l.colorScheme=i.charting.colorScheme,l.seriesGroups=[d],d.formatSettings=i.charting.formatSettings,d.series=c,"line"===e)c.forEach((function(e){e.symbolSize=8,e.symbolType="square"}));else if("pie"===e){const e=c[0].dataField;delete d.formatSettings,d.formatFunction=function(e,t){return isNaN(e)&&"object"==typeof e?t:e},d.showLabels=!0,c.length=0,c.push({dataField:e,displayText:f.xAxisDataField,initialAngle:0})}else if("bar"===e)e="column",d.orientation="horizontal",l.xAxis.textRotationAngle=90,l.valueAxis.textRotationAngle=30,l.valueAxis.flip=!0;else if("area"===e){let e=1;for(let t=0;t<c.length;t++)c[t].opacity=e,e-=.2,e=Math.max(.3,e)}if(d.type=e,i.onChartInit&&i.onChartInit(l),i.charting.appendTo){const e="string"===i.charting.appendTo?document.querySelector(i.charting.appendTo):i.charting.appendTo;e&&e.appendChild(l)}else i._openChartDialog(l,e)}}_openChartDialog(e,t){const i=this;if(!i.charting.dialog.enabled)return!1;const a=i._dialogChart||i._createDialog(i.charting.dialog),n=t.substring(0,1).toUpperCase()+t.substring(1),o="{{message}}"===i.charting.dialog.header?i.localize("dialogChartHeader",{value:n}):i.charting.dialog.header;e.style.width="100%",e.style.height="100%",a.header.innerHTML=o,a.content.innerHTML="",a.content.style.width="100%",a.content.style.height="100%",a.btnCancel.classList.add("smart-hidden"),i._dialogChart||(a.modal=!0,a.onOpen=function(){i.charting.dialog.visible=!0},a.onClose=function(){i.charting.dialog.visible=!1},a.btnConfirm.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},i._dialogChart=a),a.open(),setTimeout((function(){a.btnConfirm.focus(),a.content.appendChild(e)}),100)}});
|
|
64
|
-
Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden")})),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;(t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled")})(e.dataSource&&0===e.dataSource.length),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget),t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight+"px";const a=()=>{if(e){const a=t.grid.offset(e);a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px"}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",a())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));if(super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t.grid.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),350)}}openSortPanel(e){const t=this,a=t.dataSource;t._refreshColumns("sort");const o=t.columns.map((e=>{const o=Object.assign({},e),n=t._appliedSorting.dataFields.indexOf(o.dataField),s=a.dataFields.find((e=>e.name===o.dataField));return s&&(o.dataType=s.dataType,o.sortIndex=n,-1!==n&&(o.sortDirection=t._appliedSorting.orderBy[n])),o})).filter((e=>e.allowSort));if(e&&t._appliedSorting&&-1===t._appliedSorting.dataFields.indexOf(e.dataField)){const a=o.find((t=>t.dataField===e.dataField));a.sortDirection="ascending",a.sortIndex=t._appliedSorting.dataFields.length}super.openSortPanel(o),t._closeDownloadMenu(),t._closeViewsMenu();const n=t.grid;n.closeMenu();const s=t.$.headerDropDown.querySelector("smart-sort-panel");if(!s)return;s.grid=n,s.$.maintainSortContainer.classList.remove("smart-hidden"),n.sorting.maintainSort?s.$.maintainSortContainer.firstElementChild.setAttribute("active",""):s.$.maintainSortContainer.firstElementChild.removeAttribute("active"),s._changeApplyButtonText();const i=s.$.inputNotSorted,r=()=>{const e=s.querySelectorAll(".smart-grid-panel-item");"many"===t.grid.sorting.mode||e.length<1?i.classList.remove("smart-visibility-hidden"):e.length>=1&&i.classList.add("smart-visibility-hidden")};s.onDataSourceChange=()=>{r()},r()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,n=0,s=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(o--,i.push(r.dataField)),r.visible||(n++,s.push(r.dataField)),t.push(r)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===n||o===n&&i.toString()!==s.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,n=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let s;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)s=o.querySelector("smart-column-panel"),s.locale=e.locale,s.messages=e._innerElementMessages.columnPanel,s.set("dataSource",n),s.propertyChangedHandler("dataSource",void 0,n),s.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=n,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],n=o[0],s=o[1];a.grid.columnByDataField[n].filter=s}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.sorting.maintainSort=t.maintainSort,e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")&&(t="customize"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,n=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&n.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();n.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)&&t.addSort(o.sortByInfo),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target;const o=t.grid.$.header;if(t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]),t._closeDownloadMenu(),t._closeViewsMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||a!==o&&o.contains(a))){const n=a.closest("smart-scroll-viewer"),s=a.closest(".smart-drop-down");if((!n||!o.contains(n.ownerElement))&&(!s||s.ownerElement&&!o.contains(s.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(n&&n.ownerElement){const e=n.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,n=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((t=>!1!==t._visible&&("filter"!==e&&"sort"!==e&&"group"!==e||!1!==t.visible))),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible,sortIndex:void 0!==e.sortIndex&&null!==e.sortIndex?e.sortIndex:-1,sortDirection:void 0!==e.sortOrder?e.sortOrder:null}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;n.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;n.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.grid._openRowSettingsDialog=t._openRowSettingsDialog,t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),e.header.onInit&&e.header.onInit(t)}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-views-menu"),a.rightToLeft=t.rightToLeft;const n=(e,a)=>{const o=document.createElement("smart-menu-item");let n="#D50000",s="smart-icon-table-alt";switch(a){case"grid":n="#3f51b5",s="smart-icon-table-alt","grid"===t.view&&o.setAttribute("focus","");break;case"pdf":n="#f4511e";break;case"kanban":n="#C40093",s="smart-icon-kanban","kanban"===t.view&&o.setAttribute("focus","");break;case"json":n="#8e24aa"}return o.label='<span style="color: '+n+'" class="smart-grid-icon '+s+'"></span>'+e,o.value=a,o};o.appendChild(n(t.localize("viewGrid"),"grid")),o.appendChild(n(t.localize("viewKanban"),"kanban")),a.appendChild(o),e.viewsMenu.appendChild(a),a.onItemClick=t=>{e._setView(t.detail.value)}}_setView(e){const t=this,a=t.grid;if(a.view!==e){if("kanban"===e){const e=a.context;a.context=a,a.view="kanban",a.context=e,a._kanbanInitialized&&a.columnByDataField.taskStatus?(a._showKanbanView(),t._refresh()):(delete a._kanbanInitialized,a._initKanbanView())}else"grid"===e&&(a.view="grid",a._hideKanbanView(),t._refresh());a.$.fireEvent("viewChanged",{view:e}),t._refresh()}}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const n=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const n='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+n+e,a.value=t,a};o.appendChild(n(t.localize("download")+" CSV","csv")),o.appendChild(n(t.localize("download")+" XLSX","xlsx")),o.appendChild(n(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")&&e._closeViewsMenu()}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled&&"grid"===t.view?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},t._sortedColumns){const a=[],o=[],n=[];for(let e=0;e<t._sortedColumns.length;e++){const s=t._sortedColumns[e];a.push(s.dataField),o.push(s.sortOrder),n.push(s.dataType)}e._appliedSorting={dataFields:a,dataTypes:n,orderBy:o},e._refreshSortButton()}if("grid"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumns();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const n=t.filters[o];a.filters.push([e,n.condition,n.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}else e.$.sortButton.classList.add("smart-hidden"),e.$.filterButton.classList.add("smart-hidden");e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e.refreshTools()}_refreshViewsButton(){const e=this;let t=e.grid.localize("viewGrid");switch(e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":e.$.viewsButton.classList.remove("kanban"),t=e.grid.localize("viewGrid")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>"}_refreshDownloadButton(){this.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation">'+this.grid.localize("download")+"</div>"}_openRowSettingsDialog(e){let t=this;t.getSelectedRows||(t=t.grid);const a=t.editing.dialog.enabled,o=t.editing.mode,n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=e,t.beginEdit(e),t._endToolbarEdit?(t.removeEventListener("endEdit",t._endToolbarEdit,null),t.removeEventListener("cancelEdit",t._endToolbarEdit,null)):t._endToolbarEdit=()=>{t.context=t,t.editing.dialog.enabled=a,t.editing.mode=o,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endToolbarEdit),t.addEventListener("cancelEdit",t._endToolbarEdit)}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.querySelector("smart-grid-toolbar").$.deleteButton;0!==t?(a.classList.remove("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.querySelector("smart-grid-toolbar")._refreshDeleteButton()}openGroupPanel(e){const t=this;let a;const o=t.grid;t.$.headerDropDown.classList.add("group-panel"),t.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","format-panel"),t.$.group.classList.remove("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.sort.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t.$.format.classList.add("smart-hidden"),t._closeDownloadMenu(),t._closeViewsMenu(),t._refreshColumns("group"),o.closeMenu();const n=t.columns.map((e=>{const a=Object.assign({},e);if(t._appliedGrouping&&t._appliedGrouping.dataFields){const e=t._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=e}return a})).filter((e=>e.allowGroup));e&&t._appliedGrouping&&-1===t._appliedGrouping.dataFields.indexOf(e.dataField)&&(n.find((t=>t.dataField===e.dataField)).groupIndex=t._appliedGrouping.dataFields.length),t._groupPartCreated?(a=t.$.group.firstElementChild,a.rightToLeft=t.rightToLeft,a.dataSource=n,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel):(a=document.createElement("smart-group-panel"),a.rightToLeft=t.rightToLeft,a.animation=t.animation,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel,a.theme=t.theme,a.dataSource=n,t.$.group.appendChild(a),t._groupPartCreated=!0,a.onExpandAll=()=>{if(t._appliedGrouping.expandAll)return t._appliedGrouping.expandAll=!1,void a.querySelector(".smart-group-panel-expand-button").removeAttribute("active");t._appliedGrouping.expandAll=!0,t._appliedGrouping.collapseAll=!1,a.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},a.onCollapseAll=()=>{if(t._appliedGrouping.collapseAll)return t._appliedGrouping.collapseAll=!1,void a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active");t._appliedGrouping.expandAll=!1,t._appliedGrouping.collapseAll=!0,a.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),a.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},a.addEventListener("apply",(e=>{const a=e.detail.sortByInfo,n=t._appliedGrouping.dataFields;t._appliedGrouping.dataFields=a.dataFields;const s=o.onRowInserted;if(o.onRowInserted=null,o.beginUpdate(),o.grouping.autoHideGroupColumn&&n)for(let e=0;e<n.length;e++){const t=o.columnByDataField[n[e]];t&&(t.visible=!0)}o.clearGroups();for(let e=0;e<a.dataFields.length;e++){const t=a.dataFields[e];o.addGroup(t)}t._appliedGrouping.expandAll&&o.expandAllRows(),t._appliedGrouping.collapseAll&&o.collapseAllRows(),o.endUpdate();const i=[];for(let e=0;e<o.dataSource.groupBy.length;e++)i.push(o.dataSource.groupBy[e]);o.$.fireEvent("group",{groups:i}),o.paging.enabled&&o._refreshPagesCount(),o.onRowInserted=s}))),t._refreshGroupButton(),t._openHeaderDropDown(t.$.groupButton)}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search("",!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),t.closeMenu();const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const n=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:n,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,void a.grid._recycle(!1);const o=a._searchInfo.source,n=[],s=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),n.push([t,a])})),o._filter(n,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(s.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=s,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,s.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:s.length}),a._searchInfo.highlighted=s[0],a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if("kanban"===t.view&&t._kanban)return e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++)}const o=-1===t.header.buttons.indexOf("views");a>0&&o?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"))}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let n=0,s=[],i=[],r=[];const l=o.onColumnChange;o.onColumnChange=null;for(let t in e){const a=e[t],l=o.columnByDataField[a.dataField];l&&(l.visible!==a.visible&&(s.push(a),i.push(l.visible),r.push(a.visible)),l.visible=a.visible,a.visible||n++)}o.onColumnChange=l,o.onColumnChange&&o.onColumnChange(s,"visible",i,r),n>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],n=a.oldIndex,s=a.newIndex,i=o.columns[s+1],r=o.columns[s-1],l=o.columns[n];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),o.reorderColumns(n,s,!0)}o.endUpdate()}});
|
|
65
|
-
Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"}},type:"object"},behavior:{value:{allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"object"},fileName:{value:"smartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:150,type:"number"},height:{value:null,type:"number?"},dataSource:{value:{contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertLeft:{value:{command:{value:"insertLeftCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-left",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertRight:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-right",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},description:{value:"",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:400,type:"any"},width:{value:400,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban"],type:"string"},currentUser:{value:null,type:"any"},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the smartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",kanbanNone:"None",kanbanNoneDescription:"Start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Basic kanban",kanbanBasicDescription:'Start from Basic kanban-style board with columns for "To do", "in progress" and "Done".',uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsertLeft:"Insert left",columnMenuItemInsertRight:"Insert right",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Shift</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Record with Id: {{value}}",dialogEditHeader:"Edit Record with Id: {{value}}",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonCancel:"CANCEL",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnStatus:"Create a group column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your data will be grouped in columns based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogImageHeader:"Image",dialogImageDrop:"or drag and drop image(s) to upload",dialogImageUpload:"Select Image(s) to Upload",dialogImageURL:"You can also provide the URL to an image",dialogImageURLUpload:"Upload",dialogImageLink:"Link (URL)",dialogImageDevice:"My Device",dialogImageSize:'No image currently added. The "{{value}}" image cannot be uploaded. Maximum image size is {{fileSize}}.',dialogImageCount:'The following images cannot be added "{{files}}". Maximum images allowed is {{fileCount}}.',dialogImageFileUpload:"No images currently selected for upload",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple Select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"Collaborator",dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeAutoNumber:"Auto Number",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnListItems:"List items",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnCheckItems:"Show Checkbox",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",noComments:"No comments to this record yet",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Details",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'Changed {{column}} from "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed {{column}} to "{{newValue}}"',rowCreated:"Row Created",propertyUpdated:'"{{value}}" updated',propertyRemoved:'"{{value}}" removed',dropImages:"Drop images here",addImages:"Add images",unassigned:"Unassigned",historyDate:"Date",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less Than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",formatColumn:"Format Column",formating:"Conditional Formatting",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:500,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["smart.menu.css","smart.filterpanel.css","smart.pager.css","smart.grid.css","smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' role='grid'>\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler"}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);super._upHandler(),t._tapTimer&&clearTimeout(t._tapTimer);const l=()=>{t.editing.isEditing&&!t.editing.dialog.enabled&&setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.endEdit()}}),50)};if(!e.originalEvent||(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),!e.originalEvent.target.closest(".smart-grid-dialog"))){if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;)if(a=a.parentNode,a===t){o=!0;break}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const e=n.querySelectorAll("smart-drop-down-list"),l=n.querySelectorAll("smart-date-time-picker"),a=n.querySelectorAll("smart-date-input"),i=n.querySelectorAll("smart-input");for(let t=0;t<e.length;t++)if(e[t].$.dropDownContainer.contains(o))return;for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.scrollView.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;return void t.closeMenu()}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX)if(n.top<=e.pageY&&n.top+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&t.sortBy(l),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l)}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField}),i("doubleClick"),t._onColumnDoubleClick(o,e)),t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,d=null;t._lastPointerDownTime=new Date;for(let e=0;e<a.length;e++){const t=a[e];if(t.hasAttribute("toggle-button")&&(i=t),t.hasAttribute("checkbox")&&(r=t),d||"smart-grid-cell"!==t.nodeName.toLowerCase()||(d=t),!n&&"smart-grid-row"===t.nodeName.toLowerCase()){n=t;break}}if(n&&d){const o=d?d.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn){const e=n.row;e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else{const o=n.row,l=d?d.cell:null;l.column._treeColumn&&r&&(o.checked=!o.checked),l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===d&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(o.header&&"row-resize"===o.header.style.cursor){const l=t.offset(o.header);if(t._rowToResize&&l.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=l.left+o.header.offsetWidth)return;o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const s=t._clickedCell===d&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,u=e.originalEvent?e.originalEvent:e,c=3===u.which;if(c||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),c&&t.contextMenu.enabled)return t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField,t._focusCell(o.id,l.column.dataField),t.openContextMenu(u.pageX+10,u.pageY+10),void(t.contextMenu.selector&&(u.stopPropagation(),u.preventDefault()));if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else s||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else s||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),a("doubleClick")),t._clickedCell===d&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}))),t._clickedRow=n,t._clickedCell=d,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0}_blurHandler(){this._focused=!1}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){switch(l._notify(e,t,o),e){case"onRowInserted":return;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o));case"users":case"currentUser":l._refreshCurrentUser();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":l.header.visible&&""===l.header.template&&(l.$.header.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=l.$.header.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar));break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index}}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":if(l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[],l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}if(l._renderColumns(),l._refreshHeaderBar(),l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return;case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":if(delete l._isFirstVirtualDataSourceRequest,"dataSource"===e&&t&&o&&t instanceof Smart.DataAdapter&&t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{l.beginUpdate();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e].$.id;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const e=l._filters,t=l._sortedColumns;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;t&&l._refreshSort(t),e&&e.length>0&&(l._filters=null,l.refreshFilters()),l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}return l.dataBind(),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"button"===l.editing.addNewRow.displayMode&&(l.editing.addNewRow._addButton&&l.editing.addNewRow._addButton.remove(),l._newRow&&l._newRow.element.classList.add("smart-hidden")),l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.removeAttribute("aria-readonly"):l.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){super.ready();const e=this,t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];e.filtering.enabled&&0===e._filterPanels.length&&requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this;let t=e._recyclingRows,o=0,l=e._autoRowHeight,a=0,n=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===t.length||0===e.columns.length||!e.hasVisibleColumn())return 0;e.rows.canNotify=!1;const i=e._measureRowElement(t[0].data),r=t.length;for(let d=0;d<r;d++){let r=t[d];if(!r.visible||!1===r.filtered){r.height=0,r.cellHeight=0,r.top=o;continue}const s=e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled;if((!r.height||!r.cellHeight||s||"auto"===r.height||"auto"===r._height||"auto"===e.layout.rowHeight||e.layout.isDirty)&&!r.expandHeight){if(r.detailHeight||(r.detailHeight=200),e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.height=e.layout.rowHeight,r.computedHeight&&(r.height=r.computedHeight),r.minHeight>r.height&&(r.height=r.minHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.element=i,r.grid=e,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l,o=r.canNotify;r.canNotify=!1,r.height=t,r.computedHeight&&(r.height=r.computedHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight),r.canNotify=o}else e.layout.rowHeight(d,r),r.height||(r.height=l),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}else{if("auto"===r.height||"auto"===r._height){r.element=i,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l;r.height=t,r._height="auto"}else r.height=l;void 0===r.label||r.summaryRow||"advanced"!==e.grouping.renderMode||(r.height=e.grouping.groupRowHeight),r.computedHeight&&(r.height=r.computedHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}e._rowGap&&d<e.rows.length-1&&(r.height+=e._rowGap)}!0===r.freeze||"near"===r.freeze?r.visible&&(a+=r.height):"far"===r.freeze&&r.visible&&(n+=r.height),r.freeze&&r.visible?r.top=o:(r.top!==o&&(r.top=o),r.expandHeight?o+=r.cellHeight:o+=r.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(o+=1*l),e.editing.addNewRow&&"button"===e.editing.addNewRow.displayMode&&(o+=1*l),e.filtering&&e.filtering.filterRow.visible&&(a+=l),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(o=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return e.__scrollHeight=o,e.__frozenNearHeight=a,e.__frozenFarHeight=n,e._scrollView.scrollHeight=o-e.$.scrollView.offsetHeight+a+n,o=e.__scrollHeight+a+n-1,e.grouping.enabled&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(o+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=o,i.remove(),t[0]&&delete t[0]._isMeasureRow,e.rows.canNotify=!0,o}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,d="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(d="far"),r++);r===n.length?l.freeze=d:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o}_refreshColumnHeights(){const e=this;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],d=0,s=0,u=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=d,u+=o.computedWidth,d+=o.computedWidth):"far"===o.freeze&&(o.left=s,s+=o.computedWidth):(o.left=u,u+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;t.summaryRow.visible&&(t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{!0!==t.editing.isEditing&&(t._calculateSummary(),!1!==e&&t._recycle(!1,!0,!1))}),100))}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[];let o=new Date;const l=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=l;const a=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],n=function(l,n,i){let r=null;if(e.isInitialized&&(o=new Date),r=l?l.grid?l:new Smart.Grid.Row({data:l,index:n,grid:e,createdBy:e.currentUser,createdDate:o}):new Smart.Grid.Row({data:{},index:n,grid:e,createdBy:e.currentUser,createdDate:o}),a)for(let e=0;e<a.length;e++){const t=a[e],o=t.getCellValue(r.id,t.dataField,l);void 0!==o&&(r.data[t.dataField]=o)}if(e.rowById[r.id]&&(r.id=e.rows.length,e.rowById[r.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};r.id=e()}if(e.onRowInit){e.onRowInit(n,r,e),30!==r.height&&(r.cellHeight=r.height);for(let t in r)-1!==r.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}))}if(r.selected&&(e._selection.rows[r.id]=!0,e._selection.indexes[r.index]=r.index),r.freeze&&r.visible){if(!0===r.freeze||"near"===r.freeze){e.rows.splice(t++,0,r);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}else if("far"===r.freeze){e.rows.push(r);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&e._frozenFarRows.push(t)}}else e.rows[n]?e.rows.splice(n,0,r):e.rows.push(r),r.data&&r.data.$&&(r.data.$.history=r.history,r.data.$.starred=r.starred,r.data.$.comments=r.comments,r.data.$.style=r.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&e._recycle(!1,!0),e._onRowInserted&&e._onRowInserted(l),i&&i(l)};if(void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:n});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([n],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[a.id];a.id=a.data.id=n;const o=e._getId();o&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a,t&&(t[o]=n,e.dataSource.dataItemById[a.id]=t,a.data=t)}e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),i&&i(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([n],[t],o,e)}else{const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n];void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),i&&i(t)}},i=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},r=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=n,e._removeLastRow=i,e._removeAt=r,e._rowHeight=e._autoRowHeight;const d=e.dataSource.length;if(e.setAttribute("aria-rowcount",d),e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];n(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];n(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(l(),e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let a=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)n(o[t],e.dataSource.length-o.length+t);else n(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],l=[],i=[];for(let r=0;r<i.length;r++){const d=t.index[r];e.rows[d]?(e.rows[d].data=i[r],o.push(d),l.push(e.rows[d]),i.push(e.rows[d].data)):(n(i[r],i[r].$.index),a=!0)}e.onRowUpdated&&e.onRowUpdated(o,l,i,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:n(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":n(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":r(t.index);break;case"removeLast":i();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==d){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize)),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize))}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),e.onLoad())}}l(),("update"!==t.action||a)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?e._frozenNearRows.push(o):"far"===o.freeze&&e._frozenFarRows.push(o),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]&&(l.data=e.dataSource[o],void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)),-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l))})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l.data=o,l.id=o.$.id,e.rowById[l.id]=l}return e.rows.canNotify=!0,void e.refresh()}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||e._render()})),e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),void super.render();const o=e.context;e.context=e,e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&e.header.buttons.indexOf("views")>=0&&e._updateKanbanTaskFields()),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale,e.$.header.appendChild(t),e.$.headerBar=e.$.header.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}a&&e.addFilter(t,a,!1)}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t&&e.addFilter(o.dataField,t,!1)}}e.refreshFilters()}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t){if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view&&e._initKanbanView()}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(){const e=this,t=e.conditionalFormatting;if(!t||0===t.length)return;if(!e._defaults){const t=getComputedStyle(e);e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)}}e._formatter||(e._formatter=new Smart.Utilities.ConditionalFormatter(e.dataSource));const o=e._defaults,l=e._formatter,a=[],n=function(t){if("all"===t){if(e.columns&&e.columns.map){const t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||t.push(l.dataField)}return t}return[]}return[t]};for(let e=0;e<t.length;e++){t[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:o.fontFamily,fontSize:o.fontSize,text:o.text,highlight:o.highlight},t[e]);const i=t[e],r=n(i.column),d=i.condition;l.color=i.highlight,l.comparator=i.firstValue,l.min=i.firstValue,l.max=i.secondValue;const s=l.format(d,r);for(let e in s){const t=s[e];for(let e in t){const o=t[e];o.color=i.text,o.fontFamily=i.fontFamily,o.fontSize=i.fontSize}}a.push(s)}if(e._formattingPanel&&(e._formattingPanel.items=t),0===a.length)return a[0];const i={};for(let e=0;e<a.length;e++){const t=a[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){i[e]||(i[e]={});for(let t in o)i[e][t]=Object.assign({},i[e][t],o[t])}}}e._conditionalFormatting=i}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const d=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:d,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));n.grid=e,e.columns.push(n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);"near"===e.rowDetail.position?(o.freeze="near",a.freeze="near",e.viewColumns.splice(l,0,a),e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30}),n=new Smart.Observable(a,a.observables);n.canNotify=!1,e.viewColumns.push(n),e._frozenFarColumns.splice(0,0,n);const i=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),r=new Smart.Observable(i,i.observables);r.canNotify=!1,"near"===e.editing.commandColumn.position?(i.freeze="near",r.freeze="near",e.viewColumns.splice(l,0,r),e._frozenNearColumns.splice(l,0,r)):(e.viewColumns.push(r),e._frozenFarColumns.splice(0,0,r)),e._commandColumn=r;const d=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(d,d.observables);if("near"===d.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s)),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}t._renderColumns(),t.__columnHeaderHeight=null,t.refresh()}onAttached(){const e=this;e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.isRendered&&e.isCompleted&&e._render()}onDetached(){const e=this;if(!e.isRendered)return;["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.querySelector("smart-grid-toolbar");if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}_observeColumns(){const e=this,t=function(t,o,l,a){l===a&&"selected"!==o||(t.propertyChanged(o,l,a),e.onColumnChange&&t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a))};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l&&(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),delete e.columnByDataField[l.dataField]),e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,requestAnimationFrame((()=>{if(e.filtering.enabled&&e.filtering.filterRow.visible)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(t._isUpdating)return;if(t.editing.isEditing)return;const o=t.querySelector("smart-grid-toolbar");if(!o||!o.$.headerDropDown.classList.contains("open"))if(t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&!t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&e.deltaX){const o=t.scrollLeft;if(0===o&&e.deltaX<0||o===t.scrollWidth&&e.deltaX>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaX<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaX)>=100?t._scrollView.scrollLeft+=l:t._scrollView.scrollLeft+=e.deltaX}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaY<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100?t._scrollView.scrollTop+=l:t._scrollView.scrollTop+=e.deltaY}}_refresh(){const e=this;if(e._isUpdating)return;const t=e.$.verticalScrollBar.offsetWidth;e.removeAttribute("grouped"),e.removeAttribute("tree");let o=!0;e.__autoHeightRows&&(e.__autoHeightRows=null,e._refreshColumnsResponsiveVisibility(),e._recycle(),o=!1),e._groups||(e._groups=[]),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>=0&&("advanced"===e.grouping.renderMode?e.setAttribute("grouped",""):e.setAttribute("tree",""),e._groups||(e._groups=[].concat(e.dataSource.groupBy.toArray())||[]),e._renderGroupBar()),e.grouping.enabled&&e.dataSource.groupBy&&0===e.dataSource.groupBy.length?e.$.breadcrumb&&(e.$.breadcrumb.dataSource=[]):e.dataSource.boundHierarchy&&(e.setAttribute("tree",""),e.setAttribute("role","treegrid")),(e.isInitialized||o)&&e._refreshColumnsResponsiveVisibility(),e._refreshLayout(),t!==e.$.verticalScrollBar.offsetWidth&&(e.__scrollWidth=null,e._refreshColumnsResponsiveVisibility(),e._refreshScrollBars(),0===e.$.verticalScrollBar.offsetWidth&&e.isRendered&&requestAnimationFrame((()=>{e._refreshScrollBars()}))),e._refreshSelection(),e._recycle(),e._refreshHeaderBar(),e._recyclingRows&&0===e._recyclingRows.length&&(e.$.placeholder.classList.remove("smart-hidden"),e.scrollHeight=0,e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${e.localize("filteredRecords")}`)),requestAnimationFrame((()=>{e._width=e.offsetWidth,e._height=e.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return;t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const d=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=d;let s=0,u=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(s+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(u+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===u&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=s,e._autoGeneratedColumnsFarWidth=u,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1);e._refreshRowHierarchy()}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let d=0;const s=function(t,l){for(let u=0;u<t.length;u++){const c=t[u];let m=o.rowById[c.$.id];if(n&&(m=o.rows[d],m||(m=r(c),o.rows.push(m)),c[i.leaf]?m.id=c.$.id:m.id="Group_"+c.$.id,o.rowById[m.id]=m),m||(m=r(c),o.rowById[m.id]=m),m.data=c,m.leaf=c[i.leaf]||!1,m.level=c[i.level],m.groupDataField=c.groupDataField,!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=c.label,m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),c.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),c.parent?(m.parent=o.rowById[c.parent.$.id],m.parentId=c.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(c);e&&(m.expanded=c[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==c[i.expanded]&&(m.expanded=c[i.expanded]);let g=!!e||m.expanded;a&&(g=!0);const p=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(p&&!m.data[p]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];c.parent&&c.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[p])&&(d++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(d++,g||c[i.leaf])if(l.push(m),c.children&&c.children.length>0){const e=s(c.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),c.children&&c.children.length>0){const e=s(c.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let u=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<u.length;o++){let l=u[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;if((a||null===a)&&0===l.level&&!l.parent){if(0===t(l.children).length)continue;e.push(l)}}u=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}o.rowHierarchy=s(u,new Array);let c=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&c.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=l++:t.visibleIndex=-1:t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=c),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow&&o._initializeRowElements(),o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e.editing.addNewRow.visible&&1===e._recyclingRows.length&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.header.visible?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));e.header.visible&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshElementsVisibility(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),d=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),s=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),u=parseInt(e.$.columnFarContainer.style.width)+parseInt(d.borderLeftWidth);if(e.__frozenNearWidth=s,e.__frozenFarWidth=u,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=d,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden")),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(s>0||u>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-s-u+"px",e.rightToLeft?o.style.right=s+"px":o.style.left=s+"px",o.style.setProperty("--smart-scroll-bar-near-size",s+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",u+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",u+e.__scrollBarSize+"px"))),t.refresh(),o.refresh()}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getColumns(){const e=this,t=[];if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}getState(){const e=this,t=e.getSortedColumns(),o=e.getFilteredColumns(),l=e.getGroups(),a=e.getSelectedCells(),n=e.getSelectedRows(),i=e.$.headerPager.querySelector("smart-pager");let r=0;return i&&(r=i.pagesCount),{sort:t,filter:o,groups:l,paging:{count:r,index:e.paging.pageIndex,size:e._pageSize},selectedCells:a,selectedRows:n}}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,t,e._farRowsAdded,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),0===o.columns.length&&o.column.element.classList.add("smart-hidden"),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_recycle(e,t,o){const l=this;if(l._layoutSuspended||!1===l.isAttached)return;if(l._isUpdating)return;if(l.editing.isEditing&&(l.endEdit(),l._isUpdating))return;l._recycleValues=void 0===o||o,l._removeCellContentPopup(),l._inputOverlay&&(l._inputOverlay.parentNode&&l._inputOverlay.parentNode.removeChild(l._inputOverlay),l._inputOverlay=null),l._selection.selectionRect&&l._refreshCellSelectionRect();const a=l._scrollView.scrollTop;let n,i=l._getRowIndexByPosition(a),r=l._recyclingRows,d=r[i],s=d?d.top:0,u=0,c=0,m=0,g=0;if(l._cellRowSpan&&l._cellRowSpan.maxSpan>0){let e=0;if(i>=5?e=5:i>=4?e=4:i>=3?e=3:i>=2?e=2:i>=1&&(e=1),e>0){const t=r[i-e];t&&(d=t,s=d?d.top:0,m=e*d.height,i-=e)}}l._cellRowSpan=[];for(let e=0;e<l._cellsMerge.length;e++){const t=l._cellsMerge[e],o=r.indexOf(t.row);if(i>o&&i<=o+t.rowSpan&&(i=o,d=t.row,m=Math.max(m,s-d.top),s=d.top,l.$.rowContainer.style.top=l.__frozenNearHeight-a+s+"px"),t.colSpan>1)for(let e=0;e<l.viewColumns.length;e++){const o=l.viewColumns[e];let a=o.autoGenerated?o:l.columnByDataField[o.dataField];if(a.visible&&a.left+a.computedWidth-l._scrollView.scrollLeft>=u&&a.left-a.computedWidth-l._scrollView.scrollLeft<l._clientSize.width){let e=l.columnByDataField[t.column.dataField];g=Math.max(g,a.left-e.left+a.computedWidth);break}}}let p=null;if(!1!==e||l._cellsMerge.length>0){for(let e=0;e<l._columnElements.length;e++){const t=l._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<l._columnGroups.length;e++){const t=l._columnGroups[e],o=t.element;l.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px"}l._firstVisibleColumn=null,l._lastVisibleColumn=null;for(let e=0;e<l.viewColumns.length;e++){let t=l.viewColumns[e];if(t.visible&&(l._firstVisibleColumn||(l._firstVisibleColumn=t),l._lastVisibleColumn=t),t.element&&(t===l._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(u+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-l._scrollView.scrollLeft>=u-g&&t.left-t.computedWidth-l._scrollView.scrollLeft<l._clientSize.width){const o=l._columnElements[c++];o&&(o.set("column",t,!1),o.parentNode||l.$.columnContainer.appendChild(o),p||(p=t,l._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===n&&(n=t.left))}}}if(void 0===n&&(n=0),l.rightToLeft){const e=l._scrollView.scrollWidth-l._scrollView.scrollLeft-l._scrollView.vScrollBar.offsetWidth;l.$.columnContainer.style.right=e+"px",e<=0&&!l._scrollView.scrollWidth&&(l.$.columnContainer.style.right=-l.offsetWidth+l._computedColumnsWidth+"px")}else l.$.columnContainer.style.left=-l._scrollView.scrollLeft+"px";if(l.$.rowContainer.style.top=l.__frozenNearHeight-a+s+"px",l.isScrolling&&!l.isHScrolling&&(l._scrollUpdate&&clearTimeout(l._scrollUpdate),l._scrollUpdate=setTimeout((function(){l.isScrolling||(l.$.rowContainer.style.top=parseInt(l.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!l._rowElements)return;const h=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&l.dataSource.length>l.virtualModeCachedRowsCount&&"infinite"!==l.scrolling;if(i>=0){c=0;let e=Math.max(l._clientSize.height,l._overflowOffset),t=0;h&&(l.rowById=[],l.rows&&l.rows.length>0&&void 0===l.rows[l.rows.length-1].top&&(l.rows[l.rows.length-1].top=(l.rows.length-1)*l.rows[0].height),l.rows&&l.rows.length>0&&(t=l._getVirtualRowIndexByPosition(a),s=t*l.rows[0].height,l.$.rowContainer.style.top=l.__frozenNearHeight-a+s+"px",l.paging.enabled||(i=0)),l.paging.enabled&&(t=l.paging.pageIndex*l._pageSize));for(let o=i;o<r.length;o++){const n=r[o];if(0===n.height||!n.visible||!1===n.filtered||n.freeze&&n.visible)continue;const d=n.height;if(n.expandHeight&&(e+=l.offsetHeight+n.expandHeight),!(s+d>=a-m&&s<=a+e||l._autoHeight))break;{const e=l._rowElements[c++];if(!e)break;e.setAttribute("aria-rowindex",t+o+1),n.element=e,n.grid=l,h&&(n.index=o+t,n.visibleIndex=o+t,l.paging.enabled?(n.data=l.dataSource[i+c-1],n.data&&(n.id=n.data.$.id,l.rowById[n.id]=n)):(n.data=l.dataSource[c-1],n.data&&(n.id=n.data.$.id,l.rowById[n.id]=n))),n.render()}s+=d}}l._renderFrozenRows();let f=c;if(c<l._rowElements.length)for(let e=c;e<l._rowElements.length;e++){const e=l._rowElements[c++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}l.editing.addNewRow&&l.editing.addNewRow.visible&&"button"===l.editing.addNewRow.displayMode&&l._rowElements[f]&&(l._newRow||(l._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:l,addNewRow:!0,inline:!0,autoGenerated:!0})),l._newRow.element=l._rowElements[f],l._newRow.element.classList.remove("smart-hidden"),l._newRow.render()),h&&l._selection.selectionRect&&l._refreshCellSelectionRect()}_renderFrozenRows(){const e=this;let t=!1,o=!1;0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,d=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(d=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(d=4),"center"!==l&&"middle"!==l||(d+=i.height/2-n.height/2),"bottom"===l&&(d+=i.height-n.height-4),t.style.left=r+"px",t.style.top=d+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo,sorting:o.getSortedColumns(),filtering:o.getFilteredColumns(),grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action)return void(t&&t(e.result));if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling)o._recycle(!1,!1);else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){if(o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize)),o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1)}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&(t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max,e.closeMenu(),e._addingNewRow=!1}),100)},t}addNewColumn(e){e&&this.columns.push(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.remove(),void delete t.editing.addNewRow._addButton;if("float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)?t.editing.addNewRow._addButton.classList.remove("float"):t.computedVerticalScrollBarVisibility?t.computedVerticalScrollBarVisibility&&"float"===e&&t.editing.addNewRow._addButton.classList.add("float"):t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.editing.addNewRow._addButton.style.bottom="20px":t.editing.addNewRow._addButton.style.bottom="")};t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&(t.editing.addNewRow._addButton||(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.appendChild(t.editing.addNewRow._addButton)),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o())})))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if(t._recycle(!1),t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")})))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e){const t=this;t.isInitialized&&(e&&(t._initializeRows(),t._initializeRowElements()),t._refresh(),t._refreshSummary())}refreshView(){this._recycle()}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t){const o=this;o._isUpdating--,o._isUpdating<0&&(o._isUpdating=0),!1!==e?o.refresh():!1!==t&&o.refreshView()}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
|
|
64
|
+
Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden")})),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;(t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled")})(e.dataSource&&0===e.dataSource.length),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget),t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight+"px";const a=()=>{if(e){const a=t.grid.offset(e);a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px"}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",a())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));if(super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t.grid.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),350)}}openSortPanel(e){const t=this,a=t.dataSource;t._refreshColumns("sort");const o=t.columns.map((e=>{const o=Object.assign({},e),n=t._appliedSorting.dataFields.indexOf(o.dataField),s=a.dataFields.find((e=>e.name===o.dataField));return s&&(o.dataType=s.dataType,o.sortIndex=n,-1!==n&&(o.sortDirection=t._appliedSorting.orderBy[n])),o})).filter((e=>e.allowSort));if(e&&t._appliedSorting&&-1===t._appliedSorting.dataFields.indexOf(e.dataField)){const a=o.find((t=>t.dataField===e.dataField));a.sortDirection="ascending",a.sortIndex=t._appliedSorting.dataFields.length}super.openSortPanel(o),t._closeDownloadMenu(),t._closeViewsMenu();const n=t.grid;n.closeMenu();const s=t.$.headerDropDown.querySelector("smart-sort-panel");if(!s)return;s.grid=n,s.$.maintainSortContainer.classList.remove("smart-hidden"),n.sorting.maintainSort?s.$.maintainSortContainer.firstElementChild.setAttribute("active",""):s.$.maintainSortContainer.firstElementChild.removeAttribute("active"),s._changeApplyButtonText();const i=s.$.inputNotSorted,r=()=>{const e=s.querySelectorAll(".smart-grid-panel-item");"many"===t.grid.sorting.mode||e.length<1?i.classList.remove("smart-visibility-hidden"):e.length>=1&&i.classList.add("smart-visibility-hidden")};s.onDataSourceChange=()=>{r()},r()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,n=0,s=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(o--,i.push(r.dataField)),r.visible||(n++,s.push(r.dataField)),t.push(r)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===n||o===n&&i.toString()!==s.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,n=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let s;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)s=o.querySelector("smart-column-panel"),s.locale=e.locale,s.messages=e._innerElementMessages.columnPanel,s.set("dataSource",n),s.propertyChangedHandler("dataSource",void 0,n),s.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=n,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],n=o[0],s=o[1];a.grid.columnByDataField[n].filter=s}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.sorting.maintainSort=t.maintainSort,e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")&&(t="customize"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,n=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&n.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();n.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)&&t.addSort(o.sortByInfo),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target;const o=t.grid.$.header;if(t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]),t._closeDownloadMenu(),t._closeViewsMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||a!==o&&o.contains(a))){const n=a.closest("smart-scroll-viewer"),s=a.closest(".smart-drop-down");if((!n||!o.contains(n.ownerElement))&&(!s||s.ownerElement&&!o.contains(s.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(n&&n.ownerElement){const e=n.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,n=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((t=>!1!==t._visible&&("filter"!==e&&"sort"!==e||!1!==t.visible))),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible,sortIndex:void 0!==e.sortIndex&&null!==e.sortIndex?e.sortIndex:-1,sortDirection:void 0!==e.sortOrder?e.sortOrder:null}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;n.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;n.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.grid._openRowSettingsDialog=t._openRowSettingsDialog,t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),e.header.onInit&&e.header.onInit(t)}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-views-menu"),a.rightToLeft=t.rightToLeft;const n=(e,a)=>{const o=document.createElement("smart-menu-item");let n="#D50000",s="smart-icon-table-alt";switch(a){case"grid":n="#3f51b5",s="smart-icon-table-alt","grid"===t.view&&o.setAttribute("focus","");break;case"pdf":n="#f4511e";break;case"kanban":n="#C40093",s="smart-icon-kanban","kanban"===t.view&&o.setAttribute("focus","");break;case"json":n="#8e24aa"}return o.label='<span style="color: '+n+'" class="smart-grid-icon '+s+'"></span>'+e,o.value=a,o};o.appendChild(n(t.localize("viewGrid"),"grid")),o.appendChild(n(t.localize("viewKanban"),"kanban")),a.appendChild(o),e.viewsMenu.appendChild(a),a.onItemClick=t=>{e._setView(t.detail.value)}}_setView(e){const t=this,a=t.grid;if(a.view!==e){if("kanban"===e){const e=a.context;a.context=a,a.view="kanban",a.context=e,a._kanbanInitialized&&a.columnByDataField.taskStatus?(a._showKanbanView(),t._refresh()):(delete a._kanbanInitialized,a._initKanbanView())}else"grid"===e&&(a.view="grid",a._hideKanbanView(),t._refresh());a.$.fireEvent("viewChanged",{view:e}),t._refresh()}}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const n=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const n='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+n+e,a.value=t,a};o.appendChild(n(t.localize("download")+" CSV","csv")),o.appendChild(n(t.localize("download")+" XLSX","xlsx")),o.appendChild(n(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")&&e._closeViewsMenu()}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled&&"grid"===t.view?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},t._sortedColumns){const a=[],o=[],n=[];for(let e=0;e<t._sortedColumns.length;e++){const s=t._sortedColumns[e];a.push(s.dataField),o.push(s.sortOrder),n.push(s.dataType)}e._appliedSorting={dataFields:a,dataTypes:n,orderBy:o},e._refreshSortButton()}if("grid"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumns();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const n=t.filters[o];a.filters.push([e,n.condition,n.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}else e.$.sortButton.classList.add("smart-hidden"),e.$.filterButton.classList.add("smart-hidden");e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e.refreshTools()}_refreshViewsButton(){const e=this;let t=e.grid.localize("viewGrid");switch(e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":e.$.viewsButton.classList.remove("kanban"),t=e.grid.localize("viewGrid")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>"}_refreshDownloadButton(){this.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation">'+this.grid.localize("download")+"</div>"}_openRowSettingsDialog(e){let t=this;t.getSelectedRows||(t=t.grid);const a=t.editing.dialog.enabled,o=t.editing.mode,n=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=e,t.beginEdit(e),t._endToolbarEdit?(t.removeEventListener("endEdit",t._endToolbarEdit,null),t.removeEventListener("cancelEdit",t._endToolbarEdit,null)):t._endToolbarEdit=()=>{t.context=t,t.editing.dialog.enabled=a,t.editing.mode=o,t.context=n,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endToolbarEdit),t.addEventListener("cancelEdit",t._endToolbarEdit)}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.querySelector("smart-grid-toolbar").$.deleteButton;0!==t?(a.classList.remove("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.querySelector("smart-grid-toolbar")._refreshDeleteButton()}openGroupPanel(e){const t=this;let a;const o=t.grid;t.$.headerDropDown.classList.add("group-panel"),t.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","format-panel"),t.$.group.classList.remove("smart-hidden"),t.$.filter.classList.add("smart-hidden"),t.$.customize.classList.add("smart-hidden"),t.$.sort.classList.add("smart-hidden"),t.$.search.classList.add("smart-hidden"),t.$.format.classList.add("smart-hidden"),t._closeDownloadMenu(),t._closeViewsMenu(),t._refreshColumns("group"),o.closeMenu();const n=t.columns.map((e=>{const a=Object.assign({},e);if(t._appliedGrouping&&t._appliedGrouping.dataFields){const e=t._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=e}return a})).filter((e=>e.allowGroup));e&&t._appliedGrouping&&-1===t._appliedGrouping.dataFields.indexOf(e.dataField)&&(n.find((t=>t.dataField===e.dataField)).groupIndex=t._appliedGrouping.dataFields.length),t._groupPartCreated?(a=t.$.group.firstElementChild,a.rightToLeft=t.rightToLeft,a.dataSource=n,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel):(a=document.createElement("smart-group-panel"),a.rightToLeft=t.rightToLeft,a.animation=t.animation,a.locale=t.locale,a.messages=t._innerElementMessages.groupPanel,a.theme=t.theme,a.dataSource=n,t.$.group.appendChild(a),t._groupPartCreated=!0,a.onExpandAll=()=>{if(t._appliedGrouping.expandAll)return t._appliedGrouping.expandAll=!1,void a.querySelector(".smart-group-panel-expand-button").removeAttribute("active");t._appliedGrouping.expandAll=!0,t._appliedGrouping.collapseAll=!1,a.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},a.onCollapseAll=()=>{if(t._appliedGrouping.collapseAll)return t._appliedGrouping.collapseAll=!1,void a.querySelector(".smart-group-panel-collapse-button").removeAttribute("active");t._appliedGrouping.expandAll=!1,t._appliedGrouping.collapseAll=!0,a.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),a.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},a.addEventListener("apply",(e=>{const a=e.detail.sortByInfo,n=t._appliedGrouping.dataFields;t._appliedGrouping.dataFields=a.dataFields;const s=o.onRowInserted;if(o.onRowInserted=null,o.beginUpdate(),o.grouping.autoHideGroupColumn&&n)for(let e=0;e<n.length;e++){const t=o.columnByDataField[n[e]];t&&(t.visible=!0)}o.clearGroups();for(let e=0;e<a.dataFields.length;e++){const t=a.dataFields[e];o.addGroup(t)}t._appliedGrouping.expandAll&&o.expandAllRows(),t._appliedGrouping.collapseAll&&o.collapseAllRows(),o.endUpdate();const i=[];for(let e=0;e<o.dataSource.groupBy.length;e++)i.push(o.dataSource.groupBy[e]);o.$.fireEvent("group",{groups:i}),o.paging.enabled&&o._refreshPagesCount(),o.onRowInserted=s}))),t._refreshGroupButton(),t._openHeaderDropDown(t.$.groupButton)}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search("",!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),t.closeMenu();const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const n=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:n,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,void a.grid._recycle(!1);const o=a._searchInfo.source,n=[],s=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),n.push([t,a])})),o._filter(n,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(s.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=s,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,s.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:s.length}),a._searchInfo.highlighted=s[0],a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if("kanban"===t.view&&t._kanban)return e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++)}const o=-1===t.header.buttons.indexOf("views");a>0&&o?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"))}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let n=0,s=[],i=[],r=[];const l=o.onColumnChange;o.onColumnChange=null;for(let t in e){const a=e[t],l=o.columnByDataField[a.dataField];l&&(l.visible!==a.visible&&(s.push(a),i.push(l.visible),r.push(a.visible)),l.visible=a.visible,a.visible||n++)}o.onColumnChange=l,o.onColumnChange&&o.onColumnChange(s,"visible",i,r),n>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],n=a.oldIndex,s=a.newIndex,i=o.columns[s+1],r=o.columns[s-1],l=o.columns[n];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),o.reorderColumns(n,s,!0)}o.endUpdate()}});
|
|
65
|
+
Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showColumnHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!1,type:"boolean"},showSortColumnBackground:{value:!1,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showTreeRowHeader:{value:!1,type:"boolean"},showTodayDateAsString:{value:!0,type:"boolean"}},type:"object"},behavior:{value:{allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"object"},fileName:{value:"smartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},contextMenu:{value:{selector:{value:"",type:"string"},enabled:{value:!1,type:"boolean"},width:{value:150,type:"number"},height:{value:null,type:"number?"},dataSource:{value:{contextMenuItemDelete:{value:{command:{value:"contextMenuItemDeleteCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemEdit:{value:{command:{value:"contextMenuItemEditCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},contextMenuItemCustom:{value:{command:{value:null,type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemClone:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertLeft:{value:{command:{value:"insertLeftCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-left",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertRight:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-right",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSort:{value:{command:{value:"addSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort",type:"string"},iconAlt:{value:"smart-icon-sort",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},description:{value:"",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:400,type:"any"},width:{value:400,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban"],type:"string"},currentUser:{value:null,type:"any"},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandToLevel:{value:0,type:"number",reflectToAttribute:!1},onGroupDefaultExpanded:{value:null,type:"any",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced","multipleColumns"]},groupBy:{value:[],type:"array",reflectToAttribute:!1},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},formatFunction:{value:null,type:"any",reflectToAttribute:!1},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the smartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",kanbanNone:"None",kanbanNoneDescription:"Start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Basic kanban",kanbanBasicDescription:'Start from Basic kanban-style board with columns for "To do", "in progress" and "Done".',uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Column settings",columnMenuItemClone:"Clone column",columnMenuItemInsertLeft:"Insert left",columnMenuItemInsertRight:"Insert right",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter column",columnMenuItemSort:"Sort column",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide column",columnMenuItemShow:"Show column",columnMenuItemDelete:"Delete column",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete row",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",contextMenuItemDelete:"Delete row",contextMenuItemEditCell:"Edit cell",contextMenuItemEditRow:"Edit row",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Shift</code> + <code>Space</code>",addNewRowAltSmall:"Add new empty row",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeaderDisabled:"Record with Id: {{value}}",dialogEditHeader:"Edit Record with Id: {{value}}",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonCancel:"CANCEL",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New column",dialogAddColumn:"Add Column",dialogAddColumnStatus:"Create a group column",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your data will be grouped in columns based on this column",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogImageHeader:"Image",dialogImageDrop:"or drag and drop image(s) to upload",dialogImageUpload:"Select Image(s) to Upload",dialogImageURL:"You can also provide the URL to an image",dialogImageURLUpload:"Upload",dialogImageLink:"Link (URL)",dialogImageDevice:"My Device",dialogImageSize:'No image currently added. The "{{value}}" image cannot be uploaded. Maximum image size is {{fileSize}}.',dialogImageCount:'The following images cannot be added "{{files}}". Maximum images allowed is {{fileCount}}.',dialogImageFileUpload:"No images currently selected for upload",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple Select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"Collaborator",dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeAutoNumber:"Auto Number",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnTypeStartDate:"Start Date",dialogAddColumnTypeDueDate:"Due Date",dialogAddColumnTypeProgress:"Progress",dialogAddColumnTypePriority:"Priority",dialogAddColumnTypeDescription:"Description",dialogAddColumnTypeTags:"Tags",dialogAddColumnTypeName:"Name",dialogAddColumnTypeColor:"Color",dialogAddColumnTypeChecklist:"Checklist",dialogAddColumnTypeAssigned:"Assignee",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnNumberFormatCurrencyInfo:"Choose the currency display format",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnListItems:"List items",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnCheckItems:"Show Checkbox",priority_low:"Low",priority_average:"Average",priority_high:"High",priority_critical:"Critical",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",copy:"copy",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",noComments:"No comments to this record yet",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Details",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'Changed {{column}} from "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed {{column}} to "{{newValue}}"',rowCreated:"Row Created",propertyUpdated:'"{{value}}" updated',propertyRemoved:'"{{value}}" removed',dropImages:"Drop images here",addImages:"Add images",unassigned:"Unassigned",historyDate:"Date",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",and:"And",apply:"Apply",applyOnce:"Apply once",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide columns",customizeOne:"1 hidden column",customizeHidden:"{{n}} hidden columns",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",maintainSort:"Maintain sort",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} columns",sortedByOne:"Sorted by 1 column",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less Than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",formatColumn:"Format Column",formating:"Conditional Formatting",reset:"Reset",filteredRecords:"All rows are filtered",duplicateCells:"Clone column cells and settings",duplicateSettings:"Clone column settings"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onLoad:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onComment:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowClass:{value:null,type:"any",reflectToAttribute:!1},onRowChange:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowHistory:{value:null,type:"any",reflectToAttribute:!1},onRowStyle:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onColumnClone:{value:null,type:"any",reflectToAttribute:!1},onColumnChange:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:500,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"boolean"},allowColumnHeaderEdit:{value:!1,type:"boolean"},autoUpdateFilterAndSort:{value:!0,type:"boolean"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},rowCSSRules:{value:null,type:"any"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},onInit:{value:null,reflectToAttribute:!1,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"any"}},type:"object"},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},maintainSort:{value:!0,type:"boolean"},commandKey:{value:"",allowedValues:["","Shift","Control","Alt"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"},sortToggleOnClick:{value:!0,type:"boolean"},sortToggleOnClickAndCommandKey:{value:!1,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["smart.menu.css","smart.filterpanel.css","smart.pager.css","smart.grid.css","smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' role='grid'>\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler",contextmenu:"_contextMenuHandler"}}_contextMenuHandler(e){if(this.contextMenu.enabled)return e.preventDefault(),e.stopPropagation(),!1}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);super._upHandler(),t._tapTimer&&clearTimeout(t._tapTimer);const l=()=>{t.editing.isEditing&&!t.editing.dialog.enabled&&setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.endEdit()}}),50)};if(!e.originalEvent||(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),!e.originalEvent.target.closest(".smart-grid-dialog"))){if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;)if(a=a.parentNode,a===t){o=!0;break}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const e=n.querySelectorAll("smart-drop-down-list"),l=n.querySelectorAll("smart-date-time-picker"),a=n.querySelectorAll("smart-date-input"),i=n.querySelectorAll("smart-input");for(let t=0;t<e.length;t++)if(e[t].$.dropDownContainer.contains(o))return;for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.scrollView.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;return void t.closeMenu()}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX)if(n.top<=e.pageY&&n.top+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void t._openAddColumnDialog();if(Smart.Utilities.Core.isMobile)n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled&&t.sortBy(l),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&t.sorting.sortToggleOnClick&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey){if("Alt"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"Shift"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"Control"===t.sorting.commandKey&&!1===e.metaKey&&!1===e.ctrlKey&&(t._canSort=!1),"Control"!==t.sorting.commandKey&&e.ctrlKey)return;if(!0===t.sorting.sortToggleOnClickAndCommandKey&&!t._canSort)return}t.sortBy(l)}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&(!t.appearance.showColumnHeaderDragIcon||!e.originalEvent.target.classList.contains("smart-drag-handle"))&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField}),i("doubleClick"),t._onColumnDoubleClick(o,e)),t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,d=null;t._lastPointerDownTime=new Date;for(let e=0;e<a.length;e++){const t=a[e];if(t.hasAttribute("toggle-button")&&(i=t),t.hasAttribute("checkbox")&&(r=t),d||"smart-grid-cell"!==t.nodeName.toLowerCase()||(d=t),!n&&"smart-grid-row"===t.nodeName.toLowerCase()){n=t;break}}if(n&&d){const o=d?d.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn){const e=n.row;e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else{const o=n.row,l=d?d.cell:null;l.column._treeColumn&&r&&(o.checked=!o.checked),l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===d&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(o.header&&"row-resize"===o.header.style.cursor){const l=t.offset(o.header);if(t._rowToResize&&l.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=l.left+o.header.offsetWidth)return;o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const s=t._clickedCell===d&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,u=e.originalEvent?e.originalEvent:e,c=3===u.which;if(c||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),c&&t.contextMenu.enabled)return t.contextMenu.id=o.id,t.contextMenu.dataField=l.column.dataField,t._focusCell(o.id,l.column.dataField),t.openContextMenu(u.pageX+10,u.pageY+10),void(t.contextMenu.selector&&(u.stopPropagation(),u.preventDefault()));if(o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else s||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else s||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),a("doubleClick")),t._clickedCell===d&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}))),t._clickedRow=n,t._clickedCell=d,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0}_blurHandler(){this._focused=!1}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if(e&&"function"==typeof e)e(t);else if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){switch(l._notify(e,t,o),e){case"onRowInserted":return;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o));case"users":case"currentUser":l._refreshCurrentUser();break;case"summaryRow_visible":{for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);const e=l.onRowInserted;l.onRowInserted=null,l._renderRows(!0),l.onRowInserted=e;break}case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":l.header.visible&&""===l.header.template&&(l.$.header.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=l.$.header.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar));break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index}}}break;case"grouping_groupBy":return l.dataSource&&l.dataSource.groupBy&&(l.dataSource.groupBy=o),void l.refresh();case"sorting_enabled":return void l.refresh();case"sorting_maintainSort":return void l._recycle(!1);case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":if(l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[],l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}if(l._renderColumns(),l._refreshHeaderBar(),l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return;case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":if(delete l._isFirstVirtualDataSourceRequest,"dataSource"===e&&t&&o&&t instanceof Smart.DataAdapter&&t.length===o.length&&t.length>0&&o.length>0&&!l.dataSourceSettings.parentDataField&&!t.parentDataField){if(l.dataSource=t,l._cachedDataSource===o)return;return setTimeout((()=>{l.beginUpdate();for(let e=0;e<o.length;e++){const t=o[e],a=l.dataSource[e].$.id;l._updateRow(a,t,!0)}delete l.__autoRowHeight,l._virtualOnExpandCache=[],l._cellsMerge=[],l._cellStyles=[];const e=l._filters,t=l._sortedColumns;if(l.clearSort(),l.filtering.filterRow)for(let e=0;e<l.columns.length;e++)l.columns[e]._filterEditorInitialized=!1;for(let e=0;e<l.columns.length;e++)delete l.columns[e]._cellsCachedValues;t&&l._refreshSort(t),e&&e.length>0&&(l._filters=null,l.refreshFilters()),l.endUpdate()})),l._cachedDataSource=o,void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l))}return l.dataBind(),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return!1===l.editing.addNewRow.visible&&"button"===l.editing.addNewRow.displayMode&&(l.editing.addNewRow._addButton&&l.editing.addNewRow._addButton.remove(),l._newRow&&l._newRow.element.classList.add("smart-hidden")),l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.removeAttribute("aria-readonly"):l.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){super.ready();const e=this,t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];e.filtering.enabled&&0===e._filterPanels.length&&requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){if(l.children[1].children[a].style.height="auto",e.columns[0]){const t=o.getCell(e.columns[0].dataField);t&&t.render()}t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this;let t=e._recyclingRows,o=0,l=e._autoRowHeight,a=0,n=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===t.length||0===e.columns.length||!e.hasVisibleColumn())return 0;e.rows.canNotify=!1;const i=e._measureRowElement(t[0].data),r=t.length;for(let d=0;d<r;d++){let r=t[d];if(!r.visible||!1===r.filtered){r.height=0,r.cellHeight=0,r.top=o;continue}const s=e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled;if((!r.height||!r.cellHeight||s||"auto"===r.height||"auto"===r._height||"auto"===e.layout.rowHeight||e.layout.isDirty)&&!r.expandHeight){if(r.detailHeight||(r.detailHeight=200),e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.height=e.layout.rowHeight,r.computedHeight&&(r.height=r.computedHeight),r.minHeight>r.height&&(r.height=r.minHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.element=i,r.grid=e,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l,o=r.canNotify;r.canNotify=!1,r.height=t,r.computedHeight&&(r.height=r.computedHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight),r.canNotify=o}else e.layout.rowHeight(d,r),r.height||(r.height=l),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}else{if("auto"===r.height||"auto"===r._height){r.element=i,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l;r.height=t,r._height="auto"}else r.height=l;void 0===r.label||r.summaryRow||"advanced"!==e.grouping.renderMode||(r.height=e.grouping.groupRowHeight),r.computedHeight&&(r.height=r.computedHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}e._rowGap&&d<e.rows.length-1&&(r.height+=e._rowGap)}!0===r.freeze||"near"===r.freeze?r.visible&&(a+=r.height):"far"===r.freeze&&r.visible&&(n+=r.height),r.freeze&&r.visible?r.top=o:(r.top!==o&&(r.top=o),r.expandHeight?o+=r.cellHeight:o+=r.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(o+=1*l),e.editing.addNewRow&&"button"===e.editing.addNewRow.displayMode&&(o+=1*l),e.filtering&&e.filtering.filterRow.visible&&(a+=l),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),"virtual"===e.scrolling&&t>=e.virtualModeCachedRowsCount&&(o=e.rows[0]?e.rows[0].height*e.dataSource.length:e.layout.rowMinHeight*e.dataSource.length)}return e.__scrollHeight=o,e.__frozenNearHeight=a,e.__frozenFarHeight=n,e._scrollView.scrollHeight=o-e.$.scrollView.offsetHeight+a+n,o=e.__scrollHeight+a+n-1,e.grouping.enabled&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(o+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=o,i.remove(),t[0]&&delete t[0]._isMeasureRow,e.rows.canNotify=!0,o}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let t=0;t<o.length;t++)o[t].parent=null,o[t].groups=null,o[t].labelTemplate=e.columnGroups[t].labelTemplate;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,d="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(d="far"),r++);r===n.length?l.freeze=d:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o}_refreshColumnHeights(){const e=this;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],d=0,s=0,u=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=d,u+=o.computedWidth,d+=o.computedWidth):"far"===o.freeze&&(o.left=s,s+=o.computedWidth):(o.left=u,u+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,labelTemplate:l.labelTemplate,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;t.summaryRow.visible&&(t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{!0!==t.editing.isEditing&&(t._calculateSummary(),!1!==e&&t._recycle(!1,!0,!1))}),100))}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[];let o=new Date;const l=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=l;const a=e.columns?e.columns.filter((e=>void 0!==e.getCellValue)):[],n=function(l,n,i){let r=null;if(e.isInitialized&&(o=new Date),r=l?l.grid?l:new Smart.Grid.Row({data:l,index:n,grid:e,createdBy:e.currentUser,createdDate:o}):new Smart.Grid.Row({data:{},index:n,grid:e,createdBy:e.currentUser,createdDate:o}),a)for(let e=0;e<a.length;e++){const t=a[e],o=t.getCellValue(r.id,t.dataField,l);void 0!==o&&(r.data[t.dataField]=o)}if(e.rowById[r.id]&&(r.id=e.rows.length,e.rowById[r.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};r.id=e()}if(e.onRowInit){e.onRowInit(n,r,e),30!==r.height&&(r.cellHeight=r.height);for(let t in r)-1!==r.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}))}if(r.selected&&(e._selection.rows[r.id]=!0,e._selection.indexes[r.index]=r.index),r.freeze&&r.visible){if(!0===r.freeze||"near"===r.freeze){e.rows.splice(t++,0,r);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}else if("far"===r.freeze){e.rows.push(r);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&e._frozenFarRows.push(t)}}else e.rows[n]?e.rows.splice(n,0,r):e.rows.push(r),r.data&&r.data.$&&(r.data.$.history=r.history,r.data.$.starred=r.starred,r.data.$.comments=r.comments,r.data.$.style=r.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e._getId()&&(l.data[e._getId()]=l.id),t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else{const t=e.dataSource.dataItemById[l.id];l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id;const a=e._getId();a&&(l.data[e._getId()]=l.id),t&&(t[a]=o,e.dataSource.dataItemById[l.id]=t,l.data=t),e.rowById[l.id]=l}-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&e._recycle(!1,!0),e._onRowInserted&&e._onRowInserted(l),i&&i(l)};if(void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:n});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([n],[t],o,e),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],n=t?t[l]:void 0;if(void 0!==n){const t=e.dataSource.dataItemById[a.id];a.id=a.data.id=n;const o=e._getId();o&&(a.data[e._getId()]=a.id),e.rowById[a.id]=a,t&&(t[o]=n,e.dataSource.dataItemById[a.id]=t,a.data=t)}e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),i&&i(a)}delete e._undoRedoAction,e.endUpdate(!1)}),e)}}),l)}else e.onRowInserted([n],[t],o,e)}else{const t=void 0===n?e.rows[e.rows.length-1]:e.rows[n];void 0===n&&(n=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=n)),i&&i(t)}},i=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index],e),e._setRemoveUndoRedo(t)},r=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t],e),e._setRemoveUndoRedo(o)};e._add=n,e._removeLastRow=i,e._removeAt=r,e._rowHeight=e._autoRowHeight;const d=e.dataSource.length;if(e.setAttribute("aria-rowcount",d),e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];n(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];n(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(l(),e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let a=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)n(o[t],e.dataSource.length-o.length+t);else n(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],l=[],i=[];for(let r=0;r<i.length;r++){const d=t.index[r];e.rows[d]?(e.rows[d].data=i[r],o.push(d),l.push(e.rows[d]),i.push(e.rows[d].data)):(n(i[r],i[r].$.index),a=!0)}e.onRowUpdated&&e.onRowUpdated(o,l,i,e)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:n(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data],e)}break;case"insert":n(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":r(t.index);break;case"removeLast":i();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==d){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize)),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize))}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle(),e.onLoad&&(e.onLoad(),e.onLoad())}}l(),("update"!==t.action||a)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?e._frozenNearRows.push(o):"far"===o.freeze&&e._frozenFarRows.push(o),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||(l.propertyChanged(a,n,i),e.onRowChange&&l.properties.indexOf(a)>=0&&e.onRowChange(l,a,n,i,e))),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]&&(l.data=e.dataSource[o],void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)),-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l))})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l.data=o,l.id=o.$.id,e.rowById[l.id]=l}return e.rows.canNotify=!0,void e.refresh()}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||e._render()})),e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),void super.render();const o=e.context;e.context=e,e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_render(){const e=this;if(e.isInitialized||(e.onBeforeInit&&(e.onBeforeInit(e),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&e.header.buttons.indexOf("views")>=0&&e._updateKanbanTaskFields()),(()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy||e.grouping.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:e.grouping.groupBy}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(e),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),t&&e.grouping.enabled&&e.grouping.groupBy.length&&e.dataSource&&(e.dataSource.groupBy=e.grouping.groupBy),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale,e.$.header.appendChild(t),e.$.headerBar=e.$.header.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}if(0===t.length&&e.sorting.sort)for(let o=0;o<e.sorting.sort.length;o++){const l=e.sorting.sort[o],a=Object.keys(l)[0],n=l[a],i=e.columnByDataField[a];i&&(t.push(i),i.sortOrder=n||"asc")}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}a&&e.addFilter(t,a,!1)}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t&&e.addFilter(o.dataField,t,!1)}}e.refreshFilters()}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy?e.expandAllRows():e.grouping.enabled&&e.grouping.autoExpandToLevel&&e.rowHierarchy&&e.expandRowsToGroupLevel(e.grouping.autoExpandToLevel),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t){if(e.onAfterInit&&(e.onAfterInit(e),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}!e.dataSource||e.dataSource.url||e.dataSource.virtualDataSource||e.onLoad&&e.onLoad(e)}"kanban"===e.view&&e._initKanbanView()}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rows.toArray?e.rows.toArray():[],o=e.rowHierarchy?e.rowHierarchy:t,l=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,o,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=l,l}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(){const e=this,t=e.conditionalFormatting;if(!t||0===t.length)return;if(!e._defaults){const t=getComputedStyle(e);e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)}}e._formatter||(e._formatter=new Smart.Utilities.ConditionalFormatter(e.dataSource));const o=e._defaults,l=e._formatter,a=[],n=function(t){if("all"===t){if(e.columns&&e.columns.map){const t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||t.push(l.dataField)}return t}return[]}return[t]};for(let e=0;e<t.length;e++){t[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:o.fontFamily,fontSize:o.fontSize,text:o.text,highlight:o.highlight},t[e]);const i=t[e],r=n(i.column),d=i.condition;l.color=i.highlight,l.comparator=i.firstValue,l.min=i.firstValue,l.max=i.secondValue;const s=l.format(d,r);for(let e in s){const t=s[e];for(let e in t){const o=t[e];o.color=i.text,o.fontFamily=i.fontFamily,o.fontSize=i.fontSize}}a.push(s)}if(e._formattingPanel&&(e._formattingPanel.items=t),0===a.length)return a[0];const i={};for(let e=0;e<a.length;e++){const t=a[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){i[e]||(i[e]={});for(let t in o)i[e][t]=Object.assign({},i[e][t],o[t])}}}e._conditionalFormatting=i}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const d=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:d,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e,a.label&&/<.+?>/.test(a.label)&&a.label.replace&&("all"===e.dataSourceSettings.sanitizeHTML?a.label=a.label.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):"blackList"===e.dataSourceSettings.sanitizeHTML&&(a.label=window.Smart.Utilities.Core.escapeHTML(a.label)));const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));n.grid=e,e.columns.push(n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n.getState())}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);"near"===e.rowDetail.position?(o.freeze="near",a.freeze="near",e.viewColumns.splice(l,0,a),e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30}),n=new Smart.Observable(a,a.observables);n.canNotify=!1,e.viewColumns.push(n),e._frozenFarColumns.splice(0,0,n);const i=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),r=new Smart.Observable(i,i.observables);r.canNotify=!1,"near"===e.editing.commandColumn.position?(i.freeze="near",r.freeze="near",e.viewColumns.splice(l,0,r),e._frozenNearColumns.splice(l,0,r)):(e.viewColumns.push(r),e._frozenFarColumns.splice(0,0,r)),e._commandColumn=r;const d=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),s=new Smart.Observable(d,d.observables);if("near"===d.freeze?(e.viewColumns.splice(l,0,s),e._frozenNearColumns.splice(l,0,s)):(e.viewColumns.push(s),e._frozenFarColumns.splice(0,0,s)),e._selectionColumn=s,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}setColumns(e){const t=this;if(null===e)return void(t.columns=[]);t.beginUpdate(),t.columns.canNotify=!1;let o=[],l=[];for(let l=0;l<e.length;l++){const a=e[l];let n=!0;for(let e=0;e<t.columns.length;e++)if(t.columns[e].dataField===a.dataField){n=!1;break}n&&o.push(a)}const a=e.map((e=>e.dataField));for(let e=0;e<t.columns.length;e++){const o=t.columns[e];-1===a.indexOf(o.dataField)&&l.push(o)}l.forEach((e=>{const o=t.columns.indexOf(e);o>=0&&t.columns.splice(o,1)}));for(let e=0;e<o.length;e++)t.columns.push(o[e]);if(t.columns.canNotify=!0,t.endUpdate(),t._columnGroups=[],t._columnHeights=0,t.viewColumns)for(let e=0;e<t.viewColumns.length;e++){const o=t.viewColumns[e],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}t._renderColumns(),t.__columnHeaderHeight=null,t.refresh()}onAttached(){const e=this;e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.isRendered&&e.isCompleted&&e._render()}onDetached(){const e=this;if(!e.isRendered)return;["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail","_dialogAddColumn"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.querySelector("smart-grid-toolbar");if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}_observeColumns(){const e=this,t=function(t,o,l,a){l===a&&"selected"!==o||(t.propertyChanged(o,l,a),e.onColumnChange&&t.stateProps.indexOf(o)>=0&&e.onColumnChange(t,o,l,a))};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;if(!e._dragDrop&&e.onColumnInserted){e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]);const o=l.getState();o.dataField=l.dataField,e._onColumnInsertData.push(o),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50)}};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l&&(l.filter&&e.removeFilter(l.dataField),l.sortOrder&&e.removeSort(l.dataField),e.removeGroup(l.dataField),delete e.columnByDataField[l.dataField]),e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,requestAnimationFrame((()=>{if(e.filtering.enabled&&e.filtering.filterRow.visible)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(t._isUpdating)return;if(t.editing.isEditing)return;const o=t.querySelector("smart-grid-toolbar");if(!o||!o.$.headerDropDown.classList.contains("open"))if(t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&!t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&e.deltaX){const o=t.scrollLeft;if(0===o&&e.deltaX<0||o===t.scrollWidth&&e.deltaX>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaX<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaX)>=100?t._scrollView.scrollLeft+=l:t._scrollView.scrollLeft+=e.deltaX}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaY<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100?t._scrollView.scrollTop+=l:t._scrollView.scrollTop+=e.deltaY}}_refresh(){const e=this;if(e._isUpdating)return;const t=e.$.verticalScrollBar.offsetWidth;e.removeAttribute("grouped"),e.removeAttribute("tree");let o=!0;e.__autoHeightRows&&(e.__autoHeightRows=null,e._refreshColumnsResponsiveVisibility(),e._recycle(),o=!1),e._groups||(e._groups=[]),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>=0&&("advanced"===e.grouping.renderMode?e.setAttribute("grouped",""):e.setAttribute("tree",""),e._groups||(e._groups=[].concat(e.dataSource.groupBy.toArray())||[]),e._renderGroupBar()),e.grouping.enabled&&e.dataSource.groupBy&&0===e.dataSource.groupBy.length?e.$.breadcrumb&&(e.$.breadcrumb.dataSource=[]):e.dataSource.boundHierarchy&&(e.setAttribute("tree",""),e.setAttribute("role","treegrid")),(e.isInitialized||o)&&e._refreshColumnsResponsiveVisibility(),e._refreshLayout(),t!==e.$.verticalScrollBar.offsetWidth&&(e.__scrollWidth=null,e._refreshColumnsResponsiveVisibility(),e._refreshScrollBars(),0===e.$.verticalScrollBar.offsetWidth&&e.isRendered&&requestAnimationFrame((()=>{e._refreshScrollBars()}))),e._refreshSelection(),e._recycle(),e._refreshHeaderBar(),e._recyclingRows&&0===e._recyclingRows.length&&(e.$.placeholder.classList.remove("smart-hidden"),e.scrollHeight=0,e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${e.localize("filteredRecords")}`)),requestAnimationFrame((()=>{e._width=e.offsetWidth,e._height=e.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return;t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;(e>0||"grid"!==t.view)&&(t.offsetHeight>=e?(t._refreshLayout(),t._initializeRowElements()):"grid"!==t.view&&t._refreshLayout()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const d=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=d;let s=0,u=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(s+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(u+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===u&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=s,e._autoGeneratedColumnsFarWidth=u,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1);e._refreshRowHierarchy()}_getId(){const e=this;return e.dataSource&&e.dataSource.id?e.dataSource.id:e.dataSourceSettings.id?e.dataSourceSettings.id:void 0}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),o.grouping.enabled&&o.dataSource.groupBy&&0===o.dataSource.groupBy.length)return;let n=!1;if(o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&o.dataSource.virtualDataSourceOnExpand&&(n=!0),o.dataSource.boundHierarchy){const i=o.dataSource.reservedNames,r=function(e){return new Smart.Grid.Row({data:e,grid:o,index:o.rows.length})};let d=0;const s=function(t,l){for(let u=0;u<t.length;u++){const c=t[u];let m=o.rowById[c.$.id];if(n&&(m=o.rows[d],m||(m=r(c),o.rows.push(m)),c[i.leaf]?m.id=c.$.id:m.id="Group_"+c.$.id,o.rowById[m.id]=m),m||(m=r(c),o.rowById[m.id]=m),m.data=c,m.leaf=c[i.leaf]||!1,m.level=c[i.level],m.groupDataField=c.groupDataField,!m.groupDataField&&o.appearance.showTreeRowHeader&&(m.groupDataField=o.columns[m.level].dataField),m.label=c.label,m.children=[],m.data&&(m.filtered=void 0===m.data.$.filtered||m.data.$.filtered),c.summaryRow&&(m.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==m.id)&&(m.expandHeight=0),c.parent?(m.parent=o.rowById[c.parent.$.id],m.parentId=c.parent.$.id):(m.parent=null,m.parentId=null),o.grouping.onGroupDefaultExpanded&&!o.isRendered){const e=o.grouping.onGroupDefaultExpanded(c);e&&(m.expanded=c[i.expanded]=e)}o.appearance.allowRowToggleAnimation||void 0!==c[i.expanded]&&(m.expanded=c[i.expanded]);let g=!!e||m.expanded;a&&(g=!0);const p=o.dataSource&&o.dataSource.id||o.dataSourceSettings.id;if(p&&!m.data[p]&&o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length){const e=o.dataSource.groupBy[m.level];c.parent&&c.parent.expanded&&(""===m.data[e]&&o.dataSource.id&&!m.data.data[o.dataSource.id]||m.leaf&&!m.data[p])&&(d++,m.filtered=!1)}if(!0===m.visible&&!1!==m.filtered)if(d++,g||c[i.leaf])if(l.push(m),c.children&&c.children.length>0){const e=s(c.children,new Array);0===e.length&&(m.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0);else if(l.push(m),c.children&&c.children.length>0){const e=s(c.children,new Array);0===e.length&&(m.leaf=!0),m.children=e}else c.children&&0===c.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?m.data._loaded&&(m.leaf=!0):m.leaf=!0)}return l};let u=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<u.length;o++){let l=u[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;if((a||null===a)&&0===l.level&&!l.parent){if(0===t(l.children).length)continue;e.push(l)}}u=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}o.rowHierarchy=s(u,new Array);let c=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&c.push(t),t.canNotify=!1,o.grouping.enabled&&o.dataSource&&o.dataSource.groupBy.length?t.leaf?t.visibleIndex=l++:t.visibleIndex=-1:t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=c),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow&&o._initializeRowElements(),o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e.editing.addNewRow.visible&&1===e._recyclingRows.length&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.header.visible?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));e.header.visible&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshElementsVisibility(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),d=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),s=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),u=parseInt(e.$.columnFarContainer.style.width)+parseInt(d.borderLeftWidth);if(e.__frozenNearWidth=s,e.__frozenFarWidth=u,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=d,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden")),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(s>0||u>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-s-u+"px",e.rightToLeft?o.style.right=s+"px":o.style.left=s+"px",o.style.setProperty("--smart-scroll-bar-near-size",s+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",u+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",u+e.__scrollBarSize+"px"))),t.refresh(),o.refresh()}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getColumns(){const e=this,t=[];if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}getState(){const e=this,t=e.getSortedColumns(),o=e.getFilteredColumns(),l=e.getGroups(),a=e.getSelectedCells(),n=e.getSelectedRows(),i=e.$.headerPager.querySelector("smart-pager");let r=0;return i&&(r=i.pagesCount),{sort:t,filter:o,groups:l,paging:{count:r,index:e.paging.pageIndex,size:e._pageSize},selectedCells:a,selectedRows:n}}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,t,e._farRowsAdded,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),0===o.columns.length&&o.column.element.classList.add("smart-hidden"),0===t&&0===e.columns.indexOf(o.columns[0])&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_recycle(e,t,o){const l=this;if(l._layoutSuspended||!1===l.isAttached)return;if(l._isUpdating)return;if(l.editing.isEditing&&(l.endEdit(),l._isUpdating))return;l._recycleValues=void 0===o||o,l._removeCellContentPopup(),l._inputOverlay&&(l._inputOverlay.parentNode&&l._inputOverlay.parentNode.removeChild(l._inputOverlay),l._inputOverlay=null),l._selection.selectionRect&&l._refreshCellSelectionRect();const a=l._scrollView.scrollTop;let n,i=l._getRowIndexByPosition(a),r=l._recyclingRows,d=r[i],s=d?d.top:0,u=0,c=0,m=0,g=0;if(l._cellRowSpan&&l._cellRowSpan.maxSpan>0){let e=0;if(i>=5?e=5:i>=4?e=4:i>=3?e=3:i>=2?e=2:i>=1&&(e=1),e>0){const t=r[i-e];t&&(d=t,s=d?d.top:0,m=e*d.height,i-=e)}}l._cellRowSpan=[];for(let e=0;e<l._cellsMerge.length;e++){const t=l._cellsMerge[e],o=r.indexOf(t.row);if(i>o&&i<=o+t.rowSpan&&(i=o,d=t.row,m=Math.max(m,s-d.top),s=d.top,l.$.rowContainer.style.top=l.__frozenNearHeight-a+s+"px"),t.colSpan>1)for(let e=0;e<l.viewColumns.length;e++){const o=l.viewColumns[e];let a=o.autoGenerated?o:l.columnByDataField[o.dataField];if(a.visible&&a.left+a.computedWidth-l._scrollView.scrollLeft>=u&&a.left-a.computedWidth-l._scrollView.scrollLeft<l._clientSize.width){let e=l.columnByDataField[t.column.dataField];g=Math.max(g,a.left-e.left+a.computedWidth);break}}}let p=null;if(!1!==e||l._cellsMerge.length>0){for(let e=0;e<l._columnElements.length;e++){const t=l._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<l._columnGroups.length;e++){const t=l._columnGroups[e],o=t.element;l.rightToLeft?o.style.right=t.right+"px":o.style.left=t.left+"px",o.style.width=t.computedWidth+"px"}l._firstVisibleColumn=null,l._lastVisibleColumn=null;for(let e=0;e<l.viewColumns.length;e++){let t=l.viewColumns[e];if(t.visible&&(l._firstVisibleColumn||(l._firstVisibleColumn=t),l._lastVisibleColumn=t),t.element&&(t===l._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(u+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-l._scrollView.scrollLeft>=u-g&&t.left-t.computedWidth-l._scrollView.scrollLeft<l._clientSize.width){const o=l._columnElements[c++];o&&(o.set("column",t,!1),o.parentNode||l.$.columnContainer.appendChild(o),p||(p=t,l._firstRenderedColumn=t),t.element=o,t.render(),o.setAttribute("aria-colindex",e+1),void 0===n&&(n=t.left))}}}if(void 0===n&&(n=0),l.rightToLeft){const e=l._scrollView.scrollWidth-l._scrollView.scrollLeft-l._scrollView.vScrollBar.offsetWidth;l.$.columnContainer.style.right=e+"px",e<=0&&!l._scrollView.scrollWidth&&(l.$.columnContainer.style.right=-l.offsetWidth+l._computedColumnsWidth+"px")}else l.$.columnContainer.style.left=-l._scrollView.scrollLeft+"px";if(l.$.rowContainer.style.top=l.__frozenNearHeight-a+s+"px",l.isScrolling&&!l.isHScrolling&&(l._scrollUpdate&&clearTimeout(l._scrollUpdate),l._scrollUpdate=setTimeout((function(){l.isScrolling||(l.$.rowContainer.style.top=parseInt(l.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!l._rowElements)return;const h=l.dataSource&&l.dataSource.virtualDataSource&&!l.dataSource.virtualDataSourceOnExpand&&l.dataSource.length>l.virtualModeCachedRowsCount&&"infinite"!==l.scrolling;if(i>=0){c=0;let e=Math.max(l._clientSize.height,l._overflowOffset),t=0;h&&(l.rowById=[],l.rows&&l.rows.length>0&&void 0===l.rows[l.rows.length-1].top&&(l.rows[l.rows.length-1].top=(l.rows.length-1)*l.rows[0].height),l.rows&&l.rows.length>0&&(t=l._getVirtualRowIndexByPosition(a),s=t*l.rows[0].height,l.$.rowContainer.style.top=l.__frozenNearHeight-a+s+"px",l.paging.enabled||(i=0)),l.paging.enabled&&(t=l.paging.pageIndex*l._pageSize));for(let o=i;o<r.length;o++){const n=r[o];if(0===n.height||!n.visible||!1===n.filtered||n.freeze&&n.visible)continue;const d=n.height;if(n.expandHeight&&(e+=l.offsetHeight+n.expandHeight),!(s+d>=a-m&&s<=a+e||l._autoHeight))break;{const e=l._rowElements[c++];if(!e)break;e.setAttribute("aria-rowindex",t+o+1),n.element=e,n.grid=l,h&&(n.index=o+t,n.visibleIndex=o+t,l.paging.enabled?(n.data=l.dataSource[i+c-1],n.data&&(n.id=n.data.$.id,l.rowById[n.id]=n)):(n.data=l.dataSource[c-1],n.data&&(n.id=n.data.$.id,l.rowById[n.id]=n))),n.render()}s+=d}}l._renderFrozenRows();let f=c;if(c<l._rowElements.length)for(let e=c;e<l._rowElements.length;e++){const e=l._rowElements[c++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}l.editing.addNewRow&&l.editing.addNewRow.visible&&"button"===l.editing.addNewRow.displayMode&&l._rowElements[f]&&(l._newRow||(l._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:l,addNewRow:!0,inline:!0,autoGenerated:!0})),l._newRow.element=l._rowElements[f],l._newRow.element.classList.remove("smart-hidden"),l._newRow.render()),h&&l._selection.selectionRect&&l._refreshCellSelectionRect()}_renderFrozenRows(){const e=this;let t=!1,o=!1;0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,d=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(d=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(d=4),"center"!==l&&"middle"!==l||(d+=i.height/2-n.height/2),"bottom"===l&&(d+=i.height-n.height-4),t.style.left=r+"px",t.style.top=d+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o._toggledRow||(o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility()),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo,sorting:o.getSortedColumns(),filtering:o.getFilteredColumns(),grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action)return void(t&&t(e.result));if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"scroll"===e.action)if("infinite"===o.scrolling)o._recycle(!1,!1);else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else if(o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action){if(o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize)),o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements(),o.filtering.filterRow)for(let e=0;e<o.columns.length;e++)o.columns[e]._filterEditorInitialized&&(o.columns[e]._filterEditorInitialized=!1)}else o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest&&o.onLoad&&(o.onLoad(o),delete o.onLoad),o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&(t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max,e.closeMenu(),e._addingNewRow=!1}),0)},t}addNewColumn(e){e&&this.columns.push(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.remove(),void delete t.editing.addNewRow._addButton;if("float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton&&("float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)?t.editing.addNewRow._addButton.classList.remove("float"):t.computedVerticalScrollBarVisibility?t.computedVerticalScrollBarVisibility&&"float"===e&&t.editing.addNewRow._addButton.classList.add("float"):t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.pager.visible?t.editing.addNewRow._addButton.style.bottom="68px":t.editing.addNewRow._addButton.style.bottom="20px":t.pager.visible?t.editing.addNewRow._addButton.style.bottom="48px":t.editing.addNewRow._addButton.style.bottom="")};t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&(t.editing.addNewRow._addButton||(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.appendChild(t.editing.addNewRow._addButton)),requestAnimationFrame((()=>{t.editing.addNewRow._addButton&&(t.editing.addNewRow._addButton.classList.add("show"),o())})))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if(t._recycle(!1),t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")})))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;if(e.canNotify=!1,o)for(let t in o)void 0!==e[t]&&(e[t]=o[t]);else e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null;e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e){const t=this;t.isInitialized&&(e&&(t._initializeRows(),t._initializeRowElements()),t._refresh(),t._refreshSummary())}refreshView(){this._recycle()}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t){const o=this;o._isUpdating--,o._isUpdating<0&&(o._isUpdating=0),!1!==e?o.refresh():!1!==t&&o.refreshView()}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
|
|
66
66
|
Smart("smart-menu-item",class extends Smart.BaseElement{static get properties(){return{checked:{value:!1,type:"boolean"},label:{value:"",type:"any"},level:{value:null,type:"number?"},separator:{value:!1,type:"boolean"},shortcut:{value:"",type:"string"},value:{value:null,type:"any"}}}get enableShadowDOM(){return!1}template(){return""}ready(){const e=this;if(super.ready(),e.$.addClass("smart-unselectable"),e.setAttribute("role","menuitem"),e.checked&&e.setAttribute("aria-checked",!0),!1===e.isDirty)return;const t=e.closest("smart-menu, smart-tree");t&&t.isRendered&&(cancelAnimationFrame(Smart.Menu.processTimer),Smart.Menu.processTimer=requestAnimationFrame((()=>{t._lazyInitItems()})))}propertyChangedHandler(e,t,n){const o=this;if(super.propertyChangedHandler(e,t,n),"smart-tree-item"===o.tagName.toLowerCase())return;const i=o.menu,r=o.parentItem,a=r||i;if("label"===e)return""===n?void(o.label=t):(o.setAttribute("aria-label",n),void(i&&i._setItemLabel(o,n)));if(!i)return;if("separator"===e)return void i._refreshCheckableItems(a);if("disabled"!==e||!1===n||!o.checked)return;super.propertyChangedHandler(e,t,n),o.checked=!1;const s=a.checkMode;"radioButton"===s?i._validateRadioButtonSelection(r,o.level,[]):"checkbox"!==s&&i._refreshCheckableItems(a)}}),Smart("smart-menu-items-group",class extends Smart.BaseElement{static get properties(){return{checkable:{value:!1,type:"boolean"},checked:{value:!1,type:"boolean"},checkMode:{value:"checkbox",type:"string"},dropDownHeight:{value:null,type:"number?"},expanded:{value:!1,type:"boolean"},label:{value:"",type:"any"},level:{value:null,type:"number?"},separator:{value:!1,type:"boolean"},value:{value:null,type:"any"}}}get enableShadowDOM(){return!1}template(){return""}ready(){const e=this;if(super.ready(),e.$.addClass("smart-unselectable"),e.setAttribute("role","menuitem"),e.setAttribute("aria-haspopup",!0),e.setAttribute("aria-expanded",e.expanded),e.checked&&e.setAttribute("aria-checked",!0),!1===e.isDirty)return;const t=e.closest("smart-menu, smart-tree");t&&t.isRendered&&(cancelAnimationFrame(Smart.Menu.processTimer),Smart.Menu.processTimer=requestAnimationFrame((()=>{t._lazyInitItems()})))}propertyChangedHandler(e,t,n){const o=this;if(super.propertyChangedHandler(e,t,n),"smart-tree-items-group"===o.tagName.toLowerCase())return;const i=o.menu,r=o.parentItem,a=r||i;if("label"===e)return""===n?void(o.label=t):(o.setAttribute("aria-label",n),void(i&&i._setItemLabel(o,n)));if(i&&-1!==["checkable","checkMode","disabled","separator"].indexOf(e))switch(e){case"checkable":n?o.itemContainer.setAttribute("checkable",""):o.itemContainer.removeAttribute("checkable"),i._isContainerOpened(o.container.level,o.container)&&"tree"!==i.mode&&!i._minimized&&i._closeSubContainers(o.level+2),i._updateItemRoles(o);break;case"checkMode":o.itemContainer.setAttribute("check-mode",n),i._changeToRadioButtonMode(n,o.itemContainer,o),i._updateItemRoles(o);break;case"disabled":{if(Smart.ListMenu&&i instanceof Smart.ListMenu){if(i._view)for(;o.contains(i._view);)i._backButtonClickHandler()}else i._isContainerOpened(o.container.level,o.container)&&i._closeSubContainers(o.level+1,o.container);if(!o.checked)return;o.checked=!1;const e=a.checkMode;"radioButton"===e?i._validateRadioButtonSelection(r,o.level,[]):"checkbox"!==e&&i._refreshCheckableItems(a);break}case"separator":i._refreshCheckableItems(a)}}}),Smart("smart-menu",class extends Smart.BaseElement{static get properties(){return{autoCloseDelay:{value:100,type:"number"},autoFocusOnMouseenter:{value:!1,type:"boolean"},checkable:{value:!1,type:"boolean"},checkboxes:{value:!1,type:"boolean"},checkMode:{value:"checkbox",type:"string"},closeAction:{value:"up",allowedValues:["up","down","none"],type:"string"},dataSource:{value:null,type:"array?",reflectToAttribute:!1},displayMember:{value:"label",type:"string"},dropDownAppendTo:{value:null,type:"any?"},dropDownOverlay:{value:!1,type:"boolean"},dropDownPosition:{value:"auto",allowedValues:["top-left","top-right","bottom-left","bottom-right","overlay-left","overlay-right","auto"],type:"string"},enableMouseWheelAction:{value:!1,type:"boolean"},innerHTML:{type:"string",reflectToAttribute:!1},itemsMember:{value:"items",type:"string"},minimizeIconTemplate:{value:null,type:"string?"},minimizeWidth:{value:null,type:"number?"},mode:{value:"horizontal",allowedValues:["horizontal","vertical","dropDown","tree"],type:"string"},opened:{value:!1,type:"boolean"},overflow:{value:"auto",allowedValues:["auto","hidden","scroll"],type:"string"},preventCloseOnCheck:{value:!1,type:"boolean"},selectionMode:{value:"click",allowedValues:["click","mouseenter"],type:"string"},valueMember:{value:"value",type:"string"}}}static get listeners(){return{"container.click":"_selectionHandler",keydown:"_keydownHandler",mouseenter:"_mouseenterHandler",mouseleave:"_mouseleaveHandler","container.mouseout":"_mouseoutMouseoverHandler","container.mouseover":"_mouseoutMouseoverHandler",resize:"_resizeHandler",transitionend:"_transitionendHandler","hamburgerIcon.click":"_hamburgerIconClickHandler","mainContainer.click":"_mainContainerHandler","mainContainer.mouseleave":"_mainContainerHandler","mainContainer.mouseout":"_mainContainerHandler","mainContainer.mouseover":"_mainContainerHandler","document.down":"_documentDownHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.RepeatButton":"smart.button.js"}}static get styleUrls(){return["smart.button.css","smart.menu.css"]}get items(){return this._menuItems}template(){return'<div id="container" role="presentation">\n <div id="minimizedHeader" class="smart-header smart-minimized-header smart-hidden" role="presentation">\n <div id="hamburgerIcon" class="smart-hamburger-icon smart-hidden" role="button" aria-label="Toggle minimized menu" aria-haspopup="true">\n <div id="hamburgerIconLineTop" class="smart-hamburger-icon-line smart-hamburger-icon-line-top" role="presentation"></div>\n <div id="hamburgerIconLineCenter" class="smart-hamburger-icon-line smart-hamburger-icon-line-center" role="presentation"></div>\n <div id="hamburgerIconLineBottom" class="smart-hamburger-icon-line smart-hamburger-icon-line-bottom" role="presentation"></div>\n <div id="customIconContainer" class="smart-hamburger-icon-custom-container smart-hidden" role="presentation"></div>\n </div>\n </div>\n <smart-repeat-button id="scrollButtonNear" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-near smart-hidden" animation="[[animation]]" unfocusable right-to-left="[[rightToLeft]]">\n <div id="arrowNear" class="smart-arrow" aria-hidden="true"></div>\n </smart-repeat-button>\n <div id="mainContainer" class="smart-menu-main-container" role="presentation">\n <content></content>\n </div>\n <smart-repeat-button id="scrollButtonFar" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-far smart-hidden" animation="[[animation]]" unfocusable right-to-left="[[rightToLeft]]">\n <div id="arrowFar" class="smart-arrow" aria-hidden="true"></div>\n </smart-repeat-button>\n </div>'}attached(){const e=this;if(super.attached(),!e.isCompleted||!e.isRendered||"tree"===e._element||Smart.ListMenu&&e instanceof Smart.ListMenu)return;const t=e._scrollInfo;if(null!==e.dropDownAppendTo){if(e._minimized)e._dropDownParent.appendChild(e.$.mainContainer);else for(let t=0;t<e._containersInBody.length;t++)e._dropDownParent.appendChild(e._containersInBody[t]);"dropDown"===e.mode&&(e._dropDownParent===e.parentElement?e._dynamicallyReparented?delete e._dynamicallyReparented:e._positionRelativeTo=null:(e._positionRelativeTo=e.parentElement,e._dynamicallyReparented=!0,setTimeout((function(){e._dropDownParent.appendChild(e)}),0)))}t&&t.forEach((function(e,t){t.scrollLeft=e.left,t.scrollTop=e.top}))}detached(){const e=this;super.detached(),"tree"===e._element||Smart.ListMenu&&e instanceof Smart.ListMenu||(e._close(),null!==e.dropDownAppendTo&&(e._minimized?e._dropDownParent.removeChild(e.$.mainContainer):e._removeContainersInBody()))}ready(){super.ready()}render(){const e=this;e._element="menu",e._edgeMacFF=Smart.Utilities.Core.Browser.Edge||Smart.Utilities.Core.Browser.Firefox&&-1!==navigator.platform.toLowerCase().indexOf("mac"),e._containers=[],e._containersInBody=[],e._openedContainers=[],e._containersFixedHeight=[],e._menuItemsGroupsToExpand=[],e._additionalScrollButtons=[],e._scrollInfo=new Map,e._createElement(),super.render()}addItem(e,t){const n=this;if(!(e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup))if("string"==typeof e){const t=document.createElement("smart-menu-item");t.label=e,e=t}else{if(!e||!e.label)return;{const t=document.createElement("smart-menu-item");t.label=e.label,e=t}}let o,i,r;if(e.isDirty=!1,void 0===t)o=n,i=1,r=t=n.$.mainContainer;else{if((t=n.getItem(t))instanceof Smart.MenuItemsGroup==0)return;o=t,i=t.level+1,r=t.itemContainer}if(n._createItemHTMLStructure(e,i,t,r.childElementCount,0),e instanceof Smart.MenuItemsGroup&&(n._processHTML(e,i+1),n._checkContainersLength()),r.appendChild(e),n._checkOverflowAddRemove(e.level,r),e instanceof Smart.MenuItemsGroup&&("tree"===n.mode||n._minimized)){const t=e.getElementsByClassName("smart-menu-items-group-arrow");for(let e=0;e<t.length;e++)t[e].className="smart-menu-items-group-arrow down smart-arrow-down";n._expandItemsByDefault()}n._refreshCheckableItems(o)}checkItem(e){void 0===(e=this.getItem(e))||e.checked||e.disabled||e.templateApplied||this._toggleItem(e)}clear(){const e=this;e.$.mainContainer.innerHTML="",e._removeContainersInBody(),e._menuItems={},e._containers=[],e._containersInBody=[],e._openedContainers=[],e._containersFixedHeight=[],e._menuItemsGroupsToExpand=[],e._additionalScrollButtons=[]}clickItem(e){const t=this;"string"==typeof e&&(e=t.getItem(e)),e&&e.nodeName&&t._selectionHandler({type:"click",isTrusted:!0,target:e,stopPropagation:()=>{},preventDefault:()=>{}})}close(){const e=this;"dropDown"!==e.mode||!1===e.opened&&e.$.hasClass("smart-visibility-hidden")||(e.$.fireEvent("closing",arguments[0]||{trigger:"programmatic"}).defaultPrevented?e.opened=!0:(e.opened=!1,e.$.addClass("smart-visibility-hidden"),e._close(),e.$.fireEvent("close")))}collapseItem(e,t){const n=this,o=n.animation,i=!1===t&&n.hasAnimation;if(void 0===e)return i&&(n.animation="none"),n._close(),void(i&&setTimeout((function(){n.animation=o}),0));if(void 0===(e=n.getItem(e))||e instanceof Smart.MenuItem)return;const r=e.level;if(n._openedContainers[r+1]&&n._isContainerOpened(r+1,e.container)){const t=n.mode;i&&(n.animation="none"),n._closeSubContainers(r+1,e.container,void 0,!1!==arguments[2]),1!==r&&"tree"!==t||n._checkOverflow(n.$.mainContainer,"horizontal"===t,[n.$.scrollButtonNear,n.$.scrollButtonFar]),i&&(n.animation=o)}}expandItem(e,t){const n=this;if(void 0===(e=n.getItem(e))||e instanceof Smart.MenuItemsGroup&&n._isContainerOpened(e.level+1,e.container)&&n._isBranchExpanded(e))return;void 0!==Smart.Menu.processTimer&&n._lazyInitItems();const o=[e],i=n.animation,r=!1===t&&n.hasAnimation;let a=e.parentItem;for(r&&(n.animation="none"),n._discardKeyboardHover();a;)o.unshift(a),a=a.parentItem;for(let e=0;e<o.length;e++){const t=o[e];if(e===o.length-1&&t instanceof Smart.MenuItem){t.disabled||t.templateApplied||n._hoverViaKeyboard(t);break}n._isContainerOpened(t.container.level,t.container)||n._menuItemsGroupSelectionHandler(t,{target:t,type:"expand",isTrusted:!0},arguments[2])}r&&(n.animation=i)}getItem(e){const t=this;let n;if(null!=e&&t._menuItems){if("string"==typeof e){if(/^[0-9]*([.]?[0-9]*)*$/gm.test(e))return t._menuItems[e];if(n=t.$.mainContainer.querySelector('[id="'+e+'"]'),null===n)return t._menuItems[e]}else{if(!isNaN(e))return t._menuItems[e.toString()];n=e}if((n instanceof Smart.MenuItem||n instanceof Smart.MenuItemsGroup)&&(t.contains(n)||t.$.mainContainer.contains(n)||n.parentElement.parentElement.ownerElement===t))return n}}maximize(){const e=this;if(!e._minimized)return;const t=e.animation;if(e.$.mainContainer.style.marginTop="",e.$.mainContainer.style.marginLeft="",e.enableShadowDOM&&!e.$.mainContainer.id&&(e.$.mainContainer.id=e.$.mainContainer.getAttribute("smart-id")),"none"!==t&&(e.animation="none"),e._positionDetection.removeOverlay(),e._closeSubContainers(2),e.$minimizedHeader.addClass("smart-hidden"),e._minimized=!1,e._minimizedDropDownOpened&&(e.$hamburgerIcon.removeClass("smart-close-button"),e._minimizedDropDownOpened=!1),null!==e.dropDownAppendTo&&e._appendMinimizedContainerToMenu(e.$.mainContainer,e.$.scrollButtonFar),"tree"!==e.mode){e.$mainContainer.addClass("smart-menu-main-container"),e.$mainContainer.removeClass("smart-menu-minimized-items-container");const t=e.$.mainContainer.getElementsByClassName("smart-menu-items-group-arrow");for(let n=0;n<t.length;n++)e._setArrowDirection(t[n],t[n].parentElement.parentElement.level+1);null!==e.dropDownAppendTo&&e._moveDropDownsToExternalContainer(),e._applyContainerFixedHeight()}e.$mainContainer.removeClass("smart-visibility-hidden"),e.$hamburgerIcon.addClass("smart-hidden"),e.removeAttribute("minimized"),e._checkOverflow(e.$.mainContainer,"horizontal"===e.mode,[e.$.scrollButtonNear,e.$.scrollButtonFar]),"none"!==t&&setTimeout((function(){e.animation=t}),0),e.$.mainContainer.removeAttribute("drop-down"),e.$.hamburgerIcon.removeAttribute("aria-expanded"),e.$.hamburgerIcon.removeAttribute("aria-owns"),e.$.mainContainer.setAttribute("role","presentation"),e.$.mainContainer.removeAttribute("aria-orientation"),e.setAttribute("role","menu"),e.setAttribute("aria-orientation","horizontal"===e.mode?"horizontal":"vertical")}minimize(){const e=this;if(e._minimized||"dropDown"===e.mode)return;e.$minimizedHeader.removeClass("smart-hidden");const t=null!==e.dropDownAppendTo,n=e.animation,o=e.hasAnimation;if(o&&(e.animation="none"),e._positionDetection.removeOverlay(),e._closeSubContainers(2),o&&t&&(e.animation=n),"tree"!==e.mode&&(t&&e._moveDropDownsToMenu(),e._removeContainerFixedHeight()),e._hideMainContainerScrollButtons(),e.$mainContainer.removeClass("smart-menu-main-container"),e.$mainContainer.addClass("smart-visibility-hidden"),e.enableShadowDOM&&e.$.mainContainer.removeAttribute("id"),e._edgeMacFF&&(e.$.mainContainer.style.left="",e.$.mainContainer.style.top="",e.$mainContainer.addClass("not-in-view")),e.$hamburgerIcon.removeClass("smart-hidden"),t&&e._appendMinimizedContainerToExternalElement(e.$.mainContainer),setTimeout((function(){e.$mainContainer.addClass("smart-menu-minimized-items-container"),o&&!t&&(e.animation=n)}),0),e._minimized=!0,e.setAttribute("minimized",""),"tree"!==e.mode)for(let t=0;t<e._containers.length;t++){const n=e._containers[t];n.level>2&&e._setArrowDirection(n.menuItemsGroup.children[0].children[1],n.level)}e.$.mainContainer.setAttribute("drop-down",""),e.setAttribute("role","presentation"),e.removeAttribute("aria-orientation"),e.$.hamburgerIcon.setAttribute("aria-expanded",!1),e.$.hamburgerIcon.setAttribute("aria-owns",e.$.mainContainer.id),e.$.mainContainer.setAttribute("role","menu"),e.$.mainContainer.setAttribute("aria-orientation","vertical")}open(e,t){const n=this;if("dropDown"!==n.mode)return;if(n.$.fireEvent("opening").defaultPrevented)return void(n.opened=!1);let o;if(n.opened=!0,n._positionRelativeTo){const i=n._positionRelativeTo.getBoundingClientRect();e+=i.left,t+=i.top,n._positionedParent?(o=n._positionedParent.getBoundingClientRect(),e-=o.left,t-=o.top):(e+=window.pageXOffset,t+=window.pageYOffset)}let i=e+n.offsetWidth-document.documentElement.clientWidth,r=t+n.offsetHeight-document.documentElement.clientHeight;o?(i+=o.left,r+=o.top):(i-=window.pageXOffset,r-=window.pageYOffset),i>0?e-=i:e=o?Math.max(e,-o.left):Math.max(e,window.pageXOffset),r>0?t-=r:t=o?Math.max(t,-o.top):Math.max(t,window.pageYOffset),n.style.right="",isNaN(e)||(n.rightToLeft&&(n.style.right="initial"),n.style.left=e+"px"),isNaN(t)||(n.style.top=t+"px"),n.$.removeClass("smart-visibility-hidden"),n.$.fireEvent("open"),n.hasAnimation||(n._checkOverflowOnOpen&&(n._checkOverflow(n.$.mainContainer,!1,[n.$.scrollButtonNear,n.$.scrollButtonFar]),delete n._checkOverflowOnOpen),n._noAutoFocus||n.focus())}removeItem(e){const t=this;if(void 0===(e=t.getItem(e)))return;const n=e.parentElement,o=e.parentItem||t;if(e instanceof Smart.MenuItemsGroup){const n=e.container;if(t._isContainerOpened(n.level,n)&&t._closeSubContainers(n.level,n),1===e.level){const e=t._containersInBody.indexOf(n);-1!==e&&(t._containersInBody.splice(e,1),null===t.dropDownAppendTo||"tree"===t.mode||t._minimized||t._dropDownParent.removeChild(n))}}n.removeChild(e),t._refreshContainersArrays(),t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0),t._checkOverflowAddRemove(e.level,n),t._refreshCheckableItems(o)}uncheckItem(e){void 0===(e=this.getItem(e))||!e.checked||e.disabled||e.templateApplied||this._toggleItem(e)}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const o=this;if("tree"!==o._element)switch(e){case"animation":o.$.mainContainer.setAttribute("animation",n),o._additionalScrollButtons.forEach((function(e){e[0].animation=n,e[1].animation=n})),null!==o._dropDownParent&&o._containers.forEach((function(e){e.setAttribute("animation",n)}));break;case"checkable":"tree"===o.mode||o._minimized?o._minimized&&null!==o.dropDownAppendTo&&r("checkable",o.$.mainContainer,n):o._closeSubContainers(2),o._updateItemRoles(o);break;case"checkboxes":if(o._close(),null!==o.dropDownAppendTo){for(let e=0;e<o._containers.length;e++)r("checkboxes",o._containers[e],n);o._minimized&&r("checkboxes",o.$.mainContainer,n)}o._updateItemRoles();break;case"checkMode":o._changeToRadioButtonMode(n,o.$.mainContainer),o._minimized&&null!==o.dropDownAppendTo&&o.$.mainContainer.setAttribute("check-mode",n),o._updateItemRoles(o);break;case"dataSource":{let e=!1;o._minimized&&(o.maximize(),e=!0),o._removeContainersInBody(),o._containersInBody=[],o._menuItems={},o._processDataSource(),o._checkContainersLength(),e?o.minimize():i(),o._expandItemsByDefault(),o._refreshCheckableItems(),o._suppressResizeHandler=!0,setTimeout((()=>delete o._suppressResizeHandler),500);break}case"innerHTML":o.$.mainContainer.innerHTML=n,o._lazyInitItems();break;case"dropDownAppendTo":{const e=o._dropDownParent;if(o._positionDetection.getDropDownParent(),o._dropDownParent===e||"tree"===o.mode&&!o._minimized)return;if(o._close(),o._minimized)return void(null===n?o._appendMinimizedContainerToMenu(o.$.mainContainer,o.$.scrollButtonFar):o._appendMinimizedContainerToExternalElement(o.$.mainContainer));if(null!==o._dropDownParent&&null===e)o._moveDropDownsToExternalContainer();else if(null===o._dropDownParent&&null!==e)o._moveDropDownsToMenu();else if(null!==o._dropDownParent&&null!==e)for(let e=0;e<o._containersInBody.length;e++)o._dropDownParent.appendChild(o._containersInBody[e]);null!==n||o.$mainContainer.hasClass("simple")?o._checkOverflow(o.$.mainContainer,"horizontal"===o.mode,[o.$.scrollButtonNear,o.$.scrollButtonFar]):o._hideMainContainerScrollButtons();for(let e=0;e<o._containersFixedHeight.length;e++)o._containersFixedHeight[e].itemContainer.checkOverflow=!0;"dropDown"===o.mode&&(o.close({trigger:"internal"}),o._reparentMenu(!0,e));break}case"dropDownOverlay":n||o._positionDetection.removeOverlay();break;case"disabled":n&&o._close(),o._setFocusable(),o.$.scrollButtonNear.disabled=n,o.$.scrollButtonFar.disabled=n,n||null===o.dropDownAppendTo&&!o.$mainContainer.hasClass("simple")&&"tree"!==o.mode||o._updateScrollButtonVisibility(o.$.mainContainer,"horizontal"===o.mode,[o.$.scrollButtonNear,o.$.scrollButtonFar]);break;case"dropDownPosition":case"mode":{if("mode"===e){if(delete o._dynamicallyReparented,"tree"===t||o._minimized?(o._closeSubContainersTreeMode(2,void 0,void 0,void 0,!0),o._openedContainers=[]):o._closeSubContainersDefaultMode(2),o._discardKeyboardHover(!0),o._minimized&&o._minimizedDropDownOpened&&(o.$mainContainer.addClass("smart-visibility-hidden"),o.$hamburgerIcon.removeClass("smart-close-button"),o.$.hamburgerIcon.setAttribute("aria-expanded",!1),o._minimizedDropDownOpened=!1),"horizontal"!==n&&"horizontal"!==t||o._changeScrollButtonsArrows(),o._minimized)return void("dropDown"===n&&(o.mode=t));o.setAttribute("aria-orientation","horizontal"===o.mode?"horizontal":"vertical"),!1===o.opened&&("dropDown"===n?o.$.addClass("smart-visibility-hidden"):"dropDown"===t&&o.$.removeClass("smart-visibility-hidden")),"tree"===t?(null!==o.dropDownAppendTo&&o._moveDropDownsToExternalContainer(),o.$mainContainer.addClass("smart-menu-main-container"),o.$mainContainer.removeClass("smart-menu-minimized-items-container"),o._applyContainerFixedHeight()):"tree"===n&&(null!==o.dropDownAppendTo&&o._moveDropDownsToMenu(),o._applyTreeMode()),"auto"===o.overflow&&o._hideMainContainerScrollButtons(),i()}if("tree"===o.mode||o._minimized)return o._minimizedDropDownOpened&&o._close(),void(o._minimized&&null!==o.dropDownAppendTo&&o.$.mainContainer.setAttribute(o.properties[e].attributeName,n));"dropDownPosition"===e&&o._close();const r=o._containers.map((e=>e.menuItemsGroup));for(let e=0;e<r.length;e++){const t=r[e];o._setArrowDirection(t.children[0].children[1],t.level+1)}if(null!==o.dropDownAppendTo)for(let t=0;t<o._containers.length;t++){const i=o._containers[t];i.setAttribute(Smart.Utilities.Core.toDash(e),n),i.level>2&&o._setArrowDirection(i.menuItemsGroup.children[0].children[1],i.level)}break}case"minimizeIconTemplate":o._applyMinimizeIconTemplate(n,t);break;case"minimizeWidth":o._resizeHandler();break;case"opened":n?o.open():o.close({trigger:"internal"});break;case"overflow":o._handleOverflowChange();break;case"rightToLeft":if("tree"!==o.mode){const e=o._containers.map((e=>e.menuItemsGroup));for(let t=0;t<e.length;t++){const n=e[t];o._setArrowDirection(n.children[0].children[1],n.level+1)}if(null!==o.dropDownAppendTo){n?o.$.mainContainer.setAttribute("right-to-left",""):o.$.mainContainer.removeAttribute("right-to-left");for(let e=0;e<o._containers.length;e++){const t=o._containers[e];n?t.setAttribute("right-to-left",""):t.removeAttribute("right-to-left"),t.level>2&&o._setArrowDirection(t.menuItemsGroup.children[0].children[1],t.level)}}}break;case"theme":if(null===o.dropDownAppendTo||Smart.ListMenu&&o instanceof Smart.ListMenu)return;if(o._minimized)""!==t&&o.$mainContainer.removeClass(t),""!==n&&o.$mainContainer.addClass(n);else for(let e=0;e<o._containers.length;e++){const i=o._containers[e];""!==t&&i.classList.remove(t),""!==n&&i.classList.add(n)}break;case"unfocusable":o._setFocusable()}function i(){null===o.dropDownAppendTo&&"tree"!==o.mode||o._checkOverflow(o.$.mainContainer,"horizontal"===o.mode,[o.$.scrollButtonNear,o.$.scrollButtonFar])}function r(e,t,n){n?t.setAttribute(e,""):t.removeAttribute(e)}}_addOpenedContainer(e,t){const n=this;if("tree"===n.mode||n._minimized){n._openedContainers[e]||(n._openedContainers[e]=[]);const o=t.menuItemsGroup;return o.set("expanded",!0),o.setAttribute("aria-expanded",!0),n._updateState&&n._updateState("expanded",o.id,!0),n._openedContainers[e].push(t)}n._openedContainers[e]=t}_appendMinimizedContainerToExternalElement(e){const t=this;e.ownerElement=t,t._dropDownParent.appendChild(e),e.setAttribute("animation",t.animation),""!==t.theme&&e.$.addClass(t.theme),e.$.addClass("smart-menu-drop-down smart-drop-down"),e.$.addClass("smart-drop-down-repositioned"),e.setAttribute("check-mode",t.checkMode),e.setAttribute("drop-down-position",t.dropDownPosition),e.setAttribute("mode",t.mode),e.setAttribute("loading-indicator-position",t.loadingIndicatorPosition),t.rightToLeft&&e.setAttribute("right-to-left",""),t.checkable&&e.setAttribute("checkable",""),t.checkboxes&&e.setAttribute("checkboxes",""),t.$.view&&t.detachedChildren.indexOf(t.$.view)&&t.detachedChildren.push(t.$.view)}_appendMinimizedContainerToMenu(e,t){const n=this;delete e.ownerElement,n.$.container.insertBefore(e,t),e.removeAttribute("animation"),""!==n.theme&&e.$.removeClass(n.theme),e.$.removeClass("smart-menu-drop-down smart-drop-down"),e.$.removeClass("smart-drop-down-repositioned"),e.removeAttribute("checkable"),e.removeAttribute("checkboxes"),e.removeAttribute("check-mode"),e.removeAttribute("drop-down-position"),e.removeAttribute("mode"),e.removeAttribute("loading-indicator-position"),e.removeAttribute("style"),e.removeAttribute("right-to-left")}_applyContainerFixedHeight(){const e=this;for(let t=0;t<e._containers.length;t++){const n=e._containers[t];-1!==e._containersFixedHeight.indexOf(n)?(n.style.height=n.menuItemsGroup.dropDownHeight+"px",n.itemContainer.checkOverflow=!0):n.style.height=""}}_applyGrouping(e,t){const n=this;let o;o=e===n.$.mainContainer?Array.from(e.children):Array.from(e.container.firstElementChild.children);for(let e=0;e<o.length;e++){const i=o[e];i.originalIndex=e,i instanceof Smart.MenuItemsGroup&&void 0===t&&n._applyGrouping(i)}n._sortItems(e)}_applyMinimizeIconTemplate(e,t){const n=this;if(null===e){if(null===t)return;n.$customIconContainer.addClass("smart-hidden"),n.$.customIconContainer.innerHTML="",n.$hamburgerIconLineTop.removeClass("smart-hidden"),n.$hamburgerIconLineCenter.removeClass("smart-hidden"),n.$hamburgerIconLineBottom.removeClass("smart-hidden")}else{const o=document.getElementById(e);if(null!==o&&"template"===o.tagName.toLowerCase()){const e=document.importNode(o.content,!0);n.$hamburgerIconLineTop.addClass("smart-hidden"),n.$hamburgerIconLineCenter.addClass("smart-hidden"),n.$hamburgerIconLineBottom.addClass("smart-hidden"),n.$.customIconContainer.innerHTML="",n.$.customIconContainer.appendChild(e),n.$customIconContainer.removeClass("smart-hidden")}else n.minimizeIconTemplate=t}}_applyTreeMode(){const e=this,t=e.$.mainContainer.getElementsByClassName("smart-menu-items-group-arrow");if(e.$mainContainer.removeClass("smart-menu-main-container"),e.$mainContainer.addClass("smart-menu-minimized-items-container"),e.isCompleted&&e.isRendered)for(let e=0;e<t.length;e++)t[e].className="smart-menu-items-group-arrow down";e._removeContainerFixedHeight()}_arrowLeftHandler(e,t,n,o){const i=this;1===e?"horizontal"===t&&i._levelOneNavigate("_getLastEnabledChild",n,o):2===e?i._levelOneNavigateFromLowerLevel("_getPreviousEnabledChild",n):i._escapeHandler(n,e,o)}_arrowRightHandler(e,t,n,o){const i=this;1===e?"horizontal"===t?i._levelOneNavigate("_getFirstEnabledChild",n,o):i._levelOneOpenDropDown(n):n instanceof Smart.MenuItemsGroup?i._selectionHandler({target:n,isTrusted:!0}):i._levelOneNavigateFromLowerLevel("_getNextEnabledChild",n)}_browserBoundsDetection(e){const t=this;if("tree"===t.mode&&!t._minimized)return;if(e.style.marginTop="",e.style.marginLeft="","auto"!==t.dropDownPosition)return;const n=1===window.devicePixelRatio?document.documentElement.clientWidth:window.innerWidth,o=1===window.devicePixelRatio?document.documentElement.clientHeight:window.innerHeight,i=e.getBoundingClientRect(),r=n-i.left-e.offsetWidth,a=o-i.top-e.offsetHeight;r<10&&(e.style.marginLeft=Math.min(r-10,-10)+"px"),a<10&&(e.style.marginTop=Math.min(a-10,-10)+"px")}_changeScrollButtonsArrows(){const e=this;"horizontal"===e.mode?(e.$.scrollButtonNear.setAttribute("aria-label","Scroll left"),e.$.scrollButtonFar.setAttribute("aria-label","Scroll right"),e.$arrowNear.removeClass("smart-arrow-up"),e.$arrowFar.removeClass("smart-arrow-down"),e.$arrowNear.addClass("smart-arrow-left"),e.$arrowFar.addClass("smart-arrow-right")):(e.$.scrollButtonNear.setAttribute("aria-label","Scroll up"),e.$.scrollButtonFar.setAttribute("aria-label","Scroll down"),e.$arrowNear.removeClass("smart-arrow-left"),e.$arrowFar.removeClass("smart-arrow-right"),e.$arrowNear.addClass("smart-arrow-up"),e.$arrowFar.addClass("smart-arrow-down"))}_changeToRadioButtonMode(e,t,n){if("radioButton"===e){const e=[];for(let n=0;n<t.childElementCount;n++){const o=t.children[n];!o.checked||o.disabled||o.templateApplied||e.push(o)}this._validateRadioButtonSelection(n,n?n.level+1:1,e)}}_checkContainersLength(e){const t=this;0===t._containers.length?(t.$mainContainer.addClass("simple"),e||t._checkOverflow(t.$.mainContainer,"horizontal"===t.mode,[t.$.scrollButtonNear,t.$.scrollButtonFar])):e||(t.$mainContainer.removeClass("simple"),null===t.dropDownAppendTo&&"tree"!==t.mode&&t.$mainContainer.removeClass("scroll-buttons-shown one-button-shown"))}_checkOverflow(e,t,n){const o=this,i=o.$.mainContainer,r=e===i?o.overflow:"auto";if(o._minimized||"hidden"===r||null===o.dropDownAppendTo&&"tree"!==o.mode&&e===i&&!i.classList.contains("simple"))return;if("dropDown"===o.mode&&!o.opened)return void(o._checkOverflowOnOpen=!0);const a=e.scrollLeft,s=a/(e.scrollWidth-e.offsetWidth),l=e.scrollTop,d=l/(e.scrollHeight-e.offsetHeight);let m,c,u;"auto"===r&&(e.classList.remove("scroll-buttons-shown"),e.classList.remove("one-button-shown"),n[0].$.addClass("smart-hidden"),n[1].$.addClass("smart-hidden")),t?(m=Math.round(e.scrollWidth)>Math.round(e.offsetWidth),c=s>0,u=s<1):(m=Math.round(e.scrollHeight)>Math.round(e.offsetHeight),c=d>0,u=d<1),m?"auto"===r?(e.classList.add("scroll-buttons-shown"),c&&n[0].$.removeClass("smart-hidden"),u&&n[1].$.removeClass("smart-hidden"),!1===(c&&u)&&e.classList.add("one-button-shown"),o.disabled||(n[0].disabled=!1,n[1].disabled=!1),e.scrollLeft=a,e.scrollTop=l):(n[0].$.removeClass("smart-hidden"),n[1].$.removeClass("smart-hidden"),o.disabled?(n[0].disabled=!0,n[1].disabled=!0):(n[0].disabled=!c,n[1].disabled=!u)):"scroll"===r&&(n[0].disabled=!0,n[1].disabled=!0),e===i&&"tree"!==o.mode&&o._close(),o._scrollInfo.set(e,{left:e.scrollLeft,top:e.scrollTop})}_checkOverflowAddRemove(e,t){const n=this;1===e&&null!==n.dropDownAppendTo||"tree"===n.mode?n._checkOverflow(n.$.mainContainer,"horizontal"===n.mode,[n.$.scrollButtonNear,n.$.scrollButtonFar]):e>1&&t.dropDownHeightSet&&(n._isContainerOpened(e,t.container)?n._checkOverflow(t,!1,[t.container.children[0],t.container.children[2]]):t.checkOverflow=!0)}_close(){const e=this;e._positionDetection.removeOverlay(),e._closeSubContainers(2),e._discardKeyboardHover(!0),e._minimized&&e._minimizedDropDownOpened&&(e.$mainContainer.addClass("smart-visibility-hidden"),e._edgeMacFF&&(e.$.mainContainer.style.left="",e.$.mainContainer.style.top="",e.$mainContainer.addClass("not-in-view")),e.$hamburgerIcon.removeClass("smart-close-button"),e.$.hamburgerIcon.setAttribute("aria-expanded",!1),e._minimizedDropDownOpened=!1)}_closeSubContainers(e,t,n,o){const i=this;"tree"===i.mode||i._minimized?i._closeSubContainersTreeMode(e,t,n,o):i._closeSubContainersDefaultMode(e,t,n)}_closeSubContainersDefaultMode(e,t,n){const o=this,i=o._openedContainers;function r(t){const r=i[t].menuItemsGroup;n&&t===e||(r.$.removeClass("focus"),r.removeAttribute("focus"),r.$.removeClass("hover"),r.removeAttribute("hover")),r.$.removeClass("smart-menu-items-group-opened"),r.$.removeClass("smart-menu-items-group-expanded"),r.setAttribute("aria-expanded",!1),i[t].$.addClass("smart-visibility-hidden"),o._edgeMacFF&&2===t&&!o.hasAnimation&&(i[t].style.left="",i[t].style.top="",i[t].$.addClass("not-in-view")),o._minimized&&o._browserBoundsDetection(o.$.mainContainer),o.$.fireEvent("collapse",{item:r,label:r.label,path:r.path,value:r.value,children:r.itemContainer.children}),i[t]=void 0}for(let t=i.length-1;t>=e;t--)void 0!==i[t]&&r(t)}_closeSubContainersTreeMode(e,t,n,o,i){const r=this;if(o){const e=t.menuItemsGroup;if(r.$.fireEvent("collapsing",{item:e,label:e.label,path:e.path,value:e.value,children:t.itemContainer.children}).defaultPrevented)return}if(void 0===t)return void r._collapseAll(!1,i);const a=t.menuItemsGroup;if(a.set("expanded",!1),a.setAttribute("aria-expanded",!1),"menu"===r._element)if(n){const e=r.$.mainContainer.getElementsByClassName("focus")[0];e&&(e.$.removeClass("focus"),e.removeAttribute("focus")),a.$.addClass("focus"),a.setAttribute("focus",""),r._focusedViaKeyboard=a}else a.$.removeClass("focus"),a.removeAttribute("focus");else r._updateState("expanded",a.id,!1);if(a.$.removeClass("smart-"+r._element+"-items-group-opened"),i||!r.hasAnimation?(a.$.removeClass("smart-"+r._element+"-items-group-expanded"),a.setAttribute("aria-expanded",!1),t.$.addClass("smart-visibility-hidden"),r._minimized&&r._browserBoundsDetection(r.$.mainContainer)):r._collapseSection(t),o){const e={item:a,label:a.label,path:a.path,value:a.value,children:a.itemContainer.children};r.toggleCallback?(e.type="collapse",r.toggleCallback(e)):r.$.fireEvent("collapse",e)}if(!r._openedContainers[e])return;const s=r._openedContainers[e].indexOf(t);-1!==s&&r._openedContainers[e].splice(s,1)}_collapseAll(e,t){const n=this;for(let o=n._openedContainers.length-1;o>=2&&void 0!==n._openedContainers[o];o--)for(let i=n._openedContainers[o].length-1;i>=0;i--)n._closeSubContainersTreeMode(o,n._openedContainers[o][i],void 0,e,t);n.hasAnimation||n._checkOverflow(n.$.mainContainer,!1,[n.$.scrollButtonNear,n.$.scrollButtonFar]);for(let e=n._openedContainers.length-1;e>=2;e--){const t=n._openedContainers[e];if(void 0!==t&&0!==t.length)break;n._openedContainers.splice(e,1)}2===n._openedContainers.length&&(n._openedContainers=[])}_collapseSection(e){const t=this,n=e.scrollHeight+"px";t._treeAnimationInProgress=e,e.style.transition="none",requestAnimationFrame((function(){"tree"===t.mode||t._minimized?(e.style.height=n,e.style.transition="",requestAnimationFrame((function(){e.style.height="0px","smart-tree"===t.tagName.toLowerCase()&&e.$.addClass("smart-visibility-hidden"),"0px"===n&&t._transitionendHandlerCollapse(t,e)}))):e.style.transition=""})),e.addEventListener("transitionend",t._transitionendHandlerCollapse)}_createElement(){const e=this,t=e.mode;e.setAttribute("role","menu"),e.$.mainContainer.id=e.id+"MainContainer",e.setAttribute("aria-orientation","horizontal"===e.mode?"horizontal":"vertical"),e._positionDetection=new Smart.Utilities.PositionDetection(e),e._positionDetection.getDropDownParent(),e._reparentMenu(),e.disabled&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),null===e.dataSource&&e.$.mainContainer.firstElementChild instanceof HTMLUListElement&&e._processUList();const n=(e.shadowRoot||e).querySelectorAll("smart-menu-item, smart-menu-items-group"),o=function(){const n=e.animation;e._changeScrollButtonsArrows(),e._setFocusable(),"dropDown"===t&&!1===e.opened&&(e.hasAnimation?(e.animation="none",e.$.addClass("smart-visibility-hidden"),e.animation=n):e.$.addClass("smart-visibility-hidden")),e._menuItems={},e.$.mainContainer.setAttribute("animation",n),null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource(),e._checkContainersLength(!0),null===e.dropDownAppendTo&&!e.$mainContainer.hasClass("simple")&&"tree"!==e.mode||"scroll"!==e.overflow||(e.$mainContainer.addClass("scroll-buttons-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility(e.$.mainContainer,"horizontal"===t,[e.$.scrollButtonNear,e.$.scrollButtonFar])),e._applyMinimizeIconTemplate(e.minimizeIconTemplate,null),"tree"===t&&e._applyTreeMode(),null!==e.minimizeWidth&&e.offsetWidth<=e.minimizeWidth?e.minimize():e._checkOverflow(e.$.mainContainer,"horizontal"===t,[e.$.scrollButtonNear,e.$.scrollButtonFar]),e._expandItemsByDefault(),e._refreshCheckableItems(),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted())};0===n.length||e.enableShadowDOM||e.isInShadowDOM?o():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(n,o))}_ensureItemsReady(e,t){const n=this,o=function(){const n=function(t){for(let n=0;n<e.length;n++)e[n].context="node"===t?e[n]:document};n("node"),t(),n()};if(0===e.length)o();else{n._nodesReadyListeners=0;for(let t=0;t<e.length;t++){const i=e[t],r=function(){const e=n.context;n.context=n,n._nodesReadyListeners--,0===n._nodesReadyListeners&&(o(),delete n._nodesReadyListeners),n.context=e}.bind(n);i.isCompleted||(n._nodesReadyListeners++,i.completeHandlers=[],i._onCompleted=r)}0===n._nodesReadyListeners&&o()}}_createItemHTMLStructure(e,t,n,o){const i=this,r="smart-"+i._element+"-item-label-container",a="smart-"+i._element+"-item-label-element",s=document.createDocumentFragment(),l=e.children;let d,m,c,u;for(let e=0;e<l.length;e++){const t=l[e];if(t.classList&&(t.classList&&t.classList.contains(r)?d=t:t.classList&&t.classList.contains(a)&&(m=t),d&&m))break}if(d){const t=d.querySelector("."+a);if(null!==t){e.insertBefore(t.firstElementChild,e.children[0]);const n="smart-"+i._element+"-drop-down",o="smart-"+i._element+"-item-container",r=e.querySelector("."+n);if(r){const t=e.querySelector("."+o);for(;t.childNodes.length;)e.appendChild(t.firstChild);r.remove()}}d.remove()}m&&m.remove(),d=document.createElement("div"),m=document.createElement("div");let p=document.createElement("span");e.menu=i,t>1?(e.originalIndex=o,c=n.path+"."+e.originalIndex,e.parentItem=n,u=n):(e.originalIndex=o,c=""+o,u=i),i.checkboxes&&u.checkable&&("checkbox"===u.checkMode?e.setAttribute("role","menuitemcheckbox"):"radioButton"===u.checkMode&&e.setAttribute("role","menuitemradio")),e.path=c,i._menuItems[c]=e,d.className=r,m.className=a,"tree"===i._element&&i._setIndentation(d,t,i.rightToLeft?"paddingRight":"paddingLeft");const h=Array.from(e.childNodes);for(let e=0;e<h.length;e++){const t=h[e];if(t instanceof Smart.MenuItem||t instanceof Smart.MenuItemsGroup)break;p.appendChild(t)}if(""===p.innerHTML.trim()){const t=e.label||e.getAttribute("label");t&&""!==t?i._setLabel(t,p,e,!0):(e.set("label","Item "+o),p.innerHTML="Item "+o)}else e.set("label",p.innerHTML.trim());if(e.setAttribute("aria-label",e.label),e instanceof Smart.MenuItemsGroup&&void 0===e.titleLabel&&(e.titleLabel=e.label),m.appendChild(p),s.appendChild(m),e.set("level",t),e.set("shortcut",e.shortcut||e.getAttribute("shortcut")||""),e.shortcut&&e instanceof Smart.MenuItem){const t=document.createElement("div");t.id=e.id+"Shortcut",t.className="smart-"+i._element+"-item-shortcut",t.innerHTML=e.shortcut,s.appendChild(t),e.setAttribute("aria-describedby",t.id)}d.appendChild(s),e.insertBefore(d,e.children[0]),e.id||(e.id=i.id+"ItemP"+e.path.replace(/\./g,"_")+"L"+e.label.replace(/[^a-zA-Z0-9\-\_]/g,""))}_createMenuItemsGroupContainer(e,t){const n=this,o=e.children,i="smart-"+n._element+"-drop-down",r="smart-"+n._element+"-item-container";let a,s;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList&&(t.classList&&t.classList.contains(i)?a=t:t.classList&&t.classList.contains(r)&&(s=t),a&&s))break}if(a||(a=document.createElement("div")),s||(s=document.createElement("div")),a.innerHTML=s.innerHTML="",a.id=e.id+"Container",a.className="smart-"+n._element+"-drop-down smart-visibility-hidden",n._edgeMacFF&&2===t&&"tree"!==n.mode&&(a.className+=" not-in-view"),a.$||(a.$=Smart.Utilities.Extend(a)),a.level=t,a.setAttribute("level",t),"menu"===n._element?(e.setAttribute("aria-owns",a.id),a.setAttribute("role","menu")):a.setAttribute("role","group"),a.menuItemsGroup=e,s.className=r,s.$||(s.$=Smart.Utilities.Extend(s)),s.container=a,s.menuItemsGroup=e,e.checkable&&s.setAttribute("checkable",""),s.setAttribute("check-mode",e.checkMode),s.setAttribute("role","presentation"),a.itemContainer=s,a.contains(s)||a.appendChild(s),null!==e.dropDownHeight){let t=a.querySelector(".smart-spin-button.smart-scroll-button-near"),o=a.querySelector(".smart-spin-button.smart-scroll-button-far");t||(t=document.createElement("smart-repeat-button")),o||(o=document.createElement("smart-repeat-button")),t.className="smart-menu-scroll-button smart-spin-button smart-scroll-button-near smart-hidden",t.setAttribute("aria-label","Scroll up"),t.innerHTML='<div class="smart-arrow smart-arrow-up" aria-hidden="true"></div>',t.animation=n.animation,t.unfocusable=!0,t.rightToLeft=n.rightToLeft,o.className="smart-menu-scroll-button smart-spin-button smart-scroll-button-far smart-hidden",o.setAttribute("aria-label","Scroll down"),o.innerHTML='<div class="smart-arrow smart-arrow-down" aria-hidden="true"></div>',o.animation=n.animation,o.unfocusable=!0,o.rightToLeft=n.rightToLeft,a.contains(t)||a.insertBefore(t,s),a.contains(o)||a.appendChild(o),a.$.addClass("drop-down-height-set"),s.dropDownHeightSet=!0,s.checkOverflow=!0,a.style.height=e.dropDownHeight+"px",n._containersFixedHeight.push(a),n._additionalScrollButtons.push([t,o])}return a}_discardKeyboardHover(e){const t=this;t._focusedViaKeyboard&&(!e&&t._focusedViaKeyboard instanceof Smart.MenuItemsGroup&&t._isContainerOpened(t._focusedViaKeyboard.level+1,t._focusedViaKeyboard.container)||(t._focusedViaKeyboard.$.removeClass("focus"),t._focusedViaKeyboard.removeAttribute("focus"),t._focusedViaKeyboard.$.removeClass("hover"),t._focusedViaKeyboard.removeAttribute("hover"),t._focusedViaKeyboard=void 0))}_documentDownHandler(e){const t=this;"down"===t.closeAction&&t._closeOnDocumentInteraction(e.originalEvent)}_documentUpHandler(e){const t=this,n=e.originalEvent.target;if(t.disabled||t.displayLoadingIndicator||!n.closest)return;const o="up"===t.closeAction&&t._closeOnDocumentInteraction(e.originalEvent);if(o)return;let i,r;if(t.isInShadowDOM?(i=t.isInShadowDOM?t.getRootNode().activeElement:t.shadowRoot&&t.shadowRoot.activeElement||document.activeElement,r=t.$.container.contains(e.originalEvent.composedPath()[0])):(i=document.activeElement,r=t.contains(n)),!o&&t!==i&&null===i.closest("[template-applied]")){if(r||n.closest(".smart-list-menu-view")===t.$.view)return void t.focus();const e=n.closest(".smart-drop-down-repositioned");e&&e.ownerElement===t&&t.focus()}}_closeOnDocumentInteraction(e){const t=this,n=e.target;let o,i;if(t.isInShadowDOM?(o=e.composedPath()[0],i=t.$.container.contains(o)):i=t.contains(n),"dropDown"===t.mode&&t.opened){const e=n.closest(".smart-drop-down-repositioned");if(!(i||e&&e.ownerElement===t))return t.close({trigger:"interaction",target:t.isInShadowDOM?o:n}),!0}const r=(o||n).closest(".smart-input-drop-down-menu");return(!r||!t.contains(r.ownerElement))&&(!i&&null===n.closest(".smart-menu-drop-down")||o&&o===t.$.mainContainer||n===t.$.mainContainer?("tree"===t.mode||t._close(),!0):void 0)}_ensureVisible(e){const t=this;if(t._minimized)return;const n=t.mode,o=t.$.mainContainer;let i,r;if("tree"!==n&&e.parentElement!==o){if(null===e.dropDownHeight)return;i=e.parentElement,r=[i.container.children[0],i.container.children[2]]}else i=o,r=[t.$.scrollButtonNear,t.$.scrollButtonFar];if(i===o&&(null===t.dropDownAppendTo&&"tree"!==t.mode&&!o.classList.contains("simple")||!i.$.hasClass("scroll-buttons-shown")&&"hidden"!==t.overflow))return;const a=i.getBoundingClientRect(),s=e.getBoundingClientRect();function l(t,n,o){let r=e.firstElementChild[o]+t-i[o];r<0&&(r=t),i["scroll"+n]=r}function d(n,a){let s=e["offset"+n],d=i[a];"Top"!==n||i===o||r[0].$.hasClass("smart-hidden")||(s-=r[0][a]),l(s,n,a),t._updateScrollButtonVisibility(i,"Left"===n,r),d!==i[a]&&l(s,n,a)}"tree"!==n?(i===o&&"horizontal"===n&&(a.left>s.left||a.right<s.right)?d("Left","offsetWidth"):(a.top>s.top||a.bottom<s.bottom)&&d("Top","offsetHeight"),t._scrollInfo.set(i,{left:i.scrollLeft,top:i.scrollTop})):t._ensureVisibleTreeMode(e,s,i,a,0)}_ensureVisibleTreeMode(e,t,n,o,i){const r=this;if(("menu"===r._element||"scrollButtons"===r.scrollMode)&&!n.$.hasClass("scroll-buttons-shown")&&"hidden"!==r.overflow)return;const a=n.offsetHeight,s=r.$scrollButtonNear.hasClass("smart-hidden");let l;if(o.top>t.top)l=r._getOffsetTop(e);else{let n=e.expanded?e.firstElementChild.offsetHeight+parseInt(window.getComputedStyle(e.children[1]).marginTop,10):e.offsetHeight;if("tree"===r._element&&(n+=parseFloat(getComputedStyle(r).getPropertyValue("--smart-tree-item-vertical-offset"))||0),!(o.bottom<t.top+n))return;l=r._getOffsetTop(e)-a+n+i}"tree"===r._element&&"0"===e.path&&(l-=parseFloat(getComputedStyle(r).getPropertyValue("--smart-tree-item-vertical-offset"))),n.scrollTop=l,"menu"!==r._element&&"scrollButtons"!==r.scrollMode||r._updateScrollButtonVisibility(n,!1,[r.$.scrollButtonNear,r.$.scrollButtonFar]),"auto"===r.overflow&&s&&!r.$scrollButtonNear.hasClass("smart-hidden")&&(n.scrollTop+=a-n.offsetHeight),r._scrollInfo.set(n,{left:n.scrollLeft,top:n.scrollTop})}_escapeHandler(e,t,n){e&&(e.$.removeClass("focus"),e.removeAttribute("focus")),this._closeSubContainers(t,void 0,void 0,!0),this._hoverViaKeyboard(n.menuItemsGroup)}_expandItemsByDefault(e){const t=this;if(0===t._menuItemsGroupsToExpand.length&&!e||"tree"!==t.mode&&!t._minimized)return;const n=t.hasAnimation,o=t.animation;n&&(t.animation="none"),e&&t._collapseAll(!1);for(let e=0;e<t._menuItemsGroupsToExpand.length;e++)t.expandItem(t._menuItemsGroupsToExpand[e].path,void 0,!1);n&&(t.animation=o),t._menuItemsGroupsToExpand=[]}_expandSection(e){const t=this,n=e.style.height,o=e.scrollHeight+"px";e.style.height=o,t._treeAnimationInProgress=e,n!==o&&(parseFloat(n)||parseFloat(o))?e.addEventListener("transitionend",t._transitionendHandlerExpand):t._transitionendHandlerExpand(t,e)}_filterInputKeyupHandler(){const e=this;e._filterTimer&&clearTimeout(e._filterTimer),e._filterTimer=setTimeout((function(){const t=e.context;e.context=e,e._applyFilter(e.$.filterInput.value,e._view),e._checkOverflow(),e.context=t}),300)}_findItem(e,t){if(""===t)return e;const n=e[this.filterMember||"label"];if("string"!=typeof n)return null;switch(this.filterMode){case"startsWith":if(0===n.indexOf(t))return e;break;case"startsWithIgnoreCase":if(0===n.toLowerCase().indexOf(t.toLowerCase()))return e;break;case"doesNotContain":if(n.indexOf(t)<0)return e;break;case"doesNotContainIgnoreCase":if(n.toLowerCase().indexOf(t.toLowerCase())<0)return e;break;case"contains":if(n.indexOf(t)>-1)return e;break;case"containsIgnoreCase":if(n.toLowerCase().indexOf(t.toLowerCase())>-1)return e;break;case"equals":if(0===n.localeCompare(t))return e;break;case"equalsIgnoreCase":if(0===n.toLowerCase().localeCompare(t.toLowerCase()))return e;break;case"endsWith":if(n.endsWith(t))return e;break;case"endsWithIgnoreCase":if(n.toLowerCase().endsWith(t.toLowerCase()))return e}return null}_getFirstEnabledChild(e){const t=e.children;for(let e=0;e<t.length;e++)if(this._isChildEnabled(t[e]))return t[e]}_getLastEnabledChild(e){const t=e.children;for(let e=t.length-1;e>=0;e--)if(this._isChildEnabled(t[e]))return t[e]}_getNextEnabledChild(e){if(e)for(;e.nextElementSibling;){const t=e.nextElementSibling;if(this._isChildEnabled(t))return t;e=t}}_getOffsetTop(e){if(!e)return 0;let t=e.offsetTop;for(;e.offsetParent!==this.$.mainContainer;){if(!(e=e.offsetParent))return t;t+=e.offsetTop}return t}_getPreviousEnabledChild(e){if(e)for(;e.previousElementSibling;){const t=e.previousElementSibling;if(this._isChildEnabled(t))return t;e=t}}_hamburgerIconClickHandler(e,t){e&&e.stopPropagation();const n=this;if(void 0===t&&(t=Smart.ListMenu&&n instanceof Smart.ListMenu?n.$.view:n.$.mainContainer),!n.disabled)if(n._minimizedDropDownOpened)n._close();else{if(n._positionDetection.placeOverlay(),null!==n.dropDownAppendTo){const e=n.dropDownPosition,o=n.getBoundingClientRect(),i=n._positionDetection.getDropDownOffset();-1!==e.indexOf("right")||"auto"===e?n.rightToLeft?(t.style.right="initial",t.style.left=o.left+o.width-t.offsetWidth-i.x+"px"):(t.style.left=o.left+i.x+"px",t.style.right="initial"):-1!==e.indexOf("left")&&(t.style.left=o.right-t.offsetWidth+i.x+"px",t.style.right="initial"),-1!==e.indexOf("bottom")||-1!==e.indexOf("overlay")||"auto"===e?t.style.top=o.bottom+i.y+"px":-1!==e.indexOf("top")&&(t.style.top=o.top+i.y+"px")}else t.style.right="";n._edgeMacFF&&t.$.removeClass("not-in-view"),t.$.removeClass("smart-visibility-hidden"),n.$hamburgerIcon.addClass("smart-close-button"),n.$.hamburgerIcon.setAttribute("aria-expanded",!0),n._minimizedDropDownOpened=!0,n._browserBoundsDetection(t)}}_handleOverflowChange(){const e=this,t=e.$.mainContainer;if((e._minimized||null===e.dropDownAppendTo&&!t.classList.contains("simple")&&"tree"!==e.mode)&&!(Smart.ListMenu&&e instanceof Smart.ListMenu))return;const n=e.overflow;let o;"horizontal"===e.mode?(o=!0,t.scrollLeft=0):(o=!1,t.scrollTop=0),"hidden"===n?(t.classList.remove("scroll-buttons-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden")):(e.$.scrollButtonNear.disabled=e.disabled,e.$.scrollButtonFar.disabled=e.disabled,"auto"===n?(e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"),e._checkOverflow(t,o,[e.$.scrollButtonNear,e.$.scrollButtonFar])):(t.classList.add("scroll-buttons-shown"),t.classList.remove("one-button-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility(t,o,[e.$.scrollButtonNear,e.$.scrollButtonFar]))),e._scrollInfo.set(t,{left:t.scrollLeft,top:t.scrollTop})}_hideMainContainerScrollButtons(){const e=this;e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"),e.$mainContainer.removeClass("scroll-buttons-shown"),e.$mainContainer.removeClass("one-button-shown")}_hoverViaKeyboard(e){e&&(e.$.addClass("focus"),e.setAttribute("focus",""),this._focusedViaKeyboard=e,this._ensureVisible(e))}_isBranchExpanded(e){if("tree"!==this.mode)return!0;let t=!0;for(;e.parentItem;)t=t&&e.parentItem.expanded,e=e.parentItem;return t}_isChildEnabled(e){return!(e.disabled||e.templateApplied||e.hidden||e instanceof HTMLDivElement||0===e.offsetHeight)}_isContainerOpened(e,t){const n=this;return"tree"===n.mode||n._minimized?(n._openedContainers[e]||(n._openedContainers[e]=[]),-1!==n._openedContainers[e].indexOf(t)):n._openedContainers[e]===t}_keydownHandler(e){const t=this;let n=e.key;if(t.getRootNode().activeElement!==t||-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","Escape","Home"," "].indexOf(n)||t.disabled)return;e.preventDefault();const o=t.mode;if("tree"===o||t._minimized)return void t._keydownHandlerTreeMode(n);const i=t.dropDownPosition,r=-1!==i.indexOf("left"),a="top-left"===i||"top-right"===i,s=t._openedContainers;let l,d=t.$.mainContainer,m=1;for(let e=s.length-1;e>=0;e--)if(void 0!==s[e]){d=s[e],m=d.level,d=d.itemContainer;break}switch(l=d.querySelector('[focus][level="'+m+'"]'),t.rightToLeft&&("ArrowLeft"===n?n="ArrowRight":"ArrowRight"===n&&(n="ArrowLeft")),n){case"ArrowDown":1===m?"horizontal"!==o||a?"horizontal"!==o&&t._levelOneNavigate("_getFirstEnabledChild",l,d):t._levelOneOpenDropDown(l):t._navigate("_getNextEnabledChild",l,d);break;case"ArrowLeft":r?1===m?"horizontal"===o?t._levelOneNavigate("_getLastEnabledChild",l,d):t._levelOneOpenDropDown(l):l instanceof Smart.MenuItemsGroup?t._selectionHandler({target:l,isTrusted:!0}):t._levelOneNavigateFromLowerLevel("_getPreviousEnabledChild",l):t._arrowLeftHandler(m,o,l,d);break;case"ArrowRight":r?1===m?"horizontal"===o&&t._levelOneNavigate("_getFirstEnabledChild",l,d):2===m?t._levelOneNavigateFromLowerLevel("_getNextEnabledChild",l):t._escapeHandler(l,m,d):t._arrowRightHandler(m,o,l,d);break;case"ArrowUp":1===m?"horizontal"===o&&a?t._levelOneOpenDropDown(l):"horizontal"!==o&&t._levelOneNavigate("_getLastEnabledChild",l,d):t._navigate("_getPreviousEnabledChild",l,d);break;case"End":case"Home":{const e="End"===n?t._getLastEnabledChild(d):t._getFirstEnabledChild(d);if(!e||l===e)return;l&&(l.$.removeClass("focus"),l.removeAttribute("focus")),t._hoverViaKeyboard(e);break}case"Enter":l&&t._selectionHandler({target:l,isTrusted:!0});break;case"Escape":m>1?(2===m&&t._positionDetection.removeOverlay(),t._escapeHandler(l,m,d)):"dropDown"===o&&t.opened&&t.close({trigger:"interaction",target:"Escape"});break;case" ":l&&t._toggleItem(l)}}_keydownHandlerTreeMode(e){const t=this,n=Array.from(t.$.mainContainer.querySelectorAll("smart-menu-item, smart-menu-items-group")),o=t.$.mainContainer.getElementsByClassName("focus")[0];function i(e){const n=e.level;return!1===e.disabled&&!0!==e.templateApplied&&(1===n||n>1&&t._isContainerOpened(n,e.parentElement.container)&&e.getBoundingClientRect().height>0)}function r(e){for(let r=e;r<n.length;r++){const e=n[r];if(i(e)){if(o){if(o===e)break;o.$.removeClass("focus"),o.removeAttribute("focus")}t._hoverViaKeyboard(e);break}}}function a(e){for(let r=e;r>=0;r--){const e=n[r];if(i(e)){if(o){if(o===e)break;o.$.removeClass("focus"),o.removeAttribute("focus")}t._hoverViaKeyboard(e);break}}}function s(){o.level>1&&(o.$.removeClass("focus"),o.removeAttribute("focus"),t._hoverViaKeyboard(o.parentItem))}let l;switch(e){case"ArrowDown":l=o?n.indexOf(o)+1:0,r(l);break;case"ArrowLeft":if(!o)return;if(o instanceof Smart.MenuItem)s();else{if(t._isContainerOpened(o.level+1,o.container))return void t._closeSubContainers(o.level+1,o.container,!0,!0);s()}break;case"ArrowRight":if(!o||o instanceof Smart.MenuItem)return;t._isContainerOpened(o.level+1,o.container)?(o.$.removeClass("focus"),o.removeAttribute("focus"),t._hoverViaKeyboard(t._getFirstEnabledChild(o.itemContainer))):t._selectionHandler({target:o,type:"keydown",isTrusted:!0},o);break;case"ArrowUp":l=o?n.indexOf(o)-1:n.length-1,a(l);break;case"End":a(n.length-1);break;case"Enter":t._minimized&&!t._minimizedDropDownOpened?t._hamburgerIconClickHandler(void 0,t.$.mainContainer):o&&t._selectionHandler({target:o,type:"keydown",isTrusted:!0});break;case"Escape":t._minimized&&t._minimizedDropDownOpened&&t._close();break;case"Home":r(0);break;case" ":o&&t._toggleItem(o)}}_lazyInitItems(){const e=this;e._inLazyInit||(e._inLazyInit=!0,e._menuItems={},e._processHTML(e.$.mainContainer,1),e._expandItemsByDefault(),e._refreshCheckableItems(),cancelAnimationFrame(Smart.Menu.processTimer),delete Smart.Menu.processTimer,e._inLazyInit=!1,e.$.scrollViewer&&e.$.scrollViewer.refresh())}_levelOneNavigate(e,t,n){const o=this;if(t)"_getLastEnabledChild"===e?o._navigate("_getPreviousEnabledChild",t,n):o._navigate("_getNextEnabledChild",t,n);else{const t=o[e](n);t&&o._hoverViaKeyboard(t)}}_levelOneNavigateFromLowerLevel(e,t){const n=this,o=n[e](n._openedContainers[2].menuItemsGroup);o&&(t&&(t.$.removeClass("focus"),t.removeAttribute("focus")),n._closeSubContainers(2),o instanceof Smart.MenuItemsGroup?n._selectionHandler({target:o,isTrusted:!0}):n._hoverViaKeyboard(o))}_levelOneOpenDropDown(e){e&&e instanceof Smart.MenuItemsGroup&&this._selectionHandler({target:e,isTrusted:!0})}_mainContainerHandler(e){const t=this;if(t._minimized&&null!==t.dropDownAppendTo)switch(e.type){case"click":t._selectionHandler(e);break;case"mouseleave":t._mouseleaveHandler(e);break;case"mouseout":case"mouseover":t._mouseoutMouseoverHandler(e)}}_menuItemSelectionHandler(e,t){const n=this;function o(){n.enableShadowDOM&&(n.shadowRoot.activeElement||document.activeElement)!==n&&null!==n.dropDownAppendTo&&"click"===t.type&&!n.shadowRoot.contains(e)?n.focus():document.activeElement===n||null===n.dropDownAppendTo||"click"!==t.type||n.contains(e)||n.focus()}if(e.disabled||e.templateApplied)o();else{if(!n._toggleItem(e)){if(n.$.fireEvent("itemClick",{item:e,label:e.label,value:e.value}),t.target&&"A"!==t.target.nodeName){const t=e.querySelector("a");t&&t.click()}if("tree"!==n.mode&&(n._close(),"dropDown"===n.mode))return n._ripple(e,t),void n.close({trigger:"interaction",target:e})}n._ripple(e,t),o()}}_menuItemsGroupSelectionHandler(e,t,n){const o=this,i=o.mode,r=e.container,a=r.level,s="tree"!==i&&!o._minimized;if(o._treeAnimationInProgress===r)return;if(o._discardKeyboardHover(),o.getRootNode().activeElement===o||null===o.dropDownAppendTo||"click"!==t.type||o.contains(t.target)||o.focus(),"click"===t.type&&(!t.target.classList.contains("smart-"+o._element+"-items-group-arrow")&&o._toggleItem(e)||"mouseenter"===o.selectionMode&&"tree"!==i&&!o._minimized))return;let l=o.hasAnimation;if(o._isContainerOpened(a,r))o._closeSubContainers(a,r,!0,!1!==n),s&&e.hasAttribute("focus")&&(o._focusedViaKeyboard=e);else{if(o.$.fireEvent("expanding",{item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children}).defaultPrevented)return;if(o._positionDetection.placeOverlay(),s&&o._closeSubContainers(a),l&&!s&&("expand"!==t.type&&(o._ensureVisibleOnTransitionend=e),o._expandSection(r)),o._edgeMacFF&&2===a&&s&&r.$.removeClass("not-in-view"),r.$.removeClass("smart-visibility-hidden"),s||"expand"!==t.type){if(s)"keydown"===t.type&&(o._focusedViaKeyboard=e);else{const t=o.$.mainContainer.getElementsByClassName("focus")[0];t&&(t.$.removeClass("focus"),t.removeAttribute("focus")),o._focusedViaKeyboard=e}e.$.addClass("focus"),e.setAttribute("focus","")}if(e.$.addClass("smart-"+o._element+"-items-group-opened"),e.$.addClass("smart-"+o._element+"-items-group-expanded"),e.setAttribute("aria-expanded",!0),o._addOpenedContainer(a,r),s){if(o._ensureVisible(e),e.level>1&&e.parentElement.dropDownHeightSet){const t=o.dropDownPosition,n=e.getBoundingClientRect().top-e.parentElement.container.getBoundingClientRect().top;-1!==t.indexOf("bottom")||"auto"===t?r.style.top=n+"px":-1!==t.indexOf("top")?r.style.top=n+e.offsetHeight+"px":r.style.top=n+e.offsetHeight/2+"px"}r.itemContainer.checkOverflow&&r.itemContainer.dropDownHeightSet&&(o._checkOverflow(r.itemContainer,!1,[r.children[0],r.children[2]]),delete r.itemContainer.checkOverflow)}o._positionExternalContainer(r,e),"tree"===i||o._minimized?l||o._browserBoundsDetection(o.$.mainContainer):o._browserBoundsDetection(r),void 0===t.type&&o._hoverViaKeyboard(o._getFirstEnabledChild(e.itemContainer)),!1!==n&&o.$.fireEvent("expand",{item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children})}s?o._ripple(e,t):"tree"!==i||l||(o._checkOverflow(o.$.mainContainer,!1,[o.$.scrollButtonNear,o.$.scrollButtonFar]),o._minimized||"expand"===t.type||o._ensureVisible(e))}_mouseenterHandler(){const e=this;e.autoFocusOnMouseenter&&e.getRootNode().activeElement!==e&&e.focus()}_mouseleaveHandler(e){const t=this;if("mouseenter"===t.selectionMode&&"tree"!==t.mode&&!t._minimized){if(null!==t.dropDownAppendTo&&e.relatedTarget)if(t.contains(e.target)){const n=e.relatedTarget.closest(".smart-menu-drop-down");if(n&&n.ownerElement===t)return}else if(t.contains(e.relatedTarget))return;t._isElementHovered=!1,t._autoCloseTimeout=setTimeout((function(){const e=t.context;clearTimeout(t._autoCloseTimeout),t._isElementHovered||(t.context=t,t._close(),t.context=e)}),t.autoCloseDelay)}}_mouseoutMouseoverHandler(e){const t=this;if(t.disabled||t.displayLoadingIndicator)return;let n=e.target.closest("smart-menu-item")||e.target.closest("smart-menu-items-group");if(t.enableShadowDOM&&(n=e.composedPath()[0].closest("smart-menu-item")||e.composedPath()[0].closest("smart-menu-items-group")||n),"mouseover"===e.type&&(t._isElementHovered=!0),null!==n&&!n.disabled&&!n.templateApplied&&("tree"!==t.mode&&!t._minimized||!n.hasAttribute("focus")||!e.relatedTarget||e.target.parentElement!==e.relatedTarget&&e.relatedTarget.parentElement!==e.target))if(t._discardKeyboardHover(!1),"mouseover"===e.type){"mouseenter"!==t.selectionMode||"tree"===t.mode||t._minimized||(n instanceof Smart.MenuItemsGroup&&!n.hasAttribute("hover")?t._selectionHandler(e,n):n instanceof Smart.MenuItem&&t._closeSubContainers(n.level+1));const o=e.target.closest(".smart-menu-drop-down");(!o||o&&!n.contains(o))&&(n.$.addClass("hover"),n.setAttribute("hover",""),t._discardKeyboardHover(!0))}else{if("tree"!==t.mode&&!t._minimized&&("mouseenter"===t.selectionMode&&e.relatedTarget===t.$.mainContainer&&t._close(),n instanceof Smart.MenuItemsGroup&&n.container&&!n.container.$.hasClass("smart-visibility-hidden")))return;n.$.removeClass("hover"),n.removeAttribute("hover")}}_moveDropDownsToExternalContainer(){const e=this;for(let t=0;t<e._containersInBody.length;t++){const n=e._containersInBody[t];e._dropDownParent.appendChild(n),n.$.listen("click",e._selectionHandler.bind(e)),n.$.listen("mouseleave",e._mouseleaveHandler.bind(e)),n.$.listen("mouseout",e._mouseoutMouseoverHandler.bind(e)),n.$.listen("mouseover",e._mouseoutMouseoverHandler.bind(e))}for(let t=0;t<e._containers.length;t++){const n=e._containers[t];n.ownerElement=e,""!==e.theme&&n.classList.add(e.theme),e.rightToLeft&&n.setAttribute("right-to-left",""),n.classList.add("smart-drop-down-repositioned"),n.setAttribute("mode",e.mode),n.setAttribute("drop-down-position",e.dropDownPosition),e.checkboxes&&n.setAttribute("checkboxes","")}}_moveDropDownsToMenu(){const e=this;for(let t=0;t<e._containersInBody.length;t++){const n=e._containersInBody[t];n.$.unlisten("click"),n.$.unlisten("mouseleave"),n.$.unlisten("mouseout"),n.$.unlisten("mouseover"),n.style.left="",n.style.right="",n.style.top="",n.style.marginLeft="",n.style.marginTop="",n.menuItemsGroup.appendChild(n)}for(let t=0;t<e._containers.length;t++){const n=e._containers[t];""!==e.theme&&n.classList.remove(e.theme),n.classList.remove("smart-drop-down-repositioned"),n.removeAttribute("mode"),n.removeAttribute("drop-down-position"),n.removeAttribute("checkboxes"),n.removeAttribute("right-to-left")}}_navigate(e,t,n){const o=this;if(!t)return void("_getNextEnabledChild"===e?o._hoverViaKeyboard(o._getFirstEnabledChild(n)):o._hoverViaKeyboard(o._getLastEnabledChild(n)));const i=o[e](t);i&&(t.$.removeClass("focus"),t.removeAttribute("focus"),o._hoverViaKeyboard(i))}_positionExternalContainer(e,t){const n=this;if(null===n.dropDownAppendTo||2!==e.level)return;const o=n.dropDownPosition,i=n.mode,r=t.getBoundingClientRect(),a=n._positionDetection.getDropDownOffset(),s=r.top+a.y,l=r.bottom+a.y;let d=r.left+a.x,m=r.right+a.x;switch(e.style.top=e.style.left=e.style.right="",n.rightToLeft&&(e.style.right="initial"),-1!==o.indexOf("left")?(d-=e.offsetWidth,"horizontal"!==i&&"overlay-left"!==o||(d+=r.width),e.style.left=d+"px",e.style.right="initial"):"horizontal"===i||"overlay-right"===o?e.style.left=d+"px":n.rightToLeft?e.style.left=m-e.offsetWidth+"px":e.style.left=d+r.width+"px",o){case"bottom-right":case"bottom-left":case"auto":e.style.top="horizontal"===i?l+"px":s+"px";break;case"top-right":case"top-left":e.style.top="horizontal"===i?s-e.offsetHeight+"px":l-e.offsetHeight+"px";break;case"overlay-right":case"overlay-left":e.style.top=s+r.height/2+"px"}}_processDataSource(){const e=this,t=e.dataSource,n=e.displayMember,o=e.itemsMember,i=e.valueMember,r=e.$.mainContainer,a=document.createDocumentFragment();function s(t,r){let a;if(Array.isArray(t[o])&&t[o].length>0){a=document.createElement("smart-"+e._element+"-items-group"),!0===t.checkable&&a.set("checkable",!0),"string"==typeof t.checkMode&&a.set("checkMode",t.checkMode),t.dropDownHeight&&a.set("dropDownHeight",t.dropDownHeight),!0===t.expanded&&"tree"===e.mode&&(a.set("expanded",!0),a.setAttribute("aria-expanded",!0));for(let e=0;e<t[o].length;e++)s(t[o][e],a)}else a=document.createElement("smart-"+e._element+"-item"),void 0!==t.shortcut&&a.set("shortcut",t.shortcut),t.customAttribute&&a.setAttribute(t.customAttribute,"");a.isDirty=!1,void 0!==t.id&&/^[A-Za-z]+[\w\-\:\.]*$/.test(t.id)&&(a.id=t.id),!0===t.checked&&(a.set("checked",!0),a.setAttribute("aria-checked",!0)),!0===t.disabled&&a.set("disabled",!0),void 0!==t[n]?a.set("label",t[n]):"string"==typeof t[o]&&a.set("label",t[o]),!0===t.selected&&a.set("selected",!0),!0===t.separator&&a.set("separator",!0),void 0!==t[i]&&a.set("value",t[i]),r.appendChild(a)}r.innerHTML="",r instanceof Smart.ScrollViewer&&r.removeAll();for(let e=0;e<t.length;e++)s(t[e],a);e.$.mainContainer.appendChild(a),e._processHTML(e.$.mainContainer,1)}_processHTML(e,t,n){const o=this;let i,r;t>1&&(i=o._createMenuItemsGroupContainer(e,t),r=i.itemContainer,(e.expanded||e.hasAttribute("expanded"))&&"tree"===o.mode?o._menuItemsGroupsToExpand.push(e):(e.set("expanded",!1),e.removeAttribute("expanded"),e.setAttribute("aria-expanded",!1)));const a=Array.from(e.children),s=[],l=document.createDocumentFragment();let d=0;for(let n=0;n<a.length;n++){if(t>1&&0===n){d++;continue}const i=a[n];i instanceof Smart.MenuItem||i instanceof Smart.MenuItemsGroup?(o._createItemHTMLStructure(i,t,e,n-d),(i.checked||i.hasAttribute("checked"))&&(i.disabled||i.hasAttribute("disabled")||i.templateApplied?(i.set("checked",!1),i.removeAttribute("checked"),i.removeAttribute("aria-checked")):s.push(i)),t>1&&l.appendChild(i),i instanceof Smart.MenuItemsGroup&&o._processHTML(i,t+1)):(i.parentElement.removeChild(i),d++)}if(t>1){if(r.appendChild(l),e.container=i,e.itemContainer=r,e instanceof Smart.MenuItemsGroup){const n=document.createElement("div");n.className="smart-"+o._element+"-items-group-arrow","menu"===o._element?n.setAttribute("role","presentation"):(n.setAttribute("role","button"),n.setAttribute("aria-label","Toggle")),o._setArrowDirection(n,t),e.firstElementChild.appendChild(n)}o._containers.push(i),2===t&&(o._containersInBody.push(i),o._edgeMacFF&&i.addEventListener("transitionend",(function(e){e.target===this&&this.$.hasClass("smart-visibility-hidden")&&(this.style.left="",this.style.top="",this.$.addClass("not-in-view"))}))),null===o.dropDownAppendTo||"tree"===o.mode||o._minimized?e.appendChild(i):(i.ownerElement=o,o.rightToLeft?i.setAttribute("right-to-left",""):i.removeAttribute("right-to-left"),i.classList.add("smart-drop-down-repositioned"),i.setAttribute("mode",o.mode),i.setAttribute("drop-down-position",o.dropDownPosition),o.checkboxes&&i.setAttribute("checkboxes",""),""!==o.theme&&i.$.addClass(o.theme),i.setAttribute("animation",o.animation),2===t?(o._dropDownParent.appendChild(i),i.$.listen("click",o._selectionHandler.bind(o)),i.$.listen("mouseleave",o._mouseleaveHandler.bind(o)),i.$.listen("mouseout",o._mouseoutMouseoverHandler.bind(o)),i.$.listen("mouseover",o._mouseoutMouseoverHandler.bind(o))):e.appendChild(i))}o._validateRadioButtonSelection(e,t,s),o._sortItems&&!1!==n&&o._sortItems(e)}_processUList(){const e=this,t=new RegExp(/<li>(.(?!<\/li>)|\n)*?<ul>/),n=new RegExp(/<\/ul>(.|\n)*?<\/li>/);let o=e.$.mainContainer.firstElementChild.innerHTML;for(o=o.replace(/\r?\n|\r/g,""),o=o.replace(/<li(.|\n)*?>/g,"<li>"),o=o.replace(/<li><\/li>/g,"<li> </li>"),o=o.replace(/<ul(.|\n)*?>/g,"<ul>");t.test(o);){const n=t.exec(o),i="<smart-"+e._element+"-items-group>"+n[0].slice(4,n[0].length-4);o=o.replace(n[0],i)}for(;n.test(o);){const t=n.exec(o),i="</smart-"+e._element+"-items-group>";o=o.replace(t[0],i)}o=o.replace(/li>/g,"smart-"+e._element+"-item>"),e.$.mainContainer.innerHTML=o}_refreshContainersArrays(){const e=this;for(let t=e._containers.length-1;t>=0;t--){const n=e._containers[t];if(!document.body.contains(n)){e._containers.splice(t,1);const o=e._containersFixedHeight.indexOf(n);o>-1&&(e._containersFixedHeight.splice(o,1),e._additionalScrollButtons.splice(o,1))}}e._checkContainersLength()}_refreshItemPaths(e,t,n,o){const i=this;let r;r=t?e:e.container.itemContainer;const a=n?n(e):r.children;for(let r=0;r<a.length;r++){const s=a[r];let l;o&&(s.originalIndex=r),l=t?""+r:e.path+"."+r,s.path=l,i._menuItems[l]=s,s instanceof Smart.MenuItemsGroup&&i._refreshItemPaths(s,void 0,n,o)}}_removeContainerFixedHeight(){const e=this;for(let t=0;t<e._containersFixedHeight.length;t++){const n=e._containersFixedHeight[t];n.style.height="",n.itemContainer.$.removeClass("scroll-buttons-shown"),n.itemContainer.$.removeClass("one-button-shown"),n.children[0].$.addClass("smart-hidden"),n.children[2].$.addClass("smart-hidden"),n.itemContainer.checkOverflow=!0}}_removeContainersInBody(){const e=this;if(null!==e.dropDownAppendTo&&!e._minimized)for(let t=0;t<e._containersInBody.length;t++)e._containersInBody[t].remove()}_reparentMenu(e,t){const n=this;if("dropDown"===n.mode&&(null!==n._dropDownParent||e)&&n._dropDownParent!==n.parentElement){if(e&&null!==t){if(null===n._dropDownParent)return n._positionRelativeTo.appendChild(n),void(n._positionRelativeTo=null)}else n._positionRelativeTo=n.parentElement;n._dropDownParent.appendChild(n)}}refresh(){const e=this;if(e._suppressResizeHandler)return void delete e._suppressResizeHandler;const t=e.minimizeWidth,n=e.mode;if(null!==t&&"dropDown"!==n){if(e.offsetWidth<=t&&!e._minimized)return void e.minimize();e.offsetWidth>t&&e.maximize()}(null!==e.dropDownAppendTo||"tree"===n||e.$mainContainer.hasClass("simple"))&&e._checkOverflow(e.$.mainContainer,"horizontal"===n,[e.$.scrollButtonNear,e.$.scrollButtonFar])}_resizeHandler(){this.refresh()}_ripple(e,t){if(this.hasRippleAnimation&&"click"===t.type)return Smart.Utilities.Animation.Ripple.animate(e,t.pageX,t.pageY),!0}_scroll(e){if(e.closest("[template-applied]"))return;const t=this,n=t.$.mainContainer,o=t.mode,i=e.classList.contains("smart-scroll-button-near")?-1:1;let r;if(e.parentElement===t.$.container)r=n,"tree"!==o&&t._closeSubContainers(2),"horizontal"===t.mode?(n.scrollLeft=n.scrollLeft+10*i,t._updateScrollButtonVisibility(n,!0,[t.$.scrollButtonNear,t.$.scrollButtonFar])):(n.scrollTop=n.scrollTop+10*i,t._updateScrollButtonVisibility(n,!1,[t.$.scrollButtonNear,t.$.scrollButtonFar]));else{const n=e.parentElement,o=n.itemContainer;r=o,t._closeSubContainers(n.level+1),o.scrollTop=o.scrollTop+10*i,t._updateScrollButtonVisibility(o,!1,[n.children[0],n.children[2]])}t._scrollInfo.set(r,{left:r.scrollLeft,top:r.scrollTop})}_selectionHandler(e,t){const n=this,o=e.target;if(o.closest("[template-applied]")&&e.stopPropagation(),!n.disabled&&!n.displayLoadingIndicator){if(void 0===t){if("click"===e.type){const t=o.closest("smart-repeat-button");if(t)return void n._scroll(t,e)}if(!e.isTrusted)return;const i=o.closest("smart-"+n._element+"-item");if(i)return void n._menuItemSelectionHandler(i,e);if((t=o.closest("smart-"+n._element+"-items-group"))&&(o===t.container||o===t.container.firstElementChild))return}t&&!t.disabled&&n._menuItemsGroupSelectionHandler(t,e)}}_setArrowDirection(e,t){const n=this,o=n.mode;"tree"===o||n._minimized?e.className="smart-"+n._element+"-items-group-arrow down smart-arrow-down":"overlay"!==n.dropDownPosition.slice(0,7)?2===t&&"horizontal"===o?"top"!==n.dropDownPosition.slice(0,3)?e.className="smart-menu-items-group-arrow down smart-arrow-down":e.className="smart-menu-items-group-arrow up smart-arrow-up":e.className="smart-menu-items-group-arrow "+(n.rightToLeft?"left smart-arrow-left":"right smart-arrow-right"):e.className="smart-menu-items-group-arrow minus"}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return void e.removeAttribute("tabindex");const t=e.getAttribute("tabindex");(null===t||t<0)&&e.setAttribute("tabindex",0)}_setItemLabel(e,t){const n=this,o=n.context,i=e.querySelector(".smart-menu-item-label-element>span");n.context=n,n._setLabel(t,i,e,!0),n._checkOverflow(n.$.mainContainer,"horizontal"===n.mode,[n.$.scrollButtonNear,n.$.scrollButtonFar]),n.context=o}_setLabel(e,t,n,o){const i=document.getElementById(e);if(null!==i&&"template"===i.tagName.toLowerCase()){const r=document.importNode(i.content,!0);if(n instanceof Smart.MenuItem)t.appendChild(r),o&&(n.setAttribute("template-applied",""),n.templateApplied=!0);else if(Smart.ListMenu&&this instanceof Smart.ListMenu){const e=new RegExp(/{{title="(.*)"}}/);for(let t=0;t<r.childNodes.length;t++)e.test(r.childNodes[t].innerHTML)?(n.titleLabel=e.exec(r.childNodes[t].innerHTML)[1],r.childNodes[t].innerHTML=r.childNodes[t].innerHTML.replace(e,"")):e.test(r.childNodes[t].textContent)&&(n.titleLabel=e.exec(r.childNodes[t].textContent)[1],r.childNodes[t].textContent=r.childNodes[t].textContent.replace(e,""));void 0===n.titleLabel&&(n.titleLabel=r.textContent),t.appendChild(r)}else t.innerHTML=e,n.titleLabel=e}else t.innerHTML=e,n instanceof Smart.MenuItemsGroup&&(n.titleLabel=e)}_toggleItem(e){const t=this;if(t.checkboxes){const n=1===e.level?t:e.parentItem;if(n.checkable){const o=t._getItemCheckableInfo(e,n);let i=!1;return"none"!==o.checkMode&&("checkbox"===o.checkMode?(i=!0,e.set("checked",!e.checked),e.checked?e.setAttribute("aria-checked",!0):e.removeAttribute("aria-checked"),t.$.fireEvent("itemCheckChange",{item:e,label:e.label,value:e.value,checked:e.checked})):"radioButton"!==o.checkMode||e.checked||(i=!0,e.set("checked",!0),e.setAttribute("aria-checked",!0),t._uncheckSiblings(e,o.siblings),t.$.fireEvent("itemCheckChange",{item:e,label:e.label,value:e.value,checked:!0})),e instanceof Smart.MenuItem&&i&&t.$.fireEvent("itemClick",{item:e,label:e.label,value:e.value}),"tree"===t.mode||"ListMenu"===t.elementName||t.preventCloseOnCheck||(t._close(),t.close()),!0)}}return!1}_getItemCheckableInfo(e,t){const n=Array.from(e.parentElement.children),o=t.checkMode.replace(/\s/g,"").split(",");let i,r;if(1===o.length)i=o[0],r=n;else{let t=0,a=!1;r=[];for(let o=0;o<n.length;o++){const i=n[o];if(r.push(i),i===e&&(a=!0),i.separator){if(!0===a)break;t++,r=[]}}i=o[t]}return{checkMode:i,siblings:r}}_refreshCheckableItems(e){const t=this,n=!t.checkboxes;(e?[e]:[t].concat(t._containers.map((e=>e.menuItemsGroup)))).forEach((e=>{const o=Array.from((e===t?t.$.mainContainer:e.itemContainer).children);let i=e.checkMode.replace(/\s/g,"").split(",");if(n||!e.checkable||1===i.length)return void o.forEach((e=>e.removeAttribute("check-type")));let r=0;i=i.map((e=>-1===["checkbox","radioButton","none"].indexOf(e)?"none":e));let a=[],s=[];for(let e=0;e<o.length;e++){const n=o[e];let l=i[r];if(void 0===l&&(l=i[r]="none"),"none"!==l&&t._isChildEnabled(n)||(n.checked=!1,n.removeAttribute("aria-checked")),"none"===l?n.setAttribute("role","menuitem"):"checkbox"===l?n.setAttribute("role","menuitemcheckbox"):"radioButton"===l&&(n.setAttribute("role","menuitemradio"),a.push(n),n.checked&&s.push(n)),n.setAttribute("check-type",l),n.separator){if(a.length>0)if(s.length>1)for(let e=0;e<s.length-1;e++)s[e].checked=!1;else if(0===s.length)for(let e=0;e<a.length;e++)if(t._isChildEnabled(a[e])){a[e].checked=!0;break}a=[],s=[],r++}}e.checkMode=i.join(", ")}))}_transitionendHandler(e){const t=this;"dropDown"===t.mode&&t.opened&&e.target===t&&"opacity"===e.propertyName&&(t._checkOverflowOnOpen&&(t._checkOverflow(t.$.mainContainer,!1,[t.$.scrollButtonNear,t.$.scrollButtonFar]),delete t._checkOverflowOnOpen),t.getRootNode().activeElement===t||t._noAutoFocus||t.focus())}_transitionendHandlerCollapse(){let e,t;if(1===arguments.length){if("visibility"===arguments[0].propertyName)return;t=this,e=t.menuItemsGroup.menu}else e=arguments[0],t=arguments[1];t.menuItemsGroup.$.removeClass("smart-"+e._element+"-items-group-expanded"),t.menuItemsGroup.setAttribute("aria-expanded",!1),t.removeEventListener("transitionend",e._transitionendHandlerCollapse),t.style.height=null,t.$.addClass("smart-visibility-hidden"),e._checkOverflow(e.$.mainContainer,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar]),e._minimized&&e._browserBoundsDetection(e.$.mainContainer),delete e._treeAnimationInProgress}_transitionendHandlerExpand(){let e,t;if(1===arguments.length){if("visibility"===arguments[0].propertyName)return;t=this,e=t.menuItemsGroup.menu}else e=arguments[0],t=arguments[1];t.removeEventListener("transitionend",e._transitionendHandlerExpand),t.style.height=null,e._checkOverflow(e.$.mainContainer,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar]),e._minimized&&e._browserBoundsDetection(e.$.mainContainer),e._ensureVisibleOnTransitionend&&(e._ensureVisible(e._ensureVisibleOnTransitionend),delete e._ensureVisibleOnTransitionend),delete e._treeAnimationInProgress}_uncheckSiblings(e,t){for(let n=0;n<t.length;n++){const o=t[n];o!==e&&o.checked&&(o.set("checked",!1),o.removeAttribute("aria-checked"),this.$.fireEvent("itemCheckChange",{item:o,label:o.label,value:o.value,checked:!1}))}}_unsortItems(e,t){const n=this;let o,i,r=[];e===n.$.mainContainer?(i=e,o=e.children):(i=e.container.firstElementChild,o=i.children);for(let e=0;e<o.length;e++){const i=o[e];r[i.originalIndex]=i,i instanceof Smart.MenuItemsGroup&&void 0===t&&n._unsortItems(i)}if(!(r.length<2))for(let e=0;e<r.length;e++)i.appendChild(r[e])}_updateItemRoles(e){const t=this;for(let n in t._menuItems){const o=t._menuItems[n],i=o.parentItem||t;e&&i!==e||(t.checkboxes&&i.checkable?o.setAttribute("role","checkbox"===i.checkMode?"menuitemcheckbox":"menuitemradio"):o.setAttribute("role","menuitem"))}t._refreshCheckableItems(e)}_updateScrollButtonVisibility(e,t,n){const o=this,i=o.overflow,r=e===o.$.mainContainer;if(r&&"hidden"===i)return;let a,s,l,d=!0,m=!0;if(t?(a="scrollLeft",s="offsetWidth",l="scrollWidth"):(a="scrollTop",s="offsetHeight",l="scrollHeight"),0===Math.round(e[a])&&(d=!1),Math.round(e[s]+e[a])>=Math.round(e[l])&&(m=!1),r&&"auto"!==i)"scroll"!==i||o.disabled||(n[0].disabled=!d,n[1].disabled=!m);else{if(d&&m)return n[0].$.removeClass("smart-hidden"),n[1].$.removeClass("smart-hidden"),void e.classList.remove("one-button-shown");d?n[0].$.removeClass("smart-hidden"):n[0].$.addClass("smart-hidden"),m?n[1].$.removeClass("smart-hidden"):n[1].$.addClass("smart-hidden"),e.classList.add("one-button-shown")}}_validateRadioButtonSelection(e,t,n){const o=this;if(o.checkboxes){let i,r;if(1===t?(i=o,r=o.$.mainContainer):(i=e,r=e.itemContainer),"radioButton"===i.checkMode&&i.checkable)if(n.length>1)for(let e=n.length-2;e>=0;e--)n[e].set("checked",!1),n[e].removeAttribute("aria-checked");else if(0===n.length){const e=o._getFirstEnabledChild(r);e&&(e.set("checked",!0),e.setAttribute("aria-checked",!0))}}}});
|
|
67
67
|
(()=>{class e extends HTMLElement{constructor(){super(),this._properties={min:50,label:"Item",modifiers:["resize","drag","close"],size:null}}_setProperty(e,t){const i=this;if(i._properties[e]===t)return;if(i._properties[e]=t,i._updating=!0,"disabled"===e||"modifiers"===e?t?i.setAttribute(e,t):i.removeAttribute(e):null===t?i.removeAttribute(e):i.setAttribute(e,t),!i.isCompleted)return;const r=i.closest("smart-layout");r&&(r._resizeDetails||r._updating||!r.isRendered||r.refresh()),i._updating=!1}get label(){return this._properties.label}set label(e){this._setProperty("label",e)}get modifiers(){return this._properties.modifiers}set modifiers(e){this._setProperty("modifiers",e)}get min(){return this._properties.min}set min(e){this._setProperty("min",e)}get size(){return this._properties.size}set size(e){null!==e?"string"==typeof e?this._setProperty("size",e):this._setProperty("size",Math.max(this.min,e)):this._setProperty("size",e)}static get observedAttributes(){return["min","size","label","modifiers"]}attributeChangedCallback(e,t,i){const r=this;if(t!==i&&r.isCompleted)if("size"===e){if(!r._updating){if(null===i)return void(this[e]=null);r[e]=Math.max(r.min,parseInt(i))}}else r[e]=i}connectedCallback(){this.isCompleted||this.render()}whenRendered(e){const t=this;t.isRendered?e():(t.whenRenderedCallbacks||(t.whenRenderedCallbacks=[]),t.whenRenderedCallbacks.push(e))}render(){const e=this;e.hasAttribute("data-id")||e.setAttribute("data-id","id"+Math.random().toString(16).slice(2)),e.hasAttribute("label")||e.setAttribute("label",e.label),e.hasAttribute("min")||e.setAttribute("min",e.min),e.hasAttribute("label")||e.setAttribute("label",e.label),e.hasAttribute("modifiers")||e.setAttribute("modifiers",e.modifiers);for(let t=0;t<e.attributes.length;t++){const i=e.attributes[t],r=i.name,s=i.value;isNaN(s)||"min"!==r&&"size"!==r?e._properties[r]=s:e._properties[r]=parseInt(s)}if(e.classList.add("smart-layout-item"),e.isCompleted=!0,e.whenRenderedCallbacks){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}}}class t extends e{constructor(){super(),this._properties.label="Group",this._properties.orientation="vertical"}get orientation(){return this._properties.orientation}set orientation(e){this._setProperty("orientation",e)}static get observedAttributes(){return["min","size","modifiers","orientation","position"]}render(){const e=this;super.render(),e.className="smart-layout-group",e.hasAttribute("orientation")?e._properties.orientation=e.getAttribute("orientation"):e.setAttribute("orientation",e._properties.orientation)}}class i extends t{constructor(){super(),this._properties.position="top",this._properties.label="TabGroup"}get position(){return this._properties.position}set position(e){this._setProperty("position",e)}render(){const e=this;super.render(),!e.hasAttribute("position")&&e.position&&e.setAttribute("position","top")}static get observedAttributes(){return["min","size","modifiers","orientation","position"]}}class r extends t{constructor(){super(),this._properties.label="TabItem"}}customElements.define("smart-layout-group",t),customElements.define("smart-layout-item",e),customElements.define("smart-tab-layout-group",i),customElements.define("smart-tab-layout-item",r),Smart("smart-layout",class extends Smart.ContentElement{static get properties(){return{allowLiveSplit:{value:!1,type:"boolean"},allowContextMenu:{value:!1,type:"boolean"},contextMenuDataSource:{value:["select","delete"],type:"any"},dataSource:{reflectToAttribute:!1,value:null,type:"any"},messages:{value:{en:{select:"Select Parent",delete:"Delete"}},type:"object",extend:!0},orientation:{value:"vertical",type:"string"},selectedIndex:{value:null,type:"any"}}}static get listeners(){return{contextmenu:"_contextMenuHandler","document.down":"_documentDownHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler","document.selectstart":"_documentSelectStartHandler",mouseleave:"_leaveHandler",mouseenter:"_enterHandler",dragStart:"_dragStart","document.keyup":"_keyUpHandler"}}_dragStart(e){e.stopPropagation(),e.preventDefault()}_leaveHandler(){const e=this;e._resizeDetails||(e._handleButtonsVisibility(null),e._hideSplitter(),requestAnimationFrame((()=>{e.classList.remove("outline")})))}_enterHandler(){const e=this;e._resizeDetails||(e._handleButtonsVisibility(e._selectedItem),e._updateSplitter(),requestAnimationFrame((()=>{e.classList.add("outline")})))}template(){return'<div id="container" role="presentation"><smart-layout-group data-id="root" id="itemsContainer"><content></content></smart-layout-group><div root-splitter id="splitter" class="smart-layout-splitter"></div>'}propertyChangedHandler(e,t,i){const r=this;switch(e){case"contextMenuDataSource":r._contextMenu&&(r._closeContextMenu(),r._contextMenu.innerHTML="");break;case"orientation":r.$.itemsContainer&&(r.$.itemsContainer.orientation=r.orientation);break;case"dataSource":r.dataBind();break;case"selectedIndex":r._handleItemClick(r.getItem(i+""),!0);break;default:super.propertyChangedHandler(e,t,i)}}dataBind(){const e=this;e.$.itemsContainer.innerHTML="";let t="";const i=(e,r)=>{for(let s=0;s<e.length;s++){const n=e[s],o=n.size,a=n.min,l=n.modifiers,d=n.type,c=n.position,u=n.orientation?n.orientation:"vertical";let p="";if(void 0!==o&&(p+=`size="${o}" `),void 0!==a&&(p+=`min="${a}" `),void 0!==l&&(p+=`modifiers="${l}" `),void 0!==c&&(p+=`position="${c}" `),n.items)p+=`orientation=${u} `,"tabs"===d?(t+=`<smart-tab-layout-group ${p}>`,i(n.items,!0),t+="</smart-tab-layout-group>"):(t+=`<smart-layout-group ${p}>`,i(n.items),t+="</smart-layout-group>");else{const e=n.content||"";t+=r?`<smart-tab-layout-item ${p}>`+e+"</smart-tab-layout-item>":`<smart-layout-item ${p}>`+e+"</smart-layout-item>"}}};i(e.dataSource),e.$.itemsContainer.innerHTML=t,e.refresh()}render(){const e=this;e.setAttribute("role","group"),e.selectedIndex&&e._handleItemClick(e.getItem(e.selectedIndex+""),!0),e.checkLicense();const t=()=>{e.dataSource?e.dataBind():e.dataSource=e._getDataSource(e._getLayout()),e.$.itemsContainer.orientation=e.orientation,super.render(),e.refresh(),e._updateSplitter()};"complete"===document.readyState?t():window.addEventListener("load",(()=>{t()}))}getItem(e){if(null==e)return;e=(e+"").split(".");let t,i=this._getDataSource(this._getLayout());for(let r=0;r<e.length&&(t=i[e[r]],t);r++)i=t.items;return t}_contextMenuHandler(e){const i=this;let r=e.target;if(i.allowContextMenu&&r.closest){if(r.closest(".smart-layout-context-menu"))return void e.preventDefault();let s=i.querySelector("[selected][data-id]");if(s||(s=r.closest(".smart-layout-item")||r.closest(".smart-layout-group")),!s)return;e.preventDefault(),i._createContextMenu();const n=i._contextMenu.children;for(let e=0;e<n.length;e++){const i=n[e];"delete"===i.getAttribute("value")?s.hasAttribute("index")&&"0"===s.getAttribute("index")?i.setAttribute("disabled",""):i.removeAttribute("disabled"):"select"===i.getAttribute("value")&&(s.hasAttribute("index")&&"0"===s.getAttribute("index")||!(s.parentElement instanceof t)?i.setAttribute("disabled",""):i.removeAttribute("disabled"))}i._openContextMenu(s,e.pageX,e.pageY)}}_createContextMenu(){const e=this;let t=e._contextMenu;if(t||(t=document.createElement("div"),t.classList.add("smart-layout-context-menu","smart-visibility-hidden"),e._contextMenu=t),!t.innerHTML){const i=e.contextMenuDataSource;for(let r=0;r<i.length;r++){const s=i[r];let n,o;"object"==typeof s?(n=s.label,o=s.value):o=n=s+"",t.innerHTML+=`<div class="smart-layout-context-menu-item" value="${o}">${e.localize(n)||n}</div>`}}}_openContextMenu(e,t,i){const r=this,s=r._contextMenu;if(!s||!s.classList.contains("smart-visibility-hidden"))return;r.$.fireEvent("opening").defaultPrevented||e.parentElement&&(s._target=e,r._opening=!0,r.$.container.appendChild(s),r._positionContextMenu(t,i),s.classList.remove("smart-visibility-hidden"),r.$.fireEvent("open"))}_closeContextMenu(){const e=this,t=e._contextMenu;if(!t||t.classList.contains("smart-visibility-hidden"))return;e.$.fireEvent("closing").defaultPrevented||(delete e._opening,e.hasAnimation&&t.addEventListener("transitionend",e._contextMenuTransitionEndHandler.bind(e),{once:!0}),t.classList.add("smart-visibility-hidden"),e.$.fireEvent("close"))}_contextMenuTransitionEndHandler(){const e=this,t=e._contextMenu;t&&!e._opening&&t.parentElement&&e.$.container.removeChild(t)}_positionContextMenu(e,t){const i=this._contextMenu;if(!i)return;const r=this.$.container.getBoundingClientRect();e-=r.left+window.pageXOffset,t-=r.top+window.pageYOffset,e+i.offsetWidth>r.width&&(e-=e+i.offsetWidth-r.width),t+i.offsetHeight>r.height&&(t-=t+i.offsetHeight-r.height),i.style.left=e+"px",i.style.top=t+"px"}_documentDownHandler(e){const t=this,i=e.originalEvent.target;t.contains(i)&&i.closest&&(t._target=i,t._updateSplitter())}_documentMoveHandler(e){const t=this,s=e.originalEvent.target,n=t._contextMenu;if(n&&!Smart.Utilities.Core.isMobile){if(n.querySelector(".smart-layout-context-menu-item[hover]")){const e=n.children;for(let t=0;t<e.length;t++)e[t].removeAttribute("hover")}n.contains(s)&&s.closest&&s.closest(".smart-layout-context-menu-item")&&s.setAttribute("hover","")}if(t._dragDetails){const s=Math.abs(t._dragDetails.pageX-e.pageX);if(Math.abs(t._dragDetails.pageY-e.pageY)<=5&&s<=5)return;t._dragDetails.feedback.parentElement||(document.body.appendChild(t._dragDetails.feedback),document.body.appendChild(t._dragDetails.overlay),setTimeout((()=>{t._dragDetails.feedback.classList.add("dragging")}),100)),t._dragDetails.dragging=!0,t._dragDetails.feedback.style.left=e.pageX-t._dragDetails.feedback.offsetWidth/2-5+"px",t._dragDetails.feedback.style.top=e.pageY-t._dragDetails.feedback.offsetHeight/2-5+"px";const n=document.elementsFromPoint(e.pageX,e.pageY);let o=null,a=!1;for(let e=0;e<n.length;e++){const s=n[e];if(!t._dragDetails.feedback.contains(s)){if(s.classList.contains("smart-layout-tab-strip")){if(t._dragDetails.element.contains(s))continue;o=s.parentElement,a=!0;break}if((s.parentElement!==t._dragDetails.parent&&s!==t._dragDetails.parent||1!==t._dragDetails.layoutGroup.items.length)&&!t._dragDetails.element.contains(s)){if(s instanceof r){o=s.parentElement;break}if(s instanceof i){o=s;break}}}}const l=(i,r)=>{const s=t.offset(i);let n=null,o=50,a=r,l=r;r?o=0:(l=i.offsetWidth/3,a=i.offsetHeight/3);const d=[{left:s.left,top:s.top,right:s.left+o,bottom:s.top+o,position:"top"},{left:s.left+o,top:s.top,right:s.left+i.offsetWidth-o,bottom:s.top+a-o,position:"top"},{left:s.left+i.offsetWidth-o,top:s.top,right:s.left+i.offsetWidth,bottom:s.top+o,position:"top"},{left:s.left,top:s.top+o,right:s.left+l,bottom:s.top+i.offsetHeight-o,position:"left"},{left:s.left+i.offsetWidth-l,top:s.top+o,right:s.left+i.offsetWidth,bottom:s.top+i.offsetHeight-o,position:"right"},{left:s.left,top:s.top+i.offsetHeight-o,right:s.left+o,bottom:s.top+i.offsetHeight,position:"bottom"},{left:s.left+o,top:s.top+i.offsetHeight-a+o,right:s.left+i.offsetWidth-o,bottom:s.top+i.offsetHeight,position:"bottom"},{left:s.left+i.offsetWidth-o,top:s.top+i.offsetHeight-o,right:s.left+i.offsetWidth,bottom:s.top+i.offsetHeight,position:"bottom"}];for(let t=0;t<d.length;t++){const i=d[t];if(i.left<=e.pageX&&e.pageX<=i.right&&i.top<=e.pageY&&e.pageY<=i.bottom){n=i.position;break}}return n},d=t.querySelector("smart-layout-group");let c=l(d,10),u=null;c?u=d:o?a?o!==t._dragDetails.parent&&(c="center",u=o):(c=l(o)||"center",u=o):t._handleDropArea(null),u&&(t._dragDetails.current=u,t._dragDetails.position=c,t._handleDropArea(u,c))}if(t._resizeDetails){const i=Math.abs(t._resizeDetails.clientX-e.clientX),r=Math.abs(t._resizeDetails.clientY-e.clientY),s=t._resizeDetails.splitter,n=t._resizeDetails.item,o=t._resizeDetails.itemRect,a=t._resizeDetails.previousItemRect,l=t._resizeDetails.previousItem,d=t._resizeDetails.nextItemRect,c=t._resizeDetails.nextItem,u=parseInt(n.getAttribute("min")),p=e=>{e.classList.contains("smart-visibility-hidden")||(e.style.right="",e.style.top="",e.style.left="",e.style.bottom="")};if(p(s),p(t.$.splitter),s.classList.remove("error"),s.classList.add("active"),!t._resizeDetails.dragging){if(s.classList.contains("horizontal")&&r<=5)return;if(s.classList.contains("vertical")&&i<=5)return;t._resizeDetails.dragging=!0}let m={clientPos:"clientX",pos:"x",size:"width",near:"left",far:"right",offsetSize:"offsetWidth"};s.classList.contains("horizontal")&&(m={clientPos:"clientY",pos:"y",size:"height",near:"top",far:"bottom",offsetSize:"offsetHeight"});const f=e=>{const i=t.offset(e),r=t.offset(t);t.$.splitter.style.width=e.offsetWidth+"px",t.$.splitter.style.height=e.offsetHeight+"px",t.$.splitter.className=e.className,t.$.splitter.style.left=i.left-r.left+"px",t.$.splitter.style.top=i.top-r.top+"px",e.setAttribute("drag",""),t.$.splitter.setAttribute("drag","")};if(s.classList.contains("last")){let i=e[m.clientPos]-t._resizeDetails.splitterRect[m.pos],r=o[m.size]-u;if(i>r&&(i=r,s.classList.add("error")),a){const e=parseInt(l.getAttribute("min"));let t=a[m.size]-e;i<-t&&(i=-t,s.classList.add("error"))}s.style[m.near]=i+"px";const d=n[m.offsetSize]-i;if(n.setAttribute("size",d),l){const e=n[m.offsetSize]+l[m.offsetSize]-d;l.setAttribute("size",e)}}else{let i=-e[m.clientPos]+t._resizeDetails.splitterRect[m.pos],r=o[m.size]-u;if(i>r&&(i=r,s.classList.add("error")),d){const e=parseInt(c.getAttribute("min"));let t=-d[m.size]+e;i<t&&(i=t,s.classList.add("error"))}s.style[m.far]=i+"px";const a=n[m.offsetSize]-i;if(n.setAttribute("size",a),c){const e=c[m.offsetSize]+n[m.offsetSize]-a;c.setAttribute("size",e)}}f(s)}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}_keyUpHandler(e){const t=this;if("Escape"===e.key){if(t._dragDetails&&(t._dragDetails.feedback.remove(),t._dragDetails.overlay.remove(),t._dragDetails=null,t._handleDropArea(null)),t._resizeDetails){const e=t._resizeDetails;return e.splitter.classList.contains("last")?e.previousItem.size=e.previousItemSize:e.nextItem.size=e.nextItem.previousItemSize,e.item.size=e.itemSize,t.refresh(),t._handleItemClick(e.item),void(t._resizeDetails=null)}}else"Delete"===e.key&&t._selectedItem&&t._removeLayoutItem(t._selectedItem)}_endDrag(){const e=this;if(e._handleDropArea(null),!e._dragDetails.dragging)return void(e._dragDetails=null);const t=e._dragDetails.current,i=e._dragDetails.element,r=e._dragDetails.position;if(e._handleDropArea(null),t){if(e._addTabLayoutItem(t,r,i),e._removeLayoutItem(i),t.parentElement&&1===Array.from(t.parentElement.parentElement.children).filter((e=>!!e.classList.contains("smart-layout-group"))).length){const i=t.parentElement,r=i.parentElement,s=r.parentElement;if("root"!==r.getAttribute("data-id")&&"root"!==s.getAttribute("data-id")&&s!==e){const e=Array.from(s.children).indexOf(i.parentElement);e>=0?s.insertBefore(i,s.children[e]):s.appendChild(i),r.remove()}}e.refresh(),e._updateSplitter(),requestAnimationFrame((()=>{e.classList.add("outline"),e.querySelectorAll(".smart-element").forEach((e=>{e.$.fireEvent("resize")}))}))}e.$.fireEvent("stateChange",{type:"insert",item:i}),e._dragDetails.feedback.remove(),e._dragDetails.overlay.remove(),e._dragDetails=null}_documentUpHandler(e){const t=this,i=Smart.Utilities.Core.isMobile,s=i?document.elementFromPoint(e.pageX-window.pageXOffset,e.pageY-window.pageYOffset):e.originalEvent.target;if(2!==e.button){if(t._dragDetails&&t._endDrag(e),t._resizeDetails){const e=t._resizeDetails;return e.item&&(e.item.style.overflow=""),e.previousItem&&(e.previousItem.style.overflow=""),e.nextItem&&(e.nextItem.style.overflow=""),t.refresh(),t._handleItemClick(e.item),t._resizeDetails=null,void t.querySelectorAll(".smart-element").forEach((e=>{e.$.fireEvent("resize")}))}if(t.contains(s)&&(t.classList.add("outline"),t._target&&!s.item&&(s instanceof r?t._handleItemClick(s):t._handleItemClick(s.closest(".smart-layout-item"))),t._target)){if(t._target!==s)return void delete t._target;if(!e.button&&s.closest(".smart-layout-buttons-container")){const i=e.originalEvent.target;t._handleButtonClick(i.item,i.position)}else s.closest(".smart-layout-context-menu")&&(!i&&!e.button||i)&&t._handleMenuItemClick(s.closest(".smart-layout-context-menu-item"));delete t._target}}}_documentSelectStartHandler(e){this._target&&e.preventDefault()}_getDataSource(i,r,s){const n=this;let o=[];s||(s=0),r||(r="");for(let a=0;a<i.length;a++){const l=i[a],d={label:l.label,id:l.getAttribute("data-id"),orientation:l.orientation,size:l.size,min:l.min,type:l.type,modifiers:l.modifiers,position:l.position};if(l.removeAttribute("index"),l instanceof t){if(o.push(d),d.index=""!==r?r+"."+s:s.toString(),l.setAttribute("index",d.index),l.items){const e=n._getDataSource(l.items,d.index,0);d.items=e}}else if(l instanceof e)if(l.items){const e=n._getDataSource(l.items,r,s);o=o.concat(e)}else d.index=""!==r?r+"."+s:s.toString(),l.setAttribute("index",d.index),o.push(d);s++}return o}_getLayout(){const e=this,i=arguments.length?arguments[0]:e.$.itemsContainer;e._buttons&&e._buttons.remove(),e._dropArea&&e._dropArea.remove();const r=e.querySelectorAll(".smart-layout-splitter");for(let t=0;t<r.length;t++){const i=r[t];i!==e.$.splitter&&i.remove()}i.items=Array.from(i.children),i.items=i.items.filter((e=>e!==i.tabs&&e.hasAttribute("data-id")));const s=i.items.map((function(i){if(i.classList.contains("smart-layout-tab-strip"))return null;const r=i,s=i instanceof t?i:null;return s&&(r.items=e._getLayout(s)),r}));if(i!==e.$.itemsContainer)return s.filter((e=>null!==e&&e!==i.tabs));const n=[],o=i;return o.items=s.filter((e=>null!==e&&e!==i.tabs)),n.push(o),n}_updateSplitter(){const e=this;e._buttons&&e._dragDetails&&e._buttons.remove(),e._removeSplitter();const t=e.querySelectorAll("[data-id]");for(let i=0;i<t.length;i++){const r=t[i];if("root"!==r.getAttribute("data-id")){if(r.hasAttribute("role")){const e=r.getAttribute("role");if("gridcell"===e||"row"===e||"columnheader"===e||"rowheader"===e)continue}r.setAttribute("hover",""),e._handleSplitter(r)}}}_hideSplitter(){const e=this.querySelectorAll("[data-id]");for(let t=0;t<e.length;t++){e[t].removeAttribute("hover")}}_removeSplitter(){const e=this,t=e.querySelectorAll(".smart-layout-splitter");for(let i=0;i<t.length;i++){const r=t[i];r!==e.$.splitter&&r.remove()}e._hideSplitter()}_handleItemClick(e){const t=this,i=t.selectedIndex;let r=null;return e?(r=e instanceof HTMLElement?e:t.querySelector("[data-id="+e.id+"]"),r&&r.readonly?(t._closeContextMenu(),void(t.selectedIndex=null)):(t.querySelectorAll("[data-id]").forEach((e=>e.removeAttribute("selected"))),t._closeContextMenu(),void(r?(t.selectedIndex=r.getAttribute("index"),r.setAttribute("selected",""),r.setAttribute("hover",""),t._selectedItem=r,r.classList.contains("smart-hidden")&&t.refresh(),t._handleButtonsVisibility(r),i!==t.selectedIndex&&t.$.fireEvent("change",{selectedIndex:t.selectedIndex,oldSelectedIndex:i}),t._updateSplitter()):t.refresh()))):(t._closeContextMenu(),t.selectedIndex=null,t.querySelectorAll("[data-id]").forEach((e=>e.removeAttribute("selected"))),void(t._selectedItem=null))}_handleButtonClick(e,t){const i=this,r=i._addLayoutItem(e,t);i.$.fireEvent("stateChange",{type:"insert",item:r}),i._handleItemClick(r,!0)}_handleMenuItemClick(e){const t=this;if(!e||e.hasAttribute("disabled"))return;const i=e.getAttribute("value"),r=t._contextMenu;t.$.fireEvent("menuItemClick",{target:r?r._target:null,item:e,label:e.textContent,value:i});const s=r._target;s&&("select"===i&&t._handleItemClick(s.parentElement?s.parentElement:s),"delete"===i&&t._removeLayoutItem(s))}_removeLayoutItem(t){const i=this;if("root"!==t.getAttribute("data-id")){if(t instanceof e&&1===t.parentElement.items.length){let e=t.parentElement,r=e;for(;e&&e.items&&1===e.items.length&&"root"!==e.getAttribute("data-id");)r=e,e=e.parentElement;"root"!==r.getAttribute("data-id")?r.remove():i.allowLiveSplit&&r.appendChild(document.createElement("smart-layout-item"))}else t.remove();i.refresh(),i.$.fireEvent("stateChange",{type:"delete",item:t})}}refresh(){const e=this;if(e._isUpdating)return;e.dataSource=e._getDataSource(e._getLayout()),e.$.splitter.className="smart-visibility-hidden smart-layout-splitter";const t=t=>{const s=e.getItem(t.getAttribute("index"));if(!s)return;t.style.gridTemplateColumns="",t.style.gridTemplateRows="";let n="",o=0,a=0;if(t instanceof i){t.tabs&&t.tabs.remove();const i=document.createElement("div");i.classList.add("smart-layout-tab-strip"),e._selectedItem&&t.contains(e._selectedItem)&&e._selectedItem instanceof r&&(t.selectedIndex=Math.max(0,t.items.indexOf(e._selectedItem))),t.selectedIndex>=t.children.length&&(t.selectedIndex=0);for(let r=0;r<t.children.length;r++){const n=t.children[r],o=e.getItem(n.getAttribute("index"));if(!o)continue;const a=document.createElement("div");a.classList.add("smart-layout-tab"),a.innerHTML="<label>"+o.label+'</label><span class="smart-close-button"></span>',i.appendChild(a),n.setAttribute("tab",""),n.classList.add("smart-hidden"),a.content=n,a.item=o,a.group=s,n.modifiers?-1===n.modifiers.indexOf("close")&&a.querySelector(".smart-close-button").classList.add("smart-hidden"):a.querySelector(".smart-close-button").classList.add("smart-hidden"),void 0!==t.selectedIndex&&r!==t.selectedIndex||(a.classList.add("selected"),n.classList.remove("smart-hidden"),t.selectedIndex=r),a.onpointerup=function(i){i.target.classList.contains("smart-close-button")&&a.close&&(t.selectedIndex=0,e._removeLayoutItem(e._selectedItem),e._handleItemClick(parent))},a.onpointerdown=function(t){const i=this.closest(".smart-layout-group");e._handleItemClick(this.content),a.close=!1,t.target.classList.contains("smart-close-button")?a.close=!0:o.modifiers&&o.modifiers.indexOf("drag")>=0&&e._beginDrag(i,this,t)}}t.tabs=i,"top"===s.position||"left"===s.position?t.insertBefore(i,t.firstChild):t.appendChild(i)}else{for(var l=0;l<t.children.length;l++){var d=t.children[l];if(d.hasAttribute("size")){var c=d.getAttribute("size"),u=parseFloat(c),p="vertical"===t.orientation?t.offsetWidth:t.offsetHeight,m=c.indexOf("%")>=0?parseFloat(c):parseFloat(u/p*100);if(o+=m,a++,a===t.children.length){if(o<100){n+="1fr ",o=100;continue}o>100&&(o-=m,m=100-o,o=100)}else if(o>100||0===m){a=t.children.length,o=0;break}n+=m+"% "}else n+="1fr "}if(a===t.children.length&&(o<99||o>100)){n="";for(let e=0;e<t.children.length;e++){t.children[e].removeAttribute("size"),n+="1fr "}}"vertical"===t.orientation?t.style.gridTemplateColumns=n:t.style.gridTemplateRows=n}t.items=Array.from(t.children),t.items=t.items.filter((e=>e!==t.tabs))},s=e.querySelectorAll(".smart-layout-group");for(let e=0;e<s.length;e++)t(s[e])}_beginDrag(e,t,i){const r=this;r._dragDetails&&r._dragDetails.feedback.remove();const s=document.createElement("div"),n=document.createElement("div"),o=e.querySelector(".smart-layout-tab-strip");let a="";if(o)for(let t=0;t<Array.from(o.children).length;t++)t===e.selectedIndex&&(a=o.children[t].innerText);s.innerHTML=`<smart-layout><smart-tab-layout-group><smart-tab-layout-item label="${a}"></smart-tab-layout-item></smart-tab-layout-group></smart-layout>`,r._feedback=s,r._feedback.classList.add("smart-layout-feedback","smart-layout"),n.classList.add("smart-layout-overlay"),r._dragDetails={element:t.content,item:t.item,layoutGroup:t.group,parent:e,overlay:n,feedback:s,pageX:i.pageX,pageY:i.pageY}}moveChildren(e,t){t.innerHTML="";let i=e;for(;i.firstChild;){const e=i.firstChild;t.appendChild(e)}}createLayoutItem(e,t){const i=this;return"layoutItem"!==e&&e?"tabLayoutItem"!==e&&e?"tabLayoutGroup"===e?(e=>{const t=document.createElement("smart-tab-layout-group"),r="top"===e||"bottom"===e?"horizontal":"vertical";return t.setAttribute("orientation",r),t.orientation=r,i.$.fireEvent("createGroup",{item:t,type:"tabLayoutGroup"}),t})(t):(e=>{const t=document.createElement("smart-layout-group"),r="top"===e||"bottom"===e?"horizontal":"vertical";return i.$.fireEvent("createGroup",{item:t,type:"layoutGroup"}),t.setAttribute("orientation",r),t.orientation=r,t})(t):(()=>{const e=document.createElement("smart-tab-layout-item");return e.innerHTML="",i.$.fireEvent("createItem",{item:e,type:"tabLayoutItem"}),e})():(()=>{const e=document.createElement("smart-layout-item");return e.innerHTML="",i.$.fireEvent("createItem",{item:e,type:"layoutItem"}),e})()}_addTabLayoutItem(s,n,o){const a=this,l=a.createLayoutItem("tabLayoutItem"),d=s.closest("smart-tab-layout-group");let c;o&&(l.label=o.label,l.modifiers=o.modifiers,a.moveChildren(o,l));const u=e=>{for(let t=0;t<e.children.length;t++){e.children[t].removeAttribute("size")}e.removeAttribute("size")},p=e=>{if(s.removeAttribute("size"),s.querySelector("smart-layout-group"))a._addLayoutItem(s.querySelector("smart-layout-group"),e);else{c=a.createLayoutItem("layoutGroup",e);const t=a.createLayoutItem();a.moveChildren(s,t),"top"===e||"left"===e?(c.appendChild(a.createLayoutItem()),c.appendChild(t)):(c.appendChild(t),c.appendChild(a.createLayoutItem())),s.appendChild(c)}},m=(e,t)=>{const i=s.parentElement,r=s,n=a.createLayoutItem("layoutGroup",t);i.insertBefore(n,r),"top"===t||"left"===t?(n.append(e),n.appendChild(r)):(n.appendChild(r),n.append(e)),"root"===r.getAttribute("data-id")&&(r.setAttribute("data-id",n.getAttribute("data-id")),n.setAttribute("data-id","root"),a.$.itemsContainer=n),u(r),u(i)};if(o)switch(n){case"center":if(s instanceof i||s instanceof r)d.appendChild(l);else{const i=a.createLayoutItem("tabLayoutGroup","top");i.appendChild(l),s instanceof t&&!(s instanceof r)?(s.appendChild(i),u(s)):s instanceof e&&(c=a.createLayoutItem("layoutGroup"),s.parentElement.insertBefore(c,s),c.appendChild(s),c.appendChild(i),u(c))}break;case"left":case"right":{const e=a.createLayoutItem("tabLayoutGroup","top");e.appendChild(l),"root"===s.getAttribute("data-id")?(e.position=n,m(e,n)):m(e,n)}break;case"top":case"bottom":{const e=a.createLayoutItem("tabLayoutGroup","top");e.appendChild(l),"root"===s.getAttribute("data-id")?(e.position=n,m(e,n)):m(e,n);break}}else{switch(n){case"center":s instanceof i||s instanceof r?d.appendChild(l):p();break;case"left":case"right":if(s instanceof i){const e=s.querySelector("smart-tab-layout-item");e&&"left"===n?s.insertBefore(l,e):s.appendChild(l)}else if(s instanceof r){const e=a.createLayoutItem("tabLayoutGroup","top"),t=s.parentElement;e.appendChild(l),c=a.createLayoutItem("layoutGroup"),t.parentElement.insertBefore(c,t),"right"===n?(c.appendChild(t),c.appendChild(e)):"left"===n&&(c.appendChild(e),c.appendChild(t))}else if(o){const i=a.createLayoutItem("tabLayoutGroup","top");i.appendChild(l),s instanceof t?s.insertBefore(s.firstChild,i):s instanceof e&&(c=a.createLayoutItem("layoutGroup"),c.orientation=d.orientation,c.setAttribute("orientation",d.orientation),s.removeAttribute("size"),s.parentElement.insertBefore(c,s),c.appendChild(s),c.appendChild(i))}else p(n);break;case"top":case"bottom":s instanceof i?(c=a.createLayoutItem("layoutGroup","top"),s.removeAttribute("size"),s.parentElement.insertBefore(c,s),"top"===n?(c.appendChild(a.createLayoutItem()),c.appendChild(s)):(c.appendChild(s),c.appendChild(a.createLayoutItem()))):p(n)}a.refresh()}}_addLayoutItem(s,n,o){const a=this;if(!s)return;const l=e=>{for(let t=0;t<e.children.length;t++){e.children[t].removeAttribute("size")}e.removeAttribute("size")};if(s instanceof r||s instanceof i||o&&o instanceof r)return a._addTabLayoutItem(s,n,o);const d=a.createLayoutItem(),c=s.closest(".smart-layout-group");let u;if(o&&a.moveChildren(o,d),"center"===n){if(s instanceof t)return u=c,u.appendChild(d),l(u),a.refresh(),d;if(s instanceof e)return u=a.createLayoutItem("layoutGroup"),u.orientation=c.orientation,u.setAttribute("orientation",c.orientation),s.removeAttribute("size"),s.parentElement.insertBefore(u,s),u.appendChild(s),u.appendChild(d),a.refresh(),u}if("vertical"===c.orientation&&("left"===n||"right"===n)||"horizontal"===c.orientation&&("top"===n||"bottom"===n))if(u=c,s instanceof t)"left"===n||"top"===n?u.insertBefore(d,u.children[0]):u.appendChild(d),l(s);else{const e=u.items,t=Math.max(0,e.indexOf(s)+("top"===n||"left"===n?0:1));u.insertBefore(d,e[t]),l(u)}else if(s instanceof t){const e=s.parentElement,t=s,i=a.createLayoutItem("layoutGroup",n);e.insertBefore(i,t),"top"===n||"left"===n?(i.append(d),i.appendChild(t)):(i.appendChild(t),i.append(d)),"root"===t.getAttribute("data-id")&&(t.setAttribute("data-id",i.getAttribute("data-id")),i.setAttribute("data-id","root"),a.$.itemsContainer=i),l(e)}else u=a.createLayoutItem("layoutGroup",n),c.insertBefore(u,s),"top"===n||"left"===n?(u.appendChild(d),u.appendChild(s)):(u.appendChild(s),u.appendChild(d)),l(u);return a.refresh(),d}_handleButtonsVisibility(e){const t=this;if(t._buttons||(t._buttons=document.createElement("div"),t._buttons.classList.add("smart-layout-buttons-container"),t._buttons.innerHTML='<div role="button" position="top"></div>\n <div role="button" position="bottom"></div>\n <div role="button" position="center"></div>\n <div role="button" position="left"></div>\n <div role="button" position="right"></div>'),e||!t._buttons.parentElement){if(e){const i=e._buttonPosition||[],r=t._buttons.children;for(let t=0;t<r.length;t++){const s=r[t];s.position=s.getAttribute("position"),s.item=e,i.length&&i.indexOf(s.getAttribute("position"))<0?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),s.onmouseenter=()=>{s.setAttribute("hover","")},s.onmouseleave=()=>{s.removeAttribute("hover")}}t.allowLiveSplit&&t._buttons.parentElement!==e&&e.appendChild(t._buttons)}}else t._buttons.parentElement.removeChild(t._buttons)}_handleDropArea(e,t="center"){const i=this,r=e=>{switch(e){case"left":i._dropArea.style.top="0px",i._dropArea.style.left="0px",i._dropArea.style.width="50%",i._dropArea.style.height="100%";break;case"right":i._dropArea.style.top="0px",i._dropArea.style.left="calc(100% - 50%)",i._dropArea.style.width="50%",i._dropArea.style.height="100%";break;case"top":i._dropArea.style.top="0px",i._dropArea.style.left="0px",i._dropArea.style.width="100%",i._dropArea.style.height="50%";break;case"bottom":i._dropArea.style.top="calc(100% - 50%)",i._dropArea.style.left="0px",i._dropArea.style.width="100%",i._dropArea.style.height="50%";break;case"center":i._dropArea.style.top="0px",i._dropArea.style.left="0px",i._dropArea.style.width="100%",i._dropArea.style.height="100%"}};i._dropArea&&i._dropArea.parentElement===e?r(t):(i._dropArea&&i._dropArea.remove(),i._dragDetails&&e&&(i._dropArea=document.createElement("div"),i._dropArea.classList.add("smart-layout-drop-area"),e.appendChild(i._dropArea),i._dropArea.style.opacity=1,r(t)))}_handleSplitter(e){const t=this;if(!e)return;if(e.hasAttribute("tab")&&(e=e.parentElement),e._splitter&&e._splitter.remove(),e._splitter||(e._splitter=document.createElement("div")),t._dragDetails&&t._dragDetails.dragging)return void e._splitter.remove();if(-1===e.modifiers.indexOf("resize"))return;e.appendChild(e._splitter);const i=e.parentElement;if(i){e._splitter.className="smart-layout-splitter",e._splitter.item=e,e._splitter.removeAttribute("drag");const r=i.orientation;e.nextElementSibling&&e.nextElementSibling.hasAttribute("data-id")?e._splitter.classList.add(r):e.previousElementSibling&&e.previousElementSibling.hasAttribute("data-id")&&(e._splitter.classList.add(r),e._splitter.classList.add("last"));(e=>{e.style.top="",e.style.left="",e.style.bottom="",e.style.right="",e.onpointerdown=e=>{const i=e.target.item;i.style.overflow="hidden",t._resizeDetails={splitter:e.target,splitterRect:e.target.getBoundingClientRect(),itemRect:i.getBoundingClientRect(),item:i,itemSize:i.size,group:i.parentElement,clientX:e.clientX,clientY:e.clientY},t._selectedItem!==i&&(t.querySelectorAll("[data-id]").forEach((e=>e.removeAttribute("selected"))),t.selectedIndex=i.getAttribute("index"),i.setAttribute("selected",""),t._selectedItem=i,t._handleButtonsVisibility(i)),i.previousElementSibling&&i.previousElementSibling.hasAttribute("data-id")?(t._resizeDetails.previousItemRect=i.previousElementSibling.getBoundingClientRect(),t._resizeDetails.previousItem=i.previousElementSibling,t._resizeDetails.previousItemSize=i.previousElementSibling.size,t._resizeDetails.previousItem.style.overflow="hidden"):(t._resizeDetails.previousItemRect=null,t._resizeDetails.previousItem=null),i.nextElementSibling&&i.nextElementSibling.hasAttribute("data-id")?(t._resizeDetails.nextItemRect=i.nextElementSibling.getBoundingClientRect(),t._resizeDetails.nextItem=i.nextElementSibling,t._resizeDetails.nextItemSize=i.nextElementSibling.size,t._resizeDetails.nextItem.style.overflow="hidden"):(t._resizeDetails.nextItemRect=null,t._resizeDetails.nextItem=null)}})(e._splitter)}}})})();
|
|
68
68
|
Smart("smart-list-menu",class extends Smart.Menu{static get properties(){return{displayLoadingIndicator:{value:!1,type:"boolean"},dropDownPosition:{value:"auto",allowedValues:["top-left","top-right","bottom-left","bottom-right","auto"],type:"string"},enableMouseWheelAction:{value:!0,type:"boolean"},filterable:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterMember:{value:"label",type:"string"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},grouped:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},scrollMode:{value:"scrollButtons",allowedValues:["scrollbar","scrollButtons"],type:"string"}}}static get listeners(){return{resize:"_resizeHandler","backButton.click":"_backButtonClickHandler","filterInput.keyup":"_filterInputKeyupHandler","mainContainer.down":"_mainContainerDownHandler","mainContainer.move":"_mainContainerMoveHandler","mainContainer.swipeleft":"_mainContainerSwipeHandler","mainContainer.swiperight":"_mainContainerSwipeHandler","mainContainer.touchmove":"_mainContainerTouchmoveHandler","mainContainer.touchstart":"_mainContainerTouchstartHandler","view.click":"_viewHandler","view.mouseout":"_viewHandler","view.mouseover":"_viewHandler","view.transitionend":"_viewHandler"}}static get styleUrls(){return["smart.listmenu.css"]}template(){return`<div id="container" role="presentation">\n <div id="hamburgerIcon" class="smart-hamburger-icon smart-hidden" role="button" aria-label="Toggle minimized menu" aria-haspopup="true">\n <div id="hamburgerIconLineTop" class="smart-hamburger-icon-line smart-hamburger-icon-line-top" role="presentation"></div>\n <div id="hamburgerIconLineCenter" class="smart-hamburger-icon-line smart-hamburger-icon-line-center" role="presentation"></div>\n <div id="hamburgerIconLineBottom" class="smart-hamburger-icon-line smart-hamburger-icon-line-bottom" role="presentation"></div>\n <div id="customIconContainer" class="smart-hamburger-icon-custom-container smart-hidden" role="presentation"></div>\n </div>\n <div id="view" class="smart-list-menu-view" role="presentation">\n <div id="header" class="smart-header smart-hidden" role="heading" aria-level="1">\n <smart-button id="backButton" animation="[[animation]]" disabled="[[disabled]]" unfocusable right-to-left="[[rightToLeft]]" aria-label="Back">\n <div id="backButtonArrow" class="smart-arrow ${this.rightToLeft?"smart-arrow-right":"smart-arrow-left"}" aria-hidden="true"></div>\n </smart-button>\n <div id="title" class="smart-title"></div>\n </div>\n <div class="smart-list-menu-filter-input-container smart-hidden" id="filterInputContainer" role="presentation"><input id="filterInput" class="smart-filter-input" disabled="[[disabled]]" placeholder="[[filterInputPlaceholder]]" type="text" role="searchbox" aria-label="[[filterInputPlaceholder]]" /></div>\n <smart-repeat-button id="scrollButtonNear" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-near smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll up">\n <div id="arrowNear" class="smart-arrow smart-arrow-up" right-to-left="[[rightToLeft]]"></div>\n </smart-repeat-button>\n <smart-scroll-viewer id="mainContainer" class="smart-menu-main-container" horizontal-scroll-bar-visibility="hidden" right-to-left="[[rightToLeft]]" role="presentation">\n <content></content>\n </smart-scroll-viewer>\n <smart-repeat-button id="scrollButtonFar" class="smart-menu-scroll-button smart-spin-button smart-scroll-button-far smart-hidden" animation="[[animation]]" unfocusable right-to-left="[[rightToLeft]]" aria-label="Scroll down">\n <div id="arrowFar" class="smart-arrow smart-arrow-down"></div>\n </smart-repeat-button>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" role="presentation">\n <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n </div>\n </div>\n </div>`}attached(){const e=this;super.attached(),e.isCompleted&&null!==e.dropDownAppendTo&&e._minimized&&e._dropDownParent.appendChild(e.$.view)}detached(){const e=this;super.detached(),e._close(),null!==e.dropDownAppendTo&&e._minimized&&e._dropDownParent.removeChild(e.$.view)}addItem(e,t){const i=this;if(!(e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup))return;let r,n,o,a;if(void 0===t)r=void 0,n=1,o=t=i.$.mainContainer,a=i._topLevelFilter;else{if("string"==typeof t&&(t=i.getItem(t)),void 0===t||!(t instanceof Smart.MenuItemsGroup)||!i.contains(t)&&t.closest(".smart-list-menu-view")!==i.$.view)return;r=t,n=t.level+1,o=t.itemContainer,a=t.filter}if(i._createItemHTMLStructure(e,n,t,i._getCurrentViewItems(r).length,0),e instanceof Smart.MenuItemsGroup&&i._processHTML(e,n+1),i._view!==t&&!t.$.hasClass("smart-hidden")&&t.offsetHeight>0&&t.offsetWidth>0&&(!i._view&&!i.$.mainContainer.contains(t)||i._view&&!i._view.contains(t))&&e.$.addClass("smart-hidden"),i.grouped){let e;e=o instanceof Smart.ScrollViewer&&o.isRendered?Array.from(o.$.scrollViewerContentContainer.children):Array.from(o.children);for(let t=e.length-1;t>=0;t--)e[t].$.hasClass("smart-list-menu-group-label")&&o.removeChild(e[t]);i._unsortItems(t,!0)}if(o.appendChild(e),i.grouped){const e=i._view;i._applyGrouping(t,!0),i._home(),e&&i.changePage(e.path)}i.filterable&&void 0!==a&&""!==a&&null===i._findItem(e,a)&&(e.$.addClass("smart-hidden"),e.hidden=!0),i._toggleFilterInputGroupLabelVisibility(),i._checkOverflow()}back(e){const t=this,i=t.animation,r=!1===e&&"none"!==i;r&&(t.animation="none"),t._backButtonClickHandler(),r&&(t.animation=i)}changePage(e){const t=this,i=t.getItem(e);if(void 0===i||i instanceof Smart.MenuItem||i.hidden)return;const r=[i];let n=i.parentItem,o=0;for(t._discardKeyboardHover();n;)r.unshift(n),n=n.parentItem;if(t._view){const e=r.indexOf(t._view);-1===e?t._home():o=e+1}for(let e=o;e<r.length&&!r[e].disabled&&!r[e].hidden;e++)t._menuItemsGroupSelectionHandler(r[e],{type:"expand"},!0)}maximize(){const e=this;if(e._minimized){if(e._positionDetection.removeOverlay(),e._minimized=!1,e._minimizedDropDownOpened&&(e.$hamburgerIcon.removeClass("smart-close-button"),e._minimizedDropDownOpened=!1),null!==e.dropDownAppendTo&&e._appendMinimizedContainerToMenu(e.$.view,null),e.$view.removeClass("smart-visibility-hidden"),e.$view.removeClass("smart-list-menu-view-minimized"),e.$hamburgerIcon.addClass("smart-hidden"),e.removeAttribute("minimized"),e.enableShadowDOM){e.$.view.id=e.$.view.getAttribute("smart-id");const t=e.$.view.querySelectorAll("[smart-id]");for(let e=0;e<t.length;e++)t[e].id=t[e].getAttribute("smart-id")}e.$.mainContainer.scrollTop=0,e._checkOverflow(),e.$.hamburgerIcon.removeAttribute("aria-expanded"),e.$.hamburgerIcon.removeAttribute("aria-owns"),e.$.view.setAttribute("role","presentation"),e.$.view.removeAttribute("aria-orientation"),e.setAttribute("role","menu")}}minimize(){const e=this;if(!e._minimized){if(e.$view.addClass("smart-visibility-hidden"),e.enableShadowDOM){e.$.view.removeAttribute("id");const t=e.$.view.querySelectorAll("[smart-id]");for(let e=0;e<t.length;e++)t[e].removeAttribute("id")}e._edgeMacFF&&e.$view.addClass("not-in-view"),e.$hamburgerIcon.removeClass("smart-hidden"),setTimeout((function(){null!==e.dropDownAppendTo&&e._appendMinimizedContainerToExternalElement(e.$.view),e.$view.addClass("smart-list-menu-view-minimized"),e.$.mainContainer.scrollTop=0,e._checkOverflow()}),0),e._minimized=!0,e.setAttribute("minimized",""),e.setAttribute("role","presentation"),e.removeAttribute("aria-orientation"),e.$.hamburgerIcon.setAttribute("aria-expanded",!1),e.$.hamburgerIcon.setAttribute("aria-owns",e.$.view.id),e.$.view.setAttribute("role","menu"),e.$.view.setAttribute("aria-orientation","vertical")}}removeItem(e){const t=this;if("string"==typeof e&&(e=t.getItem(e)),void 0===e||!(e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup)||!t.contains(e)&&e.closest(".smart-list-menu-view")!==t.$.view)return;const i=e.parentElement;for(;e.contains(t._view);)t._backButtonClickHandler(void 0,!0);const r=t._view;t.grouped&&(t._home(),t._discardGrouping()),i.removeChild(e),t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,(function(e){return t._getCurrentViewItems(e===t.$.mainContainer?void 0:e)})),t.grouped&&(t._applyGrouping(t.$.mainContainer),r&&t.changePage(r.path)),t._toggleFilterInputGroupLabelVisibility(),t._checkOverflow()}propertyChangedHandler(e,t,i){if("disabled"===e||"dropDownOverlay"===e||"minimizeIconTemplate"===e||"minimizeWidth"===e||"unfocusable"===e)return void super.propertyChangedHandler(e,t,i);const r=this;switch(e){case"animation":r.$.view.setAttribute("animation",i);break;case"checkable":case"checkboxes":r._minimized&&null!==r.dropDownAppendTo&&(i?r.$.view.setAttribute(e,""):r.$.view.removeAttribute(e));break;case"checkMode":{const e=r.$.mainContainer;r._changeToRadioButtonMode(i,e.isRendered?e.$.scrollViewerContentContainer:e),r._minimized&&null!==r.dropDownAppendTo&&r.$.view.setAttribute("check-mode",i);break}case"dataSource":{r.$header.addClass("smart-hidden"),r.$mainContainer.removeClass("header-shown"),r._view=void 0;const e=r.querySelectorAll("smart-menu-items-group");e.length>0&&e.forEach((e=>{e.remove()})),r._menuItems={},r._topLevelFilter="",r._processDataSource(),r._toggleFilterInputGroupLabelVisibility(),r._checkOverflow();break}case"displayLoadingIndicator":if(i){const e=r.$.mainContainer.querySelector("[hover]");e&&e.removeAttribute("hover"),r._discardKeyboardHover(),r.$loadingIndicatorContainer.removeClass("smart-hidden")}else r.$loadingIndicatorContainer.addClass("smart-hidden");break;case"dropDownAppendTo":{const e=r._dropDownParent;if(r._positionDetection.getDropDownParent(),r._dropDownParent===e||!r._minimized)return;r._close(),null===i?r._appendMinimizedContainerToMenu(r.$.view,null):r._appendMinimizedContainerToExternalElement(r.$.view),r.$.mainContainer.scrollTop=0,r._checkOverflow();break}case"dropDownPosition":r._close(),r._minimized&&null!==r.dropDownAppendTo&&r.$.view.setAttribute("drop-down-position",i);break;case"filterable":if(r._toggleFilterInputGroupLabelVisibility(!0),!1===i){""!==r._topLevelFilter&&r._applyFilter("");for(let e=r._filteredLowerLevelGroups.length-1;e>=0;e--)r._applyFilter("",r._filteredLowerLevelGroups[e])}r._checkOverflow();break;case"filterMode":if(!r.filterable)return;""!==r._topLevelFilter&&r._applyFilter(r._topLevelFilter);for(let e=r._filteredLowerLevelGroups.length-1;e>=0;e--)r._applyFilter(r._filteredLowerLevelGroups[e].filter,r._filteredLowerLevelGroups[e]);break;case"grouped":r._home(),i?r._applyGrouping(r.$.mainContainer):r._discardGrouping(),r._toggleFilterInputGroupLabelVisibility(!1,!0),r._checkOverflow();break;case"loadingIndicatorPosition":null!==r.dropDownAppendTo&&r._minimized&&r.$.view.setAttribute("loading-indicator-position",i),"center"===i?r.$loadingIndicatorPlaceHolder.addClass("smart-hidden"):r.$loadingIndicatorPlaceHolder.removeClass("smart-hidden");break;case"overflow":r.$.mainContainer.verticalScrollBarVisibility="scroll"===i?"visible":i,r._handleOverflowChange();break;case"rightToLeft":i?(r.$backButtonArrow.removeClass("smart-arrow-left"),r.$backButtonArrow.addClass("smart-arrow-right")):(r.$backButtonArrow.removeClass("smart-arrow-right"),r.$backButtonArrow.addClass("smart-arrow-left")),i?r.$.view.setAttribute("right-to-left",""):r.$.view.removeAttribute("right-to-left"),Array.prototype.forEach.call(r.$.mainContainer.querySelectorAll(".smart-menu-items-group-arrow"),(e=>e.className="smart-menu-items-group-arrow "+(r.rightToLeft?"smart-arrow-left left":"smart-arrow-right right")));break;case"scrollMode":r.$.mainContainer.verticalScrollBarVisibility="scrollButtons"===i?"hidden":"scroll"===r.overflow?"visible":r.overflow,r._checkOverflow();break;case"theme":super.propertyChangedHandler(e,t,i),null!==r.dropDownAppendTo&&r._minimized&&(""!==t&&r.$view.removeClass(t),i&&r.$view.addClass(i))}}_appendGroupLabels(e,t){for(let i=0;i<e.length;i++){const r=document.createElement("div");r.$=Smart.Utilities.Extend(r),r.className="smart-list-menu-group-label",r.setAttribute("role","heading"),r.setAttribute("aria-level",1),r.innerHTML=e[i],r.groupChildren=t[i],t[i][0].parentElement.insertBefore(r,t[i][0]);for(let e=0;e<t[i].length;e++)t[i][e].groupLabel=r}}_applyFilter(e,t){const i=this,r=i._getCurrentViewItems(t);for(let n=0;n<r.length;n++){const o=i._findItem(r[n],e);o&&o.hidden?(o.hidden=!1,(t===i._view||void 0!==i._view&&void 0!==t&&!t.contains(i._view)||void 0===i._view)&&o.$.removeClass("smart-hidden")):o||(r[n].hidden=!0,r[n].$.addClass("smart-hidden"))}if(t){t.filter=e;const r=i._filteredLowerLevelGroups.indexOf(t);""===e?-1!==r&&i._filteredLowerLevelGroups.splice(r,1):-1===r&&i._filteredLowerLevelGroups.push(t)}else i._topLevelFilter=e}_backButtonClickHandler(e,t){const i=this,r=i._view;if(e&&e.stopPropagation(),!r||i.disabled&&e||i.displayLoadingIndicator||i._inTransition)return;let n=i.hasAnimation,o=i.animation,a=!1;n&&t&&(n=!1,a=!0,i.animation="none"),i._discardKeyboardHover(),i.$scrollButtonNear.addClass("smart-hidden"),i.$scrollButtonFar.addClass("smart-hidden"),i.$mainContainer.removeClass("scroll-buttons-shown"),r.firstElementChild.classList.remove("smart-hidden"),n?(i._inTransition=!0,r.container.$.addClass("no-transition"),r.container.$.addClass("smart-hidden"),r.$.addClass("right"),r.$.removeClass("right"),r.container.$.removeClass("no-transition")):(r.$.removeClass("smart-menu-items-group-opened"),r.container.$.addClass("smart-hidden")),i._showHideMenuItemsGroupSiblings(r,"removeClass",n),n?setTimeout((function(){r.container.style.top=r.parentElement.getBoundingClientRect().top-r.getBoundingClientRect().top+"px"}),0):a&&(i.animation=o),1===r.level?(i.$header.addClass("smart-hidden"),i.$mainContainer.removeClass("header-shown"),i._view=void 0):(i.$.title.innerHTML=r.parentItem.titleLabel,i._view=r.parentItem),i._toggleFilterInputGroupLabelVisibility(),i.$.mainContainer.scrollTop=0,n||i._checkOverflow(),e&&i.focus()}_bounceBottom(e){const t=this,i=t.$.mainContainer;function r(){i.scrollTop-=5,i.scrollTop>e?window.requestAnimationFrame(r):t.$mainContainer.removeClass("bounce-bottom")}t.$mainContainer.addClass("bounce-bottom"),window.requestAnimationFrame((function e(){i.scrollTop+=5,i.scrollTop!==i.scrollHeight-i.offsetHeight?window.requestAnimationFrame(e):window.requestAnimationFrame(r)}))}_bounceTop(){const e=this,t=e.$.mainContainer;function i(){t.scrollTop+=5,50!==t.scrollTop?window.requestAnimationFrame(i):(t.scrollTop=0,e.$mainContainer.removeClass("bounce-top"))}e.$mainContainer.addClass("bounce-top"),window.requestAnimationFrame((function e(){t.scrollTop-=5,t.scrollTop>0?window.requestAnimationFrame(e):window.requestAnimationFrame(i)}))}_checkOverflow(){const e=this,t=e.overflow,i=e.$.mainContainer,r=i instanceof Smart.ScrollViewer?i.$.content:i;if(r){if("hidden"!==t&&"scrollButtons"===e.scrollMode){const n=Math.round(r.scrollHeight)>Math.round(i.offsetHeight),o=Math.round(i.scrollTop)>0,a=Math.round(i.offsetHeight+i.scrollTop)<Math.round(r.scrollHeight);e.$.mainContainer.verticalScrollBarVisibility="hidden",n?"auto"===t?(e.$mainContainer.hasClass("scroll-buttons-shown")||e.$mainContainer.addClass("scroll-buttons-shown"),o?e.$scrollButtonNear.removeClass("smart-hidden"):e.$scrollButtonNear.addClass("smart-hidden"),a?e.$scrollButtonFar.removeClass("smart-hidden"):e.$scrollButtonFar.addClass("smart-hidden"),!1===(o&&a)?e.$mainContainer.addClass("one-button-shown"):e.$mainContainer.removeClass("one-button-shown"),e.disabled||(e.$.scrollButtonNear.disabled=!1,e.$.scrollButtonFar.disabled=!1)):(e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.disabled?(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0):(e.$.scrollButtonNear.disabled=!o,e.$.scrollButtonFar.disabled=!a)):!n&&"auto"===t&&e.$mainContainer.hasClass("scroll-buttons-shown")?(e.$mainContainer.removeClass("scroll-buttons-shown"),e.$mainContainer.removeClass("one-button-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden")):n||"scroll"!==t||(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0)}else"scrollbar"===e.scrollMode&&(e.$mainContainer.removeClass("scroll-buttons-shown"),e.$mainContainer.removeClass("one-button-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"));i.refresh()}}_updateScrollButtonVisibility(e,t,i){const r=this,n=r.overflow,o=r.$.mainContainer,a=e===r.$.mainContainer,s=a?o.$.content:e;if(a&&"hidden"===n)return void o.refresh();let l,d,c,m=!0,u=!0;if(t?(l="scrollLeft",d="offsetWidth",c="scrollWidth"):(l="scrollTop",d="offsetHeight",c="scrollHeight"),0===Math.round(e[l])&&(m=!1),Math.round(e[d]+e[l])>=Math.round(s[c])&&(u=!1),a&&"auto"!==n)"scroll"!==n||r.disabled||(i[0].disabled=!m,i[1].disabled=!u);else{if(m&&u)return i[0].$.removeClass("smart-hidden"),i[1].$.removeClass("smart-hidden"),e.classList.remove("one-button-shown"),void o.refresh();m?i[0].$.removeClass("smart-hidden"):i[0].$.addClass("smart-hidden"),u?i[1].$.removeClass("smart-hidden"):i[1].$.addClass("smart-hidden"),e.classList.add("one-button-shown")}o.refresh()}_close(){const e=this;e._discardKeyboardHover(!0),e._minimized&&e._minimizedDropDownOpened&&(e._positionDetection.removeOverlay(),e.$view.addClass("smart-visibility-hidden"),e._edgeMacFF&&(e.$.view.style.left="",e.$.view.style.top="",e.$view.addClass("not-in-view")),e.$hamburgerIcon.removeClass("smart-close-button"),e._minimizedDropDownOpened=!1,e.$.hamburgerIcon.setAttribute("aria-expanded",!1))}_createElement(){const e=this,t=e.$.mainContainer;e.$.title.id||(e.$.title.id=e.id+"Title"),e.$.view.id||(e.$.view.id=e.id+"View"),e.setAttribute("role","menu"),e.setAttribute("aria-labelledby",e.$.title.id),e.setAttribute("aria-orientation","vertical"),e.$.header.setAttribute("aria-labelledby",e.$.title.id),e.mode="vertical",t.verticalScrollBarVisibility="scroll"===e.overflow?"visible":e.overflow,t.refresh=e._scrollViewerRefresh,t._mouseWheelHandler=e._mouseWheelHandler.bind(e),t.onVerticalChange=()=>{"scrollButtons"===e.scrollMode&&e._updateScrollButtonVisibility(t,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar]),t.scrollTop===t.scrollHeight&&e.$.fireEvent("scrollBottomReached")},e._positionDetection=new Smart.Utilities.PositionDetection(e),e._positionDetection.getDropDownParent(),null===e.dataSource&&e.$.mainContainer.firstElementChild instanceof HTMLUListElement&&e._processUList();const i=e.getElementsByTagName("smart-menu-item"),r=function(){e._setFocusable(),e._menuItems={},e._topLevelFilter="",e._filteredLowerLevelGroups=[],e.$.view.setAttribute("animation",e.animation),null===e.dataSource?e._processHTML(void 0,1):e._processDataSource(),e._toggleFilterInputGroupLabelVisibility(),"scroll"===e.overflow&&(e.$mainContainer.addClass("scroll-buttons-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility(e.$.mainContainer,!1,[e.$.scrollButtonNear,e.$.scrollButtonFar])),e._applyMinimizeIconTemplate(e.minimizeIconTemplate,null),null!==e.minimizeWidth&&e.offsetWidth<=e.minimizeWidth?e.minimize():e._checkOverflow(),e.displayLoadingIndicator&&e.$loadingIndicatorContainer.removeClass("smart-hidden"),"center"!==e.loadingIndicatorPosition&&e.$loadingIndicatorPlaceHolder.removeClass("smart-hidden"),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted())};0===i.length?r():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(i,r))}_createMenuItemsGroupContainer(e,t){const i=document.createElement("div"),r=document.createElement("div");return i.className="smart-menu-drop-down smart-hidden",i.$=Smart.Utilities.Extend(i),i.level=t,i.setAttribute("level",t),i.setAttribute("role","menu"),i.menuItemsGroup=e,r.className="smart-menu-item-container",r.$=Smart.Utilities.Extend(r),r.container=i,r.menuItemsGroup=e,e.checkable&&r.setAttribute("checkable",""),r.setAttribute("check-mode",e.checkMode),i.itemContainer=r,i.appendChild(r),i}_discardGrouping(){const e=this,t=Array.from(e.$.view.getElementsByClassName("smart-list-menu-group-label"));for(let e=0;e<t.length;e++){let i=t[e];i.parentElement.removeChild(i)}e._unsortItems(e.$.mainContainer)}_discardKeyboardHover(){const e=this;e._focusedViaKeyboard&&(e._focusedViaKeyboard===e.$.backButton?(e.$.backButton.removeAttribute("hover"),e.$.backButton.$.button.removeAttribute("hover")):(e._focusedViaKeyboard.removeAttribute("focus"),e._focusedViaKeyboard.removeAttribute("hover")),e._focusedViaKeyboard=void 0)}_documentUpHandler(e){const t=this,i=e.originalEvent.target,r=e=>{"right"===e&&!t.rightToLeft||"left"===e&&t.rightToLeft?t._backButtonClickHandler():t._swipeDetails.target&&t._selectionHandler({target:t._swipeDetails.target},t._swipeDetails.target,!0)};if(delete t._dragStartDetails,t._swipeDetails){const i="pointercancel"===e.originalEvent.type;return"left"===t._swipeDetails.direction?(i||t._swipeDetails.start>e.pageX&&t._swipeDetails.start-e.pageX>t.offsetWidth/4)&&r(t._swipeDetails.direction):(i||t._swipeDetails.start<e.pageX&&e.pageX-t._swipeDetails.start>t.offsetWidth/4)&&r(t._swipeDetails.direction),void delete t._swipeDetails}i===t.$.filterInput||t.disabled||t.displayLoadingIndicator||!i.closest||(t.contains(i)||i.closest(".smart-list-menu-view")===t.$.view?!t.contains(i)&&i.closest(".smart-list-menu-view")!==t.$.view||t===document.activeElement||t.focus():t._close())}_ensureVisible(e){const t=this,i=t.$.mainContainer;if(!i.$.hasClass("scroll-buttons-shown")&&"hidden"!==t.overflow)return;const r=i.getBoundingClientRect(),n=e.getBoundingClientRect(),o=[t.$.scrollButtonNear,t.$.scrollButtonFar],a=i.scrollTop;(r.top>n.top||r.bottom<n.bottom)&&(i.scrollTop=e.offsetTop,t._updateScrollButtonVisibility(i,!1,o)),t._fireScrollBottomReachedEvent(a)}_fireScrollBottomReachedEvent(e){const t=this.$.mainContainer,i=t.scrollTop;e!==i&&i===t.scrollHeight-t.offsetHeight&&this.$.fireEvent("scrollBottomReached")}_getCurrentViewItems(e){const t=this;let i;if(void 0===e&&(i=t.$.mainContainer,i instanceof Smart.ScrollViewer&&(i=i.isRendered?i.$.scrollViewerContentContainer:i)),t.grouped){if(void 0===e)return Array.from(i.children).filter((e=>e instanceof Smart.MenuItem||e instanceof Smart.MenuItemsGroup));{const t=e.container.firstElementChild.children,i=[];for(let e=0;e<t.length;e++){let r=t[e];(r instanceof Smart.MenuItem||r instanceof Smart.MenuItemsGroup)&&i.push(r)}return i}}return void 0===e?i.children:e.container.firstElementChild.children}_sortItems(e){const t=this;if(!t.grouped)return;const i=[],r=t.$.mainContainer,n=[];let o;e instanceof Smart.MenuItemsGroup?o=e.container.firstElementChild:e===t.$.mainContainer&&(o=r instanceof Smart.ScrollViewer?r.$.content:r);const a=Array.from(o.children);a.sort((function(e,t){return e.label.localeCompare(t.label)}));for(let e=a.length-1;e>=0;e--)o.insertBefore(a[e],o.firstElementChild);for(let e=0;e<a.length;e++){const t=a[e],r=t.label.charAt(0),o=i.indexOf(r.toUpperCase());-1===o?(i.push(r.toUpperCase()),n.push([t])):n[o].push(t)}t._appendGroupLabels(i,n)}_home(){const e=this;for(;e._view;)e._backButtonClickHandler(void 0,!0)}_keydownHandler(e){const t=this,i=e.key;if(((t.shadowRoot||t.getRootNode()).activeElement||document.activeElement)!==t||-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","Escape","Home"," "].indexOf(i)||t.disabled||t.displayLoadingIndicator)return;e.preventDefault();const r=t._view,n=t.$.mainContainer;let o;o=r?r.itemContainer:n.isRendered?n.$.scrollViewerContentContainer:n;const a=t.$.backButton.hasAttribute("hover")?t.$.backButton:o.querySelector("[focus]");switch(i){case"ArrowDown":t._navigate("_getNextEnabledChild",a,o);break;case"ArrowLeft":case"ArrowRight":if("ArrowLeft"===i&&!t.rightToLeft||"ArrowRight"===i&&t.rightToLeft){t._backButtonClickHandler();break}("ArrowRight"===i&&!t.rightToLeft||"ArrowLeft"===i&&t.rightToLeft)&&a&&a instanceof Smart.MenuItemsGroup&&t._menuItemsGroupSelectionHandler(a,{type:"keydown"});break;case"ArrowUp":t._navigate("_getPreviousEnabledChild",a,o);break;case"End":case"Home":{if(r&&"Home"===i)return t.$.mainContainer.scrollTop=0,t._checkOverflow(),t.$.backButton.setAttribute("hover",""),t.$.backButton.$.button.setAttribute("hover",""),t._focusedViaKeyboard=t.$.backButton,void(a&&a.removeAttribute("focus"));const e="End"===i?t._getLastEnabledChild(o):t._getFirstEnabledChild(o);if(!e||a===e)return;a&&(a===t.$.backButton?(t.$.backButton.removeAttribute("hover"),t.$.backButton.$.button.removeAttribute("hover")):a.removeAttribute("focus")),t._hoverViaKeyboard(e);break}case"Enter":t._minimized&&!t._minimizedDropDownOpened?t._hamburgerIconClickHandler(void 0,t.$.view):a&&(a===t.$.backButton?t._backButtonClickHandler():t._selectionHandler({target:a}));break;case"Escape":t._minimized&&t._minimizedDropDownOpened&&!t._view?t._close():t._backButtonClickHandler();break;case" ":a&&(a===t.$.backButton?t._backButtonClickHandler():t._toggleItem(a))}}_mainContainerDownHandler(e){const t=this;!Smart.Utilities.Core.isMobile||t.disabled||t.displayLoadingIndicator||(t._dragStartDetails={startY:e.pageY,x:e.pageX,y:e.pageY,startTime:Date.now(),target:e.originalEvent.target})}_mainContainerHandler(){}_mainContainerMoveHandler(){}_mainContainerSwipeHandler(e){const t=this;if(!Smart.Utilities.Core.isMobile||t.disabled||t.displayLoadingIndicator||Math.abs(t._dragStartDetails.startY-e.pageY)>2)return;const i=e.originalEvent.target,r=i.closest("smart-menu-item"),n=i.closest("smart-menu-items-group");if("swiperight"===e.type&&!t.rightToLeft||"swipeleft"===e.type&&t.rightToLeft){const i=r||n;i&&(delete t._dragStartDetails,t._swipeDetails={direction:e.type.replace("swipe",""),start:e.pageX,target:i})}else("swipeleft"===e.type&&!t.rightToLeft||"swiperight"===e.type&&t.rightToLeft&&n&&null===r)&&(delete t._dragStartDetails,t._swipeDetails={direction:e.type.replace("swipe",""),start:e.pageX,target:n})}_mainContainerTouchmoveHandler(){}_mainContainerTouchstartHandler(){}_getRootDetails(e,t){const i=this;if(!e)return;if(!i.enableShadowDOM)return{activeElement:e.activeElement,isInsideElement:i.contains(t.target)};let r,n;for(;e&&(!r&&e.activeElement&&(r=e.activeElement),e.host===i&&(n=!0),e!==document);)e=e.host?e.host.getRootNode():e.getRootNode();return{activeElement:r,isInsideElement:n}}_menuItemsGroupSelectionHandler(e,t,i){const r=this,n=e.container,o=n.level,a=r._getRootDetails(t.target?t.target.getRootNode():null,t);if(r._view===e)return;if(r._discardKeyboardHover(),a&&a.activeElement!==r&&null!==r.dropDownAppendTo&&"click"===t.type&&!a.isInsideElement&&r.focus(),r._inTransition)return;if("click"===t.type&&!t.target.classList.contains("smart-menu-items-group-arrow")&&r._toggleItem(e))return void r._ripple(e,t);let s=r.hasAnimation,l=r.animation,d=!1;s&&i&&(s=!1,d=!0,r.animation="none"),2===o&&(r.$header.removeClass("smart-hidden"),r.$mainContainer.addClass("header-shown")),r.$.title.innerHTML=e.titleLabel,r._view=e,r._toggleFilterInputGroupLabelVisibility(),e.removeAttribute("hover"),e.removeAttribute("focus"),e.$.addClass("smart-menu-items-group-opened"),r._showHideMenuItemsGroupSiblings(e,"addClass",s),s?(r._inTransition=!0,e.firstElementChild.classList.add("animate"),setTimeout((function(){n.style.top=e.parentElement.getBoundingClientRect().top-e.getBoundingClientRect().top+"px"}),0)):e.firstElementChild.classList.add("smart-hidden"),n.$.removeClass("smart-hidden"),d&&(r.animation=l),r.$.mainContainer.scrollTop=0,s||r._checkOverflow(),r.$.fireEvent("expand",{item:e,label:e.label,path:e.path,value:e.value})}_mouseoutMouseoverHandler(e){const t=this;if(t.disabled||t.displayLoadingIndicator)return;const i=e.target.closest("smart-menu-item")||e.target.closest("smart-menu-items-group");null===i||t._view&&i.level<=t._view.level||i.disabled||i.templateApplied||(t._discardKeyboardHover(),"mouseover"===e.type?(i.setAttribute("hover",""),t._discardKeyboardHover(!0)):i.removeAttribute("hover"))}_navigate(e,t,i){const r=this;if(!t)return void("_getNextEnabledChild"===e?r._view?(r.$.backButton.setAttribute("hover",""),r.$.backButton.$.button.setAttribute("hover",""),r._focusedViaKeyboard=r.$.backButton):r._hoverViaKeyboard(r._getFirstEnabledChild(i)):r._hoverViaKeyboard(r._getLastEnabledChild(i)));let n;if("_getNextEnabledChild"===e&&t===r.$.backButton){if(n=r._getFirstEnabledChild(i),!n)return;r.$.backButton.removeAttribute("hover"),r.$.backButton.$.button.removeAttribute("hover")}else{if("_getPreviousEnabledChild"===e&&r._view&&t===r._getFirstEnabledChild(i))return r.$.backButton.setAttribute("hover",""),r.$.backButton.$.button.setAttribute("hover",""),r._focusedViaKeyboard=r.$.backButton,void t.removeAttribute("focus");n=r[e](t)}n&&(t.removeAttribute("focus"),r._hoverViaKeyboard(n))}_processHTML(e,t){const i=this,r=i.$.mainContainer;let n,o,a;void 0===e&&(e=i.$.mainContainer),t>1&&(n=i._createMenuItemsGroupContainer(e,t),o=n.itemContainer),a=e===r?Array.from((r instanceof Smart.ScrollViewer?r.$.content:r).children):Array.from(e.children);const s=[];let l=0;for(let r=0;r<a.length;r++){if(t>1&&0===r){l++;continue}const n=a[r];n instanceof Smart.MenuItem||n instanceof Smart.MenuItemsGroup?(i._createItemHTMLStructure(n,t,e,r-l),n.checked&&(n.disabled||n.templateApplied?n.checked=!1:s.push(n)),t>1&&o.appendChild(n),n instanceof Smart.MenuItemsGroup&&i._processHTML(n,t+1)):(n.parentElement.removeChild(n),l++)}if(t>1){if(e.container=n,e.itemContainer=o,e instanceof Smart.MenuItemsGroup){const t=document.createElement("div");t.className="smart-menu-items-group-arrow "+(i.rightToLeft?"smart-arrow-left left":"smart-arrow-right right"),e.children[0].appendChild(t)}e.appendChild(n)}i._validateRadioButtonSelection(e,t,s),i._sortItems(e)}_resizeHandler(){this.refresh()}refresh(){const e=this,t=e.minimizeWidth;if(null!==t){if(!e._minimized&&e.offsetWidth<=t)return void e.minimize();if(e._minimized&&e.offsetWidth>t)return void e.maximize()}e._checkOverflow()}_scroll(e){const t=this,i=t.$.mainContainer,r=e.classList.contains("smart-scroll-button-near")?-1:1,n=i.scrollTop;i.scrollTop=i.scrollTop+10*r,"scrollbar"!==t.scrollMode&&n!==i.scrollTop&&(t._updateScrollButtonVisibility(i,!1,[t.$.scrollButtonNear,t.$.scrollButtonFar]),t._fireScrollBottomReachedEvent(n))}_selectionHandler(e,t,i){const r=this,n=e.target;if(!r.disabled&&!r.displayLoadingIndicator){if(r._swipeDetails&&!i)return delete r._dragStartDetails,void delete r._swipeDetails;if(void 0===t){if("click"===e.type){const t=n.closest("smart-repeat-button");if(t)return void r._scroll(t,e)}const i=n.closest("smart-menu-item");if(i)return i.disabled||i.templateApplied||(r._toggleItem(i)||r.$.fireEvent("itemClick",{item:i,label:i.label,value:i.value}),r._ensureVisible(i),r._ripple(i,e)),void o();if((t=n.closest("smart-menu-items-group"))&&(n===t.container||n===t.container.firstElementChild))return}t&&!t.disabled&&r._menuItemsGroupSelectionHandler(t,e)}function o(){const t=r._getRootDetails(n.getRootNode(),e);t&&t.activeElement!==r&&null!==r.dropDownAppendTo&&"click"===e.type&&!t.isInsideElement&&r.focus()}}_showHideMenuItemsGroupSiblings(e,t,i){const r=e.parentElement.children;for(let n=0;n<r.length;n++){const o=r[n];o!==e&&(o.hidden||(i?"addClass"===t?o.$.addClass("animate"):(o.$.removeClass("smart-hidden"),o.$.addClass("right"),setTimeout((function(){o.$.removeClass("right")}),0)):o.$[t]("smart-hidden")))}}_toggleFilterInputGroupLabelVisibility(e,t){const i=this,r=i._getCurrentViewItems(i._view).length;if(!0!==t){const e=!i.$filterInputContainer.hasClass("smart-hidden");i.filterable&&r>1?(e||(i.$mainContainer.addClass("filter-input-shown"),i.$filterInputContainer.removeClass("smart-hidden")),i._view?i.$.filterInput.value=i._view.filter||"":i.$.filterInput.value=i._topLevelFilter):e&&(i.$mainContainer.removeClass("filter-input-shown"),i.$filterInputContainer.addClass("smart-hidden"))}if(!e&&i.grouped&&r>0){const e=i._view?i._view.container.firstElementChild.firstElementChild.$:i.$.mainContainer.$.content.firstElementChild.$;1===r?e.addClass("smart-hidden"):e.removeClass("smart-hidden")}}_viewHandler(e){const t=this;if("transitionend"===e.type){const i=e.target;if(i===t.$.view||t.$.backButton.contains(i))return;return i.classList.contains("animate")&&(i.classList.remove("animate"),i.classList.add("smart-hidden")),i.classList.contains("smart-menu-drop-down")&&(i.style.top=""),i.classList.contains("smart-menu-items-group-opened")&&i.classList.remove("smart-menu-items-group-opened"),cancelAnimationFrame(t._refreshScroll),t._refreshScroll=requestAnimationFrame((()=>{t._checkOverflow(),cancelAnimationFrame(t._refreshScroll),delete t._refreshScroll})),void(t._inTransition=!1)}if(t._minimized&&null!==t.dropDownAppendTo)switch(e.type){case"click":t._selectionHandler(e);break;case"mouseout":case"mouseover":t._mouseoutMouseoverHandler(e)}}_mouseWheelHandler(e){let t=this;if(t.enableMouseWheelAction&&!t.disabled&&!t.displayLoadingIndicator&&(t=t.$.mainContainer,t.scrollHeight>0)){const i=t.scrollTop;if(0===i&&e.deltaY<0||i===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault(),t.scrollTo(t.scrollTop+t._getScrollCoefficient(e,t.offsetHeight))}}_scrollViewerRefresh(){const e=this;e.$.scrollViewerContentContainer&&(e.scrollWidth=0,e.scrollHeight=function(){let t;const i=e.$.scrollViewerContainer.classList.contains("hscroll");if(e.$.scrollViewerContainer.classList.remove("hscroll"),Smart.Utilities.Core.Browser.Safari){const i=e.$.scrollViewerContentContainer.getBoundingClientRect().height,r=e.$.scrollViewerContainer.getBoundingClientRect().height;t=i&&r?parseInt(i)-parseInt(r):e.$.scrollViewerContentContainer.scrollHeight-e.$.scrollViewerContainer.offsetHeight}else t=e.$.scrollViewerContentContainer.scrollHeight-e.$.scrollViewerContainer.offsetHeight;return t>0&&"hidden"!==e.verticalScrollBarVisibility||"visible"===e.verticalScrollBarVisibility?e.$.scrollViewerContainer.classList.add("vscroll"):e.$.scrollViewerContainer.classList.remove("vscroll"),i&&e.$.scrollViewerContainer.classList.add("hscroll"),t}(),e.computedVerticalScrollBarVisibility&&(e.scrollHeight+=e._scrollView.hScrollBar.offsetHeight))}});
|
|
@@ -71,7 +71,7 @@ Smart("smart-gauge",class extends Smart.Tank{static get properties(){return{anal
|
|
|
71
71
|
Smart("smart-slider",class extends Smart.Tank{static get properties(){return{enableMouseWheelAction:{value:!1,type:"boolean"},hint:{value:"",type:"string"},orientation:{value:"horizontal",allowedValues:["horizontal","vertical"],type:"string",defaultReflectToAttribute:!0},rangeSlider:{value:!1,type:"boolean"},showButtons:{value:!1,type:"boolean"},values:{value:["0","100"],type:"array"}}}static get listeners(){return{"track.down":"_trackDownHandler","thumb.down":"_thumbDownHandler","secondThumb.down":"_thumbDownHandler","thumb.mouseleave":"_thumbMoveMouseleaveHandler","secondThumb.mouseleave":"_thumbMoveMouseleaveHandler","thumb.move":"_thumbMoveMouseleaveHandler","secondThumb.move":"_thumbMoveMouseleaveHandler","document.move":"_documentMoveHandler","document.up":"_documentUpHandler","leftButton.click":"_spinButtonClickHandler","rightButton.click":"_spinButtonClickHandler",keydown:"_keydownHandlerSlider",keyup:"_keyupHandlerSlider",resize:"_resizeAndStyleChangedHandler",styleChanged:"_resizeAndStyleChangedHandler","document.selectstart":"_selectStartHandler",wheel:"_wheelHandler"}}static get requires(){return{"Smart.RepeatButton":"smart.button.js"}}static get styleUrls(){return["smart.slider.css","smart.button.css"]}template(){return'<div id="container" class="smart-container" role="presentation">\n <div id="scaleNear" class="smart-scale smart-scale-near" aria-hidden="true"></div>\n <div id="trackContainer" class="smart-track-container" role="presentation">\n <smart-repeat-button id="leftButton" class="smart-spin-button" animation="[[animation]]" unfocusable>\n <div id="leftArrow" class="smart-arrow" aria-hidden="true"></div>\n </smart-repeat-button>\n <div id="track" class="smart-track" role="presentation">\n <div id="fill" class="smart-value" role="presentation"></div>\n <div id="trackTicksContainer" class="smart-track-ticks-container smart-hidden" role="presentation"></div>\n <div id="thumb" class="smart-thumb" role="slider">\n <span id="thumbLabel" class="smart-thumb-label" role="presentation"></span>\n <div id="tooltip" class="smart-tooltip" role="tooltip">\n <div id="tooltipContent" class="smart-tooltip-content smart-unselectable" role="presentation"></div>\n </div>\n </div>\n <div id="secondThumb" class="smart-thumb" role="slider">\n <span id="secondThumbLabel" class="smart-thumb-label" role="presentation"></span>\n <div id="secondTooltip" class="smart-tooltip" role="tooltip">\n <div id="secondTooltipContent" class="smart-tooltip-content smart-unselectable" role="presentation"></div>\n </div>\n </div>\n </div>\n <smart-repeat-button id="rightButton" class="smart-spin-button" animation="[[animation]]" unfocusable>\n <div id="rightArrow" class="smart-arrow" aria-hidden="true"></div>\n </smart-repeat-button>\n </div>\n <div id="scaleFar" class="smart-scale smart-scale-far" aria-hidden="true"></div>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n <span class="smart-hint" id="span">[[hint]]</span>\n </div>'}_createElement(){const e=this,t="numeric"===e.mode;if(e.$.tooltip.id||(e.$.tooltip.id=e.id+"Tooltip",e.$.secondTooltip.id=e.id+"SecondTooltip"),e.setAttribute("role","presentation"),e.setAttribute("aria-describedby",e.$.tooltip.id+" "+e.$.secondTooltip.id),e._renderingSuspended||(t?e._redefineProperty("values"):t||e._handleDateScale()),e._setSettingsObject(),e._setDrawVariables(),e._getLayoutType(),e._numericProcessor=new Smart.Utilities.NumericProcessor(e,"scaleType"),e._numberRenderer=new Smart.Utilities.NumberRenderer,!e._isVisible())return void(e._renderingSuspended=!0);e._renderingSuspended=!1,e._setInitialComponentDisplay(),e._measurements={},e._getMeasurements(),e._wordLengthNumber=e._numericProcessor.getWordLength(e.wordLength);const a=e._valuesHandler=e.rangeSlider?new Smart.Utilities.SliderMultipleValueHandler(e):new Smart.Utilities.SliderSingleValueHandler(e);t&&(e._getEventValue=function(){return e._valuesHandler.getValue()}),e._validateInitialPropertyValues(),e._setTicksAndInterval(),a.validate(!0),a.updateTooltipValue(),window.requestAnimationFrame((function(){e.$thumb.addClass("enable-animation"),e.$secondThumb.addClass("enable-animation"),e.$fill.addClass("enable-animation")})),e._setFocusable(),e._makeThumbAccessible(),e.$.hiddenInput.value=e._getEventValue(),e.$.thumb.setAttribute("aria-orientation",e.orientation),e.$.secondThumb.setAttribute("aria-orientation",e.orientation),e._setAriaValue("valuenow")}val(e){const t=this,a=t._valuesHandler;if(void 0===e)return t._getEventValue();"date"===t.mode&&(t.rangeSlider?(e[0]=Smart.Utilities.DateTime.validateDate(e[0]),e[1]=Smart.Utilities.DateTime.validateDate(e[1]),e[0]=e[0].getTimeStamp(),e[1]=e[1].getTimeStamp()):e=(e=Smart.Utilities.DateTime.validateDate(e)).getTimeStamp()),a.areDifferent(e)&&a.validate(!1,e,!0)}getOptimalSize(){const e=this;if(e._renderingSuspended)return{width:0,height:0};const t=window.getComputedStyle(e),a=window.getComputedStyle(e.$.trackContainer);let i,r,n,o,s,l,d,u,m=0;return i="all"===e.labelsVisibility?e._numericProcessor._longestLabelSize:"endPoints"===e.labelsVisibility?Math.max(e._tickIntervalHandler.labelsSize.minLabelOtherSize,e._tickIntervalHandler.labelsSize.maxLabelOtherSize):0,"horizontal"===e.orientation?(m+=parseFloat(a.marginTop)+parseFloat(a.marginBottom)+e.$.track.offsetHeight,"near"!==e.scalePosition&&"both"!==e.scalePosition||(m+=i,n=e.$.scaleNear.getElementsByClassName("smart-label"),o=n[0],s=n[n.length-1],m+=parseFloat(window.getComputedStyle(o).bottom)),"far"!==e.scalePosition&&"both"!==e.scalePosition||(m+=i,n=e.$.scaleFar.getElementsByClassName("smart-label"),o=n[0],s=n[n.length-1],m+=parseFloat(window.getComputedStyle(o).top)),m+=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),r=e.offsetWidth,"none"!==e.scalePosition&&(l=o.getBoundingClientRect(),d=s.getBoundingClientRect(),u=l.left+o.offsetWidth-d.left,u>0&&(r=o.offsetWidth+s.offsetWidth+Math.max(10,e.$.thumb.offsetWidth))),{width:r,height:m}):(m+=parseFloat(a.marginLeft)+parseFloat(a.marginRight)+e.$.track.offsetWidth,"near"!==e.scalePosition&&"both"!==e.scalePosition||(m+=i,n=e.$.scaleNear.getElementsByClassName("smart-label"),o=n[0],s=n[n.length-1],m+=parseFloat(window.getComputedStyle(o).right)),"far"!==e.scalePosition&&"both"!==e.scalePosition||(m+=i,n=e.$.scaleFar.getElementsByClassName("smart-label"),o=n[0],s=n[n.length-1],m+=parseFloat(window.getComputedStyle(o).left)),m+=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),r=e.offsetHeight,"none"!==e.scalePosition&&(l=o.getBoundingClientRect(),d=s.getBoundingClientRect(),u=l.top+o.offsetHeight-d.top,u>0&&(r=o.offsetHeight+s.offsetHeight+Math.max(10,e.$.thumb.offsetHeight))),{width:m,height:r})}propertyChangedHandler(e,t,a){const i=this;if(!i._isVisible()||i._renderingSuspended)return void(i._renderingSuspended=!0);if(-1!==["disabled","mode","readonly","showThumbLabel","tooltipPosition","unfocusable","validation"].indexOf(e))return void super.propertyChangedHandler(e,t,a);let r=i._valuesHandler;function n(){i._setTicksAndInterval(),r.validate(!1,r.getValue(),!0)}if("values"!==e&&a!=t||"values"===e&&(a[0]!=t[0]||a[1]!==t[1]))switch(e){case"coerce":if(a){const e=r.getValue();r.validate(!1,e.slice(0),!0),i._valueBeforeCoercion=e}else void 0!==i._valueBeforeCoercion&&r.validate(!1,i._valueBeforeCoercion.slice(0),!0);break;case"customInterval":case"customTicks":super.propertyChangedHandler(e,t,a),i.customInterval&&r.validate(!1,r.getValue(),!0);break;case"dateLabelFormatString":"date"===i.mode&&n();break;case"decimalSeparator":case"scientificNotation":if("date"===i.mode)return;n();break;case"interval":i._numericProcessor.validateInterval(a),r.validate(!1,r.getValue(),!0);break;case"inverted":case"rightToLeft":i._getLayoutType(),i._normalLayout&&(i.$.fill.style[i._settings.margin]="0px"),n();break;case"labelFormatFunction":case"showUnit":case"unit":n();break;case"labelsVisibility":case"ticksVisibility":return;case"logarithmicScale":if("date"===i.mode)return void(i.logarithmicScale=!1);i._validateMinMax("both"),n();break;case"min":case"max":"date"===i.mode&&(delete i._dateInterval,i[e]=Smart.Utilities.DateTime.validateDate(a).getTimeStamp()),i._validateMinMax(e,!1,t),n();break;case"orientation":i.$.container.removeAttribute("style"),i.$.trackContainer.removeAttribute("style"),i.$.fill.removeAttribute("style"),i.$.thumb.removeAttribute("style"),i.$.secondThumb.removeAttribute("style"),i._setSettingsObject(),i._getLayoutType(),i._getMeasurements(),n(),"horizontal"===a?(i.$leftArrow.removeClass("smart-arrow-up"),i.$rightArrow.removeClass("smart-arrow-down"),i.$leftArrow.addClass("smart-arrow-left"),i.$rightArrow.addClass("smart-arrow-right")):(i.$leftArrow.removeClass("smart-arrow-left"),i.$rightArrow.removeClass("smart-arrow-right"),i.$leftArrow.addClass("smart-arrow-up"),i.$rightArrow.addClass("smart-arrow-down")),i.$.thumb.setAttribute("aria-orientation",a),i.$.secondThumb.setAttribute("aria-orientation",a);break;case"precisionDigits":case"significantDigits":if("date"===i.mode)return;"precisionDigits"===e&&"integer"===i.scaleType&&i.error(i.localize("noInteger",{elementType:i.nodeName.toLowerCase(),property:e})),"significantDigits"===e&&null!==i.precisionDigits?i.precisionDigits=null:"precisionDigits"===e&&null!==i.significantDigits&&(i.significantDigits=null),n();break;case"rangeSlider":a?(i.values=[i.min,i.value],i._drawValues=[i._drawMin,i._drawValue],"date"===i.mode&&(i._valueDate=[i._minDate.clone(),i._valueDate]),void 0!==i._valueBeforeCoercion&&(i._valueBeforeCoercion=[i.min,i._valueBeforeCoercion]),r=i._valuesHandler=new Smart.Utilities.SliderMultipleValueHandler(i)):(i.value=i.values[1],i._drawValue=i._drawValues[1],"date"===i.mode&&(i._valueDate=i._valueDate[1]),void 0!==i._valueBeforeCoercion&&(i._valueBeforeCoercion=i._valueBeforeCoercion[1]),r=i._valuesHandler=new Smart.Utilities.SliderSingleValueHandler(i),i.$.fill.style.marginTop=0,i.$.fill.style.marginLeft=0),r.validate(!1,r.getValue(),!0);break;case"scalePosition":i._setInitialComponentDisplay(),n();break;case"scaleType":if("date"===i.mode)return void(i.scaleType="integer");i._numericProcessor=new Smart.Utilities.NumericProcessor(i,"scaleType"),i._validateMinMax("both"),i._setTicksAndInterval(),r.validate(!0);break;case"showButtons":a?(i.$leftButton.removeClass("smart-hidden"),i.$rightButton.removeClass("smart-hidden")):(i.$leftButton.addClass("smart-hidden"),i.$rightButton.addClass("smart-hidden")),i._setTicksAndInterval(),r.moveThumbBasedOnValue(r.getDrawValue(),void 0,!0);break;case"showTooltip":super.propertyChangedHandler(e,t,a),a||(i.$tooltip.addClass("smart-hidden"),i.$secondTooltip.addClass("smart-hidden"));break;case"theme":super.propertyChangedHandler(e,t,a),n();break;case"ticksPosition":"scale"===a?(i.$trackTicksContainer.addClass("smart-hidden"),i.$.trackTicksContainer.innerHTML=""):i.$trackTicksContainer.removeClass("smart-hidden"),i._setTicksAndInterval();break;case"value":case"values":if("value"===e&&i.rangeSlider||"values"===e&&!i.rangeSlider)return;if(i[e]=t,"date"===i.mode)if("value"===e){if(a=(a=Smart.Utilities.DateTime.validateDate(a)).getTimeStamp(),i.value=a,0===a.compare(t))return}else if(a[0]=Smart.Utilities.DateTime.validateDate(a[0]),a[1]=Smart.Utilities.DateTime.validateDate(a[1]),a[0]=a[0].getTimeStamp(),a[1]=a[1].getTimeStamp(),i.values=a,0===a[0].compare(t[0])&&0===a[1].compare(t[1]))return;r.validate(!1,a,!0);break;case"wordLength":if("date"===i.mode)return void(i.wordLength="uint64");i._wordLengthNumber=i._numericProcessor.getWordLength(a),i._validateMinMax("both"),n()}else"string"!=typeof a&&"string"==typeof t&&(i[e]=t)}_addMovedThumbClass(){const e=this;e.rangeSlider&&(e._movedThumb.$.addClass("smart-moved-thumb"),e._movedThumb===e.$.thumb?e.$secondThumb.removeClass("smart-moved-thumb"):e.$thumb.removeClass("smart-moved-thumb"))}_setInitialComponentDisplay(){super._setInitialComponentDisplay();const e=this;e.$secondTooltip.addClass("smart-hidden"),e.showButtons||(e.$leftButton.addClass("smart-hidden"),e.$rightButton.addClass("smart-hidden"))}_getMeasurements(){const e=this,t=e._measurements,a=e.$.track,i=e.$.thumb;e._isVisible()&&!e._renderingSuspended?("horizontal"===e.orientation?(t.trackWidth=a.offsetHeight,t.thumbSize=i.offsetWidth,t.borderWidth=parseFloat(window.getComputedStyle(e.$.track).borderLeftWidth)):(t.trackWidth=a.offsetWidth,t.thumbSize=i.offsetHeight,t.borderWidth=parseFloat(window.getComputedStyle(e.$.track).borderTopWidth)),t.halfThumbSize=t.thumbSize/2):e._renderingSuspended=!0}_layout(){const e=this,t=e._measurements,a=e.$.container.style,i=t.halfThumbSize,r=e._tickIntervalHandler.labelsSize;let n,o,s,l;if("none"!==e.scalePosition?(n=r.minLabelSize/2,o=r.maxLabelSize/2):(n=0,o=0),e.showButtons){const t=e.$.leftButton[e._settings.size]+i;s=Math.max(n-t,0)+"px",l=Math.max(o-t,0)+"px"}else s=Math.max(i,n)+"px",l=Math.max(i,o)+"px";"horizontal"===e.orientation?(!e.inverted&&!e.rightToLeft||e.rightToLeft&&e.inverted?(a.paddingLeft=s,a.paddingRight=l):(a.paddingLeft=l,a.paddingRight=s),t.trackLength=e.$.track.clientWidth,e.$leftArrow.addClass("smart-arrow-left"),e.$rightArrow.addClass("smart-arrow-right")):(e.inverted?(a.paddingBottom=l,a.paddingTop=s):(a.paddingBottom=s,a.paddingTop=l),t.trackLength=e.$.track.clientHeight,e.$leftArrow.addClass("smart-arrow-up"),e.$rightArrow.addClass("smart-arrow-down"))}_trackDownHandler(e){const t=this,a=t.mechanicalAction;t.disabled||t.readonly||!t.rangeSlider&&e.target===t.$.thumb||(t._stopTrackDownHandler?t._stopTrackDownHandler=!1:("switchWhileDragging"!==a&&(t._valueAtDragStart=t._valuesHandler.getValue()),t._getTrackStartAndEnd(),t._valuesHandler.setActiveThumbOnTrackClick(e),t._moveThumbBasedOnCoordinates(e,!0,"switchWhenReleased"!==a),t._thumbDragged=!0,t.setAttribute("dragged",""),t.showTooltip&&t._movedTooltip.removeClass("smart-hidden")))}_trackMoveHandler(){}_thumbDownHandler(e){const t=this;t.disabled||t.readonly||(t._getTrackStartAndEnd(),(e[t._settings.page]<t._trackStart||e[t._settings.page]>t._trackEnd)&&(t._stopTrackDownHandler=!0),"switchWhileDragging"!==t.mechanicalAction&&(t._valueAtDragStart=t._valuesHandler.getValue()),window.getSelection().removeAllRanges(),t._thumbDragged=!0,t.setAttribute("dragged",""),t.$track.addClass("smart-dragged"),t._movedThumb=e.target,t._addMovedThumbClass(),t._movedTooltip=t.$tooltip,t.rangeSlider&&(t._movedThumb===t.$.thumb?(t._staticThumb=t.$.secondThumb,t.$secondTooltip.addClass("smart-hidden")):(t._staticThumb=t.$.thumb,t._movedTooltip=t.$secondTooltip,t.$tooltip.addClass("smart-hidden"))),t.showTooltip&&t._movedTooltip.removeClass("smart-hidden"),e.stopPropagation())}_thumbMoveMouseleaveHandler(e){if(this.disabled||this.readonly)return;const t=e.target;if("move"===e.type){const a=t.getBoundingClientRect(),i=window.scrollX||window.pageXOffset,r=window.scrollY||window.pageYOffset,n=(a.left+a.right)/2+i,o=(a.top+a.bottom)/2+r,s=Math.pow(a.width/2,2);if(Math.pow(e.pageX-n,2)+Math.pow(e.pageY-o,2)>s)return;t.setAttribute("hover","")}else t.removeAttribute("hover")}_documentMoveHandler(e){const t=this;t._thumbDragged&&(t.$thumb.removeClass("enable-animation"),t.$secondThumb.removeClass("enable-animation"),t.$fill.removeClass("enable-animation"),t._moveThumbBasedOnCoordinates(e,!0,"switchWhenReleased"!==t.mechanicalAction))}_documentUpHandler(e,t){const a=this;a._thumbDragged&&(a.$thumb.addClass("enable-animation"),a.$secondThumb.addClass("enable-animation"),a.$fill.addClass("enable-animation"),t||("switchUntilReleased"===a.mechanicalAction?a._valuesHandler.validate(!1,a._valueAtDragStart):"switchWhenReleased"===a.mechanicalAction&&a._moveThumbBasedOnCoordinates(e,!0,!0)),a.showTooltip&&a._movedTooltip.addClass("smart-hidden"),a._thumbDragged=!1,a.removeAttribute("dragged"),a._makeThumbAccessible(),a._movedThumb=void 0,a.$track.removeClass("smart-dragged"))}_spinButtonClickHandler(e){const t=this;if(t.disabled||t.readonly)return;let a;a=t.$.leftButton.contains(e.target)===t._normalLayout?"subtract":"add",t._valuesHandler.incrementOrDecrement(a)}_keydownHandlerSlider(e){const t=this,a=e.key;if("Escape"===a&&t._thumbDragged&&"switchWhenReleased"===t.mechanicalAction)return t._documentUpHandler(void 0,!0),void t._valuesHandler.validate(!1,t._valueAtDragStart);-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp"].indexOf(a)||t.coerce||(t.$thumb.removeClass("enable-animation"),t.$secondThumb.removeClass("enable-animation"),t.$fill.removeClass("enable-animation"),t._restoreAnimationClass=!0),this._valuesHandler.keydownHandler(e)}_keyupHandlerSlider(){const e=this;e._restoreAnimationClass&&(e.$thumb.addClass("enable-animation"),e.$secondThumb.addClass("enable-animation"),e.$fill.addClass("enable-animation"))}refresh(){this._resizeAndStyleChangedHandler()}_resizeAndStyleChangedHandler(e){const t=this,a=t._valuesHandler;if(t._isVisible()){if(t._renderingSuspended)t._createElement();else if(!t._renderingSuspended&&(t._getMeasurements(),t._setTicksAndInterval(),a.validate(!1,a.getValue(),!0),e&&"styleChanged"===e.type)){const a=e.detail.styleProperties;if(a["font-size"]||a["font-family"]||a["font-style"]||a["font-weight"]){const e=t.getOptimalSize();t.style.width=e.width+"px",t.style.height=e.height+"px"}}}else t._renderingSuspended=!0}_moveThumbBasedOnCoordinates(e,t,a){const i=this,r=i._numericProcessor,n=i._trackStart,o=i._settings.margin;let s=e[i._settings.page];t&&(s=i._valuesHandler.restrictThumbCoordinates(s,n,i._trackEnd));let l=r.pxToValue(s);i.rangeSlider&&i._movedThumb===i.$.thumb&&1===r.compare(l,i.values[1],!0)&&(l=r.createDescriptor(i.values[1]));let d=l;i.logarithmicScale?(l=r.getCoercedValue(Math.log10(l)),d=parseFloat(Math.pow(10,l).toFixed(11))):(l=r.getCoercedValue(l),d=l),s=r.valueToPx(l)+n;const u=s-n;i._movedThumb.style[o]=u-i._measurements.halfThumbSize+"px",i._valuesHandler.updateFillSizeAndPosition(u,o,d,!0,a),Smart.Utilities.Core.isMobile&&e.originalEvent&&(e.originalEvent.stopPropagation(),e.originalEvent.preventDefault())}_moveThumbBasedOnValue(e,t,a,i){const r=this,n=r._numericProcessor.valueToPx(t),o=r._settings.margin;e.style[o]=n-r._measurements.halfThumbSize+"px";const s=r._getSingleActualValue(t);i?r.rangeSlider&&(r._firstPassSize=n):r._valuesHandler.updateFillSizeAndPosition(n,o,s,a,a)}_validate(e,t,a,i){this._valuesHandler.validate(e,t,i)}_updateValue(e){const t=this._valuesHandler;t.updateValue(t.getActualValue(e))}_makeThumbAccessible(){const e=this;e.rangeSlider&&(e.$.thumb[e._settings.offset]===e.$.secondThumb[e._settings.offset]&&!1===e._numericProcessor.compare(e.values[1],e.max)?e.$thumb.addClass("accessible"):e.$thumb.removeClass("accessible"))}_getSingleActualValue(e){return this.logarithmicScale?parseFloat(Math.pow(10,e).toFixed(11)):e.toString()}_coerceCustomInterval(){const e=this;if(e.coerce){const t=e._valueBeforeCoercion;e._valuesHandler.validate(!1,e._valuesHandler.getValue()),e._valueBeforeCoercion=t}}_wheelHandler(e){const t=this;document.activeElement===t&&t.enableMouseWheelAction&&(e.stopPropagation(),e.preventDefault(),e.wheelDelta>0?t._keydownHandlerSlider({key:"ArrowRight",which:39,preventDefault:function(){}}):t._keydownHandlerSlider({key:"ArrowLeft",which:37,preventDefault:function(){}}))}_handleDateScale(){const e=this,t=Smart.Utilities.DateTime;super._handleDateScale(),Object.defineProperty(e,"values",{get:function(){return e.context===e?e.properties.values.value:e._valueDate},set(t){function a(e,t){return t instanceof Smart.Utilities.BigNumber?t.toString():t}const i=e.properties.values.value;if(JSON.stringify(i,a)!==JSON.stringify(t,a)&&(e.properties.values.value=t,e.isReady&&(!e.ownerElement||e.ownerElement&&e.ownerElement.isReady)&&e.context!==e)){const a=e.context;e.context=e,e.propertyChangedHandler("values",i,t),e.context=a}}}),e.rangeSlider&&(e._valueDate=[t.validateDate(e.values[0]),t.validateDate(e.values[1])],e.values=[e._valueDate[0].getTimeStamp(),e._valueDate[1].getTimeStamp()]),e._properties.values.serialize="_serializeValue"}_setTicksAndInterval(){const e=this;e._skipTrackReset?delete e._skipTrackReset:e.$.track.style[e._settings.dimension]=null,super._setTicksAndInterval(),e.$.track[e._settings.size]<10&&(e._skipTrackReset=!0,e.$.track.style[e._settings.dimension]=e.getOptimalSize()[e._settings.dimension]+"px",e._getMeasurements(),e._setTicksAndInterval(),e._valuesHandler.validate(!1,e._valuesHandler.getValue()))}_getLayoutType(){const e=this;super._getLayoutType(),e._normalLayout?(e.$.leftButton.setAttribute("aria-label","Decrement"),e.$.rightButton.setAttribute("aria-label","Increment")):(e.$.leftButton.setAttribute("aria-label","Increment"),e.$.rightButton.setAttribute("aria-label","Decrement"))}_setAriaValue(e){this._valuesHandler.setAriaValue(e)}}),Smart.Utilities.Assign("SliderSingleValueHandler",class{constructor(e){this.context=e,"date"===e.mode&&(e._getEventValue=function(t,a){let i;return i=void 0!==a?Smart.Utilities.DateTime.fromFullTimeStamp(a):e._valueDate.clone(),t?(e.$.thumb.setAttribute("aria-valuetext",i.toString("f")),e.value.toString()):i})}applyFunctionToValue(e,t){const a=this.context;return void 0===t&&(t=a.value),e.apply(a,[t])}areDifferent(e){return this.context.value!==e}incrementOrDecrement(e){const t=this.context._keyIncrementDecrement(e);this.validate(!1,t)}setActiveThumbOnTrackClick(){const e=this.context;e._movedThumb=e.$.thumb,e._addMovedThumbClass(),e._movedTooltip=e.$tooltip}getActualValue(e){return this.context._getSingleActualValue(e)}getCoercedLogarithmicValue(e){const t=this.context;if(t.logarithmicScale){const a=t._numericProcessor.getCoercedValue(Math.log10(e));return this.getActualValue(a)}return e}getDrawValue(){return this.context._drawValue}getValue(){return this.context.value}keydownHandler(e){this.context._keydownHandler(e)}moveThumbBasedOnValue(e,t,a){const i=this.context;if(void 0===e&&(e=i.value),i._moveThumbBasedOnValue(i.$.thumb,e,t),!0!==a){i._drawValue=e;const t=this.getActualValue(e);let a;a=void 0!==i._valueNoRangeValidation?i._valueNoRangeValidation.toString():t.toString(),"date"===i.mode&&(i._valueDate=Smart.Utilities.DateTime.fromFullTimeStamp(a)),i.value=a,delete i._valueBeforeCoercion,this.updateTooltipValue(t)}}restrictThumbCoordinates(e,t,a){return e=Math.max(e,t),e=Math.min(e,a)}updateFillSizeAndPosition(e,t,a,i,r){const n=this.context,o=n.$.fill.style,s=n._settings.dimension;if(n._normalLayout?o[s]=e+"px":(o[s]=n._measurements.trackLength-e+"px",o[t]=e+"px"),i){const e=n.value,t=n._getEventValue(!1,e),i=n._numericProcessor;if(i.compare(i.createDescriptor(a),i.createDescriptor(e))&&(this.updateTooltipValue(a),r)){let e;if(n._drawValue=n.logarithmicScale?Math.log10(a):a,e=void 0!==n._valueNoRangeValidation?n._valueNoRangeValidation.toString():a.toString(),"date"===n.mode&&(n._valueDate=Smart.Utilities.DateTime.fromFullTimeStamp(e)),n.value=e,delete n._valueBeforeCoercion,!0!==n._programmaticValueIsSet){const e=n._getEventValue();n.$.hiddenInput.value=e,n.$.fireEvent("change",{value:e,oldValue:t}),n._updateTargetValue(),this.setAriaValue("valuenow")}}}}updateTooltipValue(e){const t=this.context;void 0===e&&(e=t.value);const a=t._formatLabel(e);t.$.tooltipContent.innerHTML!==a&&(t.$.tooltipContent.innerHTML=a,t.$.thumbLabel.innerHTML=a)}updateValue(e){const t=this.context,a=t._numericProcessor.createDescriptor(e,!0,!1);t._drawValue=t.logarithmicScale?Math.log10(a):a,this.moveThumbBasedOnValue(t._drawValue,!0)}validate(e,t,a){const i=this.context,r=i._numericProcessor;let n,o;i._programmaticValueIsSet=a&&"interaction"===i.validation,n=e?i.value:t,i.coerce&&(n=i._numericProcessor.createDescriptor(n,!0,!0,!0)),n=i.logarithmicScale?this.getCoercedLogarithmicValue(n):r.getCoercedValue(n),"strict"===i.validation?(i._valueNoRangeValidation=r.createDescriptor(n,!0,!0,!0),o=i._valueNoRangeValidation):(i._valueNoRangeValidation=r.createDescriptor(n,!0,!0,!1),o=r.validate(i._valueNoRangeValidation,i._minObject,i._maxObject)),e?(i._drawValue=i.logarithmicScale?Math.log10(o):o,n=i._valueNoRangeValidation.toString(),"date"===i.mode&&(i._valueDate=Smart.Utilities.DateTime.fromFullTimeStamp(n)),i.value=n,this.moveThumbBasedOnValue(i._drawValue,void 0,!0)):this.updateValue(o),delete i._valueNoRangeValidation,i._programmaticValueIsSet=!1}setAriaValue(e){const t=this.context,a=t.$.thumb;"valuenow"===e?a.setAttribute("aria-valuenow",t._getEventValue(!0)):(a.setAttribute("aria-valuemin",t.min.toString()),a.setAttribute("aria-valuemax",t.max.toString()))}}),Smart.Utilities.Assign("SliderMultipleValueHandler",class{constructor(e){this.context=e,"date"===e.mode&&(e._getEventValue=function(t,a,i){const r=[e._valueDate[0].clone(),e._valueDate[1].clone()];return void 0!==a&&(r[i]=Smart.Utilities.DateTime.fromFullTimeStamp(a)),t?(e.$.thumb.setAttribute("aria-valuetext",r[0].toString("f")),e.$.secondThumb.setAttribute("aria-valuetext",r[1].toString("f")),e.values.slice(0)):r})}applyFunctionToValue(e,t){const a=this.context,i=[];return void 0===t&&(t=a.values),i[0]=e.apply(a,[t[0]]),i[1]=e.apply(a,[t[1]]),i}areDifferent(e){const t=this.context.values;return t[0]!==e[0]||t[1]!==e[1]}incrementOrDecrement(e){const t=this.context.values.slice(0);let a;a="add"===e?1:0,t[a]=this.keyIncrementDecrement(e,a),this.validate(!1,t)}keydownHandler(e){const t=this.context;if(t.disabled||t.readonly)return;const a=e.charCode?e.charCode:e.which;if(-1!==[35,36,37,38,39,40].indexOf(a)){e.preventDefault();const i=t.values.slice(0);let r;switch(a){case 40:case 37:r=this.keyIncrementDecrement("subtract",0),i[0]=r,t._movedThumb=t.$.thumb;break;case 38:case 39:r=this.keyIncrementDecrement("add",1),i[1]=r,t._movedThumb=t.$.secondThumb;break;case 36:t._drawValues[0]=t._drawMin,i[0]=t.min,t._movedThumb=t.$.thumb;break;case 35:t._drawValues[1]=t._drawMax,i[1]=t.max,t._movedThumb=t.$.secondThumb}return this.validate(!1,i),!1}}keyIncrementDecrement(e,t){const a=this.context;let i,r;if(a.customInterval&&a.coerce)return i=this.getValue()[t],a._keyIncrementDecrement(e,i.toString());if("date"===a.mode)return i=a._valueDate[t],r=i[a._dateIncrementMethod](("add"===e?1:-1)*parseFloat(a.interval),!0),r=r.getTimeStamp(),-1===r.compare(a._drawMin)?new Smart.Utilities.BigNumber(a._drawMin):1===r.compare(a._drawMax)?new Smart.Utilities.BigNumber(a._drawMax):r;const n=a._drawValues[t];return i=a._numericProcessor.createDescriptor(n),r=a._numericProcessor.incrementDecrement(i,e,a._validInterval),a.logarithmicScale&&(a._drawValues[t]=r,r=parseFloat(Math.pow(10,Math.round(r)).toFixed(11))),r}setActiveThumbOnTrackClick(e){const t=this.context,a=t._trackStart+t._measurements.halfThumbSize,i=t._settings.offset,r=t.$.thumb,n=t.$.secondThumb,o=r[i],s=n[i],l=e[t._settings.page];let d=t._normalLayout?a+o+(s-o)/2:a+s+(o-s)/2;t._normalLayout&&l<=d||!t._normalLayout&&l>d?(t._movedThumb=r,t._staticThumb=n,t._movedTooltip=t.$tooltip,t.$secondTooltip.addClass("smart-hidden")):(t._movedThumb=n,t._staticThumb=r,t._movedTooltip=t.$secondTooltip,t.$tooltip.addClass("smart-hidden")),t._addMovedThumbClass()}getActualValue(e){return this.context.logarithmicScale?[parseFloat(Math.pow(10,e[0].toString()).toFixed(11)),parseFloat(Math.pow(10,e[1].toString()).toFixed(11))]:[e[0].toString(),e[1].toString()]}getCoercedLogarithmicValue(e){const t=this.context;if(t.logarithmicScale){const a=[];return a[0]=t._numericProcessor.getCoercedValue(Math.log10(e[0])),a[1]=t._numericProcessor.getCoercedValue(Math.log10(e[1])),this.getActualValue(a)}return e}getDrawValue(){return this.context._drawValues}getValue(){return this.context.values.slice(0)}moveThumbBasedOnValue(e,t,a){const i=this.context,r=void 0===t;if(void 0===e&&(e=i.values),i._numericProcessor.restrictValue(e),(r||1===t)&&(i._movedThumb=i.$.secondThumb,i._moveThumbBasedOnValue(i.$.secondThumb,e[1],!0,r)),(r||0===t)&&(i._movedThumb=i.$.thumb,i._moveThumbBasedOnValue(i.$.thumb,e[0],!0)),delete i._firstPassSize,!0!==a){i._drawValues=e;const t=this.getActualValue(e);let a;a=i._valuesNoRangeValidation?[i._valuesNoRangeValidation[0].toString(),i._valuesNoRangeValidation[1].toString()]:t,"date"===i.mode&&(i._valueDate=[Smart.Utilities.DateTime.fromFullTimeStamp(t[0]),Smart.Utilities.DateTime.fromFullTimeStamp(t[1])]),i.values=a,delete i._valueBeforeCoercion,this.updateTooltipValue()}}restrictThumbCoordinates(e,t,a){const i=this.context,r=t+i._staticThumb[i._settings.offset]+i._measurements.halfThumbSize;return i._movedThumb===i.$.thumb&&i._normalLayout||i._movedThumb===i.$.secondThumb&&!i._normalLayout?(e=Math.max(e,t),e=Math.min(e,a,r)):(e=Math.max(e,t,r),e=Math.min(e,a)),e}updateFillSizeAndPosition(e,t,a,i,r){const n=this.context,o=n.$.fill.style,s=n._settings.dimension,l=n._settings.offset,d=n._measurements.halfThumbSize;let u,m;if(n._movedThumb===n.$.thumb?(u=e-d,m=void 0!==n._firstPassSize?n._firstPassSize-d:n.$.secondThumb[l]):(u=void 0!==n._firstPassSize?n._firstPassSize-d:n.$.thumb[l],m=e-d),n._normalLayout?(o[s]=Math.max(0,m-u)+"px",o[t]=u+d+"px"):(o[s]=Math.max(0,u-m)+"px",o[t]=m+d+"px"),i){const e=n._numericProcessor,t=n._movedThumb===n.$.thumb?0:1,i=n.values[t],o=n._getEventValue(!1,i,t);if(e.compare(e.createDescriptor(a),e.createDescriptor(i))){const e=n.values.slice(0);if(e[t]=a.toString(),this.updateTooltipValue(a,t),r){let t;if(this.updateDrawValues(e),t=n._valuesNoRangeValidation?[n._valuesNoRangeValidation[0].toString(),n._valuesNoRangeValidation[1].toString()]:e,"date"===n.mode&&(n._valueDate=[Smart.Utilities.DateTime.fromFullTimeStamp(e[0]),Smart.Utilities.DateTime.fromFullTimeStamp(e[1])]),n.values=t,delete n._valueBeforeCoercion,!0!==n._programmaticValueIsSet){const e=n._getEventValue();n.$.hiddenInput.value=e,n.$.fireEvent("change",{value:e,oldValue:o}),n._updateTargetValue(),this.setAriaValue("valuenow")}}}}}updateDrawValues(e){const t=this.context;t.logarithmicScale?(t._drawValues[0]=Math.log10(e[0]),t._drawValues[1]=Math.log10(e[1])):t._drawValues=e.slice(0)}updateTooltipValue(e,t){const a=this.context;if(void 0===e){const e=a.values,t=a._formatLabel(e[0]),i=a._formatLabel(e[1]);a.$.tooltipContent.innerHTML!==t&&(a.$.tooltipContent.innerHTML=t,a.$.thumbLabel.innerHTML=t),a.$.secondTooltipContent.innerHTML!==i&&(a.$.secondTooltipContent.innerHTML=i)}else{const i=a._formatLabel(e);(0===t&&a.$.tooltipContent.innerHTML!==i||void 0===t)&&(a.$.tooltipContent.innerHTML=i,a.$.thumbLabel.innerHTML=i),(1===t&&a.$.secondTooltipContent.innerHTML!==i||void 0===t)&&(a.$.secondTooltipContent.innerHTML=i,a.$.secondThumbLabel.innerHTML=i)}}updateValue(e){const t=this.context,a=[];let i;a[0]=t._numericProcessor.createDescriptor(e[0],!0,!1),a[1]=t._numericProcessor.createDescriptor(e[1],!0,!1),this.updateDrawValues(a),t._movedThumb===t.$.secondThumb&&(i=1),this.moveThumbBasedOnValue(t._drawValues.slice(0),i)}validate(e,t,a){const i=this.context,r=i._numericProcessor;let n,o=[];i._programmaticValueIsSet=a&&"interaction"===i.validation,n=e?i.values.slice(0):t,i.coerce&&(n[0]=r.createDescriptor(n[0],!0,!0,!0),n[1]=r.createDescriptor(n[1],!0,!0,!0)),i.logarithmicScale?n=this.getCoercedLogarithmicValue(n):(n[0]=r.getCoercedValue(n[0]),n[1]=r.getCoercedValue(n[1])),i._valuesNoRangeValidation=[],i._valuesNoRangeValidation[0]=r.createDescriptor(n[0],!0,!0,!1),i._valuesNoRangeValidation[1]=r.createDescriptor(n[1],!0,!0,!1),i._numericProcessor.restrictValue(i._valuesNoRangeValidation),o[0]=r.validate(i._valuesNoRangeValidation[0],i._minObject,i._maxObject),o[1]=r.validate(i._valuesNoRangeValidation[1],i._minObject,i._maxObject),e?(i._drawValues=[],this.updateDrawValues(o),n=[i._valuesNoRangeValidation[0].toString(),i._valuesNoRangeValidation[1].toString()],"date"===i.mode&&(i._valueDate=[Smart.Utilities.DateTime.fromFullTimeStamp(o[0]),Smart.Utilities.DateTime.fromFullTimeStamp(o[1])]),i.values=n,this.moveThumbBasedOnValue(i._drawValues,void 0,!0)):this.updateValue(o),delete i._valuesNoRangeValidation,i._programmaticValueIsSet=!1}setAriaValue(e){const t=this.context,a=t.$.thumb,i=t.$.secondThumb;if("valuenow"===e){const e=t._getEventValue(!0),r=e[0].toString(),n=e[1].toString();a.setAttribute("aria-valuenow",r),a.setAttribute("aria-valuemax",n),i.setAttribute("aria-valuenow",n),i.setAttribute("aria-valuemin",r)}else a.setAttribute("aria-valuemin",t.min.toString()),i.setAttribute("aria-valuemax",t.max.toString())}});
|
|
72
72
|
Smart("smart-accordion-item",class extends Smart.ContentElement{static get properties(){return{dragged:{value:!1,type:"boolean"},expanded:{value:!1,type:"boolean"},focused:{value:!1,type:"boolean"},index:{value:null,type:"number?"},label:{value:"",type:"string"}}}get enableShadowDOM(){return!1}static get listeners(){return{"accordionItemHeader.mouseenter":"_headerMouseEnterHandler","accordionItemHeader.mouseleave":"_headerMouseLeaveHandler","accordionItemHeader.down":"_ripple"}}template(){return'<div id="container" role="presentation">\n <div id="accordionItemHeader" class="smart-accordion-item-header smart-unselectable" role="heading" aria-level="1">\n <span id="arrow" class="smart-arrow" role="presentation" aria-hidden="true"></span>\n <span id="label" class="smart-label" inner-h-t-m-l=\'[[label]]\' role="button"></span>\n </div>\n <div id="accordionItemContent" class="smart-accordion-item-content">\n <div id="contentContainer" class="smart-content-container" role="presentation"><content></content></div>\n </div>\n </div>'}render(){const e=this;let t;t=e.id?e.id+"Content":e.parentElement&&e.parentElement.parentElement&&e.parentElement.parentElement.id?e.parentElement.parentElement.id+Math.floor(1e4*Math.random())+"Content":"accordion"+Math.floor(1e4*Math.random())+"Content",e.$.accordionItemContent.id=t,e.$.label.setAttribute("aria-controls",t),super.render()}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const a=this;if("expanded"===e){a.$.label.setAttribute("aria-expanded",n);const e=a.parentElement&&a.parentElement.parentElement?a.parentElement.parentElement.expandMode:a.shadowParent.expandMode;if("multiple"===e||"toggle"===e)return;return void(n?a.$.label.setAttribute("aria-disabled",!0):a.$.label.removeAttribute("aria-disabled"))}if(t=parseInt(t),n=parseInt(n),"index"!==e||isNaN(t)||isNaN(n))return;const i=a.parentElement.parentElement._items.length;n<0?n=0:n>=i&&(n=i-1),n!==t&&a.$.fireEvent("indexChange",{newIndex:n,oldIndex:t}),a.index=n}_headerMouseEnterHandler(){this.disabled||this.setAttribute("hover","")}_headerMouseLeaveHandler(){this.disabled||this.removeAttribute("hover")}_ripple(e){const t=this;t.disabled||t.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t.$.container,e.pageX,e.pageY)}_setIndex(e){const t=this,n=t.context;t.context=t,t.index=e,t.context=n}focus(){super.focus(),this.setAttribute("focus","")}blur(){super.blur(),this.removeAttribute("focus")}}),Smart("smart-accordion",class extends Smart.BaseElement{static get properties(){return{dataSource:{value:null,type:"array?",reflectToAttribute:!1},expandedIndexes:{value:[],type:"array"},expandMode:{allowedValues:["single","singleFitHeight","multiple","toggle","none"],value:"singleFitHeight",type:"string"},messages:{extend:!0,value:{en:{accordionItemRequired:'{{elementType}}: "{{method}}" requires an item from type "smart-accordion-item".',indexOutOfBound:'{{elementType}}: Out of bound index/indexes in "{{method}}" method.',invalidSettings:'{{elementType}}: "{{method}}" method accepts a string or an object as it\'s second parameter.',missingReference:"{{elementType}}: Missing reference to {{files}}.",noItems:"{{elementType}}: No child elements found.",overridingProperties:'{{elementType}}: Overriding properties {{property1}} and {{property2}} applied. The "{{property1}}" property is used by default.'}},type:"object"},reorder:{value:!1,type:"boolean"}}}static get listeners(){return{down:"_downHandler",focus:"_focusHandler",indexChange:"_indexChangeHandler",keydown:"_keyDownHandler",move:"_moveHandler",resize:"_resizeHandler",styleChanged:"_resizeHandler","document.up":"_upHandler","container.move":"_containerMoveHandler"}}template(){return'<div id="container" role="presentation">\n <content></content>\n </div>'}static get styleUrls(){return["smart.accordion.css"]}ready(){super.ready()}render(){this._createElement(),super.render()}propertyChangedHandler(e,t,n){const a=this;if("expandedIndexes"===e){if(t.toString()===n.toString())return;let i=[];if(a._items.length>0)for(let e=0;e<n.length;e++){let t=parseInt(n[e]);if(!isNaN(t)){if(a._expandModeIs(["single","singleFitHeight","toggle"])){i.length<1&&t>=0&&t<a._items.length&&i.push(t);break}t>=0&&t<=a._items.length&&-1===i.indexOf(t)&&i.push(t)}}if(0===i.length&&a._expandModeIs(["single","singleFitHeight"]))return n=t.slice(),a.expandedIndexes=n,void super.propertyChangedHandler(e,t,n);n=i;const o=a._compareExpandedIndexes(t,n);return a._toggleItems("collapse",o.collapse),a._toggleItems("expand",o.expand),a.expandedIndexes=n,void super.propertyChangedHandler(e,t,n)}switch(super.propertyChangedHandler(e,t,n),e){case"dataSource":a.render();break;case"disabled":a._setFocusable(),a._enableDisableHandler();break;case"expandMode":{if(0===a._items.length)break;if("multiple"===t&&"none"!==n||"none"===t&&"multiple"!==n){const e=a.expandedIndexes.slice(1);a._toggleItems("collapse",e),0===a.expandedIndexes.length&&a._expandModeIs(["single","singleFitHeight"])&&i()}else"toggle"===t&&a._expandModeIs(["single","singleFitHeight"])&&0===a.expandedIndexes.length&&i();const e=a.expandedIndexes[0];if(void 0===e)return;a._supportCSSVariables&&a._usedCSSVariables||("singleFitHeight"===t?a._items[e].$.accordionItemContent.style.height="":"singleFitHeight"===n&&(a._items[e].$.accordionItemContent.style.height=a._expandedItemsContainerHeight-1+"px")),"multiple"===n||"toggle"===n?a._items[e].$.label.removeAttribute("aria-disabled"):a._items[e].$.label.setAttribute("aria-disabled",!0);break}case"unfocusable":a._setFocusable()}function i(){a._toggleItems("expand",[0]),a.expandedIndexes=[0]}}appendChild(e){const t=this;if(!t.isCompleted||e instanceof HTMLElement&&(e.classList.contains("smart-resize-trigger-container")||e.classList.contains("smart-measure-element"))){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof Smart.AccordionItem||t.error(t.localize("accordionItemRequired",{method:"appendChild"})),t.insert(t._items.length,e)}collapse(e,t){const n=this;e=n._validateItemsIndex(e,"collapse"),isNaN(e)||!n._items[e].expanded||n._expandModeIs(["single","singleFitHeight"])&&n.expandedIndexes.indexOf(e)>-1||n._collapseItem(e,t)}expand(e,t){const n=this;e=n._validateItemsIndex(e,"expand"),isNaN(e)||n._items[e].expanded||(n._expandModeIs(["single","singleFitHeight","toggle"])&&n._toggleItems("collapse",n.expandedIndexes),n._expandItem(e,t))}insert(e,t){const n=this,a=0===n._items.length;let i,o;if(t||("number"==typeof e?t=[{label:"",content:""}]:(t=[{label:e?e.toString():"",content:e?e.toString():""}],e=0)),t instanceof HTMLElement)t instanceof Smart.AccordionItem?i=t:n.error(n.localize("accordionItemRequired",{method:"insert"}));else if(Array.isArray(t)){o=document.createDocumentFragment();for(let e=0;e<t.length;e++){const a=n._createItem(t[e]);o.appendChild(a)}}else i=t instanceof Object?n._createItem(t):"string"==typeof t||"number"==typeof t?n._createItem({label:t.toString(),content:t.toString()}):n._createItem({label:"",content:""});e>n._items.length?i?n.$.container.appendChild(i):n.$.container.appendChild(o):i?n.$.container.insertBefore(i,n._items[e]):n.$.container.insertBefore(o,n._items[e]),i&&(i.tabIndex=n._tabIndex),n._storeItems(),a&&n._expandModeIs(["single","singleFitHeight"])?n._expandItem(0):n.expandedIndexes=n._getExpandedIndexes(),n._updateExpanedContentHeight(),n._updateInlineHeight(),n._storeItemsCoordinates(),n._updateItemsIndexProperty()}insertBefore(e,t){const n=this;if(!n.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.insertBefore.apply(n,e.concat(Array.prototype.slice.call(arguments)))}void 0!==e&&void 0!==t&&e instanceof Smart.AccordionItem&&t instanceof Smart.AccordionItem||n.error(n.localize("accordionItemRequired",{method:"insertBefore"})),null!=t?(n.contains(t)||n.error(n.localize("referenceNodeNotChild",{argument:"referenceNode"})),n.insert(n._items.indexOf(t),e)):n.insert(n._items.indexOf(t),e)}removeAt(e){const t=this;let n;if(e instanceof HTMLElement)e instanceof Smart.AccordionItem?t.contains(e)||t.error(t.localize("referenceNodeNotChild",{argument:"node"})):t.error(t.localize("accordionItemRequired",{method:"remove"})),n=e,e=n.index;else{if(e=t._validateItemsIndex(e,"remove"),isNaN(e))return;n=t._items[e]}n&&(n.parentNode.removeChild(n),t._storeItems(),t._expandModeIs(["singleFitHeight"])&&(t._preventAnimation=!0),t._expandModeIs(["single","singleFitHeight"])&&e===t.expandedIndexes[0]&&t._items.length>0&&(t._expandItem(0),t._selectedItem=t._items[0],t._selectedItemIndex=0,t._itemIsFocussed=!0),t.expandedIndexes=t._getExpandedIndexes(),t._updateExpanedContentHeight(),t._updateInlineHeight(),t._storeItemsCoordinates(),t._updateItemsIndexProperty())}removeChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}e instanceof HTMLElement||t.error(t.localize("accordionItemRequired",{method:"removeChild"})),"smart-resize-trigger-container"!==e.className?(e instanceof Smart.AccordionItem||t.error(t.localize("accordionItemRequired",{method:"removeChild"})),t.contains(e)||t.error(t.localize("referenceNodeNotChild",{argument:"node"})),t.removeAt(e)):super.removeChild(e)}_setFocusable(){const e=this;if(e.disabled||e.unfocusable){e.removeAttribute("tabindex");for(let t=0;t<e._items.length;t++)e._items[t].removeAttribute("tabindex")}else{e.tabIndex=e._tabIndex;for(let t=0;t<e._items.length;t++)e._items[t].tabIndex=e._tabIndex}}update(e,t){const n=this;if(e=n._validateItemsIndex(e,"update"),isNaN(e))return;let a=n._items[e];if(t||n.error(n.localize("invalidSettings",{elementType:n.nodeName.toLowerCase(),method:"update"})),a)if(Array.isArray(t)&&(t=0===t.length?{label:"",content:""}:t[0]),"string"==typeof t)a.content=t;else for(let e in t)a[e]=t[e];const i=n._getItemsHeights(e);n._updateExpanedContentLocalHeight(n._items[e],i),n._updateInlineHeight(),n._storeItemsCoordinates()}_adjustHeightValue(e){const t=this,n=t._items.length;let a,i;for(let e=0;e<n&&(t._items[e].expanded?a=t._items[e]:i=t._items[e],!a||!i);e++);if(a||(a=t._items[0]),!a&&!i)return;const o=a.expanded;a.expanded=!0;const r=window.getComputedStyle(a,null),s=!!i&&window.getComputedStyle(i,null),d=parseInt(r.getPropertyValue("margin-top"))+parseInt(r.getPropertyValue("margin-bottom"))+10,l=s?parseInt(s.getPropertyValue("margin-top"))+parseInt(s.getPropertyValue("margin-bottom")):0;return a.expanded=o,e-((n-1)*l+d)}_collapseItem(e,t){const n=this;let a=n._items[e];if(a.expanded&&("none"!==n.expandMode||!t)){if(a.expanded=!1,n.$.fireEvent("collapsing",{index:e,label:a.label,content:a.content.innerHTML}),n.expandedIndexes.indexOf(e)>-1){let t=n.expandedIndexes.indexOf(e),a=n.expandedIndexes.slice();a.splice(t,1),n.expandedIndexes=a}a.$.accordionItemContent.style.height="",n._handleAnimationsDuration(a,e,"collapse")}}_compareExpandedIndexes(e,t){let n=[],a=[],i=[],o=e.length,r=t.length;for(let i=0;i<o;i++)-1===t.indexOf(e[i])?-1===n.indexOf(e[i])&&n.push(e[i]):-1===a.indexOf(e[i])&&a.push(e[i]);for(let e=0;e<r;e++)-1===a.indexOf(t[e])&&i.push(t[e]);return{collapse:n,expand:i}}_processDataSource(){const e=this.dataSource;if(null===e||!e)return;let t="";for(let a=0;a<e.length;a++){const i=e[a];t+=`<smart-accordion-item label="${(n=i).label}">${n.content}</smart-accordion-item>`}var n;this.$.container.innerHTML=t}_createElement(){const e=this;null!==e.dataSource&&e._processDataSource(),e._reorderItemsByIndex(),e._usedCSSVariables=Boolean(window.getComputedStyle(e.$.container).getPropertyValue("--smart-accordion-animation-duration")),e._supportCSSVariables=Smart.Utilities.Core.CSSVariablesSupport(),e._storeItems(),e._enableDisableHandler(),e._expandedIndexesHandler(),e._updateExpanedContentHeight(),e._tabIndex=e.tabIndex<=0?0:e.tabIndex,e._setFocusable(),e._updateItemsIndexProperty(),e._updateInlineHeight();for(let t=0;t<e._items.length;t++)e._items[t].setAttribute("part","smart-accordion-item"),e._items[t].$.arrow.classList.add("smart-animate-trigger")}_createItem(e){const t=this,n=document.createElement("smart-accordion-item");if(e)return n.disabled=t.disabled,t._tabIndex>-1&&(n.tabIndex=t._tabIndex),"string"==typeof e||"number"==typeof e?(n.label=e+"",n.content=e+"",n):(n.label=e.label||"",n.content=e.content||"",n)}_downHandler(e){const t=this;if(t.disabled||t.readonly||"none"===t.expandMode||t._toggled)return;const n=t.enableShadowDOM&&t.shadowRoot?t.shadowRoot.elementFromPoint(e.pageX-window.pageXOffset,e.pageY-window.pageYOffset):e.originalEvent.target,a=n.closest(".smart-accordion-item-header"),i=n.closest("smart-accordion-item");a?(t._pointerPosition=e.pageY-window.pageYOffset,t._selectedItem=i,t._itemIsPressed=t._itemIsFocussed=!0,t._reorderedIndex=t._selectedItemIndex=t._items.indexOf(i),t._storeItemsCoordinates()):i&&(i.focused=!0)}_enableDisableHandler(){const e=this;if(e.disabled)for(let t=0;t<e._items.length;t++)e._items[t].disabled=!0;else for(let t=0;t<e._items.length;t++)e._items[t].disabled=!1}_expandedIndexesHandler(){const e=this;let t=e._getExpandedIndexes("initial"),n=t.length,a=e.expandedIndexes.length;if(0!==e._items.length){if(0===a&&n>0&&(e.expandedIndexes=t,a=n),e._expandModeIs(["multiple","none"])||1===a)return e._toggleItems("expand",e.expandedIndexes),void(e._animationAfterInitialization=!0);switch(e.expandMode){case"single":case"singleFitHeight":0===a?e._toggleItems("expand",[0]):a>1&&(e._toggleItems("collapse",e.expandedIndexes.splice(0,1)),e._toggleItems("expand",e.expandedIndexes));break;case"toggle":a>1&&(e._toggleItems("collapse",e.expandedIndexes.splice(0,1)),e._toggleItems("expand",e.expandedIndexes))}e._animationAfterInitialization=!0}else e._animationAfterInitialization=!0}_expandItem(e,t){const n=this;let a=n._items[e];if(!(a.expanded||"none"===n.expandMode&&t)){if(a.$.container.style.getPropertyValue("--smart-accordion-expanded-content-local-height")||(a.expanded=!0,a.$.container.style.setProperty("--smart-accordion-expanded-content-local-height",a.$.accordionItemContent.scrollHeight+"px"),a.expanded=!1),a.expanded=!0,n.$.fireEvent("expanding",{index:e,label:a.label,content:a.content.innerHTML}),-1===n.expandedIndexes.indexOf(e)){let t=n.expandedIndexes.slice();t.push(e),n.expandedIndexes=t}n._supportCSSVariables&&n._usedCSSVariables||"singleFitHeight"!==n.expandMode||(a.$.accordionItemContent.style.height=n._expandedItemsContainerHeight-1+"px"),n._handleAnimationsDuration(a,e,"expand")}}_expandModeIs(e){return e.indexOf(this.expandMode)>-1}_focusHandler(){const e=this;e.disabled||0===e._items.length||(e._itemIsFocussed?e._selectedItem.focused=!1:e._items[0].focused=!1)}_getExpandedIndexes(e){const t=this,n=[];for(let a=0;a<t._items.length;a++)"initial"===e?t._items[a].hasAttribute("expanded")&&(n.push(a),t._items[a].removeAttribute("expanded")):t._items[a].expanded&&n.push(a);return n.slice()}_getItemsHeights(e){const t=this._items,n=t.length;let a=[];if(0!==n){if(!isNaN(e)&&e>=0&&e<n){const n=t[e];let a=0;return n.expanded?a=n.$.accordionItemContent.scrollHeight:(n.expanded=!0,a=n.$.accordionItemContent.scrollHeight,n.expanded=!1),a+"px"}for(let e=0;e<n;e++){const n=t[e];let i=0;n.expanded?i=n.$.accordionItemContent.scrollHeight:(n.expanded=!0,i=n.$.accordionItemContent.scrollHeight,n.expanded=!1),a.push(i+"px")}return this._heightCalcAfterInitialization=!0,a}}_handleAnimationsDuration(e,t,n){const a=this;if(!a._animationAfterInitialization)return;if(1===a._items.length&&"singleFitHeight"===a.expandMode)return void a.$.fireEvent(n,{index:t,label:e.label,content:e.content.innerHTML});if(!1===a.hasAnimation||!a._supportCSSVariables)return void a.$.fireEvent(n,{index:t,label:e.label,content:e.content.innerHTML});if(a._preventAnimation)return a.$.fireEvent(n,{index:t,label:e.label,content:e.content.innerHTML}),void(a._preventAnimation=!1);a._toggled=!0;let i,o=window.getComputedStyle(a).animationDuration;if(o.indexOf("ms")>-1)o=parseFloat(o.substring(0,o.length-2)),i=isNaN(o)||o<0?0:o-50;else{if(!(o.indexOf("s")>-1))return void a.$.fireEvent(n,{index:t,label:e.label,content:e.content.innerHTML});o=parseFloat(o.substring(0,o.length-1)),i=isNaN(o)||o<0?0:1e3*o-50}e&&(e.$.addClass("smart-toggled-item"),a.$container.addClass("smart-toggling"),setTimeout((function(){e.$.removeClass("smart-toggled-item"),a.$container.removeClass("smart-toggling"),a.$.fireEvent(n,{index:t,label:e.label,content:e.content.innerHTML}),a._toggled=!1}),i))}_indexChangeHandler(e){const t=this,n=t._items,a=n.length,i=e.detail;i.newIndex>=a?t.$.container.appendChild(n[i.oldIndex]):i.newIndex>i.oldIndex?t.$.container.insertBefore(n[i.oldIndex],n[i.newIndex+1]):t.$.container.insertBefore(n[i.oldIndex],n[i.newIndex]);let o=t.enableShadowDOM&&t.shadowRoot?t.shadowRoot.querySelectorAll("smart-accordion-item"):t.getElementsByTagName("smart-accordion-item");t._items=Array.from(o),t._updateItemsIndexProperty()}_keyDownHandler(e){const t=this,n=e.key;if("none"===t.expandMode||t.disabled||t.readonly||t._toggled)return;const a=(t.shadowRoot?t.shadowRoot.activeElement:document.activeElement)||document.activeElement;if(-1===["ArrowLeft","ArrowDown","ArrowRight","ArrowUp","End","Home"," ","Enter","Tab"].indexOf(n)||!(a instanceof Smart.AccordionItem))return;"Tab"!==n&&e.preventDefault();let i,o,r=t._items.length,s=r-1;for(let e=0;e<r;e++){let n=t._items[e];n.focused&&(i=n,o=e)}switch(void 0===o&&t._items[0]&&(o=0,t._items[0].focused=!0),n){case"Tab":e.shiftKey?l("up"):l("down");break;case"ArrowLeft":t.collapse(o);break;case"ArrowDown":l("down");break;case"ArrowRight":t.expand(o);break;case"ArrowUp":l("up");break;case"End":d(s);break;case"Home":d(0);break;case" ":case"Enter":if(i&&i.expanded)return void t.collapse(o);t.expand(o);break;default:return}function d(e){e===o||isNaN(e)||(i&&(i.focused=!1),o=e,i=t._items[o],i&&(i.focused=!0))}function l(e){d("up"!==e?o+1>s?s:o+1:o-1<0?0:o-1)}}_containerMoveHandler(e){"touchmove"===e.originalEvent.type&&e.originalEvent.preventDefault()}_moveHandler(e){const t=this;if(e.stopPropagation(),!(!t._itemIsPressed||!t.reorder||t.readonly||t._items.length<2||!t.$container.hasClass("smart-reordering")&&Math.abs(e.pageY-t._pointerPosition)<5))if(t._dragStart){if(t.$container.hasClass("smart-reordering")||t.$container.addClass("smart-reordering"),!t._dragging){const n=t._selectedItem;t.$.fireEvent("dragStart",{position:{left:e.pageX,top:e.pageY},target:e.originalEvent.target,index:t._selectedItemIndex,label:n.label,content:n.content.innerHTML}),t._selectedItem.dragged=t._dragging=!0}if(t.hasAnimation){const e=t._selectedItem.querySelector(".smart-ripple");e&&(e.style.height=0)}const n=e.clientY;let a=!1;for(let e=0;e<t._itemsCoordinates.length;e++){const i=t._itemsCoordinates[e];if(n>=i.fromY&&n<=i.toY){a=e;break}}const i=t._items[a];if(!1!==a&&i!==t._selectedItem){if(t._lastReorderedItem&&i===t._lastReorderedItem)return;if(t._lastReorderedItem=i,Math.abs(t._reorderedIndex-a)>1){const e=t._reorderedIndex-a<0?-1:1;t._swapItems(t._reorderedIndex,a+e)}return t._swapItems(t._reorderedIndex,a),t._reorderedIndex=a,void t._storeItemsCoordinates()}t._lastReorderedItem=void 0}else t._dragStart=!0}_reorderItemsByIndex(){const e=this;let t=e.enableShadowDOM&&e.shadowRoot?e.shadowRoot.querySelectorAll("smart-accordion-item"):e.$.container.children,n=Array.from(t),a=!1,i=n.map((function(e){return null!==e.index?a=!0:e.index=0,e.index}));if(!a)return;const o=n.length;if(o<2)return;let r=i.slice();if(r.sort((function(e,t){return parseInt(e)-parseInt(t)})),i.toString()!==r.toString())for(let n=0;n<o;n++){let a;for(let e=0;e<o;e++)t[e].index===r[n]&&(a=t[e]);e.$.container.insertBefore(a,t[n])}}_resizeHandler(){this.refresh()}refresh(){const e=this;e._updateExpanedContentHeight(),e._updateInlineHeight(),e._storeItemsCoordinates()}_storeItems(){const e=this,t=e.enableShadowDOM&&e.shadowRoot?e.shadowRoot.querySelectorAll("smart-accordion-item"):e.$.container.children;if(e._items=Array.from(t),0===e._items.length)return void e.$container.addClass("smart-empty");e.$container.removeClass("smart-empty");const n=e._getItemsHeights();for(let t=0;t<e._items.length;t++)e._updateExpanedContentLocalHeight(e._items[t],n[t])}_storeItemsCoordinates(){const e=this;if(e.disabled||!e.reorder)return;const t=[];for(let n=0;n<e._items.length;n++){const a=e._items[n].getBoundingClientRect();t.push({fromY:a.top+(window.scrollY||window.pageYOffset),toY:a.bottom+(window.scrollY||window.pageYOffset)})}e._itemsCoordinates=t}_swapItems(e,t){const n=this,a=Math.min(e,t),i=Math.max(e,t),o=n._items;let r=n.expandedIndexes.slice();if(n._items[e].expanded&&!n._items[t].expanded){const a=r.indexOf(e);r[a]=t,n.expandedIndexes=r.slice()}else if(n._items[t].expanded&&!n._items[e].expanded){const a=r.indexOf(t);r[a]=e,n.expandedIndexes=r.slice()}n.selectedIndex=n.selectedIndex===e?t:e,n.$.container.insertBefore(o[i],o[a]),function(e,t,n){const a=e[n];e[n]=e[t],e[t]=a}(o,e,t),n._items[e].$.removeClass("hovered"),n._reorderedIndex=t}_toggleItems(e,t){const n=this,a=t.length;if(a>0)for(let i=0;i<a;i++)n["_"+e+"Item"](t[i])}_updateExpanedContentHeight(){const e=this;e.$.container.style.setProperty("--smart-accordion-item-header-height","");const t=e._items.length,n=e.$.container.offsetHeight,a=e._items[e.expandedIndexes[0]];let i=0,o=0,r=0,s=0;if(1===t){let t=e._items[0],n=t.expanded;t.expanded=!1,i=t.offsetHeight,o=t.$.accordionItemHeader.offsetHeight,t.expanded=n}else for(;0===i&&s<t;){const t=e._items[s];t instanceof Smart.AccordionItem&&!t.expanded&&(i=t.$.accordionItemHeader.offsetHeight),o=t.$.accordionItemHeader.offsetHeight,s++}t>1&&a instanceof Smart.AccordionItem&&(r=a.$.accordionItemHeader.offsetHeight-o);const d=getComputedStyle(e.$.root);let l=n-i*t-r-parseFloat(d.paddingBottom)-parseFloat(d.paddingTop);"singleFitHeight"===e.expandMode&&(l=e._adjustHeightValue(l)),l=l>=0?l:0,e.$.container.style.setProperty("--smart-accordion-expanded-content-height",l+"px"),e.$.container.style.setProperty("--smart-accordion-item-header-height",o+"px"),e._expandedItemsContainerHeight=l}_updateExpanedContentLocalHeight(e,t){this._supportCSSVariables&&this._usedCSSVariables&&e.$.container.style.setProperty("--smart-accordion-expanded-content-local-height",t)}_updateInlineHeight(){const e=this;e._supportCSSVariables&&e._usedCSSVariables||"singleFitHeight"!==e.expandMode||0===e._items.length||(e._items[e.expandedIndexes[0]].$.accordionItemContent.style.height=e._expandedItemsContainerHeight-1+"px")}_updateItemsIndexProperty(){const e=this;let t=[];for(let n=0;n<e._items.length;n++)e._items[n]._setIndex(n),e._items[n].expanded&&t.push(n);e.expandedIndexes=t.slice()}_upHandler(e){const t=this;if(t._itemIsPressed&&!t.disabled&&!t.readonly){for(let e=0;e<t._items.length;e++)e!==t._selectedItemIndex&&(t._items[e].focused=!1);if(t._selectedItem.focused=!0,t._dragging){const n=t._selectedItem;t.$container.removeClass("smart-reordering"),t.$.fireEvent("dragEnd",{position:{left:e.pageX,top:e.pageY},target:e.originalEvent.target,index:t._selectedItemIndex,label:n.label,content:n.content.innerHTML})}else t._selectedItem.expanded?t.collapse(t._selectedItemIndex,!0):t.expand(t._selectedItemIndex,!0);t._reorderedIndex=void 0,t._dragStart=!1,t._dragging=!1,t._itemIsPressed=!1,t._selectedItem.dragged=!1,t._updateItemsIndexProperty()}}_validateItemsIndex(e,t){const n=this;if(!(isNaN(parseInt(e))||e<0||e>n._items.length-1))return parseInt(e);n.log(n.localize("indexOutOfBound",{elementType:n.nodeName.toLowerCase(),method:t}))}});
|
|
73
73
|
Smart("smart-rating",class extends Smart.BaseElement{static get properties(){return{max:{value:5,type:"number"},name:{value:"rating",type:"string"},value:{value:3,type:"number"}}}static get listeners(){return{"stars.click":"_clickHandler","stars.move":"_moveHandler","stars.mouseout":"_mouseoutHandler"}}refresh(){}attached(){this.value>this.max&&(this.value=this.max),this._updateActiveStars(this.value)}template(){return'<div id="container" role="presentation">\n <div id="stars" class="smart-content" role="presentation">\n <template>\n <div id="ratingStars" *items={{max}} role="presentation"><span class="rating-star" index={{item}} role="button" aria-label="Star"></span></div>\n </template>\n </div>\n <input class="smart-hidden" value="[[value]]" name="[[max]]"></input>\n </div>'}propertyChangedHandler(t,e,a){switch(t){case"value":case"max":this._updateActiveStars(this.value);break;default:super.propertyChangedHandler(t,e,a)}}render(){const t=this;t.setAttribute("role","group"),t.disabled||t.setAttribute("tabindex","0"),t.$.stars.firstElementChild.setAttribute("role","presentation"),super.render()}_clickHandler(t){if(t.target.className.includes("rating-star")){const e=t.target,a=e.parentNode,s=Array.prototype.indexOf.call(a.children,e);this.value=s+1,this._updateActiveStars(this.value),this._updateHoveredStars(0)}}_moveHandler(t){const e=this,a=t=>{const e=t.getBoundingClientRect();return{left:e.left+window.scrollX,top:e.top+window.scrollY}},s=(()=>{const s=e.querySelectorAll("#ratingStars .rating-star");for(let e=0;e<s.length;e++){const r=a(s[e]);if(t.x>=r.left&&t.x<=r.left+s[e].offsetWidth)return e}})();e._updateHoveredStars(s+1)}_mouseoutHandler(){this._updateHoveredStars(0)}_updateActiveStars(t){const e=this.value,a=this.getElementsByClassName("rating-star");for(let e=0;e<a.length;e++)e<t?a[e].classList.add("active"):a[e].classList.remove("active");this.$.fireEvent("change",{value:t,oldValue:e}),this._updateTargetValue()}_updateTargetValue(){const t=this;if(t.dataset.target){const e=document.querySelector(t.dataset.target);if(e){const a=t.dataset.property,s=t.value;a&&void 0!==e[a]&&(e[a]=s)}}}getValue(){return this.value}setValue(t){this.value=t,this._updateActiveStars(this.value),this._updateHoveredStars(0)}_updateHoveredStars(t){if(Smart.Utilities.Core.isMobile)return;const e=this.getElementsByClassName("rating-star");for(let a=0;a<e.length;a++)a<t?e[a].classList.add("hover"):e[a].classList.remove("hover")}});
|
|
74
|
-
Smart("smart-calendar",class extends Smart.BaseElement{static get properties(){return{animationSettings:{value:null,type:"object"},calendarMode:{value:"default",allowedValues:["default","classic"],type:"string"},dayNameFormat:{value:"firstTwoLetters",allowedValues:["narrow","firstTwoLetters","long","short"],type:"string"},dateFormatFunction:{value:null,type:"function"},disableAutoNavigation:{value:!1,type:"boolean"},displayMode:{value:"month",allowedValues:["month","year","decade"],type:"string"},displayModeView:{value:"table",allowedValues:["table","list"],type:"string"},dropDownHeight:{value:"200",type:"string"},dropDownWidth:{value:"",type:"string"},firstDayOfWeek:{value:0,type:"number",defaultValue:0,validator:"_firstDayOfWeekValidator"},footerTemplate:{value:null,type:"any"},headerTemplate:{value:null,type:"any"},hideDayNames:{value:!1,type:"boolean"},hideOtherMonthDays:{value:!1,type:"boolean"},hideTooltipArrow:{value:!1,type:"boolean"},importantDates:{value:[],type:"array",defaultValue:[]},importantDatesTemplate:{value:null,type:"any"},max:{value:new Date(2100,0,1),type:"any",defaultValue:new Date(2100,0,1)},min:{value:new Date(1900,0,1),type:"any",defaultValue:new Date(1900,0,1)},months:{value:1,type:"number",defaultValue:1,validator:"_monthsValidator"},monthNameFormat:{value:"long",allowedValues:["narrow","firstTwoLetters","long","short","2-digit","numeric"],type:"string"},name:{value:"",type:"string"},restrictedDates:{value:[],type:"array",defaultValue:[]},scrollButtonsNavigationMode:{value:"landscape",allowedValues:["portrait","landscape"],type:"string"},scrollButtonsPosition:{value:"both",allowedValues:["near","far","both"],type:"string"},selectedDates:{value:[],reflectToAttribute:!1,type:"array"},selectionMode:{value:"default",allowedValues:["none","default","one","oneExtended","many","zeroOrMany","oneOrMany","zeroOrOne","week","range"],type:"string"},spinButtonsDelay:{value:80,type:"number"},spinButtonsInitialDelay:{value:0,type:"number"},titleTemplate:{value:null,type:"any"},tooltip:{value:!1,type:"boolean"},tooltipArrow:{value:!0,type:"boolean"},tooltipArrowDirection:{allowedValues:["bottom","top","left","right","none"],value:"bottom",type:"string"},tooltipDelay:{value:100,type:"number"},tooltipOffset:{value:[],type:"array"},tooltipPosition:{value:"auto",allowedValues:["auto","bottom","top","left","right","absolute"],type:"string"},tooltipTemplate:{value:null,type:"any"},view:{value:"portrait",allowedValues:["landscape","portrait"],type:"string"},viewSections:{value:["header"],type:"array"},weekNumbers:{value:!1,type:"boolean"},weeks:{value:6,type:"number",defaultValue:6,validator:"_weeksValidator"},yearFormat:{value:"numeric",allowedValues:["2-digit","numeric"],type:"string"}}}static get listeners(){return{"container.down":"_downHandler","document.up":"_documentUpHandler","body.move":"_moveHandler","container.wheel":"_containerWheelHandler","body.focus":"_bodyFocusStateHandler","body.blur":"_bodyBlurStateHandler","header.click":"_headerClickHandler","header.change":"_headerChangeHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler","container.mouseover":"_mouseEventsHandler","container.mouseout":"_mouseEventsHandler","container.open":"_popupEventHandler","container.close":"_popupEventHandler"}}static get methods(){return{select:"select(date=new Date(): date|string): void",clearSelection:"clearSelection(): void",today:"today(): date",navigate:"navigate(step: date|string|int): bool"}}static get styleUrls(){return["smart.calendar.css"]}template(){return'<div id="container" role="presentation">\n <div id="title" class="smart-calendar-title" role="heading" aria-level="1">\n <div id="yearContainer" class="smart-calendar-year-container" role="button"></div>\n <div id="dateContainer" class="smart-calendar-date-container smart-calendar-selected" role="button"></div>\n </div>\n <div id="calendarContainer" class="smart-calendar-container">\n <div id="header" class="smart-calendar-header">\n <smart-repeat-button prev-month class="smart-calendar-button" id="previousMonthButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Previous month">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n <div id="dateElement" class="smart-calendar-date-element" role="presentation">\n <div id="defaultHeaderDate" role="button"></div>\n <div id="classicHeaderDate">\n <div id="monthElement" class="smart-calendar-month-element" disabled="[[disabled]]" role="presentation">\n </div>\n <input class="smart-calendar-year-element" id="yearElement" disabled="[[disabled]]" readonly="[[readonly]]" aria-label="Year" />\n <span class="smart-calendar-year-elements">\n <smart-repeat-button next-year class="smart-calendar-button" id="nextYearButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Next year">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button prev-year class="smart-calendar-button" id="previousYearButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Previous year">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n </div>\n <smart-repeat-button next-month class="smart-calendar-button" id="nextMonthButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Next month">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n </div>\n <div id="body" class="smart-content smart-calendar-body" role="presentation">\n <div id="monthsContainer" class="smart-calendar-months-container" role="presentation">\n <div id="month" class="smart-calendar-month" role="grid">\n <div id="monthName" class="smart-calendar-month-name"></div>\n <div id="weekTitles" class="smart-calendar-week-titles" role="row">\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n </div>\n <div id="weeks" class="smart-calendar-weeks" role="rowgroup">\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n </div>\n </div>\n </div>\n <div id="dateViewContainer" class="smart-calendar-date-view-container smart-hidden">\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n </div>\n <div id="monthsSeparator" class="smart-calendar-month-separator"></div>\n <div id="nextMonthsContainer" class="smart-calendar-next-months-container" aria-hidden="true"></div>\n <div id="animationPanel" class="smart-calendar-animation-panel smart-hidden"></div>\n </div>\n <div id="footer" class="smart-calendar-footer smart-hidden">\n <div id="selectedDatesRange"></div>\n </div>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>\n </div>'}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const a=e.dataset.property,n=e.selectedDates.toString();a&&void 0!==t[a]&&(t[a]=n)}}}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const n=this;switch(e){case"animationSettings":n._applyAnimationSettings();break;case"disabled":case"unfocusable":n._setFocusable();break;case"calendarMode":case"dropDownWidth":case"dropDownHeight":n.displayMode="month",n._refreshHeaderElements(),n._refreshCalendarMode(),n._setDisplayModeContent();break;case"dayNameFormat":n._refreshDayOfWeekTitles(n.$.month);break;case"dateFormatFunction":{let e=n.$.monthsContainer.children;for(let t=0;t<e.length;t++)e[t].firstElementChild.innerHTML=a?a(e[t]._date):n._monthsNames[e[t]._date.getMonth()]+" "+e[t]._date.toLocaleDateString(n.locale,{year:n.yearFormat});n._refreshHeaderTitle();break}case"displayMode":if("classic"===n.calendarMode&&"month"!==a){n[e]="month";break}n._setDisplayMode(t,a);break;case"displayModeView":n._applyAnimationSettings(!0),"month"!==n.displayMode&&n._setDisplayModeContent();break;case"firstDayOfWeek":n._handleMonths(),n._refreshDayOfWeekTitles();break;case"hideTooltipArrow":n.$.tooltip&&(n.$.tooltip.arrow=!a);break;case"titleTemplate":case"headerTemplate":case"footerTemplate":n._handleLayoutTemplate(n.$[e.split(/[T]/)[0]],a),"titleTemplate"===e?n._refreshTitle():"headerTemplate"===e?n._refreshHeaderTitle():n._refreshFooter();break;case"importantDates":n.importantDates=n._getValidDates(a),n._refreshImportantDates();break;case"importantDatesTemplate":n._handleImportantDateTemplate(),n._refreshImportantDates();break;case"locale":n._refreshMonthNames(),n._refreshDayOfWeekTitles(),n._refreshHeaderTitle(),n._refreshTitle(),n._refreshFooter(),n.displayMode&&"month"!==n.displayMode&&n._setDisplayModeContent();break;case"max":case"min":n._validateMinMax(e,a,t),n._validateSelectedDates(),n._noFocusingRequired=!1,n._refreshHeaderElements();break;case"months":n._handleMonths();break;case"monthNameFormat":n._refreshCalendarMode(),n._refreshHeaderTitle();break;case"restrictedDates":n._setRestrictedDates(n.restrictedDates=n._getValidDates(a));break;case"rightToLeft":n._refreshDayOfWeekTitles(),n._handleMonths();break;case"scrollButtonsNavigationMode":n._setScrollButtonsNavigationMode();break;case"selectedDates":if(n._clearSelection(!0),n._validateSelectedDates(n._getValidDates(a)),n._applySelectionMode(!0),n._viewDates){let e=n.selectedDates[n.selectedDates.length-1];n._isDateInView(e)?n.selectedDates.map((e=>n._selectDate(e,!0,!0))):n._handleMonths(e)}n._refreshFooter(),n._setWeeksVisibility(n.$.monthsContainer),n.$.hiddenInput.value=n.selectedDates.toString(),n.isInitialized&&(n.$.fireEvent("change",{value:n.selectedDates}),n._updateTargetValue()),n._refreshTitle(),"month"!==n.displayMode&&n._setDisplayModeContent();break;case"selectionMode":n._applySelectionMode(!1,t),n._refreshTitle();break;case"tooltip":n._handleTooltip();break;case"tooltipArrow":case"tooltipArrowDirection":case"tooltipDelay":case"tooltipOffset":case"tooltipPosition":case"tooltipTemplate":if(n.$.tooltip){const t=e.replace("tooltip","");n.$.tooltip[t.charAt(0).toLowerCase()+t.slice(1)]=a}break;case"view":n._refreshTitle();break;case"viewSections":a.indexOf("title")>-1?n.$title.removeClass("smart-hidden"):n.$title.addClass("smart-hidden"),n._refreshTitle(),a.indexOf("header")>-1?n.$header.removeClass("smart-hidden"):n.$header.addClass("smart-hidden"),n._refreshHeaderTitle(),a.indexOf("footer")>-1?n.$footer.removeClass("smart-hidden"):n.$footer.addClass("smart-hidden"),n._refreshFooter(),n._setFocusable();break;case"weeks":n._setWeeksVisibility(n.$.monthsContainer);break;case"yearFormat":if(n._refreshCalendarMode(),n._refreshFooter(),n.months>1&&"month"===n.displayMode){let e=n._animationStarted?n.$.nextMonthsContainer.children:n.$.monthsContainer.children;for(let t=0;t<e.length;t++)e[t].firstElementChild.innerHTML=n.dateFormatFunction?n.dateFormatFunction(e[t]._date):n._monthsNames[e[t]._date.getMonth()]+" "+e[t]._date.toLocaleDateString(n.locale,{year:a})}n._refreshTitle(),n._refreshHeaderTitle()}}ready(){super.ready();const e=this;e._keysPressed={},e._applyAnimationSettings(),e.importantDates=e._getValidDates(e.importantDates),e.restrictedDates=e._getValidDates(e.restrictedDates)}render(){const e=this;e.setAttribute("role","dialog"),e._refreshMonthNames(),e._validateMinMax(),e._validateSelectedDates(e._getValidDates(e.selectedDates)),e._handleLayoutTemplate(e.$.title,e.titleTemplate),e._handleLayoutTemplate(e.$.header,e.headerTemplate),e._handleLayoutTemplate(e.$.footer,e.footerTemplate),e._handleImportantDateTemplate(),e._setFocusable(),e._refreshDayOfWeekTitles(),e._applySelectionMode(!0),e._handleMonths(0===e.selectedDates.length?new Date((new Date).setHours(0,0,0,0)):e.selectedDates[e.selectedDates.length-1]),e._handleTooltip(),e._updateViewSectionsVisibility(),e._setScrollButtonsNavigationMode(),e._refreshCalendarMode(),e._setDisplayMode(),e._refreshTitle(),e._refreshFooter(),e._refreshImportantDates(),e.$.monthElement&&e.$.monthElement._setDropDownSize&&e.$.monthElement._setDropDownSize(),e._changeEventFired=0,e.$.hiddenInput.value=e.selectedDates.toString(),e.shadowRoot&&e.appendChild(e.$.hiddenInput),e.isInitialized=!0,super.render()}refresh(){this.isInitialized&&this.render()}_updateViewSectionsVisibility(){const e=this;e.viewSections.indexOf("title")>-1?e.$title.removeClass("smart-hidden"):e.$title.addClass("smart-hidden"),e.viewSections.indexOf("header")>-1?e.$header.removeClass("smart-hidden"):e.$header.addClass("smart-hidden"),e.viewSections.indexOf("footer")>-1?e.$footer.removeClass("smart-hidden"):e.$footer.addClass("smart-hidden")}clearSelection(){this._clearSelection()}_setFocusable(){const e=this;let t=e.tabIndex>0?e.tabIndex:0;function a(e,a){if(a)return e&&e instanceof a?("function"==typeof e._setFocusable&&e.isCompleted?e.unfocusable=t<=-1:e.setAttribute("tabindex",t),e):e||void 0}(e.disabled||e.unfocusable)&&(t=-1),e.$.previousMonthButton=a(e.$.previousMonthButton,Smart.Button),e.$.nextMonthButton=a(e.$.nextMonthButton,Smart.Button),e.$.nextYearButton=a(e.$.nextYearButton,Smart.Button),e.$.previousYearButton=a(e.$.previousYearButton,Smart.Button),e.$.monthElement=a(e.$.monthElement,Smart.Input),e.$.yearElement=a(e.$.yearElement,HTMLInputElement),e.viewSections.indexOf("title")>-1&&(e.$.dateContainer.setAttribute("tabindex",t),e.$.yearContainer.setAttribute("tabindex",t)),e.$.body.setAttribute("tabindex",t),"default"===e.calendarMode?e.$.dateElement.setAttribute("tabindex",t):e.$.dateElement.removeAttribute("tabindex"),e.unfocusable?e.removeAttribute("tabindex"):e.tabIndex=e.readonly&&!e.disabled?e.tabIndex>0?e.tabIndex:0:t}static get requires(){return{"Smart.DropDownList":"smart.dropdownlist.js","Smart.ListBox":"smart.listbox.js","Smart.RepeatButton":"smart.button.js","Smart.Tooltip":"smart.tooltip.js"}}navigate(e){const t=this;let a,n,l;if(e){if("number"==typeof e){if(e=parseInt(e),isNaN(e)||0===e)return!1;if(6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode){let l,i;t._focusedCell||t._focusCell();const s=[].slice.call(t._focusedCell.closest(".smart-calendar-weeks").children).filter((e=>!e.classList.contains("smart-hidden")));e<0?(i=s[0].querySelectorAll(".smart-calendar-cell"),l=t.rightToLeft?i[i.length-1]:i[0]):(i=s[s.length-1].querySelectorAll(".smart-calendar-cell"),l=t.rightToLeft?i[0]:i[i.length-1]),n=new Date(l.value),n.setDate(n.getDate()+e),a=n}else a=t._getNextDate(e)}else{if(a=e=t._getValidDate(e),l=!0,isNaN(a.getTime()))return!1;const i=t._viewDates[0];if(i&&a.getMonth()===i.getMonth()&&a.getFullYear()===i.getFullYear())return!1;6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&(n=a)}return!(!a||t.$.fireEvent("navigationChanging",{value:new Date(a),type:t.displayMode}).defaultPrevented||("month"!==t.displayMode?(!l&&t.hasAnimation?(t.$nextMonthsContainer.addClass("smart-calendar-date-view-container"),"list"===t.displayModeView?t._setDisplayModeContent(a):t._navigationDate&&t._navigationDate.getTime()===a.getTime()||t._animateNavigation(a,e)):t._setDisplayModeContent(a),t.$.fireEvent("navigationChange",{value:new Date(a),type:t.displayMode}),0):(t.hasAnimation?(t._animateNavigation(a,e),t.$nextMonthsContainer.hasClass("smart-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-date-view-container")):(t._handleMonths(a),t._refreshHeaderElements(),t._refreshHeaderTitle()),n&&(t._focusCell(t._getCellByDate(n,t._animationStarted?t.$.nextMonthsContainer:void 0),!0),t._updateWeeksVisibility(e)),t.$.fireEvent("navigationChange",{value:new Date(a),type:t.displayMode}),0)))}}set value(e){this.select(e)}get value(){return this.selectedDates&&this.selectedDates.length>0?this.selectedDates[0]:null}select(e){const t=this;t._viewDates&&void 0!==t._viewDates[0]&&"none"!==t.selectionMode&&e&&(e=t._getValidDate(e))instanceof Date&&("one"===t.selectionMode&&t.selectedDates.map(Number).indexOf(e.getTime())>-1||e.getTime()<t.min.getTime()||e.getTime()>t.max.getTime()||("one"!==t.selectionMode&&"default"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._clearSelection(!0),t._selectDate(e),1!==t.selectedDates.length||t._isDateInView(t.selectedDates[0])||t._handleMonths(t.selectedDates[0])))}today(){const e=this;let t=new Date;return t.setHours(0,0,0,0),t.getTime()<e.min.getTime()||t.getTime()>e.max.getTime()?t=new Date(e.max):e._selectDate(t),e._handleMonths(t),t}_animateNavigation(e,t,a){const n=this;n._navigationDate=e,n._animationSettings||n._applyAnimationSettings(),n.$animationPanel.addClass("smart-hidden"),n.$.dateViewContainer.style.transform="",n.$.dateViewContainer.style.opacity="",n.$.monthsContainer.style.transform="",n.$.monthsContainer.style.opacity="";const l="month"!==n.displayMode?n.$.dateViewContainer:n.$.monthsContainer,i=n.$.body[n._animationSettings.scrollMax]-n.$.body[n._animationSettings.size];n._scrollStep=n.$.body[n._animationSettings.size]*n._animationSettings.startSpeed,n._animationStarted&&n._getMonthCells(n.$.monthsContainer,n.rightToLeft).map((e=>{n._setCellState(e,"restricted",!1),n._setCellState(e,"selected",!1),n._setCellState(e,"otherMonth",!1),n._setCellState(e,"focus",!1),n._setCellState(e,"important",!1),n._setCellState(e,"today",!1),n._setCellState(e,"disabled",!1),n._setCellState(e,"hover",!1)})),n._animationStarted=!0,"month"!==n.displayMode?(n._setCellState(n._focusedCell,"focus",!1),n._setDisplayModeContent(e,n.$.nextMonthsContainer)):n._handleMonths(e,n.$.nextMonthsContainer),n.rightToLeft&&(t*=-1),a||(t>0?(l.style.order=1,n.$.nextMonthsContainer.style.order=3,(!n._animationStarted||n._animationStarted&&n.$.body[n._animationSettings.scrollSize]>n.$.body[n._animationSettings.scrollMax]*n._animationSettings.resetThreshold*2)&&(n.$.body[n._animationSettings.scrollSize]=0)):(l.style.order=3,n.$.nextMonthsContainer.style.order=1,(!n._animationStarted||n._animationStarted&&n.$.body[n._animationSettings.scrollSize]<n.$.body[n._animationSettings.scrollMax]*n._animationSettings.resetThreshold)&&(n.$.body[n._animationSettings.scrollSize]=n.$.body[n._animationSettings.scrollMax]))),cancelAnimationFrame(n._animationId),n._animationId=requestAnimationFrame((function e(){let a=t>0?n.$.body[n._animationSettings.scrollSize]>=i:0===n.$.body[n._animationSettings.scrollSize],l=n._scrollStep/2;a?n._animateNavigationCompleted():(t>0&&n.$.body[n._animationSettings.scrollSize]>i*n._animationSettings.easeThreshold?(l=Math.max(n.$.body[n._animationSettings.scrollSize]/n._animationSettings.stepEaseSize,Math.abs(l-(i-n.$.body[n._animationSettings.scrollSize])*n._animationSettings.step)),n._scrollStep=n._scrollStep*n._animationSettings.step+l):t<0&&n.$.body[n._animationSettings.scrollSize]<i*n._animationSettings.easeThreshold&&(l=Math.max(n.$.body[n._animationSettings.scrollMax]/n._animationSettings.stepEaseSize,Math.abs(l-n.$.body[n._animationSettings.scrollSize]*n._animationSettings.step)),n._scrollStep=n._scrollStep*n._animationSettings.step+l),n.$.body[n._animationSettings.scrollSize]+=t>0?n._scrollStep:-n._scrollStep,n._animationId=requestAnimationFrame(e))}))}_animateNavigationCompleted(){const e=this;let t,a,n,l="month"!==e.displayMode?e.$.dateViewContainer:e.$.monthsContainer;if(cancelAnimationFrame(e._animationId),"month"!==e.displayMode){let i=[].slice.call(l.children).indexOf(e._focusedCell);l.innerHTML=e.$.nextMonthsContainer.innerHTML;let s,o=l.children[i];a=l.children,n=e.$.nextMonthsContainer.children;for(let t=0;t<a.length;t++)a[t].value=n[t].value,a[t].restricted=n[t].restricted,a[t].important=n[t].important,a[t].otherMonth=n[t].otherMonth,a[t].value.getTime()<=e.max.getTime()&&(s=a[t]);t=o&&o.value.getTime()>=e.max.getTime()?s.value:e._focusedCell?e._focusedCell.value:void 0}else{let i=l.children,s=e.$.nextMonthsContainer.children;e._focusedCell&&e.$.nextMonthsContainer.contains(e._focusedCell)&&(t=e._focusedCell.value);for(let t=0;t<i.length&&s[t]._date;t++){i[t]._date=s[t]._date,i[t].innerHTML=s[t].innerHTML,a=e._getMonthCells(i[t]),n=e._getMonthCells(s[t]);for(let e=0;e<a.length;e++)a[e].value=n[e].value,a[e].restricted=n[e].restricted,a[e].important=n[e].important,a[e].otherMonth=n[e].otherMonth,a[e].removeAttribute("focus")}e._selectedCells.length>0&&(e._selectedCells=e._selectedCells.map((t=>e._getCellByDate(t.value))).filter((e=>void 0!==e)))}e._focusCell(e._getCellByDate(t)),l.style.order=1,e.$.nextMonthsContainer.style.order=3,e.$.body[e._animationSettings.scrollSize]=0,e._animationStarted=!1,delete e._navigationDate}_applyAnimationSettings(e){const t=this;t._animationSettings=t.animationSettings?t.animationSettings:t._animationSettings||{},"portrait"===t.scrollButtonsNavigationMode?(t._animationSettings.scrollMax="scrollHeight",t._animationSettings.size="offsetHeight",t._animationSettings.scrollSize="scrollTop"):(t._animationSettings.scrollMax="scrollWidth",t._animationSettings.size="offsetWidth",t._animationSettings.scrollSize="scrollLeft"),e||(t._animationSettings.startSpeed=t._animationSettings.startSpeed?t._animationSettings.startSpeed:.2,t._animationSettings.easeThreshold=t._animationSettings.easeThreshold?t._animationSettings.easeThreshold:.5,t._animationSettings.step=t._animationSettings.step?t._animationSettings.step:.25,t._animationSettings.stepEaseSize=t._animationSettings.stepEaseSize?t._animationSettings.stepEaseSize:200,t._animationSettings.resetThreshold=t._animationSettings.resetThreshold?t._animationSettings.resetThreshold:.2)}_applySelectionMode(e,t){const a=this;let n=[],l=!!e,i=a.selectionMode;function s(e,t){const n=a.$.monthsContainer.children;for(let l=0;l<n.length;l++)a._getMonthCells(n[l]).map((n=>{a._setCellState(n,e,t)}))}switch("many"===i&&"range"===i||s("hover",!1),a._newRangeSelectionStarted=a.selectedDates.length>0&&"range"===i,-1!==["default","many","zeroOrMany","oneOrMany","week","range"].indexOf(i)?Array.from(a.getElementsByClassName("smart-calendar-month")).forEach((e=>e.setAttribute("aria-multiselectable",!0))):Array.from(a.getElementsByClassName("smart-calendar-month")).forEach((e=>e.removeAttribute("aria-multiselectable"))),"none"!==i&&"none"!==t||s("selected",!1),i){case"none":return void a._clearSelection(l);case"range":return void(a.selectedDates.length>1&&a._selectMultipleDates(a.selectedDates[0],a.selectedDates[a.selectedDates.length-1]));case"many":case"default":case"oneOrMany":if(0===a.selectedDates.length){n.push(new Date(Math.min(Math.max(a.min.getTime(),(new Date).setHours(0,0,0,0)),a.max.getTime())));break}return;case"oneExtended":case"one":if(1===a.selectedDates.length)return;a.selectedDates.length>1?(n.push(a.selectedDates[a.selectedDates.length-1]),a._clearSelection(l)):n.push(new Date(Math.min(Math.max(a.min.getTime(),(new Date).setHours(0,0,0,0)),a.max.getTime())));break;case"zeroOrOne":if(a.selectedDates.length>1){n.push(a.selectedDates[a.selectedDates.length-1]),a._clearSelection(l);break}return;case"zeroOrMany":return;case"week":if(a.selectedDates.length>=1){let e=a.selectedDates[a.selectedDates.length-1];for(let t=0;t<7;t++)n.push(new Date(e)),e.setDate(e.getDate()+1);a._clearSelection(l)}}if(a.selectedDates=[],e)return void(a.selectedDates=n);const o=n.length;for(let e=0;e<o;e++)a._selectDate(n[e],e<o-1)}_clearSelection(e){const t=this,a=t.selectedDates.slice(0),n=t.selectionMode;if(t.isRendered){if(t._selectedCells&&t._selectedCells.map((e=>{t._setCellState(e,"selected",!1)})),t.selectedDates=[],t._selectedCells=[],"many"===n||"range"===n){const e=t.$.monthsContainer.children;for(let a=0;a<e.length;a++)t._getMonthCells(e[a]).map((e=>{t._setCellState(e,"hover",!1)}))}t.$.footer&&t._refreshFooter(),t.$.hiddenInput.value=t.selectedDates.toString(),!e&&t.isInitialized&&a.length&&(t.$.fireEvent("change",{value:[]}),t._updateTargetValue()),t.$.title&&t._refreshTitle()}else t.set("selectedDates",[])}_bodyBlurStateHandler(e){this._bodyStateHandler(e),this.$.fireEvent("blur")}_bodyFocusStateHandler(e){this._bodyStateHandler(e),this.$.fireEvent("focus")}_bodyStateHandler(e){const t=this;if(t._focusedCell){if("blur"===e.type||"focus"===e.type&&t._noFocusingRequired)return t._noFocusingRequired=!1,void t._setCellState(t._focusedCell,"focus",!1);if("month"!==t.displayMode)return void("focus"!==e.type||t.$.dateViewContainer.querySelector("smart-calendar-cell[focus]")||t._setCellState(t._focusedCell||t.$.dateViewContainer.querySelector(".smart-calendar-cell"),"focus",!0))}"focus"===e.type&&t._focusCell()}_containerWheelHandler(e){const t=this;if(t.disabled||t.readonly||"month"!==t.displayMode&&"list"===t.displayModeView)return;let a,n;n=document.activeElement,t.shadowRoot?n=t.shadowRoot.activeElement:t.isInShadowDOM&&(n=t.getRootNode().activeElement),t.$.yearElement===n&&(a=12),(n&&t.shadowRoot||n.closest("smart-calendar")===t)&&(a=e.target===t.$.yearElement?12:1),a&&(e.preventDefault(),a=12===a?a:a*t.months,e.deltaY>0?t.navigate(-a):t.navigate(a))}_downHandler(e){const t=this;let a=e.originalEvent.target;if(t._dragStartDetails=void 0,t.disabled||t.readonly)return;if(t.hasRippleAnimation&&(a.value instanceof Date||a.parentElement&&a.parentElement.classList.contains("smart-calendar-title")||a.parentElement===t.$.dateElement)&&Smart.Utilities.Animation.Ripple.animate(a,e.pageX,e.pageY),a=e.originalEvent.target.closest(".smart-calendar-header"),e.originalEvent.target.closest(".smart-calendar-year-container")&&"decade"!==t.displayMode){if("classic"===t.calendarMode)return;return void t._showDateView("year")}if(e.originalEvent.target.closest(".smart-calendar-date-container")&&"month"!==t.displayMode){if("classic"===t.calendarMode)return;return void t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell,"month")}if(t._animationStarted&&t._animateNavigationCompleted(),Smart.Utilities.Core.isMobile&&e.originalEvent.target.closest(".smart-calendar-body")===t.$.body)return void(t._dragStartDetails={x:e.pageX,y:e.pageY,startTime:Date.now(),target:e.originalEvent.target});if(a=e.originalEvent.target,a.closest(".smart-calendar-week")||a.parentElement===t.$.dateViewContainer){for(;a&&!(a.value instanceof Date);)a=a.parentElement;return void(a&&("month"!==t.displayMode?t._displayModeHandler(a):t._weeksDownHandler(e,a)))}if(a.closest(".smart-calendar-month-element"))return;if(e.originalEvent.stopPropagation(),"list"===t.displayModeView&&"month"!==t.displayMode)return a=(t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target).closest("smart-list-item"),void(a&&t._displayModeHandler(a));const n=document.scrollingElement||document.documentElement,l=n.scrollLeft,i=n.scrollTop;t.unfocusable||t.focus(),window.scrollTo(l,i)}_displayModeHandler(e,t){const a=this;if(a._animationStarted&&a._animateNavigationCompleted(),e instanceof HTMLElement&&e.closest(".smart-calendar-week")&&e.otherMonth){if("decade"===a.displayMode&&(e.value.getFullYear()<a.min.getFullYear()||e.value.getFullYear()>a.max.getFullYear()))return;if("year"===a.displayMode&&(e.value.getFullYear()<a.min.getFullYear()||e.value.getFullYear()===a.min.getFullYear()&&e.value.getMonth()<a.min.getMonth()||e.value.getFullYear()>a.max.getFullYear()||e.value.getFullYear()===a.max.getFullYear()&&e.value.getMonth()>a.max.getMonth()))return}switch(t=t||a.displayMode){case"year":t="month";break;case"decade":t="year"}if(a.displayMode===t)return;const n=a.$.listViewContainer,l=n&&n.contains(e);a.$.fireEvent("displayModeChanging",{oldDisplayMode:a.displayMode,newDisplayMode:t}).defaultPrevented||(a.set("displayMode",t),a.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),e.parentElement!==a.$.dateViewContainer||e.disabled||e.restricted||a._focusCell(e),a.hasAnimation?(l&&e instanceof HTMLLIElement?e.offsetHeight?a.$.animationPanel.style.transformOrigin=e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px":a.$.animationPanel.style.transformOrigin=n.offsetLeft+n.offsetWidth/2+"px "+(n.offsetTop+n.offsetHeight/2)+"px":(a.$.dateViewContainer.style.order=1,a.$.nextMonthsContainer.style.order=3,e=a._focusedCell,a.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px"),a._animateView(1,e)):a._setDisplayModeContent(e.value instanceof Date?e.value:new Date(e.getAttribute("value")||e.value)))}_animateView(e,t){const a=this;let n,l,i=t instanceof Date?t:new Date(t.getAttribute("value")||t.value),s=!1,o=1,r=1;const d=a.$.listViewContainer;"list"===a.displayModeView?n=d.contains(t)?d:l="month"!==a.displayMode?a.$.monthsContainer:d:t.value instanceof Date||(t=a._focusedCell?a._focusedCell:a._selectedCells.length>0?a._selectedCells[a._selectedCells.length-1]:a._getCellByDate(new Date)),n||(n=t.parentElement===a.$.dateViewContainer?a.$.dateViewContainer:a.$.monthsContainer),l||(l="month"===a.displayMode?a.$.monthsContainer:"list"===a.displayModeView?d:a.$.dateViewContainer),l.style.transformOrigin=a.$.animationPanel.style.transformOrigin,n===d?(a.$.animationPanel.innerHTML="",a.$.animationPanel.appendChild(n.cloneNode(!0))):a.$.animationPanel.innerHTML=n.innerHTML,a._setDisplayModeContent(i),n.style.order=1,a.$.nextMonthsContainer.style.order=3,a.$.body[a._animationSettings.scrollSize]=0,a.$.animationPanel.style.width=a.$.body.offsetWidth+"px",a.$.animationPanel.style.height=a.$.body.offsetHeight+"px",a.$.animationPanel.style.transform="scale(1)",a.$.animationPanel.style.opacity=1,a.$animationPanel.removeClass("smart-hidden"),l.style.opacity="0",l.style.transform="scale(3.5)",n.$.hasClass("smart-calendar-date-view-container")?a.$animationPanel.addClass("smart-calendar-date-view-container"):a.$animationPanel.removeClass("smart-calendar-date-view-container"),cancelAnimationFrame(a._animationId),a._animationId=requestAnimationFrame((function t(){if((e>0&&o>=3.5||e<0&&o<=0)&&(s=!0),s){if(cancelAnimationFrame(a._animationId),a.$animationPanel.addClass("smart-hidden"),a.$.animationPanel.style.transform="",a.$.animationPanel.style.opacity="",n.style.order=1,a.$.nextMonthsContainer.style.order=3,a.$.body[a._animationSettings.scrollSize]=0,l.style.transform="",l.style.opacity="",a.unfocusable)return;"month"===a.displayMode?a.$.body.focus():"list"===a.displayModeView&&a.focus()}else a.$.animationPanel.style.opacity=r,l.style.opacity=1-r,r-=.05,e>0?(a.$.animationPanel.style.transform="scale("+o+")",l.style.transform="scale("+Math.min((o-1)/2,1)+")",o+=.125):(a.$.animationPanel.style.transform="scale("+Math.max(o,0)+")",l.style.transform="scale("+Math.max(1+o,1)+")",o-=.06),a._animationId=requestAnimationFrame(t)}))}_documentUpHandler(e){const t=this;let a=e.originalEvent.target;if((t.isInShadowDOM||t.shadowRoot&&a===t)&&(a=e.originalEvent.composedPath()[0]),t._newRangeSelectionStarted&&!t.$.container.contains(a)&&delete t._newRangeSelectionStarted,a&&a.classList&&a.classList.contains("smart-calendar-cell")&&(e.originalEvent.stopPropagation(),e.originalEvent.preventDefault(),e.preventDefault()),!Smart.Utilities.Core.isMobile||!t._dragStartDetails||e.originalEvent.target.closest(".smart-calendar-list-view"))return;delete t._previousIteration;const n=Date.now();let l={};(t.isInShadowDOM||t.shadowRoot&&a===t)&&(a=e.originalEvent.composedPath()[0]),"portrait"===t.scrollButtonsNavigationMode?(l.coordinate="y",l.direction="pageY"):(l.coordinate="x",l.direction="pageX");const i=t._dragStartDetails.step*(t.rightToLeft?-1:1);if(Math.abs(t._dragStartDetails[l.coordinate]-e[l.direction])<=10){if(a="list"===t.displayModeView&&"month"!==t.displayMode?a.closest("smart-list-item"):a,!a)return void(t._dragStartDetails=void 0);if("month"!==t.displayMode)return t._displayModeHandler(a),"portrait"===t.scrollButtonsNavigationMode?t.$.body.scrollTop=0:t.$.body.scrollLeft=0,void(t._dragStartDetails=void 0);if(t._weeksDownHandler(e,a),!t.disableAutoNavigation&&a.otherMonth)return}else{const a=Math.abs((e[l.direction]-t._dragStartDetails[l.coordinate])/(n-t._dragStartDetails.startTime));if(a>1){const e=parseInt(a);for(let a=0;a<e;a++)if(!t.navigate(i)){t._cancelAnimation();break}return void(t._dragStartDetails=void 0)}}if(!t.hasAnimation)return t.navigate(t._dragStartDetails.step),void(t._dragStartDetails=void 0);let s=("month"!==t.displayMode?t.$.dateViewContainer[t._animationSettings.scrollMax]:t.$.monthsContainer[t._animationSettings.scrollMax])+t.$.monthsSeparator[t._animationSettings.size];if(t._dragStartDetails.step>0&&t.$.body[t._animationSettings.scrollSize]>s*t._animationSettings.easeThreshold||t._dragStartDetails.step<0&&t.$.body[t._animationSettings.scrollSize]<s*t._animationSettings.easeThreshold)return t._animateNavigation(t._dragStartDetails.navigationDate,i,!0),6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&t._updateWeeksVisibility(i,t._getCellByDate(t._dragStartDetails.navigationDate,t.$.nextMonthsContainer)),t.$.fireEvent("navigationChange",{value:new Date(t._dragStartDetails.navigationDate),type:t.displayMode}),void(t._dragStartDetails=void 0);t._cancelAnimation(),t._dragStartDetails=void 0}_cancelAnimation(){const e=this,t="month"!==e.displayMode?e.$.dateViewContainer:e.$.monthsContainer;let a=e.$.animationPanel.style.transform,n=e.$.animationPanel.style.opacity;a&&(a=parseFloat(a.substring(a.indexOf("(")+1||0,a.indexOf(")")))),t.style.order=1,e.$.nextMonthsContainer.style.order=3,e.$.body[e._animationSettings.scrollSize]=0,e._animationId=requestAnimationFrame((function t(){if(!a||a>=3.5){cancelAnimationFrame(e._animationId),e.$animationPanel.addClass("smart-hidden"),e.$.animationPanel.style.transform="",e.$.animationPanel.style.opacity="";const t="month"===e.displayMode?e.$.monthsContainer:e.$.listViewContainer;return t.style.transform="",t.style.opacity="",e.unfocusable||("month"===e.displayMode?e.$.body.focus():"list"===e.displayModeView&&e.focus()),void(e._animationStarted=!1)}e.$.animationPanel.style.opacity=n-=.25,e.$.animationPanel.style.transform="scale("+(a+=.5)+")",e._animationId=requestAnimationFrame(t)}))}_focusCell(e,t){const a=this;if(a._focusedCell&&a._setCellState(a._focusedCell,"focus",!1),a.disabled||a.readonly)return;if(e){if("month"!==a.displayMode)return a._setCellState(e,"focus",!0),void(a._focusedCell=e);if(e.disabled||e.restricted)return;return t||a._setCellState(e,"focus",!0),void(a._focusedCell=e)}if("month"!==a.displayMode&&0===a.$.monthsContainer.offsetHeight)return;const n=a._selectedCells[a._selectedCells.length-1];if(n&&n.offsetHeight)a._setCellState(n,"focus",!0),a._focusedCell=n;else{const e=a.$.monthsContainer.children;if(!e[0]._date||a.min.getTime<e[0]._date.getTime())return;const t=a._getMonthCells(e[0],a.rightToLeft);for(let e=0;e<t.length;e++){const n=t[e];if(!n.otherMonth){if(n.disabled||n.restricted||!n.offsetHeight)continue;a._focusedCell=n;break}}}a._focusedCell&&a._setCellState(a._focusedCell,"focus",!0)}_getDays(e,t){const a=t.length;let n=[];if(a>0)for(let l=0;l<a;l++)t[l].getFullYear()===e.getFullYear()&&t[l].getMonth()===e.getMonth()&&n.push(t[l].getDate());return n}_getCellByDate(e,t){const a=this;if(!(e instanceof Date))return;if(t||(t=a.$.monthsContainer),"month"!==a.displayMode){if("list"===a.displayModeView)return;let t=arguments[1]?a.$.nextMonthsContainer.children:a.$.dateViewContainer.children;for(let n=0;n<t.length;n++)if("year"!==a.displayMode){if(t[n].value.getFullYear()===e.getFullYear())return t[n]}else if(t[n].value.getMonth()===e.getMonth())return t[n];return}let n,l,i=t.children;for(let t=0;t<i.length;t++)if(e.getFullYear()===i[t]._date.getFullYear()&&e.getMonth()===i[t]._date.getMonth()){n=i[t];break}if(n){l=a._getMonthCells(n);for(let t=0;t<l.length;t++)if((!l[t].otherMonth||l[t].hover)&&l[t].value.getMonth()===e.getMonth()&&l[t].value.getDate()===e.getDate())return l[t]}}_getMonthCells(e,t){const a=e.getElementsByClassName("smart-calendar-week");let n=[];if(t)for(let e=0;e<a.length;e++){let t=a[e].children;for(let e=t.length-1;e>0;e--)t[e].classList.contains("smart-calendar-cell")&&n.push(t[e])}else for(let e=0;e<a.length;e++){let t=a[e].children;for(let e=1;e<t.length;e++)t[e].classList.contains("smart-calendar-cell")&&n.push(t[e])}return n}_getWeekNumber(e){const t=this;let a,n=new Date(e.getFullYear(),0,1),l=Math.round((e.getTime()-n.getTime()-6e4*(e.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)+1,i=n.getDay()-t.firstDayOfWeek;return i=i>=0?i:i+7,i<4?(a=Math.floor((l+i-1)/7)+1,a>52&&(n=new Date(e.getFullYear()+1,0,1),i=n.getDay()-t.firstDayOfWeek,i=i>=0?i:i+7,a=i<4?1:53)):a=Math.round((l+i-1)/7),a}_handleDateSelection(e){const t=this;if(void 0!==e&&!e.disabled&&!e.restricted)switch(t.selectionMode){case"none":t._focusCell(e);break;case"oneExtended":case"one":case"default":if(t._keysPressed.Control)return t.selectedDates.length>1||1===t.selectedDates.length&&!e.selected?void t._selectDate(e.value):void t._focusCell(e);if(t._keysPressed.Shift)return void t._selectMultipleDates(new Date(t.selectedDates[0]),e);t._clearSelection(!0),t._selectDate(e.value,t._selectedCells.indexOf(e.value)>-1);break;case"many":{if(0===t.selectedDates.length)return void t._selectDate(e.value);const a=t.selectedDates[t.selectedDates.length-1];let n=new Date(t.selectedDates[0]);if(e.value.getTime()===n.getTime()||e.value.getTime()===a.getTime())return t._clearSelection(),void t._focusCell(e);t.selectedDates.length>0&&t._selectMultipleDates(n,e);break}case"range":{if(t.selectedDates.length>1&&!t._keysPressed.Control&&!t._newRangeSelectionStarted&&t._clearSelection(!0),0===t.selectedDates.length||t._keysPressed.Control&&t.selectedDates.length>1&&!t._newRangeSelectionStarted){if(e.value&&t.selectedDates.find((t=>t.getTime()===e.value.getTime())))return;return t._newRangeSelectionStarted=!0,void t._selectDate(e.value)}const a=t.selectedDates[t.selectedDates.length-1];let n=t._keysPressed.Control||t._newRangeSelectionStarted?a:new Date(t.selectedDates[0]);t.selectedDates.length>0&&t._selectMultipleDates(n,e),delete t._newRangeSelectionStarted;break}case"zeroOrMany":t._selectDate(e.value);break;case"oneOrMany":if(1===t.selectedDates.length&&e.selected)return void t._focusCell(e);t._selectDate(e.value);break;case"zeroOrOne":if(1===t.selectedDates.length&&e.selected)return void t._selectDate(e.value);t._clearSelection(!0),t._selectDate(e.value);break;case"week":{if(e.selected&&(e.value.getTime()===t.selectedDates[0].getTime()||e.value.getTime()===t.selectedDates[t.selectedDates.length-1].getTime()))return t._clearSelection(),void t._focusCell(e);t._clearSelection(!0);let a=new Date(e.value);t._selectDate(a);for(let e=1;e<7;e++)a.setDate(a.getDate()+1),t._selectDate(a);t._isDateInView(a)||t.navigate(1);break}}}_handleImportantDateTemplate(){const e=this;if(e._importantDatesTemplate=e._validateTemplate("importantDatesTemplate",e.importantDatesTemplate),!e._importantDatesTemplate||!e._importantDatesTemplate.content)return;let t=e._importantDatesTemplate.content;const a=t.childNodes.length,n=/{{\w+}}/g;let l;e._bindingDetails=[];for(let i=0;i<a;i++)if(l=n.exec(t.childNodes[i].innerHTML),l)return void e._bindingDetails.push({childNodeIndex:i,bindingString:l[0]})}_handleLayoutTemplate(e,t){const a=this,n=a._validateTemplate(e.$.hasClass("smart-header")?"headerTemplate":e.$.hasClass("smart-calendar-footer")?"footerTemplate":"titleTemplate",t);if(!n||!n.content)return void("function"==typeof t&&t(e,{}));a._layoutTemplates||(a._layoutTemplates=[]);let l=document.importNode(n.content,!0);e.innerHTML="";const i=l.childNodes.length,s=/{{\w+}}/g;let o,r=[];for(let e=0;e<i;e++)o=s.exec(l.childNodes[e].innerHTML),o&&r.push({childNodeIndex:e,bindingString:o[0]});if(a._layoutTemplates=a._layoutTemplates.filter((t=>t.selector!==e)),a._layoutTemplates.push({selector:e,template:n,bindings:r}),a.shadowRoot)return e.innerHTML="<slot></slot>",void a.appendChild(l);e.appendChild(l)}_handleCalendarCellHover(e,t){const a=this;if(!a._animationStarted){if("month"===a.displayMode)if("mouseover"===e.type&&("many"===a.selectionMode||"range"===a.selectionMode&&a._newRangeSelectionStarted)&&a.selectedDates.length>0){const e=a.$.monthsContainer.children;for(let t=0;t<e.length;t++)a._getMonthCells(e[t]).map((e=>{a._setCellState(e,"hover",!1)}));let n=new Date("range"===a.selectionMode?a.selectedDates[a.selectedDates.length-1]:a.selectedDates[0]),l=new Date(t.value),i=t;const s=n.getTime()>l.getTime()?-1:1,o=function(){i=a._getCellByDate(n),!i||i.selected||i.restricted||a._setCellState(i,"hover",!0)};if(n.getTime()!==l.getTime()){for(n.setDate(n.getDate()+s);n.getTime()!==l.getTime();)o(),n.setDate(n.getDate()+s);o()}}else a._setCellState(t,"hover",!1);"mouseover"!==e.type||t.otherMonth?a._setCellState(t,"hover",!1):a._setCellState(t,"hover",!0)}}_handleMonths(e,t){const a=this;let n;function l(e){let t,n=e.children.length,l=document.createDocumentFragment();for(;n<a.months;n++)t=a.$.month.cloneNode(!1),t.innerHTML=a.$.month.innerHTML,l.appendChild(t);return l}function i(t){let n=t.children;for(let t=0;t<n.length;t++)a._setMonth(e,n[t]),e.setMonth(e.getMonth()+1);a._setWeeksVisibility(t),a._refreshHeaderElements(),a._refreshHeaderTitle(),a.tooltip&&a.$.tooltip&&a.$.tooltip.close(),a.$.body===document.activeElement&&a._focusCell()}if(e||(e=a._viewDates&&a._viewDates.length>0?a._viewDates[0]:new Date),e=new Date(Math.min(Math.max(a.min.getTime(),e.getTime()),a.max.getTime())),t||(t=a.$.monthsContainer),a._selectedCells=[],a.hasAnimation){for(n=a.$.nextMonthsContainer.children,n.length>0&&n[0].value instanceof Date&&(a.$.nextMonthsContainer.innerHTML="");a.$.nextMonthsContainer.childElementCount<a.months;)a.$.nextMonthsContainer.appendChild(l(a.$.nextMonthsContainer));for(;a.$.nextMonthsContainer.childElementCount>a.months;)a.$.nextMonthsContainer.removeChild(n[a.$.nextMonthsContainer.childElementCount-1]);if(arguments[1]===a.$.nextMonthsContainer)return void i(a.$.nextMonthsContainer)}if(n=a.$.monthsContainer.children,n.length>a.months){for(;a.$.monthsContainer.childElementCount>a.months;)a.$.monthsContainer.removeChild(n[a.$.monthsContainer.childElementCount-1]),a._viewDates.pop();i(a.$.monthsContainer)}else a.$.monthsContainer.children.length!==a.months?(a._viewDates=[],a.$.monthsContainer.appendChild(l(a.$.monthsContainer)),i(a.$.monthsContainer)):i(a.$.monthsContainer)}_headerChangeHandler(e){const t=this;if(e.stopPropagation(),t.disabled||t.readonly)return;if(e.target.ownerElement===t.$.monthElement&&0!==t._changeEventFired)return void t._changeEventFired--;const a=t.displayMode;e.target===t.$.yearElement&&(t._viewDates[0].setFullYear(Math.min(Math.max(t.min.getFullYear(),isNaN(parseInt(t.$.yearElement.value))?0:parseInt(t.$.yearElement.value)),t.max.getFullYear())),t._handleMonths(t._viewDates[0])),!t.$.monthElement||e.target!==t.$.monthElement&&e.target.ownerElement!==t.$.monthElement||(t._handleMonths(new Date(t.$.monthsContainer.children[0]._date.getFullYear(),t.$.monthElement.selectedIndex,1)),"month"!==a&&t._setDisplayMode(t.displayMode,t.displayMode="month"))}_headerClickHandler(e){const t=this;if(t.disabled||t.readonly)return;let a=e.target.closest("smart-repeat-button");if(!a||!a.disabled){switch(a){case t.$.previousMonthButton:return t._isInteractiveNavigation=!0,void t.navigate(-1*t.months*(t.rightToLeft?-1:1));case t.$.nextMonthButton:return t._isInteractiveNavigation=!0,void t.navigate(1*t.months*(t.rightToLeft?-1:1));case t.$.previousYearButton:return void t.navigate(-12);case t.$.nextYearButton:return void t.navigate(12)}"classic"!==t.calendarMode&&e.target.closest(".smart-calendar-date-element")&&(t._animationStarted&&t._animateNavigationCompleted(),t._isInteractiveNavigation=!0,t._showDateView())}}_selectMultipleDates(e,t){const a=this;if(t instanceof HTMLElement&&(t=t.value),a._newRangeSelectionStarted?a._selectDate(e,!0):a._clearSelection(!0),"range"!==a.selectionMode||t.getTime()!==e.getTime()){if((e=new Date(e)).getTime()<t.getTime())for(;e.getTime()<=t.getTime();)a.selectedDates.find((t=>t.getTime()===e.getTime()))||a._selectDate(e,!0),e.setDate(e.getDate()+1);else if(e.getTime()>t.getTime())for(;e.getTime()>=t.getTime();)a.selectedDates.find((t=>t.getTime()===e.getTime()))||a._selectDate(e,!0),e.setDate(e.getDate()-1);else a._selectDate(t,!0);a.$.hiddenInput.value=a.selectedDates.toString(),a._refreshFooter(),a.isInitialized&&(a.$.fireEvent("change",{value:a.selectedDates}),a._updateTargetValue()),a._refreshTitle()}}_setDisplayMode(e,t,a){const n=this;if(n.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),0!==arguments.length&&n.hasAnimation)if(n._animationStarted&&(n.displayMode=e,n._animateNavigationCompleted(),n.displayMode=t),"month"===e&&"year"===t||"year"===e&&"decade"===t)n.displayMode=e,n._showDateView(a?void 0:n.displayMode);else if("month"===e&&"decade"===t)n._showDateView(n.displayMode="year");else{let e;"list"===n.displayModeView?(e=n.$.listViewContainer.querySelector("li.active"),n.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop>0?e.offsetTop-e.offsetHeight/2:e.offsetTop+e.offsetHeight/2)+"px"):(n.$.dateViewContainer.style.order=1,n.$.nextMonthsContainer.style.order=3,e=n._focusedCell,n.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px"),n._animateView(1,e)}else{if("classic"===n.calendarMode)return void(n.displayMode="month");if("month"!==n.displayMode&&(n.$monthsContainer.addClass("smart-hidden"),n.$dateViewContainer.hasClass("smart-hidden")&&n.$dateViewContainer.removeClass("smart-hidden")),!n.isCompleted&&"month"===n.displayMode)return;n._setDisplayModeContent()}}_setDisplayModeContent(e,t){const a=this;let n=e&&"Invalid Date"!==e.toString()?e:a.selectedDates.length>0?a.selectedDates[a.selectedDates.length-1]:new Date;n.setTime(Math.min(Math.max(n.getTime(),a.min.getTime()),a.max.getTime())),n.setHours(0,0,0,0);const l=a._prepareView(n);if(!l)return;let i;t?(a.$.nextMonthsContainer.innerHTML=a.$.dateViewContainer.innerHTML,i=a.$.nextMonthsContainer):i=a.$.dateViewContainer;const s=i.children;let o;for(let e=0;e<s.length;e++){const t=s[e];t.innerHTML=l.viewContent[e],t.value=l.dates[e],"year"===a.displayMode?(t.value.getFullYear()<a.min.getFullYear()||t.value.getFullYear()===a.min.getFullYear()&&t.value.getMonth()<a.min.getMonth()||t.value.getFullYear()>a.max.getFullYear()||t.value.getFullYear()===a.max.getFullYear()&&t.value.getMonth()>a.max.getMonth()?a._setCellState(t,"otherMonth",!0):a._setCellState(t,"otherMonth",!1),n.getFullYear()===t.value.getFullYear()&&n.getMonth()===t.value.getMonth()&&(o=t)):"decade"===a.displayMode&&(0===e||e===s.length-1||t.value.getFullYear()<a.min.getFullYear()||t.value.getFullYear()>a.max.getFullYear()?a._setCellState(t,"otherMonth",!0):a._setCellState(t,"otherMonth",!1),n.getFullYear()===t.value.getFullYear()&&(o=t)),a._setCellState(t,"hover",!1),a._setCellState(t,"focus",!1)}if(o.otherMonth)for(let e=0;e<s.length;e++)if(!s[e].otherMonth){o=s[e];break}a._mobileScrolling||(a._focusedCell&&a._setCellState(a._focusedCell,"focus",!1),a._focusedCell=o,a._focusCell(a._focusedCell),a._refreshHeaderTitle(),a._refreshHeaderElements(),a.$.fireEvent("displayModeChange"),a._isInteractiveNavigation?a._isInteractiveNavigation=void 0:(a._setCellState(o,"focus",!0),setTimeout((function(){a.unfocusable||(a.$.body.focus(),a._focusCell(a._focusedCell))}),0)))}_prepareView(e){const t=this,a=t.$.listViewContainer;let n,l,i=[],s=[];function o(e,t,a){let n=new Date(e,t+1,0),l=n.getDate();return a>l?n.setDate(l):n.setDate(a),n}if("month"===t.displayMode)return t.$nextMonthsContainer.hasClass("smart-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-date-view-container"),a&&a.classList.add("smart-hidden"),t.$dateViewContainer.hasClass("smart-visibility-hidden")&&t.$dateViewContainer.removeClass("smart-visibility-hidden"),t._isDateInView(e)||t._handleMonths(e),t.$header.hasClass("smart-hidden")&&t.$header.removeClass("smart-hidden"),t.$body.hasClass("smart-calendar-list-view")&&t.$body.removeClass("smart-calendar-list-view"),t.$dateContainer.addClass("smart-calendar-selected"),t.$yearContainer.removeClass("smart-calendar-selected"),t.$dateViewContainer.addClass("smart-hidden"),t.$monthsContainer.removeClass("smart-hidden"),t._refreshHeaderTitle(),t.$.body.setAttribute("tabindex",t.tabIndex>0?t.tabIndex:0),t._refreshHeaderElements(),t.unfocusable||t.$.body.focus(),t._focusCell(t._getCellByDate(e)),void t.$.fireEvent("displayModeChange");if("list"===t.displayModeView)return t._setDisplayModeListContent(e),void t.$.fireEvent("displayModeChange");if(t.$header.hasClass("smart-hidden")&&t.$header.removeClass("smart-hidden"),t.$dateViewContainer.hasClass("smart-visibility-hidden")&&t.$dateViewContainer.removeClass("smart-visibility-hidden"),a&&a.classList.add("smart-hidden"),t.$.body.setAttribute("tabindex",t.tabIndex>0?t.tabIndex:0),"year"===t.displayMode){let a=new Date;for(let n=0;n<12;n++)a=o(a.getFullYear(),n,a.getDate()),i.push(a.toLocaleDateString(t.locale,{month:"short"})),s.push(o(e.getFullYear(),n,e.getDate()))}else{n=e?e.getFullYear():t._viewDates[0].getFullYear(),l=n%10,0!==l&&(n-=l),n-=1;for(let t=0;t<12;t++)i.push(n+""),s.push(new Date(n,e.getMonth(),e.getDate())),++n}return{viewContent:i,dates:s}}_setDisplayModeListContent(e){const t=this;let a=[];function n(e,t,a){let n=new Date(e,t+1,0),l=n.getDate();return a>l?n.setDate(l):n.setDate(a),n}if(t.$dateViewContainer.addClass("smart-visibility-hidden"),"year"===t.displayMode){let l=new Date;for(let i=0;i<12;i++)l=n(l.getFullYear(),i,l.getDate()),a.push({label:l.toLocaleDateString(t.locale,{month:"short"}),value:n(e.getFullYear(),i,e.getDate()).toDateString()});t.$yearContainer.removeClass("smart-calendar-selected"),t.$dateContainer.addClass("smart-calendar-selected")}else{let n=t.min.getFullYear(),l=t.max.getFullYear();l=Math.min(t.max.getFullYear(),e.getFullYear()+10),n=Math.max(t.min.getFullYear(),l-10);for(let t=n;t<l;t++)a.push({label:t.toString(),value:new Date(t,e.getMonth(),e.getDate()).toDateString()});t.$yearContainer.addClass("smart-calendar-selected"),t.$dateContainer.removeClass("smart-calendar-selected")}t._prepareListViewer(a,e.toDateString()),t._refreshHeaderTitle(),t._refreshHeaderElements(),t.unfocusable||t.focus()}_prepareListViewer(e=[],t){const a=this,n=a.$.body;let l=a.$.listViewContainer;l||(a.$.listViewContainer=l=document.createElement("smart-scroll-viewer"),l.classList.add("smart-input-drop-down-menu","smart-calendar-list-view"),l.ensureVisible=a._listViewerEnsureVisible.bind(a),l._handleKeyStrokes=a._listViewerKeyStrokesHandler.bind(a),l._setActiveDescendant=a._listViewerSetActiveDescendant.bind(a));let i=l.querySelector("ul");i||(i=document.createElement("ul"),i.onclick=a._listViewContainerItemClickHandler.bind(a),l.appendChild(i)),n.contains(l)&&n.removeChild(l),i.innerHTML="";for(let a=0;a<e.length;a++){const n=e[a],s=n.label,o=n.value,r=document.createElement("li"),d=document.createElement("a");t===o?(r.setAttribute("aria-selected",!0),r.classList.add("active"),t=r):r.setAttribute("aria-selected",!1),r.id=l.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),r.setAttribute("value",o),r.setAttribute("role","option"),r.setAttribute("aria-label",s),d.innerHTML=s,d.setAttribute("aria-hidden",!0),r.appendChild(d),i.appendChild(r)}l.classList.remove("smart-hidden"),n.classList.add("smart-calendar-list-view"),n.removeAttribute("tabindex"),n.insertBefore(l,a.$.animationPanel),l.refresh(),l.ensureVisible()}_listViewerEnsureVisible(){const e=this.$.listViewContainer,t=e.querySelector(".active");if(!t)return;const a=Array.from(e.querySelectorAll("li"));t.offsetTop+t.offsetHeight>=e.scrollTop+e.offsetHeight&&(e.scrollTop=t.offsetTop+t.offsetHeight),(t.offsetTop<=e.scrollTop||t.offsetTop>=e.scrollTop+e.offsetHeight)&&(e.scrollTop=t.offsetTop),0===a.indexOf(t)?e.scrollTop=0:a.indexOf(t)===a.length-1&&(e.scrollTop=e.scrollHeight)}_listViewerKeyStrokesHandler(e){if(["ArrowUp","ArrowDown"].indexOf(e)<0)return;event.preventDefault();const t=this.$.listViewContainer,a=t.querySelector(".active");if(!a){const e=t.querySelector("li");return e.classList.add("active"),void t._setActiveDescendant(e)}const n=a["ArrowDown"===e?"nextElementSibling":"previousElementSibling"];n&&(a.classList.remove("active"),n.classList.add("active"),t._setActiveDescendant(n),t.ensureVisible())}_listViewerSetActiveDescendant(e){const t=this.$.listViewContainer;e?t.setAttribute("aria-activedescendant",e.id):t.removeAttribute("aria-activedescendant")}_listViewContainerItemClickHandler(e){const t=this,a=e.target.closest("li");a&&"list"===t.displayModeView&&"month"!==t.displayMode&&t._displayModeHandler(a)}_isDateInView(e){const t=this;if(!e)return!1;for(let a=0;a<t._viewDates.length;a++)if(e.getFullYear()===t._viewDates[a].getFullYear()&&e.getMonth()===t._viewDates[a].getMonth()){let a=t._getCellByDate(e,t._animationStarted?t.$.nextMonthsContainer:void 0);if(!a)return;return!(a.otherMonth||!a.offsetHeight||a.classList.contains("smart-visibility-hidden"))}return!1}_keyDownHandler(e){const t=this;if(t.disabled||t.readonly)return;const a=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;switch(a){case t.$.yearElement:"Escape"===e.key&&t._refreshHeaderElements();break;case t.$.dateElement:if("default"===t.calendarMode&&" "===e.key||"Enter"===e.key)return e.preventDefault(),t._isInteractiveNavigation=!0,void t._showDateView();t._focusedCell||t._focusCell(),e.key.indexOf("Arrow")>-1&&t.$.dateElement===a&&!t.unfocusable&&t.$.body.focus(),t._navigateDays(e);break;case t.$.body:" "===e.key&&e.preventDefault(),t._navigateDays(e);break;case t.$.yearContainer:if(" "!==e.key&&"Enter"!==e.key||"decade"===t.displayMode||(e.preventDefault(),t._isInteractiveNavigation=!0,t._showDateView("year")),e.key.indexOf("Arrow")>-1){if(e.preventDefault(),t._focusedCell||t._focusCell(),"month"!==t.displayMode&&"list"===t.displayModeView)return t.unfocusable||t.focus(),void t.$.listViewContainer._handleKeyStrokes(e.key);t._navigateDays(e)}break;case t.$.dateContainer:if(" "!==e.key&&"Enter"!==e.key||"month"===t.displayMode||(e.preventDefault(),t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell,"month")),e.key.indexOf("Arrow")>-1){if(t._focusedCell||t._focusCell(),"month"!==t.displayMode&&"list"===t.displayModeView)return t.unfocusable||t.focus(),void t.$.listViewContainer._handleKeyStrokes(e.key);t._navigateDays(e)}break;default:if("month"!==t.displayMode&&"list"===t.displayModeView)return["Arrow","End","Home","Page"].indexOf(e.key)&&e.preventDefault()," "===e.key||"Enter"===e.key||e.ctrlKey&&("ArrowUp"===e.key||"ArrowDown"===e.key)?void t._navigateDays(e):void t.$.listViewContainer._handleKeyStrokes(e.key);e.key.indexOf("Arrow")>-1&&(t._focusedCell||t._focusCell(),t._navigateDays(e))}}_showDateView(e){const t=this;switch(e=e||t.displayMode){case"month":e="year";break;case"year":e="decade"}if(t.displayMode===e)return;if(t.$.fireEvent("displayModeChanging",{oldDisplayMode:t.displayMode,newDisplayMode:e}).defaultPrevented)return;let a;if(t.displayMode=e,"list"===t.displayModeView&&"month"!==t.displayMode){t._setDisplayModeListContent(t._focusedCell?t._focusedCell.value:t._viewDates[0]);const e=t.$.listViewContainer;e.classList.remove("smart-hidden"),a=e.querySelector("li.active"),a.offsetHeight?t.$.animationPanel.style.transformOrigin=a.offsetLeft+a.offsetWidth/2+"px "+(a.offsetTop>0?a.offsetTop-a.offsetHeight/2:a.offsetTop+a.offsetHeight/2)+"px":t.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(a.offsetTop>0?a.offsetTop-a.offsetHeight/2:e.offsetTop+e.offsetHeight/2)+"px"}else t._focusedCell||t._focusCell(),a=t._focusedCell,t.$.animationPanel.style.transformOrigin=a.offsetLeft+a.offsetWidth/2+"px "+(a.offsetTop+a.offsetHeight/2)+"px";t.$monthsContainer.addClass("smart-hidden"),t.$dateViewContainer.hasClass("smart-hidden")&&t.$dateViewContainer.removeClass("smart-hidden"),"decade"===t.displayMode&&(t.$yearContainer.addClass("smart-calendar-selected"),t.$dateContainer.removeClass("smart-calendar-selected")),t.hasAnimation?t._animateView(-1,a):t._setDisplayModeContent(t._focusedCell?t._focusedCell.value:t._viewDates[0])}_keyUpHandler(e){const t=this;t.disabled||t.readonly||"default"!==t.selectionMode&&"range"!==t.selectionMode||"Shift"!==e.key&&"Control"!==e.key||(t._keysPressed[e.key]=!1)}_handleTooltip(){const e=this,t=e.tooltip;let a=e.$.tooltip;t?(a||(a=document.createElement("smart-tooltip"),a.tooltipTemplate=e.tooltipTemplate,a.arrow=e.tooltipArrow,a.arrowDirection=e.tooltipArrowDirection,a.offset=e.tooltipOffset,a.position=e.tooltipPosition,a.delay=e.tooltipDelay,a.rightToLeft=e.rightToLeft,a.openMode="manual",e.$.tooltip=a),a.parentElement||e.$.calendarContainer.appendChild(a)):a&&a.remove()}_mouseEventsHandler(e){const t=this;if(t.disabled||t.readonly)return;const a=t.$.tooltip;if("mouseenter"===e.type)return void t.$.setAttributeValue("hover",!0);if("mouseleave"===e.type){if(t.$.setAttributeValue("hover",!1),t._newRangeSelectionStarted&&"range"===t.selectionMode){const e=t.$.monthsContainer.children;for(let a=0;a<e.length;a++)t._getMonthCells(e[a]).map((e=>{t._setCellState(e,"hover",!1)}))}return void(t.tooltip&&a&&a.close())}const n=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(!n.closest(".smart-calendar-week"))return void(t.tooltip&&a&&(clearTimeout(t._tooltipAutoCloseTimeout),a[a.contains(n)?"open":"close"]()));const l=n.closest(".smart-calendar-cell");if(!l)return;if(Smart.Utilities.Core.isMobile||t._handleCalendarCellHover(e,l),!t.tooltip&&a)return void a.close();const i=l.hasAttribute("important");if(clearTimeout(t._tooltipAutoCloseTimeout),i&&a&&"mouseover"===e.type)return a.selector=l,void(a.selector!==l?a.close():(t.tooltipTemplate||(a.innerHTML=0===a.innerHTML.trim().length?"Important day!":a.innerHTML),a.open(),t.$.fireEvent("open",{target:a,value:new Date(l.value)})));t._tooltipAutoCloseTimeout=setTimeout(function(){!a||"mouseout"!==e.type&&l&&i||a.close(),clearTimeout(t._tooltipAutoCloseTimeout)}.bind(t),t.tooltipDelay)}_popupEventHandler(e){const t=this,a=t.$.tooltip;if(e.stopPropagation(),e.target!==t.$.monthElement)if(e.target===a)if("close"!==e.type);else{const e=a.selector;t.$.fireEvent("close",{target:a,value:e?new Date(e.value):null})}else t.$.fireEvent(e.type,{target:e.target})}_moveHandler(e){const t=this;if(!Smart.Utilities.Core.isMobile||!t._dragStartDetails||"list"===t.displayModeView&&"month"!==t.displayMode)return;e.originalEvent.preventDefault(),e.preventDefault(),e.stopPropagation();const a={x:Math.round(e.pageX),y:Math.round(e.pageY)};let n,l,i;if(n="portrait"===t.scrollButtonsNavigationMode?a.y>t._dragStartDetails.y?-1*t.months:1*t.months:a.x<t._dragStartDetails.x?1*t.months:-1*t.months,t._previousIteration&&n===t._previousIteration.step)l=t._previousIteration.date;else if(6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode){let e,a;t._focusedCell||t._focusCell();const i=[].slice.call(t._focusedCell.closest(".smart-calendar-weeks").children).filter((e=>!e.classList.contains("smart-hidden")));if(i.length){let s;!t.rightToLeft&&n<0||t.rightToLeft&&n>0?(s=i[0].querySelectorAll(".smart-calendar-cell"),a=t.rightToLeft?s[s.length-1]:s[0]):(s=i[i.length-1].querySelectorAll(".smart-calendar-cell"),a=t.rightToLeft?s[0]:s[s.length-1]),e=new Date(a.value),e.setDate(e.getDate()+n*(t.rightToLeft?-1:1)),l=e}else l=t._getNextDate(n*(t.rightToLeft?-1:1))}else l=t._getNextDate(n*(t.rightToLeft?-1:1));if(!l)return;if(!t._dragStartDetails.navigationDate&&t.$.fireEvent("navigationChanging",{value:new Date(l),type:t.displayMode}).defaultPrevented)return t._cancelAnimation(),void(t._dragStartDetails=void 0);if(t._dragStartDetails.step=n,t._dragStartDetails.navigationDate=new Date(l),!t.hasAnimation)return;if(t._previousIteration={step:n,date:l},t._mobileScrolling=!0,"month"!==t.displayMode)t.$nextMonthsContainer.addClass("smart-calendar-date-view-container"),i=t.$.dateViewContainer,t.$.nextMonthsContainer.children[0].value instanceof Date&&t.$.nextMonthsContainer.children[1].value.getFullYear()===l.getFullYear()||t._setDisplayModeContent(l,t.$.nextMonthsContainer);else if(t.$nextMonthsContainer.hasClass("smart-calendar-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),i=t.$.monthsContainer,!t.$.nextMonthsContainer.children[0]._date||t.$.nextMonthsContainer.children[0]._date.getTime()!==l.getTime()){let e=t.$.nextMonthsContainer.children;for(let a=0;a<e.length;a++)l.setMonth(t._dragStartDetails.navigationDate.getMonth()+a*(t.rightToLeft?-1:1)),t._setMonth(new Date(l),e[a],!0)}6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&t._updateWeeksVisibility(n*(t.rightToLeft?-1:1),t._getCellByDate(l,t.$.nextMonthsContainer)),delete t._mobileScrolling,n<0?(i.style.order=3,t.$.nextMonthsContainer.style.order=1,t.$.body[t._animationSettings.scrollSize]=t.$.body[t._animationSettings.scrollMax]):(i.style.order=1,t.$.nextMonthsContainer.style.order=3,t.$.body[t._animationSettings.scrollSize]=0);const s="portrait"===t.scrollButtonsNavigationMode?"y":"x";Math.abs(t._dragStartDetails[s]-a[s])>5&&(t.$.body[t._animationSettings.scrollSize]+=2*-(a[s]-t._dragStartDetails[s]))}_getNextDate(e){const t=this;let a;if("month"!==t.displayMode){let n;const l=t._focusedCell&&t._focusedCell.value.getFullYear();if("list"===t.displayModeView)a=new Date(t.$.listViewContainer.querySelector("li").getAttribute("value"));else{let e=t._animationStarted?t.$.nextMonthsContainer:t.$.dateViewContainer;a=new Date("year"===t.displayMode?e.children[0].value:e.children[1].value)}n="year"===t.displayMode?1:0!==e?10:1,a.setFullYear(a.getFullYear()+(e>0?n:-n)),a.getTime()<t.min.getTime()&&(a=t.min),a.getTime()>t.max.getTime()&&(a=t.max);const i="month"!==t.displayMode&&"list"===t.displayModeView;if(a.getFullYear()<t.min.getFullYear()||a.getFullYear()>t.max.getFullYear()||!i&&l===a.getFullYear())return}else{let n=t._viewDates[0];if(a=new Date(n),a.setDate(1),a.setMonth(a.getMonth()+e),a.setTime(Math.min(Math.max(a.getTime(),t.min.getTime()),t.max.getTime())),n.getMonth()===a.getMonth()&&n.getFullYear()===a.getFullYear())return}return a}_navigateDays(e){const t=this;let a="ArrowUp"===e.key||"ArrowDown"===e.key?7:1,n="ArrowUp"===e.key||"ArrowLeft"===e.key||"PageUp"===e.key?-1:1;switch(e.key){case"ArrowUp":case"ArrowLeft":case"ArrowDown":case"ArrowRight":if(!t._handleArrowKeys(e,a,n))return;break;case" ":case"Enter":{if("month"!==t.displayMode)return void t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell);const e=t._focusedCell;if("oneExtended"===t.selectionMode&&e)return t._clearSelection(!0),void t._selectDate(e.value,t._selectedCells.indexOf(e.value)>-1);break}case"Control":case"Shift":return"default"===t.selectionMode&&(t._keysPressed[e.key]=!0),void("range"===t.selectionMode&&(t._keysPressed[e.key]="Control"===e.key));case"Home":case"End":{e.preventDefault();let a,n=function(t){if("Home"===e.key){for(let e=0;e<t.length;e++)if(!t[e].otherMonth&&(!t[e].disabled||!t[e].restricted)&&t[e].offsetHeight)return t[e]}else for(let e=t.length-1;e>=0;e--)if(!t[e].otherMonth&&(!t[e].disabled||!t[e].restricted)&&t[e].offsetHeight)return t[e]};if(a="month"!==t.displayMode?n(t.$.dateViewContainer.children):n(t._getMonthCells(t._focusedCell.closest(".smart-calendar-month"),t.rightToLeft)),!a)return;if(t._focusCell(a),"month"!==t.displayMode)return;break}case"PageUp":case"PageDown":if(!t._handlePageUpDownKeys(e,n))return;break;default:return}"oneExtended"!==t.selectionMode&&t._focusedCell&&t._handleDateSelection(t._focusedCell)}_handleArrowKeys(e,t,a){const n=this;let l;if("month"!==n.displayMode||n._animationStarted||n.unfocusable||n.$.body.focus(),n._focusedCell||n._focusCell(n._getCellByDate(new Date)),e.altKey)return;if(e.ctrlKey){if("ArrowDown"===e.key||"ArrowUp"===e.key){if("classic"===n.calendarMode)return;let t;switch(n.displayMode){case"month":t="ArrowDown"===e.key?"month":"year";break;case"year":t="ArrowDown"===e.key?"month":"decade";break;case"decade":t="ArrowDown"===e.key?"year":"decade"}if(t!==n.displayMode){const e=n.displayMode;n.displayMode=t,n._setDisplayMode(e,t,"month"===e),n._keysPressed&&delete n._keysPressed.Control}}return}if(e.preventDefault(),!n.rightToLeft||"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||(a*=-1),"month"!==n.displayMode&&"list"!==n.displayModeView){const i=n._animationStarted?n.$.nextMonthsContainer.children:n.$.dateViewContainer.children;if(t="ArrowUp"===e.key||"ArrowDown"===e.key?4:1,"year"===n.displayMode){const e=n._focusedCell.value.getMonth()+a*t;let i=new Date(n._focusedCell.value.getFullYear(),e+1,0);n._focusedCell.value.getDate()<=i.getDate()&&(i=n._focusedCell.value),l=new Date(n._focusedCell.value.getFullYear(),e,i.getDate())}else l=new Date(n._focusedCell.value.getFullYear()+a*t,n._focusedCell.value.getMonth(),n._focusedCell.value.getDate());if("year"===n.displayMode){if(l.getFullYear()<n.min.getFullYear()||l.getFullYear()===n.min.getFullYear()&&l.getMonth()<n.min.getMonth()||l.getFullYear()>n.max.getFullYear()||l.getFullYear()===n.max.getFullYear()&&l.getMonth()>n.max.getMonth())return;l.getTime()>i[i.length-1].value.getTime()?n.navigate(1):l.getTime()<i[0].value.getTime()&&n.navigate(-1)}else{if(l.getFullYear()<n.min.getFullYear()||l.getFullYear()>n.max.getFullYear())return;if(l.getFullYear()<i[1].value.getFullYear()||l.getFullYear()>i[10].value.getFullYear()){let t=n._focusedCell;n.navigate(a),"ArrowUp"!==e.key&&"ArrowDown"!==e.key||(t===i[3]||t===i[4]||t===i[7]||t===i[8]?l.setFullYear(l.getFullYear()+2*a):l.setFullYear(l.getFullYear()-2*a))}}return void n._focusCell(n._getCellByDate(l,n._animationStarted?n.$.nextMonthsContainer:void 0))}if(!n._focusedCell)return;const i=n.restrictedDates.map(Number);for(l=new Date(n._focusedCell.value.getFullYear(),n._focusedCell.value.getMonth(),n._focusedCell.value.getDate()+a*t,0,0,0,0);i.indexOf(l.getTime())>-1;)l.setDate(l.getDate()+a);if(l.getTime()<n.min.getTime()||l.getTime()>n.max.getTime())return;n._isDateInView(l)||n.navigate(a*n.months);let s=n._getCellByDate(l,n._animationStarted?n.$.nextMonthsContainer:void 0);return n._focusCell(s),n._updateWeeksVisibility(a),!(["zeroOrMany","oneOrMany","none","many","week","range"].indexOf(n.selectionMode)>-1)||void 0}_handlePageUpDownKeys(e,t){const a=this;let n;if(e.preventDefault(),"month"!==a.displayMode){if(n=a._focusedCell,!a.navigate(t))return;for(;n&&n.classList.contains("smart-visibility-hidden");)n=null===n.previousElementSibling?n.nextElementSibling:n.previousElementSibling;return a._focusCell(n),void(a.hasAnimation&&"decade"===a.displayMode&&a._focusedCell.value.setFullYear(a._focusedCell.value.getFullYear()+10*t))}n=new Date(a._focusedCell.value.getFullYear(),a._focusedCell.value.getMonth()+t,1,0,0,0,0);let l=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return a._focusedCell.value.getDate()>l?n.setDate(l):n.setDate(a._focusedCell.value.getDate()),a._isDateInView(n)||a.navigate(n),a._animationStarted?a._focusCell(a._getCellByDate(n,a.$.nextMonthsContainer)):a._focusCell(a._getCellByDate(n)),!0}_selectDate(e,t,a){const n=this;if(void 0===n._viewDates||"none"===n.selectionMode)return;let l,i=n.selectedDates.slice(0),s=n._getCellByDate(e,n._animationStarted?n.$.nextMonthsContainer:void 0);s&&n._selectCell(s),(e=new Date(e)).setHours(0,0,0,0),l=i.map(Number).indexOf(e.getTime()),n.restrictedDates.map(Number).indexOf(e.getTime())>-1||e.getTime()<n.min.getTime()||e.getTime()>n.max.getTime()||(l>-1?i.splice(l,1):i.push(e),a||(n.selectedDates=i),n._refreshFooter(),n.$.hiddenInput.value=n.selectedDates.toString(),!t&&n.isInitialized&&(n.$.fireEvent("change",{value:[e]}),n._updateTargetValue()),n._refreshTitle())}_selectCell(e){const t=this;if(!e||t.restrictedDates.map(Number).indexOf(e.value.getTime())>-1||t.disableAutoNavigation&&!1===e.otherMonth||e.value.getTime()<t.min.getTime()||e.value.getTime()>t.max.getTime())return;const a=t._selectedCells.indexOf(e);a>-1?(t._setCellState(e,"selected",!1),t._selectedCells.splice(a,1)):(t._setCellState(e,"selected",!0),t._selectedCells.push(e)),t._focusCell(e)}_refreshDayOfWeekTitles(){const e=this;let t,a=[],n=new Date;function l(t){let a;return"firstTwoLetters"===e.dayNameFormat?(a=new Intl.DateTimeFormat(e.locale,{weekday:"long"}).format(t),a=8206===a.charCodeAt(0)?a.substring(1,3):a.substring(0,2)):a=new Intl.DateTimeFormat(e.locale,{weekday:e.dayNameFormat}).format(t),a}for(let e=1;e<8;e++)n.setDate(e),t={number:n.getDay(),name:l(n)},a.push(t);a.sort(((e,t)=>e.number>t.number?1:-1));const i=e.$.monthsContainer.children;let s,o;for(let t=0;t<i.length;t++)if(s=i[t].getElementsByClassName("smart-calendar-week-titles")[0].children,o=e.firstDayOfWeek>6?0:e.firstDayOfWeek,e.rightToLeft)for(let e=s.length-1;e>=1;e--)s[e].textContent=a[o++].name,o=o>6?0:o;else for(let e=1;e<s.length;e++)s[e].textContent=a[o++].name,o=o>6?0:o;if(e.hasAnimation){const t=e.$.monthsContainer.getElementsByClassName("smart-calendar-week-titles")[0].innerHTML,a=e.$.nextMonthsContainer.getElementsByClassName("smart-calendar-week-titles");for(let e=0;e<a.length;e++)a[e].innerHTML=t}}_refreshCalendarMode(){const e=this;if(!e.headerTemplate)if(e._refreshMonthNames(),"default"===e.calendarMode){e.$classicHeaderDate.addClass("smart-hidden"),e.$defaultHeaderDate.removeClass("smart-hidden");const t=e._viewDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime())),a=t[0],n=t[t.length-1];a.setDate(2);let l=e.monthNameFormat;"firstTwoLetters"===l&&(l="long");let i=a.toLocaleDateString(e.locale,{year:e.yearFormat,month:l});e.months>1&&(n.setDate(2),i+=" - "+n.toLocaleDateString(e.locale,{year:e.yearFormat,month:l})),e.$.defaultHeaderDate.innerHTML=i,e.unfocusable||e.$.dateElement.setAttribute("tabindex",e.tabIndex>0?e.tabIndex:0)}else e.$defaultHeaderDate.addClass("smart-hidden"),e.$classicHeaderDate.removeClass("smart-hidden"),e.$.dateElement.removeAttribute("tabindex")}_refreshFooter(){const e=this;if(!(e.viewSections.indexOf("footer")<0||0===e.$.footer.offsetHeight))if(e.footerTemplate){if("function"==typeof e.footerTemplate)return;let a=e._layoutTemplates.filter((t=>t.selector===e.$.footer))[0],n=document.importNode(a.template.content,!0);if(a.bindings.length>0){let e=n.childNodes[a.bindings[0].childNodeIndex];a.selector.childNodes[a.bindings[0].childNodeIndex].innerHTML=e.innerHTML.replace(a.bindings[0].bindingString,t())}}else e.$.selectedDatesRange.innerHTML=t();function t(){if(0===e.selectedDates.length)return"";if(1===e.selectedDates.length)return e.selectedDates[0].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"});{let t=e.selectedDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime()));return t[0].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"})+" - "+t[t.length-1].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"})}}}_refreshImportantDates(){const e=this;if("month"===e.displayMode){e._clearImportantDates();for(let t=0;t<e.importantDates.length;t++)e._setImportantDate(e.importantDates[t])}}_clearImportantDates(){const e=this,t=e.$.monthsContainer.children;for(let a=0;a<t.length;a++)e._getMonthCells(t[a]).map((t=>{e._setCellState(t,"important",!1)}))}_setImportantDate(e,t){const a=this,n=a._getCellByDate(e);t||(t=n),t&&(a._setCellState(t,"important",!0),a._applyImportantDateTemplate(t))}_applyImportantDateTemplate(e){const t=this;if(!t._importantDatesTemplate)return"function"==typeof t.importantDatesTemplate?void t.importantDatesTemplate(e,{value:e.value}):void(e.innerHTML=e.value.getDate()+"");let a=document.importNode(t._importantDatesTemplate.content,!0);if(t._bindingDetails&&t._bindingDetails.length>0){let n=a.childNodes[t._bindingDetails[0].childNodeIndex];n.innerHTML=n.innerHTML.replace(t._bindingDetails[0].bindingString,e.value.getDate())}e.innerHTML="";for(let t=0;t<a.childNodes.length;t++)a.childNodes[t].outerHTML&&(e.innerHTML+=a.childNodes[t].outerHTML)}_setMonth(e,t,a){const n=this,l=n._getDays(e,n.selectedDates),i=n._getDays(e,n.importantDates),s=n._getDays(e,n.restrictedDates);e.setDate(1),t||(t=n.$.month),t._date=new Date(e),a||((!n._viewDates||n._viewDates.length>=n.months)&&(n._viewDates=[]),n._viewDates.push(new Date(e)));let o=((e=new Date(e)).getDay()-n.firstDayOfWeek+7)%7;e.setDate(0);let r=e.getDate();if(e.setDate(32),e.setDate(1),e.setDate(32),n._selectedCells)for(let e=0;e<n._selectedCells.length;e++)n._selectedCells[e].closest(".smart-calendar-month")===t&&n._setCellState(n._selectedCells[e],"selected",!1);n._setMonthContent(e,t,{previusMonthDays:r,firstDayOfWeek:o,selectedDates:l,importantDates:i,restrictedDates:s})}_setMonthContent(e,t,a){const n=this,l=32-e.getDate(),i=n._getMonthCells(t,n.rightToLeft),s=t._date.getMonth(),o=t._date.getFullYear(),r=new Date;let d,c=1,m=1;r.setHours(0,0,0,0),i.map((e=>{n._setCellState(e,"restricted",!1),n._setCellState(e,"selected",!1),n._setCellState(e,"otherMonth",!1),n._setCellState(e,"focus",!1),n._setCellState(e,"important",!1),n._setCellState(e,"today",!1),n._setCellState(e,"disabled",!1),n._setCellState(e,"hover",!1)}));for(let e=0;e<i.length;e++){const h=i[e];e===a.firstDayOfWeek&&m<=l?(h.className="smart-calendar-cell",h.value=new Date(o,s,m),h.innerHTML=h.value.getDate().toString(),a.restrictedDates.indexOf(m)>-1||h.value.getTime()<n.min.getTime()||h.value.getTime()>n.max.getTime()?n._setCellState(h,"restricted",!0):a.selectedDates.indexOf(m)>-1&&(n._setCellState(h,"selected",!0),n._selectedCells.indexOf(h)<0&&n._selectedCells.push(h)),a.importantDates.indexOf(m)>-1&&(n._setImportantDate(h.value,h),a.importantDates.splice(a.importantDates.indexOf(m),1)),h.value.getTime()===r.getTime()&&n._setCellState(h,"today",!0),a.firstDayOfWeek++,m++):(1===m?(h.value=new Date(o,s-1,++a.previusMonthDays-a.firstDayOfWeek),d=!!(h.value.getTime()<n.min.getTime()||t.previousElementSibling)):(h.value=new Date(o,s+1,c++),d=!!(h.value.getTime()>n.max.getTime()||t.nextElementSibling)),h.innerHTML=h.value.getDate().toString(),n._setCellState(h,"otherMonth",!0),d?h.classList.add("smart-visibility-hidden"):h.classList.remove("smart-visibility-hidden"))}n.months>1&&(t.firstElementChild.innerHTML=n.dateFormatFunction?n.dateFormatFunction(t._date):n._monthsNames[s]+" "+t._date.toLocaleDateString(n.locale,{year:n.yearFormat})),n._setMonthWeekNumbers(t)}_refreshMonthNames(){const e=this;let t,a=new Date;function n(t){let a=e.monthNameFormat;"firstTwoLetters"===a&&(a="long");let n=new Intl.DateTimeFormat(e.locale,{month:a}).format(t);return"firstTwoLetters"===e.monthNameFormat&&(n=8206===n.charCodeAt(0)?n.substring(0,2):n.substring(1,3)),n}a.setDate(1),e._monthsNames=[];for(let l=0;l<12;l++)a.setMonth(l),t=n(a),e._monthsNames.push(t);if("classic"===e.calendarMode&&e.$.monthElement){let t=e.$.monthsContainer.children;if(e.$.monthElement.dataSource&&(e._changeEventFired=1),e.shadowRoot?e._setMonthElementPropertyInShadowDOM("dataSource",e._monthsNames):e.$.monthElement.dataSource=e._monthsNames,e._viewDates){for(let a=0;a<t.length;a++)t[a].firstElementChild.textContent=e._monthsNames[t[a]._date.getMonth()]+" "+t[a]._date.getFullYear();e._changeEventFired=1,e.shadowRoot?e._setMonthElementPropertyInShadowDOM("selectedIndex",e._viewDates.map((e=>e.getMonth()))[0]):e.$.monthElement.selectedIndex=e._viewDates.map((e=>e.getMonth()))[0]}}}_setMonthWeekNumbers(e){const t=this,a=function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!0};let n=e.getElementsByClassName("smart-calendar-week");n=[].slice.call(n);for(let l=0;l<n.length;l++){if(!a(n[l])){n[l].children[0].innerHTML="";continue}const i=n[l].children[1],s=i.otherMonth?i.value.getTime()>e._date.getTime()?1:-1:0;n[l].children[0].innerHTML=t._getWeekNumber(new Date(e._date.getFullYear(),e._date.getMonth()+s,i.value.getDate()))}}_setRestrictedDates(e){const t=this,a=t.$.monthsContainer.children;for(let e=0;e<a.length;e++)t._getMonthCells(a[e]).map((e=>{t._setCellState(e,"restricted",!1)}));if(t._viewDates){const a=function(e){for(let a=0;a<t._viewDates.length;a++)if(t._viewDates[a].getFullYear()===e.getFullYear()&&t._viewDates[a].getMonth()===e.getMonth())return!0};for(let n=0;n<e.length;n++)if(a(e[n])){const a=t._getCellByDate(e[n]);t._setCellState(a,"restricted",!0)}}}_setScrollButtonsNavigationMode(){const e=this;"landscape"!==e.scrollButtonsNavigationMode?(e.$.previousMonthButton&&(e.$.previousMonthButton.$.button.firstElementChild.className="smart-arrow-down smart-arrow"),e.$.nextMonthButton&&(e.$.nextMonthButton.$.button.firstElementChild.className="smart-arrow-up smart-arrow")):(e.$.previousMonthButton&&(e.$.previousMonthButton.$.button.firstElementChild.className="smart-arrow-left smart-arrow"),e.$.nextMonthButton&&(e.$.nextMonthButton.$.button.firstElementChild.className="smart-arrow-right smart-arrow")),e._applyAnimationSettings(!0)}_refreshTitle(){const e=this;let t=e.selectedDates.length>0?e.selectedDates[e.selectedDates.length-1]:new Date;if(e.titleTemplate){if("function"==typeof e.titleTemplate)return;let a=e._layoutTemplates.filter((t=>t.selector===e.$.title))[0],n=document.importNode(a.template.content,!0);if(a.bindings.length>0){let l=n.childNodes[a.bindings[0].childNodeIndex];return t=t.toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"}),void(a.selector.childNodes[a.bindings[0].childNodeIndex].innerHTML=l.innerHTML.replace(a.bindings[0].bindingString,t))}}e.$.title.children[0].innerHTML=t.toLocaleDateString(e.locale,{year:e.yearFormat}),e.$.title.children[1].innerHTML="landscape"===e.view?t.toLocaleDateString(e.locale,{weekday:"short"})+",</br>"+t.toLocaleDateString(e.locale,{month:"short",day:"numeric"}):t.toLocaleDateString(e.locale,{weekday:"short"})+", "+t.toLocaleDateString(e.locale,{month:"short",day:"numeric"})}_setWeeksVisibility(e){const t=this,a=e.children;let n;function l(e){(function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!1;return!0})(e)||n>=t.weeks?e.classList.add("smart-hidden"):n<t.weeks&&(e.classList.remove("smart-hidden"),n++)}for(let e=0;e<a.length;e++){let i=a[e].getElementsByClassName("smart-calendar-week");i=[].slice.call(i);let s=t._selectedCells.filter((t=>t.closest(".smart-calendar-month")===a[e]));if(6!==t.weeks)if(n=0,s.length>0){let e=s[s.length-1],t=i.indexOf(e.parentElement);for(let e=t;e<i.length;e++)l(i[e]);for(let e=t-1;e>=0;e--)l(i[e])}else for(let e=0;e<i.length;e++)l(i[e]);else i.map((e=>e.classList.remove("smart-hidden")))}}_refreshHeaderElements(){const e=this,t=document.activeElement.closest("smart-calendar")===e,a=e._animationStarted?e.$.nextMonthsContainer:e.$.dateViewContainer;let n,l,i=e._viewDates[e._viewDates.length-1],s=e._viewDates.map((e=>e.getFullYear()));if("month"===e.displayMode||"list"!==e.displayModeView){if("classic"===e.calendarMode&&e.$.monthElement&&e.$.monthElement instanceof HTMLDivElement){const t=document.createElement("smart-input");t.setAttribute("smart-id","monthElement"),t.classList.add("smart-calendar-month-element"),t.dropDownPosition="bottom",t.selectionMode="one",t.disabled=e.disabled,t.rightToLeft=e.rightToLeft,t.theme=e.theme,t.dropDownWidth=e.dropDownWidth,t.dropDownHeight=e.dropDownHeight,t.readonly=!0,t.dropDownButtonPosition="right";const a=e.$.monthElement;e.$.monthElement.parentNode.insertBefore(t,e.$.monthElement),e.$.monthElement=t,a.remove()}if(e.$.previousMonthButton&&!e.disabled&&("month"!==e.displayMode&&e.$.dateViewContainer.children[0].value?l="year"===e.displayMode?a.children[0].value.getFullYear()-1:a.children[1].value.getFullYear()-1:e._viewDates[0].getMonth()-1<0?(n=11,l=e._viewDates[0].getFullYear()-1):(n=e._viewDates[0].getMonth()-1,l=e._viewDates[0].getFullYear()),e.$.previousMonthButton.disabled=l<e.min.getFullYear()||l===e.min.getFullYear()&&n<e.min.getMonth(),e.$.previousMonthButton.disabled&&t&&e.$.body.focus()),e.$.nextMonthButton&&!e.disabled&&("month"!==e.displayMode&&e.$.dateViewContainer.children[0].value?l="year"===e.displayMode?a.children[0].value.getFullYear()+1:a.children[1].value.getFullYear()+11:i.getMonth()+1>11?(n=0,l=i.getFullYear()+1):(n=i.getMonth()+1,l=i.getFullYear()),e.$.nextMonthButton.disabled=l>e.max.getFullYear()||l===e.max.getFullYear()&&n>e.max.getMonth(),e.$.nextMonthButton.disabled&&t&&e.$.body.focus()),"classic"===e.calendarMode&&e.$.monthElement){let t=[...e._monthsNames];if(s.indexOf(e.min.getFullYear())>-1)for(let a=0;a<e.min.getMonth();a++)t[a]="";if(s.indexOf(e.max.getFullYear())>-1)for(let a=e.max.getMonth()+1;a<t.length;a++)t[a]="";t=t.filter((e=>""!==e));const a=Math.max(0,e.$.monthElement.selectedIndex);e.$.monthElement.dataSource=t,e._changeEventFired=0!==e.$.monthElement.selectedIndex,e.shadowRoot?e._setMonthElementPropertyInShadowDOM("selectedIndex",e._viewDates[0].getMonth()):e.$.monthElement.selectedIndex=a,e._changeEventFired=0}e.$.previousYearButton&&!e.disabled&&(l=e._viewDates[0].getFullYear()-1,e.$.previousYearButton.disabled=l<e.min.getFullYear(),e.$.previousYearButton.disabled&&t&&e.$.body.focus()),e.$.nextYearButton&&!e.disabled&&(l=i.getFullYear()+1,e.$.nextYearButton.disabled=l>e.max.getFullYear(),e.$.nextYearButton.disabled&&t&&e.$.body.focus()),e.$.yearElement&&(e.$.yearElement.value=s[0],e.$.yearElement.disabled=i.getFullYear()+1>e.max.getFullYear()&&e._viewDates[0].getFullYear()-1<e.min.getFullYear())}}_setMonthElementPropertyInShadowDOM(e,t){const a=this.$.monthElement,n=a.context;a.context=document,this.$.monthElement[e]=t,a.context=n}_refreshHeaderTitle(){const e=this;let t;function a(){if("month"!==e.displayMode){if("list"===e.displayModeView){const a=e.$.listViewContainer;if(!a)return;const n=a.querySelectorAll("li");if(!n.length)return"";let l;a.querySelector("li.active")&&(l=a.querySelector("li.active").getAttribute("value")),t="year"===e.displayMode?new Date(l||n[0].getAttribute("value")).getFullYear():new Date(n[0].getAttribute("value")).getFullYear()+" - "+new Date(n[n.length-1].getAttribute("value")).getFullYear()}else if(e.$.dateViewContainer.children[0].value){let a=e._animationStarted?e.$.nextMonthsContainer.children:e.$.dateViewContainer.children;t="year"===e.displayMode?a[0].value.getFullYear():a[1].value.getFullYear()+" - "+a[a.length-2].value.getFullYear()}if(t)return t}const a=e._viewDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime())),n=a[0],l=a[a.length-1];n.setDate(2);let i=e.monthNameFormat;return"firstTwoLetters"===i&&(i="long"),t=n.toLocaleDateString(e.locale,{year:e.yearFormat,month:i}),e.months>1&&(l.setDate(2),t+=" - "+l.toLocaleDateString(e.locale,{year:e.yearFormat,month:i})),t}if("default"===e.calendarMode&&(e.$.defaultHeaderDate.innerHTML=a()),"function"==typeof e.headerTemplate||!e._layoutTemplates)return;let n=e._layoutTemplates.filter((t=>t.selector===e.$.header))[0];if(!n)return;let l=document.importNode(n.template.content,!0);if(n.bindings.length>0){const t=l.childNodes[n.bindings[0].childNodeIndex];(e.shadowRoot?e:n.selector).childNodes[n.bindings[0].childNodeIndex].innerHTML=t.innerHTML.replace(n.bindings[0].bindingString,e.dateFormatFunction?e.dateFormatFunction(e._viewDates):a())}}_updateWeeksVisibility(e,t){const a=this;let n=(t||a._focusedCell).parentElement;function l(){for(let e=o;e<s.length;e++)if(s[e].classList.contains("smart-hidden")&&!r(s[e])&&(s[e].classList.remove("smart-hidden"),d++,d===a.weeks))return!0}function i(){for(let e=o;e>=0;--e)if(s[e].classList.contains("smart-hidden")&&!r(s[e])&&(s[e].classList.remove("smart-hidden"),d++,d===a.weeks))return!0}if(!t&&!n.classList.contains("smart-hidden"))return;const s=[].slice.call(n.parentElement.children),o=s.indexOf(n),r=function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!1;return!0};let d=0;if(s.map((e=>e.classList.add("smart-hidden"))),e>0){if(l())return;i()}else{if(i())return;l()}}_getValidDates(e){let t=[];function a(e){if(e instanceof Date)return e;if(Smart.Utilities.DateTime&&e instanceof Smart.Utilities.DateTime)return e.toDate();if("string"==typeof e){if("new Date()"===e.trim()||"new Smart.Utilities.DateTime()"===e.trim())return new Date;let t=/(\d+[,-.\/]{1}\s*\d+[,-.\/]{1}\s*\d+)/;const a=()=>(e=e.replace(/[,-.\/]/g,",").split(",")).length>2?e=new Date(parseInt(e[0]),parseInt(e[1])-1,parseInt(e[2])):new Date;return t.test(e)&&(e=t.exec(e)[0].replace(/[,-.\/]/g,",").split(","))?new Date(parseInt(e[0]),parseInt(e[1])-1,parseInt(e[2])):a()}}if(void 0===e)return null;if(Array.isArray(e))for(let n=0;n<e.length;n++)t.push(a(e[n]));else t.push(a(e));return t=t.filter((e=>e&&"Invalid Date"!==e.toDateString())),t.map((e=>e.setHours(0,0,0,0))),t}_getValidDate(e){const t=this._getValidDates(e);return t.length>0?t[0]:null}_validateSelectedDates(e){const t=this;let a=[];e||(e=t.selectedDates);let n=e.slice(0),l=function(e){for(let a=0;a<t.restrictedDates.length;a++)if(t.restrictedDates[a].getTime()===e.getTime())return!0};t.selectedDates=n.filter((function(e){if(e.getTime()>=t.min.getTime()&&e.getTime()<=t.max.getTime()&&!l(e))return!0;a.push(e)})),t._viewDates&&(a.map((e=>t._selectDate(e))),t._focusCell())}_validateMinMax(e,t,a){const n=this;switch(e){case"min":t=n._getValidDate(n[e]),n.min=t||a||n.properties.min.defaultValue;break;case"max":t=n._getValidDate(n[e]),n.max=t||a||n.properties.max.defaultValue;break;default:t=n._getValidDate(n.min),n.min=t||a||n.properties.min.defaultValue,t=n._getValidDate(n.max),n.max=t||a||n.properties.max.defaultValue}n.min=n.min.getTime()>n.max.getTime()?n.max:n.min,n.min.setHours(0,0,0,0),n.max.setHours(0,0,0,0);let l,i=n.$.monthsContainer.children;if(n._viewDates){if(n._viewDates[0].getTime()>n.max.getTime()||n._viewDates[0].getTime()<n.min.getTime())return void n._handleMonths();for(let e=0;e<i.length;e++){l=n._getMonthCells(i[e]);for(let t=0;t<l.length;t++){const a=l[t];if(a.value.getTime()>=n.min.getTime()&&a.value.getTime()<=n.max.getTime())n._setCellState(a,"restricted",!1),a.value.getMonth()===i[e]._date.getMonth()?a.classList.remove("smart-visibility-hidden"):n.hideOtherMonthDays||(n._setCellState(a,"otherMonth",!0),a.classList.remove("smart-visibility-hidden")),"month"!==n.displayMode&&n._setCellState(a,"otherMonth",!1);else{if(a.otherMonth){if(a.classList.contains("smart-visibility-hidden")){n._setCellState(a,"restricted",!1);continue}}else n._setCellState(a,"restricted",!0);"month"!==n.displayMode&&(a.classList.remove("smart-visibility-hidden"),n._setCellState(a,"otherMonth",!0))}}}}}_setCellState(e,t,a){e[t]=a;const n=Smart.Utilities.Core.toDash(t);a?(e.setAttribute(n,""),"selected"===t?e.setAttribute("aria-selected",!0):"today"===t?e.setAttribute("aria-current","date"):"restricted"===t?e.removeAttribute("aria-selected"):"disabled"===t&&(e.removeAttribute("aria-selected"),e.setAttribute("aria-disabled",!0))):(e.removeAttribute(n),"selected"===t?"none"===this.selectionMode||e.restricted||e.disabled?e.removeAttribute("aria-selected"):e.setAttribute("aria-selected",!1):"today"===t?e.removeAttribute("aria-current"):"restricted"!==t||e.disabled?"disabled"===t&&(e.removeAttribute("aria-disabled"),e.restricted||e.setAttribute("aria-selected",!1)):e.setAttribute("aria-selected",!1))}_validateTemplate(e,t){if(null===t||!t)return;if("function"==typeof t)return;const a=this;if("content"in document.createElement("template")){if("string"==typeof t&&(t=document.getElementById(t)),null!==t&&"content"in t)return t;a.error(a.localize("invalidTemplate",{elementType:a.nodeName.toLowerCase(),property:e}))}else a.error(a.localize("htmlTemplateNotSuported",{elementType:a.nodeName.toLowerCase()}))}_weeksDownHandler(e,t){const a=this,n=t.value;let l;if(a.$.body.contains(t))if(t.otherMonth&&(l=t.value.getTime()>t.closest(".smart-calendar-month")._date.getTime()?1:-1),n&&a.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t,e.pageX,e.pageY),l){if(a._isDateInView(n))return;a.disableAutoNavigation||a.navigate(l*a.months)}else(t=a._getCellByDate(n))&&(t.disabled||t.restricted)||a._handleDateSelection(t)}_firstDayOfWeekValidator(e,t){return Math.min(Math.max(0,isNaN(t)?6:t),6)}_weeksValidator(e,t){return Math.min(Math.max(1,isNaN(t)?6:t),6)}_monthsValidator(e,t){return Math.min(Math.max(1,isNaN(t)?1:t),12)}});
|
|
74
|
+
Smart("smart-calendar",class extends Smart.BaseElement{static get properties(){return{animationSettings:{value:null,type:"object"},calendarMode:{value:"default",allowedValues:["default","classic"],type:"string"},dayNameFormat:{value:"firstTwoLetters",allowedValues:["narrow","firstTwoLetters","long","short"],type:"string"},dateFormatFunction:{value:null,type:"function"},disableAutoNavigation:{value:!1,type:"boolean"},displayMode:{value:"month",allowedValues:["month","year","decade"],type:"string"},displayModeView:{value:"table",allowedValues:["table","list"],type:"string"},dropDownHeight:{value:"200",type:"string"},dropDownWidth:{value:"",type:"string"},firstDayOfWeek:{value:0,type:"number",defaultValue:0,validator:"_firstDayOfWeekValidator"},footerTemplate:{value:null,type:"any"},headerTemplate:{value:null,type:"any"},hideDayNames:{value:!1,type:"boolean"},hideOtherMonthDays:{value:!1,type:"boolean"},hideTooltipArrow:{value:!1,type:"boolean"},importantDates:{value:[],type:"array",defaultValue:[]},importantDatesTemplate:{value:null,type:"any"},max:{value:new Date(2100,0,1),type:"any",defaultValue:new Date(2100,0,1)},min:{value:new Date(1900,0,1),type:"any",defaultValue:new Date(1900,0,1)},months:{value:1,type:"number",defaultValue:1,validator:"_monthsValidator"},monthNameFormat:{value:"long",allowedValues:["narrow","firstTwoLetters","long","short","2-digit","numeric"],type:"string"},name:{value:"",type:"string"},restrictedDates:{value:[],type:"array",defaultValue:[]},scrollButtonsNavigationMode:{value:"landscape",allowedValues:["portrait","landscape"],type:"string"},scrollButtonsPosition:{value:"both",allowedValues:["near","far","both"],type:"string"},selectedDates:{value:[],reflectToAttribute:!1,type:"array"},selectionMode:{value:"default",allowedValues:["none","default","one","oneExtended","many","zeroOrMany","oneOrMany","zeroOrOne","week","range"],type:"string"},spinButtonsDelay:{value:80,type:"number"},spinButtonsInitialDelay:{value:0,type:"number"},titleTemplate:{value:null,type:"any"},tooltip:{value:!1,type:"boolean"},tooltipArrow:{value:!0,type:"boolean"},tooltipArrowDirection:{allowedValues:["bottom","top","left","right","none"],value:"bottom",type:"string"},tooltipDelay:{value:100,type:"number"},tooltipOffset:{value:[],type:"array"},tooltipPosition:{value:"auto",allowedValues:["auto","bottom","top","left","right","absolute"],type:"string"},tooltipTemplate:{value:null,type:"any"},view:{value:"portrait",allowedValues:["landscape","portrait"],type:"string"},viewSections:{value:["header"],type:"array"},weekNumbers:{value:!1,type:"boolean"},weeks:{value:6,type:"number",defaultValue:6,validator:"_weeksValidator"},yearFormat:{value:"numeric",allowedValues:["2-digit","numeric"],type:"string"}}}static get listeners(){return{"container.down":"_downHandler","document.up":"_documentUpHandler","body.move":"_moveHandler","container.wheel":"_containerWheelHandler","body.focus":"_bodyFocusStateHandler","body.blur":"_bodyBlurStateHandler","header.click":"_headerClickHandler","header.change":"_headerChangeHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",mouseenter:"_mouseEventsHandler",mouseleave:"_mouseEventsHandler","container.mouseover":"_mouseEventsHandler","container.mouseout":"_mouseEventsHandler","container.open":"_popupEventHandler","container.close":"_popupEventHandler"}}static get methods(){return{select:"select(date=new Date(): date|string): void",clearSelection:"clearSelection(): void",today:"today(): date",navigate:"navigate(step: date|string|int): bool"}}static get styleUrls(){return["smart.calendar.css"]}template(){return'<div id="container" role="presentation">\n <div id="title" class="smart-calendar-title" role="heading" aria-level="1">\n <div id="yearContainer" class="smart-calendar-year-container" role="button"></div>\n <div id="dateContainer" class="smart-calendar-date-container smart-calendar-selected" role="button"></div>\n </div>\n <div id="calendarContainer" class="smart-calendar-container">\n <div id="header" class="smart-calendar-header">\n <smart-repeat-button prev-month class="smart-calendar-button" id="previousMonthButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Previous month">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n <div id="dateElement" class="smart-calendar-date-element" role="presentation">\n <div id="defaultHeaderDate" role="button"></div>\n <div id="classicHeaderDate">\n <div id="monthElement" class="smart-calendar-month-element" disabled="[[disabled]]" role="presentation">\n </div>\n <input class="smart-calendar-year-element" id="yearElement" disabled="[[disabled]]" readonly="[[readonly]]" aria-label="Year" />\n <span class="smart-calendar-year-elements">\n <smart-repeat-button next-year class="smart-calendar-button" id="nextYearButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Next year">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n <smart-repeat-button prev-year class="smart-calendar-button" id="previousYearButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Previous year">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n </span>\n </div>\n </div>\n <smart-repeat-button next-month class="smart-calendar-button" id="nextMonthButton" animation="[[animation]]" initial-delay="[[spinButtonsInitialDelay]]" delay="[[spinButtonsDelay]]" disabled="[[disabled]]" readonly="[[readonly]]" right-to-left="[[rightToLeft]]" aria-label="Next month">\n <span aria-hidden="true"></span>\n </smart-repeat-button>\n </div>\n <div id="body" class="smart-content smart-calendar-body" role="presentation">\n <div id="monthsContainer" class="smart-calendar-months-container" role="presentation">\n <div id="month" class="smart-calendar-month" role="grid">\n <div id="monthName" class="smart-calendar-month-name"></div>\n <div id="weekTitles" class="smart-calendar-week-titles" role="row">\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n <div class="smart-calendar-week-title" role="columnheader"></div>\n </div>\n <div id="weeks" class="smart-calendar-weeks" role="rowgroup">\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n <div class="smart-calendar-week" role="row">\n <div class="smart-calendar-week-number" role="rowheader"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"></div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n <div class="smart-calendar-cell" role="gridcell"> </div>\n </div>\n </div>\n </div>\n </div>\n <div id="dateViewContainer" class="smart-calendar-date-view-container smart-hidden">\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n <div class="smart-calendar-cell" role="button"></div>\n </div>\n <div id="monthsSeparator" class="smart-calendar-month-separator"></div>\n <div id="nextMonthsContainer" class="smart-calendar-next-months-container" aria-hidden="true"></div>\n <div id="animationPanel" class="smart-calendar-animation-panel smart-hidden"></div>\n </div>\n <div id="footer" class="smart-calendar-footer smart-hidden">\n <div id="selectedDatesRange"></div>\n </div>\n <input id="hiddenInput" type="hidden" name="[[name]]">\n </div>\n </div>'}_updateTargetValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const a=e.dataset.property,n=e.selectedDates.toString();a&&void 0!==t[a]&&(t[a]=n)}}}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const n=this;switch(e){case"animationSettings":n._applyAnimationSettings();break;case"disabled":case"unfocusable":n._setFocusable();break;case"calendarMode":case"dropDownWidth":case"dropDownHeight":n.displayMode="month",n._refreshHeaderElements(),n._refreshCalendarMode(),n._setDisplayModeContent();break;case"dayNameFormat":n._refreshDayOfWeekTitles(n.$.month);break;case"dateFormatFunction":{let e=n.$.monthsContainer.children;for(let t=0;t<e.length;t++)e[t].firstElementChild.innerHTML=a?a(e[t]._date):n._monthsNames[e[t]._date.getMonth()]+" "+e[t]._date.toLocaleDateString(n.locale,{year:n.yearFormat});n._refreshHeaderTitle();break}case"displayMode":if("classic"===n.calendarMode&&"month"!==a){n[e]="month";break}n._setDisplayMode(t,a);break;case"displayModeView":n._applyAnimationSettings(!0),"month"!==n.displayMode&&n._setDisplayModeContent();break;case"firstDayOfWeek":n._handleMonths(),n._refreshDayOfWeekTitles();break;case"hideTooltipArrow":n.$.tooltip&&(n.$.tooltip.arrow=!a);break;case"titleTemplate":case"headerTemplate":case"footerTemplate":n._handleLayoutTemplate(n.$[e.split(/[T]/)[0]],a),"titleTemplate"===e?n._refreshTitle():"headerTemplate"===e?n._refreshHeaderTitle():n._refreshFooter();break;case"importantDates":n.importantDates=n._getValidDates(a),n._refreshImportantDates();break;case"importantDatesTemplate":n._handleImportantDateTemplate(),n._refreshImportantDates();break;case"locale":n._refreshMonthNames(),n._refreshDayOfWeekTitles(),n._refreshHeaderTitle(),n._refreshTitle(),n._refreshFooter(),n.displayMode&&"month"!==n.displayMode&&n._setDisplayModeContent();break;case"max":case"min":n._validateMinMax(e,a,t),n._validateSelectedDates(),n._noFocusingRequired=!1,n._refreshHeaderElements();break;case"months":n._handleMonths();break;case"monthNameFormat":n._refreshCalendarMode(),n._refreshHeaderTitle();break;case"restrictedDates":n._setRestrictedDates(n.restrictedDates=n._getValidDates(a));break;case"rightToLeft":n._refreshDayOfWeekTitles(),n._handleMonths();break;case"scrollButtonsNavigationMode":n._setScrollButtonsNavigationMode();break;case"selectedDates":if(n._clearSelection(!0),n._validateSelectedDates(n._getValidDates(a)),n._applySelectionMode(!0),n._viewDates){let e=n.selectedDates[n.selectedDates.length-1];n._isDateInView(e)?n.selectedDates.map((e=>n._selectDate(e,!0,!0))):n._handleMonths(e)}n._refreshFooter(),n._setWeeksVisibility(n.$.monthsContainer),n.$.hiddenInput.value=n.selectedDates.toString(),n.isInitialized&&(n.$.fireEvent("change",{value:n.selectedDates}),n._updateTargetValue()),n._refreshTitle(),"month"!==n.displayMode&&n._setDisplayModeContent();break;case"selectionMode":n._applySelectionMode(!1,t),n._refreshTitle();break;case"tooltip":n._handleTooltip();break;case"tooltipArrow":case"tooltipArrowDirection":case"tooltipDelay":case"tooltipOffset":case"tooltipPosition":case"tooltipTemplate":if(n.$.tooltip){const t=e.replace("tooltip","");n.$.tooltip[t.charAt(0).toLowerCase()+t.slice(1)]=a}break;case"view":n._refreshTitle();break;case"viewSections":a.indexOf("title")>-1?n.$title.removeClass("smart-hidden"):n.$title.addClass("smart-hidden"),n._refreshTitle(),a.indexOf("header")>-1?n.$header.removeClass("smart-hidden"):n.$header.addClass("smart-hidden"),n._refreshHeaderTitle(),a.indexOf("footer")>-1?n.$footer.removeClass("smart-hidden"):n.$footer.addClass("smart-hidden"),n._refreshFooter(),n._setFocusable();break;case"weeks":n._setWeeksVisibility(n.$.monthsContainer);break;case"yearFormat":if(n._refreshCalendarMode(),n._refreshFooter(),n.months>1&&"month"===n.displayMode){let e=n._animationStarted?n.$.nextMonthsContainer.children:n.$.monthsContainer.children;for(let t=0;t<e.length;t++)e[t].firstElementChild.innerHTML=n.dateFormatFunction?n.dateFormatFunction(e[t]._date):n._monthsNames[e[t]._date.getMonth()]+" "+e[t]._date.toLocaleDateString(n.locale,{year:a})}n._refreshTitle(),n._refreshHeaderTitle()}}ready(){super.ready();const e=this;e._keysPressed={},e._applyAnimationSettings(),e.importantDates=e._getValidDates(e.importantDates),e.restrictedDates=e._getValidDates(e.restrictedDates)}render(){const e=this;e.setAttribute("role","dialog"),e._refreshMonthNames(),e._validateMinMax(),e._validateSelectedDates(e._getValidDates(e.selectedDates)),e._handleLayoutTemplate(e.$.title,e.titleTemplate),e._handleLayoutTemplate(e.$.header,e.headerTemplate),e._handleLayoutTemplate(e.$.footer,e.footerTemplate),e._handleImportantDateTemplate(),e._setFocusable(),e._refreshDayOfWeekTitles(),e._applySelectionMode(!0),e._handleMonths(0===e.selectedDates.length?new Date((new Date).setHours(0,0,0,0)):e.selectedDates[e.selectedDates.length-1]),e._handleTooltip(),e._updateViewSectionsVisibility(),e._setScrollButtonsNavigationMode(),e._refreshCalendarMode(),e._setDisplayMode(),e._refreshTitle(),e._refreshFooter(),e._refreshImportantDates(),e.$.monthElement&&e.$.monthElement._setDropDownSize&&e.$.monthElement._setDropDownSize(),e._changeEventFired=0,e.$.hiddenInput.value=e.selectedDates.toString(),e.shadowRoot&&e.appendChild(e.$.hiddenInput),e.isInitialized=!0,super.render()}refresh(){this.isInitialized&&this.render()}_updateViewSectionsVisibility(){const e=this;e.viewSections.indexOf("title")>-1?e.$title.removeClass("smart-hidden"):e.$title.addClass("smart-hidden"),e.viewSections.indexOf("header")>-1?e.$header.removeClass("smart-hidden"):e.$header.addClass("smart-hidden"),e.viewSections.indexOf("footer")>-1?e.$footer.removeClass("smart-hidden"):e.$footer.addClass("smart-hidden")}clearSelection(){this._clearSelection()}_setFocusable(){const e=this;let t=e.tabIndex>0?e.tabIndex:0;function a(e,a){if(a)return e&&e instanceof a?("function"==typeof e._setFocusable&&e.isCompleted?e.unfocusable=t<=-1:e.setAttribute("tabindex",t),e):e||void 0}(e.disabled||e.unfocusable)&&(t=-1),e.$.previousMonthButton=a(e.$.previousMonthButton,Smart.Button),e.$.nextMonthButton=a(e.$.nextMonthButton,Smart.Button),e.$.nextYearButton=a(e.$.nextYearButton,Smart.Button),e.$.previousYearButton=a(e.$.previousYearButton,Smart.Button),e.$.monthElement=a(e.$.monthElement,Smart.Input),e.$.yearElement=a(e.$.yearElement,HTMLInputElement),e.viewSections.indexOf("title")>-1&&(e.$.dateContainer.setAttribute("tabindex",t),e.$.yearContainer.setAttribute("tabindex",t)),e.$.body.setAttribute("tabindex",t),"default"===e.calendarMode?e.$.dateElement.setAttribute("tabindex",t):e.$.dateElement.removeAttribute("tabindex"),e.unfocusable?e.removeAttribute("tabindex"):e.tabIndex=e.readonly&&!e.disabled?e.tabIndex>0?e.tabIndex:0:t}static get requires(){return{"Smart.DropDownList":"smart.dropdownlist.js","Smart.ListBox":"smart.listbox.js","Smart.RepeatButton":"smart.button.js","Smart.Tooltip":"smart.tooltip.js"}}navigate(e){const t=this;let a,n,l;if(e){if("number"==typeof e){if(e=parseInt(e),isNaN(e)||0===e)return!1;if(6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode){let l,i;t._focusedCell||t._focusCell();const s=[].slice.call(t._focusedCell.closest(".smart-calendar-weeks").children).filter((e=>!e.classList.contains("smart-hidden")));e<0?(i=s[0].querySelectorAll(".smart-calendar-cell"),l=t.rightToLeft?i[i.length-1]:i[0]):(i=s[s.length-1].querySelectorAll(".smart-calendar-cell"),l=t.rightToLeft?i[0]:i[i.length-1]),n=new Date(l.value),n.setDate(n.getDate()+e),a=n}else a=t._getNextDate(e)}else{if(a=e=t._getValidDate(e),l=!0,isNaN(a.getTime()))return!1;const i=t._viewDates[0];if(i&&a.getMonth()===i.getMonth()&&a.getFullYear()===i.getFullYear())return!1;6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&(n=a)}return!(!a||t.$.fireEvent("navigationChanging",{value:new Date(a),type:t.displayMode}).defaultPrevented||("month"!==t.displayMode?(!l&&t.hasAnimation?(t.$nextMonthsContainer.addClass("smart-calendar-date-view-container"),"list"===t.displayModeView?t._setDisplayModeContent(a):t._navigationDate&&t._navigationDate.getTime()===a.getTime()||t._animateNavigation(a,e)):t._setDisplayModeContent(a),t.$.fireEvent("navigationChange",{value:new Date(a),type:t.displayMode}),0):(t.hasAnimation?(t._animateNavigation(a,e),t.$nextMonthsContainer.hasClass("smart-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-date-view-container")):(t._handleMonths(a),t._refreshHeaderElements(),t._refreshHeaderTitle()),n&&(t._focusCell(t._getCellByDate(n,t._animationStarted?t.$.nextMonthsContainer:void 0),!0),t._updateWeeksVisibility(e)),t.$.fireEvent("navigationChange",{value:new Date(a),type:t.displayMode}),0)))}}set value(e){this._select(e)}get value(){return this.selectedDates&&this.selectedDates.length>0?this.selectedDates[0]:null}select(e){this._select(e)}_select(e){const t=this;t._viewDates&&void 0!==t._viewDates[0]&&"none"!==t.selectionMode&&e&&(e=t._getValidDate(e))instanceof Date&&("one"===t.selectionMode&&t.selectedDates.map(Number).indexOf(e.getTime())>-1||e.getTime()<t.min.getTime()||e.getTime()>t.max.getTime()||("one"!==t.selectionMode&&"default"!==t.selectionMode&&"zeroOrOne"!==t.selectionMode||t._clearSelection(!0),t._selectDate(e),1!==t.selectedDates.length||t._isDateInView(t.selectedDates[0])||t._handleMonths(t.selectedDates[0])))}today(){const e=this;let t=new Date;return t.setHours(0,0,0,0),t.getTime()<e.min.getTime()||t.getTime()>e.max.getTime()?t=new Date(e.max):e._selectDate(t),e._handleMonths(t),t}_animateNavigation(e,t,a){const n=this;n._navigationDate=e,n._animationSettings||n._applyAnimationSettings(),n.$animationPanel.addClass("smart-hidden"),n.$.dateViewContainer.style.transform="",n.$.dateViewContainer.style.opacity="",n.$.monthsContainer.style.transform="",n.$.monthsContainer.style.opacity="";const l="month"!==n.displayMode?n.$.dateViewContainer:n.$.monthsContainer,i=n.$.body[n._animationSettings.scrollMax]-n.$.body[n._animationSettings.size];n._scrollStep=n.$.body[n._animationSettings.size]*n._animationSettings.startSpeed,n._animationStarted&&n._getMonthCells(n.$.monthsContainer,n.rightToLeft).map((e=>{n._setCellState(e,"restricted",!1),n._setCellState(e,"selected",!1),n._setCellState(e,"otherMonth",!1),n._setCellState(e,"focus",!1),n._setCellState(e,"important",!1),n._setCellState(e,"today",!1),n._setCellState(e,"disabled",!1),n._setCellState(e,"hover",!1)})),n._animationStarted=!0,"month"!==n.displayMode?(n._setCellState(n._focusedCell,"focus",!1),n._setDisplayModeContent(e,n.$.nextMonthsContainer)):n._handleMonths(e,n.$.nextMonthsContainer),n.rightToLeft&&(t*=-1),a||(t>0?(l.style.order=1,n.$.nextMonthsContainer.style.order=3,(!n._animationStarted||n._animationStarted&&n.$.body[n._animationSettings.scrollSize]>n.$.body[n._animationSettings.scrollMax]*n._animationSettings.resetThreshold*2)&&(n.$.body[n._animationSettings.scrollSize]=0)):(l.style.order=3,n.$.nextMonthsContainer.style.order=1,(!n._animationStarted||n._animationStarted&&n.$.body[n._animationSettings.scrollSize]<n.$.body[n._animationSettings.scrollMax]*n._animationSettings.resetThreshold)&&(n.$.body[n._animationSettings.scrollSize]=n.$.body[n._animationSettings.scrollMax]))),cancelAnimationFrame(n._animationId),n._animationId=requestAnimationFrame((function e(){let a=t>0?n.$.body[n._animationSettings.scrollSize]>=i:0===n.$.body[n._animationSettings.scrollSize],l=n._scrollStep/2;a?n._animateNavigationCompleted():(t>0&&n.$.body[n._animationSettings.scrollSize]>i*n._animationSettings.easeThreshold?(l=Math.max(n.$.body[n._animationSettings.scrollSize]/n._animationSettings.stepEaseSize,Math.abs(l-(i-n.$.body[n._animationSettings.scrollSize])*n._animationSettings.step)),n._scrollStep=n._scrollStep*n._animationSettings.step+l):t<0&&n.$.body[n._animationSettings.scrollSize]<i*n._animationSettings.easeThreshold&&(l=Math.max(n.$.body[n._animationSettings.scrollMax]/n._animationSettings.stepEaseSize,Math.abs(l-n.$.body[n._animationSettings.scrollSize]*n._animationSettings.step)),n._scrollStep=n._scrollStep*n._animationSettings.step+l),n.$.body[n._animationSettings.scrollSize]+=t>0?n._scrollStep:-n._scrollStep,n._animationId=requestAnimationFrame(e))}))}_animateNavigationCompleted(){const e=this;let t,a,n,l="month"!==e.displayMode?e.$.dateViewContainer:e.$.monthsContainer;if(cancelAnimationFrame(e._animationId),"month"!==e.displayMode){let i=[].slice.call(l.children).indexOf(e._focusedCell);l.innerHTML=e.$.nextMonthsContainer.innerHTML;let s,o=l.children[i];a=l.children,n=e.$.nextMonthsContainer.children;for(let t=0;t<a.length;t++)a[t].value=n[t].value,a[t].restricted=n[t].restricted,a[t].important=n[t].important,a[t].otherMonth=n[t].otherMonth,a[t].value.getTime()<=e.max.getTime()&&(s=a[t]);t=o&&o.value.getTime()>=e.max.getTime()?s.value:e._focusedCell?e._focusedCell.value:void 0}else{let i=l.children,s=e.$.nextMonthsContainer.children;e._focusedCell&&e.$.nextMonthsContainer.contains(e._focusedCell)&&(t=e._focusedCell.value);for(let t=0;t<i.length&&s[t]._date;t++){i[t]._date=s[t]._date,i[t].innerHTML=s[t].innerHTML,a=e._getMonthCells(i[t]),n=e._getMonthCells(s[t]);for(let e=0;e<a.length;e++)a[e].value=n[e].value,a[e].restricted=n[e].restricted,a[e].important=n[e].important,a[e].otherMonth=n[e].otherMonth,a[e].removeAttribute("focus")}e._selectedCells.length>0&&(e._selectedCells=e._selectedCells.map((t=>e._getCellByDate(t.value))).filter((e=>void 0!==e)))}e._focusCell(e._getCellByDate(t)),l.style.order=1,e.$.nextMonthsContainer.style.order=3,e.$.body[e._animationSettings.scrollSize]=0,e._animationStarted=!1,delete e._navigationDate}_applyAnimationSettings(e){const t=this;t._animationSettings=t.animationSettings?t.animationSettings:t._animationSettings||{},"portrait"===t.scrollButtonsNavigationMode?(t._animationSettings.scrollMax="scrollHeight",t._animationSettings.size="offsetHeight",t._animationSettings.scrollSize="scrollTop"):(t._animationSettings.scrollMax="scrollWidth",t._animationSettings.size="offsetWidth",t._animationSettings.scrollSize="scrollLeft"),e||(t._animationSettings.startSpeed=t._animationSettings.startSpeed?t._animationSettings.startSpeed:.2,t._animationSettings.easeThreshold=t._animationSettings.easeThreshold?t._animationSettings.easeThreshold:.5,t._animationSettings.step=t._animationSettings.step?t._animationSettings.step:.25,t._animationSettings.stepEaseSize=t._animationSettings.stepEaseSize?t._animationSettings.stepEaseSize:200,t._animationSettings.resetThreshold=t._animationSettings.resetThreshold?t._animationSettings.resetThreshold:.2)}_applySelectionMode(e,t){const a=this;let n=[],l=!!e,i=a.selectionMode;function s(e,t){const n=a.$.monthsContainer.children;for(let l=0;l<n.length;l++)a._getMonthCells(n[l]).map((n=>{a._setCellState(n,e,t)}))}switch("many"===i&&"range"===i||s("hover",!1),a._newRangeSelectionStarted=a.selectedDates.length>0&&"range"===i,-1!==["default","many","zeroOrMany","oneOrMany","week","range"].indexOf(i)?Array.from(a.getElementsByClassName("smart-calendar-month")).forEach((e=>e.setAttribute("aria-multiselectable",!0))):Array.from(a.getElementsByClassName("smart-calendar-month")).forEach((e=>e.removeAttribute("aria-multiselectable"))),"none"!==i&&"none"!==t||s("selected",!1),i){case"none":return void a._clearSelection(l);case"range":return void(a.selectedDates.length>1&&a._selectMultipleDates(a.selectedDates[0],a.selectedDates[a.selectedDates.length-1]));case"many":case"default":case"oneOrMany":if(0===a.selectedDates.length){n.push(new Date(Math.min(Math.max(a.min.getTime(),(new Date).setHours(0,0,0,0)),a.max.getTime())));break}return;case"oneExtended":case"one":if(1===a.selectedDates.length)return;a.selectedDates.length>1?(n.push(a.selectedDates[a.selectedDates.length-1]),a._clearSelection(l)):n.push(new Date(Math.min(Math.max(a.min.getTime(),(new Date).setHours(0,0,0,0)),a.max.getTime())));break;case"zeroOrOne":if(a.selectedDates.length>1){n.push(a.selectedDates[a.selectedDates.length-1]),a._clearSelection(l);break}return;case"zeroOrMany":return;case"week":if(a.selectedDates.length>=1){let e=a.selectedDates[a.selectedDates.length-1];for(let t=0;t<7;t++)n.push(new Date(e)),e.setDate(e.getDate()+1);a._clearSelection(l)}}if(a.selectedDates=[],e)return void(a.selectedDates=n);const o=n.length;for(let e=0;e<o;e++)a._selectDate(n[e],e<o-1)}_clearSelection(e){const t=this,a=t.selectedDates.slice(0),n=t.selectionMode;if(t.isRendered){if(t._selectedCells&&t._selectedCells.map((e=>{t._setCellState(e,"selected",!1)})),t.selectedDates=[],t._selectedCells=[],"many"===n||"range"===n){const e=t.$.monthsContainer.children;for(let a=0;a<e.length;a++)t._getMonthCells(e[a]).map((e=>{t._setCellState(e,"hover",!1)}))}t.$.footer&&t._refreshFooter(),t.$.hiddenInput.value=t.selectedDates.toString(),!e&&t.isInitialized&&a.length&&(t.$.fireEvent("change",{value:[]}),t._updateTargetValue()),t.$.title&&t._refreshTitle()}else t.set("selectedDates",[])}_bodyBlurStateHandler(e){this._bodyStateHandler(e),this.$.fireEvent("blur")}_bodyFocusStateHandler(e){this._bodyStateHandler(e),this.$.fireEvent("focus")}_bodyStateHandler(e){const t=this;if(t._focusedCell){if("blur"===e.type||"focus"===e.type&&t._noFocusingRequired)return t._noFocusingRequired=!1,void t._setCellState(t._focusedCell,"focus",!1);if("month"!==t.displayMode)return void("focus"!==e.type||t.$.dateViewContainer.querySelector("smart-calendar-cell[focus]")||t._setCellState(t._focusedCell||t.$.dateViewContainer.querySelector(".smart-calendar-cell"),"focus",!0))}"focus"===e.type&&t._focusCell()}_containerWheelHandler(e){const t=this;if(t.disabled||t.readonly||"month"!==t.displayMode&&"list"===t.displayModeView)return;let a,n;n=document.activeElement,t.shadowRoot?n=t.shadowRoot.activeElement:t.isInShadowDOM&&(n=t.getRootNode().activeElement),t.$.yearElement===n&&(a=12),(n&&t.shadowRoot||n.closest("smart-calendar")===t)&&(a=e.target===t.$.yearElement?12:1),a&&(e.preventDefault(),a=12===a?a:a*t.months,e.deltaY>0?t.navigate(-a):t.navigate(a))}_downHandler(e){const t=this;let a=e.originalEvent.target;if(t._dragStartDetails=void 0,t.disabled||t.readonly)return;if(t.hasRippleAnimation&&(a.value instanceof Date||a.parentElement&&a.parentElement.classList.contains("smart-calendar-title")||a.parentElement===t.$.dateElement)&&Smart.Utilities.Animation.Ripple.animate(a,e.pageX,e.pageY),a=e.originalEvent.target.closest(".smart-calendar-header"),e.originalEvent.target.closest(".smart-calendar-year-container")&&"decade"!==t.displayMode){if("classic"===t.calendarMode)return;return void t._showDateView("year")}if(e.originalEvent.target.closest(".smart-calendar-date-container")&&"month"!==t.displayMode){if("classic"===t.calendarMode)return;return void t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell,"month")}if(t._animationStarted&&t._animateNavigationCompleted(),Smart.Utilities.Core.isMobile&&e.originalEvent.target.closest(".smart-calendar-body")===t.$.body)return void(t._dragStartDetails={x:e.pageX,y:e.pageY,startTime:Date.now(),target:e.originalEvent.target});if(a=e.originalEvent.target,a.closest(".smart-calendar-week")||a.parentElement===t.$.dateViewContainer){for(;a&&!(a.value instanceof Date);)a=a.parentElement;return void(a&&("month"!==t.displayMode?t._displayModeHandler(a):t._weeksDownHandler(e,a)))}if(a.closest(".smart-calendar-month-element"))return;if(e.originalEvent.stopPropagation(),"list"===t.displayModeView&&"month"!==t.displayMode)return a=(t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target).closest("smart-list-item"),void(a&&t._displayModeHandler(a));const n=document.scrollingElement||document.documentElement,l=n.scrollLeft,i=n.scrollTop;t.unfocusable||t.focus(),window.scrollTo(l,i)}_displayModeHandler(e,t){const a=this;if(a._animationStarted&&a._animateNavigationCompleted(),e instanceof HTMLElement&&e.closest(".smart-calendar-week")&&e.otherMonth){if("decade"===a.displayMode&&(e.value.getFullYear()<a.min.getFullYear()||e.value.getFullYear()>a.max.getFullYear()))return;if("year"===a.displayMode&&(e.value.getFullYear()<a.min.getFullYear()||e.value.getFullYear()===a.min.getFullYear()&&e.value.getMonth()<a.min.getMonth()||e.value.getFullYear()>a.max.getFullYear()||e.value.getFullYear()===a.max.getFullYear()&&e.value.getMonth()>a.max.getMonth()))return}switch(t=t||a.displayMode){case"year":t="month";break;case"decade":t="year"}if(a.displayMode===t)return;const n=a.$.listViewContainer,l=n&&n.contains(e);a.$.fireEvent("displayModeChanging",{oldDisplayMode:a.displayMode,newDisplayMode:t}).defaultPrevented||(a.set("displayMode",t),a.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),e.parentElement!==a.$.dateViewContainer||e.disabled||e.restricted||a._focusCell(e),a.hasAnimation?(l&&e instanceof HTMLLIElement?e.offsetHeight?a.$.animationPanel.style.transformOrigin=e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px":a.$.animationPanel.style.transformOrigin=n.offsetLeft+n.offsetWidth/2+"px "+(n.offsetTop+n.offsetHeight/2)+"px":(a.$.dateViewContainer.style.order=1,a.$.nextMonthsContainer.style.order=3,e=a._focusedCell,a.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px"),a._animateView(1,e)):a._setDisplayModeContent(e.value instanceof Date?e.value:new Date(e.getAttribute("value")||e.value)))}_animateView(e,t){const a=this;let n,l,i=t instanceof Date?t:new Date(t.getAttribute("value")||t.value),s=!1,o=1,r=1;const d=a.$.listViewContainer;"list"===a.displayModeView?n=d.contains(t)?d:l="month"!==a.displayMode?a.$.monthsContainer:d:t.value instanceof Date||(t=a._focusedCell?a._focusedCell:a._selectedCells.length>0?a._selectedCells[a._selectedCells.length-1]:a._getCellByDate(new Date)),n||(n=t.parentElement===a.$.dateViewContainer?a.$.dateViewContainer:a.$.monthsContainer),l||(l="month"===a.displayMode?a.$.monthsContainer:"list"===a.displayModeView?d:a.$.dateViewContainer),l.style.transformOrigin=a.$.animationPanel.style.transformOrigin,n===d?(a.$.animationPanel.innerHTML="",a.$.animationPanel.appendChild(n.cloneNode(!0))):a.$.animationPanel.innerHTML=n.innerHTML,a._setDisplayModeContent(i),n.style.order=1,a.$.nextMonthsContainer.style.order=3,a.$.body[a._animationSettings.scrollSize]=0,a.$.animationPanel.style.width=a.$.body.offsetWidth+"px",a.$.animationPanel.style.height=a.$.body.offsetHeight+"px",a.$.animationPanel.style.transform="scale(1)",a.$.animationPanel.style.opacity=1,a.$animationPanel.removeClass("smart-hidden"),l.style.opacity="0",l.style.transform="scale(3.5)",n.$.hasClass("smart-calendar-date-view-container")?a.$animationPanel.addClass("smart-calendar-date-view-container"):a.$animationPanel.removeClass("smart-calendar-date-view-container"),cancelAnimationFrame(a._animationId),a._animationId=requestAnimationFrame((function t(){if((e>0&&o>=3.5||e<0&&o<=0)&&(s=!0),s){if(cancelAnimationFrame(a._animationId),a.$animationPanel.addClass("smart-hidden"),a.$.animationPanel.style.transform="",a.$.animationPanel.style.opacity="",n.style.order=1,a.$.nextMonthsContainer.style.order=3,a.$.body[a._animationSettings.scrollSize]=0,l.style.transform="",l.style.opacity="",a.unfocusable)return;"month"===a.displayMode?a.$.body.focus():"list"===a.displayModeView&&a.focus()}else a.$.animationPanel.style.opacity=r,l.style.opacity=1-r,r-=.05,e>0?(a.$.animationPanel.style.transform="scale("+o+")",l.style.transform="scale("+Math.min((o-1)/2,1)+")",o+=.125):(a.$.animationPanel.style.transform="scale("+Math.max(o,0)+")",l.style.transform="scale("+Math.max(1+o,1)+")",o-=.06),a._animationId=requestAnimationFrame(t)}))}_documentUpHandler(e){const t=this;let a=e.originalEvent.target;if((t.isInShadowDOM||t.shadowRoot&&a===t)&&(a=e.originalEvent.composedPath()[0]),t._newRangeSelectionStarted&&!t.$.container.contains(a)&&delete t._newRangeSelectionStarted,a&&a.classList&&a.classList.contains("smart-calendar-cell")&&(e.originalEvent.stopPropagation(),e.originalEvent.preventDefault(),e.preventDefault()),!Smart.Utilities.Core.isMobile||!t._dragStartDetails||e.originalEvent.target.closest(".smart-calendar-list-view"))return;delete t._previousIteration;const n=Date.now();let l={};(t.isInShadowDOM||t.shadowRoot&&a===t)&&(a=e.originalEvent.composedPath()[0]),"portrait"===t.scrollButtonsNavigationMode?(l.coordinate="y",l.direction="pageY"):(l.coordinate="x",l.direction="pageX");const i=t._dragStartDetails.step*(t.rightToLeft?-1:1);if(Math.abs(t._dragStartDetails[l.coordinate]-e[l.direction])<=10){if(a="list"===t.displayModeView&&"month"!==t.displayMode?a.closest("smart-list-item"):a,!a)return void(t._dragStartDetails=void 0);if("month"!==t.displayMode)return t._displayModeHandler(a),"portrait"===t.scrollButtonsNavigationMode?t.$.body.scrollTop=0:t.$.body.scrollLeft=0,void(t._dragStartDetails=void 0);if(t._weeksDownHandler(e,a),!t.disableAutoNavigation&&a.otherMonth)return}else{const a=Math.abs((e[l.direction]-t._dragStartDetails[l.coordinate])/(n-t._dragStartDetails.startTime));if(a>1){const e=parseInt(a);for(let a=0;a<e;a++)if(!t.navigate(i)){t._cancelAnimation();break}return void(t._dragStartDetails=void 0)}}if(!t.hasAnimation)return t.navigate(t._dragStartDetails.step),void(t._dragStartDetails=void 0);let s=("month"!==t.displayMode?t.$.dateViewContainer[t._animationSettings.scrollMax]:t.$.monthsContainer[t._animationSettings.scrollMax])+t.$.monthsSeparator[t._animationSettings.size];if(t._dragStartDetails.step>0&&t.$.body[t._animationSettings.scrollSize]>s*t._animationSettings.easeThreshold||t._dragStartDetails.step<0&&t.$.body[t._animationSettings.scrollSize]<s*t._animationSettings.easeThreshold)return t._animateNavigation(t._dragStartDetails.navigationDate,i,!0),6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&t._updateWeeksVisibility(i,t._getCellByDate(t._dragStartDetails.navigationDate,t.$.nextMonthsContainer)),t.$.fireEvent("navigationChange",{value:new Date(t._dragStartDetails.navigationDate),type:t.displayMode}),void(t._dragStartDetails=void 0);t._cancelAnimation(),t._dragStartDetails=void 0}_cancelAnimation(){const e=this,t="month"!==e.displayMode?e.$.dateViewContainer:e.$.monthsContainer;let a=e.$.animationPanel.style.transform,n=e.$.animationPanel.style.opacity;a&&(a=parseFloat(a.substring(a.indexOf("(")+1||0,a.indexOf(")")))),t.style.order=1,e.$.nextMonthsContainer.style.order=3,e.$.body[e._animationSettings.scrollSize]=0,e._animationId=requestAnimationFrame((function t(){if(!a||a>=3.5){cancelAnimationFrame(e._animationId),e.$animationPanel.addClass("smart-hidden"),e.$.animationPanel.style.transform="",e.$.animationPanel.style.opacity="";const t="month"===e.displayMode?e.$.monthsContainer:e.$.listViewContainer;return t.style.transform="",t.style.opacity="",e.unfocusable||("month"===e.displayMode?e.$.body.focus():"list"===e.displayModeView&&e.focus()),void(e._animationStarted=!1)}e.$.animationPanel.style.opacity=n-=.25,e.$.animationPanel.style.transform="scale("+(a+=.5)+")",e._animationId=requestAnimationFrame(t)}))}_focusCell(e,t){const a=this;if(a._focusedCell&&a._setCellState(a._focusedCell,"focus",!1),a.disabled||a.readonly)return;if(e){if("month"!==a.displayMode)return a._setCellState(e,"focus",!0),void(a._focusedCell=e);if(e.disabled||e.restricted)return;return t||a._setCellState(e,"focus",!0),void(a._focusedCell=e)}if("month"!==a.displayMode&&0===a.$.monthsContainer.offsetHeight)return;const n=a._selectedCells[a._selectedCells.length-1];if(n&&n.offsetHeight)a._setCellState(n,"focus",!0),a._focusedCell=n;else{const e=a.$.monthsContainer.children;if(!e[0]._date||a.min.getTime<e[0]._date.getTime())return;const t=a._getMonthCells(e[0],a.rightToLeft);for(let e=0;e<t.length;e++){const n=t[e];if(!n.otherMonth){if(n.disabled||n.restricted||!n.offsetHeight)continue;a._focusedCell=n;break}}}a._focusedCell&&a._setCellState(a._focusedCell,"focus",!0)}_getDays(e,t){const a=t.length;let n=[];if(a>0)for(let l=0;l<a;l++)t[l].getFullYear()===e.getFullYear()&&t[l].getMonth()===e.getMonth()&&n.push(t[l].getDate());return n}_getCellByDate(e,t){const a=this;if(!(e instanceof Date))return;if(t||(t=a.$.monthsContainer),"month"!==a.displayMode){if("list"===a.displayModeView)return;let t=arguments[1]?a.$.nextMonthsContainer.children:a.$.dateViewContainer.children;for(let n=0;n<t.length;n++)if("year"!==a.displayMode){if(t[n].value.getFullYear()===e.getFullYear())return t[n]}else if(t[n].value.getMonth()===e.getMonth())return t[n];return}let n,l,i=t.children;for(let t=0;t<i.length;t++)if(e.getFullYear()===i[t]._date.getFullYear()&&e.getMonth()===i[t]._date.getMonth()){n=i[t];break}if(n){l=a._getMonthCells(n);for(let t=0;t<l.length;t++)if((!l[t].otherMonth||l[t].hover)&&l[t].value.getMonth()===e.getMonth()&&l[t].value.getDate()===e.getDate())return l[t]}}_getMonthCells(e,t){const a=e.getElementsByClassName("smart-calendar-week");let n=[];if(t)for(let e=0;e<a.length;e++){let t=a[e].children;for(let e=t.length-1;e>0;e--)t[e].classList.contains("smart-calendar-cell")&&n.push(t[e])}else for(let e=0;e<a.length;e++){let t=a[e].children;for(let e=1;e<t.length;e++)t[e].classList.contains("smart-calendar-cell")&&n.push(t[e])}return n}_getWeekNumber(e){const t=this;let a,n=new Date(e.getFullYear(),0,1),l=Math.round((e.getTime()-n.getTime()-6e4*(e.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)+1,i=n.getDay()-t.firstDayOfWeek;return i=i>=0?i:i+7,i<4?(a=Math.floor((l+i-1)/7)+1,a>52&&(n=new Date(e.getFullYear()+1,0,1),i=n.getDay()-t.firstDayOfWeek,i=i>=0?i:i+7,a=i<4?1:53)):a=Math.round((l+i-1)/7),a}_handleDateSelection(e){const t=this;if(void 0!==e&&!e.disabled&&!e.restricted)switch(t.selectionMode){case"none":t._focusCell(e);break;case"oneExtended":case"one":case"default":if(t._keysPressed.Control)return t.selectedDates.length>1||1===t.selectedDates.length&&!e.selected?void t._selectDate(e.value):void t._focusCell(e);if(t._keysPressed.Shift)return void t._selectMultipleDates(new Date(t.selectedDates[0]),e);t._clearSelection(!0),t._selectDate(e.value,t._selectedCells.indexOf(e.value)>-1);break;case"many":{if(0===t.selectedDates.length)return void t._selectDate(e.value);const a=t.selectedDates[t.selectedDates.length-1];let n=new Date(t.selectedDates[0]);if(e.value.getTime()===n.getTime()||e.value.getTime()===a.getTime())return t._clearSelection(),void t._focusCell(e);t.selectedDates.length>0&&t._selectMultipleDates(n,e);break}case"range":{if(t.selectedDates.length>1&&!t._keysPressed.Control&&!t._newRangeSelectionStarted&&t._clearSelection(!0),0===t.selectedDates.length||t._keysPressed.Control&&t.selectedDates.length>1&&!t._newRangeSelectionStarted){if(e.value&&t.selectedDates.find((t=>t.getTime()===e.value.getTime())))return;return t._newRangeSelectionStarted=!0,void t._selectDate(e.value)}const a=t.selectedDates[t.selectedDates.length-1];let n=t._keysPressed.Control||t._newRangeSelectionStarted?a:new Date(t.selectedDates[0]);t.selectedDates.length>0&&t._selectMultipleDates(n,e),delete t._newRangeSelectionStarted;break}case"zeroOrMany":t._selectDate(e.value);break;case"oneOrMany":if(1===t.selectedDates.length&&e.selected)return void t._focusCell(e);t._selectDate(e.value);break;case"zeroOrOne":if(1===t.selectedDates.length&&e.selected)return void t._selectDate(e.value);t._clearSelection(!0),t._selectDate(e.value);break;case"week":{if(e.selected&&(e.value.getTime()===t.selectedDates[0].getTime()||e.value.getTime()===t.selectedDates[t.selectedDates.length-1].getTime()))return t._clearSelection(),void t._focusCell(e);t._clearSelection(!0);let a=new Date(e.value);t._selectDate(a);for(let e=1;e<7;e++)a.setDate(a.getDate()+1),t._selectDate(a);t._isDateInView(a)||t.navigate(1);break}}}_handleImportantDateTemplate(){const e=this;if(e._importantDatesTemplate=e._validateTemplate("importantDatesTemplate",e.importantDatesTemplate),!e._importantDatesTemplate||!e._importantDatesTemplate.content)return;let t=e._importantDatesTemplate.content;const a=t.childNodes.length,n=/{{\w+}}/g;let l;e._bindingDetails=[];for(let i=0;i<a;i++)if(l=n.exec(t.childNodes[i].innerHTML),l)return void e._bindingDetails.push({childNodeIndex:i,bindingString:l[0]})}_handleLayoutTemplate(e,t){const a=this,n=a._validateTemplate(e.$.hasClass("smart-header")?"headerTemplate":e.$.hasClass("smart-calendar-footer")?"footerTemplate":"titleTemplate",t);if(!n||!n.content)return void("function"==typeof t&&t(e,{}));a._layoutTemplates||(a._layoutTemplates=[]);let l=document.importNode(n.content,!0);e.innerHTML="";const i=l.childNodes.length,s=/{{\w+}}/g;let o,r=[];for(let e=0;e<i;e++)o=s.exec(l.childNodes[e].innerHTML),o&&r.push({childNodeIndex:e,bindingString:o[0]});if(a._layoutTemplates=a._layoutTemplates.filter((t=>t.selector!==e)),a._layoutTemplates.push({selector:e,template:n,bindings:r}),a.shadowRoot)return e.innerHTML="<slot></slot>",void a.appendChild(l);e.appendChild(l)}_handleCalendarCellHover(e,t){const a=this;if(!a._animationStarted){if("month"===a.displayMode)if("mouseover"===e.type&&("many"===a.selectionMode||"range"===a.selectionMode&&a._newRangeSelectionStarted)&&a.selectedDates.length>0){const e=a.$.monthsContainer.children;for(let t=0;t<e.length;t++)a._getMonthCells(e[t]).map((e=>{a._setCellState(e,"hover",!1)}));let n=new Date("range"===a.selectionMode?a.selectedDates[a.selectedDates.length-1]:a.selectedDates[0]),l=new Date(t.value),i=t;const s=n.getTime()>l.getTime()?-1:1,o=function(){i=a._getCellByDate(n),!i||i.selected||i.restricted||a._setCellState(i,"hover",!0)};if(n.getTime()!==l.getTime()){for(n.setDate(n.getDate()+s);n.getTime()!==l.getTime();)o(),n.setDate(n.getDate()+s);o()}}else a._setCellState(t,"hover",!1);"mouseover"!==e.type||t.otherMonth?a._setCellState(t,"hover",!1):a._setCellState(t,"hover",!0)}}_handleMonths(e,t){const a=this;let n;function l(e){let t,n=e.children.length,l=document.createDocumentFragment();for(;n<a.months;n++)t=a.$.month.cloneNode(!1),t.innerHTML=a.$.month.innerHTML,l.appendChild(t);return l}function i(t){let n=t.children;for(let t=0;t<n.length;t++)a._setMonth(e,n[t]),e.setMonth(e.getMonth()+1);a._setWeeksVisibility(t),a._refreshHeaderElements(),a._refreshHeaderTitle(),a.tooltip&&a.$.tooltip&&a.$.tooltip.close(),a.$.body===document.activeElement&&a._focusCell()}if(e||(e=a._viewDates&&a._viewDates.length>0?a._viewDates[0]:new Date),e=new Date(Math.min(Math.max(a.min.getTime(),e.getTime()),a.max.getTime())),t||(t=a.$.monthsContainer),a._selectedCells=[],a.hasAnimation){for(n=a.$.nextMonthsContainer.children,n.length>0&&n[0].value instanceof Date&&(a.$.nextMonthsContainer.innerHTML="");a.$.nextMonthsContainer.childElementCount<a.months;)a.$.nextMonthsContainer.appendChild(l(a.$.nextMonthsContainer));for(;a.$.nextMonthsContainer.childElementCount>a.months;)a.$.nextMonthsContainer.removeChild(n[a.$.nextMonthsContainer.childElementCount-1]);if(arguments[1]===a.$.nextMonthsContainer)return void i(a.$.nextMonthsContainer)}if(n=a.$.monthsContainer.children,n.length>a.months){for(;a.$.monthsContainer.childElementCount>a.months;)a.$.monthsContainer.removeChild(n[a.$.monthsContainer.childElementCount-1]),a._viewDates.pop();i(a.$.monthsContainer)}else a.$.monthsContainer.children.length!==a.months?(a._viewDates=[],a.$.monthsContainer.appendChild(l(a.$.monthsContainer)),i(a.$.monthsContainer)):i(a.$.monthsContainer)}_headerChangeHandler(e){const t=this;if(e.stopPropagation(),t.disabled||t.readonly)return;if(e.target.ownerElement===t.$.monthElement&&0!==t._changeEventFired)return void t._changeEventFired--;const a=t.displayMode;e.target===t.$.yearElement&&(t._viewDates[0].setFullYear(Math.min(Math.max(t.min.getFullYear(),isNaN(parseInt(t.$.yearElement.value))?0:parseInt(t.$.yearElement.value)),t.max.getFullYear())),t._handleMonths(t._viewDates[0])),!t.$.monthElement||e.target!==t.$.monthElement&&e.target.ownerElement!==t.$.monthElement||(t._handleMonths(new Date(t.$.monthsContainer.children[0]._date.getFullYear(),t.$.monthElement.selectedIndex,1)),"month"!==a&&t._setDisplayMode(t.displayMode,t.displayMode="month"))}_headerClickHandler(e){const t=this;if(t.disabled||t.readonly)return;let a=e.target.closest("smart-repeat-button");if(!a||!a.disabled){switch(a){case t.$.previousMonthButton:return t._isInteractiveNavigation=!0,void t.navigate(-1*t.months*(t.rightToLeft?-1:1));case t.$.nextMonthButton:return t._isInteractiveNavigation=!0,void t.navigate(1*t.months*(t.rightToLeft?-1:1));case t.$.previousYearButton:return void t.navigate(-12);case t.$.nextYearButton:return void t.navigate(12)}"classic"!==t.calendarMode&&e.target.closest(".smart-calendar-date-element")&&(t._animationStarted&&t._animateNavigationCompleted(),t._isInteractiveNavigation=!0,t._showDateView())}}_selectMultipleDates(e,t){const a=this;if(t instanceof HTMLElement&&(t=t.value),a._newRangeSelectionStarted?a._selectDate(e,!0):a._clearSelection(!0),"range"!==a.selectionMode||t.getTime()!==e.getTime()){if((e=new Date(e)).getTime()<t.getTime())for(;e.getTime()<=t.getTime();)a.selectedDates.find((t=>t.getTime()===e.getTime()))||a._selectDate(e,!0),e.setDate(e.getDate()+1);else if(e.getTime()>t.getTime())for(;e.getTime()>=t.getTime();)a.selectedDates.find((t=>t.getTime()===e.getTime()))||a._selectDate(e,!0),e.setDate(e.getDate()-1);else a._selectDate(t,!0);a.$.hiddenInput.value=a.selectedDates.toString(),a._refreshFooter(),a.isInitialized&&(a.$.fireEvent("change",{value:a.selectedDates}),a._updateTargetValue()),a._refreshTitle()}}_setDisplayMode(e,t,a){const n=this;if(n.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),0!==arguments.length&&n.hasAnimation)if(n._animationStarted&&(n.displayMode=e,n._animateNavigationCompleted(),n.displayMode=t),"month"===e&&"year"===t||"year"===e&&"decade"===t)n.displayMode=e,n._showDateView(a?void 0:n.displayMode);else if("month"===e&&"decade"===t)n._showDateView(n.displayMode="year");else{let e;"list"===n.displayModeView?(e=n.$.listViewContainer.querySelector("li.active"),n.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop>0?e.offsetTop-e.offsetHeight/2:e.offsetTop+e.offsetHeight/2)+"px"):(n.$.dateViewContainer.style.order=1,n.$.nextMonthsContainer.style.order=3,e=n._focusedCell,n.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(e.offsetTop+e.offsetHeight/2)+"px"),n._animateView(1,e)}else{if("classic"===n.calendarMode)return void(n.displayMode="month");if("month"!==n.displayMode&&(n.$monthsContainer.addClass("smart-hidden"),n.$dateViewContainer.hasClass("smart-hidden")&&n.$dateViewContainer.removeClass("smart-hidden")),!n.isCompleted&&"month"===n.displayMode)return;n._setDisplayModeContent()}}_setDisplayModeContent(e,t){const a=this;let n=e&&"Invalid Date"!==e.toString()?e:a.selectedDates.length>0?a.selectedDates[a.selectedDates.length-1]:new Date;n.setTime(Math.min(Math.max(n.getTime(),a.min.getTime()),a.max.getTime())),n.setHours(0,0,0,0);const l=a._prepareView(n);if(!l)return;let i;t?(a.$.nextMonthsContainer.innerHTML=a.$.dateViewContainer.innerHTML,i=a.$.nextMonthsContainer):i=a.$.dateViewContainer;const s=i.children;let o;for(let e=0;e<s.length;e++){const t=s[e];t.innerHTML=l.viewContent[e],t.value=l.dates[e],"year"===a.displayMode?(t.value.getFullYear()<a.min.getFullYear()||t.value.getFullYear()===a.min.getFullYear()&&t.value.getMonth()<a.min.getMonth()||t.value.getFullYear()>a.max.getFullYear()||t.value.getFullYear()===a.max.getFullYear()&&t.value.getMonth()>a.max.getMonth()?a._setCellState(t,"otherMonth",!0):a._setCellState(t,"otherMonth",!1),n.getFullYear()===t.value.getFullYear()&&n.getMonth()===t.value.getMonth()&&(o=t)):"decade"===a.displayMode&&(0===e||e===s.length-1||t.value.getFullYear()<a.min.getFullYear()||t.value.getFullYear()>a.max.getFullYear()?a._setCellState(t,"otherMonth",!0):a._setCellState(t,"otherMonth",!1),n.getFullYear()===t.value.getFullYear()&&(o=t)),a._setCellState(t,"hover",!1),a._setCellState(t,"focus",!1)}if(o.otherMonth)for(let e=0;e<s.length;e++)if(!s[e].otherMonth){o=s[e];break}a._mobileScrolling||(a._focusedCell&&a._setCellState(a._focusedCell,"focus",!1),a._focusedCell=o,a._focusCell(a._focusedCell),a._refreshHeaderTitle(),a._refreshHeaderElements(),a.$.fireEvent("displayModeChange"),a._isInteractiveNavigation?a._isInteractiveNavigation=void 0:(a._setCellState(o,"focus",!0),setTimeout((function(){a.unfocusable||(a.$.body.focus(),a._focusCell(a._focusedCell))}),0)))}_prepareView(e){const t=this,a=t.$.listViewContainer;let n,l,i=[],s=[];function o(e,t,a){let n=new Date(e,t+1,0),l=n.getDate();return a>l?n.setDate(l):n.setDate(a),n}if("month"===t.displayMode)return t.$nextMonthsContainer.hasClass("smart-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-date-view-container"),a&&a.classList.add("smart-hidden"),t.$dateViewContainer.hasClass("smart-visibility-hidden")&&t.$dateViewContainer.removeClass("smart-visibility-hidden"),t._isDateInView(e)||t._handleMonths(e),t.$header.hasClass("smart-hidden")&&t.$header.removeClass("smart-hidden"),t.$body.hasClass("smart-calendar-list-view")&&t.$body.removeClass("smart-calendar-list-view"),t.$dateContainer.addClass("smart-calendar-selected"),t.$yearContainer.removeClass("smart-calendar-selected"),t.$dateViewContainer.addClass("smart-hidden"),t.$monthsContainer.removeClass("smart-hidden"),t._refreshHeaderTitle(),t.$.body.setAttribute("tabindex",t.tabIndex>0?t.tabIndex:0),t._refreshHeaderElements(),t.unfocusable||t.$.body.focus(),t._focusCell(t._getCellByDate(e)),void t.$.fireEvent("displayModeChange");if("list"===t.displayModeView)return t._setDisplayModeListContent(e),void t.$.fireEvent("displayModeChange");if(t.$header.hasClass("smart-hidden")&&t.$header.removeClass("smart-hidden"),t.$dateViewContainer.hasClass("smart-visibility-hidden")&&t.$dateViewContainer.removeClass("smart-visibility-hidden"),a&&a.classList.add("smart-hidden"),t.$.body.setAttribute("tabindex",t.tabIndex>0?t.tabIndex:0),"year"===t.displayMode){let a=new Date;for(let n=0;n<12;n++)a=o(a.getFullYear(),n,a.getDate()),i.push(a.toLocaleDateString(t.locale,{month:"short"})),s.push(o(e.getFullYear(),n,e.getDate()))}else{n=e?e.getFullYear():t._viewDates[0].getFullYear(),l=n%10,0!==l&&(n-=l),n-=1;for(let t=0;t<12;t++)i.push(n+""),s.push(new Date(n,e.getMonth(),e.getDate())),++n}return{viewContent:i,dates:s}}_setDisplayModeListContent(e){const t=this;let a=[];function n(e,t,a){let n=new Date(e,t+1,0),l=n.getDate();return a>l?n.setDate(l):n.setDate(a),n}if(t.$dateViewContainer.addClass("smart-visibility-hidden"),"year"===t.displayMode){let l=new Date;for(let i=0;i<12;i++)l=n(l.getFullYear(),i,l.getDate()),a.push({label:l.toLocaleDateString(t.locale,{month:"short"}),value:n(e.getFullYear(),i,e.getDate()).toDateString()});t.$yearContainer.removeClass("smart-calendar-selected"),t.$dateContainer.addClass("smart-calendar-selected")}else{let n=t.min.getFullYear(),l=t.max.getFullYear();l=Math.min(t.max.getFullYear(),e.getFullYear()+10),n=Math.max(t.min.getFullYear(),l-10);for(let t=n;t<l;t++)a.push({label:t.toString(),value:new Date(t,e.getMonth(),e.getDate()).toDateString()});t.$yearContainer.addClass("smart-calendar-selected"),t.$dateContainer.removeClass("smart-calendar-selected")}t._prepareListViewer(a,e.toDateString()),t._refreshHeaderTitle(),t._refreshHeaderElements(),t.unfocusable||t.focus()}_prepareListViewer(e=[],t){const a=this,n=a.$.body;let l=a.$.listViewContainer;l||(a.$.listViewContainer=l=document.createElement("smart-scroll-viewer"),l.classList.add("smart-input-drop-down-menu","smart-calendar-list-view"),l.ensureVisible=a._listViewerEnsureVisible.bind(a),l._handleKeyStrokes=a._listViewerKeyStrokesHandler.bind(a),l._setActiveDescendant=a._listViewerSetActiveDescendant.bind(a));let i=l.querySelector("ul");i||(i=document.createElement("ul"),i.onclick=a._listViewContainerItemClickHandler.bind(a),l.appendChild(i)),n.contains(l)&&n.removeChild(l),i.innerHTML="";for(let a=0;a<e.length;a++){const n=e[a],s=n.label,o=n.value,r=document.createElement("li"),d=document.createElement("a");t===o?(r.setAttribute("aria-selected",!0),r.classList.add("active"),t=r):r.setAttribute("aria-selected",!1),r.id=l.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),r.setAttribute("value",o),r.setAttribute("role","option"),r.setAttribute("aria-label",s),d.innerHTML=s,d.setAttribute("aria-hidden",!0),r.appendChild(d),i.appendChild(r)}l.classList.remove("smart-hidden"),n.classList.add("smart-calendar-list-view"),n.removeAttribute("tabindex"),n.insertBefore(l,a.$.animationPanel),l.refresh(),l.ensureVisible()}_listViewerEnsureVisible(){const e=this.$.listViewContainer,t=e.querySelector(".active");if(!t)return;const a=Array.from(e.querySelectorAll("li"));t.offsetTop+t.offsetHeight>=e.scrollTop+e.offsetHeight&&(e.scrollTop=t.offsetTop+t.offsetHeight),(t.offsetTop<=e.scrollTop||t.offsetTop>=e.scrollTop+e.offsetHeight)&&(e.scrollTop=t.offsetTop),0===a.indexOf(t)?e.scrollTop=0:a.indexOf(t)===a.length-1&&(e.scrollTop=e.scrollHeight)}_listViewerKeyStrokesHandler(e){if(["ArrowUp","ArrowDown"].indexOf(e)<0)return;event.preventDefault();const t=this.$.listViewContainer,a=t.querySelector(".active");if(!a){const e=t.querySelector("li");return e.classList.add("active"),void t._setActiveDescendant(e)}const n=a["ArrowDown"===e?"nextElementSibling":"previousElementSibling"];n&&(a.classList.remove("active"),n.classList.add("active"),t._setActiveDescendant(n),t.ensureVisible())}_listViewerSetActiveDescendant(e){const t=this.$.listViewContainer;e?t.setAttribute("aria-activedescendant",e.id):t.removeAttribute("aria-activedescendant")}_listViewContainerItemClickHandler(e){const t=this,a=e.target.closest("li");a&&"list"===t.displayModeView&&"month"!==t.displayMode&&t._displayModeHandler(a)}_isDateInView(e){const t=this;if(!e)return!1;for(let a=0;a<t._viewDates.length;a++)if(e.getFullYear()===t._viewDates[a].getFullYear()&&e.getMonth()===t._viewDates[a].getMonth()){let a=t._getCellByDate(e,t._animationStarted?t.$.nextMonthsContainer:void 0);if(!a)return;return!(a.otherMonth||!a.offsetHeight||a.classList.contains("smart-visibility-hidden"))}return!1}_keyDownHandler(e){const t=this;if(t.disabled||t.readonly)return;const a=(t.shadowRoot||t.getRootNode()).activeElement||document.activeElement;switch(a){case t.$.yearElement:"Escape"===e.key&&t._refreshHeaderElements();break;case t.$.dateElement:if("default"===t.calendarMode&&" "===e.key||"Enter"===e.key)return e.preventDefault(),t._isInteractiveNavigation=!0,void t._showDateView();t._focusedCell||t._focusCell(),e.key.indexOf("Arrow")>-1&&t.$.dateElement===a&&!t.unfocusable&&t.$.body.focus(),t._navigateDays(e);break;case t.$.body:" "===e.key&&e.preventDefault(),t._navigateDays(e);break;case t.$.yearContainer:if(" "!==e.key&&"Enter"!==e.key||"decade"===t.displayMode||(e.preventDefault(),t._isInteractiveNavigation=!0,t._showDateView("year")),e.key.indexOf("Arrow")>-1){if(e.preventDefault(),t._focusedCell||t._focusCell(),"month"!==t.displayMode&&"list"===t.displayModeView)return t.unfocusable||t.focus(),void t.$.listViewContainer._handleKeyStrokes(e.key);t._navigateDays(e)}break;case t.$.dateContainer:if(" "!==e.key&&"Enter"!==e.key||"month"===t.displayMode||(e.preventDefault(),t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell,"month")),e.key.indexOf("Arrow")>-1){if(t._focusedCell||t._focusCell(),"month"!==t.displayMode&&"list"===t.displayModeView)return t.unfocusable||t.focus(),void t.$.listViewContainer._handleKeyStrokes(e.key);t._navigateDays(e)}break;default:if("month"!==t.displayMode&&"list"===t.displayModeView)return["Arrow","End","Home","Page"].indexOf(e.key)&&e.preventDefault()," "===e.key||"Enter"===e.key||e.ctrlKey&&("ArrowUp"===e.key||"ArrowDown"===e.key)?void t._navigateDays(e):void t.$.listViewContainer._handleKeyStrokes(e.key);e.key.indexOf("Arrow")>-1&&(t._focusedCell||t._focusCell(),t._navigateDays(e))}}_showDateView(e){const t=this;switch(e=e||t.displayMode){case"month":e="year";break;case"year":e="decade"}if(t.displayMode===e)return;if(t.$.fireEvent("displayModeChanging",{oldDisplayMode:t.displayMode,newDisplayMode:e}).defaultPrevented)return;let a;if(t.displayMode=e,"list"===t.displayModeView&&"month"!==t.displayMode){t._setDisplayModeListContent(t._focusedCell?t._focusedCell.value:t._viewDates[0]);const e=t.$.listViewContainer;e.classList.remove("smart-hidden"),a=e.querySelector("li.active"),a.offsetHeight?t.$.animationPanel.style.transformOrigin=a.offsetLeft+a.offsetWidth/2+"px "+(a.offsetTop>0?a.offsetTop-a.offsetHeight/2:a.offsetTop+a.offsetHeight/2)+"px":t.$.animationPanel.style.transformOrigin=e.offsetLeft+e.offsetWidth/2+"px "+(a.offsetTop>0?a.offsetTop-a.offsetHeight/2:e.offsetTop+e.offsetHeight/2)+"px"}else t._focusedCell||t._focusCell(),a=t._focusedCell,t.$.animationPanel.style.transformOrigin=a.offsetLeft+a.offsetWidth/2+"px "+(a.offsetTop+a.offsetHeight/2)+"px";t.$monthsContainer.addClass("smart-hidden"),t.$dateViewContainer.hasClass("smart-hidden")&&t.$dateViewContainer.removeClass("smart-hidden"),"decade"===t.displayMode&&(t.$yearContainer.addClass("smart-calendar-selected"),t.$dateContainer.removeClass("smart-calendar-selected")),t.hasAnimation?t._animateView(-1,a):t._setDisplayModeContent(t._focusedCell?t._focusedCell.value:t._viewDates[0])}_keyUpHandler(e){const t=this;t.disabled||t.readonly||"default"!==t.selectionMode&&"range"!==t.selectionMode||"Shift"!==e.key&&"Control"!==e.key||(t._keysPressed[e.key]=!1)}_handleTooltip(){const e=this,t=e.tooltip;let a=e.$.tooltip;t?(a||(a=document.createElement("smart-tooltip"),a.tooltipTemplate=e.tooltipTemplate,a.arrow=e.tooltipArrow,a.arrowDirection=e.tooltipArrowDirection,a.offset=e.tooltipOffset,a.position=e.tooltipPosition,a.delay=e.tooltipDelay,a.rightToLeft=e.rightToLeft,a.openMode="manual",e.$.tooltip=a),a.parentElement||e.$.calendarContainer.appendChild(a)):a&&a.remove()}_mouseEventsHandler(e){const t=this;if(t.disabled||t.readonly)return;const a=t.$.tooltip;if("mouseenter"===e.type)return void t.$.setAttributeValue("hover",!0);if("mouseleave"===e.type){if(t.$.setAttributeValue("hover",!1),t._newRangeSelectionStarted&&"range"===t.selectionMode){const e=t.$.monthsContainer.children;for(let a=0;a<e.length;a++)t._getMonthCells(e[a]).map((e=>{t._setCellState(e,"hover",!1)}))}return void(t.tooltip&&a&&a.close())}const n=t.shadowRoot||t.isInShadowDOM?e.composedPath()[0]:e.target;if(!n.closest(".smart-calendar-week"))return void(t.tooltip&&a&&(clearTimeout(t._tooltipAutoCloseTimeout),a[a.contains(n)?"open":"close"]()));const l=n.closest(".smart-calendar-cell");if(!l)return;if(Smart.Utilities.Core.isMobile||t._handleCalendarCellHover(e,l),!t.tooltip&&a)return void a.close();const i=l.hasAttribute("important");if(clearTimeout(t._tooltipAutoCloseTimeout),i&&a&&"mouseover"===e.type)return a.selector=l,void(a.selector!==l?a.close():(t.tooltipTemplate||(a.innerHTML=0===a.innerHTML.trim().length?"Important day!":a.innerHTML),a.open(),t.$.fireEvent("open",{target:a,value:new Date(l.value)})));t._tooltipAutoCloseTimeout=setTimeout(function(){!a||"mouseout"!==e.type&&l&&i||a.close(),clearTimeout(t._tooltipAutoCloseTimeout)}.bind(t),t.tooltipDelay)}_popupEventHandler(e){const t=this,a=t.$.tooltip;if(e.stopPropagation(),e.target!==t.$.monthElement)if(e.target===a)if("close"!==e.type);else{const e=a.selector;t.$.fireEvent("close",{target:a,value:e?new Date(e.value):null})}else t.$.fireEvent(e.type,{target:e.target})}_moveHandler(e){const t=this;if(!Smart.Utilities.Core.isMobile||!t._dragStartDetails||"list"===t.displayModeView&&"month"!==t.displayMode)return;e.originalEvent.preventDefault(),e.preventDefault(),e.stopPropagation();const a={x:Math.round(e.pageX),y:Math.round(e.pageY)};let n,l,i;if(n="portrait"===t.scrollButtonsNavigationMode?a.y>t._dragStartDetails.y?-1*t.months:1*t.months:a.x<t._dragStartDetails.x?1*t.months:-1*t.months,t._previousIteration&&n===t._previousIteration.step)l=t._previousIteration.date;else if(6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode){let e,a;t._focusedCell||t._focusCell();const i=[].slice.call(t._focusedCell.closest(".smart-calendar-weeks").children).filter((e=>!e.classList.contains("smart-hidden")));if(i.length){let s;!t.rightToLeft&&n<0||t.rightToLeft&&n>0?(s=i[0].querySelectorAll(".smart-calendar-cell"),a=t.rightToLeft?s[s.length-1]:s[0]):(s=i[i.length-1].querySelectorAll(".smart-calendar-cell"),a=t.rightToLeft?s[0]:s[s.length-1]),e=new Date(a.value),e.setDate(e.getDate()+n*(t.rightToLeft?-1:1)),l=e}else l=t._getNextDate(n*(t.rightToLeft?-1:1))}else l=t._getNextDate(n*(t.rightToLeft?-1:1));if(!l)return;if(!t._dragStartDetails.navigationDate&&t.$.fireEvent("navigationChanging",{value:new Date(l),type:t.displayMode}).defaultPrevented)return t._cancelAnimation(),void(t._dragStartDetails=void 0);if(t._dragStartDetails.step=n,t._dragStartDetails.navigationDate=new Date(l),!t.hasAnimation)return;if(t._previousIteration={step:n,date:l},t._mobileScrolling=!0,"month"!==t.displayMode)t.$nextMonthsContainer.addClass("smart-calendar-date-view-container"),i=t.$.dateViewContainer,t.$.nextMonthsContainer.children[0].value instanceof Date&&t.$.nextMonthsContainer.children[1].value.getFullYear()===l.getFullYear()||t._setDisplayModeContent(l,t.$.nextMonthsContainer);else if(t.$nextMonthsContainer.hasClass("smart-calendar-date-view-container")&&t.$nextMonthsContainer.removeClass("smart-calendar-date-view-container"),i=t.$.monthsContainer,!t.$.nextMonthsContainer.children[0]._date||t.$.nextMonthsContainer.children[0]._date.getTime()!==l.getTime()){let e=t.$.nextMonthsContainer.children;for(let a=0;a<e.length;a++)l.setMonth(t._dragStartDetails.navigationDate.getMonth()+a*(t.rightToLeft?-1:1)),t._setMonth(new Date(l),e[a],!0)}6!==t.weeks&&0!==t.weeks&&"month"===t.displayMode&&t._updateWeeksVisibility(n*(t.rightToLeft?-1:1),t._getCellByDate(l,t.$.nextMonthsContainer)),delete t._mobileScrolling,n<0?(i.style.order=3,t.$.nextMonthsContainer.style.order=1,t.$.body[t._animationSettings.scrollSize]=t.$.body[t._animationSettings.scrollMax]):(i.style.order=1,t.$.nextMonthsContainer.style.order=3,t.$.body[t._animationSettings.scrollSize]=0);const s="portrait"===t.scrollButtonsNavigationMode?"y":"x";Math.abs(t._dragStartDetails[s]-a[s])>5&&(t.$.body[t._animationSettings.scrollSize]+=2*-(a[s]-t._dragStartDetails[s]))}_getNextDate(e){const t=this;let a;if("month"!==t.displayMode){let n;const l=t._focusedCell&&t._focusedCell.value.getFullYear();if("list"===t.displayModeView)a=new Date(t.$.listViewContainer.querySelector("li").getAttribute("value"));else{let e=t._animationStarted?t.$.nextMonthsContainer:t.$.dateViewContainer;a=new Date("year"===t.displayMode?e.children[0].value:e.children[1].value)}n="year"===t.displayMode?1:0!==e?10:1,a.setFullYear(a.getFullYear()+(e>0?n:-n)),a.getTime()<t.min.getTime()&&(a=t.min),a.getTime()>t.max.getTime()&&(a=t.max);const i="month"!==t.displayMode&&"list"===t.displayModeView;if(a.getFullYear()<t.min.getFullYear()||a.getFullYear()>t.max.getFullYear()||!i&&l===a.getFullYear())return}else{let n=t._viewDates[0];if(a=new Date(n),a.setDate(1),a.setMonth(a.getMonth()+e),a.setTime(Math.min(Math.max(a.getTime(),t.min.getTime()),t.max.getTime())),n.getMonth()===a.getMonth()&&n.getFullYear()===a.getFullYear())return}return a}_navigateDays(e){const t=this;let a="ArrowUp"===e.key||"ArrowDown"===e.key?7:1,n="ArrowUp"===e.key||"ArrowLeft"===e.key||"PageUp"===e.key?-1:1;switch(e.key){case"ArrowUp":case"ArrowLeft":case"ArrowDown":case"ArrowRight":if(!t._handleArrowKeys(e,a,n))return;break;case" ":case"Enter":{if("month"!==t.displayMode)return void t._displayModeHandler("list"===t.displayModeView?t.$.listViewContainer.querySelector("li.active"):t._focusedCell);const e=t._focusedCell;if("oneExtended"===t.selectionMode&&e)return t._clearSelection(!0),void t._selectDate(e.value,t._selectedCells.indexOf(e.value)>-1);break}case"Control":case"Shift":return"default"===t.selectionMode&&(t._keysPressed[e.key]=!0),void("range"===t.selectionMode&&(t._keysPressed[e.key]="Control"===e.key));case"Home":case"End":{e.preventDefault();let a,n=function(t){if("Home"===e.key){for(let e=0;e<t.length;e++)if(!t[e].otherMonth&&(!t[e].disabled||!t[e].restricted)&&t[e].offsetHeight)return t[e]}else for(let e=t.length-1;e>=0;e--)if(!t[e].otherMonth&&(!t[e].disabled||!t[e].restricted)&&t[e].offsetHeight)return t[e]};if(a="month"!==t.displayMode?n(t.$.dateViewContainer.children):n(t._getMonthCells(t._focusedCell.closest(".smart-calendar-month"),t.rightToLeft)),!a)return;if(t._focusCell(a),"month"!==t.displayMode)return;break}case"PageUp":case"PageDown":if(!t._handlePageUpDownKeys(e,n))return;break;default:return}"oneExtended"!==t.selectionMode&&t._focusedCell&&t._handleDateSelection(t._focusedCell)}_handleArrowKeys(e,t,a){const n=this;let l;if("month"!==n.displayMode||n._animationStarted||n.unfocusable||n.$.body.focus(),n._focusedCell||n._focusCell(n._getCellByDate(new Date)),e.altKey)return;if(e.ctrlKey){if("ArrowDown"===e.key||"ArrowUp"===e.key){if("classic"===n.calendarMode)return;let t;switch(n.displayMode){case"month":t="ArrowDown"===e.key?"month":"year";break;case"year":t="ArrowDown"===e.key?"month":"decade";break;case"decade":t="ArrowDown"===e.key?"year":"decade"}if(t!==n.displayMode){const e=n.displayMode;n.displayMode=t,n._setDisplayMode(e,t,"month"===e),n._keysPressed&&delete n._keysPressed.Control}}return}if(e.preventDefault(),!n.rightToLeft||"ArrowLeft"!==e.key&&"ArrowRight"!==e.key||(a*=-1),"month"!==n.displayMode&&"list"!==n.displayModeView){const i=n._animationStarted?n.$.nextMonthsContainer.children:n.$.dateViewContainer.children;if(t="ArrowUp"===e.key||"ArrowDown"===e.key?4:1,"year"===n.displayMode){const e=n._focusedCell.value.getMonth()+a*t;let i=new Date(n._focusedCell.value.getFullYear(),e+1,0);n._focusedCell.value.getDate()<=i.getDate()&&(i=n._focusedCell.value),l=new Date(n._focusedCell.value.getFullYear(),e,i.getDate())}else l=new Date(n._focusedCell.value.getFullYear()+a*t,n._focusedCell.value.getMonth(),n._focusedCell.value.getDate());if("year"===n.displayMode){if(l.getFullYear()<n.min.getFullYear()||l.getFullYear()===n.min.getFullYear()&&l.getMonth()<n.min.getMonth()||l.getFullYear()>n.max.getFullYear()||l.getFullYear()===n.max.getFullYear()&&l.getMonth()>n.max.getMonth())return;l.getTime()>i[i.length-1].value.getTime()?n.navigate(1):l.getTime()<i[0].value.getTime()&&n.navigate(-1)}else{if(l.getFullYear()<n.min.getFullYear()||l.getFullYear()>n.max.getFullYear())return;if(l.getFullYear()<i[1].value.getFullYear()||l.getFullYear()>i[10].value.getFullYear()){let t=n._focusedCell;n.navigate(a),"ArrowUp"!==e.key&&"ArrowDown"!==e.key||(t===i[3]||t===i[4]||t===i[7]||t===i[8]?l.setFullYear(l.getFullYear()+2*a):l.setFullYear(l.getFullYear()-2*a))}}return void n._focusCell(n._getCellByDate(l,n._animationStarted?n.$.nextMonthsContainer:void 0))}if(!n._focusedCell)return;const i=n.restrictedDates.map(Number);for(l=new Date(n._focusedCell.value.getFullYear(),n._focusedCell.value.getMonth(),n._focusedCell.value.getDate()+a*t,0,0,0,0);i.indexOf(l.getTime())>-1;)l.setDate(l.getDate()+a);if(l.getTime()<n.min.getTime()||l.getTime()>n.max.getTime())return;n._isDateInView(l)||n.navigate(a*n.months);let s=n._getCellByDate(l,n._animationStarted?n.$.nextMonthsContainer:void 0);return n._focusCell(s),n._updateWeeksVisibility(a),!(["zeroOrMany","oneOrMany","none","many","week","range"].indexOf(n.selectionMode)>-1)||void 0}_handlePageUpDownKeys(e,t){const a=this;let n;if(e.preventDefault(),"month"!==a.displayMode){if(n=a._focusedCell,!a.navigate(t))return;for(;n&&n.classList.contains("smart-visibility-hidden");)n=null===n.previousElementSibling?n.nextElementSibling:n.previousElementSibling;return a._focusCell(n),void(a.hasAnimation&&"decade"===a.displayMode&&a._focusedCell.value.setFullYear(a._focusedCell.value.getFullYear()+10*t))}n=new Date(a._focusedCell.value.getFullYear(),a._focusedCell.value.getMonth()+t,1,0,0,0,0);let l=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return a._focusedCell.value.getDate()>l?n.setDate(l):n.setDate(a._focusedCell.value.getDate()),a._isDateInView(n)||a.navigate(n),a._animationStarted?a._focusCell(a._getCellByDate(n,a.$.nextMonthsContainer)):a._focusCell(a._getCellByDate(n)),!0}_selectDate(e,t,a){const n=this;if(void 0===n._viewDates||"none"===n.selectionMode)return;let l,i=n.selectedDates.slice(0),s=n._getCellByDate(e,n._animationStarted?n.$.nextMonthsContainer:void 0);s&&n._selectCell(s),(e=new Date(e)).setHours(0,0,0,0),l=i.map(Number).indexOf(e.getTime()),n.restrictedDates.map(Number).indexOf(e.getTime())>-1||e.getTime()<n.min.getTime()||e.getTime()>n.max.getTime()||(l>-1?i.splice(l,1):i.push(e),a||(n.selectedDates=i),n._refreshFooter(),n.$.hiddenInput.value=n.selectedDates.toString(),!t&&n.isInitialized&&(n.$.fireEvent("change",{value:[e]}),n._updateTargetValue()),n._refreshTitle())}_selectCell(e){const t=this;if(!e||t.restrictedDates.map(Number).indexOf(e.value.getTime())>-1||t.disableAutoNavigation&&!1===e.otherMonth||e.value.getTime()<t.min.getTime()||e.value.getTime()>t.max.getTime())return;const a=t._selectedCells.indexOf(e);a>-1?(t._setCellState(e,"selected",!1),t._selectedCells.splice(a,1)):(t._setCellState(e,"selected",!0),t._selectedCells.push(e)),t._focusCell(e)}_refreshDayOfWeekTitles(){const e=this;let t,a=[],n=new Date;function l(t){let a;return"firstTwoLetters"===e.dayNameFormat?(a=new Intl.DateTimeFormat(e.locale,{weekday:"long"}).format(t),a=8206===a.charCodeAt(0)?a.substring(1,3):a.substring(0,2)):a=new Intl.DateTimeFormat(e.locale,{weekday:e.dayNameFormat}).format(t),a}for(let e=1;e<8;e++)n.setDate(e),t={number:n.getDay(),name:l(n)},a.push(t);a.sort(((e,t)=>e.number>t.number?1:-1));const i=e.$.monthsContainer.children;let s,o;for(let t=0;t<i.length;t++)if(s=i[t].getElementsByClassName("smart-calendar-week-titles")[0].children,o=e.firstDayOfWeek>6?0:e.firstDayOfWeek,e.rightToLeft)for(let e=s.length-1;e>=1;e--)s[e].textContent=a[o++].name,o=o>6?0:o;else for(let e=1;e<s.length;e++)s[e].textContent=a[o++].name,o=o>6?0:o;if(e.hasAnimation){const t=e.$.monthsContainer.getElementsByClassName("smart-calendar-week-titles")[0].innerHTML,a=e.$.nextMonthsContainer.getElementsByClassName("smart-calendar-week-titles");for(let e=0;e<a.length;e++)a[e].innerHTML=t}}_refreshCalendarMode(){const e=this;if(!e.headerTemplate)if(e._refreshMonthNames(),"default"===e.calendarMode){e.$classicHeaderDate.addClass("smart-hidden"),e.$defaultHeaderDate.removeClass("smart-hidden");const t=e._viewDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime())),a=t[0],n=t[t.length-1];a.setDate(2);let l=e.monthNameFormat;"firstTwoLetters"===l&&(l="long");let i=a.toLocaleDateString(e.locale,{year:e.yearFormat,month:l});e.months>1&&(n.setDate(2),i+=" - "+n.toLocaleDateString(e.locale,{year:e.yearFormat,month:l})),e.$.defaultHeaderDate.innerHTML=i,e.unfocusable||e.$.dateElement.setAttribute("tabindex",e.tabIndex>0?e.tabIndex:0)}else e.$defaultHeaderDate.addClass("smart-hidden"),e.$classicHeaderDate.removeClass("smart-hidden"),e.$.dateElement.removeAttribute("tabindex")}_refreshFooter(){const e=this;if(!(e.viewSections.indexOf("footer")<0||0===e.$.footer.offsetHeight))if(e.footerTemplate){if("function"==typeof e.footerTemplate)return;let a=e._layoutTemplates.filter((t=>t.selector===e.$.footer))[0],n=document.importNode(a.template.content,!0);if(a.bindings.length>0){let e=n.childNodes[a.bindings[0].childNodeIndex];a.selector.childNodes[a.bindings[0].childNodeIndex].innerHTML=e.innerHTML.replace(a.bindings[0].bindingString,t())}}else e.$.selectedDatesRange.innerHTML=t();function t(){if(0===e.selectedDates.length)return"";if(1===e.selectedDates.length)return e.selectedDates[0].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"});{let t=e.selectedDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime()));return t[0].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"})+" - "+t[t.length-1].toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"})}}}_refreshImportantDates(){const e=this;if("month"===e.displayMode){e._clearImportantDates();for(let t=0;t<e.importantDates.length;t++)e._setImportantDate(e.importantDates[t])}}_clearImportantDates(){const e=this,t=e.$.monthsContainer.children;for(let a=0;a<t.length;a++)e._getMonthCells(t[a]).map((t=>{e._setCellState(t,"important",!1)}))}_setImportantDate(e,t){const a=this,n=a._getCellByDate(e);t||(t=n),t&&(a._setCellState(t,"important",!0),a._applyImportantDateTemplate(t))}_applyImportantDateTemplate(e){const t=this;if(!t._importantDatesTemplate)return"function"==typeof t.importantDatesTemplate?void t.importantDatesTemplate(e,{value:e.value}):void(e.innerHTML=e.value.getDate()+"");let a=document.importNode(t._importantDatesTemplate.content,!0);if(t._bindingDetails&&t._bindingDetails.length>0){let n=a.childNodes[t._bindingDetails[0].childNodeIndex];n.innerHTML=n.innerHTML.replace(t._bindingDetails[0].bindingString,e.value.getDate())}e.innerHTML="";for(let t=0;t<a.childNodes.length;t++)a.childNodes[t].outerHTML&&(e.innerHTML+=a.childNodes[t].outerHTML)}_setMonth(e,t,a){const n=this,l=n._getDays(e,n.selectedDates),i=n._getDays(e,n.importantDates),s=n._getDays(e,n.restrictedDates);e.setDate(1),t||(t=n.$.month),t._date=new Date(e),a||((!n._viewDates||n._viewDates.length>=n.months)&&(n._viewDates=[]),n._viewDates.push(new Date(e)));let o=((e=new Date(e)).getDay()-n.firstDayOfWeek+7)%7;e.setDate(0);let r=e.getDate();if(e.setDate(32),e.setDate(1),e.setDate(32),n._selectedCells)for(let e=0;e<n._selectedCells.length;e++)n._selectedCells[e].closest(".smart-calendar-month")===t&&n._setCellState(n._selectedCells[e],"selected",!1);n._setMonthContent(e,t,{previusMonthDays:r,firstDayOfWeek:o,selectedDates:l,importantDates:i,restrictedDates:s})}_setMonthContent(e,t,a){const n=this,l=32-e.getDate(),i=n._getMonthCells(t,n.rightToLeft),s=t._date.getMonth(),o=t._date.getFullYear(),r=new Date;let d,c=1,m=1;r.setHours(0,0,0,0),i.map((e=>{n._setCellState(e,"restricted",!1),n._setCellState(e,"selected",!1),n._setCellState(e,"otherMonth",!1),n._setCellState(e,"focus",!1),n._setCellState(e,"important",!1),n._setCellState(e,"today",!1),n._setCellState(e,"disabled",!1),n._setCellState(e,"hover",!1)}));for(let e=0;e<i.length;e++){const h=i[e];e===a.firstDayOfWeek&&m<=l?(h.className="smart-calendar-cell",h.value=new Date(o,s,m),h.innerHTML=h.value.getDate().toString(),a.restrictedDates.indexOf(m)>-1||h.value.getTime()<n.min.getTime()||h.value.getTime()>n.max.getTime()?n._setCellState(h,"restricted",!0):a.selectedDates.indexOf(m)>-1&&(n._setCellState(h,"selected",!0),n._selectedCells.indexOf(h)<0&&n._selectedCells.push(h)),a.importantDates.indexOf(m)>-1&&(n._setImportantDate(h.value,h),a.importantDates.splice(a.importantDates.indexOf(m),1)),h.value.getTime()===r.getTime()&&n._setCellState(h,"today",!0),a.firstDayOfWeek++,m++):(1===m?(h.value=new Date(o,s-1,++a.previusMonthDays-a.firstDayOfWeek),d=!!(h.value.getTime()<n.min.getTime()||t.previousElementSibling)):(h.value=new Date(o,s+1,c++),d=!!(h.value.getTime()>n.max.getTime()||t.nextElementSibling)),h.innerHTML=h.value.getDate().toString(),n._setCellState(h,"otherMonth",!0),d?h.classList.add("smart-visibility-hidden"):h.classList.remove("smart-visibility-hidden"))}n.months>1&&(t.firstElementChild.innerHTML=n.dateFormatFunction?n.dateFormatFunction(t._date):n._monthsNames[s]+" "+t._date.toLocaleDateString(n.locale,{year:n.yearFormat})),n._setMonthWeekNumbers(t)}_refreshMonthNames(){const e=this;let t,a=new Date;function n(t){let a=e.monthNameFormat;"firstTwoLetters"===a&&(a="long");let n=new Intl.DateTimeFormat(e.locale,{month:a}).format(t);return"firstTwoLetters"===e.monthNameFormat&&(n=8206===n.charCodeAt(0)?n.substring(0,2):n.substring(1,3)),n}a.setDate(1),e._monthsNames=[];for(let l=0;l<12;l++)a.setMonth(l),t=n(a),e._monthsNames.push(t);if("classic"===e.calendarMode&&e.$.monthElement){let t=e.$.monthsContainer.children;if(e.$.monthElement.dataSource&&(e._changeEventFired=1),e.shadowRoot?e._setMonthElementPropertyInShadowDOM("dataSource",e._monthsNames):e.$.monthElement.dataSource=e._monthsNames,e._viewDates){for(let a=0;a<t.length;a++)t[a].firstElementChild.textContent=e._monthsNames[t[a]._date.getMonth()]+" "+t[a]._date.getFullYear();e._changeEventFired=1,e.shadowRoot?e._setMonthElementPropertyInShadowDOM("selectedIndex",e._viewDates.map((e=>e.getMonth()))[0]):e.$.monthElement.selectedIndex=e._viewDates.map((e=>e.getMonth()))[0]}}}_setMonthWeekNumbers(e){const t=this,a=function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!0};let n=e.getElementsByClassName("smart-calendar-week");n=[].slice.call(n);for(let l=0;l<n.length;l++){if(!a(n[l])){n[l].children[0].innerHTML="";continue}const i=n[l].children[1],s=i.otherMonth?i.value.getTime()>e._date.getTime()?1:-1:0;n[l].children[0].innerHTML=t._getWeekNumber(new Date(e._date.getFullYear(),e._date.getMonth()+s,i.value.getDate()))}}_setRestrictedDates(e){const t=this,a=t.$.monthsContainer.children;for(let e=0;e<a.length;e++)t._getMonthCells(a[e]).map((e=>{t._setCellState(e,"restricted",!1)}));if(t._viewDates){const a=function(e){for(let a=0;a<t._viewDates.length;a++)if(t._viewDates[a].getFullYear()===e.getFullYear()&&t._viewDates[a].getMonth()===e.getMonth())return!0};for(let n=0;n<e.length;n++)if(a(e[n])){const a=t._getCellByDate(e[n]);t._setCellState(a,"restricted",!0)}}}_setScrollButtonsNavigationMode(){const e=this;"landscape"!==e.scrollButtonsNavigationMode?(e.$.previousMonthButton&&(e.$.previousMonthButton.$.button.firstElementChild.className="smart-arrow-down smart-arrow"),e.$.nextMonthButton&&(e.$.nextMonthButton.$.button.firstElementChild.className="smart-arrow-up smart-arrow")):(e.$.previousMonthButton&&(e.$.previousMonthButton.$.button.firstElementChild.className="smart-arrow-left smart-arrow"),e.$.nextMonthButton&&(e.$.nextMonthButton.$.button.firstElementChild.className="smart-arrow-right smart-arrow")),e._applyAnimationSettings(!0)}_refreshTitle(){const e=this;let t=e.selectedDates.length>0?e.selectedDates[e.selectedDates.length-1]:new Date;if(e.titleTemplate){if("function"==typeof e.titleTemplate)return;let a=e._layoutTemplates.filter((t=>t.selector===e.$.title))[0],n=document.importNode(a.template.content,!0);if(a.bindings.length>0){let l=n.childNodes[a.bindings[0].childNodeIndex];return t=t.toLocaleDateString(e.locale,{year:e.yearFormat,weekday:"short",month:"short",day:"numeric"}),void(a.selector.childNodes[a.bindings[0].childNodeIndex].innerHTML=l.innerHTML.replace(a.bindings[0].bindingString,t))}}e.$.title.children[0].innerHTML=t.toLocaleDateString(e.locale,{year:e.yearFormat}),e.$.title.children[1].innerHTML="landscape"===e.view?t.toLocaleDateString(e.locale,{weekday:"short"})+",</br>"+t.toLocaleDateString(e.locale,{month:"short",day:"numeric"}):t.toLocaleDateString(e.locale,{weekday:"short"})+", "+t.toLocaleDateString(e.locale,{month:"short",day:"numeric"})}_setWeeksVisibility(e){const t=this,a=e.children;let n;function l(e){(function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!1;return!0})(e)||n>=t.weeks?e.classList.add("smart-hidden"):n<t.weeks&&(e.classList.remove("smart-hidden"),n++)}for(let e=0;e<a.length;e++){let i=a[e].getElementsByClassName("smart-calendar-week");i=[].slice.call(i);let s=t._selectedCells.filter((t=>t.closest(".smart-calendar-month")===a[e]));if(6!==t.weeks)if(n=0,s.length>0){let e=s[s.length-1],t=i.indexOf(e.parentElement);for(let e=t;e<i.length;e++)l(i[e]);for(let e=t-1;e>=0;e--)l(i[e])}else for(let e=0;e<i.length;e++)l(i[e]);else i.map((e=>e.classList.remove("smart-hidden")))}}_refreshHeaderElements(){const e=this,t=document.activeElement.closest("smart-calendar")===e,a=e._animationStarted?e.$.nextMonthsContainer:e.$.dateViewContainer;let n,l,i=e._viewDates[e._viewDates.length-1],s=e._viewDates.map((e=>e.getFullYear()));if("month"===e.displayMode||"list"!==e.displayModeView){if("classic"===e.calendarMode&&e.$.monthElement&&e.$.monthElement instanceof HTMLDivElement){const t=document.createElement("smart-input");t.setAttribute("smart-id","monthElement"),t.classList.add("smart-calendar-month-element"),t.dropDownPosition="bottom",t.selectionMode="one",t.disabled=e.disabled,t.rightToLeft=e.rightToLeft,t.theme=e.theme,t.dropDownWidth=e.dropDownWidth,t.dropDownHeight=e.dropDownHeight,t.readonly=!0,t.dropDownButtonPosition="right";const a=e.$.monthElement;e.$.monthElement.parentNode.insertBefore(t,e.$.monthElement),e.$.monthElement=t,a.remove()}if(e.$.previousMonthButton&&!e.disabled&&("month"!==e.displayMode&&e.$.dateViewContainer.children[0].value?l="year"===e.displayMode?a.children[0].value.getFullYear()-1:a.children[1].value.getFullYear()-1:e._viewDates[0].getMonth()-1<0?(n=11,l=e._viewDates[0].getFullYear()-1):(n=e._viewDates[0].getMonth()-1,l=e._viewDates[0].getFullYear()),e.$.previousMonthButton.disabled=l<e.min.getFullYear()||l===e.min.getFullYear()&&n<e.min.getMonth(),e.$.previousMonthButton.disabled&&t&&e.$.body.focus()),e.$.nextMonthButton&&!e.disabled&&("month"!==e.displayMode&&e.$.dateViewContainer.children[0].value?l="year"===e.displayMode?a.children[0].value.getFullYear()+1:a.children[1].value.getFullYear()+11:i.getMonth()+1>11?(n=0,l=i.getFullYear()+1):(n=i.getMonth()+1,l=i.getFullYear()),e.$.nextMonthButton.disabled=l>e.max.getFullYear()||l===e.max.getFullYear()&&n>e.max.getMonth(),e.$.nextMonthButton.disabled&&t&&e.$.body.focus()),"classic"===e.calendarMode&&e.$.monthElement){let t=[...e._monthsNames];if(s.indexOf(e.min.getFullYear())>-1)for(let a=0;a<e.min.getMonth();a++)t[a]="";if(s.indexOf(e.max.getFullYear())>-1)for(let a=e.max.getMonth()+1;a<t.length;a++)t[a]="";t=t.filter((e=>""!==e));const a=Math.max(0,e.$.monthElement.selectedIndex);e.$.monthElement.dataSource=t,e._changeEventFired=0!==e.$.monthElement.selectedIndex,e.shadowRoot?e._setMonthElementPropertyInShadowDOM("selectedIndex",e._viewDates[0].getMonth()):e.$.monthElement.selectedIndex=a,e._changeEventFired=0}e.$.previousYearButton&&!e.disabled&&(l=e._viewDates[0].getFullYear()-1,e.$.previousYearButton.disabled=l<e.min.getFullYear(),e.$.previousYearButton.disabled&&t&&e.$.body.focus()),e.$.nextYearButton&&!e.disabled&&(l=i.getFullYear()+1,e.$.nextYearButton.disabled=l>e.max.getFullYear(),e.$.nextYearButton.disabled&&t&&e.$.body.focus()),e.$.yearElement&&(e.$.yearElement.value=s[0],e.$.yearElement.disabled=i.getFullYear()+1>e.max.getFullYear()&&e._viewDates[0].getFullYear()-1<e.min.getFullYear())}}_setMonthElementPropertyInShadowDOM(e,t){const a=this.$.monthElement,n=a.context;a.context=document,this.$.monthElement[e]=t,a.context=n}_refreshHeaderTitle(){const e=this;let t;function a(){if("month"!==e.displayMode){if("list"===e.displayModeView){const a=e.$.listViewContainer;if(!a)return;const n=a.querySelectorAll("li");if(!n.length)return"";let l;a.querySelector("li.active")&&(l=a.querySelector("li.active").getAttribute("value")),t="year"===e.displayMode?new Date(l||n[0].getAttribute("value")).getFullYear():new Date(n[0].getAttribute("value")).getFullYear()+" - "+new Date(n[n.length-1].getAttribute("value")).getFullYear()}else if(e.$.dateViewContainer.children[0].value){let a=e._animationStarted?e.$.nextMonthsContainer.children:e.$.dateViewContainer.children;t="year"===e.displayMode?a[0].value.getFullYear():a[1].value.getFullYear()+" - "+a[a.length-2].value.getFullYear()}if(t)return t}const a=e._viewDates.slice(0).sort(((e,t)=>e.getTime()-t.getTime())),n=a[0],l=a[a.length-1];n.setDate(2);let i=e.monthNameFormat;return"firstTwoLetters"===i&&(i="long"),t=n.toLocaleDateString(e.locale,{year:e.yearFormat,month:i}),e.months>1&&(l.setDate(2),t+=" - "+l.toLocaleDateString(e.locale,{year:e.yearFormat,month:i})),t}if("default"===e.calendarMode&&(e.$.defaultHeaderDate.innerHTML=a()),"function"==typeof e.headerTemplate||!e._layoutTemplates)return;let n=e._layoutTemplates.filter((t=>t.selector===e.$.header))[0];if(!n)return;let l=document.importNode(n.template.content,!0);if(n.bindings.length>0){const t=l.childNodes[n.bindings[0].childNodeIndex];(e.shadowRoot?e:n.selector).childNodes[n.bindings[0].childNodeIndex].innerHTML=t.innerHTML.replace(n.bindings[0].bindingString,e.dateFormatFunction?e.dateFormatFunction(e._viewDates):a())}}_updateWeeksVisibility(e,t){const a=this;let n=(t||a._focusedCell).parentElement;function l(){for(let e=o;e<s.length;e++)if(s[e].classList.contains("smart-hidden")&&!r(s[e])&&(s[e].classList.remove("smart-hidden"),d++,d===a.weeks))return!0}function i(){for(let e=o;e>=0;--e)if(s[e].classList.contains("smart-hidden")&&!r(s[e])&&(s[e].classList.remove("smart-hidden"),d++,d===a.weeks))return!0}if(!t&&!n.classList.contains("smart-hidden"))return;const s=[].slice.call(n.parentElement.children),o=s.indexOf(n),r=function(e){for(let t=1;t<e.children.length;t++)if(!e.children[t].classList.contains("smart-visibility-hidden"))return!1;return!0};let d=0;if(s.map((e=>e.classList.add("smart-hidden"))),e>0){if(l())return;i()}else{if(i())return;l()}}_getValidDates(e){let t=[];function a(e){if(e instanceof Date)return e;if(Smart.Utilities.DateTime&&e instanceof Smart.Utilities.DateTime)return e.toDate();if("string"==typeof e){if("new Date()"===e.trim()||"new Smart.Utilities.DateTime()"===e.trim())return new Date;let t=/(\d+[,-.\/]{1}\s*\d+[,-.\/]{1}\s*\d+)/;const a=()=>(e=e.replace(/[,-.\/]/g,",").split(",")).length>2?e=new Date(parseInt(e[0]),parseInt(e[1])-1,parseInt(e[2])):new Date;return t.test(e)&&(e=t.exec(e)[0].replace(/[,-.\/]/g,",").split(","))?new Date(parseInt(e[0]),parseInt(e[1])-1,parseInt(e[2])):a()}}if(void 0===e)return null;if(Array.isArray(e))for(let n=0;n<e.length;n++)t.push(a(e[n]));else t.push(a(e));return t=t.filter((e=>e&&"Invalid Date"!==e.toDateString())),t.map((e=>e.setHours(0,0,0,0))),t}_getValidDate(e){const t=this._getValidDates(e);return t.length>0?t[0]:null}_validateSelectedDates(e){const t=this;let a=[];e||(e=t.selectedDates);let n=e.slice(0),l=function(e){for(let a=0;a<t.restrictedDates.length;a++)if(t.restrictedDates[a].getTime()===e.getTime())return!0};t.selectedDates=n.filter((function(e){if(e.getTime()>=t.min.getTime()&&e.getTime()<=t.max.getTime()&&!l(e))return!0;a.push(e)})),t._viewDates&&(a.map((e=>t._selectDate(e))),t._focusCell())}_validateMinMax(e,t,a){const n=this;switch(e){case"min":t=n._getValidDate(n[e]),n.min=t||a||n.properties.min.defaultValue;break;case"max":t=n._getValidDate(n[e]),n.max=t||a||n.properties.max.defaultValue;break;default:t=n._getValidDate(n.min),n.min=t||a||n.properties.min.defaultValue,t=n._getValidDate(n.max),n.max=t||a||n.properties.max.defaultValue}n.min=n.min.getTime()>n.max.getTime()?n.max:n.min,n.min.setHours(0,0,0,0),n.max.setHours(0,0,0,0);let l,i=n.$.monthsContainer.children;if(n._viewDates){if(n._viewDates[0].getTime()>n.max.getTime()||n._viewDates[0].getTime()<n.min.getTime())return void n._handleMonths();for(let e=0;e<i.length;e++){l=n._getMonthCells(i[e]);for(let t=0;t<l.length;t++){const a=l[t];if(a.value.getTime()>=n.min.getTime()&&a.value.getTime()<=n.max.getTime())n._setCellState(a,"restricted",!1),a.value.getMonth()===i[e]._date.getMonth()?a.classList.remove("smart-visibility-hidden"):n.hideOtherMonthDays||(n._setCellState(a,"otherMonth",!0),a.classList.remove("smart-visibility-hidden")),"month"!==n.displayMode&&n._setCellState(a,"otherMonth",!1);else{if(a.otherMonth){if(a.classList.contains("smart-visibility-hidden")){n._setCellState(a,"restricted",!1);continue}}else n._setCellState(a,"restricted",!0);"month"!==n.displayMode&&(a.classList.remove("smart-visibility-hidden"),n._setCellState(a,"otherMonth",!0))}}}}}_setCellState(e,t,a){e[t]=a;const n=Smart.Utilities.Core.toDash(t);a?(e.setAttribute(n,""),"selected"===t?e.setAttribute("aria-selected",!0):"today"===t?e.setAttribute("aria-current","date"):"restricted"===t?e.removeAttribute("aria-selected"):"disabled"===t&&(e.removeAttribute("aria-selected"),e.setAttribute("aria-disabled",!0))):(e.removeAttribute(n),"selected"===t?"none"===this.selectionMode||e.restricted||e.disabled?e.removeAttribute("aria-selected"):e.setAttribute("aria-selected",!1):"today"===t?e.removeAttribute("aria-current"):"restricted"!==t||e.disabled?"disabled"===t&&(e.removeAttribute("aria-disabled"),e.restricted||e.setAttribute("aria-selected",!1)):e.setAttribute("aria-selected",!1))}_validateTemplate(e,t){if(null===t||!t)return;if("function"==typeof t)return;const a=this;if("content"in document.createElement("template")){if("string"==typeof t&&(t=document.getElementById(t)),null!==t&&"content"in t)return t;a.error(a.localize("invalidTemplate",{elementType:a.nodeName.toLowerCase(),property:e}))}else a.error(a.localize("htmlTemplateNotSuported",{elementType:a.nodeName.toLowerCase()}))}_weeksDownHandler(e,t){const a=this,n=t.value;let l;if(a.$.body.contains(t))if(t.otherMonth&&(l=t.value.getTime()>t.closest(".smart-calendar-month")._date.getTime()?1:-1),n&&a.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t,e.pageX,e.pageY),l){if(a._isDateInView(n))return;a.disableAutoNavigation||a.navigate(l*a.months)}else(t=a._getCellByDate(n))&&(t.disabled||t.restricted)||a._handleDateSelection(t)}_firstDayOfWeekValidator(e,t){return Math.min(Math.max(0,isNaN(t)?6:t),6)}_weeksValidator(e,t){return Math.min(Math.max(1,isNaN(t)?6:t),6)}_monthsValidator(e,t){return Math.min(Math.max(1,isNaN(t)?1:t),12)}});
|
|
75
75
|
Smart("smart-card",class extends Smart.ContentElement{static get properties(){return{dataSource:{value:null,type:"object?",reflectToAttribute:!1},itemTemplate:{value:null,type:"any?",reflectToAttribute:!1},contentHandler:{value:null,type:"function?",reflectToAttribute:!1}}}static get listeners(){return{mouseenter:"_mouseEnterHandler",mouseleave:"_mouseLeaveHandler",swipeleft:"_swipeHandler",swiperight:"_swipeHandler",swipetop:"_swipeHandler",swipebottom:"_swipeHandler"}}static get styleUrls(){return["smart.card.css"]}template(){return'<div id="container" inner-h-t-m-l="[[innerHTML]]" role="presentation">\n <content></content>\n </div>'}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const r=this;switch(e){case"itemTemplate":r._template=r._handleTemplate(),r.innerHTML=r._processTemplate(),r.contentHandler&&r.contentHandler(r);break;case"dataSource":r.innerHTML=r._processTemplate(),r.contentHandler&&r.contentHandler(r);break;case"contentHandler":r.contentHandler&&r.contentHandler(r)}}ready(){super.ready()}render(){const e=this;e.setAttribute("role","group"),e._template=e._handleTemplate(),e._template.hasBindings?e.innerHTML=e._processTemplate():e.itemTemplate&&(e.innerHTML=e._template.content),e.contentHandler&&e.contentHandler(e),super.render()}_handleTemplate(){const e=this;let t=e.itemTemplate,n="",r=!1;return e.itemTemplate?t instanceof HTMLElement?n=t.innerHTML:(t=document.getElementById(t),n=t?t.innerHTML:""):n=e.innerHTML,/{{\w+}}/g.exec(n)&&(r=!0),{content:n,hasBindings:r}}_processTemplate(){const e=this,t=e._template.content.match(/{{\w+}}/g),n=e.dataSource||{};let r=e._template.content;return t&&0!==t.length?(t.forEach((function(e){const t=e.replace("{{","").replace("}}","");let a=n[t];void 0===a&&(a=""),r=r.replace(e,a)})),r):r}_swipeHandler(){}});
|
|
76
76
|
Smart("smart-carousel",class extends Smart.ContentElement{static get properties(){return{adaptiveHeight:{value:!1,type:"boolean"},adaptiveAutoHeight:{value:!1,type:"boolean"},autoPlay:{value:!1,type:"any"},dataSource:{value:[],type:"array",reflectToAttribute:!1},delay:{value:200,type:"number"},displayMode:{allowedValues:["default","multiple","3d"],value:"default",type:"string"},disableItemClick:{value:!1,type:"boolean"},hideArrows:{value:!1,type:"boolean"},hideIndicators:{value:!1,type:"boolean"},indicatorTemplate:{value:null,type:"any"},interval:{value:5e3,type:"number"},itemTemplate:{value:null,type:"any"},keyboard:{value:!1,type:"boolean"},loop:{value:!1,type:"boolean"},messages:{value:{en:{htmlTemplateNotSuported:"{{elementType}}: Browser doesn't support HTMLTemplate elements."}},type:"object",extend:!0},slideShow:{value:!1,type:"boolean"},swipe:{value:!1,type:"boolean"},wheel:{value:!1,type:"boolean"}}}static get listeners(){return{"arrowLeft.click":"_handleArrowClick","arrowRight.click":"_handleArrowClick","indicatorsContainer.click":"_handleIndicatorsContainerClick",keydown:"_handleKeyDown",swipeleft:"_handleSwipe",swiperight:"_handleSwipe",wheel:"_handleMouseWheel","itemsContainer.click":"_handleItemClick","itemsContainer.transitionend":"_handleTransitionEnd"}}static get requires(){return{"Smart.RepeatButton":"smart.button.js"}}static get styleUrls(){return["smart.button.css","smart.carousel.css"]}get enableShadowDOM(){const e=this,t=Smart.EnableShadowDOM;return e._isInShadowDOM?!e._isInShadowDOM:e.isCompleted?null!==e.shadowRoot:t}template(){return'<div id="container" role="presentation">\n <div id="itemsContainer" inner-h-t-m-l="[[innerHTML]]" class="smart-items-container" role="presentation"><content></content></div>\n <smart-repeat-button initial-delay="0" right-to-left="[[rightToLeft]]" delay="[[delay]]" id="arrowLeft" animation="[[animation]]" unfocusable class="smart-arrow smart-arrow-left" aria-label="Previous slide"></smart-repeat-button>\n <smart-repeat-button initial-delay="0" right-to-left="[[rightToLeft]]" delay="[[delay]]" id="arrowRight" animation="[[animation]]" unfocusable class="smart-arrow smart-arrow-right" aria-label="Next slide"></smart-repeat-button>\n <div id="indicatorsContainer" class="smart-indicators-container" role="tablist"></div>\n </div>'}propertyChangedHandler(e,t,a){const n=this;switch(super.propertyChangedHandler(e,t,a),e){case"disabled":n._setFocusable();break;case"dataSource":if(n._currentIndex=0,n._generateIndicators(),n._generateItems(),n._handleIndicatorsState(0,0),n._handleItemsState(0,0),n._handle3dMode(0),!1!==n.autoPlay){const e=parseInt(n.autoPlay);e?setTimeout((function(){n.play()}),e):n.play()}n._animationTrigger(n._currentIndex),(n.adaptiveHeight||n.adaptiveAutoHeight)&&n._setAdaptiveHeight();break;case"itemTemplate":n._generateItems(),n._handleItemsState(n._currentIndex,n._currentIndex+1),(n.adaptiveHeight||n.adaptiveAutoHeight)&&n._setAdaptiveHeight();break;case"indicatorTemplate":n._generateIndicators(),n._handleIndicatorsState(n._currentIndex,n._currentIndex+1);break;case"interval":n.pause(),n.play();break;case"loop":n._handleArrowsActiveState(n._currentIndex,n._currentIndex);break;case"hideArrows":a||n._handleArrowsActiveState(n._currentIndex,n._currentIndex);break;case"displayMode":"multiple"===t&&n.$.itemsContainer.removeAttribute("style")}}render(){const e=this;if(e.setAttribute("role","region"),e.setAttribute("aria-roledescription","carousel"),e._setInitialState(),e._generateIndicators(),e._generateItems(),e._handleIndicatorsState(0,0),e._handleItemsState(0,0),e._handle3dMode(0),!1!==e.autoPlay){const t=parseInt(e.autoPlay);t?setTimeout((function(){e.play()}),t):e.play()}e._setFocusable(),e._animationTrigger(e._currentIndex),e._handleArrowsActiveState(0,e._currentIndex),(e.adaptiveHeight||e.adaptiveAutoHeight)&&(window.addEventListener("resize",(()=>{e._setAdaptiveHeight()})),e._setAdaptiveHeight()),super.render()}_setAdaptiveHeight(){const e=this;let t=10;(e.adaptiveHeight||e.adaptiveAutoHeight)&&(e._items.forEach((a=>{const n=a.querySelector("img");n&&(n.onload=()=>{e.classList.remove("smart-calculated-height"),e.offsetHeight<a.children[0].offsetHeight&&(e.style.height=a.children[0].offsetHeight+"px"),e.classList.add("smart-calculated-height")}),a.children[0].offsetHeight>t&&(t=a.children[0].offsetHeight)})),e.style.height=t+"px",e.classList.add("smart-calculated-height"))}_setAdaptiveAutoHeight(){const e=this;let t=10;e._items.forEach((e=>{e.classList.contains("smart-active")&&(t=e.children[0].offsetHeight)})),e.style.height=t+"px",e.classList.add("smart-calculated-height")}next(){const e=this,t=e.dataSource.length;if(e.disabled||0===t)return;let a=e._currentIndex;a=e.loop?a>=t-1?0:a+1:a>=t-1?a:a+1,e._goToItem(a)}pause(){this._handleRotation(),this._rotate=!1}slideTo(e){const t=this;e=e?parseInt(e):0,t.disabled||e<0||e>t._items.length||t._goToItem(e)}prev(){const e=this,t=e.dataSource.length;if(e.disabled||0===t)return;let a=e._currentIndex;a=e.loop?a<=0?t-1:a-1:a<=0?0:a-1,e._goToItem(a)}play(){const e=this;!e.disabled&&e.slideShow&&(e._rotationInterval&&clearInterval(e._rotationInterval),e._handleRotation(!0),e._rotate=!0)}_animationTrigger(e){const t=this;for(let a=0;a<t._items.length;a++)a!==e&&t._items[a].classList.add("smart-animate-trigger")}_handle3dMode(e){const t=this,a=t.dataSource.length;if(!t.disabled&&a&&"3d"===t.displayMode){e=e||0;for(let n=0;n<a;n++){const a=(n-e)*(t.rightToLeft?-1:1);a?t._items[n].setAttribute("position",a):t._items[n].removeAttribute("position")}}}_handleArrowsActiveState(e){const t=this,a=t.dataSource.length;t.loop?t.$.arrowLeft.disabled=t.$.arrowRight.disabled=!1:t.rightToLeft?(t.$.arrowRight.disabled=0===e,t.$.arrowLeft.disabled=e===a-1):(t.$.arrowLeft.disabled=0===e,t.$.arrowRight.disabled=e===a-1)}_handleArrowClick(e){const t=this,a=t._currentIndex;t.disabled||(t.rightToLeft?t.$.arrowLeft.contains(e.target)?t.next():t.prev():t.$.arrowLeft.contains(e.target)?t.prev():t.next(),t._changeEvent(a,t._currentIndex))}_handleDefaultInnerHTML(){const e=this;if(!(e.dataSource&&e.dataSource.length>0)&&e.$.itemsContainer.innerHTML.indexOf("<ul")>=0){const t=e.$.itemsContainer.getElementsByTagName("ul")[0].getElementsByTagName("li");for(let a=0;a<t.length;a++){const n={HTMLcontent:t[a].innerHTML};e.dataSource.push(n)}}}_handleIndicatorsState(e,t){const a=this;a.disabled||0===a._indicators.length||!e&&0!==e||!t&&0!==t||(e!==t&&(a._indicators[e].classList.remove("smart-active"),a._indicators[e].setAttribute("aria-selected",!1)),a._indicators[t].classList.add("smart-active"),a._indicators[t].setAttribute("aria-selected",!0))}_handleItemClick(e){const t=this,a=e.target.closest(".smart-carousel-item");if(t.disabled||!a||"3d"!==t.displayMode||t.disableItemClick)return;const n=parseInt(a.getAttribute("item-id")),i=parseInt(a.getAttribute("position"));Math.abs(i)>3||t._goToItem(n)}_handleItemsState(e,t){const a=this;a.disabled||0===a._items.length||!e&&0!==e||!t&&0!==t||(e!==t&&(a._items[e].classList.remove("smart-active"),a._items[e].classList.add("smart-out")),a._items[t].classList.add("smart-active"))}_handleIndicatorsContainerClick(e){const t=this,a=e.target.closest(".smart-indicator"),n=t._currentIndex;if(t.disabled||!a)return;const i=parseInt(a.getAttribute("indicator-id"));n!==i&&(t._goToItem(i),t._changeEvent(n,t._currentIndex))}_handleMultipleMode(e){const t=this;if("multiple"!==t.displayMode)return;const a=t._items[e].offsetWidth,n=t.$.container.offsetWidth,i=t.$.itemsContainer.offsetWidth;let r=0;if(0!==e)if(e!==t._items.length-1){for(let a=0;a<e;a++)r+=t._items[e].offsetWidth;r+a/2>=n/2&&r+a<i&&(t.$.itemsContainer.style.marginLeft="-"+(r+a/2-n/2)+"px")}else t.$.itemsContainer.style.marginLeft="-"+(i-n)+"px";else t.$.itemsContainer.style.marginLeft="0px"}_changeEvent(e,t){if(e===t)return;const a=this;a.onIndexChange?a.onIndexChange(t):(a.$.fireEvent("changing",{index:t,previousIndex:e}),a.hasAnimation&&"default"!==a.displayMode||a.$.fireEvent("change",{index:t,previousIndex:e}))}_handleKeyDown(e){const t=this,a=e.key,n=t._currentIndex;if(!t.disabled&&t.keyboard&&-1!==["ArrowLeft","ArrowDown","ArrowRight","ArrowUp","Home","End"," ","Enter"].indexOf(a)){switch(a){case"ArrowLeft":case"ArrowDown":t.rightToLeft?t.next():t.prev();break;case"ArrowUp":case"ArrowRight":t.rightToLeft?t.prev():t.next();break;case"Home":t._goToItem(0);break;case"End":t._goToItem(t.dataSource.length-1);break;case" ":t._rotate?t.pause():t.play();break;case"Enter":t.play()}t._changeEvent(n,t._currentIndex)}}_handleMouseWheel(e){const t=this,a=t._currentIndex;!t.disabled&&t.wheel&&document.activeElement===t&&(e.stopPropagation(),e.preventDefault(),e.deltaY>0?t.next():t.prev(),t._changeEvent(a,t._currentIndex))}_handleRotation(e){const t=this;e?t._rotationInterval=setInterval((function(){t.slideShow&&t.next()}),t.interval):clearInterval(t._rotationInterval)}_handleSwipe(e){const t=this;!t.disabled&&t.swipe&&(e.stopPropagation(),e.preventDefault(),"swipeleft"===e.type?t.prev():t.next())}_generateIndicator(e){const t=this,a=document.createElement("span"),n=e||0;if(t.indicatorTemplate){const e=t._validateTemplate(t.indicatorTemplate);a.innerHTML=t._processItemTemplate(e.content,t.dataSource[n])}return a.setAttribute("role","tab"),a.setAttribute("aria-selected",!1),a.classList.add("smart-indicator"),a.setAttribute("indicator-id",n),a}_generateIndicators(){const e=this,t=e.dataSource.length;let a=[],n=document.createDocumentFragment();for(let i=0;i<t;i++){const t=e._generateIndicator(i);a.push(t),n.appendChild(t)}e._indicators=a;const i=e.$.indicatorsContainer;for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(n)}_generateItem(e){const t=this,a=e||0,n=t.dataSource[a],i=document.createElement("div");if(i.id=t.id+"Slide"+e,t.itemTemplate){const e=t._validateTemplate(t.itemTemplate);i.innerHTML=t._processItemTemplate(e.content,t.dataSource[a])}else"string"==typeof n?i.style.backgroundImage='url("'+n+'")':i.innerHTML=`<div class="smart-carousel-item-container" style="background-image:url('${n.image||""}')" role="presentation">\n <h2 id="${i.id+"Label"}" class="smart-carousel-item-label">${n.label||""}</h2 >\n <p class="smart-carousel-item-content">${n.content||""}</p>\n </div>\n <div class="smart-carousel-html-content">${n.HTMLcontent||""}</div>\n </div>`;return n.label?(i.setAttribute("aria-labelledby",i.id+"Label"),t._indicators[e].setAttribute("aria-labelledby",i.id+"Label")):(i.setAttribute("aria-label","Slide "+e),t._indicators[e].setAttribute("aria-label","Slide "+e)),t._indicators[e].setAttribute("aria-controls",i.id),i.setAttribute("role","tabpanel"),i.classList.add("smart-carousel-item"),i.setAttribute("item-id",a),i}_processItemTemplate(e,t){const a=e.match(/{{\w+}}/g);let n=e;return a&&0!==a.length?(a.forEach((function(e){const a=e.replace("{{","").replace("}}","");n=n.replace(e,t[a]||"")})),n):n}_generateItems(){const e=this,t=e.dataSource.length;let a=[],n=document.createDocumentFragment();for(let i=0;i<t;i++){const t=e._generateItem(i);a.push(t),n.appendChild(t)}e._items=a;const i=e.$.itemsContainer;for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(n)}_goToItem(e,t){const a=this,n=a.dataSource.length,i=a._currentIndex;let r=e;e<0?r=0:e>n-1&&(r=n-1),a._removeFadeOut(),a._animationTrigger(),a._handleIndicatorsState(i,r),a._handleItemsState(i,r),a._currentIndex=r,t&&a._changeEvent(i,r),a._handle3dMode(r),a._handleMultipleMode(r),a._handleArrowsActiveState(r,i),a.adaptiveAutoHeight&&a._setAdaptiveAutoHeight()}_setFocusable(){const e=this;if(e.disabled||e.unfocusable)return e.removeAttribute("tabindex"),void(e.tabIndex=-1);let t=e.tabIndex>0?e.tabIndex:0;e.setAttribute("tabindex",t),e.tabIndex=t}_setInitialState(){const e=this;e._currentIndex=0,e._indicators=[],e._items=[],e._rotate=!1,e._handleDefaultInnerHTML()}_validateTemplate(e){const t=this;let a="",n=!1;return"function"==typeof e&&(a=e()),"content"in document.createElement("template")?(a=e instanceof HTMLElement||(e=document.getElementById(e))?e.innerHTML:"",/{{\w+}}/g.exec(a)&&(n=!0),{content:a,hasBindings:n}):(t.error(t.localize("htmlTemplateNotSuported",{elementType:t.nodeName.toLowerCase()})),void(t.itemTemplate=null))}_handleTransitionEnd(e){if(!e.target.classList.contains("smart-carousel-item")||e.target.getAttribute("position"))return;const t=this,a=e.target.getAttribute("item-id");t._lastTransitionEndId!==a&&(t._removeFadeOut(),this.$.fireEvent("change",{index:a,previousIndex:t._lastTransitionEndId}),t._lastTransitionEndId=a)}_removeFadeOut(){const e=this.$.itemsContainer.getElementsByClassName("smart-out");if(e.length)for(let t=0;t<e.length;t++)e[t].classList.remove("smart-out")}});
|
|
77
77
|
Smart("smart-chip",class extends Smart.ContentElement{static get properties(){return{avatar:{value:null,type:"string?"},closeButton:{value:!1,type:"boolean"},itemTemplate:{value:null,type:"any?",reflectToAttribute:!1},value:{value:"",type:"string"}}}static get listeners(){return{click:"_clickHandler",keydown:"_keyDownHandler"}}static get styleUrls(){return["smart.chip.css"]}template(){return'<div id="container" role="presentation">\n <span id="avatar" class="smart-avatar">[[avatar]]</span>\x3c!--\n --\x3e<span id="value" class="smart-value" inner-h-t-m-l="[[innerHTML]]"><content></content></span>\x3c!--\n --\x3e<span id="closeButton" class="smart-close-button" role="button" aria-label="Close"></span>\n </div>'}propertyChangedHandler(e,t,a){super.propertyChangedHandler(e,t,a);const n=this;switch(e){case"disabled":case"unfocusable":n._setFocusable();break;case"avatar":n.itemTemplate?n._setAvatar(n._customAvatar):n._setAvatar(n.$.avatar);break;case"itemTemplate":n._applyTemplate();break;case"value":n.itemTemplate?n._applyTemplate():n.$.value.innerHTML=a||""}}render(){const e=this;e.value=e.value?e.value:e.innerHTML,e._applyTemplate(),e._setFocusable(),super.render()}close(){const e=this;e.$.fireEvent("close",{value:e.value}),e.parentElement.removeChild(e)}_applyTemplate(){const e=this;let t=e.itemTemplate;if(!t)return e.$.value.innerHTML=e.value,void e._setAvatar(e.$.avatar);if(!("content"in document.createElement("template")))return void e.error(e.localize("htmlTemplateNotSuported",{elementType:e.nodeName.toLowerCase()}));if(t instanceof HTMLTemplateElement||(t=document.getElementById(t)),null===t||!("content"in t))return void e.error(e.localize("invalidTemplate",{elementType:e.nodeName.toLowerCase()}));let a=t.innerHTML;e.$.container.innerHTML=a.replace(/{{\s*value\s*}}/g,e.value),e._customAvatar=e.$.container.querySelector(".smart-avatar"),e._setAvatar(e._customAvatar)}_clickHandler(e){const t=this;if(t.disabled)return;const a=t.enableShadowDOM?t.shadowRoot.elementFromPoint(e.pageX,e.pageY):e.target;a.closest&&a.closest(".smart-close-button")&&t.close()}_keyDownHandler(e){const t=this;let a=e.key;t.disabled||t.readonly||"Delete"!==a||t.close()}_setAvatar(e){if(!e)return;const t=this,a=/\.(gif|jpg|jpeg|tiff|png)$/i.test(t.avatar);e.innerHTML=a?`<img src="${t.avatar}" aria-label="${t.value?"Avatar of "+t.value:"Avatar"}" />`:t.avatar||""}_setFocusable(){const e=this;e.disabled||e.unfocusable?e.removeAttribute("tabindex"):e.tabIndex=e.tabIndex>0?e.tabIndex:0}});
|