smart-webcomponents-react 14.3.0 → 14.4.0

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.
Files changed (206) hide show
  1. package/index.d.ts +1 -1
  2. package/package.json +1 -1
  3. package/source/modules/smart.accordion.js +1 -1
  4. package/source/modules/smart.array.js +1 -1
  5. package/source/modules/smart.barcode.js +1 -1
  6. package/source/modules/smart.breadcrumb.js +1 -1
  7. package/source/modules/smart.button.js +1 -1
  8. package/source/modules/smart.buttongroup.js +1 -1
  9. package/source/modules/smart.calendar.js +1 -1
  10. package/source/modules/smart.card.js +1 -1
  11. package/source/modules/smart.cardview.js +1 -1
  12. package/source/modules/smart.carousel.js +1 -1
  13. package/source/modules/smart.chart.js +1 -1
  14. package/source/modules/smart.checkbox.js +1 -1
  15. package/source/modules/smart.checkinput.js +1 -1
  16. package/source/modules/smart.chip.js +1 -1
  17. package/source/modules/smart.colorinput.js +1 -1
  18. package/source/modules/smart.colorpanel.js +1 -1
  19. package/source/modules/smart.colorpicker.js +1 -1
  20. package/source/modules/smart.combobox.js +1 -1
  21. package/source/modules/smart.common.js +1 -1
  22. package/source/modules/smart.countryinput.js +1 -1
  23. package/source/modules/smart.dateinput.js +1 -1
  24. package/source/modules/smart.daterangeinput.js +1 -1
  25. package/source/modules/smart.datetimepicker.js +1 -1
  26. package/source/modules/smart.dockinglayout.js +1 -1
  27. package/source/modules/smart.dropdownbutton.js +1 -1
  28. package/source/modules/smart.dropdownlist.js +1 -1
  29. package/source/modules/smart.editor.js +1 -1
  30. package/source/modules/smart.element.js +1 -1
  31. package/source/modules/smart.fileupload.js +1 -1
  32. package/source/modules/smart.form.js +1 -1
  33. package/source/modules/smart.formulaparser.js +1 -1
  34. package/source/modules/smart.ganttchart.js +1 -1
  35. package/source/modules/smart.gauge.js +1 -1
  36. package/source/modules/smart.grid.js +4 -4
  37. package/source/modules/smart.gridpanel.js +1 -1
  38. package/source/modules/smart.input.js +1 -1
  39. package/source/modules/smart.kanban.js +1 -1
  40. package/source/modules/smart.layout.js +1 -1
  41. package/source/modules/smart.led.js +1 -1
  42. package/source/modules/smart.listbox.js +1 -1
  43. package/source/modules/smart.listmenu.js +1 -1
  44. package/source/modules/smart.map.js +1 -1
  45. package/source/modules/smart.maskedtextbox.js +1 -1
  46. package/source/modules/smart.menu.js +1 -1
  47. package/source/modules/smart.multicomboinput.js +1 -1
  48. package/source/modules/smart.multiinput.js +1 -1
  49. package/source/modules/smart.multilinetextbox.js +1 -1
  50. package/source/modules/smart.multisplitbutton.js +1 -1
  51. package/source/modules/smart.numberinput.js +1 -1
  52. package/source/modules/smart.numerictextbox.js +1 -1
  53. package/source/modules/smart.pager.js +1 -1
  54. package/source/modules/smart.passwordinput.js +1 -1
  55. package/source/modules/smart.passwordtextbox.js +1 -1
  56. package/source/modules/smart.path.js +1 -1
  57. package/source/modules/smart.phoneinput.js +1 -1
  58. package/source/modules/smart.pivottable.js +1 -1
  59. package/source/modules/smart.progressbar.js +1 -1
  60. package/source/modules/smart.qrcode.js +1 -1
  61. package/source/modules/smart.querybuilder.js +1 -1
  62. package/source/modules/smart.radiobutton.js +1 -1
  63. package/source/modules/smart.rating.js +1 -1
  64. package/source/modules/smart.router.js +1 -1
  65. package/source/modules/smart.scheduler.js +1 -1
  66. package/source/modules/smart.scrollbar.js +1 -1
  67. package/source/modules/smart.slider.js +1 -1
  68. package/source/modules/smart.sortable.js +1 -1
  69. package/source/modules/smart.splitter.js +1 -1
  70. package/source/modules/smart.switchbutton.js +1 -1
  71. package/source/modules/smart.table.js +1 -1
  72. package/source/modules/smart.tabs.js +1 -1
  73. package/source/modules/smart.tank.js +1 -1
  74. package/source/modules/smart.textarea.js +1 -1
  75. package/source/modules/smart.textbox.js +1 -1
  76. package/source/modules/smart.timeinput.js +1 -1
  77. package/source/modules/smart.timepicker.js +1 -1
  78. package/source/modules/smart.toast.js +1 -1
  79. package/source/modules/smart.tooltip.js +1 -1
  80. package/source/modules/smart.tree.js +1 -1
  81. package/source/modules/smart.validator.js +1 -1
  82. package/source/modules/smart.window.js +1 -1
  83. package/source/smart.accordion.js +1 -1
  84. package/source/smart.ajax.js +1 -1
  85. package/source/smart.array.js +1 -1
  86. package/source/smart.barcode.js +1 -1
  87. package/source/smart.bootstrap.js +1 -1
  88. package/source/smart.breadcrumb.js +1 -1
  89. package/source/smart.button.js +1 -1
  90. package/source/smart.buttongroup.js +1 -1
  91. package/source/smart.calendar.js +1 -1
  92. package/source/smart.card.js +1 -1
  93. package/source/smart.cardview.js +1 -1
  94. package/source/smart.carousel.js +1 -1
  95. package/source/smart.chart.annotations.js +1 -1
  96. package/source/smart.chart.api.js +1 -1
  97. package/source/smart.chart.core.js +1 -1
  98. package/source/smart.chart.js +1 -1
  99. package/source/smart.chart.rangeselector.js +1 -1
  100. package/source/smart.chart.waterfall.js +1 -1
  101. package/source/smart.checkbox.js +1 -1
  102. package/source/smart.checkinput.js +1 -1
  103. package/source/smart.chip.js +1 -1
  104. package/source/smart.colorinput.js +1 -1
  105. package/source/smart.colorpanel.js +1 -1
  106. package/source/smart.colorpicker.js +1 -1
  107. package/source/smart.combobox.js +1 -1
  108. package/source/smart.complex.js +1 -1
  109. package/source/smart.core.js +1 -1
  110. package/source/smart.countryinput.js +1 -1
  111. package/source/smart.data.js +1 -1
  112. package/source/smart.date.js +1 -1
  113. package/source/smart.dateformatpanel.js +1 -1
  114. package/source/smart.dateinput.js +1 -1
  115. package/source/smart.daterangeinput.js +1 -1
  116. package/source/smart.datetimepicker.js +1 -1
  117. package/source/smart.dockinglayout.js +1 -1
  118. package/source/smart.draw.js +1 -1
  119. package/source/smart.dropdownbutton.js +1 -1
  120. package/source/smart.dropdownlist.js +1 -1
  121. package/source/smart.editor.js +1 -1
  122. package/source/smart.element.js +1 -1
  123. package/source/smart.elements.js +4 -4
  124. package/source/smart.export.js +1 -1
  125. package/source/smart.fileupload.js +1 -1
  126. package/source/smart.filter.js +1 -1
  127. package/source/smart.filterbuilder.js +1 -1
  128. package/source/smart.filterpanel.js +1 -1
  129. package/source/smart.form.js +1 -1
  130. package/source/smart.format.js +1 -1
  131. package/source/smart.formulaparser.js +1 -1
  132. package/source/smart.ganttchart.js +1 -1
  133. package/source/smart.gauge.js +1 -1
  134. package/source/smart.grid.cell.js +2 -2
  135. package/source/smart.grid.chart.js +1 -1
  136. package/source/smart.grid.column.js +1 -1
  137. package/source/smart.grid.core.js +1 -1
  138. package/source/smart.grid.dialog.js +2 -2
  139. package/source/smart.grid.edit.js +1 -1
  140. package/source/smart.grid.export.js +1 -1
  141. package/source/smart.grid.filter.js +1 -1
  142. package/source/smart.grid.group.js +1 -1
  143. package/source/smart.grid.js +1 -1
  144. package/source/smart.grid.menu.js +2 -2
  145. package/source/smart.grid.pager.js +1 -1
  146. package/source/smart.grid.reorder.js +1 -1
  147. package/source/smart.grid.resize.js +1 -1
  148. package/source/smart.grid.row.js +1 -1
  149. package/source/smart.grid.select.js +1 -1
  150. package/source/smart.grid.sort.js +1 -1
  151. package/source/smart.grid.toolbar.js +1 -1
  152. package/source/smart.grid.tree.js +1 -1
  153. package/source/smart.grid.view.js +1 -1
  154. package/source/smart.gridpanel.js +1 -1
  155. package/source/smart.input.js +1 -1
  156. package/source/smart.kanban.js +1 -1
  157. package/source/smart.layout.js +1 -1
  158. package/source/smart.led.js +1 -1
  159. package/source/smart.listbox.js +1 -1
  160. package/source/smart.listmenu.js +1 -1
  161. package/source/smart.map.js +1 -1
  162. package/source/smart.maskedtextbox.js +1 -1
  163. package/source/smart.math.js +1 -1
  164. package/source/smart.menu.js +1 -1
  165. package/source/smart.multicomboinput.js +1 -1
  166. package/source/smart.multiinput.js +1 -1
  167. package/source/smart.multilinetextbox.js +1 -1
  168. package/source/smart.multisplitbutton.js +1 -1
  169. package/source/smart.numberformatpanel.js +1 -1
  170. package/source/smart.numberinput.js +1 -1
  171. package/source/smart.numeric.js +1 -1
  172. package/source/smart.numerictextbox.js +1 -1
  173. package/source/smart.pager.js +1 -1
  174. package/source/smart.passwordinput.js +1 -1
  175. package/source/smart.passwordtextbox.js +1 -1
  176. package/source/smart.path.js +1 -1
  177. package/source/smart.phoneinput.js +1 -1
  178. package/source/smart.pivottable.js +1 -1
  179. package/source/smart.powerbutton.js +1 -1
  180. package/source/smart.progressbar.js +1 -1
  181. package/source/smart.qrcode.js +1 -1
  182. package/source/smart.radiobutton.js +1 -1
  183. package/source/smart.rating.js +1 -1
  184. package/source/smart.router.js +1 -1
  185. package/source/smart.scheduler.js +1 -1
  186. package/source/smart.scrollbar.js +1 -1
  187. package/source/smart.slider.js +1 -1
  188. package/source/smart.sortable.js +1 -1
  189. package/source/smart.splitter.js +1 -1
  190. package/source/smart.switchbutton.js +1 -1
  191. package/source/smart.table.js +1 -1
  192. package/source/smart.tabs.js +1 -1
  193. package/source/smart.tank.js +1 -1
  194. package/source/smart.textarea.js +1 -1
  195. package/source/smart.textbox.js +1 -1
  196. package/source/smart.tickintervalhandler.js +1 -1
  197. package/source/smart.timeinput.js +1 -1
  198. package/source/smart.timepicker.js +1 -1
  199. package/source/smart.toast.js +1 -1
  200. package/source/smart.tooltip.js +1 -1
  201. package/source/smart.tree.js +1 -1
  202. package/source/smart.validationpanel.js +1 -1
  203. package/source/smart.validator.js +1 -1
  204. package/source/smart.window.js +1 -1
  205. package/source/typescript/smart.elements.d.ts +1 -1
  206. package/source/typescript/smart.grid.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
 
2
- /* Smart UI v14.3.0 (2022-09-27)
2
+ /* Smart UI v14.4.0 (2022-09-27)
3
3
  Copyright (c) 2011-2021 jQWidgets.
4
4
  License: https://htmlelements.com/license/ */ //
5
5
 
@@ -47,17 +47,17 @@ 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("&lt")>=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 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}if("string"==typeof o&&(o.indexOf("[{")>=0||o.indexOf("}]")>=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="&nbsp;");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()}});
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}if("string"==typeof o&&(o.indexOf("[{")>=0||o.indexOf("}]")>=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="&nbsp;");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&&!l.formatFunction)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
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&&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()}}}});
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"):(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()}}}});
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
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(!0,!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(!0,!0,!1),o._selectionTimer&&clearTimeout(o._selectionTimer),o._selectionTimer=setTimeout((()=>{o._recycle(!0,!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
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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):t&&"object"==typeof t&&t instanceof Date?t.toLocaleString():t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;");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()}}deleteColumn(e){const t=this,i=this.columns.findIndex((t=>t.dataField===e));i>=0&&t.columns.splice(i,1)}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)}null===n[o.type]&&delete n[o.type]}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;if(void 0===t)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&&(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();let t=!0;const a=(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})},l=new DataTransfer;if("string"==typeof e&&e.indexOf("base64")>=0?e=JSON.parse(e):"string"==typeof e&&e.indexOf("[{")>=0&&(e=JSON.parse(e),t=!1),Array.isArray(e)){let o=0;e.forEach((async r=>{var s,d,c,u;t?l.items.add(a(r.value,r.label)):(s=r.value,d=r.label,c=t=>{l.items.add(t),o++,o===e.length&&(i.fileUpload.files=l.files,n())},(u=new Image).crossOrigin="Anonymous",u.onload=function(){var e=document.createElement("canvas"),t=e.getContext("2d");e.height=this.naturalHeight,e.width=this.naturalWidth,t.drawImage(this,0,0);var i=e.toDataURL("image/jpeg");c(a(i,d))},u.src=s)})),i.fileUpload.files=l.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)if(a.uploadSettings.url){const e=[...i.fileUpload.files],t=[];if(a.uploadSettings.singleFilePost)for(let l=0;l<e.length;l++){const n=[];n.push(e[l]),a._handleImagesUpload(i,n,t)}else a._handleImagesUpload(i,e,t)}else 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"),l=new DataTransfer;if(t.forEach((e=>{l.items.add(e.file)})),o.files=l.files,i.clearButton&&0===t.length&&i.clearButton.classList.remove("show"),a.uploadSettings.onUploadRemove){let t=a.uploadSettings.url+"/"+e.file.name;a.uploadSettings.onUploadRemove(t)}if(a.uploadSettings.removeUrl){let t=new FormData,i=new XMLHttpRequest;const l=(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})};n=a.uploadSettings.url+"/"+e.file.name,r=e.file.name,s=e=>{t.append(a.uploadSettings.name,e),i.open("POST",a.uploadSettings.removeUrl),i.send(t)},(d=new Image).crossOrigin="Anonymous",d.onload=function(){var e=document.createElement("canvas"),t=e.getContext("2d");e.height=this.naturalHeight,e.width=this.naturalWidth,t.drawImage(this,0,0);var a=e.toDataURL("image/jpeg");s(l(a,r))},d.src=n}}}else a._openImagePreviewDialog(e.querySelector("img"));var n,r,s,d},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=()=>{const e=i.cell.value&&i.cell.value.indexOf("[{")>=0?JSON.parse(i.cell.value):[];for(let t=0;t<o.files.length;t++)if(a.uploadSettings.removeUrl){let i=new FormData,l=new XMLHttpRequest;const n=(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})};((e,t,a)=>{var i=new Image;i.crossOrigin="Anonymous",i.onload=function(){var e=document.createElement("canvas"),i=e.getContext("2d");e.height=this.naturalHeight,e.width=this.naturalWidth,i.drawImage(this,0,0);var l=e.toDataURL("image/jpeg");a(n(l,t))},i.src=e})(e[t]?e[t]:a.uploadSettings.url+"/"+o.files[t].name,o.files[t].name,(e=>{i.append(a.uploadSettings.name,e),l.open("POST",a.uploadSettings.removeUrl),l.send(i)}))}if(a.uploadSettings.onUploadRemove){const e=i.cell.value&&i.cell.value.indexOf("[{")>=0?JSON.parse(i.cell.value):[];for(let t=0;t<o.files.length;t++)e&&e[t]?a.uploadSettings.onUploadRemove(e[t]):a.uploadSettings.onUploadRemove(a.uploadSettings.url+"/"+o.files[t].name)}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,u=i.column.editor.maxImageSize||524288;let m=0,g=[];for(const o of e){const e=s();if(m>=c){g.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>u){const e=document.createElement("p");e.textContent=a.localize("dialogImageSize",{value:o.name,fileSize:r(u)}),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),m++}if(g.length>0){const e=document.createElement("p");e.textContent=a.localize("dialogImageCount",{files:g.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)}_handleImagesUpload(e,t,a){const i=this;if(e.column&&e.column.editor&&i.uploadSettings.url){const l=new FormData,n=i.uploadSettings.url;let o=!1;const r=t[0];i._uploadedFiles||(i._uploadedFiles=[]);const s=i.uploadSettings.data;s&&""!==s&&("string"==typeof s?l.append("postData",s):l.append("postData",JSON.stringify(s)));for(let e=0;e<t.length;e++){const a={name:t[e].name,size:t[e].size},n=JSON.stringify(a);-1===i._uploadedFiles.indexOf(n)&&(l.append(i.uploadSettings.name,t[e]),i._uploadedFiles.push(n),o=!0)}let d=new XMLHttpRequest;d.open("POST",n),i.uploadSettings.onSetHeaders&&"function"==typeof i.uploadSettings.onSetHeaders&&i.uploadSettings.onSetHeaders(d,r),o&&i.$.fireEvent("uploadStarted",{files:t,size:r.size}),i.uploadSettings.onUploadStarted&&i.uploadSettings.onUploadStarted({files:t,status:d.status}),d.upload.onprogress=function(e){i.uploadSettings.onProgress&&i.uploadSettings.onProgress(e)},d.onabort=function(e){i.uploadSettings.onAbort&&i.uploadSettings.onAbort(e)},d.onerror=function(e){i.uploadSettings.onError&&i.uploadSettings.onError(e)},d.onload=function(){if(d.status>=200&&d.status<=299){let l=!1;d.fileURL&&(l=d.file_url);let n=!1;d.response&&("string"==typeof d.response?(n=d.response,n.indexOf("[{")>=0&&(n=JSON.parse(d.response))):n=JSON.parse(d.response)),n&&n.file_url?l=n.file_url:n&&n[0]&&n[0].file_url&&(l=n[0].file_url),i.uploadSettings.onUploadCompleted&&i.uploadSettings.onUploadCompleted({files:t,status:d.status,fileURL:l,serverResponse:n});for(let n=0;n<t.length;n++){let o=i.uploadSettings.url+"/"+t[n].name;l&&Array.isArray(l)?o=l[n]:"string"==typeof l&&(o=l),a.push({value:o,label:t[n].name}),a.length===e.fileUpload.files.length&&(e.cell.editor.instance.setValue(a),i._endCellEdit(e.cell))}}else i.uploadSettings.onUploadError&&i.uploadSettings.onUploadError({files:t,status:d.status})},d.onreadystatechange=function(){e.column.editor.responseHandler&&"function"==typeof e.column.editor.responseHandler&&e.column.editor.responseHandler(d)},o&&d.send(l),i.uploadSettings.onChange&&i.uploadSettings.onChange(t)}}_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 u=document.createElement("div"),m=document.createElement("div");s.appendChild(u),s.appendChild(m);let g=n&&n.length?" ("+n.length+")":"";u.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")}${g}</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 p=u.querySelectorAll(".tab");i.storeHistory&&(!i._currentUser||i._currentUser&&!i._currentUser.info?p[p.length-1].classList.add("smart-hidden"):p[p.length-1].classList.remove("smart-hidden")),!i.users||i.users&&0===i.users.length||!i._currentUser||i._currentUser&&!i._currentUser.info?p[p.length-2].classList.add("smart-hidden"):p[p.length-2].classList.remove("smart-hidden"),u.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),a=u.querySelector(".details-tab"),l=u.querySelector(".comments-tab"),n=u.querySelector(".history-tab");a.classList.add("smart-hidden"),l.classList.add("smart-hidden"),n.classList.add("smart-hidden");for(let e=0;e<p.length;e++)p[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 b=i._getColorInput();u.querySelector(".background").appendChild(b),b.onchange=()=>{l.background=b.value},l.background&&(b.value=l.background);const y=i._getColorInput();u.querySelector(".color").appendChild(y),y.onchange=()=>{l.color=y.value},l.color&&(y.value=l.color);const f=i._getColorInput();u.querySelector(".status").appendChild(f),f.onchange=()=>{l.status=f.value},l.status&&(f.value=l.status);const v=document.createElement("smart-input");v.style.width="auto",v.classList.add("underlined"),v.dropDownButtonPosition="right",v.readonly=!0,v.dropDownHeight="auto",v.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],v.onchange=()=>{l.fontFamily=v.value},l.fontFamily?v.value=l.fontFamily:v.selectedIndex=0,u.querySelector(".font-family").appendChild(v);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,u.querySelector(".font-size").appendChild(h);const C=u.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"),u.querySelector(".reset-format").onclick=()=>{for(let e=0;e<C.children.length;e++)C.children[e].classList.remove("checked");v.selectedIndex=0,h.selectedIndex=0,y.value="",b.value="",f.value="",l.fontWeight=null,l.fontStyle=null,l.textDecoration=null,l.fontSize=null,l.fontFamily=null};const S=u.querySelector(".comments-header"),w=u.querySelector('[view="comments"]'),A=u.querySelector(".comments-layout smart-text-area"),D=u.querySelector(".comments-layout smart-button"),_=u.querySelector(".comments-layout .footer"),L=u.querySelector(".comments-layout .comments");D.disabled=!0,L.innerHTML=`<span class="no-comments">${i.localize("noComments")}</span>`;const k=()=>{const e=L.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+")":"";S.innerHTML=w.innerHTML=`${i.localize("comments").replace(":","")} ${o}`}}};for(let e=0;e<n.length;e++){const t=n[e],a=i._createComment(t);x(a),L.appendChild(a)}S.innerHTML=`${i.localize("comments").replace(":","")} ${g}`,k(),A.onfocus=()=>{_.classList.add("focus")},A.onblur=()=>{_.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(),L.appendChild(t);const l=n.length?"("+n.length+")":"";S.innerHTML=w.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 u=document.createElement("label");u.classList.add("smart-field-editor-error-label"),u.setAttribute("label-for",t.dataField),l.appendChild(u),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),u=t.offset(t);let m=d.offsetWidth+c.left-u.left-120;m<0&&(m=c.left-u.left),a.open(m,c.top-u.top-s-0),setTimeout((function(){a.btnConfirm.focus()}),100)}_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")},u={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(u),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(),u=document.createElement("div"),m=document.createElement("smart-input"),g=i._addColumnDialogEditors.allowColorItems;if(void 0!==r)m.setAttribute("data-id",r),m.setAttribute("data-item-value",r);else{const e=n.querySelectorAll(".smart-sortable-item").length;m.setAttribute("data-id",e),m.setAttribute("data-item-value",e)}return void 0!==s&&m.setAttribute("data-item-value",s),c.disabled=!g.querySelector(".smart-input").value,u.className="smart-grid-icon smart-icon-close show",u.setAttribute("role","button"),u.setAttribute("aria-label","button"),m.classList.add("underlined","edit-column-input"),m.style.width="100%",m.style.height="30px",m.required=!0,t&&(m.value=t),l&&(c.value=l),m.onkeyup=m.onchange=m.onblur=t=>{o(),"Enter"===t.key&&(m.parentElement.nextElementSibling||(e.click(),o()))},d.appendChild(c),d.appendChild(m),"users"!==a.bind&&d.appendChild(u),u.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)))}});
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();let t=!0;const a=(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})},l=new DataTransfer;if("string"==typeof e&&e.indexOf("base64")>=0?e=JSON.parse(e):"string"==typeof e&&e.indexOf("[{")>=0&&(e=JSON.parse(e),t=!1),Array.isArray(e)){let o=0;e.forEach((async r=>{var s,d,c,u;t?l.items.add(a(r.value,r.label)):(s=r.value,d=r.label,c=t=>{l.items.add(t),o++,o===e.length&&(i.fileUpload.files=l.files,n())},(u=new Image).crossOrigin="Anonymous",u.onload=function(){var e=document.createElement("canvas"),t=e.getContext("2d");e.height=this.naturalHeight,e.width=this.naturalWidth,t.drawImage(this,0,0);var i=e.toDataURL("image/jpeg");c(a(i,d))},u.src=s)})),i.fileUpload.files=l.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)if(a.uploadSettings.url){const e=[...i.fileUpload.files],t=[];if(a.uploadSettings.singleFilePost)for(let l=0;l<e.length;l++){const n=[];n.push(e[l]),a._handleImagesUpload(i,n,t)}else a._handleImagesUpload(i,e,t)}else 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"),l=new DataTransfer;if(t.forEach((e=>{l.items.add(e.file)})),o.files=l.files,i.clearButton&&0===t.length&&i.clearButton.classList.remove("show"),a.uploadSettings.onUploadRemove){let t=a.uploadSettings.url+"/"+e.file.name;a.uploadSettings.onUploadRemove(t)}if(a.uploadSettings.removeUrl){let t=new FormData,i=new XMLHttpRequest;const l=(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})};n=a.uploadSettings.url+"/"+e.file.name,r=e.file.name,s=e=>{t.append(a.uploadSettings.name,e),i.open("POST",a.uploadSettings.removeUrl),i.send(t)},(d=new Image).crossOrigin="Anonymous",d.onload=function(){var e=document.createElement("canvas"),t=e.getContext("2d");e.height=this.naturalHeight,e.width=this.naturalWidth,t.drawImage(this,0,0);var a=e.toDataURL("image/jpeg");s(l(a,r))},d.src=n}}}else a._openImagePreviewDialog(e.querySelector("img"));var n,r,s,d},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=()=>{const e=i.cell.value&&i.cell.value.indexOf("[{")>=0?JSON.parse(i.cell.value):[];for(let t=0;t<o.files.length;t++)if(a.uploadSettings.removeUrl){let i=new FormData,l=new XMLHttpRequest;const n=(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})};((e,t,a)=>{var i=new Image;i.crossOrigin="Anonymous",i.onload=function(){var e=document.createElement("canvas"),i=e.getContext("2d");e.height=this.naturalHeight,e.width=this.naturalWidth,i.drawImage(this,0,0);var l=e.toDataURL("image/jpeg");a(n(l,t))},i.src=e})(e[t]?e[t]:a.uploadSettings.url+"/"+o.files[t].name,o.files[t].name,(e=>{i.append(a.uploadSettings.name,e),l.open("POST",a.uploadSettings.removeUrl),l.send(i)}))}if(a.uploadSettings.onUploadRemove){const e=i.cell.value&&i.cell.value.indexOf("[{")>=0?JSON.parse(i.cell.value):[];for(let t=0;t<o.files.length;t++)e&&e[t]?a.uploadSettings.onUploadRemove(e[t]):a.uploadSettings.onUploadRemove(a.uploadSettings.url+"/"+o.files[t].name)}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,u=i.column.editor.maxImageSize||524288;let m=0,g=[];for(const o of e){const e=s();if(m>=c){g.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>u){const e=document.createElement("p");e.textContent=a.localize("dialogImageSize",{value:o.name,fileSize:r(u)}),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),m++}if(g.length>0){const e=document.createElement("p");e.textContent=a.localize("dialogImageCount",{files:g.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)}_handleImagesUpload(e,t,a){const i=this;if(e.column&&e.column.editor&&i.uploadSettings.url){const l=new FormData,n=i.uploadSettings.url;let o=!1;const r=t[0];i._uploadedFiles||(i._uploadedFiles=[]);const s=i.uploadSettings.data;s&&""!==s&&("string"==typeof s?l.append("postData",s):l.append("postData",JSON.stringify(s))),l.append("fileType","image");for(let e=0;e<t.length;e++){const a={name:t[e].name,size:t[e].size},n=JSON.stringify(a);-1===i._uploadedFiles.indexOf(n)&&(l.append(i.uploadSettings.name,t[e]),i._uploadedFiles.push(n),o=!0)}let d=new XMLHttpRequest;d.open("POST",n),i.uploadSettings.onSetHeaders&&"function"==typeof i.uploadSettings.onSetHeaders&&i.uploadSettings.onSetHeaders(d,r),o&&i.$.fireEvent("uploadStarted",{files:t,size:r.size}),i.uploadSettings.onUploadStarted&&i.uploadSettings.onUploadStarted({files:t,status:d.status}),d.upload.onprogress=function(e){i.uploadSettings.onProgress&&i.uploadSettings.onProgress(e)},d.onabort=function(e){i.uploadSettings.onAbort&&i.uploadSettings.onAbort(e)},d.onerror=function(e){i.uploadSettings.onError&&i.uploadSettings.onError(e)},d.onload=function(){let l=!1;if(d.response&&("string"==typeof d.response?(l=d.response,l.indexOf("[{")>=0&&(l=JSON.parse(d.response))):l=JSON.parse(d.response)),d.status>=200&&d.status<=299){let n=!1;d.fileURL&&(n=d.file_url),l&&l.file_url?n=l.file_url:l&&l[0]&&l[0].file_url&&(n=l[0].file_url),i.uploadSettings.onUploadCompleted&&i.uploadSettings.onUploadCompleted({files:t,status:d.status,fileURL:n,serverResponse:l});for(let l=0;l<t.length;l++){let o=i.uploadSettings.url+"/"+t[l].name;n&&Array.isArray(n)?o=n[l]:"string"==typeof n&&(o=n),a.push({value:o,label:t[l].name}),a.length===e.fileUpload.files.length&&(e.cell.editor.instance.setValue(a),i._endCellEdit(e.cell))}}else i.uploadSettings.onUploadError&&i.uploadSettings.onUploadError({files:t,status:d.status,serverResponse:l})},d.onreadystatechange=function(){e.column.editor.responseHandler&&"function"==typeof e.column.editor.responseHandler&&e.column.editor.responseHandler(d)},o&&d.send(l),i.uploadSettings.onChange&&i.uploadSettings.onChange(t)}}_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 u=document.createElement("div"),m=document.createElement("div");s.appendChild(u),s.appendChild(m);let g=n&&n.length?" ("+n.length+")":"";u.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")}${g}</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 p=u.querySelectorAll(".tab");i.storeHistory&&(!i._currentUser||i._currentUser&&!i._currentUser.info?p[p.length-1].classList.add("smart-hidden"):p[p.length-1].classList.remove("smart-hidden")),!i.users||i.users&&0===i.users.length||!i._currentUser||i._currentUser&&!i._currentUser.info?p[p.length-2].classList.add("smart-hidden"):p[p.length-2].classList.remove("smart-hidden"),u.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),a=u.querySelector(".details-tab"),l=u.querySelector(".comments-tab"),n=u.querySelector(".history-tab");a.classList.add("smart-hidden"),l.classList.add("smart-hidden"),n.classList.add("smart-hidden");for(let e=0;e<p.length;e++)p[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 b=i._getColorInput();u.querySelector(".background").appendChild(b),b.onchange=()=>{l.background=b.value},l.background&&(b.value=l.background);const y=i._getColorInput();u.querySelector(".color").appendChild(y),y.onchange=()=>{l.color=y.value},l.color&&(y.value=l.color);const f=i._getColorInput();u.querySelector(".status").appendChild(f),f.onchange=()=>{l.status=f.value},l.status&&(f.value=l.status);const v=document.createElement("smart-input");v.style.width="auto",v.classList.add("underlined"),v.dropDownButtonPosition="right",v.readonly=!0,v.dropDownHeight="auto",v.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],v.onchange=()=>{l.fontFamily=v.value},l.fontFamily?v.value=l.fontFamily:v.selectedIndex=0,u.querySelector(".font-family").appendChild(v);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,u.querySelector(".font-size").appendChild(h);const C=u.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"),u.querySelector(".reset-format").onclick=()=>{for(let e=0;e<C.children.length;e++)C.children[e].classList.remove("checked");v.selectedIndex=0,h.selectedIndex=0,y.value="",b.value="",f.value="",l.fontWeight=null,l.fontStyle=null,l.textDecoration=null,l.fontSize=null,l.fontFamily=null};const S=u.querySelector(".comments-header"),w=u.querySelector('[view="comments"]'),A=u.querySelector(".comments-layout smart-text-area"),D=u.querySelector(".comments-layout smart-button"),_=u.querySelector(".comments-layout .footer"),L=u.querySelector(".comments-layout .comments");D.disabled=!0,L.innerHTML=`<span class="no-comments">${i.localize("noComments")}</span>`;const k=()=>{const e=L.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+")":"";S.innerHTML=w.innerHTML=`${i.localize("comments").replace(":","")} ${o}`}}};for(let e=0;e<n.length;e++){const t=n[e],a=i._createComment(t);x(a),L.appendChild(a)}S.innerHTML=`${i.localize("comments").replace(":","")} ${g}`,k(),A.onfocus=()=>{_.classList.add("focus")},A.onblur=()=>{_.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(),L.appendChild(t);const l=n.length?"("+n.length+")":"";S.innerHTML=w.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 u=document.createElement("label");u.classList.add("smart-field-editor-error-label"),u.setAttribute("label-for",t.dataField),l.appendChild(u),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),u=t.offset(t);let m=d.offsetWidth+c.left-u.left-120;m<0&&(m=c.left-u.left),a.open(m,c.top-u.top-s-0),setTimeout((function(){a.btnConfirm.focus()}),100)}_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")},u={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(u),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(),u=document.createElement("div"),m=document.createElement("smart-input"),g=i._addColumnDialogEditors.allowColorItems;if(void 0!==r)m.setAttribute("data-id",r),m.setAttribute("data-item-value",r);else{const e=n.querySelectorAll(".smart-sortable-item").length;m.setAttribute("data-id",e),m.setAttribute("data-item-value",e)}return void 0!==s&&m.setAttribute("data-item-value",s),c.disabled=!g.querySelector(".smart-input").value,u.className="smart-grid-icon smart-icon-close show",u.setAttribute("role","button"),u.setAttribute("aria-label","button"),m.classList.add("underlined","edit-column-input"),m.style.width="100%",m.style.height="30px",m.required=!0,t&&(m.value=t),l&&(c.value=l),m.onkeyup=m.onchange=m.onblur=t=>{o(),"Enter"===t.key&&(m.parentElement.nextElementSibling||(e.click(),o()))},d.appendChild(c),d.appendChild(m),"users"!==a.bind&&d.appendChild(u),u.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)}});