smart-webcomponents-react 14.0.0 → 14.0.35

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 (244) hide show
  1. package/alertwindow/alertwindow.umd.js +1 -1
  2. package/combobox/combobox.d.ts +5 -0
  3. package/combobox/combobox.esm.js +12 -1
  4. package/combobox/combobox.umd.js +12 -1
  5. package/dialogwindow/dialogwindow.umd.js +1 -1
  6. package/grid/grid.d.ts +74 -38
  7. package/grid/grid.esm.js +60 -26
  8. package/grid/grid.umd.js +60 -26
  9. package/index.d.ts +99 -30
  10. package/kanban/kanban.d.ts +10 -0
  11. package/kanban/kanban.esm.js +23 -1
  12. package/kanban/kanban.umd.js +23 -1
  13. package/multilinewindow/multilinewindow.umd.js +1 -1
  14. package/package.json +1 -1
  15. package/progresswindow/progresswindow.umd.js +1 -1
  16. package/promptwindow/promptwindow.umd.js +1 -1
  17. package/source/modules/smart.accordion.js +1 -1
  18. package/source/modules/smart.array.js +2 -2
  19. package/source/modules/smart.barcode.js +1 -1
  20. package/source/modules/smart.breadcrumb.js +1 -1
  21. package/source/modules/smart.button.js +1 -1
  22. package/source/modules/smart.buttongroup.js +1 -1
  23. package/source/modules/smart.calendar.js +1 -1
  24. package/source/modules/smart.card.js +1 -1
  25. package/source/modules/smart.cardview.js +2 -2
  26. package/source/modules/smart.carousel.js +1 -1
  27. package/source/modules/smart.chart.js +2 -2
  28. package/source/modules/smart.checkbox.js +1 -1
  29. package/source/modules/smart.checkinput.js +1 -1
  30. package/source/modules/smart.chip.js +1 -1
  31. package/source/modules/smart.colorinput.js +1 -1
  32. package/source/modules/smart.colorpanel.js +1 -1
  33. package/source/modules/smart.colorpicker.js +1 -1
  34. package/source/modules/smart.combobox.js +2 -2
  35. package/source/modules/smart.common.js +2 -2
  36. package/source/modules/smart.countryinput.js +1 -1
  37. package/source/modules/smart.dateinput.js +2 -2
  38. package/source/modules/smart.daterangeinput.js +2 -2
  39. package/source/modules/smart.datetimepicker.js +1 -1
  40. package/source/modules/smart.dockinglayout.js +1 -1
  41. package/source/modules/smart.dropdownbutton.js +1 -1
  42. package/source/modules/smart.dropdownlist.js +1 -1
  43. package/source/modules/smart.editor.js +1 -1
  44. package/source/modules/smart.element.js +1 -1
  45. package/source/modules/smart.fileupload.js +1 -1
  46. package/source/modules/smart.form.js +1 -1
  47. package/source/modules/smart.formulaparser.js +1 -1
  48. package/source/modules/smart.ganttchart.js +4 -4
  49. package/source/modules/smart.gauge.js +1 -1
  50. package/source/modules/smart.grid.js +15 -15
  51. package/source/modules/smart.gridpanel.js +3 -3
  52. package/source/modules/smart.input.js +1 -1
  53. package/source/modules/smart.kanban.js +4 -4
  54. package/source/modules/smart.layout.js +1 -1
  55. package/source/modules/smart.led.js +1 -1
  56. package/source/modules/smart.listbox.js +1 -1
  57. package/source/modules/smart.listmenu.js +1 -1
  58. package/source/modules/smart.map.js +1 -1
  59. package/source/modules/smart.maskedtextbox.js +1 -1
  60. package/source/modules/smart.menu.js +1 -1
  61. package/source/modules/smart.multicomboinput.js +1 -1
  62. package/source/modules/smart.multiinput.js +1 -1
  63. package/source/modules/smart.multilinetextbox.js +2 -2
  64. package/source/modules/smart.multisplitbutton.js +1 -1
  65. package/source/modules/smart.numberinput.js +1 -1
  66. package/source/modules/smart.numerictextbox.js +2 -2
  67. package/source/modules/smart.pager.js +1 -1
  68. package/source/modules/smart.passwordinput.js +1 -1
  69. package/source/modules/smart.passwordtextbox.js +1 -1
  70. package/source/modules/smart.path.js +1 -1
  71. package/source/modules/smart.phoneinput.js +1 -1
  72. package/source/modules/smart.pivottable.js +4 -4
  73. package/source/modules/smart.progressbar.js +1 -1
  74. package/source/modules/smart.qrcode.js +1 -1
  75. package/source/modules/smart.querybuilder.js +2 -2
  76. package/source/modules/smart.radiobutton.js +1 -1
  77. package/source/modules/smart.rating.js +1 -1
  78. package/source/modules/smart.router.js +2 -2
  79. package/source/modules/smart.scheduler.js +2 -2
  80. package/source/modules/smart.scrollbar.js +1 -1
  81. package/source/modules/smart.slider.js +1 -1
  82. package/source/modules/smart.sortable.js +1 -1
  83. package/source/modules/smart.splitter.js +1 -1
  84. package/source/modules/smart.switchbutton.js +1 -1
  85. package/source/modules/smart.table.js +3 -3
  86. package/source/modules/smart.tabs.js +1 -1
  87. package/source/modules/smart.tank.js +1 -1
  88. package/source/modules/smart.textarea.js +1 -1
  89. package/source/modules/smart.textbox.js +2 -2
  90. package/source/modules/smart.timeinput.js +1 -1
  91. package/source/modules/smart.timepicker.js +1 -1
  92. package/source/modules/smart.toast.js +1 -1
  93. package/source/modules/smart.tooltip.js +1 -1
  94. package/source/modules/smart.tree.js +2 -2
  95. package/source/modules/smart.validator.js +1 -1
  96. package/source/modules/smart.window.js +2 -2
  97. package/source/smart.accordion.js +1 -1
  98. package/source/smart.ajax.js +1 -1
  99. package/source/smart.array.js +1 -1
  100. package/source/smart.barcode.js +1 -1
  101. package/source/smart.bootstrap.js +1 -1
  102. package/source/smart.breadcrumb.js +1 -1
  103. package/source/smart.button.js +1 -1
  104. package/source/smart.buttongroup.js +1 -1
  105. package/source/smart.calendar.js +1 -1
  106. package/source/smart.card.js +1 -1
  107. package/source/smart.cardview.js +1 -1
  108. package/source/smart.carousel.js +1 -1
  109. package/source/smart.chart.annotations.js +1 -1
  110. package/source/smart.chart.api.js +1 -1
  111. package/source/smart.chart.core.js +1 -1
  112. package/source/smart.chart.js +1 -1
  113. package/source/smart.chart.rangeselector.js +1 -1
  114. package/source/smart.chart.waterfall.js +1 -1
  115. package/source/smart.checkbox.js +1 -1
  116. package/source/smart.checkinput.js +1 -1
  117. package/source/smart.chip.js +1 -1
  118. package/source/smart.colorinput.js +1 -1
  119. package/source/smart.colorpanel.js +1 -1
  120. package/source/smart.colorpicker.js +1 -1
  121. package/source/smart.combobox.js +2 -2
  122. package/source/smart.complex.js +1 -1
  123. package/source/smart.core.js +1 -1
  124. package/source/smart.countryinput.js +1 -1
  125. package/source/smart.data.js +2 -2
  126. package/source/smart.date.js +1 -1
  127. package/source/smart.dateformatpanel.js +1 -1
  128. package/source/smart.dateinput.js +2 -2
  129. package/source/smart.daterangeinput.js +1 -1
  130. package/source/smart.datetimepicker.js +1 -1
  131. package/source/smart.dockinglayout.js +1 -1
  132. package/source/smart.draw.js +1 -1
  133. package/source/smart.dropdownbutton.js +1 -1
  134. package/source/smart.dropdownlist.js +1 -1
  135. package/source/smart.editor.js +1 -1
  136. package/source/smart.element.js +1 -1
  137. package/source/smart.elements.js +18 -18
  138. package/source/smart.export.js +1 -1
  139. package/source/smart.fileupload.js +1 -1
  140. package/source/smart.filter.js +1 -1
  141. package/source/smart.filterbuilder.js +1 -1
  142. package/source/smart.filterpanel.js +1 -1
  143. package/source/smart.form.js +1 -1
  144. package/source/smart.format.js +1 -1
  145. package/source/smart.formulaparser.js +1 -1
  146. package/source/smart.ganttchart.js +2 -2
  147. package/source/smart.gauge.js +1 -1
  148. package/source/smart.grid.cell.js +2 -2
  149. package/source/smart.grid.chart.js +1 -1
  150. package/source/smart.grid.column.js +2 -2
  151. package/source/smart.grid.core.js +2 -2
  152. package/source/smart.grid.dialog.js +2 -2
  153. package/source/smart.grid.edit.js +2 -2
  154. package/source/smart.grid.export.js +1 -1
  155. package/source/smart.grid.filter.js +2 -2
  156. package/source/smart.grid.group.js +1 -1
  157. package/source/smart.grid.js +1 -1
  158. package/source/smart.grid.menu.js +2 -2
  159. package/source/smart.grid.pager.js +1 -1
  160. package/source/smart.grid.reorder.js +1 -1
  161. package/source/smart.grid.resize.js +1 -1
  162. package/source/smart.grid.row.js +2 -2
  163. package/source/smart.grid.select.js +2 -2
  164. package/source/smart.grid.sort.js +1 -1
  165. package/source/smart.grid.toolbar.js +2 -2
  166. package/source/smart.grid.tree.js +1 -1
  167. package/source/smart.grid.view.js +2 -2
  168. package/source/smart.gridpanel.js +1 -1
  169. package/source/smart.input.js +1 -1
  170. package/source/smart.kanban.js +2 -2
  171. package/source/smart.layout.js +1 -1
  172. package/source/smart.led.js +1 -1
  173. package/source/smart.listbox.js +1 -1
  174. package/source/smart.listmenu.js +1 -1
  175. package/source/smart.map.js +1 -1
  176. package/source/smart.maskedtextbox.js +1 -1
  177. package/source/smart.math.js +1 -1
  178. package/source/smart.menu.js +1 -1
  179. package/source/smart.multicomboinput.js +1 -1
  180. package/source/smart.multiinput.js +1 -1
  181. package/source/smart.multilinetextbox.js +1 -1
  182. package/source/smart.multisplitbutton.js +1 -1
  183. package/source/smart.numberformatpanel.js +1 -1
  184. package/source/smart.numberinput.js +1 -1
  185. package/source/smart.numeric.js +1 -1
  186. package/source/smart.numerictextbox.js +1 -1
  187. package/source/smart.pager.js +1 -1
  188. package/source/smart.passwordinput.js +1 -1
  189. package/source/smart.passwordtextbox.js +1 -1
  190. package/source/smart.path.js +1 -1
  191. package/source/smart.phoneinput.js +1 -1
  192. package/source/smart.pivottable.js +1 -1
  193. package/source/smart.powerbutton.js +1 -1
  194. package/source/smart.progressbar.js +1 -1
  195. package/source/smart.qrcode.js +1 -1
  196. package/source/smart.radiobutton.js +1 -1
  197. package/source/smart.rating.js +1 -1
  198. package/source/smart.router.js +1 -1
  199. package/source/smart.scheduler.js +1 -1
  200. package/source/smart.scrollbar.js +1 -1
  201. package/source/smart.slider.js +1 -1
  202. package/source/smart.sortable.js +1 -1
  203. package/source/smart.splitter.js +1 -1
  204. package/source/smart.switchbutton.js +1 -1
  205. package/source/smart.table.js +2 -2
  206. package/source/smart.tabs.js +1 -1
  207. package/source/smart.tank.js +1 -1
  208. package/source/smart.textarea.js +1 -1
  209. package/source/smart.textbox.js +1 -1
  210. package/source/smart.tickintervalhandler.js +1 -1
  211. package/source/smart.timeinput.js +1 -1
  212. package/source/smart.timepicker.js +1 -1
  213. package/source/smart.toast.js +1 -1
  214. package/source/smart.tooltip.js +1 -1
  215. package/source/smart.tree.js +2 -2
  216. package/source/smart.validationpanel.js +1 -1
  217. package/source/smart.validator.js +1 -1
  218. package/source/smart.window.js +1 -1
  219. package/source/styles/components/smart.ganttchart.css +1 -1
  220. package/source/styles/components/smart.kanban.css +1 -1
  221. package/source/styles/components/smart.pivottable.css +1 -1
  222. package/source/styles/components/smart.table.css +1 -1
  223. package/source/styles/default/scss/smart.kanban.scss +20 -3
  224. package/source/styles/default/scss/smart.table.scss +22 -4
  225. package/source/styles/default/scss/textbox/_check-input.scss +1 -0
  226. package/source/styles/default/scss/textbox/_multi-combo-input.scss +1 -1
  227. package/source/styles/default/smart.kanban.css +17 -1
  228. package/source/styles/default/smart.table.css +30 -12
  229. package/source/styles/smart.default.css +2 -2
  230. package/source/typescript/smart.combobox.d.ts +5 -0
  231. package/source/typescript/smart.elements.d.ts +99 -30
  232. package/source/typescript/smart.grid.d.ts +77 -28
  233. package/source/typescript/smart.kanban.d.ts +10 -0
  234. package/source/typescript/smart.scheduler.d.ts +1 -1
  235. package/source/typescript/smart.table.d.ts +1 -1
  236. package/source/typescript/smart.tree.d.ts +5 -0
  237. package/table/table.d.ts +1 -1
  238. package/table/table.esm.js +1 -1
  239. package/table/table.umd.js +1 -1
  240. package/tabswindow/tabswindow.umd.js +1 -1
  241. package/tree/tree.d.ts +5 -0
  242. package/tree/tree.esm.js +12 -1
  243. package/tree/tree.umd.js +12 -1
  244. package/waitwindow/waitwindow.umd.js +1 -1
@@ -1322,7 +1322,7 @@ Smart("smart-country-input",class extends Smart.Input{static get properties(){re
1322
1322
  /***/ 6057:
1323
1323
  /***/ (() => {
1324
1324
 
1325
- (()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};"string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0?(t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0?(t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0?(t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0?(t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType)?(t._bindToICS(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType)?(t._bindToXML(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType)?(t._bindToCSV(),a()):"array"===t.dataSourceType?(t._bindToArray(),a()):"json"===t.dataSourceType&&(t._bindToJSON(),a())}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={},l=i[t].split(a);for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{switch(t.condition){case"EQUAL":return e+" = "+t.value;case"NOT_EQUAL":return e+" != "+t.value;case"GREATER_THAN":return e+" > "+t.value;case"GREATER_THAN_OR_EQUAL":return e+" >= "+t.value;case"LESS_THAN":return e+" < "+t.value;case"LESS_THAN_OR_EQUAL":return e+" <= "+t.value;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+t.value+" and "+e+" <= "+t.valueTo+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1===o.logicalOperators[t]&&(s=" OR ")}r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e)}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n]+"'");d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),e.push("'"+t.edit.row[n]+"'"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id])),t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=Object.assign({},e.boundSource[n]);if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let f=new Array;for(let t=0;t<e.length;t++)f[t]=u();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const h=new Array,p=new Array;let g=0;const S=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};let y=!1;for(let n=0;n<d.length;n++){let m=Object.assign({},S(d[n]));m[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=m[a];null!=n?((""===n||void 0===n&&0===t)&&(y=!0),T[b++]={value:n,group:a,hash:f[t]}):(T[b++]={value:null,group:a,hash:f[t]},0===t&&(y=!0))}if(T.length!==e.length)break;let v=null,E="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(E=E+"_"+T[e].hash+"_"+n,void 0===p[E]||null===p[E]){if(null===v){v={$:{}},v[c.level]=0,v[c.leaf]=!1,v[o]=null,v[a]=n,v[r]=m,v.groupDataField=d,v[d]||(v[d]=v.data[d]),void 0!==m[c.expanded]?v[c.expanded]=m[c.expanded]:(v[c.expanded]=!1,s.expandHierarchy&&(v[c.expanded]=!0)),i&&(v[i]=m[i]),v[t]=new Array;let e=h.length+l;this.id&&"number"!=typeof m.$.id&&!isFinite(m.$.id)||(e="Item"+e),void 0===v.$.id&&(v.$.id=e),s._expandedRowIds[v.$.id]&&(v[c.expanded]=!0),h[g++]=v}else{const e={$:{}};e[c.level]=v[c.level]+1,e[o]=v,e[a]=n,e[t]=new Array,e[r]=m,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==m[c.expanded]?e[c.expanded]=m[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=m[i]),void 0===e.$.id&&(e.$.id=v.$.id+"_"+v[t].length),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),v[t][v[t].length]=e,v=e}p[E]=v}else v=p[E]}m&&(m[c.leaf]=!0),null!==v?(null===this.id?void 0===m.$.id&&(m.$.id=v.$.id+"_"+v[t].length):void 0===m.$.id&&-1===m.$.id.toString().indexOf(v.$.id)&&(m.$.id=v.$.id+"_"+m.$.id),m[o]=v,m[c.level]=v[c.level]+1,v[t][v[t].length]=m):void 0===m.$.id&&(m.$.id=u())}if(y){let e=null,t=!1;for(let a=0;a<h.length;a++){const n=h[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),h.splice(a,1);break}}if(e&&(h.push(e),t))for(let e=0;e<h.length;e++){h[e].$.id="Item"+e}}return h}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType)if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0);else"any"!==r.dataType&&(o=a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];""!==t&&" "!==t&&i.push(t.trim())}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n="and",i=0;for(let o=0;o<r.length;o++){let d=r[o];if("and"!==d&&"or"!==d){if(i++,2===i){let l=a[r[o-1]];l||(l=r[o-1]),"number"===e&&(d=parseFloat(d)),"date"===e&&(d=new Date(d));const s=t.createFilter(e,d,l);i=0,n&&t.addFilter(n,s)}}else n=d}o.push(t)}else{const e=r[0];if("and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy)throw new Error("sort: Missing or Invalid arguments!");"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let o=e[0][t[r]];if(void 0===o&&e[0]&&e[0].children&&e[0].data&&(o=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}s[r]=c(o,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
1325
+ (()=>{Smart.DataAdapter=window.smartDataAdapter=class{constructor(e){e||(e={});const t=Object.assign(this,e);t.key=(65536*(1+Math.random())|0).toString(16).substring(1),t.$document=Smart.Utilities.Extend(document),t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],void 0===t.allowAdd&&(t.allowAdd=!0),void 0===t.allowRemove&&(t.allowRemove=!0),void 0===t.allowUpdate&&(t.allowUpdate=!0),void 0===t.mapChar&&(t.mapChar="."),void 0!==e.observable||t.virtualDataSource?t.observable=!1:t.observable=!0,void 0===t.sanitizeHTML&&(t.sanitizeHTML="blackList"),t._expandedRowIds=[],e.dataSource||(t.dataSource=[]),e.dataFields||(t.dataFields=[]),e.dataSourceType||(t.dataSourceType="array"),e.id||(t.id=null),e.autoFetch||(t.autoFetch=!0),e.dataFields&&(t.dataFields=e.dataFields),Object.defineProperty(t,"groupBy",{configurable:!1,enumerable:!0,get:()=>t._groupBy?t._groupBy:[],set(e){const a=()=>{t.boundHierarchy=null,t.refreshHierarchy(),t.onGroup&&t.onGroup()};t._groupBy=new Smart.ObservableArray(e),t._groupBy.notify((function(){a()})),t.isInitialized&&a()}}),e.groupBy?e.groupBy.toArray?t.groupBy=e.groupBy.toArray():t.groupBy=e.groupBy:t.groupBy=[],e&&!1!==e.autoBind&&t.dataBind(),t.isInitialized=!0}beginUpdate(){this.isUpdating=!0}endUpdate(){const e=this;e.isUpdating=!1,e.refreshIndexes(),e.refreshHierarchy()}get expandHierarchy(){return void 0===this._expandHierarchy&&(this._expandHierarchy=!1),this._expandHierarchy}set expandHierarchy(e){const t=this;t._expandHierarchy=e,t.isInitialized&&t.refreshHierarchy()}_getDataField(e){switch(e.name){case"leaf":case"parent":case"expanded":case"checked":case"selected":case"level":case"icon":case"data":case"group":case"children":case"items":e.map?e.map=e.map.replace(e.name,"$"+e.name):e.map=e.name,e.name="$"+e.name}}get dataFields(){return this._dataFields}set dataFields(e){const t=this;return t._dataFields=t._getDataFieldObjects(e),t._dataFields}_getDataFieldObjects(e){const t=this;let a=[];if("number"==typeof e){const t="A".charCodeAt(0);let n="",r=0;for(let i=0;i<e;i++){const e=String.fromCharCode(t+r);r++;const i=n+e;a.push({name:i,dataType:"string"}),r>=26&&(r=0,n+="A")}}else if(Array.isArray(e)&&e.length>0)for(let n=0;n<e.length;n++){const r=e[n];if("string"==typeof r){const e=r.split(":"),t=e[0].trim(),n=e.length>1?e[1].trim():"string";a.push({name:t,dataType:n})}else a.push(r);t._getDataField(a[a.length-1])}return a}get dataSource(){const e=this;return e._dataSource||(e._dataSource=[]),e._dataSource}set dataSource(e){const t=this;t._dataSource=e,t.isInitialized&&(t.boundSource=!1===t.observable||t.virtualDataSource?[]:new Smart.ObservableArray,t.dataItemById=[],t.bindingCompleted=!1,t.dataBind(),t.refreshIndexes())}get canNotify(){const e=this;return void 0===e._canNotify&&(e._canNotify=!0),e._canNotify}set canNotify(e){this._canNotify=e}_notify(e){const t=this;t.canNotify&&t.notifyFn&&t.notifyFn(e)}notify(e){e&&(this.notifyFn=e)}toArray(){const e=this;return!1===e.observable?e.boundSource:e.boundSource.toArray()}dataBind(){const t=this;t.bindingCompleted=!1,t.clear();const a=()=>{t.observable&&(t.boundSource.notify||(t.boundSource=new Smart.ObservableArray),t.boundSource.notify((function(e){if("update"===e.action&&e.path&&e.path.indexOf(".")>=0&&-1===e.path.indexOf("children")&&-1===e.path.indexOf("loaded")&&-1===e.path.indexOf("level")&&-1===e.path.indexOf("leaf")&&-1===e.path.indexOf("expanded")){let a=!1;for(let n=0;n<t.dataFields.length;n++){const r=t.dataFields[n].name;e.path.indexOf(r)>=0&&(a=!0)}t._notify&&a&&t._notify({action:"update",data:e.target,index:e.index})}}))),t._onBindingComplete()};"string"==typeof t.dataSource&&(t.dataSource.indexOf(".json")>=0||"json"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="json",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xml")>=0?(t.url=t.dataSource,t.dataSourceType="xml",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".xlsx")>=0?(t.url=t.dataSource,t.dataSourceType="xlsx",new e(t,(e=>{if(!e[0])return e=[],t._bindToArray(),void a();const n=Object.keys(e[0]),r={},i=[];if(!1!==t.exportHeader){let a=0;for(let e in n){r[n[e]]=t.dataFields[a++].name}for(let t=1;t<e.length;t++){const a=e[t],o={};for(let e in n){const t=n[e];o[r[t]]=a[t]}i.push(o)}t.dataSource=i}t._bindToArray(),a()}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".csv")>=0?(t.url=t.dataSource,t.dataSourceType="csv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&t.dataSource.indexOf(".tsv")>=0?(t.url=t.dataSource,t.dataSourceType="tsv",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf(".ics")>=0||t.dataSource.indexOf(".php")>=0&&"ics"===t.dataSourceType||t.dataSource.indexOf(".txt")>=0&&"ics"===t.dataSourceType)?(t.url=t.dataSource,t.dataSourceType="ics",new e(t,(e=>{t.dataSource=e}))):"string"==typeof t.dataSource&&(t.dataSource.indexOf("BEGIN:VCALENDAR")>=0||"ics"===t.dataSourceType)?(t._bindToICS(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf("<?xml")>=0||"xml"===t.dataSourceType)?(t._bindToXML(),a()):"string"==typeof t.dataSource&&(t.dataSource.indexOf(" ")>=0||t.dataSource.indexOf(",")>=0||"tsv"===t.dataSourceType||"csv"===t.dataSourceType||"tab"===t.dataSourceType)?(t._bindToCSV(),a()):"array"===t.dataSourceType?(t._bindToArray(),a()):"json"===t.dataSourceType&&(t._bindToJSON(),a())}_bindToXML(){const e=this;let t=null,a=null;window.DOMParser&&(t=new DOMParser,a=t.parseFromString(e.dataSource,"text/xml")),void 0===e.root&&(e.root=""),void 0===e.record&&(e.record="");const n=a.querySelectorAll(e.root+" "+e.record),r=n.length,i=[];let o=e.dataFields?e.dataFields.length:0;if(0===o){const t=n[0],a=new Array;for(let e in t){const t=e;a[a.length]={name:t}}e.dataFields=a,o=a.length}for(let t=0;t<r;t++){const a=n[t],r={};if(void 0===a)break;if(e.id){const t=a.querySelector(e.id);r[e.id]=t.textContent}for(let t=0;t<o;t++){const n=e.dataFields[t],i=a.querySelector(n.map||n.name);r[n.name]=i.textContent}i[t]=r}e.canNotify=!1,e.dataSource=i,e.canNotify=!0,e._bindToArray()}static BindToCSV(e,t=!1){const a=""+e,n=-1===a.indexOf(",")?"\t":",",r=a.split("\r"),i=new Array,o=[];let d=a.split("\n"),l=d.length;1===l&&r.length>1&&(d=r,l=d.length);const s=!0===t;for(let e=0;e<l;e++){const t={},a=d[e].split(n);for(let n=0;n<a.length;n++){let r=o[n],i=a[n];if(r||(o.push({name:i.trim()}),r=o[o.length-1]),i=i.trim(),1!==e||s)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}t[r.name]=i}(s||e>0)&&i.push(t)}return i}_bindToCSV(){const e=this,t=""+e.dataSource,a=-1===t.indexOf(",")?"\t":",",n=t.split("\r"),r=new Array;let i=t.split("\n"),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=e.dataFields.length>0;for(let t=0;t<o;t++){const n=i[t],o={},l=i[t].split(a);for(let a=0;a<l.length;a++){let r=e.dataFields[a],i=l[a];if(r||(e.dataFields.push({name:i.trim()}),r=e.dataFields[e.dataFields.length-1]),r.map&&(i=n[r.map]),i=i.trim(),1!==t||d)switch(r.dataType){case"boolean":i="false"!==i;break;case"number":i=parseFloat(i);break;case"date":i=new Date(i)}else{let e="string";"false"===i||"true"===i?(e="boolean",i="false"!==i):isNaN(parseInt(i)&&-1===i.indexOf("/"))?(i.indexOf("-")>=0||i.indexOf("/")>=0||i.indexOf(":")>=0)&&"Invalid Date"!==new Date(i).toString()&&(e="date",i=new Date(i)):(e="number",i=parseFloat(i)),r.dataType||(r.dataType=e)}o[r.map||r.name||a.toString()]=i}(d||t>0)&&r.push(o)}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_onBindingComplete(){const e=this;e._buildHierarchy(),e.onBindingComplete&&e.onBindingComplete({data:e.boundSource}),e._notify&&e._notify({action:"bindingComplete",data:e.boundSource}),e.bindingCompleted=!0}refreshHierarchy(){this.isUpdating||this._buildHierarchy()}find(){return this.boundSource.find.apply(this.boundSource,arguments)}onVirtualDataSourceRequested(e,t){const a=this;let n=t?t.first:1/0,r=t?t.last:1/0,i=t?t.row:null;if(void 0===n&&(n=1/0),void 0===r&&(r=1/0),a.virtualFirstIndex=n,a.virtualLastIndex=r,a.virtualDataSource){const o=function(r){void 0!==r.virtualDataSourceLength&&(a.virtualDataSourceLength=r.virtualDataSourceLength),new Smart.DataAdapter({dataSource:r.dataSource,dataFields:r.dataFields||a.dataFields,data:t,keyDataField:r.keyDataField,parentDataField:r.parentDataField,observable:!1,id:r.id||a.id,onBindingComplete(r){if(void 0===t.result&&(t.result=!0),a.virtualDataSourceOnExpand&&i)return a.groupBy.length>0?r.data&&r.data.length>0&&a.add(r.data):r.data&&r.data.length>0?a.add(r.data,i.$.id):i.leaf=!0,a.onFilter&&a.onFilter(),void e(t);n===1/0&&"scroll"===t.action?r.data&&r.data.length&&a.add(r.data):"filter"===t.action||"group"===t.action?(a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0):("add"===t.action||"update"===t.action||t.action,a.canNotify=!1,a.dataSource=r.data,a.canNotify=!0),a.onFilter&&a.onFilter(),e(t)}})};let d={};if(t.sorting&&t.sorting.length>0){let e=[];for(let a in t.sorting)e.push(a+" "+t.sorting[a].sortOrder.toUpperCase());const a=" ORDER BY "+e.join(", ");d.orderBy=a}else d.orderBy="";if(void 0===n||void 0===r||0===n&&0===r)d.limit="";else{const e=r-n,t=" LIMIT "+e+" OFFSET "+n;d.limit=t,isNaN(e)&&(d.limit="")}if(t.grouping&&t.grouping.length>0){const e=" GROUP BY "+t.grouping[0];d.groupBy=e}else d.groupBy="";if(t.filtering&&t.filtering.length>0){const e=(e,t)=>{switch(t.condition){case"EMPTY":return e+" = ''";case"NOT_EMPTY":return e+" != ''";case"EQUAL":return e+" = '"+t.value+"'";case"NOT_EQUAL":return e+" != '"+t.value+"'";case"CONTAINS_CASE_SENSITIVE":case"CONTAINS":return e+" LIKE '%"+t.value+"%'";case"DOES_NOT_CONTAIN_CASE_SENSITIVE":case"DOES_NOT_CONTAIN":return e+" NOT LIKE '%"+t.value+"%'";case"STARTS_WITH_CASE_SENSITIVE":case"STARTS_WITH":return e+" LIKE '"+t.value+"%'";case"ENDS_WITH_CASE_SENSITIVE":case"ENDS_WITH":return e+" LIKE '%"+t.value+"'";case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL"}},a=(e,t)=>{switch(t.condition){case"EQUAL":return e+" = "+t.value;case"NOT_EQUAL":return e+" != "+t.value;case"GREATER_THAN":return e+" > "+t.value;case"GREATER_THAN_OR_EQUAL":return e+" >= "+t.value;case"LESS_THAN":return e+" < "+t.value;case"LESS_THAN_OR_EQUAL":return e+" <= "+t.value;case"NULL":return e+" IS NULL";case"NOT_NULL":return e+" IS NOT NULL";case"RANGE":return"("+e+" >= "+t.value+" and "+e+" <= "+t.valueTo+")"}},n=(e,t,a)=>{if(a.operator){var n=e(t,a.condition1),r=e(t,a.condition2);return"("+n+" "+a.operator+" "+r+")"}return e(t,a)};let r=[];for(let i in t.filtering){const o=t.filtering[i];let d=o.filters,l=[],s=" AND ";for(let t=0;t<d.length;t++){const r=d[t];switch(r.type){case"stringFilter":l.push(n(e,i,r));break;case"numericFilter":case"dateFilter":case"booleanFilter":l.push(n(a,i,r))}1===o.logicalOperators[t]&&(s=" OR ")}r.push("("+l.join(s)+")")}if(r.length>0){let e=" AND ";t.filterOperator&&"or"===t.filterOperator.toLowerCase()&&(e=" OR "),d.where=" WHERE "+r.join(e)}else d.where=""}else d.where="";if("dataBind"===t.action&&a.virtualDataSourceOnExpand&&a.keyDataField&&a.parentDataField&&(d.where?d.where+=" AND "+a.parentDataField+" IS NULL":d.where=" WHERE "+a.parentDataField+" IS NULL"),"update"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+"='"+t.edit.row[n]+"'");d.update=" SET "+e.join(", ")+" WHERE "+a.id+"="+t.edit.row[a.id]}if("remove"===t.action){const e=[];for(let n in t.edit.row)"$"!==n&&n!==a.id&&e.push(n+" = '"+t.edit.row[n]+"'");d.remove=" WHERE "+a.id+"="+t.edit.row[a.id]}if("add"===t.action){const e=[],a=[];for(let n in t.edit.row)"$"!==n&&(a.push(n),e.push("'"+t.edit.row[n]+"'"));d.add=" ("+a.join(", ")+") VALUES ("+e.join(", ")+")"}"expand"===t.action?(a.groupDataField?d.where?d.where+=" AND "+a.groupDataField+" = '"+i[a.groupDataField]+"'":d.where=" WHERE "+a.groupDataField+" = '"+i[a.groupDataField]+"'":a.keyDataField&&a.parentDataField?d.where?d.where+=" AND "+a.parentDataField+" = "+i[a.keyDataField]:d.where=" WHERE "+a.parentDataField+" = "+i[a.keyDataField]:d.where?d.where+=" AND "+i.groupDataField+" = '"+i.label+"'":d.where=" WHERE "+i.groupDataField+" = '"+i.label+"'",d.limit="",d.groupBy="",a.virtualDataSourceOnExpand(o,{first:n,last:r,row:t.row,sorting:t.sorting,filtering:t.filtering,grouping:t.grouping,action:t.action,query:d})):a.virtualDataSource(o,{first:n,last:r,sorting:t.sorting,filtering:t.filtering,filterOperator:t.filterOperator||"and",grouping:t.grouping,action:t.action,query:d})}else e()}add(e,t){const a=this;if(!e)return;let n=!0;const r=function(e){const r=a._getDataItem(e,a.boundSource.length);if(a.dataItemById[r.$.id])return void 0!==t&&(r.$.parentId=t),null;a[a.boundSource.length]=r,a.dataItemById[r.$.id]=r;const i=a.boundSource.push(r);return void 0!==t&&(r.$.parentId=t),i||(n=!1),r};if(e.length){let t=[];for(let a=0;a<e.length;a++){const n=r(e[a]);n&&t.push(n)}a._notify({action:"add",data:t})}else{const t=r(e);a._notify({action:"add",data:t})}return a.refreshHierarchy(),n}refreshIndexes(){const e=this;for(let t=0;t<e.boundSource.length;t++)e[t]=e.boundSource[t],e[t].$.index=t,e.dataItemById[e[t].$.id]=e[t];let t=e.boundSource.length;for(;e[t];)delete e[t],t++}removeLast(){const e=this;delete e[e.boundSource.length-1];const t=e.boundSource.pop();return delete e.dataItemById[t.$.id],e._notify({action:"removeLast",data:t}),e.refreshHierarchy(),t}remove(e){const t=this;let a=t.indexOf(e);-1===a&&e&&e.$&&(a=t.indexOf(t.dataItemById[e.$.id]));t.boundSource[a]&&t.removeAt(a)}removeAt(e){const t=this,a=t.boundSource[e];if(!a)throw new Error("Invalid Item Index");t.boundSource.splice(e,1),delete t.dataItemById[a.$.id],t.refreshIndexes(),t._notify({action:"remove",index:e,data:a}),t.refreshHierarchy()}update(e,t){const a=this;if(Smart.Utilities.Types.isArray(e)&&Smart.Utilities.Types.isArray(t)&&0===e.length&&0===t.length)return void a.refreshHierarchy();if(t.length&&e.length){let n=[];for(let r=0;r<e.length;r++){const i=a._getDataItem(t[r],e[r]),o=e[r];n.push(i),a.boundSource[o]=i,a[o]=a.boundSource[o],a.dataItemById[i.$.id]=a[o]}return a._notify({action:"update",index:e,data:n}),void a.refreshHierarchy()}const n=a._getDataItem(t,e),r=a.boundSource[e].$.id;return n.$.id=r,a.boundSource[e]=n,a[e]=a.boundSource[e],a.dataItemById[n.$.id]=a[e],a._notify({action:"update",index:e,data:n}),a.refreshHierarchy(),n}insert(e,t){const a=this;if(t.length){const n=[];for(let r=0;r<t.length;r++){const i=a._getDataItem(t[r],e+r);n.push(i)}t=n}else t=a._getDataItem(t,e);const n=a.boundSource.splice(e,0,t);return a.refreshIndexes(),a._notify({action:"insert",index:e,data:t}),a.refreshHierarchy(),n}move(e,t){if(t>e&&t-e==1||e===t)return;const a=this,n=a.boundSource.splice(e,1)[0];t>e?(t--,a.boundSource.splice(t,0,n)):a.boundSource.splice(t,0,n),a.refreshIndexes(),a._notify({action:"move",index:t,data:a.boundSource[t]}),a.refreshHierarchy()}indexOf(e){return this.boundSource.indexOf(e)}get length(){const e=this;return void 0!==e.virtualDataSourceLength?e.virtualDataSourceLength:e.dataSourceLength?e.dataSourceLength:"number"==typeof e.dataSource?e.dataSource:e.bindingCompleted?e.boundSource.length:e.dataSource&&"string"!=typeof e.dataSource&&e.dataSource.length?e.dataSource.length:e.boundSource.length}clear(){const e=this;if(!e.isInitialized)return e._cachedValues=[],void(e.dataItemById=[]);for(let t=0;t<e.boundSource.length;t++)delete e[t];e._expandedRowIds=[],e._cachedValues=[],e.boundSource=e.observable?new Smart.ObservableArray:[],e.dataItemById=[],e.refreshHierarchy()}_getId(e,t,a){if(null===e||void 0===e.name||!e.name||!t.getAttribute){if(e&&e.toString().length>0&&t.getAttribute){let a=t.getAttribute(e);if(null!==a&&a.toString().length>0)return a.trim().split(" ").join("").replace(/([ #;?%&,.+*~\':'!^$[\]()=>|\/@])/g,"");{let a=e.split(this.mapChar);if(a.length>1){let e=t;for(let t=0;t<a.length;t++)void 0!==e&&(e=e[a[t]]);if(void 0!==e)return e}else if(void 0!==t[e])return t[e]}}return a}{let n=t.getAttribute(e.name);if(null!==n&&n.toString().length>0)return n;if(e.map)try{let a=t.getAttribute(e.map);if(null!==a&&a.toString().length>0)return a}catch(e){return a}}}_buildHierarchy(){const e=this;if(e.reservedNames){const t=e.reservedNames;t.leaf||(t.leaf="leaf"),t.parent||(t.parent="parent"),t.expanded||(t.expanded="expanded"),t.checked||(t.checked="checked"),t.selected||(t.selected="selected"),t.level||(t.level="level"),t.data||(t.data="data")}else e.reservedNames={leaf:"leaf",parent:"parent",expanded:"expanded",checked:"checked",selected:"selected",level:"level",icon:"icon",data:"data"};const t=e.reservedNames;if(e.childrenDataField){const a=[];for(let n=0;n<e.boundSource.length;n++){const r=Object.assign({},e.boundSource[n]);if(!r)continue;a.push(r);const i=function(a){const n=e.childrenDataField.split(e.mapChar);let r=null;if(n.length>1){let e=a;for(let t=0;t<n.length;t++)void 0!==e&&(e=e[n[t]]);r=e}else r=a.children;a.children=r,(null===a.children||void 0===a.children||a.children&&0===a.children.length)&&(a[t.leaf]=!0)};i(r),r[t.level]=0,r.$||(r.$={}),r[t.parent]=null,r[t.data]=r,void 0===r[t.expanded]&&(r[t.expanded]=!1,e.expandHierarchy&&(r[t.expanded]=!0));const o=function(a,n){if(n)for(let r=0;r<n.length;r++){let d=e._getDataItem(n[r],r);if(d){if(i(d),!e.id){const e=function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()};d.$.id=e()}d[t.level]=a[t.level]+1,d[t.parent]=a,d[t.data]=Object.assign({},d),a&&(a.children[r]=d),void 0===d[t.expanded]&&(d[t.expanded]=!1,e.expandHierarchy&&(d[t.expanded]=!0)),o(d,d.children)}}else a.children=new Array};o(r,r.children)}if(e.boundHierarchy=a,!e._boundSourceUpdate){for(let t=0;t<e.boundHierarchy.length;t++){const a=e.boundHierarchy[t];if(a.children){const t=function(a){if(e.dataItemById[a.$.id]||(e.boundSource.canNotify=!1,e.dataItemById[a.$.id]=a,e.boundSource.canNotify=!0),a.children)for(let e=0;e<a.children.length;e++){const n=a.children[e];n.children&&t(n)}};t(a)}}e._boundSourceUpdate=!0}}if(e.xmlRoot&&"xml"===e.dataSourceType&&(e.boundHierarchy=this._getHierarchy("uid","_parentuid","children",null,e.boundSource)),e.keyDataField&&e.parentDataField)return["keyDataField","parentDataField"].forEach((t=>{switch(e[t]){case"parent":e[t]="$"+e[t]}})),void(e.boundHierarchy=this._getHierarchy(e.keyDataField,e.parentDataField,"children",null,e.boundSource));e.groupBy&&e.groupBy.length>0?e.boundHierarchy=this._getGroupHierarchy(e.groupBy,"children","label",null,"data",null,"parent",e.boundSource):e.virtualDataSourceOnExpand&&(e.boundHierarchy=this._getHierarchy("id","parentId","children",null,e.boundSource))}_getGroupHierarchy(e,t,a,n,r,i,o,d,l){let s=this;l||(l=0);let c=s.reservedNames;const u=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()};let f=new Array;for(let t=0;t<e.length;t++)f[t]=u();t||(t="children"),a||(a="group"),r||(r="item"),o||(o="parent"),void 0===i&&(i="value");const h=new Array,p=new Array;let g=0;const S=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};let y=!1;for(let n=0;n<d.length;n++){let m=Object.assign({},S(d[n]));m[c.leaf]=!1;let T=new Array,b=0;for(let t=0;t<e.length;t++){const a=e[t],n=m[a];null!=n?((""===n||void 0===n&&0===t)&&(y=!0),T[b++]={value:n,group:a,hash:f[t]}):(T[b++]={value:null,group:a,hash:f[t]},0===t&&(y=!0))}if(T.length!==e.length)break;let v=null,E="";for(let e=0;e<T.length;e++){const n=T[e].value,d=T[e].group;if(E=E+"_"+T[e].hash+"_"+n,void 0===p[E]||null===p[E]){if(null===v){v={$:{}},v[c.level]=0,v[c.leaf]=!1,v[o]=null,v[a]=n,v[r]=m,v.groupDataField=d,v[d]||(v[d]=v.data[d]),void 0!==m[c.expanded]?v[c.expanded]=m[c.expanded]:(v[c.expanded]=!1,s.expandHierarchy&&(v[c.expanded]=!0)),i&&(v[i]=m[i]),v[t]=new Array;let e=h.length+l;this.id&&"number"!=typeof m.$.id&&!isFinite(m.$.id)||(e="Item"+e),void 0===v.$.id&&(v.$.id=e),s._expandedRowIds[v.$.id]&&(v[c.expanded]=!0),h[g++]=v}else{const e={$:{}};e[c.level]=v[c.level]+1,e[o]=v,e[a]=n,e[t]=new Array,e[r]=m,e.groupDataField=d,e[c.leaf]=!1,e[d]||(e[d]=e.data[d]),void 0!==m[c.expanded]?e[c.expanded]=m[c.expanded]:(e[c.expanded]=!1,s.expandHierarchy&&(e[c.expanded]=!0)),i&&(e[i]=m[i]),void 0===e.$.id&&(e.$.id=v.$.id+"_"+v[t].length),s._expandedRowIds[e.$.id]&&(e[c.expanded]=!0),v[t][v[t].length]=e,v=e}p[E]=v}else v=p[E]}m&&(m[c.leaf]=!0),null!==v?(null===this.id?void 0===m.$.id&&(m.$.id=v.$.id+"_"+v[t].length):void 0===m.$.id&&-1===m.$.id.toString().indexOf(v.$.id)&&(m.$.id=v.$.id+"_"+m.$.id),m[o]=v,m[c.level]=v[c.level]+1,v[t][v[t].length]=m):void 0===m.$.id&&(m.$.id=u())}if(y){let e=null,t=!1;for(let a=0;a<h.length;a++){const n=h[a];if(!n[n.groupDataField]){e=n,e.$.id.toString().startsWith("Item")&&(t=!0),h.splice(a,1);break}}if(e&&(h.push(e),t))for(let e=0;e<h.length;e++){h[e].$.id="Item"+e}}return h}_getHierarchy(e,t,a,n,r){const i=this,o=new Array;let d=this.boundSource;if(r&&(d=r),0===this.boundSource.length)return null;const l=null!==a?a:"children";let s=new Array,c=d,u=c.length,f=i.reservedNames;const h=function(e){let t=e;if(n)for(let e in n){const a=n[e];a.name&&a.map&&(t[a.map]=t[a.name])}return t};for(let a=0;a<u;a++){let n=c[a],r=n[t],o=n[e];"parentId"===t&&(r=n.$.parentId),"id"===e&&(o=n.$.id),n[l]=new Array,i.expandHierarchy&&void 0===n[f.expanded]&&(n[f.expanded]=i.expandHierarchy),s[o]={parentId:r,item:n}}for(let a=0;a<u;a++){const n=c[a];let r=n[t],i=n[e];if("parentId"===t&&(r=n.$.parentId),"id"===e&&(i=n.$.id),void 0!==s[r]){let e={parentId:r,item:s[i].item},t=s[r].item;t[l]||(t[l]=new Array);let a=t[l].length;e=e.item,f?e[f.parent]=t:e.parent=t;const n=h(e);t[l][a]=n,s[r].item=t,s[i].item=e}else{let e=s[i].item;f?void 0===e[f.parent]&&(e[f.parent]=null):void 0===e.parent&&(e.parent=null);const t=h(e);f?t[f.level]=0:t.level=0,o[o.length]=t}}if(0!==o.length){let e=function(t,a){for(let n=0;n<a.length;n++){const r=a[n];f?r[f.level]=t:r.level=t;const o=r[l];o&&o.length>0?(r.leaf=!1,e(t+1,o)):i.virtualDataSourceOnExpand?void 0===r.leaf&&(r.leaf=!1):f?r[f.leaf]=!0:r.leaf=!0}};e(0,o)}return o}summarize(e,t){const a=this;Array.isArray(e)||(e=[e]);let n=[];for(let t=0;t<e.length;t++){const a=e[t];for(let e in a){const t=a[e];n.push({dataField:e,functions:t})}}e=n;let r={},i=new Array;t||(t=a.boundSource);let o=t.length,d=0;if(0!==o&&void 0!==o){for(let a=0;a<o;a++){let n=t[a];if((!n||!n.$||!1!==n.$.filtered)&&n){d++;for(let t=0;t<e.length;t++){const o=e[t];let d=n[o.dataField];if(o.functions&&o.functions.length>0){r[o.dataField]=r[o.dataField]||{},i[o.dataField]=i[o.dataField]||0,i[o.dataField]++;const e=function(e){for(let t in e){let a=r[o.dataField][t];null==a&&(r[o.dataField][t]=0,a=0),"function"==typeof e[t]&&(a=e[t](a,d,o.dataField,n)),r[o.dataField][t]=a}},t=d;let l=parseFloat(d);l=!isNaN(l),t&&t.toDate&&(l=!1),"string"==typeof d&&d.startsWith("+")&&(l=!1),l&&(d=parseFloat(d)),"number"==typeof d&&isFinite(d)?o.functions.forEach((function(t){let n=r[o.dataField][t];if(null==n&&(n=0,"min"===t&&(n=9999999999999),"max"===t&&(n=-9999999999999),"median"===t&&(n=[])),"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t)n+=parseFloat(d);else if("product"===t)0===a?n=parseFloat(d):n*=parseFloat(d);else if("min"===t)n=Math.min(n,parseFloat(d));else if("max"===t)n=Math.max(n,parseFloat(d));else if("count"===t)n++;else if("median"===t)n.push(parseFloat(d));else if("blank"===t)n=r[o.dataField][t],null==n&&(n=0),d||n++;else if("filled"===t)n=r[o.dataField][t],null==n&&(n=0),void 0!==d&&n++;else if("unique"===t)n=r[o.dataField][t],null==n&&(n=[]),-1===n.indexOf(d)&&n.push(d);else if("object"==typeof t)return void e(t);r[o.dataField][t]=n})):o.functions.forEach((function(t){if("min"===t||"max"===t||"count"===t||"product"===t||"sum"===t||"avg"===t||"stdev"===t||"stdevp"===t||"var"===t||"varp"===t){if(null===d&&"count"!==t)return!0;let e=r[o.dataField][t];return null==e&&(e=0),r[o.dataField][t]=e,!0}if("blank"===t){let e=r[o.dataField][t];null==e&&(e=0),d||e++,r[o.dataField][t]=e}else if("filled"===t){let e=r[o.dataField][t];null==e&&(e=0),d&&e++,r[o.dataField][t]=e}else if("unique"===t){let e=r[o.dataField][t];null==e&&(e=[]),-1===e.indexOf(d)&&e.push(d),r[o.dataField][t]=e}"object"==typeof t&&e(t)}))}}}}for(let a=0;a<e.length;a++){const n=e[a];if(n.functions&&(!n.functions||0!==n.functions.length)){if(r[n.dataField]||(r[n.dataField]={},n.functions.forEach((function(e){r[n.dataField][e]=0}))),void 0!==r[n.dataField].avg){const e=r[n.dataField].avg,t=i[n.dataField];r[n.dataField].avg=0===t||void 0===t?0:e/t}else void 0!==r[n.dataField].count&&(r[n.dataField].count=d);if(void 0!==r[n.dataField].unique){const e=r[n.dataField].unique;r[n.dataField].unique=e.length}if(void 0!==r[n.dataField].median){let e=r[n.dataField].median;e.sort((function(e,t){return e-t})),r[n.dataField].median=.5*(e[Math.floor((e.length+1)/2)-1]+e[Math.ceil((e.length+1)/2)-1])}(r[n.dataField].stdev||r[n.dataField].stdevp||r[n.dataField].var||r[n.dataField].varp)&&n.functions.forEach((function(e){if("stdev"===e||"var"===e||"varp"===e||"stdevp"===e){const a=r[n.dataField][e],i=o,d=a/o;let l=0;for(let e=0;e<o;e++){let a=t[e][n.dataField];l+=(a-d)*(a-d)}let s="stdevp"===e||"varp"===e?i:i-1;0===s&&(s=1),"var"===e||"varp"===e?r[n.dataField][e]=l/s:"stdevp"!==e&&"stdev"!==e||(r[n.dataField][e]=Math.sqrt(l/s))}}))}}return r}}_getDataItem(e,t){const a=this,n={},r="number"==typeof a.dataSource||a.dataSourceLength;if(!e)return{$:{id:t,isEmpty:!0,index:t}};if("string"==typeof e&&(e={"":e}),r){for(let e=0;e<a.dataFields.length;e++){n[(a.dataFields?a.dataFields[e]:{}).name]=""}return n.$={},n.$.id=t,n.$.index=t,n}const i=e;if(void 0!==i.expanded&&(n.expanded=i.expanded,"true"===i.expanded||!0===i.expanded||1===i.expanded?n.expanded=!0:n.expanded=!1),a.childrenDataField?void 0!==i[a.childrenDataField]&&(n.children=i[a.childrenDataField]):void 0!==i.children?n.children=i.children:void 0!==i.items&&(n.children=i.items),void 0!==i.leaf&&(n.leaf=i.leaf),void 0!==i.level&&(n.level=i.level),a.keyDataField&&void 0!==i[a.keyDataField]&&(n[a.keyDataField]=i[a.keyDataField]),a.parentDataField&&void 0!==i[a.parentDataField]&&(n[a.parentDataField]=i[a.parentDataField]),0===a.dataFields.length){const t=Object.getOwnPropertyNames(e);for(let e=0;e<t.length;e++)"$"!==t[e]&&a.dataFields.push({name:t[e],dataType:"string"})}for(let t=0;t<a.dataFields.length;t++){const r=a.dataFields?a.dataFields[t]:{};let o="";if(null==r)continue;if(e.length&&(o=e[t]),r.map){let e=r.map.split(a.mapChar);if(e.length>0){let t=i;for(let a=0;a<e.length;a++)i&&(t=t[e[a]]);o=t}else o=i[r.map]}null!=o?o=o.toString():void 0===o&&null!==o&&(o="");let d=!1;if(""===o&&(d=!0,o=e[r.name],void 0===r.dataType&&(r.dataType="any"),null!=o?"array"!==r.dataType&&("any"===r.dataType?o=Array.isArray(e[r.name])?[...e[r.name]]:"object"==typeof e[r.name]?Object.assign({},e[r.name]):e[r.name]:"date"!==r.dataType&&(o=o.toString())):o=void 0===o&&"any"===r.dataType?null:""),"[object Object]"===o&&r.map&&d&&(o=""),a._cachedValues[o+"_"+r.dataType])o=a._cachedValues[o+"_"+r.dataType];else{if("bool"===r.dataType||"boolean"===r.dataType)"true"===o||"1"===o?o=!0:"false"!==o&&"0"!==o||(o=!1);else if("number"===r.dataType)-1===o.indexOf(".")&&o.indexOf(",")>=0&&o.substring(1+o.indexOf(",")).length<3&&(o=o.replace(",",".")),o=a.$document.deserialize(""+o,r.dataType,!0);else if("date"===r.dataType)if(r.formatString&&Smart.Utilities.DateTime){o=Smart.Utilities.DateTime.ParseDate(o,r.formatString)}else o=a.$document.deserialize(""+o,r.dataType,!0);else"any"!==r.dataType&&(o=a.$document.deserialize(""+o,r.dataType,!0));"any"!==r.dataType&&(a._cachedValues[o+"_"+r.dataType]=o)}"string"!==r.dataType&&"boolean"!==r.dataType&&"bool"!==r.dataType&&"any"!==r.dataType&&(isNaN(o)||o===-1/0||o===1/0)&&(o="date"===r.dataType||"number"===r.dataType?null:0),"parent"!==r.name&&"group"!==r.name&&"leaf"!==r.name&&"level"!==r.name?("string"===r.dataType&&/<.+?>/.test(o)&&o.replace&&("all"===a.sanitizeHTML?o=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;"):"blackList"===a.sanitizeHTML&&(o=window.Smart.Utilities.Core.sanitizeHTML(o))),n[r.name]=o):n.$[r.name]=o}let o=t;if(a.id){if(o=i[a.id],void 0===o){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};o=e()+e()}"object"==typeof o&&(o=t),i.$&&void 0!==i.$.id&&(o=i.$.id)}else if(!a.virtualDataSource&&a.dataItemById&&a.dataItemById[o])for(o=a.length;a.dataItemById[o];)o++;return n.$||(n.$={}),n.$.id=o,n.$.index=t,new Object(n)}_bindToArray(){const e=this,t="number"==typeof e.dataSource||e.dataSourceLength,a=[];e.boundSource.canNotify=!1;const n=t?"number"==typeof e.dataSource?e.dataSource:e.dataSource.length:e.observable?e.length:e.dataSource.length;for(let r=0;r<n;r++){const n=t?{}:e.dataSource[r],i=e._getDataItem(n,r);a.push(i)}if(t&&e.dataSourceLength&&e.dataSource.length>0)for(let t=0;t<e.dataSource.length;t++){const n=e.dataSource[t].cell,r=e.dataSource[t].value,i=n.replace(/[^0-9]/g,""),o=n.replace(/[0-9]/g,"");a[i-1][o]=r}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(a),e.observable&&(e.boundSource=new Smart.ObservableArray(a));for(let t=0;t<n;t++)e.observable?e[t]=e.boundSource[t]:e[t]=a[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=a),e.boundSource.canNotify=!0}_bindToICS(){const e=this,t=""+e.dataSource,a=e.rowDelimiter||"\n",n=t.split("\r"),r=[];let i=t.split(a),o=i.length;1===o&&n.length>1&&(i=n,o=i.length);const d=function(e,t){var a=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z)?$/.exec(e);if(!a)throw new Error("Invalid UNTIL value: "+e);return t?new Date(a[1],a[2]-1,a[3],0,0,0,0):new Date(Date.UTC(a[1],a[2]-1,a[3],a[5]||0,a[6]||0,a[7]||0))};for(let e=0;e<o;e++){const t=i[e].trim();if(t.indexOf("BEGIN:VEVENT")>=0)var l={};else if(l)if(t.indexOf("BEGIN:VALARM")>=0)var s={};else{if(s){if(t.indexOf("ACTION")>=0){s.ACTION=t.substring(t.indexOf("ACTION")+7);continue}if(t.indexOf("DESCRIPTION")>=0){s.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);continue}if(t.indexOf("TRIGGER")>=0){s.TRIGGER=t.substring(t.indexOf("TRIGGER")+8);continue}if(t.indexOf("END:VALARM")>=0){l.ALARM||(l.ALARM=[]),l.ALARM.push(s),s=void 0;continue}}if(t.indexOf("SUMMARY")>=0)l.SUMMARY=t.substring(t.indexOf("SUMMARY")+8);else if(t.indexOf("LOCATION")>=0)l.LOCATION=t.substring(t.indexOf("LOCATION")+9);else if(t.indexOf("DESCRIPTION")>=0)l.DESCRIPTION=t.substring(t.indexOf("DESCRIPTION")+12);else if(t.indexOf("RRULE")>=0)l.RRULE=t.substring(t.indexOf("RRULE")+6);else if(t.indexOf("RECURRENCE-ID")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID")+14);else if(t.indexOf("RECURRENCE-ID;VALUE=DATE")>=0)l.RECURRENCEID=t.substring(t.indexOf("RECURRENCE-ID;VALUE=DATE")+25);else if(t.indexOf("EXDATE;VALUE=DATE")>=0){const e=t.substring(t.indexOf("EXDATE;VALUE=DATE")+20);l.EXDATE=e}else if(t.indexOf("EXDATE")>=0){const e=t.substring(t.indexOf("EXDATE")+7);l.EXDATE=e}else t.indexOf("DTEND;VALUE=DATE")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND;VALUE=DATE")+17),!0):t.indexOf("DTEND")>=0?l.DTEND=d(t.substring(t.indexOf("DTEND")+6)):t.indexOf("DTSTART;VALUE=DATE")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART;VALUE=DATE")+19),!0):t.indexOf("DTSTART")>=0?l.DTSTART=d(t.substring(t.indexOf("DTSTART")+8)):t.indexOf("UID")>=0?l.uid=l.UID=t.substring(t.indexOf("UID")+4):t.indexOf("STATUS")>=0?l.STATUS=t.substring(t.indexOf("STATUS")+7):t.indexOf("TITLE")>=0?l.TITLE=t.substring(t.indexOf("TITLE")+6):t.indexOf("CATEGORIES")>=0?l.CATEGORIES=t.substring(t.indexOf("CATEGORIES")+11):t.indexOf("END:VEVENT")>=0&&(r.push(l),l.ALARM&&(l.ALARM=JSON.stringify(l.ALARM)),s=void 0)}}e.canNotify=!1,e.dataSource=r,e.canNotify=!0,e._bindToArray()}_bindToJSON(){const e=this,t=[],a=e.dataSource.length?e.dataSource:Object.entries(e.dataSource);e.boundSource.canNotify=!1;for(let n=0;n<a.length;n++){const r=a[n],i=e._getDataItem(r,n);t.push(i)}e.boundSource=!1===e.observable||e.virtualDataSource?[]:new Smart.ObservableArray(t);for(let t=0;t<e.length;t++)e[t]=e.boundSource[t],e.dataItemById[e[t].$.id]=e[t];!1===e.observable&&(e.boundSource=t),e.boundSource.canNotify=!0}sortBy(e,t,a){const n=this;if(!t)for(let a=0;a<n.dataFields.length;a++){const r=n.dataFields[a];if(r.name===e){t=r.dataType;break}}if(n.boundHierarchy){if((!e||0===e.length)&&n.groupBy.length>0)return void n.refreshHierarchy();const r=(e=>{let t=[];for(;e;){t=t.concat(e);for(let a=0;a<e.length;a++)e[a].children&&(t=t.concat(e[a].children));e=e.children}return t})(n.boundHierarchy);if(r){r.find((e=>{if(e.summaryRow)return e}))&&n.refreshHierarchy()}const i=function(r){n._sort(r,e,a,t);for(let n=0;n<r.length;n++){const o=r[n];o.children&&i(o.children,e,a,t)}};i(n.boundHierarchy)}else n._sort(n.boundSource,e,a,t)}_createFilter(e,t){const a={"=":"EQUAL","<>":"NOT_EQUAL","!=":"NOT_EQUAL",not_like:"DOES_NOT_CONTAIN",like:"CONTAINS","<":"LESS_THAN",">":"GREATER_THAN","<=":"LESS_THAN_OR_EQUAL",">=":"GREATER_THAN_OR_EQUAL",equal:"EQUAL","not equal":"NOT_EQUAL","less than":"LESS_THAN","greater than":"GREATER_THAN","greater than or equal":"GREATER_THAN_OR_EQUAL","less than or equal":"LESS_THAN_OR_EQUAL","starts with":"STARTS_WITH","ends with":"ENDS_WITH",notEqual:"NOT_EQUAL",not_equal:"NOT_EQUAL",lessThan:"LESS_THAN",greaterThan:"GREATER_THAN",greaterThanOrEqual:"GREATER_THAN_OR_EQUAL",lessThanOrEqual:"LESS_THAN_OR_EQUAL",less_than:"LESS_THAN",greater_than:"GREATER_THAN",greater_than_or_equal:"GREATER_THAN_OR_EQUAL",less_than_or_equal:"LESS_THAN_OR_EQUAL",null:"null","":"EMPTY",isblank:"EMPTY",isnotblank:"NOT_EMPTY",isBlank:"EMPTY",isNotBlank:"NOT_EMPTY",CONTAINS:"CONTAINS",DOES_NOT_CONTAIN:"DOES_NOT_CONTAIN",contains:"CONTAINS",does_not_contain:"DOES_NOT_CONTAIN","not contains":"DOES_NOT_CONTAIN",notcontains:"DOES_NOT_CONTAIN",notContains:"DOES_NOT_CONTAIN",startswith:"STARTS_WITH",endswith:"ENDS_WITH",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH",startsWith:"STARTS_WITH",endsWith:"ENDS_WITH",NULL:"NULL",NOT_NULL:"NOT_NULL"};let n=[];"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++){const a=t[e],r=-1===a.indexOf('"')?a.split(" "):a.split('"');let i=[];for(let e=0;e<r.length;e++){const t=r[e];""!==t&&" "!==t&&i.push(t.trim())}n.push(i)}const r=new Smart.FilterGroup,i=[],o=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.length>1){const t=new Smart.FilterGroup;let n="and",i=0;for(let o=0;o<r.length;o++){let d=r[o];if("and"!==d&&"or"!==d){if(i++,2===i){let l=a[r[o-1]];l||(l=r[o-1]),"number"===e&&(d=parseFloat(d)),"date"===e&&(d=new Date(d));const s=t.createFilter(e,d,l);i=0,n&&t.addFilter(n,s)}}else n=d}o.push(t)}else{const e=r[0];if("and"!==e&&"or"!==e)throw new Error('Filter Exprresion expects "AND" or "OR", but the token is: '+e);i.push(e)}}let d=0;if(1===o.length)return o[0];for(let e=0;e<o.length;e++){let t=i[d];(e+1)%2==0&&d++,t||(t="and"),r.addFilter(t,o[e])}return r}filterBy(e,...t){const a=this,n=(()=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}})(),r=a._createFilter(n,t);return a.boundSource.filter((t=>r.evaluate(t[e])))}_filter(e,t="and"){const a=this,n=[],r=[];if(0===e.length)return void a.clearFilter();const i=e=>{for(let t=0;t<a.dataFields.length;t++){const n=a.dataFields[t];if(n.name===e)return n.dataType}};let o,d;"and"===t?(o=!0,d=function(e,t,a){return e&&t.evaluate(a[t.dataField])}):(o=!1,d=function(e,t,a){return e||t.evaluate(a[t.dataField])});for(let t=0;t<e.length;t++){const o=e[t],d=o[0];let l=null;l=o[1]instanceof Smart.FilterGroup?o[1]:a._createFilter(i(d),o.splice(1)),l&&(r.push(d),l.dataField=d,n.push(l))}if(a.boundHierarchy){const e=function(e){let t=o;for(let a=0;a<n.length;a++){const r=n[a];t=d(t,r,e)}return e.$.filtered=t,t},t=function(n,r,i){let o=0;for(let a=0;a<n.length;a++){const i=n[a];e(i),i.$.filtered&&o++,i.children&&t(i.children,i,r)}o>0&&a.groupBy.length>0&&r?(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0)):o>0&&o!==n.length&&r?(r.$.filtered=null,i&&!i.$.filtered&&(i.$.filtered=null)):o>0&&o===n.length&&r&&(r.$.filtered=!0,i&&!i.$.filtered&&(i.$.filtered=!0))};t(a.boundHierarchy,null,null)}else for(let e=0;e<a.boundSource.length;e++){const t=a.boundSource[e];let r=o;for(let e=0;e<n.length;e++){const a=n[e];r=d(r,a,t)}t.$.filtered=r}a.onFilter&&a.onFilter()}clearGroup(){const e=this;e.groupBy=[],e.boundHierarchy=null,e.refreshHierarchy(),e.onGroup&&e.onGroup()}clearFilter(){const e=this;for(let t=0;t<e.boundSource.length;t++){e.boundSource[t].$.filtered=!0}if(e.boundHierarchy){const t=function(e,a,n){for(let n=0;n<e.length;n++){const r=e[n];r.$.filtered=!0,r.$.filtered,r.children&&t(r.children,r,a)}a&&(a.$.filtered=!0,n&&!n.$.filtered&&(n.$.filtered=!0))};t(e.boundHierarchy,null,null)}e.onFilter&&e.onFilter()}clearSort(){this._sort(this.boundSource,[],[],[])}_sort(e,t,a,n,r,i){const o=this;let d=!1;if(0===e.length)return;if(e&&e.constructor&&e instanceof Smart.ObservableArray&&(d=!0),(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)&&!d&&!o.boundHierarchy)throw new Error("sort: Missing or Invalid arguments!");"string"==typeof t&&(t=[t]);const l=[],s=[];void 0===a&&(a=[]);const c=function(e,t){let a;switch(t||typeof e){case"string":a=(new Intl.Collator).compare;break;case"number":case"int":case"bigInt":case"float":case"double":a=function(e,t){return e-t};break;case"boolean":case"bool":a=function(e,t){return e===t?0:!1===e?-1:1};break;case"date":case"time":case"dateTime":a=e instanceof Date?function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0}:e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber?function(e,t){return e.compare(t)}:function(e,t){return e-t};break;case"object":if(e instanceof Date)a=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)a=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;a=function(t,a){return e.compareComplexNumbers(t,a)}}}return a};for(let r=0;r<t.length;r++){void 0===a[r]||"asc"===a[r]||"ascending"===a[r]?l[r]=1:l[r]=-1;let o=e[0][t[r]];if(void 0===o&&e[0]&&e[0].children&&e[0].data&&(o=e[0].data[t[r]]),i&&i){const e=t[r];if(i[e]){s[r]=i[e];continue}}s[r]=c(o,n[r])}t.length>0&&r?r(e,t,a,s):e.sort((function(e,a){for(let n=0;n<t.length;n++){const r=s[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e.$.index?(e.$.index-a.$.index)*l[n]:0}return r*l[n]}if(0===t.length)return e.$.index<a.$.index?-1:e.$.index>a.$.index?1:0}));for(let t=0;t<e.length;t++)o[t]=e[t]}static Filter(e,t,a,n,r="and"){let i,o;"and"===r?(i=!0,o=function(e,t,a,r){return n?e&&n(t,a,r):e&&r.evaluate(t[a])}):(i=!1,o=function(e,t,a,r){return n?e||n(t,a,r):e||r.evaluate(t[a])});return e.filter((e=>{let n=i;for(let r=0;r<a.length;r++){const i=a[r],d=t[r];n=o(n,e,d,i)}return n}))}filter(e,t,a){Smart.DataAdapter.Filter(this.boundSource,e,t,a)}sort(e,t,a){Smart.DataAdapter.Sort(this.boundSource,e,t,a)}static Sort(e,t,a,n){const r=function(e){let t;switch(typeof e){case"string":if(e.indexOf("-")>=0||e.indexOf("/")>=0){const t=new Date(e);if(t&&"Invalid Date"!==t.toString()){return function(e,t){const a=new Date(e),n=new Date(t);return a||n?a?n?a.getTime()-n.getTime():1:-1:0}}}t=(new Intl.Collator).compare;break;case"number":t=function(e,t){return e-t};break;case"boolean":t=function(e,t){return e===t?0:!1===e?-1:1};break;case"object":if(e instanceof Date)t=function(e,t){return e||t?e?t?e.getTime()-t.getTime():1:-1:0};else if(e instanceof Smart.Utilities.DateTime||e instanceof Smart.Utilities.BigNumber)t=function(e,t){return e.compare(t)};else if(e instanceof Smart.Utilities.Complex||window.NIComplex&&e instanceof window.NIComplex){const e=new Smart.Utilities.ComplexNumericProcessor;t=function(t,a){return e.compareComplexNumbers(t,a)}}else t=function(e,t){return e-t}}return t};if(!e||!Array.isArray(e)||0===e.length||!t||Array.isArray(t)&&0===t.length)return;"string"==typeof t&&(t=[t]);const i=[],o=[];void 0===a&&(a=[]);for(let n=0;n<t.length;n++)void 0===a[n]||"asc"===a[n]||"ascending"===a[n]?i[n]=1:i[n]=-1,o[n]=r(e[0][t[n]]);if(n)return void n(e,t,a,o);const d=e.slice(0);return d.sort((function(e,a){for(let n=0;n<t.length;n++){const r=o[n](e[t[n]],a[t[n]]);if(0===r){if(t[n+1])continue;return void 0!==e._index?(e._index-a._index)*i[n]:0}return r*i[n]}})),d}};class e{constructor(e,t){const a=this;a.config=e,a.callback=t,!1!==e.autoFetch&&a.call(e)}call(e){const t=this;e||(e=t.config);let a="GET",n=e.url,r=null,i=!0;if(e.type&&(a=e.type),e.data)if("GET"===a){n+="?";for(let t in e.data)Object.prototype.hasOwnProperty.call(e.data,t)&&(n+=encodeURI(t+"="+e.data[t]+"&"));"&"===n.charAt(n.length-1)&&(n=n.slice(0,n.length-1))}else"POST"===a&&(r=JSON.stringify(e.data));e&&!1===e.async&&"xlsx"!==e.dataSourceType&&(i=!1),void 0!==window.fetch&&i?t.ajaxFetch(e,a,n,r):t.ajaxXMLHttpRequest(e,a,n,r,i)}ajaxFetch(e,t,a,n){const r=this,i={method:t};let o,d,l,s;switch(e.dataSourceType){case"json":o="json";break;case"xlsx":o="arrayBuffer";break;default:o="text"}if(e&&e.contentType&&(i.headers=new Headers({"Content-Type":e.contentType})),null!==n&&(i.body=n),e.timeout&&(l=setTimeout((function(){s=!0}),e.timeout)),e.beforeSend){if(!1===e.beforeSend(i,e))return}fetch(a,i).then((function(e){if(s)throw d=408,new Error("timeout");if(l&&clearTimeout(l),d=e.status,!e.ok)throw new Error(e.statusText);return e[o]()})).then((function(t){if("arrayBuffer"===o)return JSZip.loadAsync(t).then((function(t){return t.files["xl/worksheets/sheet1.xml"].async("text").then((function(a){return t.files["xl/sharedStrings.xml"].async("text").then((function(t){const n=r.parseXLSXData(a,t);r.ajaxComplete(e,n,d)}))}))}));r.ajaxComplete(e,t,d)})).catch((function(t){"JSZip is not defined"===t.message&&(t.message="JSZip is not defined. Please include a reference to JSZip to be able to load data from XLSX files."),e&&e.loadError&&e.loadError(d,t),r.callback&&r.callback(t,d)}))}ajaxXMLHttpRequest(e,t,a,n,r){const i=new XMLHttpRequest,o=this;if(i.open(t,a,r),i.ontimeout=function(){e&&e.loadError&&e.loadError(408,"timeout")},i.onload=function(){if(4===i.readyState){const t=i.status;let a=i.response;t>=200&&t<=299?("json"===e.dataSourceType&&(a=JSON.parse(a)),o.ajaxComplete(e,a,t)):e&&e.loadError&&e.loadError(t,a)}},i.onerror=function(){e&&e.loadError&&e.loadError(i.status,i.response)},e&&e.contentType&&i.setRequestHeader("Content-Type",e.contentType),r&&e.timeout&&(i.timeout=e.timeout),e.beforeSend){if(!1===e.beforeSend(i,e))return}i.send(n)}ajaxComplete(e,t,a){if(e){if(e.beforeLoadComplete){const a=e.beforeLoadComplete(t);a&&(t=a)}e.loadComplete&&e.loadComplete(t,a),this.callback&&this.callback(t,a)}}parseXLSXData(e,t){const a=new DOMParser,n=a.parseFromString(t,"text/xml"),r=Array.from(n.getElementsByTagName("si")),i=[],o=a.parseFromString(e,"text/xml"),d=Array.from(o.getElementsByTagName("row")),l=[];return r.forEach((function(e){let t=e.getElementsByTagName("t");if(1===t.length)i.push(t[0].innerHTML);else{let e="";t=Array.from(t),t.forEach((function(t){e+=t.innerHTML})),i.push(e)}})),d.forEach((function(e){const t={};Array.from(e.getElementsByTagName("c")).forEach((function(e){const a=e.getAttribute("r").match(/\D+/)[0],n=e.getAttribute("t"),r=e.getElementsByTagName("v")[0].innerHTML;let o;switch(n){case"s":o=i[parseFloat(r)];break;case"b":o=1===parseFloat(r);break;default:o=parseFloat(r)}t[a]=o})),l.push(t)})),l}}Smart.Ajax=window.Ajax=e})();
1326
1326
 
1327
1327
  /***/ }),
1328
1328
 
@@ -1336,7 +1336,7 @@ Smart("smart-country-input",class extends Smart.Input{static get properties(){re
1336
1336
  /***/ 501:
1337
1337
  /***/ (() => {
1338
1338
 
1339
- Smart("smart-date-input",class extends Smart.Input{static get properties(){return{autoClose:{value:!1,type:"boolean"},autoCloseDelay:{value:0,type:"number"},dropDownButtonPosition:{allowedValues:["none","left","right"],value:"right",defaultReflectToAttribute:!0,type:"string"},dropDownHeight:{type:"any",value:"auto"},min:{type:"any",value:new Date(1900,0,1)},max:{type:"any",value:new Date(2100,0,1)},messages:{value:{en:{hours:"Hours",minutes:"Minutes",am:"am",pm:"pm"}},type:"object",extend:!0},placeholder:{value:"MM/dd/yyyy",type:"string"},dateTimeFormat:{type:"any",value:{year:"numeric",month:"numeric",day:"numeric"}},value:{type:"any",value:""}}}template(){return'<div id="inputContainer" role="presentation"><input class="smart-input" id=\'input\' readonly=\'[[readonly]]\' placeholder=\'[[placeholder]]\' type=\'[[type]]\' name=\'[[name]]\' disabled=\'[[disabled]]\' aria-label="[[placeholder]]" /><span class="smart-hidden smart-hint" id="span">[[hint]]</span><div id="dropDownButton" tabindex=-1 class="smart-drop-down-button" role="button" aria-label="Toggle popup"><div id="arrow" class="arrow" aria-hidden="true"></div></div></div>'}static get listeners(){return{"input.change":"_changeHandler","input.focus":"_focusHandler","input.blur":"_blurHandler","input.keydown":"_keyDownHandler","input.keyup":"_keyUpHandler","input.keypress":"_keyPressHandler","dropDownButton.down":"_dropDownButtonDownHandler","inputContainer.down":"_downHandler","document.up":"_documentUpHandler"}}_calendarDropDownClickHandler(e){const t=this;t.autoClose&&e.target.closest(".smart-calendar-cell")&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay))}render(){super.render(),this.value&&this.value instanceof Date&&this._setInputValue(this.value)}focus(){this.$.input.focus()}select(){const e=this;e.readonly?e.$.input.focus():e.$.input.select()}_documentUpHandler(e){const t=this,o=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;t.contains(o)?requestAnimationFrame((()=>{})):t.$.scrollView.contains(o.shadowParent||o)?t._isPointerDown&&(t._isPointerDown=!1,t.opened&&(t._preventLookup=!0),t.$.input.focus()):(t.opened&&(t._preventLookup=!0),t._isPointerDown=!1,t.close())}_changeHandler(e){const t=this;e.stopPropagation(),t._performSelect();const o=t._getInputValue();t._oldValue||(t._oldValue=null),t.$.fireEvent("change",{value:o,oldValue:t._oldValue}),t._updateTargetValue(),t._oldValue=o}_focusHandler(){const e=this;if(e.setAttribute("focus",""),e.readonly||0!==e.minLength||0!==e.$.input.value.length||e._preventLookup){if(e.$.fireEvent("focus"),e.value){const t=e._getInputValue();e._setInputValue(t)}delete e._preventLookup}}_blurHandler(){const e=this;if(e.opened||e.removeAttribute("focus"),e._popup&&e._popup.isCompleted&&e.opened)e._setInputValue(e._popup.value);else{const t=e._getInputValue();e._setInputValue(t)}e.$.fireEvent("blur"),delete e._preventLookup}_getInputValue(){const e=this,t=e.$.input.value;let o=null;const a=t=>{let o=new Date(Date.parse(t));if("Invalid Date"===o.toString()&&(o=null),!o||e.locale&&"en"!==e.locale){let e=(new Smart.Utilities.DateTime).tryparseDate(t,null);if(e)return e}return o};return e.dateTimeFormat.day&&e.dateTimeFormat.month&&e.dateTimeFormat.year?o=a(t):e.dateTimeFormat.day&&e.dateTimeFormat.month&&!e.dateTimeFormat.year?(o=a(t),e._popup.value||(e._popup.value=new Date),e._popup.isCompleted?o.setFullYear(e._popup.value.getFullYear(),o.getMonth(),o.getDate()):o.setFullYear((new Date).getFullYear(),o.getMonth(),o.getDate())):!e.dateTimeFormat.day&&e.dateTimeFormat.month&&e.dateTimeFormat.year&&(e._popup.value||(e._popup.value=new Date),o=a(t),e._popup.isCompleted?o.setFullYear(o.getFullYear(),o.getMonth(),e._popup.value.getDate()):o.setFullYear(o.getFullYear(),o.getMonth(),(new Date).getDate())),o<e.min&&(o=e.min),o>e.max&&(o=e.max),o}getDate(){return this._getInputValue()}getValue(){return this._getInputValue()}setValue(e){this._setInputValue(e)}_setInputValue(e){const t=this;if(!e)return t.$.input.value="",t.removeAttribute("data-value"),void(t.value=null);e<t.min&&(e=t.min),e>t.max&&(e=t.max);const o=t.dateTimeFormat;o&&o.timeZone&&delete o.timeZone;let a=new Intl.DateTimeFormat(t.locale,o).format(e);t.hasAttribute("focus")&&(a=new Intl.DateTimeFormat(t.locale,{year:"numeric",day:"numeric",month:"numeric"}).format(e)),t.$.input.value=t.value=a,t.setAttribute("data-value",e)}_performSelect(){}getFormattedValue(e,t){const o=this;return null===t?parseFloat(e):(e||(e=new Date),t||(t=o.dateTimeFormat).timeZone&&delete t.timeZone,new Intl.DateTimeFormat(o.locale,t).format(e))}_open(){const e=this,t=e.getBoundingClientRect(),o=window.scrollX,a=window.scrollY;let n=0,l=0;if(this.opened)return;if(e.timer&&clearTimeout(e.timer),document.body.appendChild(e.$.scrollView),e.setAttribute("aria-owns",e.$.scrollView.id),e.readonly||e.$.input.setAttribute("aria-controls",e.$.scrollView.id),e.$.scrollView.enableShadowDOM&&!e._importedStyle&&(e.$.scrollView.importStyle(e._getStyleUrl("smart.textbox.css")),e._importedStyle=!0),"static"!==getComputedStyle(document.body).position){const e=document.body.getBoundingClientRect();n=e.left,l=e.top}const r=document.body.getBoundingClientRect(),i=-3+t.left+o-n;e.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",""),i+e.$.scrollView.offsetWidth<r.right?e.$.scrollView.style.left=i+"px":e.$.scrollView.style.left=i+e.offsetWidth-e.$.scrollView.offsetWidth+"px",e.$.scrollView.style.top=t.bottom+a-l+1+"px",e.$.scrollView.classList.remove("open"),e.$.scrollView.onpointerdown=function(){e._isPointerDown=!0},e._refreshPopup(),requestAnimationFrame((function(){e.$.scrollView.setAttribute("open",""),e.setAttribute("open",""),e.$.dropDownButton.setAttribute("open",""),e.$.input.setAttribute("open","")})),this.opened=!0}_refreshPopup(){const e=this,t=e._getInputValue();e._popup.isAttached&&e._popup.select(t)}close(){const e=this;return!!e.opened&&(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((function(){e.$.scrollView.parentNode&&!e.opened&&(document.body.removeChild(e.$.scrollView),e.removeAttribute("aria-owns"),e.readonly||e.$.input.removeAttribute("aria-controls"))}),1e3),e.$.scrollView.removeAttribute("open"),e.$.dropDownButton.removeAttribute("open"),e.$.input.removeAttribute("open"),e.removeAttribute("open"),e.opened=!1,!0)}_lookup(){}_downHandler(e){const t=this;t.readonly&&t._dropDownButtonDownHandler(e)}_dropDownButtonDownHandler(e){return this._toggle(),e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}_toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this;e._process(),e.$.input.focus(),setTimeout((function(){e.$.input.focus()}),25)}_process(){this._performSelect(void 0,!0),this._open()}_matcher(){}_sorter(){}_highlighter(){}_render(){}ensureVisible(){}_next(){}_prev(){}_move(e){e.stopPropagation()}_keyPressHandler(e){this._suppressKeyPressRepeat||e.shiftKey||e.altKey||e.ctrlKey}_insertKey(e,t=1){const o=this,a=o.$.input.selectionStart,n=o.$.input.value,l=n.substring(0,a),r=n.substring(a+t);o.$.input.value=l+e.key+r,o.$.input.selectionStart=o.$.input.selectionEnd=a+1}_keyDownHandler(e){const t=this;t._suppressKeyPressRepeat=![40,38,9,13,27,16,17,18].includes(e.keyCode);let o=!1;switch(e.keyCode>=48&&e.keyCode<=57&&(o=!0),e.keyCode>=96&&e.keyCode<=105&&(o=!0),e.key){case"/":case"-":case":":case"ArrowLeft":case"ArrowUp":case"ArrowDown":case"ArrowRight":case"Home":case"End":case"Delete":case"Backspace":case"Tab":o=!0}e.ctrlKey&&(o=!0),o||e.preventDefault(),"Tab"===e.key&&t.close(),e.shiftKey||e.altKey||e.ctrlKey}_getMask(){const e=this,t=e.getFormattedValue(new Date(2020,10,10),{year:"numeric",month:"numeric",day:"numeric"});let o="/";-1===t.indexOf(o)&&(o="-");const a=t.split(o);e._mask=[];let n=0;for(let t=0;t<a.length-1;t++)n+=a[t].length,e._mask[n]=o,n++}_appendPreOrPostMatch(e,t){for(var o=0,a=!1,n=0,l=e.length;n<l;n++){var r=e.charAt(n);switch(r){case"'":a?t.push("'"):o++,a=!1;break;case"\\":a&&t.push("\\"),a=!a;break;default:t.push(r),a=!1}}return o}_keyUpHandler(e){const t=this;let o=t.$.input.value.trim();const a=new Date(o);if(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105){if(void 0!==t._mask[o.length]){let e=[...o],a=t._mask.flat().length,n=0;for(let a=0;a<e.length;a++)e[a]===t._mask[o.length]&&n++;n<a&&(o+=t._mask[o.length],t.$.input.value=o)}}else if(" "===e.key||"Enter"===e.key){const o=t._getInputValue();t._setInputValue(o),"Enter"===e.key&&t.opened&&t.close()}else if("/"===e.key||":"===e.key||"-"===e.key){const e=t.$.input.selectionStart,o=t._getInputValue();t._setInputValue(o),t.$.input.selectionStart=e,"/"===t.$.input.value[e]&&t.$.input.selectionStart++}if("Invalid Date"!==a.toString()?t.value=a:t.value=null,t._refreshPopup(),!e.shiftKey)switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:40===e.keyCode&&e.altKey&&(t.open(),setTimeout((()=>{t._popup.focus()}),50)),38===e.keyCode&&e.altKey&&(t.close(),t.focus());break;case 27:if(!t.opened)return;t.close(),e.stopPropagation(),e.preventDefault()}}propertyChangedHandler(e,t,o){const a=this;switch(e){case"value":"string"==typeof o?a.$.input.value=o:a._setInputValue(o);break;case"month":case"min":case"max":a.$.calendar[e]=o;break;case"theme":case"rightToLeft":case"animation":case"inverted":a.$.calendar&&(a.$.calendar[e]=o),a.$.scrollView&&(o?a.$.scrollView.setAttribute(Smart.Utilities.Core.toDash(e),"boolean"==typeof o?"":o):a.$.scrollView.removeAttribute(Smart.Utilities.Core.toDash(e)));break;case"locale":a._performSelect(),a.$.calendar&&(a.$.calendar.locale=o);break;default:super.propertyChangedHandler(e,t,o)}}_createElement(){const e=this,t=document.createElement("div");if(t.classList.add("smart-input-drop-down-menu","smart-date-input-drop-down-menu"),t.setAttribute("animation",e.animation),t.setAttribute("role","presentation"),e.rightToLeft?t.setAttribute("right-to-left",""):t.removeAttribute("right-to-left"),e.inverted?t.setAttribute("inverted",""):t.removeAttribute("inverted"),t.onclick=function(t){t.stopPropagation(),t.preventDefault();const o=t.target;t.altKey?e.$.input.focus():e._popup.focus(),o.closest("smart-done-button")&&e.close()},!t.id){const e=t.tagName.toLowerCase();t.id=e.slice(0,1).toLowerCase()+e.slice(1)+Math.floor(65536*(1+Math.random())).toString(16).substring(1)}e.$.scrollView=t,e.classList.add("smart-input");const o=document.createElement("smart-calendar");if(e._popup=o,e.$.calendar=o,o.locale=e.locale,o.$.listen("keyup",(t=>{if("Enter"===t.key){e._oldValue||(e._oldValue=null);const t=o.selectedDates[0];o.value=t,e._setInputValue(t),e.$.fireEvent("change",{value:t,oldValue:e._oldValue}),e.set("value",t),e._updateTargetValue(),e._oldValue=t,e.close(),e.focus()}"Escape"===t.key&&(e.close(),e.focus()),"Tab"===t.key&&(e.close(),e.focus())})),o.onclick=t=>{e._oldValue||(e._oldValue=null);const a=o.selectedDates[0];e._setInputValue(a),e._calendarDropDownClickHandler(t),e.$.fireEvent("change",{value:a,oldValue:e._oldValue}),e.set("value",a),e._updateTargetValue(),e._oldValue=a},t.appendChild(o),e.$.input.value=e.value,e.value&&(""+e.value).length>0){const t=e._getInputValue();e._oldValue=t,e._setInputValue(t)}e._getMask()}_refreshMenu(){}_setAriaRelations(){const e=this,t=e.getAttribute("aria-label");e.readonly?(e.setAttribute("role","button"),!t&&e.placeholder&&e.setAttribute("aria-label",e.placeholder),e.removeAttribute("aria-readonly"),e.$.input.setAttribute("aria-hidden",!0),e.$.input.removeAttribute("aria-controls"),e.$.dropDownButton.setAttribute("aria-hidden",!0)):(e.setAttribute("role","presentation"),t&&t===e.placeholder&&e.removeAttribute("aria-label"),e.$.input.removeAttribute("aria-hidden"),e.$.dropDownButton.removeAttribute("aria-hidden")),e.setAttribute("aria-haspopup","dialog"),e.$.scrollView.setAttribute("role","dialog")}_setActiveDescendant(){}_setInputPurpose(){}});
1339
+ Smart("smart-date-input",class extends Smart.Input{static get properties(){return{autoClose:{value:!1,type:"boolean"},autoCloseDelay:{value:0,type:"number"},dropDownButtonPosition:{allowedValues:["none","left","right"],value:"right",defaultReflectToAttribute:!0,type:"string"},dropDownHeight:{type:"any",value:"auto"},min:{type:"any",value:new Date(1900,0,1)},max:{type:"any",value:new Date(2100,0,1)},messages:{value:{en:{hours:"Hours",minutes:"Minutes",am:"am",pm:"pm"}},type:"object",extend:!0},placeholder:{value:"MM/dd/yyyy",type:"string"},dateTimeFormat:{type:"any",value:{year:"numeric",month:"numeric",day:"numeric"}},value:{type:"any",value:""}}}template(){return'<div id="inputContainer" role="presentation"><input class="smart-input" id=\'input\' readonly=\'[[readonly]]\' placeholder=\'[[placeholder]]\' type=\'[[type]]\' name=\'[[name]]\' disabled=\'[[disabled]]\' aria-label="[[placeholder]]" /><span class="smart-hidden smart-hint" id="span">[[hint]]</span><div id="dropDownButton" tabindex=-1 class="smart-drop-down-button" role="button" aria-label="Toggle popup"><div id="arrow" class="arrow" aria-hidden="true"></div></div></div>'}static get listeners(){return{"input.change":"_changeHandler","input.focus":"_focusHandler","input.blur":"_blurHandler","input.keydown":"_keyDownHandler","input.keyup":"_keyUpHandler","input.keypress":"_keyPressHandler","dropDownButton.down":"_dropDownButtonDownHandler","inputContainer.down":"_downHandler","document.up":"_documentUpHandler"}}_calendarDropDownClickHandler(e){const t=this;t.autoClose&&e.target.closest(".smart-calendar-cell")&&(clearTimeout(t._autoCloseTimeout),t._autoCloseTimeout=setTimeout((function(){t.close()}),t.autoCloseDelay))}render(){super.render(),this.value&&this.value instanceof Date&&this._setInputValue(this.value)}focus(){this.$.input.focus()}select(){const e=this;e.readonly?e.$.input.focus():e.$.input.select()}_documentUpHandler(e){const t=this,o=t.shadowRoot||t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;t.contains(o)?requestAnimationFrame((()=>{})):t.$.scrollView.contains(o.shadowParent||o)?t._isPointerDown&&(t._isPointerDown=!1,t.opened&&(t._preventLookup=!0),t.$.input.focus()):(t.opened&&(t._preventLookup=!0),t._isPointerDown=!1,t.close())}_changeHandler(e){const t=this;e.stopPropagation(),t._performSelect();const o=t._getInputValue();t._oldValue||(t._oldValue=null),t.$.fireEvent("change",{value:o,oldValue:t._oldValue}),t._updateTargetValue(),t._oldValue=o}_focusHandler(){const e=this;if(e.setAttribute("focus",""),e.readonly||0!==e.minLength||0!==e.$.input.value.length||e._preventLookup){if(e.$.fireEvent("focus"),e.value){const t=e._getInputValue();e._setInputValue(t)}delete e._preventLookup}}_blurHandler(){const e=this;if(e.opened||e.removeAttribute("focus"),e._popup&&e._popup.isCompleted&&e.opened)e._setInputValue(e._popup.value);else{const t=e._getInputValue();e._setInputValue(t)}e.$.fireEvent("blur"),delete e._preventLookup}_getInputValue(){const e=this,t=e.$.input.value;let o=null;const a=t=>{let o=new Date(Date.parse(t));if("Invalid Date"===o.toString()&&(o=null),!o||e.locale&&"en"!==e.locale){let e=(new Smart.Utilities.DateTime).tryparseDate(t,null);if(e)return e}return o};return e.dateTimeFormat.day&&e.dateTimeFormat.month&&e.dateTimeFormat.year?o=a(t):e.dateTimeFormat.day&&e.dateTimeFormat.month&&!e.dateTimeFormat.year?(o=a(t),e._popup.value||(e._popup.value=new Date),e._popup.isCompleted?o.setFullYear(e._popup.value.getFullYear(),o.getMonth(),o.getDate()):o.setFullYear((new Date).getFullYear(),o.getMonth(),o.getDate())):!e.dateTimeFormat.day&&e.dateTimeFormat.month&&e.dateTimeFormat.year&&(e._popup.value||(e._popup.value=new Date),o=a(t),e._popup.isCompleted?o.setFullYear(o.getFullYear(),o.getMonth(),e._popup.value.getDate()):o.setFullYear(o.getFullYear(),o.getMonth(),(new Date).getDate())),o<e.min&&(o=e.min),o>e.max&&(o=e.max),o}getDate(){return this._getInputValue()}getValue(){return this._getInputValue()}setValue(e){this._setInputValue(e)}_setInputValue(e){const t=this;if(!e)return t.$.input.value="",t.removeAttribute("data-value"),void(t.value=null);e<t.min&&(e=t.min),e>t.max&&(e=t.max);const o=t.dateTimeFormat;o&&o.timeZone&&delete o.timeZone;let a=new Intl.DateTimeFormat(t.locale,o).format(e);t.hasAttribute("focus")&&(a=new Intl.DateTimeFormat(t.locale,{year:"numeric",day:"numeric",month:"numeric"}).format(e)),t.$.input.value=t.value=a,t.setAttribute("data-value",e)}_performSelect(){}getFormattedValue(e,t){const o=this;return null===t?parseFloat(e):(e||(e=new Date),t||(t=o.dateTimeFormat).timeZone&&delete t.timeZone,new Intl.DateTimeFormat(o.locale,t).format(e))}_open(){const e=this,t=e.getBoundingClientRect(),o=window.scrollX,a=window.scrollY;let n=0,l=0;if(this.opened)return;if(e.timer&&clearTimeout(e.timer),document.body.appendChild(e.$.scrollView),e.setAttribute("aria-owns",e.$.scrollView.id),e.readonly||e.$.input.setAttribute("aria-controls",e.$.scrollView.id),e.$.scrollView.enableShadowDOM&&!e._importedStyle&&(e.$.scrollView.importStyle(e._getStyleUrl("smart.textbox.css")),e._importedStyle=!0),"static"!==getComputedStyle(document.body).position){const e=document.body.getBoundingClientRect();n=e.left,l=e.top}const r=document.body.getBoundingClientRect(),i=-3+t.left+o-n;e.$.scrollView.style.setProperty("--smart-input-drop-down-menu-width",""),i+e.$.scrollView.offsetWidth<r.right?e.$.scrollView.style.left=i+"px":e.$.scrollView.style.left=i+e.offsetWidth-e.$.scrollView.offsetWidth+"px",e.$.scrollView.style.top=t.bottom+a-l+1+"px",e.$.scrollView.classList.remove("open"),e.$.scrollView.onpointerdown=function(){e._isPointerDown=!0},e._refreshPopup(),requestAnimationFrame((function(){e.$.scrollView.setAttribute("open",""),e.setAttribute("open",""),e.$.dropDownButton.setAttribute("open",""),e.$.input.setAttribute("open","")})),this.opened=!0}_refreshPopup(){const e=this,t=e._getInputValue();e._popup.isAttached&&e._popup.select(t)}close(){const e=this;return!!e.opened&&(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((function(){e.$.scrollView.parentNode&&!e.opened&&(document.body.removeChild(e.$.scrollView),e.removeAttribute("aria-owns"),e.readonly||e.$.input.removeAttribute("aria-controls"))}),1e3),e.$.scrollView.removeAttribute("open"),e.$.dropDownButton.removeAttribute("open"),e.$.input.removeAttribute("open"),e.removeAttribute("open"),e.opened=!1,!0)}_lookup(){}_downHandler(e){const t=this;t.readonly&&t._dropDownButtonDownHandler(e)}_dropDownButtonDownHandler(e){return this._toggle(),e.preventDefault(),e.stopPropagation(),e.originalEvent.preventDefault(),e.originalEvent.stopPropagation(),!1}_toggle(){const e=this;e.opened?e.close():e.open()}open(){const e=this;e._process(),e.$.input.focus(),setTimeout((function(){e.$.input.focus()}),25)}_process(){this._performSelect(void 0,!0),this._open()}_matcher(){}_sorter(){}_highlighter(){}_render(){}ensureVisible(){}_next(){}_prev(){}_move(e){e.stopPropagation()}_keyPressHandler(e){this._suppressKeyPressRepeat||e.shiftKey||e.altKey||e.ctrlKey}_insertKey(e,t=1){const o=this,a=o.$.input.selectionStart,n=o.$.input.value,l=n.substring(0,a),r=n.substring(a+t);o.$.input.value=l+e.key+r,o.$.input.selectionStart=o.$.input.selectionEnd=a+1}_keyDownHandler(e){const t=this;t._suppressKeyPressRepeat=![40,38,9,13,27,16,17,18].includes(e.keyCode);let o=!1;switch(e.keyCode>=48&&e.keyCode<=57&&(o=!0),e.keyCode>=96&&e.keyCode<=105&&(o=!0),e.key){case"/":case"-":case":":case"ArrowLeft":case"ArrowUp":case"ArrowDown":case"ArrowRight":case"Home":case"End":case"Delete":case"Backspace":case"Tab":o=!0}e.ctrlKey&&(o=!0),o||e.preventDefault(),"Tab"===e.key&&t.close(),e.shiftKey||e.altKey||e.ctrlKey}_getMask(){const e=this,t=e.getFormattedValue(new Date(2020,10,10),{year:"numeric",month:"numeric",day:"numeric"});let o="/";t.indexOf(".")>=0?o=".":t.indexOf("-")>=0&&(o="-");const a=t.split(o);e._mask=[];let n=0;for(let t=0;t<a.length-1;t++)n+=a[t].length,e._mask[n]=o,n++}_appendPreOrPostMatch(e,t){for(var o=0,a=!1,n=0,l=e.length;n<l;n++){var r=e.charAt(n);switch(r){case"'":a?t.push("'"):o++,a=!1;break;case"\\":a&&t.push("\\"),a=!a;break;default:t.push(r),a=!1}}return o}_keyUpHandler(e){const t=this;let o=t.$.input.value.trim();const a=new Date(o);if(e.keyCode>=48&&e.keyCode<=57||e.keyCode>=96&&e.keyCode<=105){if(void 0!==t._mask[o.length]){let e=[...o],a=t._mask.flat().length,n=0;for(let a=0;a<e.length;a++)e[a]===t._mask[o.length]&&n++;n<a&&(o+=t._mask[o.length],t.$.input.value=o)}}else if(" "===e.key||"Enter"===e.key){const o=t._getInputValue();t._setInputValue(o),"Enter"===e.key&&t.opened&&t.close()}else if("/"===e.key||":"===e.key||"-"===e.key){const e=t.$.input.selectionStart,o=t._getInputValue();t._setInputValue(o),t.$.input.selectionStart=e,"/"===t.$.input.value[e]&&t.$.input.selectionStart++}if("Invalid Date"!==a.toString()?t.value=a:t.value=null,t._refreshPopup(),!e.shiftKey)switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:40===e.keyCode&&e.altKey&&(t.open(),setTimeout((()=>{t._popup.focus()}),50)),38===e.keyCode&&e.altKey&&(t.close(),t.focus());break;case 27:if(!t.opened)return;t.close(),e.stopPropagation(),e.preventDefault()}}propertyChangedHandler(e,t,o){const a=this;switch(e){case"value":"string"==typeof o?a.$.input.value=o:a._setInputValue(o);break;case"month":case"min":case"max":a.$.calendar[e]=o;break;case"theme":case"rightToLeft":case"animation":case"inverted":a.$.calendar&&(a.$.calendar[e]=o),a.$.scrollView&&(o?a.$.scrollView.setAttribute(Smart.Utilities.Core.toDash(e),"boolean"==typeof o?"":o):a.$.scrollView.removeAttribute(Smart.Utilities.Core.toDash(e)));break;case"locale":a._getMask(),a._performSelect(),a.$.calendar&&(a.$.calendar.locale=o);break;default:super.propertyChangedHandler(e,t,o)}}_createElement(){const e=this,t=document.createElement("div");if(t.classList.add("smart-input-drop-down-menu","smart-date-input-drop-down-menu"),t.setAttribute("animation",e.animation),t.setAttribute("role","presentation"),e.rightToLeft?t.setAttribute("right-to-left",""):t.removeAttribute("right-to-left"),e.inverted?t.setAttribute("inverted",""):t.removeAttribute("inverted"),t.onclick=function(t){t.stopPropagation(),t.preventDefault();const o=t.target;t.altKey?e.$.input.focus():e._popup.focus(),o.closest("smart-done-button")&&e.close()},!t.id){const e=t.tagName.toLowerCase();t.id=e.slice(0,1).toLowerCase()+e.slice(1)+Math.floor(65536*(1+Math.random())).toString(16).substring(1)}e.$.scrollView=t,e.classList.add("smart-input");const o=document.createElement("smart-calendar");if(e._popup=o,e.$.calendar=o,o.locale=e.locale,o.$.listen("keyup",(t=>{if("Enter"===t.key){e._oldValue||(e._oldValue=null);const t=o.selectedDates[0];o.value=t,e._setInputValue(t),e.$.fireEvent("change",{value:t,oldValue:e._oldValue}),e.set("value",t),e._updateTargetValue(),e._oldValue=t,e.close(),e.focus()}"Escape"===t.key&&(e.close(),e.focus()),"Tab"===t.key&&(e.close(),e.focus())})),o.onclick=t=>{e._oldValue||(e._oldValue=null);const a=o.selectedDates[0];e._setInputValue(a),e._calendarDropDownClickHandler(t),e.$.fireEvent("change",{value:a,oldValue:e._oldValue}),e.set("value",a),e._updateTargetValue(),e._oldValue=a},t.appendChild(o),e.$.input.value=e.value,e.value&&(""+e.value).length>0){const t=e._getInputValue();e._oldValue=t,e._setInputValue(t)}e._getMask()}_refreshMenu(){}_setAriaRelations(){const e=this,t=e.getAttribute("aria-label");e.readonly?(e.setAttribute("role","button"),!t&&e.placeholder&&e.setAttribute("aria-label",e.placeholder),e.removeAttribute("aria-readonly"),e.$.input.setAttribute("aria-hidden",!0),e.$.input.removeAttribute("aria-controls"),e.$.dropDownButton.setAttribute("aria-hidden",!0)):(e.setAttribute("role","presentation"),t&&t===e.placeholder&&e.removeAttribute("aria-label"),e.$.input.removeAttribute("aria-hidden"),e.$.dropDownButton.removeAttribute("aria-hidden")),e.setAttribute("aria-haspopup","dialog"),e.$.scrollView.setAttribute("role","dialog")}_setActiveDescendant(){}_setInputPurpose(){}});
1340
1340
 
1341
1341
  /***/ }),
1342
1342
 
@@ -1413,7 +1413,7 @@ Smart.Utilities.Assign("ConditionalFormatter",class{constructor(e){const t=this;
1413
1413
  /***/ 9719:
1414
1414
  /***/ (() => {
1415
1415
 
1416
- 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=e=>{const a=t[e];""!==a&&null!==a&&(l+=`${e}: ${a};`)},i=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<i.length;e++)a(i[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);return 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),l.toString(t)}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)return 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,!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){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.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)}a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),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"compact"===t.grouping.renderMode?(a.summaryRow?(n="<div header><span group></span><span value></span>",o&&(n+="<div summary>",n+=o,n+="</div>")):(n="<div header><span group>"+i+": </span><span value>"+a.label+"</span>",o&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=" ("+s+")",n+="</span>")),n+="</div>",e.classList.add("smart-grid-column-border-collapse")):"basic"===t.grouping.renderMode&&(n=a.label,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 i=o.children[0],r=o.children[1].children[0],s=o.children[1].children[1].firstChild,d=o.children[1].children[2];i.setAttribute("indent",""),a.checked?s.setAttribute("checked",""):!1===a.checked?s.removeAttribute("checked"):null===a.checked&&s.setAttribute("checked","indeterminate"),a.leaf?r.classList.add("smart-visibility-hidden"):(r.classList.remove("smart-visibility-hidden"),a.expanded?r.setAttribute("toggled",""):r.removeAttribute("toggled",""));let c="";if(!l._treeColumn||a.summaryRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;1+e===0?(c+="",i.classList.add("smart-hidden")):(c+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>',i.classList.remove("smart-hidden"))}else for(let e=0;e<a.level;e++)c+="<div class='smart-indent'></div>";void 0===a.label||a.summaryRow?r.classList.add("smart-hidden"):(r.classList.remove("smart-hidden"),r.style.marginLeft=""),i.innerHTML=c,d.innerHTML=n,t.appearance.showTooltips?d.setAttribute("title",a.label?a.label:n):d.hasAttribute("title")&&d.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&&(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||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"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.singleSelect){s+="</span>";break}s+='<span class=\'smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></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){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){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),t.classList.add("smart-flex-auto"),l.appendChild(t),l.appendChild(e),l.classList.add(a.cell.template.toLowerCase()),r=l,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),n=t.getAttribute("data-field"),r=l.getAttribute("data-id");if(i.beginEdit(r,n),a.cell.column.editor&&a.cell.column.editor.instance){const e=a.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}else r=t;a.setAttribute("template",a.cell.template.toLowerCase()),r.setAttribute("value",e);break}case"password":l.innerHTML=e?'<span class="smart-truncate">'+e.replace(/./g,"*")+"</span>":"",a.setAttribute("template",a.cell.template);break;case"color":l.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${e};"></span>`,a.setAttribute("template",a.cell.template);break;case"autoNumber":r=document.createElement("span"),r.innerHTML=1+a.cell.row.visibleIndex,a.setAttribute("template",a.cell.template);break;case"createdDate":case"createdTime":l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.createdDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.createdDate,"t")+"</span>",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"updatedDate":case"updatedTime":a.cell.row.updatedDate?l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.updatedDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.updatedDate,"t")+"</span>":l.innerHTML="",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"progress":{const t=e?parseInt(100*e)+"%":"0%";if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&t===l.firstElementChild.getAttribute("value"))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const i="white",n=["#D50000","#F4511E","#F6BF26","#33B679"];let r=n[0];r=e<.25?n[0]:e<.5?n[1]:e<.75?n[2]:n[3],l.innerHTML='<div value="'+t+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+t+';"><div title="'+t+'" style="width: 100%; height: 4px; background: '+r+"; color: "+i+';" class="smart-truncate smart-token"></div></div><span>'+t+"</span></div>",a.setAttribute("template",a.cell.template);break}case"images":{if(""===e)return l.innerHTML="",a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")){const t=l.firstElementChild.getAttribute("value");if(e&&e.indexOf(t)>=0)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild.evaluateScroll&&l.firstElementChild.evaluateScroll());if(t&&e&&Array.isArray(e)&&e[0]&&e[0].value&&t.length===e[0].value.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template)}const t=document.createElement("div"),n=document.createElement("div");t.classList.add("container"),n.classList.add("images");let o=e;if("string"==typeof o&&(o.indexOf("http")>=0||o.indexOf("base64")>=0)){let e="";if(o)try{e=JSON.parse(o)}catch(e){console.log(e)}o=e}Array.isArray(o)&&o.forEach((e=>{const l=document.createElement("img");l.src=e.value,l.title=e.label,t.appendChild(l)}));const s=document.createElement("div");s.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");if(d.classList.add("smart-arrow-right","arrowbtn"),n.onpointerdown=e=>{if("IMG"===e.target.nodeName)i._openImagePreviewDialog(e.target),e.stopPropagation(),e.preventDefault();else if("DIV"===e.target.nodeName&&e.target.classList.contains("arrowbtn")){let l=parseInt(t.style.marginLeft);isNaN(l)&&(l=0);const i=s===e.target,n=t.scrollWidth-a.offsetWidth+30;t.style.marginLeft=i?Math.min(0,l+25)+"px":Math.max(-n,l-25)+"px",l=parseInt(t.style.marginLeft),0===l?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),e.stopPropagation(),e.preventDefault()}},t.children.length){n.appendChild(t);const e=25*o.length;e-a.offsetWidth+30>30&&(n.appendChild(s),n.appendChild(d)),n.evaluateScroll=()=>{const l=e-a.offsetWidth+30;t.style.marginLeft="0px",s.classList.add("smart-hidden"),l<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),l>30&&(n.appendChild(s),n.appendChild(d))},r=n}else r=document.createElement("div");a.setAttribute("template",a.cell.template),e&&e[0]&&e[0].value?r.setAttribute("value",e[0].value):o&&o[0]&&o[0].label?r.setAttribute("value",o[0].label):r.setAttribute("value",e);break}case"email":Smart.Validator&&(r=document.createElement("span"),Smart.Validator.email(e)?r.innerHTML=e:(r.className="url",r.innerHTML='<a href="mailto:'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()})),a.setAttribute("template",a.cell.template);break;case"url":Smart.Validator&&(r=document.createElement("span"),r.className="url",Smart.Validator.url(e)?r.innerHTML='<a href="https://'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>":r.innerHTML='<a href="'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()}),a.setAttribute("template",a.cell.template);break;default:{let t=null;a.setAttribute("template","");const r=a.cell.row,o=l;let s=a.cell.getFormattedValue(e,n.cellsFormat);if(o.style.lineHeight="","function"==typeof a.cell.template){const t={row:r,column:n,cell:a.cell,oldValue:a.cell.oldValue,value:e,template:null};let l=o.querySelector(".smart-grid-cell-template");l&&l.getAttribute("column")===n.dataField?t.template=l.firstElementChild:l=null,a.formattedValue!==s&&(l=null),a.cell.canNotify=!1,r.canNotify=!1;const i=Object.assign({},{background:a.cell.background,color:a.cell.color,fontSize:a.cell.fontSize,fontFamily:a.cell.fontFamily,fontWeight:a.cell.fontWeight,textDecoration:a.cell.textDecoration,fontStyle:a.cell.fontStyle});if(a.cell.template(t),!l&&t.template)if(t.template instanceof HTMLElement){const e=document.createElement("div");e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),o.innerHTML="",o.appendChild(e),e.appendChild(t.template)}else o.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+t.template+"</div>";else l||null!==t.template||(o.innerHTML=e);o.style.background===i.background&&o.style.color===i.color&&o.style.fontSize===i.fontSize&&o.style.fontWeight===i.fontWeight&&o.style.fontStyle===i.fontStyle||(a.cell._styleChanged=!0,a.cell._setStyle(o)),a.cell.background!==i.background||a.cell.color!==i.color||a.cell.fontSize!==i.fontSize||a.cell.fontWeight!==i.fontWeight||a.cell.fontStyle!==i.fontStyle?(a.cell._styleChanged=!0,a.cell._setStyle(o)):a.cell._styleChanged&&a.cell._setStyle(o),void 0===a.cell.oldValue&&(a.cell.oldValue=e),a.formattedValue=s,a.cell.canNotify=!0,r.canNotify=!0}else{if(""!==o.textContent&&(o.textContent=""),a.cell.template instanceof HTMLTemplateElement)t=a.cell.template;else if(a.cell.template instanceof HTMLElement){const t=a.cell.template.innerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);o.innerHTML!==t&&(o.innerHTML=t)}if(a.cell.template.startsWith&&a.cell.template.startsWith("#")&&(t=document.querySelector(a.cell.template)),t){let l=t.content.cloneNode(!0).firstElementChild;const d=e;if(e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),l.querySelector("[smart-if]")){const t=l.querySelector("[smart-else]"),a=l.querySelectorAll("[smart-if]");let i=!1;for(let t=0;t<a.length;t++){const r=a[t],o=r.getAttribute("smart-if").split(" "),s=o[1].trim();let c=o[2].trim(),m=e;switch("Today"===c&&(c=new Date),"date"===n.dataType&&(e=new Date(d).getTime(),c=new Date(c).getTime()),s){case">":e>parseFloat(c)&&(l=r,i=!0);break;case">=":e>=parseFloat(c)&&(l=r,i=!0);break;case"=":case"==":case"===":e===c&&(l=r,i=!0);break;case"<":e<parseFloat(c)&&(l=r,i=!0);break;case"<=":e<=parseFloat(c)&&(l=r,i=!0)}if(e=m,i)break}!i&&t&&(l=t)}let c=l.outerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);for(c.indexOf("{{value=")>=0&&(e?(c=c.substring(0,c.indexOf("{{value="))+e+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const t=c.indexOf("{{value::"),l=c.substring(t+9,c.indexOf("}}")),i=a.cell.getFormattedValue(e,l);c=c.replace(`{{value::${l}}}`,i)}if(n._treeColumn){const e=o.firstChild;if(e&&e.classList&&a.toggleButton&&n._treeColumn&&o.children[1]){const e=o.children[0],t=o.children[1].children[0],l=o.children[1].children[1].firstChild,a=o.children[1].children[2];let n="";if(i.grouping.enabled)n+='<div style="width: '+(r.level-1+1)*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.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)}}}}}if(r)return l.innerHTML="",l.appendChild(r),a.cell._setStyle(l),r}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,n=a._isMeasureRow?null:l.cellsFormat;if(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=""}if(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?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button");let r=l.displayField?i[l.displayField]:i[l.dataField];null!==r||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(r=0),"string"===l.dataType&&(r=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(r=!1),"date"===l.dataType&&(r=new Date)),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row");const o=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&&(o(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]&&o(t.highlightedCells[a.id][l.dataField]),t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]&&o(t.highlightedRows[a.id]),t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),r=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell),e.cell._updating=!1,r=e.cell.value),void 0===r&&(r="");let s=r;n&&(s=e.cell.getFormattedValue(r,n));const d=e.firstChild;if(l._isDirty&&(d.innerHTML=""),d.hasAttribute("data-field")&&d.getAttribute("data-field")!==l.dataField&&(d.innerHTML=""),d.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];d.firstChild&&d.removeChild(d.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?d.appendChild(t):d.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell):l.onCellRender(e.cell),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return d.firstChild&&d.removeChild(d.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void d.appendChild(t)}e.cell.value!==r&&(s=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"),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 if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const c=e._getCellAlignment(a,l),m=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let u="";if(c.align&&(u+=c.align+" "),c.verticalAlign&&(u+=c.verticalAlign+" "),l.cellsWrap&&(u+="wrap "),u+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t._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",""),u+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command",""),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze","")),l.cellsRotationAngle){if(!e._rotateCellContent(d,l,r))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(d));d.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)d.innerHTML="";else if(l.autoGenerated&&(d.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let n in a){const r=l.cellsFormat;let 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> `}d.innerHTML!==o&&(d.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> `;d.innerHTML!==l&&(d.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value" ><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;d.innerHTML!==e&&(d.innerHTML=e)}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?d.firstElementChild.setAttribute("has-summary",""):d.firstElementChild.removeAttribute("has-summary"),d.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),d._clickTarget=e.target},d.onpointerup=l=>{d._clickTarget===l.target&&(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="";if(l=a.showDetail?'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggled toggle-button></button>':'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggle-button></button>',t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,d.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):d.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(d.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else d.innerHTML!==l&&(d.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)d.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let n="";for(let e=0;e<t;e++)n+="A";return n+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?d.textContent="":d.textContent=l(a)}else if(m)if(e.removeAttribute("readonly"),a._isMeasureRow)d.innerHTML=r;else switch(e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(r,e.cell.template,d);break;case"tags":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(r,e.cell.template,d);break;case"image":e._setTemplate(r,"images",d);break;case"email":e._setTemplate(r,"email",d);break;case"url":e._setTemplate(r,"url",d);break;default:e._setTemplate(r,e.cell.template,d)}else if(l.selectionColumn)"checkBox"===t.selectionMode&&(a.getProperty("selected")?(e.setAttribute("selected",""),e.element.setAttribute("aria-selected",!0)):e.getAttribute("selected")&&(e.removeAttribute("selected"),e.element.removeAttribute("aria-selected")));else{const i=d.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&d.children[1]){const e=d.children[0],i=d.children[1].children[0],n=d.children[1].children[1].firstChild,r=d.children[1].children[2];let o="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?o="":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(d)}}a.allowCheck?t.checkBoxes.visible?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden"):t.checkBoxes.visible||n.classList.add("smart-hidden"),e.innerHTML=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=s,t.appearance.showTooltips?r.setAttribute("title",s):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}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}1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width="",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===i.rowSpan&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),d.textContent===s||l.formatFunction||(d.textContent=s),i.column.autoGenerated||i._setStyle(d),t.appearance.showTooltips?d.setAttribute("title",i.tooltip||s):d.hasAttribute("title")&&d.removeAttribute("title")}else d.textContent=s}}if(d.className!==u&&(d.className=u),t.appearance.displayLoadingIndicator&&!l.autoGenerated?(a.element.removeAttribute("focus"),d.innerHTML='<div class="smart-grid-cell-loading"></div>'):!l.autoGenerated&&d.firstChild&&d.firstChild.classList&&d.firstChild.classList.contains("smart-grid-cell-loading")&&d.firstChild.classList.remove("smart-grid-cell-loading"),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const t={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:r,formattedValue:s,template:null};e.cell.canNotify=!1,a.canNotify=!1;const i=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});await l.formatFunction(t),d.style.background===i.background&&d.style.color===i.color&&d.style.fontSize===i.fontSize&&d.style.fontFamily===i.fontFamily&&d.style.textDecoration===i.textDecoration&&d.style.fontWeight===i.fontWeight&&d.style.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(d)),e.cell.background===i.background&&e.cell.color===i.color&&e.cell.fontSize===i.fontSize&&e.cell.fontWeight===i.fontWeight&&e.cell.textDecoration===i.textDecoration&&e.cell.fontFamily===i.fontFamily&&e.cell.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(d));let n=!0;if(t.value!==r&&(e.toggleButton?d.children[1].children[2].innerHTML=t.value:d.innerHTML=t.value,n=!1),null!==t.template){if(e.toggleButton){const e=d.children[1].children[2];e.innerHTML!==t.template&&(e.innerHTML=t.template)}else if(d.innerHTML!==t.template){const e=document.createElement("div");e.innerHTML=t.template,e.innerHTML!==d.innerHTML&&(d.innerHTML=t.template)}n=!1}n&&(l.cellsFormat?d.textContent=s:d.textContent=r),e.cell.canNotify=!0,a.canNotify=!0}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,d),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&d.querySelector("[toggle-button]")){const e=d.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),n=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),n.appendChild(l),n.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(n),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const n=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-n.top+"px",i.style.left=a._offsetLeft(l)-n.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,n=e.row,r=e.row.index,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()}});
1416
+ 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=e=>{const a=t[e];""!==a&&null!==a&&(l+=`${e}: ${a};`)},i=["background","color","fontSize","fontFamily","fontWeight","fontStyle","textDecoration"];for(let e=0;e<i.length;e++)a(i[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);return 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),l.toString(t)}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)return 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,!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){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.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)}a.label||"taskStatus"!==a.groupDataField||(e=t.localize("uncategorized")),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"compact"===t.grouping.renderMode?(a.summaryRow?(n="<div header><span group></span><span value></span>",o&&(n+="<div summary>",n+=o,n+="</div>")):(n="<div header><span group>"+i+": </span><span value>"+a.label+"</span>",o&&t.grouping.summaryRow.inline&&(n+="<span summary>",n+=" ("+s+")",n+="</span>")),n+="</div>",e.classList.add("smart-grid-column-border-collapse")):"basic"===t.grouping.renderMode&&(n=a.label,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 i=o.children[0],r=o.children[1].children[0],s=o.children[1].children[1].firstChild,d=o.children[1].children[2];i.setAttribute("indent",""),a.checked?s.setAttribute("checked",""):!1===a.checked?s.removeAttribute("checked"):null===a.checked&&s.setAttribute("checked","indeterminate"),a.leaf?r.classList.add("smart-visibility-hidden"):(r.classList.remove("smart-visibility-hidden"),a.expanded?r.setAttribute("toggled",""):r.removeAttribute("toggled",""));let c="";if(!l._treeColumn||a.summaryRow?e.toggleButton.classList.add("smart-hidden"):e.toggleButton.classList.remove("smart-hidden"),l._treeColumn)if(t.grouping.enabled){let e=a.level-1;1+e===0?(c+="",i.classList.add("smart-hidden")):(c+='<div style="width: '+(1+e)*t.grouping.groupIndent+'px;"></div>',i.classList.remove("smart-hidden"))}else for(let e=0;e<a.level;e++)c+="<div class='smart-indent'></div>";void 0===a.label||a.summaryRow?r.classList.add("smart-hidden"):(r.classList.remove("smart-hidden"),r.style.marginLeft=""),i.innerHTML=c,d.innerHTML=n,t.appearance.showTooltips?d.setAttribute("title",a.label?a.label:n):d.hasAttribute("title")&&d.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&&(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||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"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.singleSelect){s+="</span>";break}s+='<span class=\'smart-drop-down-list-unselect-button\' role="button" aria-label="Unselect"></span></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){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){const e=document.createElement("span");e.classList.add("smart-arrow-down","arrowbtn");const l=document.createElement("div");l.classList.add("smart-multi-combo-input-container","tokens","smart-flex-auto"),t.classList.add("smart-flex-auto"),l.appendChild(t),l.appendChild(e),l.classList.add(a.cell.template.toLowerCase()),r=l,e.onpointerdown=e=>{if(i.editing.enabled){const t=e.target.closest("smart-grid-cell"),l=e.target.closest("smart-grid-row"),n=t.getAttribute("data-field"),r=l.getAttribute("data-id");if(i.beginEdit(r,n),a.cell.column.editor&&a.cell.column.editor.instance){const e=a.cell.column.editor,t=e.instance.element;!e.autoOpen&&t.open?t.open():!e.autoOpen&&t.firstElementChild&&t.firstElementChild.open&&setTimeout((()=>{t.firstElementChild.open()}),250)}}e.stopPropagation(),e.preventDefault()}}else r=t;a.setAttribute("template",a.cell.template.toLowerCase()),r.setAttribute("value",e);break}case"password":l.innerHTML=e?'<span class="smart-truncate">'+e.replace(/./g,"*")+"</span>":"",a.setAttribute("template",a.cell.template);break;case"color":l.innerHTML=`<span style="left: calc(50% - 12px); top: calc(50% - 12px); position: absolute; border-radius: 50%; width: 24px; height: 24px; display: block; background:${e};"></span>`,a.setAttribute("template",a.cell.template);break;case"autoNumber":r=document.createElement("span"),r.innerHTML=1+a.cell.row.visibleIndex,a.setAttribute("template",a.cell.template);break;case"createdDate":case"createdTime":l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.createdDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.createdDate,"t")+"</span>",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"updatedDate":case"updatedTime":a.cell.row.updatedDate?l.innerHTML='<span class="smart-truncate">'+a.cell.getFormattedValue(a.cell.row.updatedDate,"d")+" "+a.cell.getFormattedValue(a.cell.row.updatedDate,"t")+"</span>":l.innerHTML="",a.cell._setStyle(l),a.setAttribute("template",a.cell.template);break;case"progress":{const t=e?parseInt(100*e)+"%":"0%";if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")&&t===l.firstElementChild.getAttribute("value"))return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);const i="white",n=["#D50000","#F4511E","#F6BF26","#33B679"];let r=n[0];r=e<.25?n[0]:e<.5?n[1]:e<.75?n[2]:n[3],l.innerHTML='<div value="'+t+'" style="padding-left: 5px; padding-right: 5px; display: grid; grid-template-columns: 1fr auto"><div style="height: 100%; display: flex; align-items: center; width: '+t+';"><div title="'+t+'" style="width: 100%; height: 4px; background: '+r+"; color: "+i+';" class="smart-truncate smart-token"></div></div><span>'+t+"</span></div>",a.setAttribute("template",a.cell.template);break}case"images":{if(""===e)return l.innerHTML="",a.cell._setStyle(l),void a.setAttribute("template",a.cell.template);if(l.firstElementChild&&l.firstElementChild.hasAttribute("value")){const t=l.firstElementChild.getAttribute("value");if(e&&e.indexOf(t)>=0)return a.cell._setStyle(l),a.setAttribute("template",a.cell.template),void(l.firstElementChild.evaluateScroll&&l.firstElementChild.evaluateScroll());if(t&&e&&Array.isArray(e)&&e[0]&&e[0].value&&t.length===e[0].value.length)return a.cell._setStyle(l),void a.setAttribute("template",a.cell.template)}const t=document.createElement("div"),n=document.createElement("div");t.classList.add("container"),n.classList.add("images");let o=e;if("string"==typeof o&&(o.indexOf("http")>=0||o.indexOf("base64")>=0)){let e="";if(o)try{e=JSON.parse(o)}catch(e){console.log(e)}o=e}Array.isArray(o)&&o.forEach((e=>{const l=document.createElement("img");l.src=e.value,l.title=e.label,t.appendChild(l)}));const s=document.createElement("div");s.classList.add("smart-arrow-left","arrowbtn","smart-hidden");const d=document.createElement("div");if(d.classList.add("smart-arrow-right","arrowbtn"),n.onpointerdown=e=>{if("IMG"===e.target.nodeName)i._openImagePreviewDialog(e.target),e.stopPropagation(),e.preventDefault();else if("DIV"===e.target.nodeName&&e.target.classList.contains("arrowbtn")){let l=parseInt(t.style.marginLeft);isNaN(l)&&(l=0);const i=s===e.target,n=t.scrollWidth-a.offsetWidth+30;t.style.marginLeft=i?Math.min(0,l+25)+"px":Math.max(-n,l-25)+"px",l=parseInt(t.style.marginLeft),0===l?s.classList.add("smart-hidden"):s.classList.remove("smart-hidden"),e.stopPropagation(),e.preventDefault()}},t.children.length){n.appendChild(t);const e=25*o.length;e-a.offsetWidth+30>30&&(n.appendChild(s),n.appendChild(d)),n.evaluateScroll=()=>{const l=e-a.offsetWidth+30;t.style.marginLeft="0px",s.classList.add("smart-hidden"),l<0?d.classList.add("smart-hidden"):d.classList.remove("smart-hidden"),l>30&&(n.appendChild(s),n.appendChild(d))},r=n}else r=document.createElement("div");a.setAttribute("template",a.cell.template),e&&e[0]&&e[0].value?r.setAttribute("value",e[0].value):o&&o[0]&&o[0].label?r.setAttribute("value",o[0].label):r.setAttribute("value",e);break}case"email":Smart.Validator&&(r=document.createElement("span"),Smart.Validator.email(e)?r.innerHTML=e:(r.className="url",r.innerHTML='<a href="mailto:'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()})),a.setAttribute("template",a.cell.template);break;case"url":Smart.Validator&&(r=document.createElement("span"),r.className="url",Smart.Validator.url(e)?r.innerHTML='<a href="https://'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>":r.innerHTML='<a href="'+e+'" target="_blank" contenteditable="false" rel="noreferrer noopener">'+e+"</a>",r.firstElementChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault(),r.firstElementChild.click()}),a.setAttribute("template",a.cell.template);break;default:{let t=null;a.setAttribute("template","");const r=a.cell.row,o=l;let s=a.cell.getFormattedValue(e,n.cellsFormat);if(o.style.lineHeight="","function"==typeof a.cell.template){const t={row:r,column:n,cell:a.cell,oldValue:a.cell.oldValue,value:e,template:null};let l=o.querySelector(".smart-grid-cell-template");l&&l.getAttribute("column")===n.dataField?t.template=l.firstElementChild:l=null,a.formattedValue!==s&&(l=null),a.cell.canNotify=!1,r.canNotify=!1;const i=Object.assign({},{background:a.cell.background,color:a.cell.color,fontSize:a.cell.fontSize,fontFamily:a.cell.fontFamily,fontWeight:a.cell.fontWeight,textDecoration:a.cell.textDecoration,fontStyle:a.cell.fontStyle});if(a.cell.template(t),!l&&t.template)if(t.template instanceof HTMLElement){const e=document.createElement("div");e.classList.add("smart-grid-cell-template"),e.setAttribute("column",n.dataField),o.innerHTML="",o.appendChild(e),e.appendChild(t.template)}else o.innerHTML='<div column="'+n.dataField+'" class="smart-grid-cell-template">'+t.template+"</div>";else l||null!==t.template||(o.innerHTML=e);o.style.background===i.background&&o.style.color===i.color&&o.style.fontSize===i.fontSize&&o.style.fontWeight===i.fontWeight&&o.style.fontStyle===i.fontStyle||(a.cell._styleChanged=!0,a.cell._setStyle(o)),a.cell.background!==i.background||a.cell.color!==i.color||a.cell.fontSize!==i.fontSize||a.cell.fontWeight!==i.fontWeight||a.cell.fontStyle!==i.fontStyle?(a.cell._styleChanged=!0,a.cell._setStyle(o)):a.cell._styleChanged&&a.cell._setStyle(o),void 0===a.cell.oldValue&&(a.cell.oldValue=e),a.formattedValue=s,a.cell.canNotify=!0,r.canNotify=!0}else{if(""!==o.textContent&&(o.textContent=""),a.cell.template instanceof HTMLTemplateElement)t=a.cell.template;else if(a.cell.template instanceof HTMLElement){const t=a.cell.template.innerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);o.innerHTML!==t&&(o.innerHTML=t)}if(a.cell.template.startsWith&&a.cell.template.startsWith("#")&&(t=document.querySelector(a.cell.template)),t){let l=t.content.cloneNode(!0).firstElementChild;const d=e;if(e=(e=(e=e.toString()).replace(/'/gi,"\\'")).replace(/"/gi,'\\"'),l.querySelector("[smart-if]")){const t=l.querySelector("[smart-else]"),a=l.querySelectorAll("[smart-if]");let i=!1;for(let t=0;t<a.length;t++){const r=a[t],o=r.getAttribute("smart-if").split(" "),s=o[1].trim();let c=o[2].trim(),m=e;switch("Today"===c&&(c=new Date),"date"===n.dataType&&(e=new Date(d).getTime(),c=new Date(c).getTime()),s){case">":e>parseFloat(c)&&(l=r,i=!0);break;case">=":e>=parseFloat(c)&&(l=r,i=!0);break;case"=":case"==":case"===":e===c&&(l=r,i=!0);break;case"<":e<parseFloat(c)&&(l=r,i=!0);break;case"<=":e<=parseFloat(c)&&(l=r,i=!0)}if(e=m,i)break}!i&&t&&(l=t)}let c=l.outerHTML.replace(/{{value}}/gi,e).replace(/{{id}}/gi,r.id);for(c.indexOf("{{value=")>=0&&(e?(c=c.substring(0,c.indexOf("{{value="))+e+c.substring(c.indexOf("}")),c=c.replace(/}/gi,""),c=c.replace(/{/gi,"")):(c=c.replace(/{{value=/gi,""),c=c.replace(/}}/gi,"")));c.indexOf("{{value::")>=0;){const t=c.indexOf("{{value::"),l=c.substring(t+9,c.indexOf("}}")),i=a.cell.getFormattedValue(e,l);c=c.replace(`{{value::${l}}}`,i)}if(n._treeColumn){const e=o.firstChild;if(e&&e.classList&&a.toggleButton&&n._treeColumn&&o.children[1]){const e=o.children[0],t=o.children[1].children[0],l=o.children[1].children[1].firstChild,a=o.children[1].children[2];let n="";if(i.grouping.enabled)n+='<div style="width: '+(r.level-1+1)*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.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)}}}}}if(r)return l.innerHTML="",l.appendChild(r),a.cell._setStyle(l),r}async _render(){const e=this,t=e.cell.grid,l=e.cell.column,a=e.cell.row,i=a.data,n=a._isMeasureRow?null:l.cellsFormat;if(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=""}if(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?l.sorted?e.setAttribute("sort",""):e.removeAttribute("sort"):l.sorted&&e.hasAttribute("sort")&&e.removeAttribute("sort"),t.appearance.showFilterColumnBackground?l.filtered?e.setAttribute("filter",""):e.removeAttribute("filter"):l.filtered&&e.hasAttribute("filter")&&e.removeAttribute("filter"),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&!l._treeColumn&&e.removeAttribute("has-toggle-button");let r=l.displayField?i[l.displayField]:i[l.dataField];null!==r||l.allowNull||("int"!==l.dataType&&"number"!==l.dataType||(r=0),"string"===l.dataType&&(r=""),"boolean"!==l.dataType&&"bool"!==l.dataType||(r=!1),"date"===l.dataType&&(r=new Date)),e.removeAttribute("highlight"),t.highlighted!==a.id||l.autoGenerated||e.setAttribute("highlight",""),t.editing.addNewRow.visible&&e.classList.remove("smart-add-new-row");const o=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&&(o(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]&&o(t.highlightedCells[a.id][l.dataField]),t.highlightedRows&&!a.summaryRow&&void 0!==t.highlightedRows[a.id]&&o(t.highlightedRows[a.id]),t.editing.batch){if(t._cellsUpdatedValues){e.removeAttribute("update");const i=t._cellsUpdatedValues[a.id+"_"+l.dataField];void 0!==i&&(e.setAttribute("update",""),r=i)}t._rowsDeleted&&(t._rowsDeleted.indexOf(a.id)>=0?e.setAttribute("delete",""):e.removeAttribute("delete")),t._rowsAdded&&(t._rowsAdded.indexOf(a.id)>=0?e.setAttribute("add",""):e.removeAttribute("add"))}!t.onCellValue||l.rowHeaderColumn||l.selectionColumn||(e.cell._updating=!0,t.onCellValue(e.cell),e.cell._updating=!1,r=e.cell.value),void 0===r&&(r="");let s=r;n&&(s=e.cell.getFormattedValue(r,n));const d=e.firstChild;if(l._isDirty&&(d.innerHTML=""),d.hasAttribute("data-field")&&d.getAttribute("data-field")!==l.dataField&&(d.innerHTML=""),d.setAttribute("data-field",l.dataField),t.onCellRender||l.onCellRender)if(l._cellsCachedValues||(l._cellsCachedValues=[]),l._cellsCachedValues[a.index]){const t=l._cellsCachedValues[a.index];d.firstChild&&d.removeChild(d.firstChild),e.cell.template instanceof HTMLTemplateElement||"string"==typeof e.cell.template?d.appendChild(t):d.innerHTML=t.innerHTML}else{if(e.cell._updating=!0,t.onCellRender?t.onCellRender(e.cell):l.onCellRender(e.cell),e.cell._updating=!1,e.cell.template!==l.template){const t=document.createElement("div");return d.firstChild&&d.removeChild(d.firstChild),e.cell.template instanceof HTMLTemplateElement?(t.appendChild(e.cell.template.content.cloneNode(!0)),l._cellsCachedValues[a.index]=t):t.appendChild(e.cell.template),void d.appendChild(t)}e.cell.value!==r&&(s=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"),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 if(e._classNames)for(let t=0;t<e._classNames.length;t++)e.classList.remove(e._classNames[t]);t.rowDetail.enabled&&a.showDetail&&!1===t.rowDetail.dialog.enabled&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px"),a.expanded&&a.expandHeight>0&&(e.style.height=a.cellHeight+"px",e.style.lineHeight=a.cellHeight+"px");const c=e._getCellAlignment(a,l),m=""!==e.cell.template&&t.isInitialized&&!a._isMeasureRow;let u="";if(c.align&&(u+=c.align+" "),c.verticalAlign&&(u+=c.verticalAlign+" "),l.cellsWrap&&(u+="wrap "),u+="smart-label",e.style.width!==l.computedWidth+"px"){const a=t._isLastVisibleColumn(l);l.autoGenerated||a?e.style.width=l.computedWidth+"px":e.style.width=l.computedWidth-t._columnGap+"px"}l===t._firstVisibleColumn?e.classList.add("smart-grid-column-border-collapse"):e.classList.remove("smart-grid-column-border-collapse"),t._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",""),u+=" smart-input",l.grid.selection.checkBoxes.enabled&&l.grid.selection.checkBoxes.autoShow?e.setAttribute("auto-show",""):e.removeAttribute("auto-show")),(l.rowHeaderColumn||l.selectionColumn)&&(e.setAttribute("header",""),e.setAttribute("role","rowheader")),l.rowDetailColumn&&(e.setAttribute("header",""),e.setAttribute("detail",""),e.setAttribute("has-toggle-button",""),e.classList.add("smart-grid-column-border-collapse")),l.commandColumn&&e.setAttribute("command",""),t.appearance.showFrozenColumnBackground&&l.freeze&&e.setAttribute("freeze",""),t.appearance.showFrozenRowBackground&&a.freeze&&e.setAttribute("freeze","")),l.cellsRotationAngle){if(!e._rotateCellContent(d,l,r))return}else if(a.filterRow){if(!l.toggleColumn&&!l.rowHeaderColumn)return t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&(l._filterEditorInitialized=!1),l._filterEditorInitialized||l.autoGenerated?void("boolean"===l.dataType||"bool"===l.dataType?e.setAttribute("template","checkBox"):e.removeAttribute("template")):(l._filterEditorInitialized=!0,void e._renderFilterCell(d));d.innerHTML=""}else if(a.summaryRow){if(l.toggleColumn||l.rowHeaderColumn)d.innerHTML="";else if(l.autoGenerated&&(d.innerHTML=""),t.dataSource.boundHierarchy&&e.hasAttribute("has-toggle-button")&&e.removeAttribute("has-toggle-button"),!l.autoGenerated){if(l.summary.length>0&&t._summaryItems){const a=t._summaryItems[l.dataField],i=[];for(let n in a){const r=l.cellsFormat;let 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> `}d.innerHTML!==o&&(d.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> `;d.innerHTML!==l&&(d.innerHTML=l)}else{const e=`<div class="smart-truncate summary-value" ><span class="smart-summary-placeholder label">${t.localize("summary")}</span><span class="smart-arrow-down"></span></div> `;d.innerHTML!==e&&(d.innerHTML=e)}t.summaryRow.editing&&l.allowSummary&&(t._selection&&t._selection.focusedCell&&t._selection.focusedCell.dataField===l.dataField?d.firstElementChild.setAttribute("has-summary",""):d.firstElementChild.removeAttribute("has-summary"),d.onpointerdown=e=>{e.preventDefault(),e.stopPropagation(),d._clickTarget=e.target},d.onpointerup=l=>{d._clickTarget===l.target&&(l.preventDefault(),l.stopPropagation(),t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.dataField===e.cell.column.dataField?t._summaryRowDialog.confirm():t._openSummaryRowDialog(e.cell,(()=>{})))})}}else if(t.rowDetail.enabled&&l.rowDetailColumn){let l="";if(l=a.showDetail?'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggled toggle-button></button>':'<button tabindex="-1" class="smart-visibility-hidden smart-animate" toggle-button></button>',t.appearance.showRowStatus){l=a._style&&a._style.status?`<span class="row-status custom" style = "color: ${a._style.status};" ></span> `+l:'<span class="row-status"></span>'+l,d.innerHTML===l||a.element.star?(a.element.star.classList.remove("smart-hidden"),a.element.star.classList.remove("custom"),a._style&&a._style.status?(a.element.star.style.color=a._style.status,a.element.star.classList.add("custom")):a.element.star.style.color=""):d.innerHTML=l;const i=()=>{if(a.comments&&a.comments.length>0){const e=a.comments.length;a.element.star.classList.add("comments"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})+", "+e+" "+t.localize("comments"))}else a.comments&&0===a.comments.length&&a.element.star.classList.remove("comments")};a.element.star=e.querySelector("span"),a.element.star||(d.innerHTML=l,a.element.star=e.querySelector("span")),a.element.star.onpointerdown=e=>{a.canNotify=!1,a.starred=!a.starred,a.canNotify=!0,a.data.$&&(a.data.$.starred=a.starred),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),i(),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("rowStarred",{id:a.id,originalEvent:e,row:a,value:a.starred})},a.element.star.setAttribute("title",t.localize(a.starred?"starred":"notStarred",{elementType:"Grid"})),a.starred?a.element.star.classList.add("starred"):a.element.star.classList.remove("starred"),i()}else d.innerHTML!==l&&(d.innerHTML=l);if(a.element.toggleDetailButton=e.querySelector("button"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),(t.rowDetail.template||t.onRowDetailInit)&&a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),a.comments&&a.comments.length>0){const e=a.comments.length;a.element.toggleDetailButton.classList.remove("smart-visibility-hidden"),t.appearance.showRowStatus?a.element.toggleDetailButton.querySelector(".comments-length")?a.element.toggleDetailButton.querySelector(".comments-length").innerHTML=e:a.element.toggleDetailButton.innerHTML+=`<div class="comments-length'>${e}</div>`:a.element.toggleDetailButton.innerHTML=`<div class="comments-length'>${e}</div>`,a.starred&&a.element.toggleDetailButton.classList.add("starred"),a.element.toggleDetailButton.classList.add("row-comments"),a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRowComments",{value:e,elementType:"Grid"}))}else a.comments&&0===a.comments.length&&a.element.toggleDetailButton.classList.remove("row-comments");t.rowDetail.dialog.enabled&&a.element.toggleDetailButton.classList.add("row-detail")}else if(l.commandColumn)e._renderCommands();else if(t.appearance.showRowHeaderNumber&&l.rowHeaderColumn)if(a.addNewRow)d.textContent="";else{const l=l=>{if(e.cell.value)return e.cell.value;if("number"===t.appearance.autoGenerateRowLabelMode)return l.visibleIndex+1;{const e=l.visibleIndex%26,t=Math.floor(l.visibleIndex/26),a="A".charCodeAt(0),i=String.fromCharCode(a+e);let n="";for(let e=0;e<t;e++)n+="A";return n+i}};t._rowsAdded&&t._rowsAdded.indexOf(a.id)>=0?d.textContent="":d.textContent=l(a)}else if(m)if(e.removeAttribute("readonly"),t.appearance.displayLoadingIndicator&&!l.autoGenerated)d.innerHTML='<div class="smart-grid-cell-loading"></div>';else if(a._isMeasureRow)d.innerHTML=r;else switch(e.cell.template){case"checkBox":case"switchButton":case"radioButton":e._setTemplate(r,e.cell.template,d);break;case"tags":case"collaborator":case"updatedBy":case"createdBy":case"multiComboInput":e._setTemplate(r,e.cell.template,d);break;case"image":e._setTemplate(r,"images",d);break;case"email":e._setTemplate(r,"email",d);break;case"url":e._setTemplate(r,"url",d);break;default:e._setTemplate(r,e.cell.template,d)}else{const i=d.firstChild;if(i&&i.classList&&e.toggleButton&&l._treeColumn&&d.children[1]){const e=d.children[0],i=d.children[1].children[0],n=d.children[1].children[1].firstChild,r=d.children[1].children[2];let o="";if(l._treeColumn){if(t.grouping.enabled){let e=a.level-1;t.appearance.showRowHeaderNumber&&e--,t.rowDetail.enabled&&e--,e<-1?o="":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(d)}}a.allowCheck?t.checkBoxes.visible?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden"):t.checkBoxes.visible||n.classList.add("smart-hidden"),e.innerHTML=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=s,t.appearance.showTooltips?r.setAttribute("title",s):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}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}1===i.colSpan&&e.hasAttribute("colspan")&&(e.style.width="",e.removeAttribute("colspan"),e.removeAttribute("aria-colspan"),i._styleChanged=!0),e.hasAttribute("rowspan")&&1===i.rowSpan&&(e.style.height="",e.removeAttribute("rowspan"),e.removeAttribute("aria-rowspan"),i._styleChanged=!0),d.textContent===s||l.formatFunction||(d.textContent=s),i.column.autoGenerated||i._setStyle(d),t.appearance.showTooltips?d.setAttribute("title",i.tooltip||s):d.hasAttribute("title")&&d.removeAttribute("title")}else d.textContent=s}}if(d.className!==u&&(d.className=u),!t.appearance.displayLoadingIndicator||l.autoGenerated||t.dataSource.boundHierarchy?t.appearance.displayLoadingIndicator&&l.selectionColumn?e.removeAttribute("selected"):!l.autoGenerated&&d.firstChild&&d.firstChild.classList&&d.firstChild.classList.contains("smart-grid-cell-loading")&&(d.firstChild.classList.remove("smart-grid-cell-loading"),e.removeAttribute("selected")):(a.element.removeAttribute("focus"),e.removeAttribute("selected"),d.innerHTML='<div class="smart-grid-cell-loading"></div>'),l.formatFunction&&!a.data.isEmpty&&t.isInitialized&&!a.summaryRow){const t={row:a,column:l,cell:e.cell,oldValue:e.cell.oldValue,value:r,formattedValue:s,template:null};e.cell.canNotify=!1,a.canNotify=!1;const i=Object.assign({},{background:e.cell.background,color:e.cell.color,fontSize:e.cell.fontSize,fontFamily:e.cell.fontFamily,textDecoration:e.cell.textDecoration,fontWeight:e.cell.fontWeight,fontStyle:e.cell.fontStyle});await l.formatFunction(t),d.style.background===i.background&&d.style.color===i.color&&d.style.fontSize===i.fontSize&&d.style.fontFamily===i.fontFamily&&d.style.textDecoration===i.textDecoration&&d.style.fontWeight===i.fontWeight&&d.style.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(d)),e.cell.background===i.background&&e.cell.color===i.color&&e.cell.fontSize===i.fontSize&&e.cell.fontWeight===i.fontWeight&&e.cell.textDecoration===i.textDecoration&&e.cell.fontFamily===i.fontFamily&&e.cell.fontStyle===i.fontStyle||(e.cell._styleChanged=!0,e.cell._setStyle(d));let n=!0;if(t.value!==r&&(e.toggleButton?d.children[1].children[2].innerHTML=t.value:d.innerHTML=t.value,n=!1),null!==t.template){if(e.toggleButton){const e=d.children[1].children[2];e.innerHTML!==t.template&&(e.innerHTML=t.template)}else if(d.innerHTML!==t.template){const e=document.createElement("div");e.innerHTML=t.template,e.innerHTML!==d.innerHTML&&(d.innerHTML=t.template)}n=!1}n&&(l.cellsFormat?d.textContent=s:d.textContent=r),e.cell.canNotify=!0,a.canNotify=!0}if(!a.data.isEmpty&&t.isInitialized&&e._applyConditionalFormattingToCell(e.cell,t,d),t.grouping.enabled&&t.dataSource&&t.dataSource.groupBy.length>0&&l===t._firstVisibleColumn&&t.rowDetail.enabled&&t.rowDetail.visible&&d.querySelector("[toggle-button]")){const e=d.querySelector("[toggle-button]");e.classList.remove("smart-visibility-hidden"),e.classList.add("row-detail"),a.element.toggleDetailButton=e,a.element.toggleDetailButton.setAttribute("title",t.localize(a.showDetail?"collapseRow":"expandRow",{elementType:"Grid"})),e.onpointerdown=function(e){a.showDetail=!a.showDetail,e.stopPropagation(),e.preventDefault()}}}_autoWrap(){const e=this,t=e.firstChild,l=e.cell.grid;l.layout.allowCellsWrapShortcut&&e.hasAttribute("focus")&&e.hasAttribute("selected")&&(t.offsetWidth<t.scrollWidth?e._popupCellContent(t.innerHTML,e.cell):l._cellContentPopup&&l._cellContentPopup.remove())}_popupCellContent(e,t){const l=this,a=t.grid;let i=a._cellContentPopup;if(!a._cellContentPopup){i=document.createElement("div");const t=document.createElement("span"),l=document.createElement("div"),n=document.createElement("div");i.style.minHeight="0px",i.style.minWidth="0px",i.setAttribute("theme",a.theme),i.classList.add("smart-grid-cell-content-popup"),n.appendChild(l),n.classList.add("smart-grid-text-area-container"),l.innerHTML=e,l.classList.add("smart-grid-cell-content-popup-content"),t.classList.add("smart-hidden"),t.classList.add("close-button"),t.classList.add("smart-grid-icon"),t.classList.add("smart-icon-cancel-circled"),t.onclick=function(){a._cellContentPopup.parentNode.removeChild(a._cellContentPopup)},i.classList.add("smart-grid-text-area-dialog"),i.appendChild(n),i.appendChild(t),a._cellContentPopup=i}i.querySelector(".smart-grid-cell-content-popup-content").innerHTML=e;const n=a.offset(a.$.scrollView);i.style.top=a._offsetTop(l)-n.top+"px",i.style.left=a._offsetLeft(l)-n.left+"px",i.style.width=l.offsetWidth-4+"px",a.$.scrollView.appendChild(i)}_applyConditionalFormattingToCell(e,t,l){const a=this,i=e.column.dataField,n=e.row,r=e.row.index,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()}});
1417
1417
 
1418
1418
  /***/ }),
1419
1419
 
@@ -1427,28 +1427,28 @@ Smart.Utilities.Assign("Grid.Chart",class{_getChartDataFields(e){const t=this,i=
1427
1427
  /***/ 8228:
1428
1428
  /***/ (() => {
1429
1429
 
1430
- 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.setState(t),e.dataType||(e.dataType="string"),e.title||(e.title=""),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},"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.editor.template="numberInput":"date"===e.dataType?"timeInput"!==e.editor.template&&(e.editor.template="dateInput"):"time"===e.dataType?e.editor.template="timeInput":"boolean"===e.dataType&&(e.editor.template="checkBox")):void 0===e.editor.autoFocus&&(e.editor.autoFocus=!0),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.filter||(e.filter=null),e.className||(e.className=""),e.cellsClassName||(e.cellsClassName=""),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),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","cellsClassName","formatSettings","formatFunction","index","sortIndex","sortOrder","sorted","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","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 n in t)if(!n.startsWith("_")&&o.indexOf(n)>=0)if("editor"===n){e._state[n]={};for(let t in e[n])"row"!==t&&"column"!==t&&"cell"!==t&&"instance"!==t&&"element"!==t&&(e._state[n][t]=e[n][t])}else"groups"===n?e[n]&&e[n].length>0&&(e._state[n]=e[n]):e._state[n]=e[n]}getState(){const t=this;if(t.dataField.startsWith("_"))return{};if(!t._state){t._state={label:t.label,dataField:t.dataField,dataType:t.dataType};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]):t._state[o]=t[o]}return t._state}setProperty(t,e,o=!0){const n=this,l=n.getProperty(t);l!==e&&(n.canNotify=!1,n[t]=e,o&&n.propertyChanged(t,l,e),n.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","formatSettings","formatFunction","index","sortIndex","sortOrder","sorted","groups","element","level","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","computedWidth","computedHeight","overflowWidth","parent","children","value","thHierarchy","valueField","onAction","left","top","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"]}propertyChanged(t,e,o){const n=this;if(n.data&&void 0!==n.data[t]&&(n.data[t]=o),n._state||(n._state={label:n.label,dataField:n.dataField,dataType:n.dataType}),n._state&&o!==e&&n.dataField&&!n.dataField.startsWith("_"))if("editor"===t){n._state[t]={};for(let e in o)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(n._state[t][e]=o[e])}else n.stateProps.indexOf(t)>=0&&(n._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?n.element._showCustomButton():n.element._hideCustomButton()),"showDescriptionButton"===t)return o?n.element._showDescriptionButton():n.element._hideDescriptionButton(),void n.refresh();if("description"!==t){if("filter"===t&&(n.filter?(n.grid.addFilter(n.dataField,n.filter),n.filtered=!0):(n.grid.removeFilter(n.dataField),n.filtered=!1),(n.autoShowFilterButton||n.showFilterButton)&&(o?n.element._showFilterButton():n.element._hideFilterButton())),"sortIndex"===t)return"many"===n.grid.sorting.mode&&n.grid.context===document&&n.grid.sortBy(n.dataField,n.sortOrder),null!==n.sortIndex?n.element.setAttribute("sort-index",n.sortIndex):n.element.removeAttribute("sort-index"),void n.element._updateSortOrder();if("selected"===t){if(!1===n.allowSelect)return;n.selectionColumn&&n.refresh(),o?n.grid._selection.columns[n.dataField]||(n.grid._selection.columns[n.dataField]=!0):!1===o&&n.grid._selection.columns[n.dataField]&&delete n.grid._selection.columns[n.dataField],n.grid._recycle(!1)}if("formatSettings"===t&&n.grid._recycle(!1),"sortOrder"===t)return n.sorted=!1,null===o?n.element._hideSortButton():(n.element._showSortButton(),n.sorted=!0),n.grid.context===document&&n.grid.sortBy(n.dataField,n.sortOrder),void(n.sorted?n.element.setAttribute("aria-sort","asc"===n.sortOrder?"ascending":"descenting"):(n.element.removeAttribute("aria-sort"),n.element.removeAttribute("sort-index")));if("group"!==t){if("showActionButton"===t&&(n.element.allowAnimations=!1,o?n.element._showActionButton():n.element._hideActionButton(),n.element.allowAnimations=!0),"autoShowActionButton"===t&&(n.element.allowAnimations=!1,o?n.element._hideActionButton():n.element._showActionButton(),n.element.allowAnimations=!0),"showFilterButton"===t&&(n.element.allowAnimations=!1,void 0===n._autoShowFilterButton&&(n._autoShowFilterButton=n.autoShowFilterButton),o?(n.autoShowFilterButton=!1,n.element._showFilterButton()):(n.element._hideFilterButton(),n.autoShowFilterButton=n._autoShowFilterButton),n.element.allowAnimations=!0),"showSortButton"===t&&(n.element.allowAnimations=!1,void 0===n._autoShowSortButton&&(n._autoShowSortButton=n.autoShowSortButton),o?(n.autoShowSortButton=!1,n.element._showSortButton()):(n.element._hideSortButton(),n.autoShowSortButton=n._autoShowSortButton),n.element.allowAnimations=!0),"autoShowSortButton"===t&&(n.element.allowAnimations=!1,n._autoShowSortButton=n.autoShowSortButton,o?n.element._hideSortButton():n.element._showSortButton(),n.element.allowAnimations=!0),"menu"===t&&(o?n.element.setAttribute("aria-controls",n.menu.id):(n.element.removeAttribute("aria-controls"),n.autoShowActionButton&&n.element._hideActionButton())),"cellsFormat"!==t&&"formatSettings"!==t&&"dataField"!==t&&"displayField"!==t&&"template"!==t||n.grid._recycle(),"label"!==t&&"width"!==t&&"minWidth"!==t||n.grid.refresh(),"freeze"===t){const t=()=>{const t=n.grid.context;n.grid.context=n.grid,n.grid._renderColumns(),!1===o&&n.grid._initializeRowElements(),n.grid.refresh(),n.grid.context=t};if(n.grid.columnGroups&&n.grid.columnGroups.length>0&&n.columnGroup)return void t();t()}}else n.grid.context===document&&(o?n.grid.addGroup(n.dataField):n.grid.removeGroup(n.dataField))}else n.refresh()}else n.grid.refresh(n.grid.grouping.enabled);else n.refresh();else n.refresh();else n._editorId="_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);else n.refresh();else this.refresh()}_measureSize(t){const e=this.grid,o=function(){const o=[],n=document.createElement("div"),l=document.createElement("div"),i=Array.isArray(t)?t:[t];l.classList.add("smart-label"),n.appendChild(l),n.style.width="auto",n.style.position="static",e.$.columnHeader.appendChild(n);for(let t=0;t<i.length;t++){l.innerHTML="<span>"+i[t]+"</span>";const e=20+l.firstChild.offsetWidth,n=Math.max(30,e);o.push(n)}return e.$.columnHeader.removeChild(n),o}();return 1===o.length?o[0]:o}_autoSize(t){const e=this,o=e.grid;let n=e.label.toString();if(!t){const t=o.isInitialized?o._recyclingRows:[];for(let o=0;o<t.length;o++){const l=""+t[o].data[e.dataField];if("image"===e.template)break;l&&l.length>n.length&&(n=l)}}const l=e._measureSize(n);return e.showIcon?l+20:l}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,n){switch(e){case"appearance_allowColumnLabelAnimation":t.setProperty("allowLabelAnimation",n);break;case"appearance_allowColumnSortAnimation":t.setProperty("allowSortAnimation",n);break;case"appearance_allowColumnSortButtonAnimation":t.setProperty("allowSortButtonAnimation",n);break;case"appearance_allowColumnActionButtonAnimation":t.setProperty("allowActionButtonAnimation",n);break;case"appearance_allowColumnFilterButtonAnimation":t.setProperty("allowFilterButtonAnimation",n);break;case"appearance_autoShowColumnActionButton":t.setProperty("autoShowActionButton",n);break;case"appearance_autoShowColumnSortButton":t.setProperty("autoShowSortButton",n);break;case"appearance_autoShowColumnFilterButton":t.setProperty("autoShowFilterButton",n);break;case"appearance_showColumnActionButton":t.setProperty("showActionButton",n);break;case"appearance_showColumnFilterButton":t.setProperty("showFilterButton",n);break;case"appearance_showColumnCustomButton":t.setProperty("showCustomButton",n);break;case"appearance_showColumnDescriptionButton":t.setProperty("showDescriptionButton",n);break;case"appearance_showColumnSortButton":t.setProperty("showSortButton",n);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.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()))}_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.column.className:t.label.firstElementChild.className=""),t.descriptionButton&&t.descriptionButton.setAttribute("title",t.column.description),!0===t.column.autoGenerated||t.hasAttribute("columnHeader")||(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 n=e.paging.enabled&&"page"===e.selection.checkBoxes.selectAllMode?e._getSelectedRows(!0,!0):e._getSelectedRows(!0,!1);return e.selection.checkBoxes.autoShow?t.setAttribute("auto-show",""):t.removeAttribute("auto-show"),n.length>0&&n.length===o.length?t.setAttribute("selected",""):n.length>0&&n.length<o.length?t.setAttribute("selected","indeterminate"):0!==n.length&&0!==o.length||t.removeAttribute("selected"),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">',n=e.areAllRowsSelected()?"smart-icon-check-squared":"smart-icon-check-empty";e.isEmpty()&&(n=""),o+='<span class="smart-grid-icon '+n+'"></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,n="label"!==e.editing.commandColumn.displayMode,l=e.editing.commandColumn.dataSource.commandColumnMenu;let i='<div class="smart-grid-command-item">';const a="{{messages}}"===l.label?e.localize("commandColumnMenu"):l.label,r=l.icon;n&&o?(i+='<span class="smart-grid-icon '+r+'"></span>',i+='<span class="smart-grid-label">'+a+"</span>"):n&&!o?i+='<span class="smart-grid-icon '+r+'"></span>':o&&!n&&(i+='<span class="smart-grid-label">'+a+"</span>"),i+="</div>",l.visible&&(t.label.innerHTML=i)}const o=t.column.getProperty("selected");!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")&&(t.icon.className="smart-grid-icon show column-icon",t.icon.classList.add(t.column.icon));let n=t.column.showIcon?1:0;for(let e=0;e<t.buttonsGroup.children.length;e++)t.buttonsGroup.children[e].classList.contains("show")&&n++;switch(n){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()}_render(){const t=this,e=t.column.dataField?t.column.dataField:"",o=t.column===t.column.grid._lastVisibleColumn;t.label.firstChild?t.label.firstChild.textContent!==t.column.label&&(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||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"),n=document.createElement("div"),l=document.createElement("div"),i=document.createElement("div"),a=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),u=document.createElement("div");e.column=t,e.classList.add("smart-visibility-hidden"),s.classList.add("smart-icon","smart-grid-icon"),o.classList.add("smart-label"),n.classList.add("smart-sort-button","smart-grid-icon"),l.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(s),e.appendChild(o),e.appendChild(u),u.appendChild(n),u.appendChild(l),u.appendChild(a),u.appendChild(r),u.appendChild(i),e.icon=s,e.label=o,e.sortButton=n,e.filterButton=l,e.actionButton=i,e.descriptionButton=a,e.customButton=r,e.buttonsGroup=u,e._properties=[];const d=window.PointerEvent?"pointerdown":"mousedown",c=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(d,e._filterDownEvent),e.filterButton.addEventListener(c,e._filterUpEvent),e.actionButton.addEventListener(c,e._actionUpEvent),e.actionButton.addEventListener(d,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()}});
1430
+ 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.setState(t),e.dataType||(e.dataType="string"),e.title||(e.title=""),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},"number"===e.dataType||"int"===e.dataType||"float"===e.dataType?e.editor.template="numberInput":"date"===e.dataType?"timeInput"!==e.editor.template&&(e.editor.template="dateInput"):"time"===e.dataType?e.editor.template="timeInput":"boolean"===e.dataType&&(e.editor.template="checkBox")):void 0===e.editor.autoFocus&&(e.editor.autoFocus=!0),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.filter||(e.filter=null),e.className||(e.className=""),e.cellsClassName||(e.cellsClassName=""),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),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","cellsClassName","formatSettings","formatFunction","index","sortIndex","sortOrder","sorted","groups","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","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 n in t)if(!n.startsWith("_")&&o.indexOf(n)>=0)if("editor"===n){e._state[n]={};for(let t in e[n])"row"!==t&&"column"!==t&&"cell"!==t&&"instance"!==t&&"element"!==t&&(e._state[n][t]=e[n][t])}else"groups"===n?e[n]&&e[n].length>0&&(e._state[n]=e[n]):e._state[n]=e[n]}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]):t._state[o]=t[o]}return t._state}setProperty(t,e,o=!0){const n=this,i=n.getProperty(t);i!==e&&(n.canNotify=!1,n[t]=e,o&&n.propertyChanged(t,i,e),n.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","formatSettings","formatFunction","index","sortIndex","sortOrder","sorted","groups","element","level","group","filtered","filterEditor","filter","filterMenuMode","defaultValue","dataField","displayField","label","dataType","align","cellsWrap","cellsAlign","minWidth","width","visible","_visible","freeze","showActionButton","selected","showIcon","highlight","showDescriptionButton","treeColumn","computedWidth","computedHeight","overflowWidth","parent","children","value","thHierarchy","valueField","onAction","left","top","title","showCustomButton","showFilterButton","showSortButton","editor","template","visibleIndex","validationRules"]}propertyChanged(t,e,o){const n=this;if(n.data&&void 0!==n.data[t]&&(n.data[t]=o),n._state||(n._state={label:n.label,dataField:n.dataField,dataType:n.dataType,_visible:n._visible}),n._state&&o!==e&&n.dataField&&!n.dataField.startsWith("_"))if("editor"===t){n._state[t]={};for(let e in o)"row"!==e&&"column"!==e&&"cell"!==e&&"instance"!==e&&"element"!==e&&(n._state[t][e]=o[e])}else n.stateProps.indexOf(t)>=0&&(n._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?n.element._showCustomButton():n.element._hideCustomButton()),"showDescriptionButton"===t)return o?n.element._showDescriptionButton():n.element._hideDescriptionButton(),void n.refresh();if("description"!==t){if("filter"===t&&(n.filter?(n.grid.addFilter(n.dataField,n.filter),n.filtered=!0):(n.grid.removeFilter(n.dataField),n.filtered=!1),(n.autoShowFilterButton||n.showFilterButton)&&(o?n.element._showFilterButton():n.element._hideFilterButton())),"sortIndex"===t)return"many"===n.grid.sorting.mode&&n.grid.context===document&&n.grid.sortBy(n.dataField,n.sortOrder),null!==n.sortIndex?n.element.setAttribute("sort-index",n.sortIndex):n.element.removeAttribute("sort-index"),void n.element._updateSortOrder();if("selected"===t){if(!1===n.allowSelect)return;n.selectionColumn&&n.refresh(),o?n.grid._selection.columns[n.dataField]||(n.grid._selection.columns[n.dataField]=!0):!1===o&&n.grid._selection.columns[n.dataField]&&delete n.grid._selection.columns[n.dataField],n.grid._recycle(!1)}if("formatSettings"===t&&n.grid._recycle(!1),"sortOrder"===t)return n.sorted=!1,null===o?n.element._hideSortButton():(n.element._showSortButton(),n.sorted=!0),n.grid.context===document&&n.grid.sortBy(n.dataField,n.sortOrder),void(n.sorted?n.element.setAttribute("aria-sort","asc"===n.sortOrder?"ascending":"descenting"):(n.element.removeAttribute("aria-sort"),n.element.removeAttribute("sort-index")));if("group"!==t){if("showActionButton"===t&&(n.element.allowAnimations=!1,o?n.element._showActionButton():n.element._hideActionButton(),n.element.allowAnimations=!0),"autoShowActionButton"===t&&(n.element.allowAnimations=!1,o?n.element._hideActionButton():n.element._showActionButton(),n.element.allowAnimations=!0),"showFilterButton"===t&&(n.element.allowAnimations=!1,void 0===n._autoShowFilterButton&&(n._autoShowFilterButton=n.autoShowFilterButton),o?(n.autoShowFilterButton=!1,n.element._showFilterButton()):(n.element._hideFilterButton(),n.autoShowFilterButton=n._autoShowFilterButton),n.element.allowAnimations=!0),"showSortButton"===t&&(n.element.allowAnimations=!1,void 0===n._autoShowSortButton&&(n._autoShowSortButton=n.autoShowSortButton),o?(n.autoShowSortButton=!1,n.element._showSortButton()):(n.element._hideSortButton(),n.autoShowSortButton=n._autoShowSortButton),n.element.allowAnimations=!0),"autoShowSortButton"===t&&(n.element.allowAnimations=!1,n._autoShowSortButton=n.autoShowSortButton,o?n.element._hideSortButton():n.element._showSortButton(),n.element.allowAnimations=!0),"menu"===t&&(o?n.element.setAttribute("aria-controls",n.menu.id):(n.element.removeAttribute("aria-controls"),n.autoShowActionButton&&n.element._hideActionButton())),"cellsFormat"!==t&&"formatSettings"!==t&&"dataField"!==t&&"displayField"!==t&&"template"!==t||n.grid._recycle(),"label"!==t&&"width"!==t&&"minWidth"!==t||n.grid.refresh(),"freeze"===t){const t=()=>{const t=n.grid.context;n.grid.context=n.grid,n.grid._renderColumns(),!1===o&&n.grid._initializeRowElements(),n.grid.refresh(),n.grid.context=t};if(n.grid.columnGroups&&n.grid.columnGroups.length>0&&n.columnGroup)return void t();t()}}else n.grid.context===document&&(o?n.grid.addGroup(n.dataField):n.grid.removeGroup(n.dataField))}else n.refresh()}else n.grid.refresh(n.grid.grouping.enabled);else n.refresh();else n.refresh();else n._editorId="_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1);else n.refresh();else this.refresh()}_measureSize(t){const e=this.grid,o=function(){const o=[],n=document.createElement("div"),i=document.createElement("div"),l=Array.isArray(t)?t:[t];i.classList.add("smart-label"),n.appendChild(i),n.style.width="auto",n.style.position="static",e.$.columnHeader.appendChild(n);for(let t=0;t<l.length;t++){i.innerHTML="<span>"+l[t]+"</span>";const e=20+i.firstChild.offsetWidth,n=Math.max(30,e);o.push(n)}return e.$.columnHeader.removeChild(n),o}();return 1===o.length?o[0]:o}_autoSize(t){const e=this,o=e.grid;let n=e.label.toString();if(!t){const t=o.isInitialized?o._recyclingRows:[];for(let o=0;o<t.length;o++){const i=""+t[o].data[e.dataField];if("image"===e.template)break;i&&i.length>n.length&&(n=i)}}const i=e._measureSize(n);return e.showIcon?i+20:i}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,n){switch(e){case"appearance_allowColumnLabelAnimation":t.setProperty("allowLabelAnimation",n);break;case"appearance_allowColumnSortAnimation":t.setProperty("allowSortAnimation",n);break;case"appearance_allowColumnSortButtonAnimation":t.setProperty("allowSortButtonAnimation",n);break;case"appearance_allowColumnActionButtonAnimation":t.setProperty("allowActionButtonAnimation",n);break;case"appearance_allowColumnFilterButtonAnimation":t.setProperty("allowFilterButtonAnimation",n);break;case"appearance_autoShowColumnActionButton":t.setProperty("autoShowActionButton",n);break;case"appearance_autoShowColumnSortButton":t.setProperty("autoShowSortButton",n);break;case"appearance_autoShowColumnFilterButton":t.setProperty("autoShowFilterButton",n);break;case"appearance_showColumnActionButton":t.setProperty("showActionButton",n);break;case"appearance_showColumnFilterButton":t.setProperty("showFilterButton",n);break;case"appearance_showColumnCustomButton":t.setProperty("showCustomButton",n);break;case"appearance_showColumnDescriptionButton":t.setProperty("showDescriptionButton",n);break;case"appearance_showColumnSortButton":t.setProperty("showSortButton",n);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.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.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 n=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;n>0&&n===o?t.setAttribute("selected",""):n>0&&n<o?t.setAttribute("selected","indeterminate"):0!==n&&0!==o||t.removeAttribute("selected")}else n.length>0&&n.length===o.length?t.setAttribute("selected",""):n.length>0&&n.length<o.length?t.setAttribute("selected","indeterminate"):0!==n.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">',n=e.areAllRowsSelected()?"smart-icon-check-squared":"smart-icon-check-empty";e.isEmpty()&&(n=""),o+='<span class="smart-grid-icon '+n+'"></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,n="label"!==e.editing.commandColumn.displayMode,i=e.editing.commandColumn.dataSource.commandColumnMenu;let l='<div class="smart-grid-command-item">';const a="{{messages}}"===i.label?e.localize("commandColumnMenu"):i.label,r=i.icon;n&&o?(l+='<span class="smart-grid-icon '+r+'"></span>',l+='<span class="smart-grid-label">'+a+"</span>"):n&&!o?l+='<span class="smart-grid-icon '+r+'"></span>':o&&!n&&(l+='<span class="smart-grid-label">'+a+"</span>"),l+="</div>",i.visible&&(t.label.innerHTML=l)}const o=t.column.getProperty("selected");!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")&&(t.icon.className="smart-grid-icon show column-icon",t.icon.classList.add(t.column.icon));let n=t.column.showIcon?1:0;for(let e=0;e<t.buttonsGroup.children.length;e++)t.buttonsGroup.children[e].classList.contains("show")&&n++;switch(n){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()}_render(){const t=this,e=t.column.dataField?t.column.dataField:"",o=t.column===t.column.grid._lastVisibleColumn;t.label.firstChild?t.label.firstChild.textContent!==t.column.label&&(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||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"),n=document.createElement("div"),i=document.createElement("div"),l=document.createElement("div"),a=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),u=document.createElement("div");e.column=t,e.classList.add("smart-visibility-hidden"),s.classList.add("smart-icon","smart-grid-icon"),o.classList.add("smart-label"),n.classList.add("smart-sort-button","smart-grid-icon"),i.classList.add("smart-filter-button","smart-icon-filter","smart-grid-icon"),l.classList.add("smart-action-button","smart-grid-icon"),l.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"),l.innerHTML="<div></div>",e.style.width=e.column.computedWidth+"px",e.appendChild(s),e.appendChild(o),e.appendChild(u),u.appendChild(n),u.appendChild(i),u.appendChild(a),u.appendChild(r),u.appendChild(l),e.icon=s,e.label=o,e.sortButton=n,e.filterButton=i,e.actionButton=l,e.descriptionButton=a,e.customButton=r,e.buttonsGroup=u,e._properties=[];const d=window.PointerEvent?"pointerdown":"mousedown",c=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(d,e._filterDownEvent),e.filterButton.addEventListener(c,e._filterUpEvent),e.actionButton.addEventListener(c,e._actionUpEvent),e.actionButton.addEventListener(d,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()}});
1431
1431
 
1432
1432
  /***/ }),
1433
1433
 
1434
1434
  /***/ 5306:
1435
1435
  /***/ (() => {
1436
1436
 
1437
- Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!0,type:"boolean"},showSortColumnBackground:{value:!0,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"}},type:"object"},behavior:{value:{allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"object"},fileName:{value:"smartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDuplicate:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertLeft:{value:{command:{value:"insertLeftCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-left",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertRight:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-right",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},description:{value:"",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:400,type:"any"},width:{value:400,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban"],type:"string"},currentUser:{value:null,type:"any"},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced"]},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the smartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",kanbanNone:"None",kanbanNoneDescription:"Start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Basic kanban",kanbanBasicDescription:'Start from Basic kanban-style board with columns for "To do", "in progress" and "Done".',uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Settings",columnMenuItemDuplicate:"Duplicate",columnMenuItemInsertLeft:"Insert left",columnMenuItemInsertRight:"Insert right",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group by this column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide field",columnMenuItemShow:"Show field",columnMenuItemDelete:"Delete field",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Shift</code> + <code>Space</code>",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeader:"Edit Record with Id: {{value}}",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonCancel:"CANCEL",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New field",dialogAddColumn:"Add Column",dialogAddColumnStatus:"Create a group field",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your data will be grouped in columns based on this field",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogImageHeader:"Image",dialogImageDrop:"or drag and drop image(s) to upload",dialogImageUpload:"Select Image(s) to Upload",dialogImageURL:"You can also provide the URL to an image",dialogImageURLUpload:"Upload",dialogImageLink:"Link (URL)",dialogImageDevice:"My Device",dialogImageSize:'No image currently added. The "{{value}}" image cannot be uploaded. Maximum image size is {{fileSize}}.',dialogImageCount:'The following images cannot be added "{{files}}". Maximum images allowed is {{fileCount}}.',dialogImageFileUpload:"No images currently selected for upload",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple Select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"Collaborator",dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeAutoNumber:"Auto Number",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnListItems:"List items",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnCheckItems:"Show Checkbox",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",noComments:"No comments to this record yet",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Details",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'Changed {{column}} from "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed {{column}} to "{{newValue}}"',rowCreated:"Row Created",propertyUpdated:'"{{value}}" updated',propertyRemoved:'"{{value}}" removed',dropImages:"Drop images here",addImages:"Add images",unassigned:"Unassigned",historyDate:"Date",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",and:"And",apply:"Apply",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide fields",customizeOne:"1 hidden field",customizeHidden:"{{n}} hidden fields",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} fields",sortedByOne:"Sorted by 1 field",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less Than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",formatColumn:"Format Column",formating:"Conditional Formatting",reset:"Reset",filteredRecords:"All rows are filtered"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},filtering:{value:{enabled:{value:!1,type:"boolean"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:500,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"any"},allowColumnHeaderEdit:{value:!1,type:"any"},autoUpdateFilterAndSort:{value:!0,type:"any"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"any"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},onInit:{value:null,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},commandKey:{value:"",allowedValues:["","shiftKey","controlKey","altKey"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["smart.menu.css","smart.filterpanel.css","smart.pager.css","smart.grid.css","smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' role='grid'>\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler"}}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);super._upHandler(),t._tapTimer&&clearTimeout(t._tapTimer);const l=()=>{t.editing.isEditing&&!t.editing.dialog.enabled&&setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.endEdit()}}),50)};if(!e.originalEvent||(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),!e.originalEvent.target.closest(".smart-grid-dialog"))){if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;)if(a=a.parentNode,a===t){o=!0;break}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const e=n.querySelectorAll("smart-drop-down-list"),l=n.querySelectorAll("smart-date-time-picker"),a=n.querySelectorAll("smart-date-input"),i=n.querySelectorAll("smart-input");for(let t=0;t<e.length;t++)if(e[t].$.dropDownContainer.contains(o))return;for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.scrollView.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;return void t.closeMenu()}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX)if(n.top<=e.pageY&&n.top+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void(t._kanbanViewColumns&&t._kanbanViewColumns.length>0?t._openColumnChooserMenu(o):t._openAddColumnDialog());if(Smart.Utilities.Core.isMobile)n&&o.allowSortToggleOnClick&&t.sorting.enabled&&t.sortBy(l),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey&&("altKey"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"shiftKey"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"ctrlKey"===t.sorting.commandKey&&!1===e.ctrlKey&&(t._canSort=!1),"ctrlKey"!==t.sorting.commandKey&&e.ctrlKey))return;t.sortBy(l)}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField}),i("doubleClick"),t._onColumnDoubleClick(o,e)),t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,s=null;t._lastPointerDownTime=new Date;for(let e=0;e<a.length;e++){const t=a[e];if(t.hasAttribute("toggle-button")&&(i=t),t.hasAttribute("checkbox")&&(r=t),s||"smart-grid-cell"!==t.nodeName.toLowerCase()||(s=t),!n&&"smart-grid-row"===t.nodeName.toLowerCase()){n=t;break}}if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn){const e=n.row;e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else{const o=n.row,l=s?s.cell:null;l.column._treeColumn&&r&&(o.checked=!o.checked),l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(o.header&&"row-resize"===o.header.style.cursor){const l=t.offset(o.header);if(t._rowToResize&&l.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=l.left+o.header.offsetWidth)return;o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,u=e.originalEvent?e.originalEvent:e,c=3===u.which;if(c||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template)t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),a("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0}_blurHandler(){this._focused=!1}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){switch(l._notify(e,t,o),e){case"onRowInserted":return;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o));case"users":case"currentUser":l._refreshCurrentUser();break;case"summaryRow_visible":for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);l._renderRows(!0);break;case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":l.header.visible&&""===l.header.template&&(l.$.header.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=l.$.header.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar));break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index}}}break;case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":if(l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[],l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}if(l._renderColumns(),l._refreshHeaderBar(),l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return;case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":return delete l._isFirstVirtualDataSourceRequest,l.dataBind(),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.removeAttribute("aria-readonly"):l.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){super.ready();const e=this,t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e.checkLicense()}checkLicense(e){const t=this;(t.grouping.enabled||t.selection.enabled&&t.selection.allowCellSelection||t.rowDetail.enabled||t.charting.enabled||t.editing.enabled&&t.editing.batch||t.editing.enabled&&"row"===t.editing.mode||t.editing.enabled&&t.editing.addNewRow.visible||t.editing.enabled&&t.editing.commandColumn.visible||"virtual"===t.scrolling||t.sorting.enabled&&"many"===t.sorting.mode||!0===e)&&super.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];e.filtering.enabled&&0===e._filterPanels.length&&requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){l.children[1].children[a].style.height="auto";const n=o.getCell(e.columns[0].dataField);n&&n.render(),t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this;let t=e._recyclingRows,o=0,l=e._autoRowHeight,a=0,n=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===t.length||0===e.columns.length||!e.hasVisibleColumn())return 0;e.rows.canNotify=!1;const i=e._measureRowElement(t[0].data),r=t.length;for(let s=0;s<r;s++){let r=t[s];if(!r.visible||!1===r.filtered){r.height=0,r.cellHeight=0,r.top=o;continue}const d=e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled;if((!r.height||!r.cellHeight||d||"auto"===r.height||"auto"===r._height||"auto"===e.layout.rowHeight||e.layout.isDirty)&&!r.expandHeight){if(r.detailHeight||(r.detailHeight=200),e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.height=e.layout.rowHeight,r.computedHeight&&(r.height=r.computedHeight),r.minHeight>r.height&&(r.height=r.minHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.element=i,r.grid=e,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l,o=r.canNotify;r.canNotify=!1,r.height=t,r.computedHeight&&(r.height=r.computedHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight),r.canNotify=o}else e.layout.rowHeight(s,r),r.height||(r.height=l),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}else{if("auto"===r.height||"auto"===r._height){r.element=i,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l;r.height=t,r._height="auto"}else r.height=l;void 0===r.label||r.summaryRow||"advanced"!==e.grouping.renderMode||(r.height=e.grouping.groupRowHeight),r.computedHeight&&(r.height=r.computedHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}e._rowGap&&s<e.rows.length-1&&(r.height+=e._rowGap)}!0===r.freeze||"near"===r.freeze?r.visible&&(a+=r.height):"far"===r.freeze&&r.visible&&(n+=r.height),r.freeze&&r.visible?r.top=o:(r.top!==o&&(r.top=o),r.expandHeight?o+=r.cellHeight:o+=r.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(o+=1*l),e.editing.addNewRow&&"button"===e.editing.addNewRow.displayMode&&(o+=1*l),e.filtering&&e.filtering.filterRow.visible&&(a+=l),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),t>=e.virtualModeCachedRowsCount&&(o=e.rows[0].height*e.dataSource.length)}return e.__scrollHeight=o,e.__frozenNearHeight=a,e.__frozenFarHeight=n,e._scrollView.scrollHeight=o-e.$.scrollView.offsetHeight+a+n,o=e.__scrollHeight+a+n-1,e.grouping.enabled&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(o+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=o,i.remove(),t[0]&&delete t[0]._isMeasureRow,e.rows.canNotify=!0,o}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let e=0;e<o.length;e++)o[e].parent=null,o[e].groups=null;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?l.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o}_refreshColumnHeights(){const e=this;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],s=0,d=0,u=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,u+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=u,u+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;t.summaryRow.visible&&(t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{!0!==t.editing.isEditing&&(t._calculateSummary(),!1!==e&&t._recycle(!1))}),100))}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[];let o=new Date;const l=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=l;const a=function(l,a,n){let i=null;if(e.isInitialized&&(o=new Date),i=l?l.grid?l:new Smart.Grid.Row({data:l,index:a,grid:e,createdBy:e.currentUser,createdDate:o}):new Smart.Grid.Row({data:{},index:a,grid:e,createdBy:e.currentUser,createdDate:o}),e.rowById[i.id]&&(i.id=e.rows.length,e.rowById[i.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};i.id=e()}if(e.onRowInit){e.onRowInit(a,i);for(let t in i)-1!==i.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}))}if(i.selected&&(e._selection.rows[i.id]=!0),i.freeze&&i.visible){if(!0===i.freeze||"near"===i.freeze){e.rows.splice(t++,0,i);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}else if("far"===i.freeze){e.rows.push(i);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&e._frozenFarRows.push(t)}}else e.rows[a]?e.rows.splice(a,0,i):e.rows.push(i),i.data&&i.data.$&&(i.data.$.history=i.history,i.data.$.starred=i.starred,i.data.$.comments=i.comments,i.data.$.style=i.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===a?e.rows[e.rows.length-1]:e.rows[a],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e.rowById[l.id]=l;-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&e._recycle(!1,!0),e._onRowInserted&&e._onRowInserted(l),n&&n(l)};if(void 0===a&&(a=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=a)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:a});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([a],[t],o),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],i=t?t[l]:void 0;void 0!==i&&(a.id=a.data.id=i,e.rowById[a.id]=a),e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),n&&n(a)}delete e._undoRedoAction,e.endUpdate(!1)}))}}),l)}else e.onRowInserted([a],[t],o)}else{const t=void 0===a?e.rows[e.rows.length-1]:e.rows[a];void 0===a&&(a=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=a)),n&&n(t)}},n=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index]),e._setRemoveUndoRedo(t)},i=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t]),e._setRemoveUndoRedo(o)};e._add=a,e._removeLastRow=n,e._removeAt=i,e._rowHeight=e._autoRowHeight;const r=e.dataSource.length;if(e.setAttribute("aria-rowcount",r),e.dataSource&&e.dataSource.virtualDataSource){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];a(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];a(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(l(),e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let s=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)a(o[t],e.dataSource.length-o.length+t);else a(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],l=[],n=[];for(let i=0;i<n.length;i++){const r=t.index[i];e.rows[r]?(e.rows[r].data=n[i],o.push(r),l.push(e.rows[r]),n.push(e.rows[r].data)):(a(n[i],n[i].$.index),s=!0)}e.onRowUpdated&&e.onRowUpdated(o,l,n)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:a(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data])}break;case"insert":a(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":i(t.index);break;case"removeLast":n();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==r){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize)),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize))}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle()}}l(),("update"!==t.action||s)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?e._frozenNearRows.push(o):"far"===o.freeze&&e._frozenFarRows.push(o),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,e.rowById[t.target.id]&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||l.propertyChanged(a,n,i)),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]&&(l.data=e.dataSource[o],void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)),-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l))})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l.data=o,l.id=o.$.id,e.rowById[l.id]=l}return e.rows.canNotify=!0,void e.refresh()}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||e._render()})),e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),void super.render();const o=e.context;e.context=e,e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_render(){const e=this;if(!e.isInitialized&&(e.onBeforeInit&&(e.onBeforeInit(),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&e.header.buttons.indexOf("views")>=0&&(e._setupKanbanView(),e.dataSource&&e.dataSource.length)))for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];for(let t=0;t<e.columns.length;t++){const l=e.columns[t];void 0!==l.defaultValue&&void 0===o[l.dataField]&&(o[l.dataField]=l.defaultValue)}}if((()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource})}})(),e._selection={rows:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:[]}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale,e.$.header.appendChild(t),e.$.headerBar=e.$.header.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}a&&e.addFilter(t,a,!1)}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t&&e.addFilter(o.dataField,t,!1)}}e.refreshFilters()}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy&&e.expandAllRows(),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t&&(e.onAfterInit&&(e.onAfterInit(),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks)){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}"kanban"===e.view&&e._initKanbanView()}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rowHierarchy?e.rowHierarchy:e.rows.toArray(),o=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,t,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=o,o}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(){const e=this,t=e.conditionalFormatting;if(!t||0===t.length)return;const o=getComputedStyle(e);e._defaults={fontFamily:o.fontFamily,fontSize:o.fontSize,text:e._toHex(o.color),highlight:e._toHex(o.backgroundColor)};const l=e._defaults,a=new Smart.Utilities.ConditionalFormatter(e.dataSource),n=[];for(let o=0;o<t.length;o++){t[o]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:l.fontFamily,fontSize:l.fontSize,text:l.text,highlight:l.highlight},t[o]);const r=t[o],s="all"===(i=r.column)?e.columns&&e.columns.map?e.columns.map((e=>e.dataField)):[]:[i],d=r.condition;a.color=r.highlight,a.comparator=r.firstValue,a.min=r.firstValue,a.max=r.secondValue;const u=a.format(d,s);for(let e in u){const t=u[e];for(let e in t){const o=t[e];o.color=r.text,o.fontFamily=r.fontFamily,o.fontSize=r.fontSize}}n.push(u)}var i;if(e._formattingPanel&&(e._formattingPanel.items=t),0===n.length)return n[0];const r={};for(let e=0;e<n.length;e++){const t=n[e];for(let e in t){const o=t[e];r[e]||(r[e]={});for(let t in o)r[e][t]=Object.assign({},r[e][t],o[t])}}e._conditionalFormatting=r}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e;const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));n.grid=e,e.columns.push(n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n)}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);"near"===e.rowDetail.position?(o.freeze="near",a.freeze="near",e.viewColumns.splice(l,0,a),e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30}),n=new Smart.Observable(a,a.observables);n.canNotify=!1,e.viewColumns.push(n),e._frozenFarColumns.splice(0,0,n);const i=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),r=new Smart.Observable(i,i.observables);r.canNotify=!1,"near"===e.editing.commandColumn.position?(i.freeze="near",r.freeze="near",e.viewColumns.splice(l,0,r),e._frozenNearColumns.splice(l,0,r)):(e.viewColumns.push(r),e._frozenFarColumns.splice(0,0,r)),e._commandColumn=r;const s=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),d=new Smart.Observable(s,s.observables);if("near"===s.freeze?(e.viewColumns.splice(l,0,d),e._frozenNearColumns.splice(l,0,d)):(e.viewColumns.push(d),e._frozenFarColumns.splice(0,0,d)),e._selectionColumn=d,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}onAttached(){const e=this;e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.isRendered&&e.isCompleted&&e._render()}onDetached(){const e=this;if(!e.isRendered)return;["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.querySelector("smart-grid-toolbar");if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection={rows:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}_observeColumns(){const e=this,t=function(e,t,o,l){o===l&&"selected"!==t||e.propertyChanged(t,o,l)};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;e._dragDrop||e.onColumnInserted&&(e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]),e._onColumnInsertData.push(l),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50))};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l&&delete e.columnByDataField[l.dataField],e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,requestAnimationFrame((()=>{if(e.filtering.enabled&&e.filtering.filterRow.visible)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(t._isUpdating)return;if(t.editing.isEditing)return;const o=t.querySelector("smart-grid-toolbar");if(!o||!o.$.headerDropDown.classList.contains("open"))if(t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&!t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&e.deltaX){const o=t.scrollLeft;if(0===o&&e.deltaX<0||o===t.scrollWidth&&e.deltaX>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaX<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaX)>=100?t._scrollView.scrollLeft+=l:t._scrollView.scrollLeft+=e.deltaX}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaY<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100?t._scrollView.scrollTop+=l:t._scrollView.scrollTop+=e.deltaY}}_refresh(){const e=this;if(e._isUpdating)return;const t=e.$.verticalScrollBar.offsetWidth;e.removeAttribute("grouped"),e.removeAttribute("tree");let o=!0;e.__autoHeightRows&&(e.__autoHeightRows=null,e._refreshColumnsResponsiveVisibility(),e._recycle(),o=!1),e._groups||(e._groups=[]),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>=0&&("advanced"===e.grouping.renderMode?e.setAttribute("grouped",""):e.setAttribute("tree",""),e._groups||(e._groups=[].concat(e.dataSource.groupBy.toArray())||[]),e._renderGroupBar()),e.grouping.enabled&&e.dataSource.groupBy&&0===e.dataSource.groupBy.length?e.$.breadcrumb&&(e.$.breadcrumb.dataSource=[]):e.dataSource.boundHierarchy&&(e.setAttribute("tree",""),e.setAttribute("role","treegrid")),(e.isInitialized||o)&&e._refreshColumnsResponsiveVisibility(),e._refreshLayout(),t!==e.$.verticalScrollBar.offsetWidth&&(e.__scrollWidth=null,e._refreshColumnsResponsiveVisibility(),e._refreshScrollBars(),0===e.$.verticalScrollBar.offsetWidth&&e.isRendered&&requestAnimationFrame((()=>{e._refreshScrollBars()}))),e._refreshSelection(),e._recycle(),e._refreshHeaderBar(),e._recyclingRows&&0===e._recyclingRows.length&&(e.$.placeholder.classList.remove("smart-hidden"),e.scrollHeight=0,e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${e.localize("filteredRecords")}`)),requestAnimationFrame((()=>{e._width=e.offsetWidth,e._height=e.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return;t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;e>0&&t.offsetHeight>=e&&(t._refreshLayout(),t._initializeRowElements()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,u=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(u+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===u&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=u,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1);e._refreshRowHierarchy()}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),(!o.grouping.enabled||!o.dataSource.groupBy||0!==o.dataSource.groupBy.length)&&o.dataSource.boundHierarchy){const n=o.dataSource.reservedNames,i=function(e){const t=new Smart.Grid.Row({data:e,index:o.rows.length});return o.rowById[t.id]=t,t},r=function(t,l){for(let s=0;s<t.length;s++){const d=t[s];let u=o.rowById[d.$.id];u||(u=i(d)),u.data=d,u.leaf=d[n.leaf]||!1,u.level=d[n.level],u.groupDataField=d.groupDataField,u.label=d.label,u.children=[],u.data&&(u.filtered=void 0===u.data.$.filtered||u.data.$.filtered),d.summaryRow&&(u.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==u.id)&&(u.expandHeight=0),d.parent?(u.parent=o.rowById[d.parent.$.id],u.parentId=d.parent.$.id):(u.parent=null,u.parentId=null);let c=!!e||u.expanded;if(a&&(c=!0),!0===u.visible&&!1!==u.filtered)if(c||d[n.leaf])if(l.push(u),d.children&&d.children.length>0){const e=r(d.children,new Array);0===e.length&&(u.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);u.children=e}else d.children&&0===d.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?u.data._loaded&&(u.leaf=!0):u.leaf=!0);else if(l.push(u),d.children&&d.children.length>0){const e=r(d.children,new Array);0===e.length&&(u.leaf=!0),u.children=e}else d.children&&0===d.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?u.data._loaded&&(u.leaf=!0):u.leaf=!0)}return l};let s=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<s.length;o++){let l=s[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;if((a||null===a)&&0===l.level&&!l.parent){if(0===t(l.children).length)continue;e.push(l)}}s=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}o.rowHierarchy=r(s,new Array);let d=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&d.push(t),t.canNotify=!1,t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=d),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow&&o._initializeRowElements(),o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e.editing.addNewRow.visible&&1===e._recyclingRows.length&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.header.visible?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));e.header.visible&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshElementsVisibility(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),u=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=u,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden")),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||u>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-u+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",u+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",u+e.__scrollBarSize+"px"))),t.refresh(),o.refresh()}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getColumns(){const e=this,t=[];if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}getState(){const e=this,t=e.getSortedColumns(),o=e.getFilteredColumns(),l=e.getGroups(),a=e.getSelectedCells(),n=e.getSelectedRows(),i=e.$.headerPager.querySelector("smart-pager");let r=0;return i&&(r=i.pagesCount),{sort:t,filter:o,groups:l,paging:{count:r,index:e.paging.pageIndex,size:e._pageSize},selectedCells:a,selectedRows:n}}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,t,e._farRowsAdded,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),0===o.columns.length&&o.column.element.classList.add("smart-hidden"),0===t&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_recycle(e,t){const o=this;if(o._layoutSuspended||!1===o.isAttached)return;if(o._isUpdating)return;if(o.editing.isEditing&&(o.endEdit(),o._isUpdating))return;o._removeCellContentPopup(),o._inputOverlay&&(o._inputOverlay.parentNode&&o._inputOverlay.parentNode.removeChild(o._inputOverlay),o._inputOverlay=null),o._selection.selectionRect&&o._refreshCellSelectionRect();const l=o._scrollView.scrollTop;let a,n=o._getRowIndexByPosition(l),i=o._recyclingRows,r=i[n],s=r?r.top:0,d=0,u=0,c=0,m=0;for(let e=0;e<o._cellsMerge.length;e++){const t=o._cellsMerge[e],a=i.indexOf(t.row);if(n>a&&n<=a+t.rowSpan&&(n=a,r=t.row,c=Math.max(c,s-r.top),s=r.top,o.$.rowContainer.style.top=o.__frozenNearHeight-l+s+"px"),t.colSpan>1)for(let e=0;e<o.viewColumns.length;e++){const l=o.viewColumns[e];let a=l.autoGenerated?l:o.columnByDataField[l.dataField];if(a.visible&&a.left+a.computedWidth-o._scrollView.scrollLeft>=d&&a.left-a.computedWidth-o._scrollView.scrollLeft<o._clientSize.width){let e=o.columnByDataField[t.column.dataField];m=Math.max(m,a.left-e.left+a.computedWidth);break}}}let g=null;if(!1!==e||o._cellsMerge.length>0){for(let e=0;e<o._columnElements.length;e++){const t=o._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<o._columnGroups.length;e++){const t=o._columnGroups[e],l=t.element;o.rightToLeft?l.style.right=t.right+"px":l.style.left=t.left+"px",l.style.width=t.computedWidth+"px"}o._firstVisibleColumn=null,o._lastVisibleColumn=null;for(let e=0;e<o.viewColumns.length;e++){let t=o.viewColumns[e];if(t.visible&&(o._firstVisibleColumn||(o._firstVisibleColumn=t),o._lastVisibleColumn=t),t.element&&(t===o._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(d+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-o._scrollView.scrollLeft>=d-m&&t.left-t.computedWidth-o._scrollView.scrollLeft<o._clientSize.width){const l=o._columnElements[u++];l.set("column",t,!1),l.parentNode||o.$.columnContainer.appendChild(l),g||(g=t,o._firstRenderedColumn=t),t.element=l,t.render(),l.setAttribute("aria-colindex",e+1),void 0===a&&(a=t.left)}}}if(void 0===a&&(a=0),o.rightToLeft){const e=o._scrollView.scrollWidth-o._scrollView.scrollLeft-o._scrollView.vScrollBar.offsetWidth;o.$.columnContainer.style.right=e+"px",e<=0&&!o._scrollView.scrollWidth&&(o.$.columnContainer.style.right=-o.offsetWidth+o._computedColumnsWidth+"px")}else o.$.columnContainer.style.left=-o._scrollView.scrollLeft+"px";if(o.$.rowContainer.style.top=o.__frozenNearHeight-l+s+"px",o.isScrolling&&!o.isHScrolling&&(o._scrollUpdate&&clearTimeout(o._scrollUpdate),o._scrollUpdate=setTimeout((function(){o.isScrolling||(o.$.rowContainer.style.top=parseInt(o.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!o._rowElements)return;const p=o.dataSource&&o.dataSource.virtualDataSource&&!o.dataSource.virtualDataSourceOnExpand&&o.dataSource.length>o.virtualModeCachedRowsCount&&"infinite"!==o.scrolling;if(n>=0){u=0;let e=Math.max(o._clientSize.height,o._overflowOffset),t=0;p&&(o.rowById=[],o.rows&&o.rows.length>0&&void 0===o.rows[o.rows.length-1].top&&(o.rows[o.rows.length-1].top=(o.rows.length-1)*o.rows[0].height),o.rows&&o.rows.length>0&&(t=o._getVirtualRowIndexByPosition(l),s=t*o.rows[0].height,o.$.rowContainer.style.top=o.__frozenNearHeight-l+s+"px",o.paging.enabled||(n=0)),o.paging.enabled&&(t=o.paging.pageIndex*o._pageSize));for(let a=n;a<i.length;a++){const r=i[a];if(0===r.height||!r.visible||!1===r.filtered||r.freeze&&r.visible)continue;const d=r.height;if(r.expandHeight&&(e+=o.offsetHeight+r.expandHeight),!(s+d>=l-c&&s<=l+e||o._autoHeight))break;{const e=o._rowElements[u++];if(!e)break;e.setAttribute("aria-rowindex",t+a+1),r.element=e,r.grid=o,p&&(r.index=a+t,r.visibleIndex=a+t,o.paging.enabled?(r.data=o.dataSource[n+u-1],r.data&&(r.id=r.data.$.id,o.rowById[r.id]=r)):(r.data=o.dataSource[u-1],r.data&&(r.id=r.data.$.id,o.rowById[r.id]=r))),r.render()}s+=d}}o._renderFrozenRows();let h=u;if(u<o._rowElements.length)for(let e=u;e<o._rowElements.length;e++){const e=o._rowElements[u++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}o.editing.addNewRow&&"button"===o.editing.addNewRow.displayMode&&o._rowElements[h]&&(o._newRow||(o._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:o,addNewRow:!0,inline:!0,autoGenerated:!0})),o._newRow.element=o._rowElements[h],o._newRow.element.classList.remove("smart-hidden"),o._newRow.render()),p&&o._selection.selectionRect&&o._refreshCellSelectionRect()}_renderFrozenRows(){const e=this;let t=!1,o=!1;0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(s=4),"center"!==l&&"middle"!==l||(s+=i.height/2-n.height/2),"bottom"===l&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility(),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo,sorting:o.getSortedColumns(),filtering:o.getFilteredColumns(),grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action)return void(t&&t(e.result));if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"expand"===e.action)o.refresh();else if("scroll"===e.action)if("infinite"===o.scrolling)o._recycle(!1,!1);else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action?(o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize)),o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements()):o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&(t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max,e.closeMenu(),e._addingNewRow=!1}),100)},t}addNewColumn(e){e&&this.columns.push(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.remove(),void delete t.editing.addNewRow._addButton;if("float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{"float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)?t.editing.addNewRow._addButton.classList.remove("float"):t.computedVerticalScrollBarVisibility?t.computedVerticalScrollBarVisibility&&"float"===e&&t.editing.addNewRow._addButton.classList.add("float"):t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.editing.addNewRow._addButton.style.bottom="20px":t.editing.addNewRow._addButton.style.bottom=""};t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&(t.editing.addNewRow._addButton||(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.appendChild(t.editing.addNewRow._addButton)),requestAnimationFrame((()=>{t.editing.addNewRow._addButton.classList.add("show"),o()})))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if(t._recycle(!1),t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")})))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;e.canNotify=!1,o?o.forEach((t=>{void 0!==e[t]&&(e[t]=o[t])})):(e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null),e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e){const t=this;t.isInitialized&&(e&&(t._initializeRows(),t._initializeRowElements()),t._refresh(),t._refreshSummary())}refreshView(){this._recycle()}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t){const o=this;o._isUpdating--,o._isUpdating<0&&(o._isUpdating=0),!1!==e?o.refresh():!1!==t&&o.refreshView()}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
1437
+ Smart("smart-grid",class extends Smart.ScrollViewer{static get properties(){return{appearance:{value:{alternationStart:{value:0,type:"int"},alternationEnd:{value:0,type:"int"},alternationCount:{value:0,type:"int"},allowHover:{value:!1,type:"boolean",defaultReflectToAttribute:!0},allowHeaderHover:{value:!0,type:"boolean",defaultReflectToAttribute:!0},allowRowToggleAnimation:{value:!1,type:"boolean"},allowRowDetailToggleAnimation:{value:!1,type:"boolean"},allowSortAnimation:{value:!1,type:"boolean"},allowColumnLabelAnimation:{value:!0,type:"boolean"},allowCheckBoxesSelectionAnimation:{value:!0,type:"boolean"},allowColumnMenuAnimation:{value:!0,type:"boolean"},allowColumnSortButtonAnimation:{value:!0,type:"boolean"},allowColumnActionButtonAnimation:{value:!0,type:"boolean"},allowColumnFilterButtonAnimation:{value:!0,type:"boolean"},allowColumnStickyPosition:{value:!1,type:"boolean"},autoShowColumnSortButton:{value:!0,type:"boolean"},autoShowColumnActionButton:{value:!0,type:"boolean"},autoGenerateRowLabelMode:{value:"number",type:"string"},autoGenerateColumnLabelMode:{value:"letter",type:"string"},autoShowColumnFilterButton:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},placeholder:{value:"No Rows",type:"string"},sortAnimationDuration:{value:500,type:"number"},showRowHeader:{value:!1,type:"boolean"},showRowStatus:{value:!1,type:"boolean"},showRowHeaderNumber:{value:!1,type:"boolean"},showRowHeaderEditIcon:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowHeaderDragIcon:{value:!1,type:"boolean"},showRowHeaderSelectIcon:{value:!1,type:"boolean"},showRowHeaderFocusIcon:{value:!1,type:"boolean"},showColumnHeaderLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showColumnLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showRowLines:{value:!0,type:"boolean",defaultReflectToAttribute:!0},showFilterColumnBackground:{value:!0,type:"boolean"},showSortColumnBackground:{value:!0,type:"boolean"},showFrozenColumnBackground:{value:!0,type:"boolean"},showFrozenRowBackground:{value:!0,type:"boolean"},showColumnSortButton:{value:!0,type:"boolean"},showColumnFilterButton:{value:!0,type:"boolean"},showColumnDescriptionButton:{value:!1,type:"boolean"},showColumnIcon:{value:!1,type:"boolean"},showColumnCustomButton:{value:!1,type:"boolean"},showColumnActionButton:{value:!0,type:"boolean"},showColumnGroupsInColumnPanel:{value:!1,type:"boolean"},showTooltips:{value:!1,type:"boolean"},showResizeTooltips:{value:!0,type:"boolean"},showHorizontalScrollBarOnFixedColumns:{value:!1,type:"boolean"},showVerticalScrollBarOnFixedColumns:{value:!1,type:"boolean"}},type:"object"},behavior:{value:{allowColumnAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowRowAutoSizeOnDoubleClick:{value:!0,type:"boolean"},allowColumnReorder:{value:!1,type:"boolean"},allowColumnFreeze:{value:!0,type:"boolean"},allowRowReorder:{value:!1,type:"boolean"},doubleClickTimingDelay:{value:300,type:"number"},columnResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]},rowResizeMode:{value:"none",type:"string",allowedValues:["none","split","growAndShrink"]}},type:"object"},layout:{value:{allowCellsWrap:{value:!1,type:"boolean"},allowCellsWrapShortcut:{value:!0,type:"boolean"},autoGenerateColumnWidth:{value:null,type:"number?"},autoSizeNewColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoSizeNewColumnMinWidth:{value:180,type:"number",reflectToAttribute:!1},columnWidth:{value:null,type:"any",reflectToAttribute:!1},columnHeight:{value:null,type:"any",reflectToAttribute:!1},columnMinHeight:{value:30,type:"any",reflectToAttribute:!1},isDirty:{value:!1,type:"boolean"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},rowMinHeight:{value:30,type:"number"},rowHeight:{value:null,type:"any",reflectToAttribute:!1}},type:"object"},dataExport:{value:{header:{value:!0,type:"boolean"},filterBy:{value:null,type:"object"},groupBy:{value:null,type:"object"},style:{value:null,type:"object"},fileName:{value:"smartGrid",type:"string?"},pageOrientation:{value:"portrait",type:"string"},expandChar:{value:"+",type:"string"},collapseChar:{value:"-",type:"string"},view:{value:!1,type:"boolean"},viewStart:{value:null,type:"number?"},viewEnd:{value:null,type:"number?"},rowIds:{value:null,type:"array?"}},type:"object"},clipboard:{value:{enabled:{value:!0,type:"boolean"},autoFillMode:{value:"copy",allowedValues:["none","copy","fillSeries"],type:"string"},onPasteValue:{value:null,type:"any"}},type:"object"},conditionalFormatting:{value:null,type:"array?",reflectToAttribute:!1},columns:{value:[],type:"any",reflectToAttribute:!1},columnMenu:{value:{autoClose:{value:!0,type:"boolean"},dataSource:{value:{columnMenuCustomizeType:{value:{command:{value:"customizeTypeCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-settings",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDuplicate:{value:{command:{value:"duplicateCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-duplicate",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertLeft:{value:{command:{value:"insertLeftCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-left",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemInsertRight:{value:{command:{value:"insertRightCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-insert-right",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortAsc:{value:{command:{value:"sortAscCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-up",type:"string"},iconAlt:{value:"smart-icon-sort-number-up",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemSortDesc:{value:{command:{value:"sortDescCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-sort-name-down",type:"string"},iconAlt:{value:"smart-icon-sort-number-down",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveSort:{value:{command:{value:"removeSortCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemFilter:{value:{command:{value:"addFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-add-filter",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveFilter:{value:{command:{value:"removeFilterCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemGroupBy:{value:{command:{value:"groupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-group",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemRemoveGroupBy:{value:{command:{value:"removeGroupByCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:"auto",type:"any"},icon:{value:"smart-icon-ungroup",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemHide:{value:{command:{value:"hideColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-visibility-off",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1},columnMenuItemDelete:{value:{command:{value:"deleteColumnCommand",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"}},type:"object",reflectToAttribute:!1}},type:"object",reflectToAttribute:!1},visible:{value:!1,type:"boolean"},enabled:{value:!0,type:"boolean"},width:{value:250,type:"number"},height:{value:null,type:"number?"}},type:"object",reflectToAttribute:!1},columnGroups:{value:[],type:"array",reflectToAttribute:!1},charting:{value:{appendTo:{value:null,type:"any"},enabled:{value:!1,type:"boolean"},colorScheme:{value:"scheme01",type:"string"},description:{value:"",type:"string"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:400,type:"any"},width:{value:400,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!0,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},formatSettings:{value:{},type:"object"}},type:"object"},view:{value:"grid",allowedValues:["grid","kanban"],type:"string"},currentUser:{value:null,type:"any"},dataSource:{value:null,type:"any",reflectToAttribute:!1},dataSourceMap:{value:{checklist:"checklist",color:"color",comments:"comments",dueDate:"dueDate",id:"id",priority:"priority",progress:"progress",startDate:"startDate",status:"status",swimlane:"swimlane",tags:"tags",text:"text",description:"description",userId:"userId",history:"history",createdUserId:"createdUserId",createdDate:"createdDate",updatedUserId:"updatedUserId",updatedDate:"updatedDate"},type:"any",reflectToAttribute:!1},dataSourceSettings:{value:{autoGenerateColumns:{value:!1,type:"boolean"},sanitizeHTML:{value:"blackList",allowedValues:["all","blackList","none"],type:"string"},root:{value:"",type:"string"},record:{value:"",type:"string"},keyDataField:{value:"",type:"string"},parentDataField:{value:"",type:"string"},childrenDataField:{value:"",type:"string"},groupBy:{value:[],type:"array"},dataFields:{value:[],type:"array"},mapChar:{value:".",type:"string"},id:{value:"",type:"string"},virtualDataSource:{value:null,type:"any"},virtualDataSourceOnExpand:{value:null,type:"any"}},type:"object"},grouping:{value:{enabled:{value:!1,type:"boolean",reflectToAttribute:!1},allowCollapse:{value:!1,type:"boolean",reflectToAttribute:!1},autoHideGroupColumn:{value:!1,type:"boolean",reflectToAttribute:!1},autoExpandAll:{value:!1,type:"boolean",reflectToAttribute:!1},expandMode:{value:"buttonClick",type:"string",allowedValues:["buttonClick","rowClick"],reflectToAttribute:!1},renderMode:{type:"string",value:"advanced",allowedValues:["basic","compact","advanced"]},groupRowHeight:{value:50,type:"any",reflectToAttribute:!1},toggleButtonIndent:{value:27,type:"number",reflectToAttribute:!1},groupIndent:{value:27,type:"number",reflectToAttribute:!1},groupBar:{value:{visible:{value:!1,type:"boolean",reflectToAttribute:!1},allowColumnDragDrop:{value:!0,type:"boolean",reflectToAttribute:!0},allowColumnCloseButtons:{value:!0,type:"boolean",reflectToAttribute:!0}},type:"object"},summaryRow:{value:{inline:{value:!0,type:"boolean"},visible:{value:!0,type:"boolean"}},type:"object"}},type:"object"},messages:{extend:!0,value:{en:{invalidColumnProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Column: "{{type}}"',invalidRowProperty:'{{elementType}}: Invalid property name "{{propertyName}}" set for Row"',invalidCellValue:'Invalid cell value "{{value}}", Validation rule: "{{validationRule}}"',invalidValue:"Invalid value",invalidMinValue:"{{value}} above {{min}} must be filled out",invalidMaxValue:"{{value}} below {{max}} must be filled out",invalidMinLengthValue:"{{value}} is shorter than the minimum length of {{min}} characters",invalidMaxLengthValue:"{{value}} is longer than the maximum length of {{max}} characters",requiredValue:"{{value}} must be filled out",frozenColumns:"{{elementType}}: To Pin/Freeze a column group, all columns within it should be frozen.",frozenRows:"{{elementType}}: To Pin/Freeze a special cell, all rows within it should be frozen.",columnGroups:"{{elementType}}: Please, check the initialization of the smartGrid's columns array. The columns in a column group are expected to be siblings in the columns array.",viewGrid:"Grid",viewKanban:"Kanban",kanbanNone:"None",kanbanNoneDescription:"Start from scratch with a completely blank project board. You can add columns and configure settings yourself.",kanbanBasic:"Basic kanban",kanbanBasicDescription:'Start from Basic kanban-style board with columns for "To do", "in progress" and "Done".',uncategorized:"Uncategorized",toDo:"To do",inProgress:"In progress",done:"Done",min:"Min: {{value}}",max:"Max: {{value}} ",sum:"Sum: {{value}} ",avg:"Avg: {{value}} ",cells:"{{value}} cells selected",rows:"{{value}} rows",oneRow:"1 row",unique:"Unique: {{value}}",blank:"Empty: {{value}}",filled:"Filled: {{value}}",summary:"Summary",countSummary:"Count",minSummary:"Min",maxSummary:"Max",avgSummary:"Avg",blankSummary:"Empty",uniqueSummary:"Unique",filledSummary:"Filled",sumSummary:"Sum",completed:"Tasks Completed: {{value}}",count:"Count: {{value}} ",pagerFirstButton:"First",pagerLastButton:"Last",pagerPreviousButton:"Previous",pagerNextButton:"Next",pagerNavigateToLabel:"Go to:",pagerPageSizeLabel:"Show:",pagerNavigateToInputPlaceholder:"",pagerEllipsis:"...",pagerSummaryString:"of",pagerSummaryPrefix:"of",pagerSummarySuffix:"",columnMenuCustomizeType:"Settings",columnMenuItemDuplicate:"Duplicate",columnMenuItemInsertLeft:"Insert left",columnMenuItemInsertRight:"Insert right",columnMenuItemSortAsc:"Sort {{mode}}",columnMenuItemSortDesc:"Sort {{mode}}",columnMenuItemRemoveSort:"Remove Sort",columnMenuItemFilter:"Filter",columnMenuItemRemoveFilter:"Remove Filter",columnMenuItemGroupBy:"Group by this column",columnMenuItemRemoveGroupBy:"Remove Group",columnMenuItemHide:"Hide field",columnMenuItemShow:"Show field",columnMenuItemDelete:"Delete field",columnResizeTooltip:"width: {{value}}px",rowResizeTooltip:"height: {{value}}px",commandBarAddRow:"Add",commandBarDeleteRow:"Delete",commandBarBatchRevert:"Revert",commandBarBatchSave:"Save",commandBarFilter:"Filter",commandBarSort:"Sort",commandBarSearch:"Search",commandBarCustomize:"Customize",commandBarGroup:"Group",commandColumnEdit:"Edit",commandColumnDelete:"Delete",commandColumnCancel:"Cancel",commandColumnUpdate:"Update",commandColumnMenu:"",expandRow:"Expand row (Shift + Enter)",expandRowComments:"Expand row and see {{value}} comments",collapseRow:"Collapse row",addNewRow:"Click here to add a new row",addNewRowAlt:"<span>Add new empty row</span> <code>Shift</code> + <code>Space</code>",addNewColumn:"Click here to add a new column",dialogChartHeader:"{{value}} Chart",dialogRowDetailHeader:"Row Id: {{value}}",dialogDescriptionHeader:"Column: {{value}}",dialogRowDetailButtonConfirm:"OK",dialogRowDetailButtonCancel:"CANCEL",dialogEditHeader:"Edit Record with Id: {{value}}",dialogExpandRowHeader:"Edit Record",dialogAddButtonConfirm:"ADD",dialogAddButtonCancel:"CANCEL",dialogEditButtonConfirm:"OK",dialogEditButtonCancel:"CANCEL",dialogFilterButtonConfirm:"FILTER",dialogFilterButtonCancel:"CLEAR",dialogDeleteButtonConfirm:"DELETE",dialogDeleteButtonCancel:"CANCEL",dialogEditColumn:"Column: {{value}}",dialogNewColumn:"New field",dialogAddColumn:"Add Column",dialogAddColumnStatus:"Create a group field",dialogAddColumnStatusDescription:"Represent the status of each record",dialogAddColumnStatusNotes:"Your data will be grouped in columns based on this field",dialogAddHeader:"Add Row",dialogDeleteHeader:"Delete Row",dialogFilterHeader:"Filter by",dialogFilterMinLabel:"Min",dialogFilterMaxLabel:"Max",dialogImageHeader:"Image",dialogImageDrop:"or drag and drop image(s) to upload",dialogImageUpload:"Select Image(s) to Upload",dialogImageURL:"You can also provide the URL to an image",dialogImageURLUpload:"Upload",dialogImageLink:"Link (URL)",dialogImageDevice:"My Device",dialogImageSize:'No image currently added. The "{{value}}" image cannot be uploaded. Maximum image size is {{fileSize}}.',dialogImageCount:'The following images cannot be added "{{files}}". Maximum images allowed is {{fileCount}}.',dialogImageFileUpload:"No images currently selected for upload",dialogAddColumnName:"Name",dialogAddColumnNameInfo:"Name of the column. The name of the column will be displayed in the column header.",dialogAddColumnDescription:"Description",dialogAddColumnDescriptionInfo:"Description of the column. When the description is set, an icon will be displayed in the column header. A tooltip with the description will be displayed when you point at the icon.",dialogAddColumnNamePlaceholder:"Column name (optional)",dialogAddColumnDescriptionPlaceholder:"Describe this column (optional)",dialogAddColumnType:"Type",dialogAddColumnTypeInfo:'Type of the data in the column. Unlike a spreadsheet, Columns have specific "types" that allow you to store rich content in each record. For example, a table can contain records (rows) with images, long texts, checkboxes.',dialogAddColumnTypeText:"Text",dialogAddColumnTypeMultilineText:"Multiline text",dialogAddColumnTypeImage:"Image",dialogAddColumnTypeNumber:"Number",dialogAddColumnTypeSelect:"Select",dialogAddColumnTypeMultipleSelect:"Multiple Select",dialogAddColumnTypeDate:"Date",dialogAddColumnTypeCheckBox:"CheckBox",dialogAddColumnTypeCreatedTime:"Created time",dialogAddColumnTypeLastUpdatedTime:"Last modified time",dialogAddColumnTypeCreatedBy:"Created by",dialogAddColumnTypeLastUpdatedBy:"Last modified by",dialogAddColumnTypeCollaborator:"Collaborator",dialogAddColumnTypeSlider:"Slider",dialogAddColumnTypeAutoNumber:"Auto Number",dialogAddColumnTypeURL:"URL",dialogAddColumnTypeEmail:"Email",dialogAddColumnTypePassword:"Password",dialogAddColumnTypePhone:"Phone",dialogAddColumnDateFormat:"Date format",dialogAddColumnDateFormatInfo:"Choose the dates display format",dialogAddColumnDateFormatShort:"Short",dialogAddColumnDateFormatLong:"Long",dialogAddColumnDateFormatEU:"EU",dialogAddColumnDateFormatISO:"ISO",dialogAddColumnDateFormatAS:"AS",dialogAddColumnDateFormatFull:"Full",dialogAddColumnDateFormatSlash:"Slash",dialogAddColumnDateFormatHyphen:"Hyphen",dialogAddColumnDateFormatDot:"Dot",dialogAddColumnTimeFormat:"Time format",dialogAddColumnTimeFormatInfo:"Choose the time display format",dialogAddColumnTimeFormatHour:"hour",dialogAddColumnAllowTimeFormat:"Include a time field",dialogAddColumnCustomDateSeparator:"Set a custom separator",dialogAddColumnNumberFormat:"Number format",dialogAddColumnNumberFormatInfo:"Choose the number display format",dialogAddColumnNumberFormatInteger:"Integer",dialogAddColumnNumberFormatNumber:"Number",dialogAddColumnNumberFormatPercent:"Percent",dialogAddColumnNumberFormatPercentRounded:"Percent(rounded)",dialogAddColumnNumberFormatScientific:"Scientific",dialogAddColumnNumberFormatEngineering:"Engineering",dialogAddColumnNumberFormatAccounting:"Accounting",dialogAddColumnNumberFormatUnit:"Unit",dialogAddColumnNumberFormatUnitInfo:"Units of measurement",dialogAddColumnNumberFormatUnitAcre:"Acre",dialogAddColumnNumberFormatUnitCelsius:"Celsius",dialogAddColumnNumberFormatUnitFahrenheit:"Fahrenheit",dialogAddColumnNumberFormatUnitPercent:"Percent",dialogAddColumnNumberFormatUnitDegree:"Degree",dialogAddColumnNumberFormatUnitMegaByte:"Mega byte",dialogAddColumnNumberFormatUnitCentimeter:"Centimeter",dialogAddColumnNumberFormatUnitMeter:"Meter",dialogAddColumnNumberFormatUnitKilometer:"Kilometer",dialogAddColumnNumberFormatUnitMile:"Mile",dialogAddColumnNumberFormatUnitKilogram:"Kilogram",dialogAddColumnNumberFormatUnitPound:"Pound",dialogAddColumnNumberFormatUnitLiter:"Liter",dialogAddColumnNumberFormatUnitGallon:"Gallon",dialogAddColumnNumberFormatUnitSecond:"Second",dialogAddColumnNumberFormatUnitMinute:"Minute",dialogAddColumnNumberFormatUnitHour:"Hour",dialogAddColumnNumberFormatUnitDay:"Day",dialogAddColumnNumberFormatUnitWeek:"Week",dialogAddColumnNumberFormatUnitMonth:"Month",dialogAddColumnNumberFormatUnitYear:"Year",dialogAddColumnNumberFormatCurrency:"Currency",dialogAddColumnNumberFormatCurrencyRounded:"Currency(rounded)",dialogAddColumnMinLength:"Minimum length",dialogAddColumnMinLengthInfo:"Minimum text length",dialogAddColumnMaxLength:"Maximum length",dialogAddColumnMaxLengthInfo:"Maximum text length",dialogAddColumnMinValue:"Minimum value",dialogAddColumnMinValueInfo:"Minimum number",dialogAddColumnMaxValue:"Maximum value",dialogAddColumnMaxValueInfo:"Maximum number",dialogAddColumnMinDate:"Minimum date",dialogAddColumnMinDateInfo:"Minimum date",dialogAddColumnMaxDate:"Maximum date",dialogAddColumnMaxDateInfo:"Maximum date",dialogAddColumnColorItems:"Color items",dialogAddColumnListItems:"List items",dialogAddColumnAlign:"Align",dialogAddColumnAlignLeft:"Left",dialogAddColumnAlignRight:"Right",dialogAddColumnAlignCenter:"Center",dialogAddColumnAlignInfo:"Table cells text alignment",dialogAddColumnResizable:"Resizable",dialogAddColumnResizableInfo:"Select if you want to make the column resizable",dialogAddColumnRequired:"Required",dialogAddColumnRequiredInfo:"Select if you want to make the column required",dialogAddColumnSortable:"Sortable",dialogAddColumnSortableInfo:"Select if you want to sort by this column",dialogAddColumnFilterable:"Filterable",dialogAddColumnFilterableInfo:"Select if you want to filter by this column",dialogAddColumnEditable:"Editable",dialogAddColumnEditableInfo:"Select if you want to edit by this column",dialogAddColumnMultipleCollaborators:"Multiple Collaborators",dialogAddColumnMultipleCollaboratorsInfo:"Select if you want to allow multiple collaborators",dialogAddColumnCheckItems:"Show Checkbox",bold:"Bold",fontStyle:"Font Style",italic:"Italic",send:"Send",status:"Status",underline:"Underline",comments:"Comments",comment:"Comment",noComments:"No comments to this record yet",guestUser:"Guest",background:"Background",starred:"Starred",resetFormat:"Reset Format",notStarred:"Not starred",color:"Color",coloredItems:"Colored items",conditionalFormatting:"Conditional Formatting",groupBarLabel:"Drag a column header here to group by that column",dialogDeleteContent:"Are you sure you want to delete this row?",detailsTab:"Details",commentsTab:"Comments",historyTab:"History",historyEvent:"Event",historyAuthor:"Author",historyDetails:"Details",range:'Changed {{column}} from "{{oldValue}}" to "{{newValue}}"',nullRange:'Changed {{column}} to "{{newValue}}"',rowCreated:"Row Created",propertyUpdated:'"{{value}}" updated',propertyRemoved:'"{{value}}" removed',dropImages:"Drop images here",addImages:"Add images",unassigned:"Unassigned",historyDate:"Date",calendar:{"/":"/",":":":",firstDay:0,days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},months:{names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},AM:["AM","am","AM"],PM:["PM","pm","PM"],eras:[{name:"A.D.",start:null,offset:0}],currencySymbol:"$",currency:"USD",currencySymbolPosition:"before",decimalSeparator:".",thousandsSeparator:","},CONTAINS:"Contains",DOES_NOT_CONTAIN:"Does not contain",ENDS_WITH:"Ends with",EQUAL:"Equal",GREATER_THAN:"Greater than",GREATER_THAN_OR_EQUAL:"Greater than or equal",LESS_THAN:"Less than",LESS_THAN_OR_EQUAL:"Less than or equal",NOT_EQUAL:"Not equal",RANGE:"Range",CLEAR_FILTER:"Clear Filter",STARTS_WITH:"Starts with",addFilter:"+ Add filter",and:"And",apply:"Apply",booleanFirst:"☐",booleanLast:"☑",cancel:"Cancel",CONTAINS_CASE_SENSITIVE:"Contains (case sensitive)",dateFirst:"1",dateLast:"9",DOES_NOT_CONTAIN_CASE_SENSITIVE:"does not contain (case sensitive)",EMPTY:"empty",ENDS_WITH_CASE_SENSITIVE:"ends with (case sensitive)",EQUAL_CASE_SENSITIVE:"equal (case sensitive)",filter:"Filter",customize:"Hide fields",customizeOne:"1 hidden field",customizeHidden:"{{n}} hidden fields",filteredByMultiple:"{{n}} filters",filteredByOne:"1 filter",filterValuePlaceholder:"Value",find:"Find a field",findInView:"Find in view",firstBy:"Sort by",found:"{{nth}} of {{n}}",from:"from",noFilters:"No filters applied",noResults:"No results",noSorting:"No sorting applied",NOT_EMPTY:"not empty",NOT_NULL:"not null",NULL:"null",numberFirst:"1",numberLast:"9",ok:"OK",or:"Or",pickAnother:"Pick another field to sort by",sort:"Sort",group:"Group",sortedByMultiple:"Sorted by {{n}} fields",sortedByOne:"Sorted by 1 field",STARTS_WITH_CASE_SENSITIVE:"starts with (case sensitive)",stringFirst:"A",stringLast:"Z",thenBy:"then by",where:"Where",collapseAll:"Collapse all",expandAll:"Expand all",noGrouping:"No grouping",groupedByMultiple:"{{n}} groups",groupedByOne:"1 group",deleteByMultiple:"Delete {{n}} rows",deleteByOne:"Delete 1 row",download:"Download",firstByGroup:"Group by",expandRecord:"Expand row",pickAnotherGroupBy:"Pick another field to group by",add:"Add condition",all:"All columns",between:"Between",close:"Close",column:"Column:",condition:"Condition:",equal:"equal",fontFamily:"Font family:",fontSize:"Font size:",format:"Format:",greaterThan:"greater than",highlight:"Highlight",lessThan:"less Than",notEqual:"not equal",remove:"Remove condition",secondValue:"Second value:",text:"Text",value:"Value:",addCondition:"Add Condition",addGroup:"Add Group",blanks:"(Blanks)",clear:"Clear",contains:"contains",containsCaseSensitive:"contains (case sensitive)",dateTabLabel:"DATE",doesNotContain:"does not contain",doesNotContainCaseSensitive:"does not contain (case sensitive)",empty:"empty",endsWith:"ends with",endsWithCaseSensitive:"ends with (case sensitive)",equalCaseSensitive:"equal (case sensitive)",greaterThanOrEqual:"greater than or equal",lessThanOrEqual:"less than or equal",mismatchedProperties:'smartFilterPanel: The "filterType" and the data type of the selected "dataField" are mismatched.',missingProperty:'smartFilterPanel: When mode is \'excel\', either "data" and "dataField" or "dataSource" of type Array have to be set.',notEmpty:"not empty",notNull:"not null",null:"null ",placeholderBoolean:"Select value",placeholderDate:"Enter date",placeholderNumber:"Enter number",placeholderTime:"Enter time",placeholderValue:"Enter value",selectAll:"(Select All)",showRows:"Show rows where:",startsWith:"starts with",startsWithCaseSensitive:"starts with (case sensitive)",matchCase:"Match Case",timeTabLabel:"TIME",today:"Today",formatColumn:"Format Column",formating:"Conditional Formatting",reset:"Reset",filteredRecords:"All rows are filtered"}},type:"object"},onCellValue:{value:null,type:"any",reflectToAttribute:!1},onCellUpdate:{value:null,type:"any",reflectToAttribute:!1},onCellRender:{value:null,type:"any",reflectToAttribute:!1},onBeforeInit:{value:null,type:"any",reflectToAttribute:!1},onInit:{value:null,type:"any",reflectToAttribute:!1},onAfterInit:{value:null,type:"any",reflectToAttribute:!1},onKey:{value:null,type:"any",reflectToAttribute:!1},onRender:{value:null,type:"any",reflectToAttribute:!1},onChartInit:{value:null,type:"any",reflectToAttribute:!1},onRowInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailInit:{value:null,type:"any",reflectToAttribute:!1},onRowDetailUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowInserted:{value:null,type:"any",reflectToAttribute:!1},onRowRemoved:{value:null,type:"any",reflectToAttribute:!1},onRowUpdate:{value:null,type:"any",reflectToAttribute:!1},onRowUpdated:{value:null,type:"any",reflectToAttribute:!1},onRowStarred:{value:null,type:"any",reflectToAttribute:!1},onRowResize:{value:null,type:"any",reflectToAttribute:!1},onColumnInit:{value:null,type:"any",reflectToAttribute:!1},onColumnInserted:{value:null,type:"any",reflectToAttribute:!1},onColumnRemoved:{value:null,type:"any",reflectToAttribute:!1},onColumnResize:{value:null,type:"any",reflectToAttribute:!1},onColumnReorder:{value:null,type:"any",reflectToAttribute:!1},onColumnSummaryChange:{value:null,type:"any",reflectToAttribute:!1},onColumnUpdated:{value:null,type:"any",reflectToAttribute:!1},onCommand:{value:null,reflectToAttribute:!1,type:"any"},filtering:{value:{enabled:{value:!1,type:"boolean"},operator:{value:"and",type:"string"},filter:{value:[],type:"array",reflectToAttribute:!1},filterRow:{value:{visible:{value:!1,type:"boolean"},menuVisible:{value:!1,type:"boolean"},applyMode:{value:"auto",type:"string",allowedValues:["auto","click"]},autoApplyModeDelay:{value:500,type:"number"}},type:"object"},filterMenu:{value:{visible:{value:!0,type:"boolean"},buttons:{value:["cancel","clear","filter"],type:"array"},dataSource:{value:null,type:"any"},width:{value:250,type:"number"},height:{value:200,type:"number"},mode:{value:"default",allowedValues:["default","excel"],type:"string"},messages:{value:null,type:"object"}},type:"object"}},type:"object"},editing:{value:{allowRowHeaderEdit:{value:!1,type:"any"},allowColumnHeaderEdit:{value:!1,type:"any"},autoUpdateFilterAndSort:{value:!0,type:"any"},active:{value:!1,readonly:!0,type:"boolean"},enabled:{value:!1,type:"boolean"},batch:{value:!1,type:"any"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},commandKeys:{value:{commandKeyCancel:{value:{command:"commandKeyCancelCommand",key:"Escape"},type:"object"},commandKeyUpdate:{value:{command:"commandKeyUpdateCommand",key:"Enter | Tab"},type:"object"}},type:"object"},commandBar:{value:{visible:{value:!1,type:"boolean"},position:{value:"near",allowedValues:["near","far","both"],type:"string"},displayMode:{value:"labelAndIcon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandBarAddRow:{value:{command:{value:"commandBarAddRowCommand",type:"any"},icon:{value:"smart-icon-plus",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarDeleteRow:{value:{command:{value:"commandBarDeleteRowCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandBarBatchSave:{value:{command:{value:"commandBarBatchSaveCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandBarBatchRevert:{value:{command:{value:"commandBarBatchRevertCommand",type:"any"},icon:{value:"smart-icon-reload",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"}},type:"object"}},type:"object"},commandColumn:{value:{visible:{value:!1,type:"boolean"},inline:{value:!1,type:"boolean"},position:{value:"far",allowedValues:["near","far"],type:"string"},displayMode:{value:"icon",allowedValues:["label","icon","labelAndIcon"],type:"string"},dataSource:{value:{commandColumnMenu:{value:{command:{value:"commandColumnMenuCommand",type:"any"},icon:{value:"smart-icon-menu",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnEdit:{value:{command:{value:"commandColumnEditCommand",type:"any"},icon:{value:"smart-icon-mode-edit",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnDelete:{value:{command:{value:"commandColumnDeleteCommand",type:"any"},icon:{value:"smart-icon-delete",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!0,type:"any"}},type:"object"},commandColumnUpdate:{value:{command:{value:"commandColumnUpdateCommand",type:"any"},icon:{value:"smart-icon-ok-squared",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnCancel:{value:{command:{value:"commandColumnCancelCommand",type:"any"},icon:{value:"smart-icon-cancel-circled",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:"auto",type:"any"}},type:"object"},commandColumnRowMenu:{value:{command:{value:"commandColumnRowMenuCommand",type:"any",reflectToAttribute:!1},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"{{messages}}",type:"string"},visible:{value:!1,type:"any"}},type:"object"},commandColumnCustom:{value:{command:{value:"",type:"any"},icon:{value:"smart-icon-ellipsis-vert",type:"string"},label:{value:"",type:"string"},visible:{value:!1,type:"any"}},type:"object"}},type:"object"},width:{value:null,type:"number?"}},reflectToAttribute:!1,type:"object"},mode:{value:"cell",allowedValues:["cell","row"],type:"string"},addNewColumn:{value:{visible:{value:!1,type:"boolean"}},type:"object"},addNewRow:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},visible:{value:!1,type:"boolean"},autoEdit:{value:!0,type:"boolean"},autoCreate:{value:!1,type:"boolean"},autoSave:{value:!0,type:"boolean"},label:{value:"{{message}}",type:"string"},displayMode:{value:"row",allowedValues:["row","button"],type:"string"}},type:"object"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},addColumnDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:430,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"},deleteDialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:"auto",type:"any"},width:{value:"auto",type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},paging:{value:{enabled:{value:!1,type:"boolean"},spinner:{value:{enabled:{value:!1,type:"boolean"},step:{value:1,type:"number"}},type:"object"},pageHierarchySize:{value:2,type:"int"},pageSize:{value:10,type:"int"},pageIndex:{value:0,type:"int",validator:"pageIndexValidator"}},type:"object"},pager:{value:{autoEllipsis:{value:"both",allowedValues:["none","before","after","both"],type:"string"},position:{value:"far",allowedValues:["near","far","both"],type:"string"},template:{value:"",type:"string"},pageSizeSelector:{value:{visible:{value:!1,type:"boolean"},dataSource:{value:[10,20,50],type:"object"},position:{value:"far",allowedValues:["near","far"],type:"string"}},type:"object"},summary:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},navigationButtons:{value:{position:{value:"both",allowedValues:["near","far","both"],type:"string"},prevNextButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},firstLastButtons:{value:{visible:{value:!0,type:"boolean"}},type:"object"},labels:{value:{visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},navigationInput:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"}},type:"object"},pageIndexSelectors:{value:{visible:{value:!0,type:"boolean"},dataSource:{value:10,type:"any"}},type:"object"},visible:{value:!1,type:"boolean"}},type:"object",reflectToAttribute:!1},rowDetail:{value:{enabled:{value:!1,type:"boolean"},height:{value:200,type:"number"},position:{value:"near",allowedValues:["near","far"],type:"string"},template:{value:"",type:"any",reflectToAttribute:!1},visible:{value:!0,type:"boolean"},dialog:{value:{header:{value:"{{message}}",type:"string"},height:{value:300,type:"any"},width:{value:360,type:"any"},left:{value:"center",type:"any"},top:{value:"center",type:"any"},enabled:{value:!1,type:"boolean"},visible:{value:!1,type:"boolean"}},type:"object"}},type:"object"},summaryRow:{value:{position:{value:"far",allowedValues:["near","far"],type:"string"},visible:{value:!1,type:"boolean"},editing:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},scrolling:{value:"physical",allowedValues:["physical","virtual","infinite","deferred"],type:"string"},columnHeader:{value:{visible:{value:!0,type:"boolean"}},type:"object"},groupHeader:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},header:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"},buttons:{value:["columns","filter","group","sort","format","search"],type:"array"},onInit:{value:null,type:"any"}},type:"object"},footer:{value:{visible:{value:!1,type:"boolean"},template:{value:"",type:"string"}},type:"object"},checkBoxes:{value:{visible:{value:!1,type:"boolean"},hasThreeStates:{value:!1,type:"boolean"}},type:"object"},selection:{value:{enabled:{value:!1,type:"boolean"},allowRowHeaderSelection:{value:!1,type:"boolean"},allowColumnHeaderSelection:{value:!1,type:"boolean"},allowRowSelection:{value:!0,type:"boolean"},allowCellSelection:{value:!1,type:"boolean"},allowDragSelection:{value:!0,type:"boolean"},allowDragSelectionAutoScroll:{value:!0,type:"boolean"},allowCellDragSelectionHandle:{value:!0,type:"boolean"},allowCellDragDropSelectionHandle:{value:!0,type:"boolean"},allowCellDragSelectionAutoFill:{value:!0,type:"boolean"},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},mode:{value:"many",type:"string",allowedValues:["one","many","extended"]},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},checkBoxes:{value:{enabled:{value:!1,type:"boolean"},autoShow:{value:!1,type:"boolean"},action:{value:"click",type:"string",allowedValues:["none","click","doubleClick"]},selectAllMode:{value:"page",allowedValues:["none","page","all"],type:"string"},position:{value:"near",allowedValues:["near","far"],type:"string"}},type:"object"},selected:{value:"",type:"string"},tabKeyBehavior:{value:"default",allowedValues:["none","default"],type:"string"},defaultSelection:{value:!1,type:"boolean"}},type:"object"},sorting:{value:{enabled:{value:!1,type:"boolean"},sort:{value:[],type:"array"},mode:{value:"one",allowedValues:["one","many"],type:"string"},commandKey:{value:"",allowedValues:["","shiftKey","controlKey","altKey"],type:"string"},sortToggleThreeStates:{value:!0,type:"boolean"}},type:"object"},storeHistory:{value:!1,type:"boolean"},storeHistoryItems:{value:20,type:"number"},users:{value:[],type:"array",reflectToAttribute:!1},virtualModeCachedRowsCount:{value:100,type:"int"}}}static get requires(){return{}}static get styleUrls(){return["smart.menu.css","smart.filterpanel.css","smart.pager.css","smart.grid.css","smart.textbox.css"]}template(){return"<div class='smart-container'id='container' disabled='[[disabled]]' role='grid'>\n <div id='header' role=\"toolbar\" class='smart-grid-header smart-hidden'>\n </div>\n <div id='groupHeader' role=\"presentation\" class='smart-grid-group-header smart-hidden'></div>\n <div id='headerPager' top class='smart-grid-pager smart-hidden'></div>\n <div id='headerCommandBar' header top class='smart-grid-header smart-grid-command-bar smart-hidden'></div>\n <div id='content' class='smart-grid-content'>\n <div id='columnHeader' role=\"rowgroup\" class='smart-grid-column-header'>\n <div id='columnNearContainer' role=\"row\" class='near smart-hidden smart-grid-column-header-cell-container'>\n </div>\n <div id='columnContainer' role=\"row\" class='center smart-grid-column-header-cell-container'>\n </div>\n <div id='columnFarContainer' role=\"row\" class='far smart-hidden smart-grid-column-header-cell-container'>\n </div>\n </div>\n <div id='scrollView' role=\"rowgroup\" class ='smart-grid-scroll-view'>\n <div id='rowNearContainer' role=\"presentation\" class='near smart-hidden smart-grid-row-container'>\n </div>\n <div id='rowContainer' role=\"presentation\" class='center smart-grid-row-container'>\n </div>\n <div id='rowFarContainer' role=\"presentation\" class='far smart-hidden smart-grid-row-container'>\n </div>\n <div id='placeholder' class ='smart-hidden smart-placeholder smart-grid-placeholder'></div>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='verticalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]' orientation='vertical'></smart-scroll-bar>\n <smart-scroll-bar right-to-left=\"[[rightToLeft]]\" theme=\"[[theme]]\" id='horizontalScrollBar' class='smart-grid-scroll-bar' wait disabled='[[disabled]]'></smart-scroll-bar>\n </div>\n <div id='filterFooter' class='smart-grid-filter-footer smart-hidden'></div>\n </div>\n <div class=\"smart-grid-view-content smart-hidden\" id=\"viewContent\"></div>\n <div id='loadingIndicatorContainer' class='smart-loader-container'>\n <span id='loadingIndicator' class='smart-grid-loader smart-loader'></span>\n <span id='loadingIndicatorPlaceholder' class ='smart-loader-label smart-hidden'></span>\n </div>\n <div id='footerCommandBar' footer class='smart-grid-footer smart-grid-command-bar smart-hidden'></div>\n <div id='footerPager' class='smart-grid-pager smart-hidden'></div>\n <div id='footer' class='smart-grid-footer smart-hidden'></div>\n </div>"}static get listeners(){return{focus:"_focusHandler",blur:"_blurHandler",wheel:"_mouseWheelHandler","document.up":"_upHandler","document.down":"_downHandler","document.move":"_moveHandler","document.scroll":"_scrollHandler",keydown:"_keyDownHandler",keyup:"_keyUpHandler",resize:"_resizeHandler","header.click":"_headerClickHandler","columnHeader.down":"_columnDownHandler","columnHeader.click":"_columnClickHandler","columnHeader.move":"_columnMoveHandler","columnHeader.mouseleave":"_columnMouseLeaveHandler","rowNearContainer.down":"_rowDownHandler","rowContainer.down":"_rowDownHandler","rowFarContainer.down":"_rowDownHandler","container.selectstart":"_selectStartHandler",styleChanged:"_styleChangedHandler",swipeleft:"_swipeLeftHandler",swiperight:"_swipeRightHandler"}}get _tabindex(){return this.disabled||this.unfocusable?"":' tabindex="0"'}pageIndexValidator(e,t){const o=this;if(t<0)return 0;if(o.dataSource){if(o.dataSource.virtualDataSource)return t;const e=Math.ceil(o.dataSource.length/o._pageSize);if(t>e-1)return e-1}}_offsetTop(e){return e?e.offsetTop+this._offsetTop(e.offsetParent):0}_offsetLeft(e){return e?e.offsetLeft+this._offsetLeft(e.offsetParent):0}offset(e){return{left:this._offsetLeft(e),top:this._offsetTop(e)}}getBoundingRect(e){const t=this;let o=window.pageXOffset,l=window.pageYOffset,a=e.getBoundingClientRect();if(e!==document.body){let a=e.parentNode;for(;a!==document.body&&a;){a&&(o+=a.scrollLeft,l+=a.scrollTop);let e=a;a?(a=a.parentNode,t.enableShadowDOM&&a===t.shadowRoot?a=t:!t.isInShadowDOM||a!==t.getRootNode()&&e!==t.getRootNode()||(a=t.getRootNode().host)):t.isInShadowDOM&&(a=t.getRootNode().host)}}return{bottom:a.bottom+l,height:a.height,left:a.left+o,right:a.right+o,top:a.top+l,width:a.width}}_downHandler(e){this._downTarget=e.originalEvent.target}_removeCellContentPopup(){const e=this;e._cellContentPopup&&(e._cellContentPopup.remove(),e._cellContentPopup=null),e._cellContentPopupTimer&&(clearTimeout(e._cellContentPopupTimer),e._cellContentPopupTimer=null)}_upHandler(e){const t=this,o=t.getBoundingRect(t);super._upHandler(),t._tapTimer&&clearTimeout(t._tapTimer);const l=()=>{t.editing.isEditing&&!t.editing.dialog.enabled&&setTimeout((()=>{if(!e.defaultPrevented){if(t.editing.editCell&&t.editing.editCell.editor.instance){const o=t.editing.editCell.editor.instance;if(o.element&&o.element.hasAttribute("aria-owns")){const t=o.element.getAttribute("aria-owns"),l=document.getElementById(t);if(l&&l.contains(e.originalEvent.target))return}if(t.editing.editCell.editor.instance.blur(e),e.defaultPrevented)return}t.endEdit()}}),50)};if(!e.originalEvent||(e.originalEvent.target===t.$.scrollView&&t._downTarget===e.originalEvent.target&&l(),!e.originalEvent.target.closest(".smart-grid-dialog"))){if(e.pageX<o.left||e.pageX>o.right||e.pageY<o.top||e.pageY>o.bottom){let o=!1,a=e.originalEvent.target;for(;a;)if(a=a.parentNode,a===t){o=!0;break}if(o)return t._dragSelectionEnd(e),t._endResize(e),void t._endDrag(e);if(t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._inputOverlay&&(t._inputOverlay.classList.remove("smart-input-overlay-on"),setTimeout((()=>{t._inputOverlay&&(t._inputOverlay.parentNode&&t._inputOverlay.parentNode.removeChild(t._inputOverlay),t._inputOverlay=null)}),t.behavior.doubleClickTimingDelay)),l(),t.menu){let o,l,a,n;if(t.enableShadowDOM||t.isInShadowDOM?(o=e.originalEvent.composedPath()[0],l=function(){let e=o.getRootNode().host;for(;e;){if(e===t)return e;e=e.getRootNode().host}}(),a=t.menu.contains(o)||t.menu.firstElementChild.shadowRoot.contains(o),n=t.menu.firstElementChild.shadowRoot):(o=e.originalEvent.target,l=t.contains(o),a=t.menu.contains(o),n=t.menu),!l&&!a){const e=n.querySelectorAll("smart-drop-down-list"),l=n.querySelectorAll("smart-date-time-picker"),a=n.querySelectorAll("smart-date-input"),i=n.querySelectorAll("smart-input");for(let t=0;t<e.length;t++)if(e[t].$.dropDownContainer.contains(o))return;for(let e=0;e<l.length;e++)if(l[e].$.dropDownContainer.contains(o))return;for(let e=0;e<a.length;e++)if(a[e].$.scrollView.contains(o))return;for(let e=0;e<i.length;e++)if(i[e].$.scrollView.contains(o))return;return void t.closeMenu()}}}t._summaryRowDialog&&t._summaryRowDialog.classList.contains("open")&&t._summaryRowDialog.confirm(),t._dragSelectionEnd(e),t._endResize(e),t._endDrag(e)}}_nextColumn(e){const t=this;for(let o=0;o<t.viewColumns.length;o++){const l=t.viewColumns[o];if(l.visibleIndex===e.visibleIndex+1)return l}return null}_nextRow(e){const t=this._recyclingRows,o=t.indexOf(e);return o>=0?t[o+1]:null}_moveHandler(e){const t=this;if(t.isInitialized&&t._selection){if(t.selection.enabled&&t.selection.allowDragSelection&&!t.editing.isEditing&&(!t._selection.selectionRect||t._selection.selectionRect&&!t._selection.selectionRect.captured)&&(t._dragSelection(e),e.originalEvent)){const o=e.originalEvent.target.closest?e.originalEvent.target:void 0;Smart.Utilities.Core.isMobile&&o&&o.closest("smart-grid")===t&&e.originalEvent.preventDefault()}t.isScrolling||("none"===t.behavior.columnResizeMode||t.classList.contains("smart-grid-row-resize-mode")||t._columnMoveResizeHandler(e),"none"===t.behavior.rowResizeMode||t.classList.contains("smart-grid-column-resize-mode")||t._rowMoveResizeHandler(e),t._drag(e))}}_hideActionButtons(){const e=this;if(e._columnElements){for(let t=0;t<e._columnElements.length;t++){const o=e._columnElements[t],l=o.column;l&&l.autoShowActionButton&&o._hideActionButton()}for(let t=0;t<e._frozenNearColumns.length;t++){const o=e._frozenNearColumns[t],l=o.element;o&&o.autoShowActionButton&&l._hideActionButton()}}}_columnMouseLeaveHandler(){this._hideActionButtons()}_columnMoveHandler(e){const t=this;if(!t.isInitialized)return;if(t._columnResizeStartLine||t._rowResizeStartLine)return;const o=(o,l)=>{if(o&&o.autoShowActionButton){const a=l.getBoundingClientRect(),n=t.offset(l);if(n.left<=e.pageX&&n.left+a.width-6>=e.pageX)if(n.top<=e.pageY&&n.top+a.height>=e.pageY){if(!t.hasColumnMenu(o))return;l._showActionButton()}else l._hideActionButton();else l._hideActionButton()}};for(let e=0;e<t._columnElements.length;e++){const l=t._columnElements[e];o(l.column,l)}for(let e=0;e<t._frozenNearColumns.length;e++){const l=t._frozenNearColumns[e];o(l,l.element)}}_headerClickHandler(e){const t=this;if(t.$.headerBar){const o=t.isInShadowDOM||t.shadowRoot?e.composedPath()[0]:e.target;t.$.headerBar._headerClickHandler(o,t)}}_columnClickHandler(e){const t=this;if(t._overlay)return;if(void 0===e.clientX)return;const o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._columnClickTime<t.behavior.doubleClickTimingDelay;t._columnClickTime=new Date;for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if(e.srcElement.classList.contains("smart-filter-button"))return;if("_addNewColumn"===o.dataField)return void(t._kanbanViewColumns&&t._kanbanViewColumns.length>0?t._openColumnChooserMenu(o):t._openAddColumnDialog());if(Smart.Utilities.Core.isMobile)n&&o.allowSortToggleOnClick&&t.sorting.enabled&&t.sortBy(l),t._columnMoveHandler(e),e.originalEvent&&e.originalEvent.preventDefault();else if(!n&&o.allowSortToggleOnClick&&t.sorting.enabled){if("none"!==t.behavior.columnResizeMode&&"col-resize"===o.element.style.cursor)return;if(t._canSort=!0,""!==t.sorting.commandKey&&("altKey"===t.sorting.commandKey&&!1===e.altKey&&(t._canSort=!1),"shiftKey"===t.sorting.commandKey&&!1===e.shiftKey&&(t._canSort=!1),"ctrlKey"===t.sorting.commandKey&&!1===e.ctrlKey&&(t._canSort=!1),"ctrlKey"!==t.sorting.commandKey&&e.ctrlKey))return;t.sortBy(l)}}}_columnDownHandler(e){const t=this,o=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(e.clientX,e.clientY);let l=null,a=null;const n=new Date-t._clickTime<t.behavior.doubleClickTimingDelay;t.$.headerBar&&t.$.headerBar.closePanel(),t._doubleClickHandler(e);for(let e=0;e<o.length;e++){const t=o[e];if(t.classList.contains("smart-action-button"))return;if(t.getAttribute("data-field")){l=t.getAttribute("data-field"),a=t;break}}if(l){const o=a.column;if(!o)return;if("_commandColumn"===l)return void(t.editing.commandColumn.dataSource.commandColumnMenu.visible&&t._applyCommand(t.editing.commandColumn.dataSource.commandColumnMenu.command));const i=function(a){const n=o.selectionColumn?t.selection.checkBoxes.action===a&&t.selection.enabled:t.selection.action===a&&t.selection.enabled;if("col-resize"!==o.element.style.cursor&&n){if(t.editing.enabled&&t.editing.editColumn===o)return;if(e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l,"_checkBoxColumn"===l)return void t._toggleColumnSelection(o);"_rowHeaderColumn"===l&&t.selection.enabled&&t.selection.allowRowHeaderSelection&&t.appearance.showRowHeaderSelectIcon&&(t.areAllRowsSelected()?t.clearSelection():t.selectAllRows(),o.refresh()),t.selection.allowColumnHeaderSelection&&o.allowSelect&&t._setSelection(null,o.dataField,e)}};if(t.editing.isEditing&&t.endEdit(),i("click"),t.$.fireEvent("columnClick",{column:o,dataField:o.dataField}),n&&(t.$.fireEvent("columnDoubleClick",{column:o,dataField:o.dataField}),i("doubleClick"),t._onColumnDoubleClick(o,e)),t._columnToResizeElement&&!t._columnResizeLine)return t._columnDownResizeHandler(e),void(t._clickTime=new Date);if(t._beginDrag(e,o),o.menu)return void(t._clickTime=new Date)}t.closeMenu(),t._clickTime=new Date}addTransformMoveStyle(e,t,o,l,a,n){e.style.opacity=n,e.style["transition-duration"]=t,e.style.transform="translate3d("+o+"px,"+l+"px,"+a+"px)"}removeTransformMoveStyle(e){e.style.opacity="",e.style["transition-duration"]="",e.style.transform=""}_rowDownHandler(e){const t=this;if(t._inputOverlay&&t._inputOverlay.classList.remove("smart-input-overlay-on"),t._doubleClickHandler(e),t._closeMenu(t.menu),t._rowResizeHandler(e),t._removeCellContentPopup(),t._toggledRow&&t.appearance.allowRowToggleAnimation)return;if(e.target&&!e.target.classList.contains("smart-grid-row-container")&&!e.target.classList.contains("smart-grid-selection-overlay")&&!e.target.classList.contains("smart-selection-overlay-content"))return;let o=e.clientX,l=e.clientY;e.touches&&(o=e.touches[0].clientX,l=e.touches[0].clientY);const a=(t.enableShadowDOM?t.shadowRoot:t.getRootNode()).elementsFromPoint(o,l);let n=null,i=null,r=null,s=null;t._lastPointerDownTime=new Date;for(let e=0;e<a.length;e++){const t=a[e];if(t.hasAttribute("toggle-button")&&(i=t),t.hasAttribute("checkbox")&&(r=t),s||"smart-grid-cell"!==t.nodeName.toLowerCase()||(s=t),!n&&"smart-grid-row"===t.nodeName.toLowerCase()){n=t;break}}if(n&&s){const o=s?s.cell:null;if(o.row.filterRow||t._closeMenu(t.filterRowMenu),i&&o&&!o.column.rowDetailColumn&&i!==o.row.toggleDetailButton&&!i.classList.contains("row-detail"))n.row.toggle(e);else if(t.rowDetail.enabled&&t.rowDetail.visible&&i&&o&&o.column.rowDetailColumn){const e=n.row;e.showDetail?t.hideDetail(e.id):t.showDetail(e.id)}else{const o=n.row,l=s?s.cell:null;l.column._treeColumn&&r&&(o.checked=!o.checked),l.element===o.header&&t.behavior.allowRowReorder&&t._beginDrag(e,o),t._tapTimer&&clearTimeout(t._tapTimer),t._tapTimer=setTimeout((function(){t._clickedRow===n&&t.$.fireEvent("rowTap",{row:o,id:o.id,originalEvent:e.originalEvent}),t._clickedCell===s&&t.$.fireEvent("cellTap",{cell:l,id:o.id,dataField:l.column.dataField,originalEvent:e.originalEvent})}),t.behavior.doubleClickTimingDelay);const a=function(a){if(!t.selection.enabled||o.autoGenerated||!0!==o.allowSelect)return void delete t.__selectionStarted;if(o.header&&"row-resize"===o.header.style.cursor){const l=t.offset(o.header);if(t._rowToResize&&l.left<=e.originalEvent.pageX&&e.originalEvent.pageX<=l.left+o.header.offsetWidth)return;o.header.style.cursor=""}const i=t.editing.isEditing;if(i&&t.editing.editCell&&t.editing.editCell.row.id===o.id&&t.editing.editCell.column.dataField===l.column.dataField)return;if(i&&t.editing.editRow&&t.editing.editRow.id===o.id)return;const r=()=>{t.focus(),setTimeout((function(){t.focus()}),50)};if(t.selection.action===a){if(e.shiftKey||e.ctrlKey||!t.selection.allowRowHeaderSelection&&l.column.autoGenerated?t._dragSelectionStartRow=null:t._dragSelectionStartRow=n.row,e.shiftKey||e.ctrlKey?t._dragSelectionStartDataField=null:t._dragSelectionStartDataField=l.column.dataField,l.column.rowHeaderColumn&&!t.selection.allowRowHeaderSelection)return t._dragSelectionStartRow=null,void r();t._setSelection(o.id,l.column.dataField,e),r()}else l.column.selectionColumn&&t.selection.checkBoxes.enabled&&t.selection.checkBoxes.action===a&&(t._setSelection(o.id,l.column.dataField,e),r())},i=l.selected;t._clickTime||(t._clickTime=new Date);const d=t._clickedCell===s&&new Date-t._clickTime<t.behavior.doubleClickTimingDelay,u=e.originalEvent?e.originalEvent:e,c=3===u.which;if(c||"_commandColumn"===l.column.dataField||a("click"),t.$.fireEvent("rowClick",{row:o,id:o.id,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),t.$.fireEvent("cellClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:u,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),o.autoGenerated||l.column.autoGenerated||"checkBox"===l.template&&e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("smart-input"))t._onRowClick(o.index,o,e),t._onCellClick(l,e);else if(t.selection.enabled)if(t.selection.allowCellSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;a&&t._clickedCell&&a.id===l.row.id&&a.dataField===l.column.dataField&&a.id===t._clickedCell.cell.row.id&&a.dataField===t._clickedCell.cell.column.dataField&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else if(t.selection.allowRowSelection)if("extended"===t.selection.mode){if(!0===i&&i===l.selected&&!t.selection.isDragging){const a=t._selection.focusedCell;t._clickedCell&&a.id===l.row.id&&a.id===t._clickedCell.cell.row.id&&(t._onRowClick(o.index,o,e),t._onCellClick(l,e))}}else d||(t._onRowClick(o.index,o,e),t._onCellClick(l,e));else t._onRowClick(o.index,o,e),t._onCellClick(l,e);else t._onRowClick(o.index,o,e),t._onCellClick(l,e);new Date-t._clickTime<t.behavior.doubleClickTimingDelay&&(t._clickedRow===n&&(t._onRowDoubleClick(o.index,o,e,e),t.$.fireEvent("rowDoubleClick",{row:o,id:o.id,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}),a("doubleClick")),t._clickedCell===s&&(t._onCellDoubleClick(l,e),t.$.fireEvent("cellDoubleClick",{cell:l,id:o.id,dataField:l.column.dataField,isRightClick:c,originalEvent:e.originalEvent,pageX:parseInt(u.pageX),pageY:parseInt(u.pageY)}))),t._clickedRow=n,t._clickedCell=s,t._clickTime=new Date,t.layout.allowCellsWrapShortcut&&t._clickedCell.hasAttribute("focus")&&t._clickedCell.hasAttribute("selected")&&e.shiftKey&&(t._cellContentPopupTimer&&clearTimeout(t._cellContentPopupTimer),t.selection.isDragging?t._removeCellContentPopup():l.autoWrap())}}}showDetail(e){const t=this.rowById[e];t&&(t.showDetail=!0)}hideDetail(e){const t=this.rowById[e];t&&(t.showDetail=!1)}_focusHandler(){this._focused=!0}_blurHandler(){this._focused=!1}_notify(e,t,o){const l=this;if(l.notifyFn)for(let a=0;a<l.notifyFn.length;a++)l.notifyFn[a](e,t,o)}notify(e){const t=this;e&&(t.notifyFn||(t.notifyFn=[]),t.notifyFn.push(e))}_applyTemplate(e,t){let o=null;if(null!==e&&""!==e)if((e.startsWith("#")||e.startsWith("."))&&(o=document.querySelector(e)),o)t.innerHTML="",o instanceof HTMLElement&&!(o instanceof HTMLTemplateElement)?t.appendChild(o):t.appendChild(o.content.cloneNode(!0).firstElementChild);else{const o=function(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}(e);o&&(t.innerHTML="",t.appendChild(o))}else t.innerHTML=""}propertyChangedHandler(e,t,o){const l=this;if(l.isInitialized){switch(l._notify(e,t,o),e){case"onRowInserted":return;case"view":return void(l.$.headerBar&&l.$.headerBar._setView&&l.$.headerBar._setView(o));case"users":case"currentUser":l._refreshCurrentUser();break;case"summaryRow_visible":for(let e=0;e<l.columns.length;e++)l._summaryRowCount=Math.max(l._summaryRowCount,l.columns[e].summary.length);l._renderRows(!0);break;case"conditionalFormatting":return l._renderConditionalFormatting(),void l.refresh();case"appearance_displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"appearance_placeholder":return void(l.$.placeholder.innerHTML=o);case"appearance_showColumnHeaderLines":case"appearance_showColumnLines":case"appearance_showRowLines":return void l._recycle();case"appearance_allowColumnStickyPosition":o?l._stickHeader():l._unstickHeader();break;case"appearance_showColumnIcon":for(let e=0;e<l.columns.length;e++)l.columns[e].setProperty("showIcon",l.appearance.showColumnIcon);l._recycle();break;case"appearance_showRowHeaderNumber":case"appearance_showRowHeader":{l._initializeRowNumberColumn();const e=l._frozenNearColumns[0];e.rowHeaderColumn&&e.element&&!e.element.parentNode&&l.$.columnNearContainer.appendChild(e.element),l.refresh();break}case"header_visible":l.header.visible&&""===l.header.template&&(l.$.header.innerHTML='<smart-grid-toolbar header-position="top"></smart-grid-toolbar>',l.$.headerBar=l.$.header.firstElementChild,l.$.headerBar._init(l),l.header.onInit&&l.header.onInit(l.$.headerBar));break;case"header_template":l._applyTemplate(o,l.$.header);break;case"footer_template":l._applyTemplate(o,l.$.footer);break;case"layout_columnWidth":case"columnWidth":{l.columns.canNotify=!1;let e=parseInt(o);if(isNaN(e)&&(e=null),e>=30||null===e)for(let t=0;t<l.columns.length;t++)l.columns[t].width=e;l.columns.canNotify=!0,l.refresh();break}case"checkBoxes_visible":return void l._recycle();case"checkBoxes_hasThreeStates":return l.rows.canNotify=!1,l._applyThreeStates(l.rowHierarchy),l.rows.canNotify=!0,void l._recycle();case"columnHeader_visible":l.__columnHeaderHeight=null,l.refresh();break;case"selection_checkBoxes_enabled":l._selectionColumn.visible=o;break;case"selection_checkBoxes_autoShow":l._selectionColumn.element&&(o?l._selectionColumn.element.setAttribute("auto-show",""):l._selectionColumn.element.removeAttribute("auto-show"));break;case"selection_checkBoxes_position":{let e=l.viewColumns.indexOf(l._selectionColumn);l.viewColumns.canNotify=!1,l.viewColumns.splice(e,1);const t=l._frozenNearColumns.indexOf(l._selectionColumn),a=l._frozenFarColumns.indexOf(l._selectionColumn);if(t>=0&&l._frozenNearColumns.splice(t,1),a>=0&&l._frozenFarColumns.splice(a,1),"far"===o)l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="far",l._selectionColumn.canNotify=!0,l._frozenFarColumns.splice(0,0,l._selectionColumn),l.viewColumns.push(l._selectionColumn),l.$.columnFarContainer.appendChild(l._selectionColumn.element);else{let e=0,t=0;for(let o=0;o<l.viewColumns.length&&(l.viewColumns[o].autoGenerated||l.viewColumns[o].dataField!==l.columns[t++].dataField);o++)l.viewColumns[o].autoGenerated&&e++;l._selectionColumn.canNotify=!1,l._selectionColumn.freeze="near",l._selectionColumn.canNotify=!0,l._frozenNearColumns.splice(e,0,l._selectionColumn),l.viewColumns.splice(e,0,l._selectionColumn),l.$.columnNearContainer.appendChild(l._selectionColumn.element)}l.viewColumns.canNotify=!0;break}case"selection_mode":if(l._selection&&(l._selection.focusedCell=null),l.selection.allowCellSelection)l.clearSelection();else if("one"===o){const e=l.getSelection();if(l.clearSelection(),e.rows&&e.rows[0]){e.rows[0].row.selected=!0;const t=l.rowById[e.rows[0].row.id].getCell(l.columns[0].dataField);l._selection.focusedCell={id:t.row.id,dataField:t.column.dataField,value:t.value,index:t.row.index}}}break;case"filtering_enabled":return o&&0===l._filterPanels.length&&l._createFilterPanels(),void(l.header.visible&&l.refresh());case"filtering_filterRow_visible":return l._initializeRows(),l._initializeRowElements(),void l.refresh();case"filtering_operator":return void l.refreshFilters();case"filtering_filter":for(let e=0;e<l.columns.length;e++){const t=l.columns[e];t.canNotify=!1,t.setProperty("filter",null),t.canNotify=!0}for(let e=0;e<l.filtering.filter.length;e++){const t=l.filtering.filter[e];if(t&&t.splice){const e=t[0],o=t.splice(1);let a=null;if(o instanceof Smart.FilterGroup)a=o;else{const t=l.columnByDataField[e];t&&(a=l.dataSource._createFilter(t.dataType,o))}a&&l.addFilter(e,a,!1)}}return void l.refreshFilters();case"messages":case"locale":{if(l.columns)for(let e=0;e<l.columns.length;e++)l.columns[e]._cellsCachedValues=[];l._dialogEdit&&(l._dialogEdit.close(),l._dialogEdit=null),l._dialogDelete&&(l._dialogDelete.close(),l._dialogDelete=null),l._dialogAddRow&&(l._dialogAddRow.close(),l._dialogAddRow=null);const e=l.$.headerPager.querySelector("smart-pager"),t=l.$.footerPager.querySelector("smart-pager");e&&(e.locale=l.locale),t&&(t.locale=l.locale);const o=(e,t)=>{l._handleFilterMenuClick(e,t)};l._filterInfo||(l._filterInfo={}),l._filterInfo.stringConditions=[{icon:"smart-icon-contains",command:o,value:"CONTAINS",label:l.localize("CONTAINS")},{icon:"smart-icon-does-not-contain",command:o,value:"DOES_NOT_CONTAIN",label:l.localize("DOES_NOT_CONTAIN")},{icon:"smart-icon-starts-with",command:o,value:"STARTS_WITH",label:l.localize("STARTS_WITH")},{icon:"smart-icon-ends-with",command:o,value:"ENDS_WITH",label:l.localize("ENDS_WITH")},{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._filterInfo.numberAndDateConditions=[{icon:"smart-icon-equals",command:o,value:"EQUAL",label:l.localize("EQUAL")},{icon:"smart-icon-not-equal",command:o,value:"NOT_EQUAL",label:l.localize("NOT_EQUAL")},{icon:"smart-icon-less-than",command:o,value:"LESS_THAN",label:l.localize("LESS_THAN")},{icon:"smart-icon-less-than-equal",command:o,value:"LESS_THAN_OR_EQUAL",label:l.localize("LESS_THAN_OR_EQUAL")},{icon:"smart-icon-greater-than",command:o,value:"GREATER_THAN",label:l.localize("GREATER_THAN")},{icon:"smart-icon-greater-than-equal",command:o,value:"GREATER_THAN_OR_EQUAL",label:l.localize("GREATER_THAN_OR_EQUAL")},{icon:"smart-icon-between",command:o,value:"RANGE",label:l.localize("RANGE")},{icon:"smart-icon-delete",command:o,value:"CLEAR_FILTER",label:l.localize("CLEAR_FILTER")}],l._refreshHeaderBar(),l.$.headerBar&&(l.$.headerBar.messages=l.messages,l.$.headerBar.locale=l.locale,l.$.headerBar._localizeHeader(),l.$.headerBar._getInnerElementMessages()),l._recycle();break}case"paging_spinner_enabled":l._refresh();break;case"pager_visible":return l._renderPagers(),void l._refreshPaging(!1);case"paging_pageIndex":case"pager_position":case"paging_enabled":return void l._refreshPaging(!0);case"paging_pageSize":return void l._refreshPaging(!1);case"columns":if(l.__measuredColumnHeight=null,l.editing&&l.editing.isEditing&&l.cancelEdit(),l._cellEditors=[],l.columns&&l._sortedColumns){const e=[];l.columns.forEach((t=>{t.sortOrder&&e.push(t)})),l._sortedColumns=JSON.parse(JSON.stringify(e))}if(l._renderColumns(),l._refreshHeaderBar(),l.columns&&l.filtering.enabled){l.beginUpdate();for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(t.canNotify=!1,l.removeFilter(t.dataField),t.filtered=!1,t.canNotify=!0,t.filter){let e=null,o=t.filter;e=o instanceof Smart.FilterGroup?o:l.dataSource._createFilter(t.dataType||"string",o),e&&l.addFilter(t.dataField,e,!1)}}l.refreshFilters(),l.endUpdate()}return;case"columnGroups":if(l._columnGroups=[],l._columnHeights=0,l.viewColumns)for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e],o=t.element;t.top=0,t.level=0,o&&(o.style.top="",o.style.height="",o.style.lineHeight="")}return l.columns.canNotify=!1,l.columns=l._initColumns,l._renderColumns(),l.columns.canNotify=!0,l.__columnHeaderHeight=null,void l.refresh();case"dataSource":return delete l._isFirstVirtualDataSourceRequest,l.dataBind(),void(l.header.visible&&""===l.header.template&&l.$.headerBar._init(l));case"rowDetail_dialog_width":case"rowDetail_dialog_height":case"rowDetail_dialog_enabled":case"rowDetail_dialog_visible":return;case"rowDetail_height":case"rowDetail_enabled":{l.beginUpdate(),l.rows.canNotify=!1;const e=l.appearance.allowRowDetailToggleAnimation;l.appearance.allowRowDetailToggleAnimation=!1;for(let e=0;e<l._recyclingRows.length;e++){const t=l._recyclingRows[e];t.height=null,t.setProperty("showDetail",!1),t.detailHeight=l.rowDetail.height}if(l.rows.canNotify=!0,l.rowDetail.enabled){let t=!1;for(let e=0;e<l.viewColumns.length;e++)if(l.viewColumns[e].rowDetailColumn){t=!0;break}if(!t)return l.appearance.allowRowDetailToggleAnimation=e,l.endUpdate(),void l._renderColumns(!0)}else for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=!1;break}}return l.appearance.allowRowDetailToggleAnimation=e,void l.endUpdate()}case"rowDetail_visible":for(let e=0;e<l.viewColumns.length;e++){const t=l.viewColumns[e];if(t.rowDetailColumn){t.visible=o;break}}return;case"displayLoadingIndicator":return void l._setLoadingIndicatorVisibility();case"filterable":return void l._refreshLayout();case"layout_allowCellsWrap":{const e=l.columns.canNotify;l.columns.canNotify=!1;for(let e=0;e<l.columns.length;e++)l.columns[e].cellsWrap=o;return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),l.refresh(),void(l.columns.canNotify=e)}case"layout_columnMinHeight":case"layout_rowMinHeight":case"layout_columnHeight":case"layout_rowHeight":return l.layout.isDirty=!0,l._resetCachedLayout(),l._refreshLayout(),void l.refresh();case"rightToLeft":return void l.refresh();case"selectionMode":return;case"editing_addNewColumn_visible":l._addNewColumn?(l._addNewColumn.visible=o,l.refresh()):l._renderColumns();break;case"editing_addNewRow_displayMode":{"row"===l.editing.addNewRow.displayMode&&l.editing.addNewRow._addButton&&(l.editing.addNewRow._addButton.remove(),delete l.editing.addNewRow._addButton);const e=l._scrollView.vScrollBar;return e.style.height="",e.style.top="",e.style.setProperty("--smart-scroll-bar-near-size","0px"),l._renderAddNewRow(),void l.refresh(!0)}case"editing_addNewRow_label":case"editing_addNewRow_visible":case"editing_addNewRow_position":return l._renderAddNewRow(),void l.refresh();case"editing_enabled":o?l.removeAttribute("aria-readonly"):l.setAttribute("aria-readonly",!0);break;case"editing_dialog_visible":return;case"editing_commandBar_dataSource_commandBarAddRow_visible":case"editing_commandBar_dataSource_commandBarDeleteRow_visible":case"editing_commandBar_dataSource_commandBarBatchSave_visible":case"editing_commandBar_dataSource_commandBarBatchRevert_visible":case"editing_commandBar_visible":case"editing_commandBar_displayMode":case"editing_commandBar_position":l._renderCommandBar();break;case"editing_commandColumn_position":l._renderColumns(!0);break;case"editing_commandColumn_visible":return void l.refresh(!0);case"editing_commandColumn_inline":return l._commandColumn.visible=l.editing.commandColumn.visible&&!l.editing.commandColumn.inline,void l.refresh(!0);case"editing_commandColumn_dataSource_commandColumnCustom_label":case"editing_commandColumn_dataSource_commandColumnCustom_icon":case"editing_commandColumn_dataSource_commandColumnCustom_visible":case"editing_commandColumn_dataSource_commandColumnUpdate_label":case"editing_commandColumn_dataSource_commandColumnUpdate_icon":case"editing_commandColumn_dataSource_commandColumnUpdate_visible":case"editing_commandColumn_dataSource_commandColumnEdit_label":case"editing_commandColumn_dataSource_commandColumnEdit_icon":case"editing_commandColumn_dataSource_commandColumnEdit_visible":case"editing_commandColumn_dataSource_commandColumnDelete_label":case"editing_commandColumn_dataSource_commandColumnDelete_icon":case"editing_commandColumn_dataSource_commandColumnDelete_visible":case"editing_commandColumn_displayMode":return delete l.__cellsCommandTemplate,void l.refresh(!0)}l.refresh()}}ready(){super.ready();const e=this,t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar;t.hasStyleObserver=!1,o.hasStyleObserver=!1,t.hasResizeObserver=!1,o.hasResizeObserver=!1,t.wait=!1,o.wait=!1,t.onChange=e._verticalScrollbarHandler.bind(e),o.onChange=e._horizontalScrollbarHandler.bind(e),e.setFocusable(!0),e.$.loadingIndicatorPlaceholder.innerHTML=e.appearance.loadingIndicatorPlaceholder,e.$.placeholder.innerHTML=e.appearance.placeholder,e._setLoadingIndicatorVisibility(),e._cellsMerge=[],e._cellStyles=[],e.checkLicense()}checkLicense(e){const t=this;(t.grouping.enabled||t.selection.enabled&&t.selection.allowCellSelection||t.rowDetail.enabled||t.charting.enabled||t.editing.enabled&&t.editing.batch||t.editing.enabled&&"row"===t.editing.mode||t.editing.enabled&&t.editing.addNewRow.visible||t.editing.enabled&&t.editing.commandColumn.visible||"virtual"===t.scrolling||t.sorting.enabled&&"many"===t.sorting.mode||!0===e)&&super.checkLicense()}_createFilterPanels(){const e=this;if(e._filterPanels){if(e._filterPanels.length>0)return}else e._filterPanels=[];e.filtering.enabled&&0===e._filterPanels.length&&requestAnimationFrame((()=>{const t=document.createElement("smart-filter-panel"),o=document.createElement("smart-filter-panel"),l=document.createElement("smart-filter-panel"),a=document.createElement("smart-filter-panel");o.filterType="boolean",l.filterType="numeric",a.filterType="date",e._filterPanels.bool=o,e._filterPanels.date=a,e._filterPanels.numeric=l,e._filterPanels.string=t;for(let t in e._filterPanels){const o=e._filterPanels[t];o.rightToLeft=e.rightToLeft,o.classList.add("smart-hidden"),e.$.content.appendChild(o),o.parentNode.removeChild(o)}}))}_applyScrolling(){const e=this,t=e._scrollView.vScrollBar;requestAnimationFrame((()=>{switch(t.largeStep=e.$.scrollView.offsetHeight,e.scrolling){case"physical":case"infinite":case"virtual":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging";break;case"deferred":t.step=10,t.mechanicalAction="switchWhenReleased";break;case"logical":t.step=e.layout.rowMinHeight,t.mechanicalAction="switchWhileDragging"}}))}_measureRowElement(e){const t=new Smart.Grid.Row({data:e,index:999999,grid:this});if(!t)return null;const o=t.createElement();return o.classList.add("smart-grid-measure-row"),this.$.scrollView.appendChild(o),o.style.height="",o.style.lineHeight="",o.style.height="",o.style.lineHeight="",t._isMeasureRow=!0,t.render(),o}get _autoRowHeight(){const e=this;if(e.__autoRowHeight)return e.__autoRowHeight;let t=e.layout.rowMinHeight;if(!e.dataSource||e.dataSource&&0===e.dataSource.length)return t;const o=new Smart.Grid.Row({index:0,grid:e}),l=o.createElement();e.$.scrollView.appendChild(l),e.removeAttribute("grouped"),e.removeAttribute("tree"),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>0?e.setAttribute("grouped",""):e.dataSource.boundHierarchy&&e.setAttribute("tree","");const a={};for(let t=0;t<e.dataSource.dataFields.length;t++)a[e.dataSource.dataFields[t].name]="ABCDEFHIJLMNOPQRSTUVWXYZ1234567910|";o.data=a,o._isMeasureRow=!0,o.render(),l.style.height="",l.style.lineHeight="",t=Math.max(l.offsetHeight,t);for(let e=0;e<l.children.length;e++)l.children[e].style.height="";for(let a=0;a<l.children[1].children.length;a++){l.children[1].children[a].style.height="auto";const n=o.getCell(e.columns[0].dataField);n&&n.render(),t=Math.max(t,8+l.children[1].children[a].offsetHeight);break}return e.$.scrollView.removeChild(l),e.__autoRowHeight=t,e.layout.rowMinHeight&&t<e.layout.rowMinHeight&&(e.__autoRowHeight=e.layout.rowMinHeight),t}get _scrollHeight(){const e=this;let t=e._recyclingRows,o=0,l=e._autoRowHeight,a=0,n=0;if(e.__scrollHeight)return e.__scrollHeight;if(0===t.length||0===e.columns.length||!e.hasVisibleColumn())return 0;e.rows.canNotify=!1;const i=e._measureRowElement(t[0].data),r=t.length;for(let s=0;s<r;s++){let r=t[s];if(!r.visible||!1===r.filtered){r.height=0,r.cellHeight=0,r.top=o;continue}const d=e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled;if((!r.height||!r.cellHeight||d||"auto"===r.height||"auto"===r._height||"auto"===e.layout.rowHeight||e.layout.isDirty)&&!r.expandHeight){if(r.detailHeight||(r.detailHeight=200),e.layout.rowHeight){if(e.layout.rowHeight)if("number"==typeof e.layout.rowHeight)e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.height=e.layout.rowHeight,r.computedHeight&&(r.height=r.computedHeight),r.minHeight>r.height&&(r.height=r.minHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight);else if("auto"===e.layout.rowHeight){e.layout.rowHeight<e.layout.rowMinHeight&&(e.layout.rowHeight=e.layout.rowMinHeight),r.element=i,r.grid=e,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l,o=r.canNotify;r.canNotify=!1,r.height=t,r.computedHeight&&(r.height=r.computedHeight),void 0!==r.label&&"advanced"===e.grouping.renderMode&&(r.height=e.grouping.groupRowHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight),r.canNotify=o}else e.layout.rowHeight(s,r),r.height||(r.height=l),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}else{if("auto"===r.height||"auto"===r._height){r.element=i,r.element&&r.element.classList.contains("smart-hidden")&&r.element.classList.remove("smart-hidden");const t=r.data&&e.isRendered?r._autoSize(r):l;r.height=t,r._height="auto"}else r.height=l;void 0===r.label||r.summaryRow||"advanced"!==e.grouping.renderMode||(r.height=e.grouping.groupRowHeight),r.computedHeight&&(r.height=r.computedHeight),r.cellHeight=r.height,e.rowDetail.enabled&&r.showDetail&&!e.rowDetail.dialog.enabled&&(r.height+=r.detailHeight)}e._rowGap&&s<e.rows.length-1&&(r.height+=e._rowGap)}!0===r.freeze||"near"===r.freeze?r.visible&&(a+=r.height):"far"===r.freeze&&r.visible&&(n+=r.height),r.freeze&&r.visible?r.top=o:(r.top!==o&&(r.top=o),r.expandHeight?o+=r.cellHeight:o+=r.height)}if(e._summaryRowCount&&e.summaryRow.visible&&(o+=1*l),e.editing.addNewRow&&"button"===e.editing.addNewRow.displayMode&&(o+=1*l),e.filtering&&e.filtering.filterRow.visible&&(a+=l),e.dataSource&&e.dataSource.virtualDataSource&&!1===e.paging.enabled){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length),t>=e.virtualModeCachedRowsCount&&(o=e.rows[0].height*e.dataSource.length)}return e.__scrollHeight=o,e.__frozenNearHeight=a,e.__frozenFarHeight=n,e._scrollView.scrollHeight=o-e.$.scrollView.offsetHeight+a+n,o=e.__scrollHeight+a+n-1,e.grouping.enabled&&e.dataSource.groupBy.length>0&&e.grouping.groupIndent>0&&"advanced"===e.grouping.renderMode&&(o+=parseInt(e.grouping.groupIndent/2)),e.__scrollHeight=o,i.remove(),t[0]&&delete t[0]._isMeasureRow,e.rows.canNotify=!0,o}_measureColumnHeight(){const e=this;if(e.__measuredColumnHeight)return e.__measuredColumnHeight;const t=document.createElement("smart-grid-column");t.style.height="auto",t.style.position="static";const o=document.createElement("div");o.classList.add("smart-label"),o.innerHTML="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRwWxXyYzZ1234567890",t.appendChild(o),e.$.columnHeader.appendChild(t);let l=e.$.columnHeader.offsetHeight;return e.$.columnHeader.removeChild(t),e._columnHeights&&e._columnHeights.length>1&&(l=e._columnHeights[0]),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),e.__measuredColumnHeight=l,l}_initializeColumnGroupsHierarchy(){const e=this;let t=0;e.$.columnContainer.innerHTML="";const o=JSON.parse(JSON.stringify(e.columnGroups));if(o.length>0){for(let e=0;e<o.length;e++)o[e].parent=null,o[e].groups=null;for(let t=0;t<e.viewColumns.length;t++)e.viewColumns[t].parent=null,e.viewColumns[t].groups=null;const l=function(e){for(let t=0;t<o.length;t++){let l=o[t];if(l.name===e)return l}return null},a=function(e){let t=new Array;if(e.columnGroup&&t.push(e),e.groups)for(let o=0;o<e.groups.length;o++)if(e.groups[o].columnGroup)t.push(e.groups[o]);else if(e.groups[o].groups){let l=a(e.groups[o]);for(let e=0;e<l.length;e++)t.push(l[e])}return t};for(let e=0;e<o.length;e++){let t=o[e];if(t.groups||(t.groups=null),t.parentGroup){let e=l(t.parentGroup);e&&(t.parent=e,e.groups||(e.groups=new Array),-1===e.groups.indexOf(t)&&e.groups.push(t))}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];if(o.columnGroup){let e=l(o.columnGroup);e&&(e.groups||(e.groups=new Array),o.parent=e,-1===e.groups.indexOf(o)&&e.groups.push(o))}}for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];let a=l;for(l.level=0;a.parent;)a=a.parent,l.level++;a=l;let n=l.level;for(t=Math.max(t,l.level);a.parent;)a=a.parent,a&&(a.level=--n)}for(let t=0;t<o.length;t++){const l=o[t],n=a(l);l.columns=n;let i=new Array,r=0,s="near";0===n.length&&(r=-1,l.visible=!1);for(let t=0;t<n.length;t++)i.push(e.viewColumns.indexOf(n[t])),n[t].freeze&&("far"===n[t].freeze&&(s="far"),r++);r===n.length?l.freeze=s:r>0&&r<n.length&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("frozenColumns",{elementType:"Grid"}))),i.sort((function(e,t){return(e=parseInt(e))<(t=parseInt(t))?-1:e>t?1:0}));for(let t=1;t<i.length;t++)i[t]!==i[t-1]+1&&(e.classList.add("smart-visibility-hidden"),e.error(e.localize("columnGroups",{elementType:"Grid"})))}}e._columnGroupsLevel=1+t,e._columnGroups=o}_refreshColumnHeights(){const e=this;e.$.columnHeader.style.height="",e._viewColumnsHeight=e._measureColumnHeight(),e._columnHeights=[];let t=0;for(let o=0;o<e._columnGroupsLevel;o++){let l=e._viewColumnsHeight;e.layout.columnHeight&&(l="number"==typeof e.layout.columnHeight?e.layout.columnHeight?e.layout.columnHeight:e._viewColumnsHeight:e.layout.columnHeight?e.columnHeight(o):e._viewColumnsHeight),l<e.layout.columnMinHeight&&(l=e.layout.columnMinHeight),l?(e._columnHeights.push(l),t+=l):(t+=e._viewColumnsHeight,e._columnHeights.push(e._viewColumnsHeight))}e._columnHeaderHeight=e._columnGroupsLevel*e._viewColumnsHeight,e._columnHeaderHeight=t,e.$.columnHeader.style.height=e._columnHeaderHeight+"px";const o=function(t){let o=0;for(let l=0;l<t.level;l++)o+=e._columnHeights[l];return o},l=function(t){let l=o(t),a=e._columnHeaderHeight-l;for(let o=t.level+1;o<e._columnHeights.length;o++){const l=o;for(let o=0;o<e.viewColumns.length;o++){const n=e.viewColumns[o];let i=!1;if(n.level===l){let o=n;for(;o.parent;){if(o.parent===t){a=e._columnHeights[l],i=!0;break}o=o.parent}if(i)break}}}return a};for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t],n=l(a);a.computedHeight=n,a.top=o(a)}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let a=0;a<e._columnGroups.length;a++){const n=e._columnGroups[a];if(n.level!==t)continue;if(n.groups){const e=l(n),t=o(n);n.top=t,n.computedHeight=e}const i=n.element;i&&(i.style.width=n.computedWidth+"px",e.rightToLeft?i.style.right=n.left+"px":i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=n.computedHeight+"px",i.style.lineHeight=n.computedHeight+"px")}}_refreshColumnWidths(){const e=this;e.__clientSize=null;const t=e.$.verticalScrollBar.offsetWidth>0?e.$.verticalScrollBar.offsetWidth:0,o=e.dataSource.groupBy||[];let l=e.grouping.enabled&&"advanced"===e.grouping.renderMode?e.grouping.groupIndent*(1+o.length):0,a=0;e.selection.checkBoxes.enabled&&(a=e._selectionColumn.computedWidth?e._selectionColumn.computedWidth:e._selectionColumn.minWidth);const n=e._clientSize.width-t-l;let i=0,r=[],s=0,d=0,u=0;if(e.editing.enabled&&!e.editing.commandColumn.inline){const t=function(){const t=document.createElement("div"),o=document.createElement("div"),l=e.editing.commandColumn.dataSource;let a=0,n="",i=0;o.classList.add("smart-label");for(let t in l){const o=l[t];let a=!1;if("commandColumnMenu"===t)continue;let r=!1;a||(!0===o.visible?(i++,r=!0):"auto"===o.visible&&((e.editing.editRow||e.editing.editCell)&&!e.editing.dialog.enabled||"commandColumnEdit"!==t?!e.editing.editRow&&!e.editing.editCell||e.editing.dialog.enabled||("commandColumnUpdate"===t||"commandColumnCancel"===t)&&(i++,r=!0):(i++,r=!0)),a=!0),r&&"icon"!==e.editing.commandColumn.displayMode&&(n+="<span>"+("{{messages}}"===o.label?e.localize(t):o.label)+"</span>")}return o.innerHTML="<span>"+n+"</span>",t.appendChild(o),t.style.width="auto",t.style.position="static",e.$.columnHeader.appendChild(t),a=10+o.firstChild.offsetWidth,e.$.columnHeader.removeChild(t),"icon"===e.editing.commandColumn.displayMode?a=20+20*i:"labelAndIcon"===e.editing.commandColumn.displayMode?a+=25*i:a+=10*i,a};if(e._commandColumn.visible=e.editing.commandColumn.visible,e.editing.commandColumn.visible){const o=e.editing.commandColumn.width?e.editing.commandColumn.width:t();e.columns.canNotify=!1,e._commandColumn.width=o,e.columns.canNotify=!0}}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];let l;"number"==typeof o.width?l=o.width:o.width&&o.width.toString().indexOf("%")>=0?(l=parseFloat(o.width)/100,l*=n-a):o.width&&(o.width.toString().indexOf("em")>=0||o.width.toString().indexOf("pt")>=0||o.width.toString().indexOf("fr")>=0)?(l=parseFloat(o.width),l*=16):"auto"===o.width?l=o._autoSize():o.visible&&(r.push(o),l=0),o.overflowWidth&&(l-=o.overflowWidth),o.visible&&(i+=l),l<o.minWidth&&(l=o.minWidth),o.computedWidth=l}if(r){let e=n-i,t=0;e<0&&(e=60*r.length);for(let o=0;o<r.length;o++){const l=r[o];let a;a=e/r.length,o===r.length-1&&(a=e-t),l.overflowWidth&&(a-=l.overflowWidth),a<l.minWidth&&(a=l.minWidth),l.computedWidth=a,t+=a}}for(let t=0;t<e.viewColumns.length;t++){let o=e.viewColumns[t];o.visible&&(l>0&&!o.autoGenerated&&(o.computedWidth+=l,l=0),o.freeze?!0===o.freeze||"near"===o.freeze?(o.left=s,u+=o.computedWidth,s+=o.computedWidth):"far"===o.freeze&&(o.left=d,d+=o.computedWidth):(o.left=u,u+=o.computedWidth))}for(let t=0;t<e._columnGroupsLevel-1;t++)for(let o=0;o<e._columnGroups.length;o++){const l=e._columnGroups[o];if(l.level!==t)continue;let a=99999;if(l.groups){const e=function(t){let o=0;for(let l=0;l<t.groups.length;l++){let n=t.groups[l];n.groups?o+=e(n):n.visible&&(a=Math.min(n.left,a),o+=n.computedWidth)}return o};l.computedWidth=e(l),l.left=a}}}_createColumnHeaderCellElements(){const e=this,t=e.$.columnContainer,o=document.createDocumentFragment();let l=0;e._columnElements=[],e.$.columnContainer.innerHTML="",e.$.columnNearContainer.innerHTML="",e.$.columnFarContainer.innerHTML="",e.rightToLeft?(e.$.columnNearContainer.classList.remove("near"),e.$.columnNearContainer.classList.add("far"),e.$.columnFarContainer.classList.remove("far"),e.$.columnFarContainer.classList.add("near")):(e.$.columnNearContainer.classList.remove("far"),e.$.columnNearContainer.classList.add("near"),e.$.columnFarContainer.classList.remove("near"),e.$.columnFarContainer.classList.add("far"));for(let t=0;t<e._frozenNearColumns.length;t++)e._frozenNearColumns[t].createElement();for(let t=0;t<e._frozenFarColumns.length;t++)e._frozenFarColumns[t].createElement();for(let t=0;t<e.viewColumns.length;t++){const a=e.viewColumns[t];if(a.freeze)continue;const n=a.createElement();void 0!==a.computedWidth?(l+=a.computedWidth,e._columnElements.push(n),l<2*e._clientSize.width&&o.appendChild(n)):(e._columnElements.push(n),o.appendChild(n))}for(let t=0;t<e._columnGroups.length;t++){const l=e._columnGroups[t],a=new Smart.Grid.Column({visible:void 0===l.visible||l.visible,allowSort:!1,allowFilter:!1,allowSelect:!1,grid:e,dataField:l.name,label:l.label,align:l.align,verticalAlign:l.verticalAlign,showIcon:!1});l.column=a;const n=a.createElement();n.style.width=l.computedWidth+"px",e.rightToLeft?n.style.right=l.right+"px":n.style.left=l.left+"px",n.style.top=l.top+"px",n.style.height=l.computedHeight+"px",n.style.lineHeight=l.computedHeight+"px",o.appendChild(n),l.element=n,l.grid=this}e.htmlColumnLastChild||(e.htmlColumnLastChild=document.createElement("smart-grid-column"),e.htmlColumnLastChild.classList.add("top-far-corner"),e.htmlColumnLastChild.onpointerdown=e=>{e.stopPropagation(),e.preventDefault()},e.$.columnHeader.appendChild(e.htmlColumnLastChild)),t.appendChild(o),t.style.width=e._computedColumnsWidth+"px",e._refreshFrozenColumns()}_refreshFrozenColumns(){const e=this;e.$.columnNearContainer.style.width=e._frozenColumnsNearWidth+"px",e.$.columnFarContainer.style.width=e._frozenColumnsFarWidth+"px";for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.freeze&&o.element&&(!0===o.freeze||"near"===o.freeze?e.$.columnNearContainer.appendChild(o.element):"far"===o.freeze&&e.$.columnFarContainer.appendChild(o.element))}}get _clientSize(){const e=this;if(e.__clientSize)return e.__clientSize;const t=getComputedStyle(e.$.container),o=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),l=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),a=parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),n=parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth);return e.__clientSize={width:e.$.container.offsetWidth-o-a,height:e.$.container.offsetHeight-l-n},e.__clientSize}_initializeRowElements(){const e=this;if(!e.rows)return;e.rows.canNotify=!1;let t=0,o=e._clientSize.height;e.$.rowNearContainer.innerHTML="",e.$.rowFarContainer.innerHTML="",e.$.rowContainer.innerHTML="",e._rowElements=[],e._overflowOffset=Math.max(o,300),e.rightToLeft?(e.$.rowNearContainer.classList.remove("near"),e.$.rowNearContainer.classList.add("far"),e.$.rowFarContainer.classList.remove("far"),e.$.rowFarContainer.classList.add("near")):(e.$.rowFarContainer.classList.remove("near"),e.$.rowFarContainer.classList.add("far"),e.$.rowNearContainer.classList.remove("far"),e.$.rowNearContainer.classList.add("near"));const l=e.offsetHeight;e.$.container.classList.add("smart-hidden");const a=e.offsetHeight;e.$.container.classList.remove("smart-hidden"),"hidden"!==e.verticalScrollBarVisibility&&l===a||(o=e._scrollHeight);const n=function(){const l=document.createDocumentFragment();if(e.rows&&0===e.rows.length)return;for(let a=0;a<e.rows.length;a++){const n=e.rows[a];if(n.freeze&&n.visible)continue;const i=n.createElement();if(l.appendChild(i),t+=e.layout.rowMinHeight,t>e._overflowOffset+o)break}e.$.rowContainer.appendChild(l);const a=e.$.rowContainer.children;for(let t=0;t<a.length;t++){const o=a[t];e.rows[t]&&(e.rows[t].element=o),e._rowElements[t]=o}};for(let t=0;t<e._frozenNearRows.length;t++){const o=e._frozenNearRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowNearContainer.appendChild(l)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];o.grid=e;const l=o.createElement();o.element=l,e.$.rowFarContainer.appendChild(l)}n();let i=0;for(;t<1.5*o&&++i<50;)n();e.rows.canNotify=!0}_refreshSummary(e){const t=this;t.summaryRow.visible&&(t._summaryUpdateTimer&&clearTimeout(t._summaryUpdateTimer),t._summaryUpdateTimer=setTimeout((()=>{!0!==t.editing.isEditing&&(t._calculateSummary(),!1!==e&&t._recycle(!1))}),100))}_initializeRows(){const e=this;let t=0;e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e.rows=[],e.rowById=[],e._frozenFarRows=[],e._frozenNearRows=[];let o=new Date;const l=function(){let t=[],o=!1;for(let l=0;l<e.columns.length;l++){const a=e.columns[l];let n={};a.summary&&a.summary.length>0&&(o=!0,n[a.dataField]=a.summary,t.push(n))}if(!o)return void(e._summaryItems=[]);const l=e.getSelectedRowIds();if(l.length>=1){const o=[];for(let t=0;t<l.length;t++){const a=e.dataSource.dataItemById[l[t]];a&&o.push(a)}e._summaryItems=e.dataSource.summarize(t,o)}else if(e._selection&&e._selection.cells&&Object.keys(e._selection.cells).length>2){const o=e.getSelectedCells(!1),l=[],a=[];for(let t=0;t<o.length;t++){const n=o[t],i=n[0],r=e.dataSource.dataItemById[i];-1===l.indexOf(r)&&l.push(r),-1===a.indexOf(n[1])&&a.push(n[1])}e._summaryItems=e.dataSource.summarize(t,l);const n=Object.keys(e._summaryItems);for(let t=0;t<n.length;t++){const o=n[t];-1===a.indexOf(o)&&delete e._summaryItems[o]}}else e._summaryItems=e.dataSource.summarize(t)};e._calculateSummary=l;const a=function(l,a,n){let i=null;if(e.isInitialized&&(o=new Date),i=l?l.grid?l:new Smart.Grid.Row({data:l,index:a,grid:e,createdBy:e.currentUser,createdDate:o}):new Smart.Grid.Row({data:{},index:a,grid:e,createdBy:e.currentUser,createdDate:o}),e.rowById[i.id]&&(i.id=e.rows.length,e.rowById[i.id])){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};i.id=e()}if(e.onRowInit){e.onRowInit(a,i);for(let t in i)-1!==i.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidRowProperty",{elementType:"Grid",propertyName:t}))}if(i.selected&&(e._selection.rows[i.id]=!0,e._selection.indexes[i.index]=i.index),i.freeze&&i.visible){if(!0===i.freeze||"near"===i.freeze){e.rows.splice(t++,0,i);const o=e.rows[t-1];-1===e._frozenNearRows.indexOf(o)&&e._frozenNearRows.push(o)}else if("far"===i.freeze){e.rows.push(i);const t=e.rows[e.rows.length-1];-1===e._frozenFarRows.indexOf(t)&&e._frozenFarRows.push(t)}}else e.rows[a]?e.rows.splice(a,0,i):e.rows.push(i),i.data&&i.data.$&&(i.data.$.history=i.history,i.data.$.starred=i.starred,i.data.$.comments=i.comments,i.data.$.style=i.style);if(!("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource))if(e.onRowInserted){const t=void 0===a?e.rows[e.rows.length-1]:e.rows[a],o=o=>{const l=t;if(void 0!==o&&Array.isArray(o)&&(o=o[0]),void 0===o){if(e.rowById[l.id]){const t=e.dataSource.dataItemById[l.id],o=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};l.id=o(),l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,t&&(e.dataSource.dataItemById[l.id]=l.data)}e.rowById[l.id]=l}else l.id=o,l.data&&l.data.$?l.data.$.id=l.id:l.data.id=l.id,e.rowById[l.id]=l;-1!==l.index&&void 0!==l.index||(l.index=e.rows.length),e._setAddUndoRedo(l),!e.editing.isEditing&&e.isInitialized&&e._recycle(!1,!0),e._onRowInserted&&e._onRowInserted(l),n&&n(l)};if(void 0===a&&(a=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=a)),e.isInitialized){e._rowInsertTimer&&clearTimeout(e._rowInsertTimer),e._rowInsert||(e._rowInsert=[]),e._rowInsert.push({row:t,index:a});const l=e._keyboardAdd?300:150;e._rowInsertTimer=setTimeout((()=>{if(1===e._rowInsert.length)e.onRowInserted([a],[t],o),delete e._rowInsert,delete e._undoRedoAction;else{let t=[],o=[];for(let l=0;l<e._rowInsert.length;l++)t.push(e._rowInsert[l].index),o.push(e._rowInsert[l].row);delete e._rowInsert,e.onRowInserted(t,o,(t=>{e.beginUpdate();for(let l=0;l<o.length;l++){const a=o[l],i=t?t[l]:void 0;void 0!==i&&(a.id=a.data.id=i,e.rowById[a.id]=a),e._setAddUndoRedo(a),-1!==a.index&&void 0!==a.index||(a.index=e.rows.length),e._onRowInserted&&e._onRowInserted(a),n&&n(a)}delete e._undoRedoAction,e.endUpdate(!1)}))}}),l)}else e.onRowInserted([a],[t],o)}else{const t=void 0===a?e.rows[e.rows.length-1]:e.rows[a];void 0===a&&(a=e.rows.length-1,void 0!==t.index&&-1!==t.index||(t.index=a)),n&&n(t)}},n=function(){const t=e.rows[e.rows.length-1];e.rows.pop(),e.onRowRemoved&&e.onRowRemoved([t.id],[t.index]),e._setRemoveUndoRedo(t)},i=function(t){const o=e.rows[t];o.selected&&o.setProperty("selected",!1),e.rows.splice(t,1),e.onRowRemoved&&e.onRowRemoved([o.id],[t]),e._setRemoveUndoRedo(o)};e._add=a,e._removeLastRow=n,e._removeAt=i,e._rowHeight=e._autoRowHeight;const r=e.dataSource.length;if(e.setAttribute("aria-rowcount",r),e.dataSource&&e.dataSource.virtualDataSource){let t=e.dataSource.length>e.virtualModeCachedRowsCount?e.virtualModeCachedRowsCount:e.dataSource.length;"infinite"===e.scrolling&&(t=e.dataSource.length);for(let o=0;o<t;o++){const t=e.dataSource[o];a(t,o)}}else for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];a(o,t)}for(let t=0;t<e._frozenFarRows.length;t++){const o=e._frozenFarRows[t];e.rows.splice(e.rows.indexOf(o),1),e.rows.push(o)}if(l(),e.dataSource.notify((function(t){if(e.dataSource._updating)return;const o=t.data;e.rows.canNotify=!1;let s=!1;switch(t.action){case"add":if(!o)return;if(void 0!==o.length)for(let t=0;t<o.length;t++)a(o[t],e.dataSource.length-o.length+t);else a(o,e.dataSource.length-1);break;case"update":if(o.length){let o=[],l=[],n=[];for(let i=0;i<n.length;i++){const r=t.index[i];e.rows[r]?(e.rows[r].data=n[i],o.push(r),l.push(e.rows[r]),n.push(e.rows[r].data)):(a(n[i],n[i].$.index),s=!0)}e.onRowUpdated&&e.onRowUpdated(o,l,n)}else{const l=t.index;e.rows[l]?e.rows[l].data=o:a(o,e.dataSource.length-1),e.onRowUpdated&&e.onRowUpdated([l],[e.rows[l]],[e.rows[l].data])}break;case"insert":a(o,t.index);for(let t=0;t<e.rows.length;t++)e.rows[t].index=t;break;case"remove":i(t.index);break;case"removeLast":n();break;case"bindingComplete":if(e.dataSource&&e.dataSource.url||e.dataSource&&!e.dataSource.virtualDataSource){if(e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),e._toggledRow=null,e.dataSource.length!==r){if(e.paging.enabled){const t=e.$.headerPager.querySelector("smart-pager"),o=e.$.footerPager.querySelector("smart-pager");t&&(t.pagesCount=Math.ceil(e.dataSource.length/e._pageSize)),o&&(o.pagesCount=Math.ceil(e.dataSource.length/e._pageSize))}e._initializeRows(),e._initializeRowElements(),e.refresh()}e._recycle()}}l(),("update"!==t.action||s)&&e._refreshLayout(),e._recycle(),e.rows.canNotify=!0})),e._observeRows(),e.summaryRow.visible){const t=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"near",visible:"near"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0}),o=new Smart.Grid.Row({height:e.layout.rowMinHeight,freeze:"far",visible:"far"===e.summaryRow.position,summaryRowIndex:0,summaryRow:!0});"near"===e.summaryRow.position&&e._frozenNearRows.splice(0,0,t),"far"===e.summaryRow.position&&e._frozenFarRows.push(o)}if(e.filtering.enabled&&e.filtering.filterRow.visible){const t=new Smart.Grid.Row({freeze:!0,autoGenerated:!0,filterRow:!0});e._frozenNearRows.splice(0,0,t)}e._renderAddNewRow()}_observeRows(){const e=this;e._frozenNearRows=[],e._frozenFarRows=[],e.rows=new Smart.ObservableArray(e.rows,null,{allowToggle:!0,allowResize:!0,allowCheck:!0,allowSelect:!0,allowReorder:!0,expanded:!0,selected:!0,checked:!0,visible:!0,enabled:!0,minHeight:!0,height:!0,freeze:!0,showDetail:!0,data:!0,visibleIndex:!0,index:!0,comments:!0,style:!0,starred:!0,updatedBy:!0,updatedDate:!0,createdDate:!0,createdBy:!0,history:!0});for(let t=0;t<e.rows.length;t++){const o=e.rows[t];!0===o.freeze||"near"===o.freeze?e._frozenNearRows.push(o):"far"===o.freeze&&e._frozenFarRows.push(o),e.rowById[e.rows[t].id]=o}e.rows.notify((function(t){if(!e.rows.canNotify)return;const o=t.action;if("length"===o)return;if(t.path)return e.rows.canNotify=!1,(e.rowById[t.target.id]||"selected"===t.propertyName)&&(l=t.target,a=t.propertyName,n=t.oldValue,i=t.newValue,n===i&&"selected"!==a&&"showDetail"!==a||l.propertyChanged(a,n,i)),void(e.rows.canNotify=!0);var l,a,n,i;if(e.rows.canNotify=!1,!e.dataSource)return;switch(e.dataSource.canNotify=!1,o){case"add":{const o=function(o){let l=e.rows[o];if(l instanceof Smart.Grid.Row==0){l=new Smart.Grid.Row(l);const a=e.rows.canNotify;e.rows.canNotify=!1,t.object[o]=l,l=t.object[o],e.rows.canNotify=a}if(l.grid=e,e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;for(let t=0;t<e.rows.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];o&&(l.data=o,l.id=o.$.id),e.rowById[l.id]=l}e.rows.canNotify=!0}else(()=>{if(0===e.dataSource.length&&e.dataSource.dataFields&&0===e.dataSource.dataFields.length&&e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource.dataFields=t}o<e.dataSource.length?e.dataSource.insert(o,e.rows[o].data):e.dataSource.add(e.rows[o].data),e.dataSource[o]&&(l.data=e.dataSource[o],void 0!==e.dataSource[o].$.id&&(l.id=e.dataSource[o].$.id,e.rowById[l.id]=l),l.data.$&&l.history&&(l.data.$.history=l.history)),-1!==l.index&&void 0!==l.index||(l.index=o),l.selected&&(e._selection.rows[l.id]=!0,e._selection.indexes[l.index]=l.index),l.freeze&&(!0===l.freeze||"near"===l.freeze?e._frozenNearRows.push(l):"far"===l.freeze&&e._frozenFarRows.push(l))})()};for(let e=0;e<t.addedCount;e++)o(t.index+e);break}case"update":if(t.target){const o=e.rowById[t.target.id],l=e.rows.indexOf(o);e.dataSource.update(l,o)}else{const o=e.rows.indexOf(t.index);e.dataSource.update(t.index,o)}break;case"remove":{if(e.dataSource&&e.dataSource.virtualDataSource){e.rows.canNotify=!1;const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id];for(let t=0;t<e.dataSource.boundSource.length;t++){const o=e.dataSource.boundSource[t],l=e.rows[t];l.data=o,l.id=o.$.id,e.rowById[l.id]=l}return e.rows.canNotify=!0,void e.refresh()}const o=t.removed&&t.removed.length>0?t.removed[0]:null;o&&delete e.rowById[o.id],e.dataSource.removeAt(t.index);break}}if(e.dataSource.canNotify=!0,e.rows.canNotify=!0,!o)return;let r=e.isInitialized&&e._rowElements&&e._rowElements.length<e.rows.length;"add"===o&&1===t.addedCount&&r&&e._rowElements.length>0&&e._rowElements[e._rowElements.length-1].classList.contains("smart-hidden")&&(r=!1),r&&e._initializeRowElements(),e.refresh(),e._refreshPagesCount(),e._sortedColumns&&e._sortedColumns.length>0&&e.refreshSort()}))}render(){const e=this,t=()=>0===e.offsetWidth||0===e.offsetHeight;if(t())return requestAnimationFrame((()=>{e.isInitialized||t()||e._render()})),e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),void super.render();const o=e.context;e.context=e,e.setAttribute("role","grid"),e.editing.enabled||e.setAttribute("aria-readonly",!0),e._undoRedo=[],e._refreshCurrentUser(),e._render(),e.context=o,super.render()}_renderColumns(e){const t=this;t._initializeColumns(),t._initializeColumnGroupsHierarchy(),t._refreshColumnsResponsiveVisibility(),t._createColumnHeaderCellElements(),t._renderColumnGroupHeaders(),!1!==e&&t._refresh()}_renderRows(e){const t=this;t._initializeRows(),t._initializeRowElements(),!1!==e&&t._refresh()}_render(){const e=this;if(!e.isInitialized&&(e.onBeforeInit&&(e.onBeforeInit(),e.onBeforeInit=null),e.$.fireEvent("beforeInit",{grid:e}),e.header.visible&&e.header.buttons.indexOf("views")>=0&&(e._setupKanbanView(),e.dataSource&&e.dataSource.length)))for(let t=0;t<e.dataSource.length;t++){const o=e.dataSource[t];for(let t=0;t<e.columns.length;t++){const l=e.columns[t];void 0!==l.defaultValue&&void 0===o[l.dataField]&&(o[l.dataField]=l.defaultValue)}}if((()=>{if(null===e.dataSource)e.dataSource=new Smart.DataAdapter;else if(Array.isArray(e.dataSource)||"string"==typeof e.dataSource){let t=[];if(e.dataSourceSettings.dataFields&&e.dataSourceSettings.dataFields.length>0)e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataSourceType:e.dataSourceSettings.dataSourceType,dataFields:e.dataSourceSettings.dataFields,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand});else if(e.columns&&e.columns.length){for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t,dataSourceType:e.dataSourceSettings.dataSourceType,keyDataField:e.dataSourceSettings.keyDataField,parentDataField:e.dataSourceSettings.parentDataField,childrenDataField:e.dataSourceSettings.childrenDataField,groupBy:e.dataSourceSettings.groupBy,mapChar:e.dataSourceSettings.mapChar,root:e.dataSourceSettings.root,record:e.dataSourceSettings.record,autoGenerateColumns:e.autoGenerateColumns,id:e.dataSourceSettings.id,virtualDataSource:e.dataSourceSettings.virtualDataSource,virtualDataSourceOnExpand:e.dataSourceSettings.virtualDataSourceOnExpand})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource})}})(),e._selection={rows:[],indexes:[],columns:[],cells:[]},e.dataSource&&e.dataSource.url&&(e.appearance.displayLoadingIndicator=!0,e._setLoadingIndicatorVisibility(),e.dataSource.data={sorting:e.getSortedColumns(),filtering:e.getFilteredColumns(),grouping:[]}),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);const t=!e.isInitialized;if(t&&(e.onInit&&(e.onInit(),e.onInit=null),e.$.fireEvent("init",{grid:e})),e._renderColumns(!1),e._renderRows(!1),e._renderPagers(),e._renderCommandBar(),e._renderConditionalFormatting(),e.appearance.allowColumnStickyPosition&&e._stickHeader(),e.header.visible&&""===e.header.template){const t=document.createElement("smart-grid-toolbar");t.headerPosition="top",t.messages=e.messages,t.locale=e.locale,e.$.header.appendChild(t),e.$.headerBar=e.$.header.firstElementChild,e.$.headerBar._init(e)}if(e.isInitialized)e.refreshFilters();else{const t=[];for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.allowSort&&l.sortOrder&&t.push(l)}t.sort(((e,t)=>e.sortIndex-t.sortIndex));for(let o=0;o<t.length;o++){const l=t[o],a=e.appearance.allowSortAnimation;e.appearance.allowSortAnimation=!1,e.sortBy(l.dataField,l.sortOrder),e.appearance.allowSortAnimation=a}if(e.filtering.filter.length>0){for(let t=0;t<e.filtering.filter.length;t++){const o=e.filtering.filter[t];if(o){const t=o[0],l=o.splice(1);let a=null;if(l instanceof Smart.FilterGroup)a=l;else{const o=e.columnByDataField[t];o&&(a=e.dataSource._createFilter(o.dataType,l))}a&&e.addFilter(t,a,!1)}}e.refreshFilters()}else{for(let t=0;t<e.columns.length;t++){const o=e.columns[t];if(o.filter){let t=null,l=o.filter;t=l instanceof Smart.FilterGroup?l:e.dataSource._createFilter(o.dataType,l),t&&e.addFilter(o.dataField,t,!1)}}e.refreshFilters()}}if(e.viewColumns.canNotify=!0,e.isInitialized=!0,("virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource)&&e._virtualDataRequest("dataBind"),""!==e.header.template&&e._applyTemplate(e.header.template,e.$.header),""!==e.footer.template&&e._applyTemplate(e.footer.template,e.$.footer),e._createFilterPanels(),e._refresh(),e._applyScrolling(),e.grouping.enabled&&e.grouping.autoExpandAll&&e.rowHierarchy&&e.expandAllRows(),e.onRender&&(e.onRender(t),e.onRender=null),e.isRendered=!0,"auto"===e.layout.rowHeight&&(e._refreshLayout(),e._recycle()),t&&(e.onAfterInit&&(e.onAfterInit(),e.onAfterInit=null),e.$.fireEvent("afterInit",{grid:e}),e.isRendering=!1,e.whenRenderedCallbacks)){for(let t=0;t<e.whenRenderedCallbacks.length;t++)e.whenRenderedCallbacks[t]();e.whenRenderedCallbacks=[]}"kanban"===e.view&&e._initKanbanView()}get _viewRows(){const e=this;if(e.__viewRows)return e.__viewRows;e._nearRowsAdded||(e._nearRowsAdded=[],e._farRowsAdded=[]);const t=e.rowHierarchy?e.rowHierarchy:e.rows.toArray(),o=[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,t,e._farRowsAdded,e._frozenFarDefaultRows);return e.__viewRows=o,o}_toHex(e){if(-1!==e.indexOf("#"))return e;const t=/rgb\((\d+), (\d+), (\d+)\)/g.exec(e);return t?"#"+(parseFloat(t[1]).toString(16).padStart(2,"0")+parseFloat(t[2]).toString(16).padStart(2,"0")+parseFloat(t[3]).toString(16).padStart(2,"0")).toUpperCase():"#FFFFFF"}_renderConditionalFormatting(){const e=this,t=e.conditionalFormatting;if(!t||0===t.length)return;if(!e._defaults){const t=getComputedStyle(e);e._defaults={fontFamily:t.fontFamily,fontSize:t.fontSize,text:e._toHex(t.color),highlight:e._toHex(t.backgroundColor)}}e._formatter||(e._formatter=new Smart.Utilities.ConditionalFormatter(e.dataSource));const o=e._defaults,l=e._formatter,a=[],n=function(t){if("all"===t){if(e.columns&&e.columns.map){const t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];l.dataField.startsWith("task")||l.autoGenerated||"number"!==l.dataType&&"date"!==l.dataType||t.push(l.dataField)}return t}return[]}return[t]};for(let e=0;e<t.length;e++){t[e]=Object.assign({column:"all",condition:"lessThan",firstValue:0,secondValue:1,fontFamily:o.fontFamily,fontSize:o.fontSize,text:o.text,highlight:o.highlight},t[e]);const i=t[e],r=n(i.column),s=i.condition;l.color=i.highlight,l.comparator=i.firstValue,l.min=i.firstValue,l.max=i.secondValue;const d=l.format(s,r);for(let e in d){const t=d[e];for(let e in t){const o=t[e];o.color=i.text,o.fontFamily=i.fontFamily,o.fontSize=i.fontSize}}a.push(d)}if(e._formattingPanel&&(e._formattingPanel.items=t),0===a.length)return a[0];const i={};for(let e=0;e<a.length;e++){const t=a[e];for(let e in t){const o=t[e];if(0!==Object.keys(o).length){i[e]||(i[e]={});for(let t in o)i[e][t]=Object.assign({},i[e][t],o[t])}}}e._conditionalFormatting=i}_stickHeader(){const e=this;e._stickyHeaderHandler=function(){e._handleStickyHeader()},e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);t!==document&&t;)t.addEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{null!==window.top&&window.top!==window.self&&window.top.document.addEventListener("scroll",e._stickyHeaderHandler)}catch(e){}e._handleStickyHeader()}_unstickHeader(){const e=this;e.$.columnHeader.style.top="",e.$.columnHeader.classList.remove("smart-columns-sticky");let t=e.parentNode;for(;t!==document.body;)t.removeEventListener("scroll",e._stickyHeaderHandler),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);try{(""!==document.referrer||window.frameElement)&&null!==window.top&&window.top!==window.self&&window.top.document.removeEventListener("scroll",e._stickyHeaderHandler)}catch(e){}}_handleStickyHeader(){const e=this;if(e.appearance.allowColumnStickyPosition)if(e.$.columnHeader.classList.add("smart-columns-sticky"),0===document.scrollTop&&0===e.parentElement.scrollTop)e.$.columnHeader.style.top="";else{let t=e.parentNode,o=0;for(;t!==document.body;)o+=parseInt(t.scrollTop),t=t.parentNode,e.isInShadowDOM&&t===e.getRootNode()&&(t=e.getRootNode().host);const l=parseInt(e.clientTop+o);e.$.columnHeader.style.top=l+"px";let a=0;window.top!==window.self&&parseInt(window.top.scrollY)>parseInt(e._offsetTop(window.frameElement))&&(a=parseInt(window.top.scrollY)-parseInt(e._offsetTop(window.frameElement))),window.scrollY+a>e.offsetTop&&(e.$.columnHeader.style.top=parseInt(window.scrollY)-parseInt(e.offsetTop)+l+a+"px")}}_scrollHandler(){this._handleStickyHeader()}_initializeRowNumberColumn(){const e=this;if(e._frozenNearColumns&&e._frozenNearColumns.length>0&&e._frozenNearColumns[0].rowHeaderColumn)return void(e._frozenNearColumns[0].visible=e.appearance.showRowHeaderNumber||e.appearance.showRowHeader);const t=new Smart.Grid.Column({dataField:"_rowHeaderColumn",label:"",allowSelect:!1,freeze:!0,visible:!0,grid:e,autoGenerated:!0,rowHeaderColumn:!0,cellsAlign:"center"}),o=e.rows?e.rows.length:e.dataSource?e.dataSource.length:0;let l=e.appearance.showRowHeaderNumber?t._measureSize(o):30;e.layout.autoGenerateColumnWidth&&(l=e.layout.autoGenerateColumnWidth),t.width=l,t.createElement();const a=new Smart.Observable(t,t.observables);e.viewColumns.splice(0,0,a),e._frozenNearColumns.splice(0,0,a)}_initializeColumns(){const e=this;if("number"==typeof e.columns){const t=[],o="A".charCodeAt(0);let l="",a=0;for(let n=0;n<e.columns;n++){let i=n+1;const r=String.fromCharCode(o+a);a++;const s=l+r;"number"!==e.appearance.autoGenerateColumnLabelMode&&(i=l+r),t.push({align:"center",label:i,dataField:s,width:100}),a>=26&&(a=0,l+="A")}e._boundColumns=t}else e._boundColumns=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];e._initColumns=e.columns,e.columnByDataField=[],e.viewColumns=[],e.columns=new Smart.ObservableArray,e._frozenFarColumns=[],e._frozenNearColumns=[],e._summaryRowCount=1;let t=0;const o=function(t){if(e.dataSource.dataFields){const o=e.dataSource.dataFields.find((e=>{if(e.name===t.dataField)return e})),l=o&&o.dataType||"string";t.dataType||(t.dataType=l)}};if(0===e._boundColumns.length&&e.dataSource&&e.dataSource[0]&&!1!==e.dataSource.autoGenerateColumns){const t=e.dataSource[0];if(t.$&&t.$.isEmpty&&e.dataSource.dataFields)for(let t=0;t<e.dataSource.dataFields.length;t++){const o=e.dataSource.dataFields[t],l=e._boundColumns.length,a={index:l,visibleIndex:l,label:o.name,dataField:o.name,dataType:o.dataType};e._boundColumns.push(a)}else for(let l in t){if(l.startsWith("_")||"$"===l)continue;const t=e._boundColumns.length,a={index:t,visibleIndex:t,label:l,dataField:l};o(a),e._boundColumns.push(a)}}for(let l=0;l<e._boundColumns.length;l++){let a=e._boundColumns[l];if("string"==typeof a){if(e.dataSource.dataFields){const t=e.dataSource.dataFields.find((e=>{if(e.name===a)return e}));a={label:a,dataField:a,dataType:t&&t.dataType||"string"}}}else o(a);a.visibleIndex=l,a.index=l,a.grid=e;const n=new Smart.Grid.Column(a);e.onColumnInit&&e.onColumnInit(l,n);for(let t in n)-1!==n.properties.indexOf(t)||t.startsWith("_")||e.error(e.localize("invalidColumnProperty",{elementType:"Grid",propertyName:t,type:n.dataField||"Column"}));n.grid=e,e.columns.push(n);const i=e.columns[e.columns.length-1];e._summaryRowCount=Math.max(e._summaryRowCount,n.summary.length),n.freeze?!0===n.freeze||"near"===n.freeze?(e.viewColumns.splice(t++,0,i),e._frozenNearColumns.push(i)):"far"===n.freeze&&e._frozenFarColumns.push(i):e.viewColumns.push(i),e.columnByDataField[n.dataField]?(i.parent=e.columnByDataField[n.dataField],e.columnByDataField[n.dataField].children||(e.columnByDataField[n.dataField].children=[]),e.columnByDataField[n.dataField].children.push(i),n.valueField=n.dataField,n.dataField+="_"+e.columnByDataField[n.dataField].children.length,n.displayField=n.valueField,e.columnByDataField[n.dataField]=i):e.columnByDataField[n.dataField]=i,e.onColumnInserted&&!e.isInitialized&&e.onColumnInserted(l,n)}e.viewColumns=e.viewColumns.concat(e._frozenFarColumns),e.setAttribute("aria-colcount",e._boundColumns.length);let l=0;if((e.appearance.showRowHeaderNumber||e.appearance.showRowHeader)&&(e._initializeRowNumberColumn(),l++),e.rowDetail.enabled){const t=20,o=new Smart.Grid.Column({dataField:"_rowDetailColumn",allowSelect:!1,visible:e.rowDetail.visible,label:"",grid:e,freeze:!0,rowDetailColumn:!0,autoGenerated:!0,cellsAlign:"center",width:t,minWidth:t}),a=new Smart.Observable(o,o.observables);"near"===e.rowDetail.position?(o.freeze="near",a.freeze="near",e.viewColumns.splice(l,0,a),e._frozenNearColumns.splice(l,0,a)):(e.viewColumns.push(a),e._frozenFarColumns.splice(0,0,a)),l++}const a=new Smart.Grid.Column({dataField:"_adaptiveColumn",allowSelect:!1,visible:!1,label:"",grid:e,freeze:"far",adaptiveColumn:!0,autoGenerated:!0,cellsAlign:"center",width:30}),n=new Smart.Observable(a,a.observables);n.canNotify=!1,e.viewColumns.push(n),e._frozenFarColumns.splice(0,0,n);const i=new Smart.Grid.Column({dataField:"_commandColumn",allowSelect:!1,visible:e.editing.enabled&&e.editing.commandColumn.visible&&!e.editing.commandColumn.inline,label:"",grid:e,freeze:"far",commandColumn:!0,autoGenerated:!0,align:"center",cellsAlign:"center",width:""}),r=new Smart.Observable(i,i.observables);r.canNotify=!1,"near"===e.editing.commandColumn.position?(i.freeze="near",r.freeze="near",e.viewColumns.splice(l,0,r),e._frozenNearColumns.splice(l,0,r)):(e.viewColumns.push(r),e._frozenFarColumns.splice(0,0,r)),e._commandColumn=r;const s=new Smart.Grid.Column({allowSelect:!1,visible:e.selection.enabled&&e.selection.checkBoxes.enabled,dataField:"_checkBoxColumn",label:"",freeze:e.selection.checkBoxes.position,grid:e,selectionColumn:!0,autoGenerated:!0,cellsAlign:"center",width:32}),d=new Smart.Observable(s,s.observables);if("near"===s.freeze?(e.viewColumns.splice(l,0,d),e._frozenNearColumns.splice(l,0,d)):(e.viewColumns.push(d),e._frozenFarColumns.splice(0,0,d)),e._selectionColumn=d,e._selectionColumn.canNotify=!1,e.editing.addNewColumn.visible){const t=new Smart.Grid.Column({dataField:"_addNewColumn",allowSelect:!1,visible:!0,title:e.localize("addNewColumn"),label:"",cellsClassName:"smart-add-new-column",className:"smart-add-new-column smart-icon smart-grid-icon show smart-icon-plus",grid:e,adaptiveColumn:!1,autoGenerated:!0,cellsAlign:"center",width:90}),o=new Smart.Observable(t,t.observables);e.viewColumns.push(o),e._addNewColumn=o,e._addNewColumn.canNotify=!1}e._observeColumns(),e._templateColumns()}get styleProperties(){return["grid-template-columns","--smart-grid-row-height","--smart-grid-column-header-height","--smart-grid-group-header-height","--smart-grid-filter-footer-height","--smart-grid-group-row-vertical","--smart-grid-group-row-horizontal-offset","--smart-grid-freeze-splitter-size","--smart-grid-resize-line-size","--smart-grid-footer-height","--smart-grid-header-height"]}_templateColumns(){const e=this,t=getComputedStyle(e),o=t.getPropertyValue("--smart-grid-template-columns").trim();if(e._rowGap=0,e._columnGap=0,e._maxHeight=parseInt(t.maxHeight),e._minHeight=parseInt(t.minHeight),"none"!==o){let t=0;for(let o=0;o<e.viewColumns.length;o++)e.viewColumns[o].autoGenerated&&(t+=e.viewColumns[o].visible?e.viewColumns[o].width:0);let l=[];const a=document.createElement("div");a.style.display="grid",a.style.gridTemplateColumns=o;for(let t=0;t<e.columns.length;t++)a.innerHTML+="<div></div>";a.style.width=e.clientWidth-t+"px",e.$.root.appendChild(a);const n=o.split(" ");for(let t=0;t<e.columns.length;t++)l[t]=a.children[t].offsetWidth,"auto"===n[t]&&(l[t]=null);a.parentNode.removeChild(a);let i=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||l[i]&&(o.width=o.templateWidth=l[i++])}}else for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.autoGenerated||o.templateWidth&&(o.width=o.templateWidth=null)}}onAttached(){const e=this;e._scrollView||(e._scrollView=new Smart.Utilities.Scroll(e,e.$.horizontalScrollBar,e.$.verticalScrollBar)),e.isRendered&&e.isCompleted&&e._render()}onDetached(){const e=this;if(!e.isRendered)return;["_dialogChart","_dialogAddRow","_dialogEdit","_dialogDelete","_dialogRowDetail"].forEach((t=>{e[t]&&(e[t].close(),e[t]=null)})),e.menu&&(e.menu.ownerElement=null,e.menu.remove(),e.menu=null);const t=e.querySelector("smart-grid-toolbar");if(t){const e=t.$.headerDropDown;e&&e.remove()}e._resetCachedLayout();const o=e._scrollView.hScrollBar,l=e._scrollView.vScrollBar;if(l.ownerElement=null,o.ownerElement=null,l.onChange=null,o.onChange=null,e._scrollView&&(e._scrollView.unlisten(),delete e._scrollView),e._columnElements)for(let t=0;t<e._columnElements.length;t++)e._columnElements[t]._detach();if(e._columnElements=null,e._rowElements)for(let t=0;t<e._rowElements.length;t++)e._rowElements[t]._detach();e._rowElements=null,e.rows=[],e.rowById=[],e._initColumns=[],e.columnByDataField=[],e.viewColumns=[],e._columnToResizeElement=null;let a=Array.isArray(e.columns)?[...e.columns]:[...e.columns.toArray()];a=a.map((e=>e.data?(void 0!==e.data.visibleIndex&&delete e.data.visibleIndex,void 0!==e.data.index&&delete e.data.index,void 0!==e.data.grid&&delete e.data.grid,e.data):e)),e.rows.notifyFn=null,e.columns.notifyFn=null,e.columns.notify=null,e.columns._array=[],e.columns=a,e._boundColumns=[],e._filterPanels=[],e._frozenFarColumns=[],e._frozenNearColumns=[],e._frozenNearDefaultRows=[],e._frozenFarDefaultRows=[],e._frozenFarRows=[],e._frozenNearRows=[],e._selection={rows:[],indexes:[],columns:[],cells:[]},e.__autoHeightRows=null,e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e._selectionColumn=null,e._adaptiveColumn=null,e._commandColumn=null,delete e._columnFarContainerComputedStyle,delete e._columnContainerComputedStyle,delete e._columnNearContainerComputedStyle,e._inputOverlay&&(e._inputOverlay.parentNode&&e._inputOverlay.parentNode.removeChild(e._inputOverlay),e._inputOverlay=null),e._firstVisibleColumn=null,e._lastVisibleColumn=null,e._toggledRow=null,Smart(e._selector)&&(delete Smart(e._selector)._properties,Smart(e._selector)),delete e._selector,delete e._initProperties}_observeColumns(){const e=this,t=function(e,t,o,l){o===l&&"selected"!==t||e.propertyChanged(t,o,l)};for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.rowHeaderColumn||(l.onAction=function(){e._openMenu(this)}),l.autoGenerated&&l.notify((function(e){l.canNotify=!1,t(l,e.propertyName,e.oldValue,e.newValue),l.canNotify=!0}))}e.columns.notify((function(o){let l=null;if(o.path)return e.columns.canNotify=!1,t(o.target,o.propertyName,o.oldValue,o.newValue),void(e.columns.canNotify=!0);e.columns.canNotify=!1;let a=0;switch(o.action){case"length":return void(e.columns.canNotify=!0);case"add":{const t=function(t){if(l=o.object[t],l instanceof Smart.Grid.Column==0){l=new Smart.Grid.Column(l);const a=e.columns.canNotify;e.columns.canNotify=!1,o.object[t]=l,l=o.object[t],e.columns.canNotify=a}l.grid=e,l.onAction=function(){e._openMenu(this)},l.freeze?e._frozenNearColumns.push(l):"far"===l.freeze&&e._frozenFarColumns.push(l);let a=e.viewColumns.length-e._frozenFarColumns.length,n=0;if(e._frozenNearColumns.forEach((e=>{e.autoGenerated&&n++})),t<e.columns.length?e.viewColumns.splice(t+n,0,l):e.viewColumns.splice(a,0,l),e.columnByDataField[l.dataField]){e.columnByDataField[l.dataField].children.push(l),l.parent=e.columnByDataField[l.dataField],l.valueField=l.dataField;const t=l.dataField+"_"+l.parent.children.length;e.columnByDataField[t]=l,l.dataField=t}else e.columnByDataField[l.dataField]=l;e._dragDrop||e.onColumnInserted&&(e._onColumnInsertData||(e._onColumnInsertData=[],e._onColumnInsertIndexes=[]),e._onColumnInsertData.push(l),e._onColumnInsertIndexes.push(t),e._onColumnInsertTimer&&clearTimeout(e._onColumnInsertTimer),e._onColumnInsertTimer=setTimeout((()=>{e.onColumnInserted(e._onColumnInsertIndexes,e._onColumnInsertData),delete e._onColumnInsertIndexes,delete e._onColumnInsertData}),50))};delete e.__measuredColumnHeight;for(let e=0;e<o.addedCount;e++)t(o.index+e);break}case"update":l=o.object[o.index],l instanceof Smart.Grid.Column==0&&(l=new Smart.Grid.Column(l)),l.grid=e;for(let t=0;t<o.index;t++)e.viewColumns[t].autoGenerated&&a++;e.viewColumns[a+o.index]=l,e.columnByDataField[l.dataField]=l,e.onColumnUpdated&&e.onColumnUpdated(o.index,l);break;case"remove":{l=o.removed[0];let t=o.index,n=e.viewColumns.indexOf(l);if(-1===n){for(let o=0;o<=t;o++)e.viewColumns[o].autoGenerated&&a++;e.viewColumns.splice(a+t,1)}else e.viewColumns.splice(n,1);if(l&&delete e.columnByDataField[l.dataField],e._dragDrop||e.onColumnRemoved&&e.onColumnRemoved(o.index,l),e.columnGroups&&(e._columnGroups=[],e._columnHeights=0,e.viewColumns))for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t],l=o.element;o.top=0,o.level=0,l&&(l.style.top="",l.style.height="",l.style.lineHeight="")}break}}e._initializeColumnGroupsHierarchy(),e._refreshColumnsResponsiveVisibility(),e._createColumnHeaderCellElements(),e._templateColumns(),e.refresh(),e.columnGroups&&e._columnGroups.length>0&&e._renderColumnGroupHeaders(),e.columns.canNotify=!0}))}get _scrollWidth(){const e=this;if(e.__scrollWidth)return e.__scrollWidth;let t=0;for(let o=0;o<e.viewColumns.length;o++){const l=e.viewColumns[o];l.visible&&(t+=l.computedWidth)}return t=parseInt(t),e.__scrollWidth=t,e._scrollView.scrollWidth=t-e._clientSize.width,e.__scrollWidth}_horizontalScrollbarHandler(){const e=this;e.closeMenu(),e.isScrolling=!0,e.isHScrolling=!0,requestAnimationFrame((()=>{if(e.filtering.enabled&&e.filtering.filterRow.visible)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized&&(e.columns[t]._filterEditorInitialized=!1);e._summaryRowDialog&&e._summaryRowDialog.classList.contains("open")&&e._summaryRowDialog.close(),e._recycle(),e.isScrolling=!1,e.isHScrolling=!1}))}_mouseWheelHandler(e){const t=this;if(t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&t._scrollView.vScrollBar.$.hasClass("smart-hidden"))return;if(t._isUpdating)return;if(t.editing.isEditing)return;const o=t.querySelector("smart-grid-toolbar");if(!o||!o.$.headerDropDown.classList.contains("open"))if(t.disabled||t._scrollView.vScrollBar.$.hasClass("smart-hidden")||e.shiftKey||!e.deltaY){if(!t.disabled&&!t._scrollView.hScrollBar.$.hasClass("smart-hidden")&&e.deltaX){const o=t.scrollLeft;if(0===o&&e.deltaX<0||o===t.scrollWidth&&e.deltaX>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaX<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaX)>=100?t._scrollView.scrollLeft+=l:t._scrollView.scrollLeft+=e.deltaX}}else{const o=t.scrollTop;if(0===o&&e.deltaY<0||o===t.scrollHeight&&e.deltaY>0)return;e.stopPropagation(),e.preventDefault();let l=3*t.layout.rowMinHeight;e.deltaY<=0&&(l=-3*t.layout.rowMinHeight),Math.abs(e.deltaY)>=100?t._scrollView.scrollTop+=l:t._scrollView.scrollTop+=e.deltaY}}_refresh(){const e=this;if(e._isUpdating)return;const t=e.$.verticalScrollBar.offsetWidth;e.removeAttribute("grouped"),e.removeAttribute("tree");let o=!0;e.__autoHeightRows&&(e.__autoHeightRows=null,e._refreshColumnsResponsiveVisibility(),e._recycle(),o=!1),e._groups||(e._groups=[]),e.grouping.enabled&&e.dataSource.groupBy&&e.dataSource.groupBy.length>=0&&("advanced"===e.grouping.renderMode?e.setAttribute("grouped",""):e.setAttribute("tree",""),e._groups||(e._groups=[].concat(e.dataSource.groupBy.toArray())||[]),e._renderGroupBar()),e.grouping.enabled&&e.dataSource.groupBy&&0===e.dataSource.groupBy.length?e.$.breadcrumb&&(e.$.breadcrumb.dataSource=[]):e.dataSource.boundHierarchy&&(e.setAttribute("tree",""),e.setAttribute("role","treegrid")),(e.isInitialized||o)&&e._refreshColumnsResponsiveVisibility(),e._refreshLayout(),t!==e.$.verticalScrollBar.offsetWidth&&(e.__scrollWidth=null,e._refreshColumnsResponsiveVisibility(),e._refreshScrollBars(),0===e.$.verticalScrollBar.offsetWidth&&e.isRendered&&requestAnimationFrame((()=>{e._refreshScrollBars()}))),e._refreshSelection(),e._recycle(),e._refreshHeaderBar(),e._recyclingRows&&0===e._recyclingRows.length&&(e.$.placeholder.classList.remove("smart-hidden"),e.scrollHeight=0,e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=`<span class="smart-grid-icon show smart-icon-filter" style="\n font-size: calc(2 * var(--smart-font-size));\n cursor: default;\n margin-right: 10px;\n "></span>${e.localize("filteredRecords")}`)),requestAnimationFrame((()=>{e._width=e.offsetWidth,e._height=e.offsetHeight}))}_refreshHeaderBar(){const e=this;e.$.headerBar&&e.header.visible&&e.$.headerBar._refresh()}_resizeHandler(e){const t=this;if((t.enableShadowDOM?e.composedPath()[0]:e.target)===t&&!t._isUpdatingScrollBars){if(!t.isInitialized)return void t._render();if(!1===t._resizeHandling||!t.offsetHeight)return;t._isUpdatingScrollBars=!0,t._autoHeight=!1,t.$.content&&t.$.content.classList.remove("auto-height");const e=t._rowElements?t._rowElements.length*t.layout.rowMinHeight:0;e>0&&t.offsetHeight>=e&&(t._refreshLayout(),t._initializeRowElements()),t.refresh(),t.$.headerBar&&t.$.headerBar.refreshTools(),t._dialogAddColumn&&t._dialogAddColumn.classList.contains("open")&&t._dialogAddColumn.refresh(),t._isUpdatingScrollBars=!1}}_refreshColumnsResponsiveVisibility(){const e=this,t=e.$.columnContainer,o=e.$.columnNearContainer,l=e.$.columnFarContainer;let a=0,n=0,i=0,r=!1;const s=e.columns.canNotify;e.columns.canNotify=!1;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.setProperty("_treeColumn",!1,!1),e.grouping.enabled&&e.grouping.autoHideGroupColumn&&e.dataSource.groupBy&&e.dataSource.groupBy.indexOf(o.dataField)>=0&&o.setProperty("visible",!1,!1),o.visible&&!o.autoGenerated&&!r&&e.dataSource.boundHierarchy&&(o.setProperty("_treeColumn",!0,!1),r=!0)}e._refreshColumnWidths(),e.columns.canNotify=s;let d=0,u=0;for(let t=0;t<e.viewColumns.length;t++){const o=e.viewColumns[t];o.visible&&(o.freeze&&(!0===o.freeze||"near"===o.freeze?(a+=o.computedWidth,o.autoGenerated&&(d+=o.computedWidth)):"far"===o.freeze&&(n+=o.computedWidth,o.autoGenerated&&(u+=o.computedWidth))),i+=o.computedWidth)}t.style.width=i+"px",o.style.width=a+"px",l.style.width=n+"px",l.classList.remove("smart-hidden"),o.classList.remove("smart-hidden"),0===n&&l.classList.add("smart-hidden"),0===a&&o.classList.add("smart-hidden"),l.classList.remove("border-collapse"),n===u&&l.classList.add("border-collapse"),e._autoGeneratedColumnsNearWidth=d,e._autoGeneratedColumnsFarWidth=u,e._computedColumnsWidth=i,e._frozenColumnsNearWidth=a,e._frozenColumnsFarWidth=n}_selectStartHandler(e){const t=this;t.isScrolling||t.editing.isEditing||"grid"!==t.view||t.selection.defaultSelection||e.preventDefault()}setFocusable(e){const t=this;!t.disabled&&e?t.tabIndex=0:t.removeAttribute("tabindex")}_setLoadingIndicatorVisibility(){const e=this;e.appearance.displayLoadingIndicator?e.$.loadingIndicatorContainer.classList.remove("smart-visibility-hidden"):e.$.loadingIndicatorContainer.classList.add("smart-visibility-hidden")}_refreshElementsVisibility(){const e=this,t=function(e,t){e&&(t?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden"))};if(t(e.$.placeholder,!e.rows||e.rows&&0===e.rows.length||0===e.columns.length),t(e.$.footer,e.footer.visible),t(e.$.header,e.header.visible),t(e.$.groupHeader,e.groupHeader.visible||e.grouping.groupBar.visible),t(e.$.columnHeader,e.columnHeader.visible&&e.columns.length>0),t(e.$.headerCommandBar,e.editing.commandBar.visible&&"far"!==e.editing.commandBar.position),t(e.$.footerCommandBar,e.editing.commandBar.visible&&"near"!==e.editing.commandBar.position),t(e.$.breadcrumb,e.groupHeader.visible||e.grouping.groupBar.visible),e.htmlColumnLastChild.classList.add("smart-visibility-hidden"),e.pager&&e.pager.visible&&e.paging.enabled)switch(e.pager.position){case"near":t(e.$.headerPager,!0),t(e.$.footerPager,!1);break;case"far":t(e.$.headerPager,!1),t(e.$.footerPager,!0);break;case"both":t(e.$.headerPager,!0),t(e.$.footerPager,!0)}else t(e.$.footerPager,!1),t(e.$.headerPager,!1);e._refreshRowHierarchy()}_refreshRowHierarchy(e,t=!1){const o=this;o.rowHierarchy=null;let l=0,a=!1;if(!o.grouping.enabled&&o.dataSource.groupBy&&o.dataSource.groupBy.length>0&&(a=!0),(!o.grouping.enabled||!o.dataSource.groupBy||0!==o.dataSource.groupBy.length)&&o.dataSource.boundHierarchy){const n=o.dataSource.reservedNames,i=function(e){const t=new Smart.Grid.Row({data:e,index:o.rows.length});return o.rowById[t.id]=t,t},r=function(t,l){for(let s=0;s<t.length;s++){const d=t[s];let u=o.rowById[d.$.id];u||(u=i(d)),u.data=d,u.leaf=d[n.leaf]||!1,u.level=d[n.level],u.groupDataField=d.groupDataField,u.label=d.label,u.children=[],u.data&&(u.filtered=void 0===u.data.$.filtered||u.data.$.filtered),d.summaryRow&&(u.summaryRow=!0),(null===o._toggledRow||o._toggledRow&&o._toggledRow.id!==u.id)&&(u.expandHeight=0),d.parent?(u.parent=o.rowById[d.parent.$.id],u.parentId=d.parent.$.id):(u.parent=null,u.parentId=null);let c=!!e||u.expanded;if(a&&(c=!0),!0===u.visible&&!1!==u.filtered)if(c||d[n.leaf])if(l.push(u),d.children&&d.children.length>0){const e=r(d.children,new Array);0===e.length&&(u.leaf=!0);for(let t=0;t<e.length;t++)l.push(e[t]);u.children=e}else d.children&&0===d.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?u.data._loaded&&(u.leaf=!0):u.leaf=!0);else if(l.push(u),d.children&&d.children.length>0){const e=r(d.children,new Array);0===e.length&&(u.leaf=!0),u.children=e}else d.children&&0===d.children.length&&(o.dataSource.virtualDataSource&&o.dataSource.virtualDataSourceOnExpand?u.data._loaded&&(u.leaf=!0):u.leaf=!0)}return l};let s=o.dataSource.boundHierarchy;if(o.paging.enabled&&!t){let e=[];const t=e=>{let l=[];if(0===o.dataSource.groupBy.length)return e;for(let o=0;o<e.length;o++){const a=e[o];(!a.$||void 0===a.$.filtered||a.$.filtered)&&(l.push(a),a.children&&(l=l.concat(t(a.children))))}return l};if(o.dataSource&&!o.dataSource.virtualDataSource){for(let o=0;o<s.length;o++){let l=s[o],a=!l.$||void 0===l.$.filtered||l.$.filtered;if((a||null===a)&&0===l.level&&!l.parent){if(0===t(l.children).length)continue;e.push(l)}}s=e.slice(o.paging.pageIndex*o._pageSize,(o.paging.pageIndex+1)*o._pageSize)}}o.rowHierarchy=r(s,new Array);let d=[];for(let e=0;e<o.rowHierarchy.length;e++){const t=o.rowHierarchy[e],a=t.canNotify;t.leaf&&d.push(t),t.canNotify=!1,t.visibleIndex=l++,t.canNotify=a}if(a&&(o.rowHierarchy=d),o._rowElements.length<o.rowHierarchy.length&&!o._toggledRow&&o._initializeRowElements(),o.grouping.summaryRow.visible&&!o.grouping.summaryRow.inline){const e=function(t,o,l,a){if(0!==t&&o.length>0&&o[o.length-1]&&!o[o.length-1].summaryRow){let e={label:" ",boundSource:[],groupDataField:l.data.groupDataField,$:{},summaryRow:!0,leaf:!0,level:t,expandHeight:0,siblings:o};e.$.id="SubRow"+a+"_"+l.data.$.id,l&&(e.parent=l.data,e.parentId=l.data.$.id),e.data=Object.assign(e),o.push(e)}for(let t=0;t<o.length;t++)o[t]&&o[t].data&&o[t].data.children&&e(o[t].level+1,o[t].data.children,o[t],t)};e(0,o.rowHierarchy,null,0)}}}applyContent(){}_refreshContentHeight(){const e=this;let t=e._clientSize.height;const o=window.scrollY;let l,a,n=!1;if((!e._contentHeight||e._maxHeight||e._autoHeight||e.__autoHeight||"hidden"===e.verticalScrollBarVisibility)&&(n=!0),n&&(l=e.offsetHeight,e.$.container.classList.add("smart-hidden"),a=e.offsetHeight,e.$.container.classList.remove("smart-hidden")),window.scrollY!==o&&window.scrollTo(window.scrollX,o),"hidden"===e.verticalScrollBarVisibility||l!==a||e._minHeight&&e._minHeight===l)return t=e._scrollHeight+e.$.columnHeader.offsetHeight+e.$.filterFooter.offsetHeight,e.header.visible&&(t+=e.$.header.offsetHeight),e.summaryRow.visible&&(t+=e.layout.rowMinHeight),0===e._recyclingRows.length&&0===e._scrollHeight&&(t+=e.$.scrollView.offsetTop),e.editing.addNewRow.visible&&1===e._recyclingRows.length&&(t+=e.$.scrollView.offsetTop),e._minHeight>t&&(t=e._minHeight),e.$.content.style.height=t+"px",e._contentHeight=t,void(e._maxHeight<t?(e._autoHeight=!1,e.$.content.classList.remove("auto-height"),e.$.content.style.height=e._maxHeight+"px",e.header.visible?(e.$.content.style.height=e._maxHeight-e.$.header.offsetHeight+"px",e._contentHeight=e._maxHeight-e.$.header.offsetHeight):e._contentHeight=e._maxHeight):(e._autoHeight=!0,e.__autoHeight=!0,e.$.content.classList.add("auto-height"),e.header.visible?(e._contentHeight=t-e.$.header.offsetHeight,e.$.content.style.height=e._contentHeight+"px"):e.summaryRow.visible&&(e.$.content.style.height=e._contentHeight+"px")));e.header.visible&&(t-=e.$.header.offsetHeight),(e.groupHeader.visible||e.grouping.groupBar.visible)&&(t-=e.$.groupHeader.offsetHeight),e.footer.visible&&(t-=e.$.footer.offsetHeight),e.pager.visible&&(t-=e.$.headerPager.offsetHeight,t-=e.$.footerPager.offsetHeight),e.editing.enabled&&e.editing.commandBar.visible&&(t-=e.$.headerCommandBar.offsetHeight,t-=e.$.footerCommandBar.offsetHeight),e.$.content.style.height!==t+"px"&&(e.$.content.style.height=t+"px"),e.$.viewContent.style.height!==t+"px"&&(e.$.viewContent.style.height=t+"px"),e._contentHeight=t}appendChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}removeChild(){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.removeChild.apply(this,e.concat(Array.prototype.slice.call(arguments)))}get _contentBorder(){const e=this;if(e.__contentBorder)return e.__contentBorder;const t=getComputedStyle(e.$.content),o={left:parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth),top:parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)};return e.__contentBorder=o,o}_refreshLayout(){const e=this,t=e.rows;if(e._layoutSuspended)return;e._visibleRows=null,e.__viewRows=null,e.__clientSize=null,e.__scrollHeight=null,e.__scrollWidth=null,e.__parentCells=null,e.$.columnFarContainer.classList.remove("vscroll"),e.$.columnNearContainer.classList.remove("vscroll"),e.$.scrollView.classList.remove("hscroll"),e.$.scrollView.classList.remove("vscroll"),e._refreshElementsVisibility(),e._refreshColumnHeights(),e._refreshContentHeight();const o=()=>{e.$.placeholder.classList.remove("smart-hidden"),e.$.placeholder.innerHTML=e.appearance.placeholder,e._filters&&e._filters.length&&(e.$.placeholder.innerHTML=e.localize("filteredRecords")),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight);let t=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;e.$.scrollView.style.height=t+"px",e.scrollWidth=0,e.scrollHeight=0,e.clearSelection(),e._showAddNewRowButton("float"),e.$.content.classList.contains("auto-height")&&(e.$.placeholder.style.height=t+"px")};if(t&&t.url)e._showAddNewRowButton("float");else{if(!t||null===t||0===t.length||0===e.columns.length)return o(),0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),void e._refreshScrollBars();e._showAddNewRowButton("float"),e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show")}0!==e.columns.length&&e.hasVisibleColumn()?e.editing.addNewColumn._addButton&&e.editing.addNewColumn._addButton.classList.remove("show"):(o(),0!==e.columns.length&&e.hasVisibleColumn()||(e._showAddNewColumnButton(),e.$.columnHeader.classList.add("smart-hidden"),e.__columnHeaderHeight=0),e._showAddNewColumnButton()),!e.__columnHeaderHeight&&e.$.columnHeader.offsetHeight&&(e.__columnHeaderHeight=e.$.columnHeader.offsetHeight),e.__filterFooterOffsetHeight||(e.__filterFooterOffsetHeight=e.$.filterFooter.classList.contains("smart-hidden")?0:e.$.filterFooter.offsetHeight);let l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight;if(e.$.scrollView.style.height=l+"px",e.htmlColumnLastChild.style.height=e.__columnHeaderHeight+"px",e.paging.spinner.enabled&&e.paging.enabled){if(!e.pageScroll){const t=document.createElement("smart-scroll-bar");t.orientation="vertical",t.style.height="100%",t.style.width="100%",t.max=Math.ceil(e.dataSource.length/e._pageSize),t.step=e.paging.spinner.step,t.largeStep=e.paging.spinner.step,t.setAttribute("spinner",""),t.setAttribute("smart-id","spinner"),t.ownerElement=e,e.addPropertyBinding("[[paging_spinner_step]]","step",t,e.$.columnHeader),t.addEventListener("change",(function(t){e.paging.pageIndex=t.detail.value})),e.pageScroll=t}e.htmlColumnLastChild.appendChild(e.pageScroll)}else e.htmlColumnLastChild.innerHTML="";e._refreshScrollBars()}_refreshScrollBars(){const e=this;if(!e._scrollView)return;const t=e._scrollView.vScrollBar,o=e._scrollView.hScrollBar,l=e._contentHeight-e.__filterFooterOffsetHeight-e.__columnHeaderHeight,a=e.$.scrollView.offsetWidth,n=e._scrollWidth-a-e._contentBorder.left,i=e._scrollHeight-l-e._contentBorder.top,r=e._columnNearContainerComputedStyle?e._columnNearContainerComputedStyle:getComputedStyle(e.$.columnNearContainer),s=e._columnFarContainerComputedStyle?e._columnFarContainerComputedStyle:getComputedStyle(e.$.columnFarContainer),d=parseInt(e.$.columnNearContainer.style.width)+parseInt(r.borderRightWidth),u=parseInt(e.$.columnFarContainer.style.width)+parseInt(s.borderLeftWidth);if(e.__frozenNearWidth=d,e.__frozenFarWidth=u,e._columnNearContainerComputedStyle=r,e._columnFarContainerComputedStyle=s,e._refreshHorizontalScrollBarVisibility(n),e._refreshVerticalScrollBarVisibility(i),t.style.height=l+"px",e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),e.__scrollWidth+=e.__scrollBarSize,e._refreshHorizontalScrollBarVisibility(e._scrollWidth-a-1),e.rightToLeft?e.$.columnNearContainer.classList.add("vscroll"):e.$.columnFarContainer.classList.add("vscroll"),e._refreshVerticalScrollBarVisibility(i),e.htmlColumnLastChild.classList.remove("smart-visibility-hidden")),o.style.width=a+"px",e.rightToLeft?o.style.right="0px":o.style.left="0px",e.computedVerticalScrollBarVisibility&&e.computedHorizontalScrollBarVisibility&&(o.style.width=a-t.offsetWidth+"px",t.style.height=l-o.offsetHeight+"px"),e.computedHorizontalScrollBarVisibility?(e.$.scrollView.classList.add("hscroll"),e._autoHeight?(e.$.content.style.height="auto",e.$.scrollView.style.height="auto",e.$.scrollView.style.paddingBottom=o.offsetHeight+"px",e.$.placeholder.style.marginTop=o.offsetHeight+"px",e.summaryRow.visible&&(e.$.scrollView.style.paddingBottom=o.offsetHeight+e.layout.rowMinHeight+"px")):(e.$.scrollView.style.paddingBottom="",e.$.placeholder.style.marginTop="")):e.$.scrollView.classList.remove("hscroll"),(e.__frozenNearHeight>0||e._frozenNearRows&&e._frozenNearRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowNearContainer),l=e.__frozenNearHeight+parseInt(o.borderBottomWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.top=l+"px",t.style.setProperty("--smart-scroll-bar-near-size",l+"px")}else e.appearance.showVerticalScrollBarOnFixedColumns&&(t.style.top="0px");if((e.__frozenFarHeight>0||e._frozenFarRows&&e._frozenFarRows.length>0)&&!e.appearance.showVerticalScrollBarOnFixedColumns){const o=getComputedStyle(e.$.rowFarContainer),l=-2+e.__frozenFarHeight+parseInt(o.borderTopWidth);t.style.height=parseInt(t.style.height)-l+"px",t.style.setProperty("--smart-scroll-bar-far-size",l+"px"),0===e.__frozenNearHeight&&(t.style.top="0px")}(d>0||u>0)&&!e.appearance.showHorizontalScrollBarOnFixedColumns&&(o.style.width=parseInt(o.style.width)-d-u+"px",e.rightToLeft?o.style.right=d+"px":o.style.left=d+"px",o.style.setProperty("--smart-scroll-bar-near-size",d+parseInt(r.borderRightWidth)+"px"),o.style.setProperty("--smart-scroll-bar-far-size",u+parseInt(r.borderLeftWidth)+"px"),e.computedVerticalScrollBarVisibility&&(e.__scrollBarSize||(e.__scrollBarSize=t.offsetWidth),o.style.setProperty("--smart-scroll-bar-far-size",u+e.__scrollBarSize+"px"))),t.refresh(),o.refresh()}_refreshHorizontalScrollBarVisibility(e){const t=this;t.scrollWidth=e,t.computedHorizontalScrollBarVisibility||(t.scrollLeft=0)}_refreshVerticalScrollBarVisibility(e){const t=this;if(t._autoHeight)return t.scrollTop=0,void(t.scrollHeight=0);t.computedHorizontalScrollBarVisibility&&(e+=t.$.horizontalScrollBar.offsetHeight),t.scrollHeight=e,t.paging.enabled&&t.paging.spinner.visible&&t.$.verticalScrollBarVisibility.classList.remove("smart-hidden"),t.computedVerticalScrollBarVisibility||(t.scrollTop=0)}_styleChangedHandler(e){const t=this;if(!e.detail.styleProperties.overflow&&!t.classList.contains("smart-grid-resize-mode")){if(e.detail.styleProperties["grid-template-columns"])return t._templateColumns(),void t.refresh();if(e.detail.styleProperties["font-size"])return t.layout.isDirty=!0,t._resetCachedLayout(),void t.refresh();(e.detail.styleProperties["--smart-grid-row-height"]||e.detail.styleProperties["--smart-font-size"]||e.detail.styleProperties["--smart-grid-column-header-height"]||e.detail.styleProperties["--smart-grid-group-header-height"]||e.detail.styleProperties["--smart-grid-filter-footer-height"]||e.detail.styleProperties["--smart-grid-group-row-vertical"]||e.detail.styleProperties["--smart-grid-group-row-horizontal-offset"]||e.detail.styleProperties["--smart-grid-freeze-splitter-size"]||e.detail.styleProperties["--smart-grid-resize-line-size"]||e.detail.styleProperties["--smart-grid-footer-height"]||e.detail.styleProperties["--smart-grid-header-height"])&&(t.layout.isDirty=!0),t.offsetWidth&&t.offsetHeight>0&&(t._resetCachedLayout(),t._refreshLayout(),t._recycle())}}_resetCachedLayout(){const e=this;delete e._columnHeights,e.__cellsCommandTemplate=null,e.__autoRowHeight=null,e.__autoHeightRows=null,e.__measuredColumnHeight=null,e.__columnHeaderHeight=null,e.__filterFooterOffsetHeight=null}_swipeLeftHandler(){}_swipeRightHandler(){}_getRowIndexByPosition(e){const t=this;return(o=>{let l=0,a=o.length-1;if(e<=0)return 0;const n=o[o.length-1];if(-1!==n.top&&n.top<=e)return o.length-1;for(;;){const n=Math.floor((l+a)/2),i=o[n];if(t._isRowInPosition(i,e))return n;i.top<e?l=n+1:i.top>e?a=n-1:l=n+1}})(t._recyclingRows)}_getVirtualRowIndexByPosition(e){let t=this.rows[0].height;const o=(e,o)=>0!==t&&e<=o&&e+t>o;return(l=>{let a=0,n=l.length-1;if(e<=0)return 0;const i=(l.length-1)*t;if(-1!==i&&i<=e)return l.length-1;for(;;){const l=Math.floor((a+n)/2),i=l*t;if(o(i,e))return l;i<e?a=l+1:i>e?n=l-1:a=l+1}})(this.dataSource)}getRows(){return this.getViewRows()}getViewRows(){const e=this;return e.rowHierarchy?e.rowHierarchy:e.getVisibleRows()}getColumns(){const e=this,t=[];if(e.columns)for(let o=0;o<e.columns.length;o++){const l=e.columns[o].getState();t.push(l)}return t}getState(){const e=this,t=e.getSortedColumns(),o=e.getFilteredColumns(),l=e.getGroups(),a=e.getSelectedCells(),n=e.getSelectedRows(),i=e.$.headerPager.querySelector("smart-pager");let r=0;return i&&(r=i.pagesCount),{sort:t,filter:o,groups:l,paging:{count:r,index:e.paging.pageIndex,size:e._pageSize},selectedCells:a,selectedRows:n}}get _pageSize(){const e=this;return e.dataSource&&e.grouping.enabled&&e.dataSource.groupBy.length>0?e.paging.pageHierarchySize:e.paging.pageSize}get _recyclingRows(){const e=this;if(e.rowHierarchy)return e.rowHierarchy;let t=e.getVisibleRows();if(e.paging.enabled)if(e.dataSource.virtualDataSource)t=t.slice(0,e._pageSize);else if(t=t.slice(e.paging.pageIndex*e._pageSize,(e.paging.pageIndex+1)*e._pageSize),e.editing.addNewRow&&e.editing.addNewRow.visible&&"button"!==e.editing.addNewRow.displayMode){let t=e.getVisibleRows();return t=0===e.paging.pageIndex&&"far"!==e.editing.addNewRow.position?t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):0===e.paging.pageIndex&&"far"===e.editing.addNewRow.position?t.slice(e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize):t.slice(1+e.paging.pageIndex*e._pageSize,1+(e.paging.pageIndex+1)*e._pageSize),[].concat(e._frozenNearDefaultRows,e._nearRowsAdded,t,e._farRowsAdded,e._frozenFarDefaultRows)}return t}_isRowInPosition(e,t){const o=e.top,l=e.top+e.height,a=o<=t&&l>t;return 0!==e.height&&a}_renderColumnGroupHeaders(){const e=this;for(let t=0;t<e._columnGroups.length;t++){const o=e._columnGroups[t];o.column.render(),o.column.allowReorder=!1,o.column.element.setAttribute("columnHeader",""),0===o.columns.length&&o.column.element.classList.add("smart-hidden"),0===t&&o.column.element.classList.add("smart-grid-column-border-collapse")}}hasVisibleColumn(){const e=this;for(let t=e.viewColumns.length-1;t>=0;t--){const o=e.viewColumns[t];if(o.visible&&!o.autoGenerated)return!0}return!1}_isLastVisibleColumn(e){const t=this;for(let o=t.viewColumns.length-1;o>=0;o--){const l=t.viewColumns[o];if(l.visible)return l===e}return!1}_recycle(e,t){const o=this;if(o._layoutSuspended||!1===o.isAttached)return;if(o._isUpdating)return;if(o.editing.isEditing&&(o.endEdit(),o._isUpdating))return;o._removeCellContentPopup(),o._inputOverlay&&(o._inputOverlay.parentNode&&o._inputOverlay.parentNode.removeChild(o._inputOverlay),o._inputOverlay=null),o._selection.selectionRect&&o._refreshCellSelectionRect();const l=o._scrollView.scrollTop;let a,n=o._getRowIndexByPosition(l),i=o._recyclingRows,r=i[n],s=r?r.top:0,d=0,u=0,c=0,m=0;for(let e=0;e<o._cellsMerge.length;e++){const t=o._cellsMerge[e],a=i.indexOf(t.row);if(n>a&&n<=a+t.rowSpan&&(n=a,r=t.row,c=Math.max(c,s-r.top),s=r.top,o.$.rowContainer.style.top=o.__frozenNearHeight-l+s+"px"),t.colSpan>1)for(let e=0;e<o.viewColumns.length;e++){const l=o.viewColumns[e];let a=l.autoGenerated?l:o.columnByDataField[l.dataField];if(a.visible&&a.left+a.computedWidth-o._scrollView.scrollLeft>=d&&a.left-a.computedWidth-o._scrollView.scrollLeft<o._clientSize.width){let e=o.columnByDataField[t.column.dataField];m=Math.max(m,a.left-e.left+a.computedWidth);break}}}let g=null;if(!1!==e||o._cellsMerge.length>0){for(let e=0;e<o._columnElements.length;e++){const t=o._columnElements[e];if(!t.parentNode)break;t.set("column",null,!1),t.classList.add("smart-visibility-hidden")}for(let e=0;e<o._columnGroups.length;e++){const t=o._columnGroups[e],l=t.element;o.rightToLeft?l.style.right=t.right+"px":l.style.left=t.left+"px",l.style.width=t.computedWidth+"px"}o._firstVisibleColumn=null,o._lastVisibleColumn=null;for(let e=0;e<o.viewColumns.length;e++){let t=o.viewColumns[e];if(t.visible&&(o._firstVisibleColumn||(o._firstVisibleColumn=t),o._lastVisibleColumn=t),t.element&&(t===o._firstVisibleColumn||t.rowDetailColumn?t.element.classList.add("smart-grid-column-border-collapse"):t.element.classList.remove("smart-grid-column-border-collapse"),t.element.removeAttribute("aria-colindex")),t.freeze){if(!0!==t.freeze&&"near"!==t.freeze||t.visible&&(d+=t.computedWidth),!t.element)continue;t.visible?(t.element.classList.remove("smart-visibility-hidden"),t.render()):t.element.classList.add("smart-visibility-hidden")}else if(t.visible&&t.left+t.computedWidth-o._scrollView.scrollLeft>=d-m&&t.left-t.computedWidth-o._scrollView.scrollLeft<o._clientSize.width){const l=o._columnElements[u++];l.set("column",t,!1),l.parentNode||o.$.columnContainer.appendChild(l),g||(g=t,o._firstRenderedColumn=t),t.element=l,t.render(),l.setAttribute("aria-colindex",e+1),void 0===a&&(a=t.left)}}}if(void 0===a&&(a=0),o.rightToLeft){const e=o._scrollView.scrollWidth-o._scrollView.scrollLeft-o._scrollView.vScrollBar.offsetWidth;o.$.columnContainer.style.right=e+"px",e<=0&&!o._scrollView.scrollWidth&&(o.$.columnContainer.style.right=-o.offsetWidth+o._computedColumnsWidth+"px")}else o.$.columnContainer.style.left=-o._scrollView.scrollLeft+"px";if(o.$.rowContainer.style.top=o.__frozenNearHeight-l+s+"px",o.isScrolling&&!o.isHScrolling&&(o._scrollUpdate&&clearTimeout(o._scrollUpdate),o._scrollUpdate=setTimeout((function(){o.isScrolling||(o.$.rowContainer.style.top=parseInt(o.$.rowContainer.style.top)+.01+"px")}),50)),!1===t)return;if(!o._rowElements)return;const p=o.dataSource&&o.dataSource.virtualDataSource&&!o.dataSource.virtualDataSourceOnExpand&&o.dataSource.length>o.virtualModeCachedRowsCount&&"infinite"!==o.scrolling;if(n>=0){u=0;let e=Math.max(o._clientSize.height,o._overflowOffset),t=0;p&&(o.rowById=[],o.rows&&o.rows.length>0&&void 0===o.rows[o.rows.length-1].top&&(o.rows[o.rows.length-1].top=(o.rows.length-1)*o.rows[0].height),o.rows&&o.rows.length>0&&(t=o._getVirtualRowIndexByPosition(l),s=t*o.rows[0].height,o.$.rowContainer.style.top=o.__frozenNearHeight-l+s+"px",o.paging.enabled||(n=0)),o.paging.enabled&&(t=o.paging.pageIndex*o._pageSize));for(let a=n;a<i.length;a++){const r=i[a];if(0===r.height||!r.visible||!1===r.filtered||r.freeze&&r.visible)continue;const d=r.height;if(r.expandHeight&&(e+=o.offsetHeight+r.expandHeight),!(s+d>=l-c&&s<=l+e||o._autoHeight))break;{const e=o._rowElements[u++];if(!e)break;e.setAttribute("aria-rowindex",t+a+1),r.element=e,r.grid=o,p&&(r.index=a+t,r.visibleIndex=a+t,o.paging.enabled?(r.data=o.dataSource[n+u-1],r.data&&(r.id=r.data.$.id,o.rowById[r.id]=r)):(r.data=o.dataSource[u-1],r.data&&(r.id=r.data.$.id,o.rowById[r.id]=r))),r.render()}s+=d}}o._renderFrozenRows();let h=u;if(u<o._rowElements.length)for(let e=u;e<o._rowElements.length;e++){const e=o._rowElements[u++];e.classList.add("smart-hidden"),e.removeAttribute("aria-rowindex")}o.editing.addNewRow&&"button"===o.editing.addNewRow.displayMode&&o._rowElements[h]&&(o._newRow||(o._newRow=new Smart.Grid.Row({data:{},index:9999999,grid:o,addNewRow:!0,inline:!0,autoGenerated:!0})),o._newRow.element=o._rowElements[h],o._newRow.element.classList.remove("smart-hidden"),o._newRow.render()),p&&o._selection.selectionRect&&o._refreshCellSelectionRect()}_renderFrozenRows(){const e=this;let t=!1,o=!1;0===e._frozenNearRows.length?e.$.rowNearContainer.classList.add("smart-hidden"):e.$.rowNearContainer.classList.remove("smart-hidden");for(let o=0;o<e._frozenNearRows.length;o++){const l=e._frozenNearRows[o];l.visible||(l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.element.classList.add("smart-hidden")),l.visible&&l.filtered&&(t=!0,l.element=e.$.rowNearContainer.children[o],l.element||(l.element=l.createElement(),e.$.rowNearContainer.appendChild(l.element)),l.render())}t||e.$.rowNearContainer.classList.add("smart-hidden"),0===e._frozenFarRows.length?e.$.rowFarContainer.classList.add("smart-hidden"):e.$.rowFarContainer.classList.remove("smart-hidden");for(let t=0;t<e._frozenFarRows.length;t++){const l=e._frozenFarRows[t];l.visible&&(o=!0),l.element=e.$.rowFarContainer.children[t],l.element||(l.element=l.createElement(),e.$.rowFarContainer.appendChild(l.element)),l.render()}o||e.$.rowFarContainer.classList.add("smart-hidden"),0!==e.columns.length&&e.hasVisibleColumn()||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"));const l=e.rows;l&&null!==l&&0!==l.length||(e.$.rowNearContainer.classList.add("smart-hidden"),e.$.rowFarContainer.classList.add("smart-hidden"))}_recycleRotate(e,t,o,l,a){const n=t.getBoundingClientRect(),i=e.getBoundingClientRect();let r=0,s=0;return 0===i.width?(e.innerHTML=a,!1):(n.left>i.left&&(r=i.left-n.left),n.top<i.top&&(s=i.top-n.top),"left"!==o&&""!==o||(r=4),"center"===o&&(r+=i.width/2-n.width/2),"right"===o&&(r+=i.width-n.width-4),"top"!==l&&""!==l||(s=4),"center"!==l&&"middle"!==l||(s+=i.height/2-n.height/2),"bottom"===l&&(s+=i.height-n.height-4),t.style.left=r+"px",t.style.top=s+"px",!0)}_virtualDataRequest(e,t){const o=this;let l=-1,a=-1;if(!o._rowElements&&"infinite"!==o.scrolling)return;if("virtual"===o.scrolling){for(let e=0;e<o._rowElements.length;e++){const t=o._rowElements[e],n=t.row,i=0===e?n.visibleIndex:l+e;t.classList.contains("smart-hidden")||(-1===l&&(l=i),-1!==i&&(a=1+i))}0===o._rowElements.length&&(l=0,a=Math.max(20,parseInt(o.offsetHeight/o.layout.rowMinHeight*1.5)))}else"infinite"===o.scrolling?(l=1/0,a=1/0):(l=0,a=o.dataSource.length);a!==1/0&&(o.dataSource.virtualDataSourceLength||o.dataSource.length)&&(a=Math.min(a,o.dataSource.length)),o.paging.enabled&&(l=o.paging.pageIndex*o._pageSize,a=l+o._pageSize),o.appearance.displayLoadingIndicator=!0,o._setLoadingIndicatorVisibility(),o._groups||(o._groups=[].concat(o.dataSource.groupBy.toArray())||[]);const n={first:l,last:a,edit:o._editInfo,sorting:o.getSortedColumns(),filtering:o.getFilteredColumns(),grouping:o._groups,row:o._toggledRow?o._toggledRow.data:null,action:e},i=o.dataSource.length,r=o.dataSource.boundSource.length;void 0===o._isFirstVirtualDataSourceRequest&&(o._isFirstVirtualDataSourceRequest=!0),o.dataSource.onVirtualDataSourceRequested((function(e){if(o.appearance.displayLoadingIndicator=!1,o._setLoadingIndicatorVisibility(),o._toggledRow=null,!e)return o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),void(o._autoHeight&&o._initializeRowElements());if("add"===e.action)return void(t&&t(e.result));if("update"===e.action)return void(t&&t(e.result));if("remove"===e.action)return void(t&&t(e.result));const l=o.context;if(o.context=o,o._isFirstVirtualDataSourceRequest&&0===o._initColumns.length&&(o.columns.canNotify=!1,o.columns=[],o._renderColumns(),o.columns.canNotify=!0),"expand"===e.action)o.refresh();else if("scroll"===e.action)if("infinite"===o.scrolling)o._recycle(!1,!1);else{const t=e.first>=0?e.first:0,l=e.last!==1/0?e.last:0;let a=0;for(let e=t;e<l;e++)o.rows[e]&&(o.rows[e].data=o.dataSource[a++]);o._recycle(!1,!1)}else o.dataSource.length!==i||o.dataSource.boundSource.length!==r||o._isFirstVirtualDataSourceRequest||"expand"===e.action||"filter"===e.action||"sort"===e.action||"pageIndexChange"===e.action||"pageSizeChange"===e.action||"sort"===e.action||"group"===e.action?(o.paging.enabled&&o.$.headerPager.querySelector("smart-pager")&&(o.$.headerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize),o.$.footerPager.querySelector("smart-pager").pagesCount=Math.ceil(o.dataSource.length/o._pageSize)),o._initializeRows(),o._initializeRowElements(),o.refresh(),o._refreshPagesCount(),o._autoHeight&&o._initializeRowElements()):o.dataSource.virtualDataSourceOnExpand&&o.refresh();o._isFirstVirtualDataSourceRequest=!1,o._recycle(),o.context=l,o._onDataUpdated&&o._onDataUpdated()}),n)}_createAddNewRowButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-row-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewRow"),e._addNewGridRow=t.onclick=()=>{e._addRowTimer&&clearTimeout(e._addRowTimer),e._addRowTimer=setTimeout((()=>{if(e.dataSource&&e.dataSource.virtualDataSource)return void e._insertNewRowAfter();const t={};for(let o=0;o<e.columns.length;o++){const l=e.columns[o];void 0!==l.defaultValue&&(t[l.dataField]=l.defaultValue)}e._addingNewRow=!0,e._add(t),e._scrollView.vScrollBar.value=e._scrollView.vScrollBar.max,e.closeMenu(),e._addingNewRow=!1}),100)},t}addNewColumn(e){e&&this.columns.push(e)}_createAddNewColumnButton(){const e=this,t=document.createElement("div");return t.className="smart-grid-add-column-button smart-grid-icon smart-icon-plus",t.title=e.localize("addNewColumn"),t.onclick=()=>{e._openAddColumnDialog(),e.addEventListener("closeColumnDialog",(()=>{e.layout.isDirty=!0,e._resetCachedLayout(),e._refreshLayout()}))},t}_showAddNewRowButton(e){const t=this;if(!t.columns.length)return;if("grid"!==t.view&&t.editing.addNewRow._addButton)return t.editing.addNewRow._addButton.remove(),void delete t.editing.addNewRow._addButton;if("float"===e&&t.computedVerticalScrollBarVisibility&&t.editing.addNewRow._addButton&&!t.editing.addNewRow._addButton.classList.contains("show"))return;if("float"===e&&t._addingNewRow)return;const o=()=>{"float"!==e&&(t.appearance.showRowHeader||t.appearance.showRowHeaderNumber)?t.editing.addNewRow._addButton.classList.remove("float"):t.computedVerticalScrollBarVisibility?t.computedVerticalScrollBarVisibility&&"float"===e&&t.editing.addNewRow._addButton.classList.add("float"):t.editing.addNewRow._addButton.classList.add("float"),t.computedHorizontalScrollBarVisibility?t.editing.addNewRow._addButton.style.bottom="20px":t.editing.addNewRow._addButton.style.bottom=""};t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&(t.editing.addNewRow._addButton||(t.editing.addNewRow._addButton=t._createAddNewRowButton(),t.appendChild(t.editing.addNewRow._addButton)),requestAnimationFrame((()=>{t.editing.addNewRow._addButton.classList.add("show"),o()})))}_showAddNewColumnButton(){const e=this,t=()=>{e.editing.addNewColumn._addButton.classList.add("float")};e.editing.addNewColumn.visible&&(e.editing.addNewColumn._addButton||(e.editing.addNewColumn._addButton=e._createAddNewColumnButton(),e.appendChild(e.editing.addNewColumn._addButton)),requestAnimationFrame((()=>{e.editing.addNewColumn._addButton.classList.add("show"),t()})))}_verticalScrollbarHandler(e){const t=this;t.menu&&t.menu.column&&t.closeMenu(),t.isScrolling=!0,t._scrollTimer&&clearTimeout(t._scrollTimer),t._layoutSuspended||(t._scrollTimer=setTimeout((()=>{if(t._recycle(!1),t.isScrolling=!1,e.max===e.value&&e.max>0){if(t.$.fireEvent("scrollBottomReached"),"infinite"===t.scrolling)return t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),void(t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50));t.editing.addNewRow._addButton&&t.editing.addNewRow._addButton.classList.remove("show")}else t.editing.addNewRow.visible&&"button"===t.editing.addNewRow.displayMode&&t.editing.addNewRow._addButton&&e.max>0&&(t.editing.addNewRow._addButton.classList.add("show"),t.editing.addNewRow._addButton.classList.remove("scroll"),t.editing.addNewRow._addButton.classList.add("float"));"virtual"===t.scrolling&&(t.appearance.displayLoadingIndicator=!0,t._setLoadingIndicatorVisibility(),t._virtualScrollTimer&&clearTimeout(t._virtualScrollTimer),t._virtualScrollTimer=setTimeout((()=>{t._virtualDataRequest("scroll"),t.appearance.displayLoadingIndicator=!1,t._setLoadingIndicatorVisibility()}),50)),e.min===e.value&&t.$.fireEvent("scrollTopReached")})))}getVerticalScrollMax(){return this.scrollHeight}getHorizontalScrollMax(){return this.scrollWidth}getHorizontalScrollValue(){return this.scrollLeft}setHorizontalScrollValue(e){this.scrollLeft=e}getVerticalScrollValue(){return this.scrollTop}setVerticalScrollValue(e){this.scrollTop=e}clearRows(){const e=this;e.dataSource=new Smart.DataAdapter({dataSource:[]}),e.rowHierarchy=null,e._visibleRows=null,e.__viewRows=null,e.rows.canNotify=!1,e.rows.length=0,e.rows.canNotify=!0,e.clearSelection(),e._refresh()}isEmpty(){const e=this;return!!(null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)}setRowStyle(e,t){const o=this,l=o.rowById[e];l&&(l.style=t,o._recycle(!1,!0))}setCellStyle(e,t,o){const l=this,a=l.rowById[e];if(a){const e=a.getCell(t);if(e){const t=e.canNotify;e.canNotify=!1,o?o.forEach((t=>{void 0!==e[t]&&(e[t]=o[t])})):(e.background=null,e.color=null,e.fontSize=null,e.fontFamily=null,e.fontWeight=null,e.textDecoration=null,e.fontStyle=null),e.canNotify=t,l._recycle(!1,!0)}}}dataBind(){const e=this;if(delete e.__autoRowHeight,e._virtualOnExpandCache=[],e._cellsMerge=[],e._cellStyles=[],null===e.dataSource||e.dataSource&&e.dataSource.dataFields&&0===e.dataSource.length&&0===e.dataSource.dataSource.length&&!e.dataSource.virtualDataSource)e.clearRows();else if(Array.isArray(e.dataSource))if(e.columns&&e.columns.length){let t=[];for(let o=0;o<e.columns.length;o++){const l=e.columns[o];t.push({name:l.dataField,dataType:l.dataType||"string"})}e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource,dataFields:t})}else e.dataSource=new Smart.DataAdapter({dataSource:e.dataSource});const t=e._filters,o=e._sortedColumns;if(e.clearSort(),e.filtering.filterRow)for(let t=0;t<e.columns.length;t++)e.columns[t]._filterEditorInitialized=!1;for(let t=0;t<e.columns.length;t++)delete e.columns[t]._cellsCachedValues;e._initColumns&&0===e._initColumns.length&&(e.columns=[],e._renderColumns(!0)),e._renderRows(),"virtual"===e.scrolling||e.paging.enabled&&e.dataSource&&e.dataSource.virtualDataSource||e.dataSource&&e.dataSource.virtualDataSource?e._virtualDataRequest("dataBind"):e.paging.enabled&&(!e.dataSource||e.dataSource&&!e.dataSource.url)&&e._refreshPagesCount(),o&&e._refreshSort(o),t&&t.length>0&&(e._filters=null,e.refreshFilters())}refresh(e){const t=this;t.isInitialized&&(e&&(t._initializeRows(),t._initializeRowElements()),t._refresh(),t._refreshSummary())}refreshView(){this._recycle()}beginUpdate(){const e=this;e._isUpdating||(e._isUpdating=0),e._isUpdating++}endUpdate(e,t){const o=this;o._isUpdating--,o._isUpdating<0&&(o._isUpdating=0),!1!==e?o.refresh():!1!==t&&o.refreshView()}}),Smart.Grid.Extend=function(e){if(!e)return;const t=Object.getOwnPropertyNames(e.prototype);for(let o in t){const l=t[o];"constructor"!==l&&(Smart.Grid.prototype[l]=e.prototype[l])}},Smart.Grid.Extend(Smart.Utilities.Grid.Resize),Smart.Grid.Extend(Smart.Utilities.Grid.Reorder),Smart.Grid.Extend(Smart.Utilities.Grid.Pager),Smart.Grid.Extend(Smart.Utilities.Grid.Filter),Smart.Grid.Extend(Smart.Utilities.Grid.Sort),Smart.Grid.Extend(Smart.Utilities.Grid.Menu),Smart.Grid.Extend(Smart.Utilities.Grid.Select),Smart.Grid.Extend(Smart.Utilities.Grid.Edit),Smart.Grid.Extend(Smart.Utilities.Grid.Dialog),Smart.Grid.Extend(Smart.Utilities.Grid.Group),Smart.Grid.Extend(Smart.Utilities.Grid.Tree),Smart.Grid.Extend(Smart.Utilities.Grid.Export),Smart.Grid.Extend(Smart.Utilities.Grid.Chart),Smart.Grid.Extend(Smart.Utilities.Grid.View),Smart.Grid.Cell=Smart.Utilities.Grid.Cell,Smart.Grid.Row=Smart.Utilities.Grid.Row,Smart.Grid.Column=Smart.Utilities.Grid.Column;
1438
1438
 
1439
1439
  /***/ }),
1440
1440
 
1441
1441
  /***/ 5110:
1442
1442
  /***/ (() => {
1443
1443
 
1444
- Smart.Utilities.Assign("Grid.Dialog",class{_openImagePreviewDialog(e){const t=this,l=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 a=t._dialogImagePreview.querySelector(".images-container");a.innerHTML="";const i=(e,l)=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const a=150+Math.min(850,e.width),i=150+Math.min(650,e.height);t._dialogImagePreview.style.width=a+"px",t._dialogImagePreview.style.height=i+"px",!1!==l&&(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 o=getComputedStyle(t._dialogImagePreview),n=parseInt(o.top),d=parseInt(o.left);(window.offsetWidth<a||window.offsetHeight<i||n<0||d<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%"},o=()=>{const e=t._dialogImagePreview.querySelector(".images-container");let l=-1;return e.querySelectorAll("img").forEach(((e,t)=>{if(e.hasAttribute("active"))return l=t,!0})),l},n=e=>{const l=t._dialogImagePreview.querySelector(".images-container");e&&l.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",""),d.innerHTML=`<img src="${t.src}"/>`;const e=d.querySelector("img");e.onload=()=>{i(e,!1)}}}))};if(l.length>1)for(let t=0;t<l.length;t++){const i=l[t].cloneNode();i.style.width="40px",i.style.height="40px",i.style.cursor="pointer",i.style.borderStyle="solid",i.style.borderWidth="1px",i.style.borderColor="transparent",i.style.borderRadius="var(--smart-border)",i.style.marginTop="10px",i.title=l[t].title||l[t].parentNode.title,l[t].src===e.src&&(i.style.borderColor="var(--smart-primary)",i.setAttribute("active","")),a.appendChild(i),i.onmouseenter=()=>{i.style.borderColor="var(--smart-primary)"},i.onmouseleave=()=>{i.hasAttribute("active")||(i.style.borderColor="transparent")},i.onclick=()=>{n(i)}}const d=t._dialogImagePreview.content.querySelector(".image-preview");d.innerHTML="",d.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=()=>{i(e)},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){if("Escape"===e.key&&t._dialogImagePreview.close(),"ArrowUp"===e.key||"ArrowLeft"===e.key){const t=o();n(l[t-1]),e.stopPropagation(),e.preventDefault()}else if("ArrowDown"===e.key||"ArrowRight"===e.key){const t=o();n(l[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 l=this,a=l._dialogImage||l._createDialog(),i='<span class="smart-grid-icon smart-icon-image show"></span>'+l.localize("dialogImageHeader");if(a.cell||(a.cell=e),a.header.innerHTML=i,a.column=e.column,a.command=t,a.classList.add("smart-grid-image-dialog"),!l._dialogImage){a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),a.onOpen=function(){a.fileUpload.value="",a.input.value="";let e=a.cell.editor.instance.getValue();if("[]"!==e)if(e&&"string"==typeof e&&e.indexOf("http")>=0)a.input.value=JSON.parse(e)[0].value,a.tabs[1].click(),o("input");else{a.tabs[0].click();const t=(e,t)=>{let l=e.split(","),a=l[0].match(/:(.*?);/)[1],i=atob(l[1]),o=i.length,n=new Uint8Array(o);for(;o--;)n[o]=i.charCodeAt(o);return new File([n],t,{type:a})},l=new DataTransfer;"string"==typeof e&&e.indexOf("base64")>=0&&(e=JSON.parse(e)),Array.isArray(e)&&(e.forEach((e=>{l.items.add(t(e.value,e.label))})),a.fileUpload.files=l.files,o())}else a.tabs[0].click()},a.onClose=function(){},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){if(a.tabs[1].classList.contains("active"))a.input.value?e.editor.instance.setValue([{label:a.input.value,value:a.input.value}]):e.editor.instance.setValue([]),l._endCellEdit(a.cell);else{const t=(e,t)=>{var l=new FileReader;l.readAsDataURL(e),l.onload=function(){t(l.result)},l.onerror=function(){t("error")}},i=[];if(a.fileUpload.files.length)for(let o=0;o<a.fileUpload.files.length;o++){const n=a.fileUpload.files[o];t(n,(t=>{"error"===t&&console.log("Image load error"),i.push({value:t,label:n.name}),i.length===a.fileUpload.files.length&&(e.editor.instance.setValue(i),l._endCellEdit(a.cell))}))}else e.editor.instance.setValue([]),l._endCellEdit(a.cell)}a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},l._dialogImage=a,a.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>${l.localize("dialogImageDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${l.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>${l.localize("dialogImageUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${l.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 ${l.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">${l.localize("dialogImageURLUpload")}</smart-button>\n </div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,a.input=a.querySelector("smart-input"),a.dropZone=a.querySelector(".smart-grid-drop-zone"),a.upload=a.querySelector(".title"),a.fileUpload=a.querySelector("input"),a.preview=a.querySelector(".preview"),a.tabs=a.querySelectorAll(".tab"),a.urlZone=a.querySelector(".url-zone"),a.uploadButton=a.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"],i=e=>t.includes(e.type);a.dropZone.ondrop=a.dropZone.dropHere=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;const l=a.column.editor.maxImages||5;for(let l=0;l<e.dataTransfer.items.length;l++)if("file"===e.dataTransfer.items[l].kind){const a=e.dataTransfer.items[l].getAsFile();i(a)&&t++}if(t===e.dataTransfer.files.length||t===l){const t=new DataTransfer;let i=[...e.dataTransfer.files],n=[...a.fileUpload.files];i.length>l&&(i=i.slice(0,5)),n.length>l&&(n=n.slice(0,5)),n.forEach(((e,a)=>{a<l&&t.items.add(e)})),i.forEach(((e,a)=>{a<l&&t.items.add(e)})),a.fileUpload.files=t.files,o()}}else a.fileUpload.files=e.dataTransfer.files,o()},a.dropZone.ondragover=e=>{e.preventDefault()},a.tabs[0].onclick=()=>{a.tabs[0].classList.add("active"),a.tabs[1].classList.remove("active"),a.dropZone.classList.remove("smart-hidden"),a.urlZone.classList.add("smart-hidden"),a.updatePreview()},a.tabs[1].onclick=()=>{a.tabs[0].classList.remove("active"),a.tabs[1].classList.add("active"),a.dropZone.classList.add("smart-hidden"),a.urlZone.classList.remove("smart-hidden"),a.updatePreview("input")},a.uploadButton.onclick=()=>{a.updatePreview("input")};const o=e=>{const t=a.preview,n=a.fileUpload;function d(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 r=()=>{const e=document.createElement("div");return e.classList.add("item"),e.onpointerdown=t=>{const i=e.getBoundingClientRect();if(a.input.value="",t.clientY>=i.bottom-12){if(t.clientX>i.left+i.width/2-13&&t.clientX<i.left+i.width/2+13){e.remove();const t=a.preview.querySelectorAll(".item"),l=new DataTransfer;t.forEach((e=>{l.items.add(e.file)})),n.files=l.files,a.clearButton&&0===t.length&&a.clearButton.classList.remove("show")}}else l._openImagePreviewDialog(e.querySelector("img"))},e},s=()=>{const e=document.createElement("div");e.classList.add("list");const i=document.createElement("div");i.classList.add("smart-grid-icon","show","smart-icon-delete"),i.title=l.localize("clear"),t.appendChild(i),i.onclick=()=>{n.value="",a.input.value="",o()},a.clearButton=i,t.appendChild(e)};if("input"===e){const e=a.input.value;if(e){const t=r();if(s(),e.endsWith("png")||e.endsWith("jpeg")||e.endsWith("jpg")){const l=document.createElement("img");l.src=e,t.appendChild(l)}a.preview.lastChild.appendChild(t)}else{const e=document.createElement("p");e.textContent=l.localize("dialogImageFileUpload"),t.appendChild(e)}}else{const e=n.files;if(0===e.length){const e=document.createElement("p");e.textContent=l.localize("dialogImageFileUpload"),t.appendChild(e)}else{s();const o=new DataTransfer,c=a.column.editor.maxImages||5,m=a.column.editor.maxImageSize||524288;let u=0,p=[];for(const n of e){const e=r();if(u>=c){p.push(n.name);continue}const s=document.createElement("div");if(i(n)){s.textContent=`${n.name}, ${d(n.size)}.`,s.textContent.length>20&&(s.textContent=`${n.name.substring(0,5)}...${n.name.substring(n.name.length-4)}, ${d(n.size)}.`);const a=document.createElement("img");if(a.src=URL.createObjectURL(n),n.size>m){const e=document.createElement("p");e.textContent=l.localize("dialogImageSize",{value:n.name,fileSize:d(m)}),t.appendChild(e);continue}o.items.add(n),e.file=n,e.title=s.textContent,e.appendChild(a),e.appendChild(s)}a.preview.querySelector(".list").appendChild(e),u++}if(p.length>0){const e=document.createElement("p");e.textContent=l.localize("dialogImageCount",{files:p.toString(),fileCount:c}),t.appendChild(e)}n.files=o.files}}};a.updatePreview=o,a.fileUpload.onchange=()=>{if(0===a.fileUpload.files.length&&a._tempFiles)a.fileUpload.files=a._tempFiles;else if(a._tempFiles){const e=new DataTransfer,t=[...a.fileUpload.files];[...a._tempFiles].forEach((t=>{e.items.add(t)})),t.forEach((t=>{e.items.add(t)})),a.fileUpload.files=e.files}o()},a.input.onchange=a.input.onblur=a.input.onkeyup=()=>{a.uploadButton.disabled=!a.input.value||!a.input.value.startsWith("https://")},a.upload.onclick=()=>{a._tempFiles=[];const e=new DataTransfer;[...a.fileUpload.files].forEach((t=>{e.items.add(t)})),a._tempFiles=e.files,a.fileUpload.click()}}a.open(),setTimeout((function(){a.btnConfirm.focus()}),100)}_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}_createDialog(e){const t=this;let l=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(l.modal=e.modal),void 0!==e.screenModal&&(l.screenModal=e.screenModal),l.setAttribute("animation","none"),l.classList.add("smart-window","smart-grid-dialog"),l.style.width="auto"===e.width?e.width:e.width+"px",l.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(l.style.width=e.width),e.height&&"string"==typeof e.height&&(l.style.height=e.height),l.style.left="",l.style.top="",l.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 ',l.querySelector&&l.querySelector(".smart-content")&&(l.content=l.querySelector(".smart-content").firstChild),l.footer=l.querySelector(".smart-footer"),l.header=l.querySelector(".smart-header"),l.btnConfirm=l.querySelector(".smart-confirm-button"),l.btnCancel=l.querySelector(".smart-cancel-button"),l.btnClose=l.querySelector(".smart-close-button"),l.btnNext=l.querySelector(".smart-next-button"),l.btnPrev=l.querySelector(".smart-prev-button");const a=document.createElement("div");return a.classList.add("smart-grid-dialog-overlay"),a.onclick=function(){},l.overlay=a,l.remove=function(){l.parentNode&&l.parentNode.removeChild(l)},l.close=function(){l.classList.remove("open"),delete t._resizeHandling,l.addEventListener("transitionend",l.remove),l.addEventListener("transitioncancel",l.remove),l.modal&&l.overlay.parentNode&&l.overlay.parentNode.removeChild(l.overlay),l.onClose&&l.onClose()},l.open=function(a,i){l.removeEventListener("transitionend",l.remove),l.removeEventListener("transitioncancel",l.remove),document.body.appendChild(l),t._resizeHandling=!1,void 0===a&&(a=e.left),void 0===i&&(i=e.top),requestAnimationFrame((function(){l.classList.add("open");const e=l.querySelector('[bind="name"]');if(e){const t=e.querySelector("smart-input");t&&t.focus()}const o=function(e,a){const i=t.offset(t);switch("center"===e&&"horizontal"===a&&(e="middle"),e){case"top":return i.top;case"bottom":return Math.max(i.top,i.top+t.offsetHeight-l.offsetHeight);case"center":return Math.max(i.top,i.top+t.offsetHeight/2-l.offsetHeight/2);case"left":return i.left;case"middle":return i.left+t.offsetWidth/2-l.offsetWidth/2;case"right":return i.left+t.offsetWidth-l.offsetWidth}return"horizontal"===a?parseInt(e)+i.left:"vertical"===a?parseInt(e)+i.top:"number"==typeof e?e:parseInt(e)};l.style.left=o(a,"horizontal")+"px",l.style.top=o(i,"vertical")+"px",l.setPosition=(e,t)=>{t?l.style.left=o(e,"horizontal")+"px":l.style.top=o(e,"vertical")+"px"},"screenMiddle"===a&&(l.style.left="calc(50% - "+l.offsetWidth/2+"px)"),"screenCenter"===i&&(l.style.top="calc(50% - "+l.offsetHeight/2+"px)")})),l.modal&&(l.screenModal?document.body.appendChild(l.overlay):t.appendChild(l.overlay)),l.onOpen&&l.onOpen()},l}_openAddRowDialog(e,t){const l=this;if(!l.editing.addDialog.enabled)return!1;const a=l._dialogAddRow||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogAddHeader"):l.editing.dialog.header,o=a.content;a.header.innerHTML=i,e.grid=l,void 0===e.index&&(e.index=l.rows.length,l._rowsAdded&&(e.index+=l._rowsAdded.length));const n=e.cells;let d=null,r=0;if(l._cellEditors||(l._cellEditors=[]),!l._dialogAddRow){a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogAddButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogAddButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0},a.onClose=function(){l.editing.dialog.visible=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e={};for(let t=0;t<n.length;t++){const a=n[t],i=l._getEditorValue(a),o=l._getEditorId(a),d=l._cellEditors[o];d&&(i&&i.error?(e[a.column.dataField]=i.value,d.detach()):(e[a.column.dataField]=i,d.detach()))}const i=l._rowsAdded?l._rowsAdded.length:0,o=new Smart.Grid.Row({index:l.rows.length+i,id:Smart.Utilities.Core.createGUID(),grid:l,data:e});a.close(),t(o,0===a.index)},a.onkeydown=function(e){const t=e.key;"Enter"===t?a.btnConfirm.onclick():"Escape"===t&&a.close()},o.classList.add("smart-grid-layout");for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(!t.allowEdit)continue;r%2==0&&(d=document.createElement("div"),d.classList.add("smart-grid-edit-dialog-row"),o.appendChild(d));const a=document.createElement("div");a.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const n=document.createElement("label");n.innerHTML=l.columns[e].label;const s=document.createElement("div");s.classList.add("smart-grid-dialog-editor"),s.setAttribute("editor",t.dataField),s.setAttribute("template",t.editor.template),a.appendChild(i),d.appendChild(a),i.appendChild(n),i.appendChild(s),r++}}a.open(),a.index=e.index;let s=0;for(let e=0;e<n.length;e++){const t=n[e],i=t.column,o=i.dataField,d=a.querySelector("[editor="+o+"]");if(!d)continue;d.innerHTML="";let r="";void 0!==t.value&&(r=t.value),"int64"!==i.dataType&&"number"!==i.dataType&&"int"!==i.dataType&&"float"!==i.dataType||(r=0),"date"===i.dataType&&(r=new Date),"bool"!==i.dataType&&"boolean"!==i.dataType||(r=!1);let c=null;switch(t.editor.template){default:case"custom":c=l._getCustomCellEditor(t);break;case"image":c=l._getImageCellEditor(t);break;case"checkBox":c=l._getCheckBoxCellEditor(t);break;case"autoComplete":c=l._getAutoCompleteCellEditor(t);break;case"dropDownList":c=l._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=l._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=l._getMaskCellEditor(t);break;case"checkInput":c=l._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=l._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=l._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=l._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=l._getDateInputCellEditor(t);break;case"dateRangeInput":c=l._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=l._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=l._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?l._getNumberInputCellEditor(t):l._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(r),0===s&&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 l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)l[t]=e[t]}));else if(e){const l=e,a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in l)a[e]=l[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 l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)l[t]=e[t]}));else if(e){const l=e,a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in l)a[e]=l[e]}}d.appendChild(c.element),c.element.onfocus=()=>{d.setAttribute("focus","")},c.element.onblur=()=>{d.removeAttribute("focus")},s++}l._dialogAddRow=a}_openEditDialog(e,t){const l=this;if(!l.editing.dialog.enabled)return!1;const a=l._dialogEdit||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogEditHeader",{value:l.editing.editRow?e.row.visibleIndex+1:e.column.label}):l.editing.dialog.header,o=a.content;a.header.innerHTML=i,a.row=l.editing.editRow,l.editing.recordNavigation&&a.classList.add("disable-animation");let n=null,d=0;if(void 0!==l._settingsDialogRowId){a.btnPrev.classList.remove("smart-hidden"),a.btnNext.classList.remove("smart-hidden");const e=e=>{const t=l.editing.editRow,i=l._recyclingRows.indexOf(t);let o=e?l._recyclingRows[i+1]:l._recyclingRows[i-1];if(l.grouping.enabled&&l.dataSource.groupBy&&l.dataSource.groupBy.length>0){let t=1;for(;o&&!o.leaf;)o=e?l._recyclingRows[i+t]:l._recyclingRows[i-t],t++}if(o){a.classList.add("disable-animation"),l.editing.recordNavigation=!0;const e=a.querySelector("[focus]");if(e){const t=e.closest(".row"),a=t.closest(".smart-grid-edit-dialog-editors-container");let i=-1;if(a&&(i=[...a.children].indexOf(t)),l.cancelEdit(),l._openRowSettingsDialog(o.id),l._dialogEdit&&i>=0){const e=l._dialogEdit.querySelectorAll(".row")[i];if(e){const t=e.querySelector(".smart-grid-dialog-editor");t.setAttribute("focus",""),t.querySelector(".smart-grid-cell-editor").focus()}}}else l.cancelEdit(),l._openRowSettingsDialog(o.id)}};a.btnNext.onmousedown=t=>{e(!0),t.preventDefault(),t.stopPropagation()},a.btnPrev.onmousedown=t=>{e(!1),t.preventDefault(),t.stopPropagation()}}if(!l._dialogEdit)if(a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0,l._settingsDialogRowId&&a.editorsContent&&a.editorsContent.offsetHeight&&(a.editorsContent.style.maxHeight=a.editorsContent.offsetHeight+40+"px")},a.onClose=function(){l.editing.dialog.visible=!1,a.row&&(a.row.showDetail=!1)},a.btnCancel.onclick=function(){l.cancelEdit()},a.btnClose.onclick=function(){l.cancelEdit()},a.btnConfirm.onclick=function(){if(void 0!==l._settingsDialogRowId){if(l.rowById[l._settingsDialogRowId]){const e=l.editing.editRow;if(!e)return!1;const t=e.cells;let i={};e.element.removeAttribute("error");for(let e=0;e<t.length;e++){const a=t[e],o=l._getEditorValue(a);i[a.column.dataField]=o}const o=l.validateRow(e.id,i);if(Object.keys(o).length>0){let e=!0;for(let i=0;i<t.length;i++){const n=t[i],d=o[n.column.dataField],r=a.querySelector(`[label-for="${n.column.dataField}"]`);if(r&&(r.innerHTML=""),d)for(let t in d){const a=d[t];let i="";if(!a)continue;let o=a[t];"minLength"!==t&&"maxLength"!==t||(o=a[t.toLowerCase()]),i=a.message?a.message:"required"===t||"valueMissing"===t?l.localize("requiredValue",{value:n.column.label}):"min"===t?l.localize("invalidMinValue",{value:n.column.label,min:o.min}):"max"===t?l.localize("invalidMaxValue",{value:n.column.label,max:o.max}):"minLength"===t?l.localize("invalidMinLengthValue",{value:n.column.label,min:o.requiredLength}):"maxLength"===t?l.localize("invalidMaxLengthValue",{value:n.column.label,max:o.requiredLength}):l.localize("invalidValue"),e=!1,r&&(r.innerHTML=i)}}if(!e)return}e.updatedDate=new Date,e.updatedBy=l.currentUser,e.style=a._rowStyle,e.comments=a._rowComments}if(a.columnVisibility){let e=!1;const t=l.columns.canNotify;l.columns.canNotify=!1;for(let t in a.columnVisibility){const i=l.columnByDataField[t];i.visible!==a.columnVisibility[t]&&(i.visible=a.columnVisibility[t],e=!0)}if(l.columns.canNotify=t,e)return l.endEdit(),l.refresh(!1),void(l.dataSource&&l.dataSource.boundHierarchy&&(l.dataSource.refreshHierarchy(),l._refreshRowHierarchy(),l.refresh()))}}l.endEdit(),l.dataSource&&l.dataSource.boundHierarchy&&(l.dataSource.refreshHierarchy(),l._refreshRowHierarchy(),l.refresh())},a.onkeydown=function(e){const t=e.key,a=l.editing.commandKeys;for(let e in a){const i=a[e];if(t===i.key){l._applyCommand(i.command);break}}},l.editing.editRow)if(void 0!==l._settingsDialogRowId)l._applySettingsDialogLayout(a,o,l.editing.editRow);else{o.classList.add("smart-grid-layout");for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(!t.allowEdit)continue;d%2==0&&(n=document.createElement("div"),n.classList.add("smart-grid-edit-dialog-row"),o.appendChild(n));const a=document.createElement("div");a.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const r=l._settingsDialogRowId?document.createElement("div"):document.createElement("label");r.innerHTML=l.columns[e].label;const s=document.createElement("div");s.classList.add("smart-grid-dialog-editor"),s.setAttribute("editor",t.dataField),s.setAttribute("template",t.editor.template),a.appendChild(i),n.appendChild(a),i.appendChild(r),i.appendChild(s),d++}}else{const t=e.column,l=document.createElement("div");l.classList.add("smart-grid-dialog-editor"),l.setAttribute("editor",""),l.setAttribute("template",t.editor.template),o.appendChild(l)}if(a.open(),l.editing.editRow){const l=a.querySelector("[editor="+e.column.dataField+"]");l&&(l.innerHTML="",l.appendChild(t.element),t.element.onfocus=()=>{l.setAttribute("focus","")},t.element.onblur=()=>{l.removeAttribute("focus")})}else{const l=e.column,i=a.querySelector("[editor]");i.innerHTML="",i.setAttribute("template",l.editor.template),i.appendChild(t.element),t.element.onfocus=()=>{i.setAttribute("focus","")},t.element.onblur=()=>{i.removeAttribute("focus")}}l._dialogEdit=a}_refreshCurrentUser(){const e=this,t=e.users;let l=e.currentUser,a=!0,i=!0,o=e.editing.enabled,n=!0;t&&null!==l&&(l=t.find((e=>e.id===l)),l&&(a=!1!==l.allowAdd,i=!1!==l.allowComment,o=o&&!1!==l.allowEdit,n=!1!==l.allowRemove)),e._currentUser={allowAdd:a,allowComment:i,allowEdit:o,allowRemove:n,info:l}}_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,l){const a=this;e.classList.add("smart-grid-dialog-expand-row");const i=e._rowStyle=JSON.parse(JSON.stringify(l._style)),o=e._rowComments=JSON.parse(JSON.stringify(l.comments)),n=[];e.columnVisibility=n;const d=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div");s.appendChild(d),s.appendChild(r),t.appendChild(s),s.classList.add("smart-grid-edit-dialog-layout"),d.classList.add("smart-grid-edit-dialog-editors-container"),r.classList.add("smart-grid-edit-dialog-activity-container");let c=0;for(let e=0;e<a.columns.length;e++){const t=a.columns[e];t.allowEdit&&!1!==t._visible&&c++}c>=8?d.classList.add("many"):d.classList.remove("many"),e.editorsContent=d,e.activityContent=r;const m=document.createElement("div"),u=document.createElement("div");r.appendChild(m),r.appendChild(u);let p=o&&o.length?" ("+o.length+")":"";m.innerHTML=`\n <div class="tabs">\n <div view="details" class="active tab"><div class="tab-label">${a.localize("detailsTab")}</div></div>\n <div view="comments" class="tab"><div class="tab-label">${a.localize("commentsTab")}${p}</div></div>\n <div view="history" class="tab smart-hidden"><div class="tab-label">${a.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">${a.localize("format").replace(":","")}\n <span title="${a.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="${a.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="${a.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="${a.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${a.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${a.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="${a.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="${a.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="${a.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">${a.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments">${a.localize("noComments")}</span></div>\n <div class="footer">\n <smart-text-area hint="${a.localize("comment")}" placeholder="${a.localize("comment")}" class="success underlined"></smart-text-area>\n <smart-button class="success">${a.localize("send")}</smart-button>\n </div>\n </div>\n </div>\n <div class="history-tab smart-hidden">\n <div class="history-layout">\n </div>\n </div>\n `;const g=m.querySelectorAll(".tab");a.storeHistory&&g[g.length-1].classList.remove("smart-hidden"),!a.users||a.users&&0===a.users.length?g[g.length-2].classList.add("smart-hidden"):g[g.length-2].classList.remove("smart-hidden"),m.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),l=m.querySelector(".details-tab"),i=m.querySelector(".comments-tab"),o=m.querySelector(".history-tab");l.classList.add("smart-hidden"),i.classList.add("smart-hidden"),o.classList.add("smart-hidden");for(let e=0;e<g.length;e++)g[e].classList.remove("active");switch(t.classList.add("active"),e){case"details":l.classList.remove("smart-hidden");break;case"comments":i.classList.remove("smart-hidden");break;case"history":o.classList.remove("smart-hidden"),a._refreshHistory()}}};const b=a._getColorInput();m.querySelector(".background").appendChild(b),b.onchange=()=>{i.background=b.value},i.background&&(b.value=i.background);const f=a._getColorInput();m.querySelector(".color").appendChild(f),f.onchange=()=>{i.color=f.value},i.color&&(f.value=i.color);const h=a._getColorInput();m.querySelector(".status").appendChild(h),h.onchange=()=>{i.status=h.value},i.status&&(h.value=i.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=()=>{i.fontFamily=v.value},i.fontFamily?v.value=i.fontFamily:v.selectedIndex=0,m.querySelector(".font-family").appendChild(v);const y=document.createElement("smart-input");y.style.width="auto",y.classList.add("underlined"),y.dropDownButtonPosition="right",y.readonly=!0,y.dropDownHeight="auto",y.dataSource=["-","8px","10px","12px","14px","18px","24px","36px"],y.onchange=()=>{i.fontSize=y.value},i.fontSize?y.value=i.fontSize:y.selectedIndex=0,m.querySelector(".font-size").appendChild(y);const C=m.querySelector(".button-group");C.onclick=e=>{const t=e.target.closest(".formatbtn");let l;t.classList.contains("checked")?(t.classList.remove("checked"),l=!1):(t.classList.add("checked"),l=!0),t.classList.contains("bold")?i.fontWeight=l?"bold":null:t.classList.contains("italic")?i.fontStyle=l?"italic":null:t.classList.contains("underline")&&(i.textDecoration=l?"underline":null)},i.fontWeight?C.children[0].classList.add("checked"):C.children[0].classList.remove("checked"),i.fontStyle?C.children[1].classList.add("checked"):C.children[1].classList.remove("checked"),i.textDecoration?C.children[2].classList.add("checked"):C.children[2].classList.remove("checked"),m.querySelector(".reset-format").onclick=()=>{for(let e=0;e<C.children.length;e++)C.children[e].classList.remove("checked");v.selectedIndex=0,y.selectedIndex=0,f.value="",b.value="",h.value="",i.fontWeight=null,i.fontStyle=null,i.textDecoration=null,i.fontSize=null,i.fontFamily=null};const w=m.querySelector(".comments-header"),A=m.querySelector('[view="comments"]'),x=m.querySelector(".comments-layout smart-text-area"),k=m.querySelector(".comments-layout smart-button"),S=m.querySelector(".comments-layout .footer"),L=m.querySelector(".comments-layout .comments");k.disabled=!0,L.innerHTML=`<span class="no-comments">${a.localize("noComments")}</span>`;const z=()=>{const e=L.querySelector(".no-comments");0===o.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},_=e=>{e.querySelector(".remove-button").onclick=e=>{const t=e.target,i=o.indexOf(t.comment);if(i>-1){const e=o[i];o.splice(i,1),a.$.fireEvent("commentRemove",{id:l.id,value:e}),t.element.remove();const n=o.length?"("+o.length+")":"";w.innerHTML=A.innerHTML=`${a.localize("comments").replace(":","")} ${n}`}}};for(let e=0;e<o.length;e++){const t=o[e],l=a._createComment(t);_(l),L.appendChild(l)}w.innerHTML=`${a.localize("comments").replace(":","")} ${p}`,z(),x.onfocus=()=>{S.classList.add("focus")},x.onblur=()=>{S.classList.remove("focus")},x.onkeyup=()=>{k.disabled=""===x.value},k.onclick=()=>{if(""===x.value)return;a._refreshCurrentUser();const e={text:x.value,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:a._currentUser.info?a._currentUser.info.id:-1,time:new Date},t=a._createComment(e);_(t),o.push(e),a.$.fireEvent("commentAdd",{id:l.id,value:e}),x.value="",k.disabled=!0,z(),L.appendChild(t);const i=o.length?"("+o.length+")":"";w.innerHTML=A.innerHTML=`${a.localize("comments").replace(":","")} ${i}`};for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit||!1===t._visible)continue;const l=document.createElement("div");l.classList.add("smart-grid-edit-dialog-row"),d.appendChild(l);const i=document.createElement("div"),o=a._settingsDialogRowId?document.createElement("div"):document.createElement("label"),r=t.validationRules&&t.validationRules.length>0?"*":"";o.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${a.columns[e].icon} show"></span><label>`+a.columns[e].label+r+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const s=document.createElement("div");s.classList.add("smart-grid-dialog-editor"),s.setAttribute("editor",t.dataField),s.setAttribute("template",t.editor.template);const c=o.querySelector("[toggle]");c.column=t,n[t.dataField]=t.visible,c.title=a.localize("columnMenuItemHide"),c.onclick=()=>{n[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=a.localize("columnMenuItemShow")):(c.classList.add("smart-icon-visibility-on"),c.classList.remove("smart-icon-visibility-off"),c.title=a.localize("columnMenuItemHide"))},t.visible||(c.classList.remove("smart-icon-visibility-on"),c.title=a.localize("columnMenuItemShow")),t.visible?c.classList.add("smart-icon-visibility-on"):c.classList.add("smart-icon-visibility-off"),i.appendChild(o),i.appendChild(s);const m=document.createElement("label");m.classList.add("smart-field-editor-error-label"),m.setAttribute("label-for",t.dataField),i.appendChild(m),l.appendChild(i)}}_refreshHistory(){const e=this,t=e._dialogEdit;if(!t)return;const l=t.querySelector(".history-layout");if(!e.storeHistory)return void l.classList.add("smart-hidden");l.classList.remove("smart-hidden");const a=t.row.history;if(!a)return;let i="\n ";for(let t=a.length-1;t>=0;t--){const l=a[t];let o="";if(e._kanban)o=e._kanban._getHistoryItemLabel(l);else if("created"===l.action)o=e.localize("rowCreated",{value:l.action});else{const t=e.columnByDataField[l.action];o=e.localize("propertyUpdated",{value:t?t.label:l.action})}if(i+='<div class="history-row">',void 0!==l.user){const t=(t=>{const l=t?t.image:null;return{image:l?`background-image: url('${l}');`:"",label:t?t.name||t.id:e.localize("guestUser"),cssClass:l?"image":""}})(e.users.find((e=>e.id===l.user)));i+=`<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(l.date).toString("dd/MM/yyyy hh:mm")}</div></div>`}else i+="<div></div>";if(i+='<div class="history-action">',i+=`<div>${o}</div>`,"created"!==l.action){let t=l.details.oldValue,a=l.details.value;if("user"===l.action){const l=e.users.find((e=>e.id===t||e.id===parseFloat(t))),i=e.users.find((e=>e.id===a||e.id===parseFloat(a)));l?t=l.name:(t="",t||(t=e.localize("unassigned"))),i?a=i.name:(a="",a||(a=e.localize("unassigned")))}if("subtasks"===l.action){const t=l.details.value.filter((e=>e.completed));e._kanban?i+=`<span class="detail smart-truncate">${e._kanban.localize("taskSubtasksCompleted",{value:t.length+"/"+l.details.value.length})}</span>`:i+=`<span class="detail smart-truncate">${e.localize("nullRange",{value:t.length})}</span>`}else{t&&"object"==typeof t&&t instanceof Date&&(t=t.toLocaleString()),a&&"object"==typeof a&&a instanceof Date&&(a=a.toLocaleString());let o=e.columnByDataField[l.action];o||(o=e.columnByDataField["task"+l.action.substring(0,1).toUpperCase()+l.action.substring(1)]),"user"===l.action&&(o=e.columnByDataField.taskUserId);let n="";o&&o.label&&(n='"'+o.label+'"'),o&&"date"===o.dataType&&(t&&"string"==typeof t&&(t=new Date(t).toLocaleString()),a&&"string"==typeof a&&(a=new Date(a).toLocaleString())),i+=t?`<span class="detail smart-truncate">${e.localize("range",{column:n,oldValue:t,newValue:a})}</span>`:`<span class="detail smart-truncate">${e.localize("nullRange",{column:n,oldValue:t,newValue:a})}</span>`}}else i+=`<div>${l.details.value}</div>`;i+="</div>\n </div>"}i+="",l.innerHTML=i}_createComment(e){const t=this,l=t.users.find((t=>t.id===e.userId)),a=document.createElement("div"),i=l?l.name||l.id:t.localize("guestUser"),o=l?l.name:t.localize("guestUser"),n=l.image?l.image:"";if(a.className="comment",a.setAttribute("role","listitem"),a.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${i}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${o}</div>\n <div class="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&&l.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>`,n){const e=a.querySelector(".user-icon");e.style.backgroundImage=`url('${n}')`,e.classList.add("image")}a.comment=e;const d=a.querySelector(".remove-button");return d.comment=e,d.element=a,e.userId!==t._currentUser.info.id&&d.classList.add("smart-visibility-hidden"),a}_openSummaryRowDialog(e){const t=this,l=t._summaryRowDialog||t._createDialog(),a="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(l.header.innerHTML=a,!l.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",l.content.innerHTML="",l.listBox=e}const i=l.listBox;l.summaryValueElement&&l.summaryValueElement.classList.remove("summary-chooser");const o=e.element.querySelector(".summary-value");if(!o)return;o.classList.add("summary-chooser"),l.summaryValueElement=o;let n=[];l.dataField=e.column.dataField,n="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"}],i.dataSource=n,i.style.position="absolute",i.style.visibility="hidden",i.style.height="auto",document.body.appendChild(i);const d=e.column;d.summary&&d.summary.forEach((e=>{i.select(e)}));const r=i.offsetHeight;l.column=d,l.content.appendChild(i),l.classList.add("smart-grid-dialog-summary"),l.header.parentElement.classList.add("smart-hidden"),l.footer.classList.add("smart-hidden"),i.style.visibility="",i.style.position="",i.style.width="100%",t._summaryRowDialog||(l.btnConfirm.innerHTML=t.localize("apply"),l.btnCancel.innerHTML=t.localize("cancel"),l.style.width=l.style.minWidth="120px",l.onOpen=function(){t.editing.dialog.visible=!0},l.onClose=function(){t.editing.dialog.visible=!1,l.summaryValueElement&&l.summaryValueElement.classList.remove("summary-chooser")},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){const e=l.column.summary;l.column.summary=i.selectedValues,t.$.fireEvent("columnSummaryChange",{column:l.column,dataField:d.dataField,oldSummary:[...e],summary:[...l.column.summary]}),l.close(),t._calculateSummary(),t._recycle(!1)},l.confirm=function(){l.btnConfirm.click()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},t._summaryRowDialog=l);const s=e.element,c=t.offset(s),m=t.offset(t);let u=s.offsetWidth+c.left-m.left-120;u<0&&(u=c.left-m.left),l.open(u,c.top-m.top-r-0),setTimeout((function(){l.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const l=this;if(!l.editing.deleteDialog.enabled)return!1;const a=l._dialogDelete||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):l.editing.dialog.header;a.header.innerHTML=i,a.content.innerHTML=l.localize("dialogDeleteContent"),a.row=e,l._dialogDelete||(a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogDeleteButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogDeleteButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0},a.onClose=function(){l.editing.dialog.visible=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){t(a.row),a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},l._dialogDelete=a),a.open(),setTimeout((function(){a.btnConfirm.focus()}),100)}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),l=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:[{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")}],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(l).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(l).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(l).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:"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")}]}_addColumnDialogShowHideEditors(e){const t=this,l=t._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input").getSelectedItem().value,a=t._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),i=t._dialogAddColumn.querySelector('[field-name="kanbanNotes"]');i&&("kanban"!==t.view?i.classList.add("smart-hidden"):i.classList.remove("smart-hidden"));let o=!!e;for(let i=0;i<a.length;i++){const n=a[i],d=n.getAttribute("filter"),r=n.getAttribute("bind"),s=n.parentNode;if(s.classList.add("smart-hidden"),"cellsAlign"!==r||"boolean"!==l&&"image"!==l&&"email"!==l&&"url"!==l&&"collaborator"!==l&&"createdBy"!==l&&"password"!==l&&"phone"!==l&&"createdTime"!==l&&"updatedBy"!==l&&"updatedTime"!==l)if("type"===r&&o)s.classList.add("smart-hidden");else if("allowEdit"!==r||!1!==t.editing.enabled&&"autoNumber"!==l&&"createdBy"!==l&&"updatedBy"!==l&&"createdTime"!==l&&"updatedTime"!==l)if("allowResize"!==r||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==r||!1!==t.filtering.enabled)if("allowSort"!==r||!1!==t.sorting.enabled)if("required"!==r||!1!==t.editing.enabled&&("string"===l||"multiText"===l))if(e&&e.disabledDialogOptions&&e.disabledDialogOptions.length>0&&e.disabledDialogOptions.indexOf(r)>=0)s.classList.add("smart-hidden");else{if(e&&"kanban"===t.view){switch(r){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":s.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===d&&s.classList.remove("smart-hidden")}if("any"!==d)switch(l){default:case"text":"text"===d&&s.classList.remove("smart-hidden"),e&&"any"===e.dataType&&s.classList.add("smart-hidden");break;case"slider":case"number":if("number"===d&&s.classList.remove("smart-hidden"),"unit"===r){s.classList.add("smart-hidden");const e=t._dialogAddColumn.querySelector('[field-name="numberFormat"]'),l=t._dialogAddColumn.querySelector('[field-name="unit"]'),a=e.querySelector("smart-input"),i=()=>{const e=a.getSelectedItem();e&&"unit"===e.value.style?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};e.onchange=()=>{i()},i()}break;case"select":case"multiSelect":d.indexOf("list")>=0&&s.classList.remove("smart-hidden");break;case"collaborator":d.indexOf("collaborator")>=0&&s.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"boolean":break;case"date":{const e=t._dialogAddColumn.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;"date"===d&&s.classList.remove("smart-hidden");const l=e=>{const l=t._dialogAddColumn.querySelector('[field-filter="time"]'),a=t._dialogAddColumn.querySelector('[field-name="dateFormat"]');e?(l.classList.remove("smart-hidden"),a.style.width="50%",a.style.float="left"):(l.classList.add("smart-hidden"),a.style.width="",a.style.float="")},a=e=>{const l=t._dialogAddColumn.querySelector('[field-name="allowTimeFormat"]'),a=l.querySelector(".smart-grid-dialog-editor");e.indexOf("T")>=0?(l.classList.add("smart-hidden"),a.uncheck()):l.classList.remove("smart-hidden")},i=e=>{const l=t._dialogAddColumn.querySelector('[field-name="dateFormatSeparator"]');e?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};if("allowTimeFormat"===r){const e=n.querySelector(".smart-input").value;n.onchange=e=>{l(e)},l(e)}if("dateFormat"===r){const e=n.querySelector(".smart-input").value;n.onchange=e=>{a(e.detail.value)},a(e)}if("dateFormatSeparator"===r){const e=t._dialogAddColumn.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;i(e)}if("allowCustomDateSeparator"===r){e.indexOf("T")>=0&&e.indexOf("-")>0&&n.uncheck();const t=n.querySelector(".smart-input").value;n.onchange=e=>{i(e)},i(t)}a(e);break}}else s.classList.remove("smart-hidden")}else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden")}}_addColumnDialogInitEditors(){const e=this,t=e._dialogAddColumn.editColumn,l=e._getAddColumnDialogTemplate();for(let a in e._addColumnDialogEditors){const i=e._addColumnDialogEditors[a],o=i.querySelector("input"),n=i.querySelector("smart-input");switch(a){case"allowTimeFormat":{const e=i.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 l=i.querySelector(".smart-input");l.value=!1,l.removeAttribute("checked");let a=0;t&&t.cellsFormat&&(t.cellsFormat.indexOf(".")>=0?(l.value=!0,l.setAttribute("checked",""),a=2):(t.cellsFormat.indexOf("M-d-yyyy")>=0||t.cellsFormat.indexOf("d-M-yyyy")>=0||t.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(l.value=!0,l.setAttribute("checked",""),a=1));const o=e._addColumnDialogEditors.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");o.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),o[a].setAttribute("checked",""),o[a].value=!0;break}case"kanban":{const t=i.querySelectorAll(".smart-grid-dialog-boolean-field");for(let l=0;l<t.length;l++)t[l].onchange=t=>{const l=[...t.parentElement.children].indexOf(t),a=t.parentElement.parentElement.previousElementSibling,i=e._dialogAddColumn.querySelector('[field-name="options"]'),o=e._dialogAddColumn.querySelector('[field-name="allowColorItems"]'),n=e._addColumnDialogEditors.name,d=()=>{const t=i.querySelector("smart-sortable");t&&(t._validate(),e._dialogAddColumn&&e._dialogAddColumn.offsetHeight&&e._dialogAddColumn.setPosition("center"))};switch(l){case 0:a.innerHTML=e.localize("kanbanNoneDescription"),o.classList.add("smart-hidden"),i.classList.add("smart-hidden"),n.querySelector("input").value=e.localize("dialogNewColumn"),d();break;case 1:a.innerHTML=e.localize("kanbanBasicDescription"),o.classList.remove("smart-hidden"),i.classList.remove("smart-hidden"),n.querySelector("input").value=e.localize("status"),d()}};break}case"dateFormat":t&&t.cellsFormat?t.cellsFormat.indexOf("M/d/yyyy")>=0?n.selectedIndex=0:t.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?n.selectedIndex=1:t.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?n.selectedIndex=2:t.cellsFormat.indexOf("d/M/yyyy")>=0?n.selectedIndex=3:t.cellsFormat.indexOf("yyyy-MM-dd")>=0?n.selectedIndex=4:t.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(n.selectedIndex=5):n.selectedIndex=0;break;case"timeFormat":t&&t.cellsFormat&&t.cellsFormat.indexOf("HH")>=0&&-1===t.cellsFormat.indexOf("T")?n.selectedIndex=1:n.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!0;t&&t.editor&&t.editor.singleSelect&&(e=!1);const l=i.querySelector(".smart-input");t?e?(l.value=!0,l.setAttribute("checked","")):(l.value=!1,l.removeAttribute("checked")):(l.value=!0,l.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)n.selectedIndex=0;else if("decimal"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)n.selectedIndex=1;else if("percent"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)n.selectedIndex=2;else if("percent"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)n.selectedIndex=3;else if("decimal"===t.editor.numberFormat.style&&"scientific"===t.editor.numberFormat.notation)n.selectedIndex=4;else if("decimal"===t.editor.numberFormat.style&&"engineering"===t.editor.numberFormat.notation)n.selectedIndex=5;else if("currency"===t.editor.numberFormat.style&&"accounting"===t.editor.numberFormat.currencySign)n.selectedIndex=6;else if("unit"===t.editor.numberFormat.style){n.selectedIndex=7;const l=t.editor.numberFormat.unit,a=e._addColumnDialogEditors.unit.querySelector("smart-input");a.dataSource.forEach(((e,t)=>{if(e.value===l)return a.selectedIndex=t,!0}))}else"currency"===t.editor.numberFormat.style?n.selectedIndex=8:"currency"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits&&0===t.editor.numberFormat.minimumFractionDigits&&(n.selectedIndex=9);else n.selectedIndex=0;break;case"allowCheckItems":{const e=i.querySelector(".smart-input");t?t.editor&&!t.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===t[a]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!1,e.setAttribute("checked",""));break}case"allowColorItems":{const e=i.querySelector(".smart-input");t?t.editor&&t.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===t[a]&&(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=i.querySelector(".smart-input"),o=l.find((e=>{if(e.bind===a)return e}));t?t[a]?(e.value=!0,e.setAttribute("checked","")):!1===t[a]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,o&&void 0!==o.value&&(e.value=o.value),e.value&&e.setAttribute("checked",""));break}}if(!t||"options"!==a&&"users"!==a){const t=i.querySelector("smart-sortable");if(t&&t._init)if("users"===a){let l=[];for(let t=0;t<e.users.length;t++)l.push({color:e.users[t].color,label:e.users[t].name,id:e.users[t].id,image:e.users[t].image});t._init(l)}else t._init()}else{const e=i.querySelector("smart-sortable");if(e&&e._init)if(t.editor.singleSelect){const l=t.editor.dataSource.filter((e=>""!==e));e._init(l)}else"multiComboInput"===t.editor.template&&e._init(JSON.parse(JSON.stringify(t.editor.dataSource)))}if(t&&"type"===a?("number"===t.dataType||"int"===t.dataType?n.selectedIndex=3:"date"===t.dataType?n.selectedIndex=7:"bool"!==t.dataType&&"boolean"!==t.dataType||(n.selectedIndex=6),t.editor&&t.editor.template&&n.dataSource.forEach(((e,l)=>{switch(e.value){case"string":"input"===t.editor.template&&(n.selectedIndex=l);break;case"number":"numberInput"===t.editor.template&&(n.selectedIndex=l);break;case"select":"multiComboInput"===t.editor.template&&t.editor.singleSelect&&"tags"===t.template&&(n.selectedIndex=l);break;case"multiSelect":"multiComboInput"!==t.editor.template||t.editor.singleSelect||"tags"!==t.template||(n.selectedIndex=l);break;case"multiText":"textarea"===t.editor.template&&(n.selectedIndex=l);break;case"date":"dateInput"!==t.editor.template&&"dateTimePicker"!==t.editor.template||(n.selectedIndex=l);break;case"checkBox":"checkBox"===t.editor.template&&(n.selectedIndex=l);break;case"slider":"slider"===t.editor.template&&(n.selectedIndex=l);break;case"image":"image"===t.editor.template&&(n.selectedIndex=l);break;case"updatedTime":"updatedTime"===t.template&&(n.selectedIndex=l);break;case"createdTime":"createdTime"===t.template&&(n.selectedIndex=l);break;case"createdBy":"createdBy"===t.template&&(n.selectedIndex=l);break;case"updatedBy":"updatedBy"===t.template&&(n.selectedIndex=l);break;case"collaborator":"collaborator"===t.template&&t.editor&&t.editor.collaborator&&(n.selectedIndex=l);break;case"autoNumber":"autoNumber"===t.template&&(n.selectedIndex=l);break;case"phone":"phone"===t.template&&(n.selectedIndex=l);break;case"password":"password"===t.template&&(n.selectedIndex=l);break;case"url":"url"===t.template&&(n.selectedIndex=l);break;case"email":"email"===t.template&&(n.selectedIndex=l)}}))):"type"===a&&(n.selectedIndex=0),"cellsAlign"===a&&t&&("center"===t.cellsAlign||"middle"===t.cellsAlign?n.selectedIndex=2:"right"===t.cellsAlign&&(n.selectedIndex=1)),!o)continue;"dataField"!==a&&"type"!==a&&"timeFormat"!==a&&"dateFormat"!==a&&"numberFormat"!==a&&"unit"!==a&&"cellsAlign"!==a&&n&&(n.selectedIndex=0),"name"===a&&(n.value=t?t.label:"",n.placeholder=l.find((e=>{if(e.bind===a)return e})).placeholder),"description"===a&&(n.value=t?t.description:"",n.placeholder=l.find((e=>{if(e.bind===a)return e})).placeholder);const d=(e,l)=>{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?(l.value=t.value,!0):void 0))};if("minValue"===a?(o.value=0,d(a,o)):"maxValue"===a?(o.value=100,d(a,o)):"minLength"===a?(o.value=0,d(a,o)):"maxLength"===a&&(o.value=500,d(a,o)),"minDateTime"===a){const e=i.querySelector("smart-date-input");e.value=new Date(1900,0,1),d(a,e)}else if("maxDateTime"===a){const e=i.querySelector("smart-date-input");e.value=new Date(2100,0,1),d(a,e)}}}_createColumnBooleanEditor(e,t,l,a,i){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const o=document.createElement("div");return o.classList.add("smart-input"),o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-check-box-cell-editor"),o.setAttribute("checked",""),o.value=!0,t.width&&(l.style.width=t.width,l.style.float="left"),!1===t.value&&(o.value=!1,o.removeAttribute("checked")),e.appendChild(o),e.getValue=function(){return o.value},e.check=function(){o.setAttribute("checked",""),o.value=!0,e.onchange&&e.onchange(o.value)},e.uncheck=function(){o.removeAttribute("checked"),o.value=!1,e.onchange&&e.onchange(o.value)},e.toggle=function(){!0!==o.value&&!1!==o.value&&null!==o.value&&(o.value=!1),null===o.value?o.value=!1:o.value=!o.value,!1===o.value?o.removeAttribute("checked"):o.setAttribute("checked",o.value?"":"indeterminate"),e.onchange&&e.onchange(o.value)},e.onclick=i.onclick=()=>{e.toggle()},a.appendChild(l),l.classList.add("smart-grid-dialog-boolean-field"),l.appendChild(e),l.appendChild(i),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,l=e._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),a=[];let i,o,n={};for(let t=0;t<l.length;t++){const a=l[t],i=a.querySelector(".smart-input"),o=a.getAttribute("bind"),d=a.parentElement;if("kanban"!==o)if("minLength"!==o&&"maxLength"!==o&&"minValue"!==o&&"maxValue"!==o&&"minDateTime"!==o&&"maxDateTime"!==o)if("options"!==o&&"users"!==o){if("allowEdit"===o&&d.classList.contains("smart-hidden"))i.value=!1;else if("required"===o&&d.classList.contains("smart-hidden"))i.value=!1;else if("dateFormatSeparator"===o){const e=a.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:n.dateFormatSeparatorType="/";break;case 1:n.dateFormatSeparatorType="-";break;case 2:n.dateFormatSeparatorType="."}break}}i&&(i.getSelectedItem?n[o]=i.getSelectedItem().value:n[o]=i.value)}else{const t=[],l=a.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),i=a.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<l.length;e++){const a=l[e],o={label:a.value,value:a.getAttribute("data-item-value"),id:parseInt(a.getAttribute("data-id")),color:i[e].value};o.color=i[e].value,t.push(o)}if("users"===o&&"collaborator"===n.type){e.users||(e.users=[]);for(let l=0;l<t.length;l++){const a=t[l],i=e.users.find((e=>e.id===a.id));i&&(i.name=a.label,i.color=a.color)}}n[o]=t}else n[o]=i.getValue();else{const e=a.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:n.kanban="blank";break;case 1:n.kanban="basic"}break}}}t.data=n;let d={},r={},s="";if(i=n.minDateTime,o=n.maxDateTime,"date"===n.type){d={template:"dateInput",min:i,max:o};let e=!1;"-"!==n.dateFormat&&(s=n.dateFormat,n.allowCustomDateSeparator&&(s.indexOf("/")>=0?s=s.replaceAll("/",n.dateFormatSeparatorType):s.indexOf("-")>=0?s=s.replaceAll("-",n.dateFormatSeparatorType):s.indexOf(".")>=0&&(s=s.replaceAll(".",n.dateFormatSeparatorType))),n.dateFormat.indexOf("T")>=0&&(d.template="dateTimePicker",d.dropDownDisplayMode="auto",d.formatString=s),e=!0),d.autoOpen=!0,n.allowTimeFormat&&"-"!==n.timeFormat&&(e&&(s+=" "),s+=n.timeFormat,d.template="dateTimePicker",d.dropDownDisplayMode="auto",d.formatString=s),a.push({type:"minDate",value:i}),a.push({type:"maxDate",value:o})}else if("number"===n.type||"slider"===n.type)i=parseInt(n.minValue),o=parseInt(n.maxValue),"unit"===n.numberFormat.style&&(n.numberFormat.unit=n.unit),d={template:"number"===n.type?"numberInput":"slider",min:i,max:o,numberFormat:n.numberFormat},r={Intl:{NumberFormat:n.numberFormat}},s="d",a.push({type:"min",value:i}),a.push({type:"max",value:o});else if("boolean"===n.type)d={template:"checkBox"};else if("image"===n.type)d={template:"image"};else if("select"===n.type||"multiSelect"===n.type){let e=n.options;if("select"===n.type)if(t.editColumn&&!t.editColumn.editor.allowEmptyItem)e=n.options;else{let t=!1;for(let e=0;e<n.options.length;e++)if(""===n.options[e].label){t=!0,n.options[e].value="";break}e=t?n.options:[""].concat(n.options)}d={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:n.allowColorItems,autoOpen:!0,pills:!n.allowCheckItems,singleSelect:"select"===n.type,dataSource:e}}else if("collaborator"===n.type){let t=n.users;n.allowMultipleCollaborators||(t=[""].concat(n.users));for(let l=0;l<e.users.length;l++)t.forEach((t=>{t.value===e.users[l].id&&(t.image=e.users[l].image,t.id=e.users[l].id)}));d={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:n.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!n.allowCheckItems,singleSelect:!n.allowMultipleCollaborators,dataSource:t}}else"multiText"===n.type?(i=n.minLength,o=n.maxLength,d={template:"textarea",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o})):"password"===n.type?(i=n.minLength,o=n.maxLength,d={template:"password",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o})):"phone"===n.type?d={template:"phone",required:n.required}:(i=n.minLength,o=n.maxLength,d={template:"input",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o}));let c="string";switch(n.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=n.name,t.description=n.description,t.showDescriptionButton=!0,t.allowResize=n.allowResize,t.allowSort=n.allowSort,t.allowFilter=n.allowFilter,t.allowEdit=n.allowEdit,t.align=t.cellsAlign=n.cellsAlign,t.cellsFormat=s;const l=t._editorId?t._editorId:"",i=d.template+"_"+t.dataField+l;e._cellEditors[i]&&delete e._cellEditors[i];let o=!0;"list"!==t.template&&"dropDownList"!==t.template||(o=!1),"autoNumber"!==t.template&&"createdBy"!==t.template&&"updatedBy"!==t.template&&"createdTime"!==t.template&&"updatedTime"!==t.template||(o=!1),t.editor&&t.editor.template.indexOf("custom")>=0&&(o=!1),t.editor&&t.editor.disabledDialogOptions&&(o=!1),o&&(t.editor=d,t.template=e._getColumnTemplateByType(n.type)),t.formatSettings=r,t._isDirty=!0,n.required&&a.push({type:"required"}),t.validationRules=a,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,n),e._recycle(!0),t.refresh(),t._isDirty=!1}else{let t=[];"number"===c&&(t=["sum"]);const l=new Smart.Grid.Column({label:n.name,description:n.description,dataField:n.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:n.allowResize,allowSort:n.allowSort,allowFilter:n.allowFilter,allowEdit:n.allowEdit,showDescriptionButton:!0,dataType:c,editor:d,summary:t,template:e._getColumnTemplateByType(n.type),formatSettings:r,cellsAlign:n.cellsAlign,align:n.cellsAlign,cellsFormat:s,visibleIndex:e.columns.length-1,grid:e});"autoNumber"===l.template&&(l.autoGenerated=!0,t=[]),n.required&&(a.push({type:"required"}),l.validationRules=a),e.columns.push(l),e._refreshHeaderBar(),e.$.fireEvent("closeColumnDialog",{dataField:l.dataField})}}_openAddColumnDialog(e,t,l){const a=this,i=a._dialogAddColumn||a._createDialog(a.editing.addColumnDialog),o=e?a.localize("dialogEditColumn",{value:e.label}):a.localize("dialogAddColumn"),n=i.querySelector(".smart-footer").querySelector(".smart-stack-layout");i.classList.add("smart-grid-dialog-add-column"),i.type=e?"customize":"add",i.editColumn=e||null,e&&e.element&&e.element.setAttribute("focus",""),n.classList.remove("right"),n.classList.add("center"),a._cellEditors||(a._cellEditors=[]);const d=a._getAddColumnDialogTemplate();if(i.header.innerHTML=o,i.header.parentElement.classList.add("smart-hidden"),i.callback=l,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===a.view&&(i.header.innerHTML=a.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"))),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),"kanban"===a.view?i.btnCancel.classList.add("smart-hidden"):i.btnCancel.classList.remove("smart-hidden"),a.cancelEdit(),!a._dialogAddColumn){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){a._addColumnDialogInitEditors(),a._addColumnDialogShowHideEditors(i.editColumn),a.$.fireEvent("openColumnDialog",{dataField:i.editColumn?i.editColumn.dataField:null});const e=a.offset(i);if(e.top+i.offsetHeight>window.innerHeight){const t=e.top+i.offsetHeight-window.innerHeight;i.style.maxHeight=Math.max(250,i.offsetHeight-t)+"px",i.style.minHeight="250px"}else i.style.maxHeight="",i.style.minHeight=""},i.onClose=function(){i.editColumn&&i.editColumn.element&&i.editColumn.element.removeAttribute("focus"),i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){a._confirmAddColumnDialog(),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&"kanban"!==a.view&&(i.result=!1,i.close())},a._dialogAddColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e),a._addColumnDialogEditors=[];for(let t=0;t<d.length;t++){const l=d[t],o=document.createElement("div"),n=document.createElement("label");n.innerHTML=l.label;const r=document.createElement("div");if(r.classList.add("smart-grid-dialog-editor","add-column"),r.innerHTML="",r.setAttribute("filter",l.filter),r.setAttribute("bind",l.bind),o.setAttribute("field-name",l.bind),o.setAttribute("field-filter",l.filter),a._addColumnDialogEditors[l.bind]=r,"type"===l.bind&&r.addEventListener("change",(()=>{a._addColumnDialogShowHideEditors(i.editColumn);const e=a._dialogAddColumn.querySelector('[bind="type"]'),t=e.querySelector("smart-input"),l=t.getSelectedItem().value;let o="smart-icon-font";switch(l){case"multiText":o="smart-icon-fontsize";break;case"image":o="smart-icon-image";break;case"number":o="smart-icon-number";break;case"select":o="smart-icon-sort-down";break;case"multiSelect":o="smart-icon-list-unordered";break;case"boolean":o="smart-icon-check-squared";break;case"date":o="smart-icon-calendar";break;case"createdTime":case"updatedTime":o="smart-icon-clock";break;case"createdBy":case"updatedBy":case"collaborator":o="smart-icon-user";break;case"slider":o="smart-icon-number";break;case"autoNumber":o="smart-icon-list-ordered";break;case"url":o="smart-icon-link";break;case"email":o="smart-icon-mail";break;case"password":o="smart-icon-lock";break;case"phone":o="smart-icon-phone"}if(a._addColumnDialogEditors.type.icon=o,a._addColumnDialogEditors.name.querySelector("input").setAttribute("data-label",t.value),e.firstElementChild.className="smart-grid-icon show smart-description-button "+o,"select"===l||"multiSelect"===l){const e=a._addColumnDialogEditors.options.querySelector("smart-sortable");e&&e._validate&&e._validate()}else i.btnConfirm.disabled=!1})),"boolean"===l.type)a._createColumnBooleanEditor(r,l,o,e,n);else{if("label"===l.type){e.appendChild(o),o.classList.add("smart-grid-dialog-field"),o.appendChild(n);const t=document.createElement("div");t.style.height="10px",o.appendChild(t);continue}{let s=document.createElement("smart-input");if(s.classList.add("underlined","edit-column-input"),s.style.width="100%",s.style.height="30px",l.width&&(o.style.width=l.width,o.style.float="left"),"items"===l.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>'+a.localize("commandBarAddRow")+"</span></div>";const t=document.createElement("div");t.classList.add("smart-grid-add-column-dialog-color-panel");const o=document.createElement("smart-sortable");o.disableMode="manual",o.dragMode="handle",o.handleVisibility="visible",o.handlePosition="left";const n=()=>{if(i.btnConfirm.disabled=!1,0===t.offsetHeight)return;let e=0;t.querySelectorAll(".edit-column-input").forEach((t=>{""===t.value&&e++,e>1&&(i.btnConfirm.disabled=!0)}))},d=(t,i,d,r)=>{const s=document.createElement("div"),c=a._getColorInput(),m=document.createElement("div"),u=document.createElement("smart-input"),p=a._addColumnDialogEditors.allowColorItems;if(void 0!==d)u.setAttribute("data-id",d),u.setAttribute("data-item-value",d);else{const e=o.querySelectorAll(".smart-sortable-item").length;u.setAttribute("data-id",e),u.setAttribute("data-item-value",e)}return void 0!==r&&u.setAttribute("data-item-value",r),c.disabled=!p.querySelector(".smart-input").value,m.className="smart-grid-icon smart-icon-close show",m.setAttribute("role","button"),m.setAttribute("aria-label","button"),u.classList.add("underlined","edit-column-input"),u.style.width="100%",u.style.height="30px",u.required=!0,t&&(u.value=t),i&&(c.value=i),u.onkeyup=u.onchange=u.onblur=t=>{n(),"Enter"===t.key&&(u.parentElement.nextElementSibling||(e.click(),n()))},s.appendChild(c),s.appendChild(u),"users"!==l.bind&&s.appendChild(m),m.onclick=()=>{s.remove(),o.updateItems(),n()},s.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),s};o._init=e=>{o.clearContent(),e&&(e.forEach(((e,t)=>{const l=void 0!==e.id?e.id:t,a=d(e.label,e.color,l,e.value);o.$.container.appendChild(a)})),o.updateItems())},o._validate=n,a._addColumnDialogEditors.allowColorItems.onchange=e=>{let t=a._addColumnDialogEditors.allowColorItems.parentElement.nextElementSibling,l=null;for(;t;){if("options"===t.getAttribute("field-name")){l=t;break}t=t.nextElementSibling}l&&l.querySelectorAll("smart-color-input").forEach((t=>{t.disabled=!e}))},t.appendChild(o),"users"!==l.bind&&(t.appendChild(e),e.onclick=()=>{const e=d();o.$.container.appendChild(e),o.updateItems(),e.querySelector(".edit-column-input").focus(),i.btnConfirm.disabled=!0}),s=t,r.style.height="auto"}else if("number"===l.type)s=document.createElement("smart-number-input"),s.classList.add("underlined"),s.style.width="100%",s.style.height="30px","minValue"===l.bind?(s.value=0,s.min=-9999999,s.max=9999999):"maxValue"===l.bind?(s.value=1e6,s.min=-9999999,s.max=9999999):"minLength"===l.bind?s.value=0:"maxLength"===l.bind&&(s.value=500);else if("datetime"===l.type)s=document.createElement("smart-date-input"),s.classList.add("underlined"),s.style.width="100%",s.style.height="30px","minDateTime"===l.bind?s.value=new Date(1900,0,1):"maxDateTime"===l.bind&&(s.value=new Date(2100,0,1));else if("radio"===l.type){const e=(e,t,l)=>{const a=document.createElement("div"),i=document.createElement("label"),o=document.createElement("div");return i.innerHTML=e,o.classList.add("smart-input"),o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-check-box-cell-editor"),t&&o.setAttribute("checked",""),o.value=void 0!==t&&t,r.appendChild(o),a.onclick=function(){if(o.value=!0,!1===o.value?o.removeAttribute("checked"):o.setAttribute("checked",o.value?"":"indeterminate"),a.onchange&&a.onchange(a),o.value){const e=o.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),o.value=!0,o.setAttribute("checked",o.value?"":"indeterminate"),e.value=l}},a.appendChild(o),a.appendChild(i),a.classList.add("smart-grid-dialog-boolean-field"),a.setAttribute("template","checkBox"),a.setAttribute("editor",""),a},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),r.classList.add("radio-group");for(let a=0;a<l.options.length;a++){const i=l.options[a],o=e(i.label,i.checked);if(l.columns){const e=100/l.columns;o.style.width=e+"%",o.style.float="left"}t.appendChild(o),i.checked&&(r.value=i.value)}const a=document.createElement("div");a.style.clear="both",t.appendChild(a),s=t}if(l.options){s.readonly=!0;let e=l.options;"type"===l.bind&&(void 0!==a.currentUser&&null!==a.currentUser||(e=e.filter((e=>"updatedBy"!==e.value&&"createdBy"!==e.value))),(void 0===a.users||null===a.users||a.users&&0===a.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),s.dataSource=e,s.dropDownButtonPosition="right","dataField"!==l.bind&&(s.selectedIndex=0),l.options.length<15?s.dropDownHeight="auto":s.dropDownHeight=300}if(l.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",l.icon,"show","smart-description-button"),r.appendChild(e),s.style.width="calc(100% - 25px)"}if(r.appendChild(s),l.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=l.info,r.appendChild(e),s.style.width="calc(100% - 25px)"}if(e.appendChild(o),o.classList.add("smart-grid-dialog-field"),o.appendChild(n),o.appendChild(r),l.width&&!d[t+1].width){const t=document.createElement("div");t.style.clear="both",e.appendChild(t)}}}}}const r=()=>{const t=parseInt(i.style.width),l=a.offset(a);if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=a.offsetWidth+"px",void(i.style.height=a.offsetHeight+"px");{const e=a.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const o=e.element;if(o){const e=a.offset(o),n=e.left-l.left,d=l.left,r=Math.max(d,n);if(r+t+o.offsetWidth>l.left+a.offsetWidth){const a=r-t+o.offsetWidth;a<0?i.open("center",e.top+o.offsetHeight-l.top):i.open(Math.max(d,a),e.top+o.offsetHeight-l.top)}else i.open(r,e.top+o.offsetHeight-l.top)}else i.classList.add("center"),i.open("center","center")}else if(a._addNewColumn){let e=a._addNewColumn.element,o=a.offset(e),n=o.left-l.left-t+e.offsetWidth,d=l.left,r=Math.max(d,n);a.editing.addNewColumn._addButton&&a.editing.addNewColumn._addButton.classList.contains("show")&&(e=a.editing.addNewColumn._addButton,o=a.offset(a.editing.addNewColumn._addButton),n=o.left-l.left-t+e.offsetWidth,d=l.left,r=Math.max(d,n)),i.open(r,o.top+e.offsetHeight-l.top)}else i.open("center","center"),i.classList.add("center")};r(),i.refresh=()=>{r()}}});
1444
+ Smart.Utilities.Assign("Grid.Dialog",class{_openImagePreviewDialog(e){const t=this,l=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 a=t._dialogImagePreview.querySelector(".images-container");a.innerHTML="";const i=(e,l)=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const a=150+Math.min(850,e.width),i=150+Math.min(650,e.height);t._dialogImagePreview.style.width=a+"px",t._dialogImagePreview.style.height=i+"px",!1!==l&&(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 o=getComputedStyle(t._dialogImagePreview),n=parseInt(o.top),d=parseInt(o.left);(window.offsetWidth<a||window.offsetHeight<i||n<0||d<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%"},o=()=>{const e=t._dialogImagePreview.querySelector(".images-container");let l=-1;return e.querySelectorAll("img").forEach(((e,t)=>{if(e.hasAttribute("active"))return l=t,!0})),l},n=e=>{const l=t._dialogImagePreview.querySelector(".images-container");e&&l.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",""),d.innerHTML=`<img src="${t.src}"/>`;const e=d.querySelector("img");e.onload=()=>{i(e,!1)}}}))};if(l.length>1)for(let t=0;t<l.length;t++){const i=l[t].cloneNode();i.style.width="40px",i.style.height="40px",i.style.cursor="pointer",i.style.borderStyle="solid",i.style.borderWidth="1px",i.style.borderColor="transparent",i.style.borderRadius="var(--smart-border)",i.style.marginTop="10px",i.title=l[t].title||l[t].parentNode.title,l[t].src===e.src&&(i.style.borderColor="var(--smart-primary)",i.setAttribute("active","")),a.appendChild(i),i.onmouseenter=()=>{i.style.borderColor="var(--smart-primary)"},i.onmouseleave=()=>{i.hasAttribute("active")||(i.style.borderColor="transparent")},i.onclick=()=>{n(i)}}const d=t._dialogImagePreview.content.querySelector(".image-preview");d.innerHTML="",d.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=()=>{i(e)},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){if("Escape"===e.key&&t._dialogImagePreview.close(),"ArrowUp"===e.key||"ArrowLeft"===e.key){const t=o();n(l[t-1]),e.stopPropagation(),e.preventDefault()}else if("ArrowDown"===e.key||"ArrowRight"===e.key){const t=o();n(l[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 l=this,a=l._dialogImage||l._createDialog(),i='<span class="smart-grid-icon smart-icon-image show"></span>'+l.localize("dialogImageHeader");if(a.cell||(a.cell=e),a.header.innerHTML=i,a.column=e.column,a.command=t,a.classList.add("smart-grid-image-dialog"),!l._dialogImage){a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),a.onOpen=function(){a.fileUpload.value="",a.input.value="";let e=a.cell.editor.instance.getValue();if("[]"!==e)if(e&&"string"==typeof e&&e.indexOf("http")>=0)a.input.value=JSON.parse(e)[0].value,a.tabs[1].click(),o("input");else{a.tabs[0].click();const t=(e,t)=>{let l=e.split(","),a=l[0].match(/:(.*?);/)[1],i=atob(l[1]),o=i.length,n=new Uint8Array(o);for(;o--;)n[o]=i.charCodeAt(o);return new File([n],t,{type:a})},l=new DataTransfer;"string"==typeof e&&e.indexOf("base64")>=0&&(e=JSON.parse(e)),Array.isArray(e)&&(e.forEach((e=>{l.items.add(t(e.value,e.label))})),a.fileUpload.files=l.files,o())}else a.tabs[0].click()},a.onClose=function(){},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){if(a.tabs[1].classList.contains("active"))a.input.value?e.editor.instance.setValue([{label:a.input.value,value:a.input.value}]):e.editor.instance.setValue([]),l._endCellEdit(a.cell);else{const t=(e,t)=>{var l=new FileReader;l.readAsDataURL(e),l.onload=function(){t(l.result)},l.onerror=function(){t("error")}},i=[];if(a.fileUpload.files.length)for(let o=0;o<a.fileUpload.files.length;o++){const n=a.fileUpload.files[o];t(n,(t=>{"error"===t&&console.log("Image load error"),i.push({value:t,label:n.name}),i.length===a.fileUpload.files.length&&(e.editor.instance.setValue(i),l._endCellEdit(a.cell))}))}else e.editor.instance.setValue([]),l._endCellEdit(a.cell)}a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},l._dialogImage=a,a.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>${l.localize("dialogImageDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${l.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>${l.localize("dialogImageUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${l.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 ${l.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">${l.localize("dialogImageURLUpload")}</smart-button>\n </div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,a.input=a.querySelector("smart-input"),a.dropZone=a.querySelector(".smart-grid-drop-zone"),a.upload=a.querySelector(".title"),a.fileUpload=a.querySelector("input"),a.preview=a.querySelector(".preview"),a.tabs=a.querySelectorAll(".tab"),a.urlZone=a.querySelector(".url-zone"),a.uploadButton=a.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"],i=e=>t.includes(e.type);a.dropZone.ondrop=a.dropZone.dropHere=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;const l=a.column.editor.maxImages||5;for(let l=0;l<e.dataTransfer.items.length;l++)if("file"===e.dataTransfer.items[l].kind){const a=e.dataTransfer.items[l].getAsFile();i(a)&&t++}if(t===e.dataTransfer.files.length||t===l){const t=new DataTransfer;let i=[...e.dataTransfer.files],n=[...a.fileUpload.files];i.length>l&&(i=i.slice(0,5)),n.length>l&&(n=n.slice(0,5)),n.forEach(((e,a)=>{a<l&&t.items.add(e)})),i.forEach(((e,a)=>{a<l&&t.items.add(e)})),a.fileUpload.files=t.files,o()}}else a.fileUpload.files=e.dataTransfer.files,o()},a.dropZone.ondragover=e=>{e.preventDefault()},a.tabs[0].onclick=()=>{a.tabs[0].classList.add("active"),a.tabs[1].classList.remove("active"),a.dropZone.classList.remove("smart-hidden"),a.urlZone.classList.add("smart-hidden"),a.updatePreview()},a.tabs[1].onclick=()=>{a.tabs[0].classList.remove("active"),a.tabs[1].classList.add("active"),a.dropZone.classList.add("smart-hidden"),a.urlZone.classList.remove("smart-hidden"),a.updatePreview("input")},a.uploadButton.onclick=()=>{a.updatePreview("input")};const o=e=>{const t=a.preview,n=a.fileUpload;function d(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 r=()=>{const e=document.createElement("div");return e.classList.add("item"),e.onpointerdown=t=>{const i=e.getBoundingClientRect();if(a.input.value="",t.clientY>=i.bottom-12){if(t.clientX>i.left+i.width/2-13&&t.clientX<i.left+i.width/2+13){e.remove();const t=a.preview.querySelectorAll(".item"),l=new DataTransfer;t.forEach((e=>{l.items.add(e.file)})),n.files=l.files,a.clearButton&&0===t.length&&a.clearButton.classList.remove("show")}}else l._openImagePreviewDialog(e.querySelector("img"))},e},s=()=>{const e=document.createElement("div");e.classList.add("list");const i=document.createElement("div");i.classList.add("smart-grid-icon","show","smart-icon-delete"),i.title=l.localize("clear"),t.appendChild(i),i.onclick=()=>{n.value="",a.input.value="",o()},a.clearButton=i,t.appendChild(e)};if("input"===e){const e=a.input.value;if(e){const t=r();if(s(),e.endsWith("png")||e.endsWith("jpeg")||e.endsWith("jpg")){const l=document.createElement("img");l.src=e,t.appendChild(l)}a.preview.lastChild.appendChild(t)}else{const e=document.createElement("p");e.textContent=l.localize("dialogImageFileUpload"),t.appendChild(e)}}else{const e=n.files;if(0===e.length){const e=document.createElement("p");e.textContent=l.localize("dialogImageFileUpload"),t.appendChild(e)}else{s();const o=new DataTransfer,c=a.column.editor.maxImages||5,m=a.column.editor.maxImageSize||524288;let u=0,p=[];for(const n of e){const e=r();if(u>=c){p.push(n.name);continue}const s=document.createElement("div");if(i(n)){s.textContent=`${n.name}, ${d(n.size)}.`,s.textContent.length>20&&(s.textContent=`${n.name.substring(0,5)}...${n.name.substring(n.name.length-4)}, ${d(n.size)}.`);const a=document.createElement("img");if(a.src=URL.createObjectURL(n),n.size>m){const e=document.createElement("p");e.textContent=l.localize("dialogImageSize",{value:n.name,fileSize:d(m)}),t.appendChild(e);continue}o.items.add(n),e.file=n,e.title=s.textContent,e.appendChild(a),e.appendChild(s)}a.preview.querySelector(".list").appendChild(e),u++}if(p.length>0){const e=document.createElement("p");e.textContent=l.localize("dialogImageCount",{files:p.toString(),fileCount:c}),t.appendChild(e)}n.files=o.files}}};a.updatePreview=o,a.fileUpload.onchange=()=>{if(0===a.fileUpload.files.length&&a._tempFiles)a.fileUpload.files=a._tempFiles;else if(a._tempFiles){const e=new DataTransfer,t=[...a.fileUpload.files];[...a._tempFiles].forEach((t=>{e.items.add(t)})),t.forEach((t=>{e.items.add(t)})),a.fileUpload.files=e.files}o()},a.input.onchange=a.input.onblur=a.input.onkeyup=()=>{a.uploadButton.disabled=!a.input.value||!a.input.value.startsWith("https://")},a.upload.onclick=()=>{a._tempFiles=[];const e=new DataTransfer;[...a.fileUpload.files].forEach((t=>{e.items.add(t)})),a._tempFiles=e.files,a.fileUpload.click()}}a.open(),setTimeout((function(){a.btnConfirm.focus()}),100)}_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}_createDialog(e){const t=this;let l=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(l.modal=e.modal),void 0!==e.screenModal&&(l.screenModal=e.screenModal),l.setAttribute("animation","none"),l.classList.add("smart-window","smart-grid-dialog"),l.style.width="auto"===e.width?e.width:e.width+"px",l.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(l.style.width=e.width),e.height&&"string"==typeof e.height&&(l.style.height=e.height),l.style.left="",l.style.top="",l.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 ',l.querySelector&&l.querySelector(".smart-content")&&(l.content=l.querySelector(".smart-content").firstChild),l.footer=l.querySelector(".smart-footer"),l.header=l.querySelector(".smart-header"),l.btnConfirm=l.querySelector(".smart-confirm-button"),l.btnCancel=l.querySelector(".smart-cancel-button"),l.btnClose=l.querySelector(".smart-close-button"),l.btnNext=l.querySelector(".smart-next-button"),l.btnPrev=l.querySelector(".smart-prev-button");const a=document.createElement("div");return a.classList.add("smart-grid-dialog-overlay"),a.onclick=function(){},l.overlay=a,l.remove=function(){l.parentNode&&l.parentNode.removeChild(l)},l.close=function(){l.classList.remove("open"),delete t._resizeHandling,l.addEventListener("transitionend",l.remove),l.addEventListener("transitioncancel",l.remove),l.modal&&l.overlay.parentNode&&l.overlay.parentNode.removeChild(l.overlay),l.onClose&&l.onClose()},l.open=function(a,i){l.removeEventListener("transitionend",l.remove),l.removeEventListener("transitioncancel",l.remove),document.body.appendChild(l),t._resizeHandling=!1,void 0===a&&(a=e.left),void 0===i&&(i=e.top),requestAnimationFrame((function(){l.classList.add("open");const e=l.querySelector('[bind="name"]');if(e){const t=e.querySelector("smart-input");t&&t.focus()}const o=function(e,a){const i=t.offset(t);switch("center"===e&&"horizontal"===a&&(e="middle"),e){case"top":return i.top;case"bottom":return Math.max(i.top,i.top+t.offsetHeight-l.offsetHeight);case"center":return Math.max(i.top,i.top+t.offsetHeight/2-l.offsetHeight/2);case"left":return i.left;case"middle":return i.left+t.offsetWidth/2-l.offsetWidth/2;case"right":return i.left+t.offsetWidth-l.offsetWidth}return"horizontal"===a?parseInt(e)+i.left:"vertical"===a?parseInt(e)+i.top:"number"==typeof e?e:parseInt(e)};l.style.left=o(a,"horizontal")+"px",l.style.top=o(i,"vertical")+"px",l.setPosition=(e,t)=>{t?l.style.left=o(e,"horizontal")+"px":l.style.top=o(e,"vertical")+"px"},"screenMiddle"===a&&(l.style.left="calc(50% - "+l.offsetWidth/2+"px)"),"screenCenter"===i&&(l.style.top="calc(50% - "+l.offsetHeight/2+"px)")})),l.modal&&(l.screenModal?document.body.appendChild(l.overlay):t.appendChild(l.overlay)),l.onOpen&&l.onOpen()},l}_openAddRowDialog(e,t){const l=this;if(!l.editing.addDialog.enabled)return!1;const a=l._dialogAddRow||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogAddHeader"):l.editing.dialog.header,o=a.content;a.header.innerHTML=i,e.grid=l,void 0===e.index&&(e.index=l.rows.length,l._rowsAdded&&(e.index+=l._rowsAdded.length));const n=e.cells;let d=null,r=0;if(l._cellEditors||(l._cellEditors=[]),!l._dialogAddRow){a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogAddButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogAddButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0},a.onClose=function(){l.editing.dialog.visible=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e={};for(let t=0;t<n.length;t++){const a=n[t],i=l._getEditorValue(a),o=l._getEditorId(a),d=l._cellEditors[o];d&&(i&&i.error?(e[a.column.dataField]=i.value,d.detach()):(e[a.column.dataField]=i,d.detach()))}const i=l._rowsAdded?l._rowsAdded.length:0,o=new Smart.Grid.Row({index:l.rows.length+i,id:Smart.Utilities.Core.createGUID(),grid:l,data:e});a.close(),t(o,0===a.index)},a.onkeydown=function(e){const t=e.key;"Enter"===t?a.btnConfirm.onclick():"Escape"===t&&a.close()},o.classList.add("smart-grid-layout");for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(!t.allowEdit)continue;r%2==0&&(d=document.createElement("div"),d.classList.add("smart-grid-edit-dialog-row"),o.appendChild(d));const a=document.createElement("div");a.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const n=document.createElement("label");n.innerHTML=l.columns[e].label;const s=document.createElement("div");s.classList.add("smart-grid-dialog-editor"),s.setAttribute("editor",t.dataField),s.setAttribute("template",t.editor.template),a.appendChild(i),d.appendChild(a),i.appendChild(n),i.appendChild(s),r++}}a.open(),a.index=e.index;let s=0;for(let e=0;e<n.length;e++){const t=n[e],i=t.column,o=i.dataField,d=a.querySelector("[editor="+o+"]");if(!d)continue;d.innerHTML="";let r="";void 0!==t.value&&(r=t.value),"int64"!==i.dataType&&"number"!==i.dataType&&"int"!==i.dataType&&"float"!==i.dataType||(r=0),"date"===i.dataType&&(r=new Date),"bool"!==i.dataType&&"boolean"!==i.dataType||(r=!1);let c=null;switch(t.editor.template){default:case"custom":c=l._getCustomCellEditor(t);break;case"image":c=l._getImageCellEditor(t);break;case"checkBox":c=l._getCheckBoxCellEditor(t);break;case"autoComplete":c=l._getAutoCompleteCellEditor(t);break;case"dropDownList":c=l._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=l._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=l._getMaskCellEditor(t);break;case"checkInput":c=l._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=l._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=l._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=l._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=l._getDateInputCellEditor(t);break;case"dateRangeInput":c=l._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=l._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=l._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?l._getNumberInputCellEditor(t):l._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(r),0===s&&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 l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)l[t]=e[t]}));else if(e){const l=e,a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in l)a[e]=l[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 l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)l[t]=e[t]}));else if(e){const l=e,a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in l)a[e]=l[e]}}d.appendChild(c.element),c.element.onfocus=()=>{d.setAttribute("focus","")},c.element.onblur=()=>{d.removeAttribute("focus")},s++}l._dialogAddRow=a}_openEditDialog(e,t){const l=this;if(!l.editing.dialog.enabled)return!1;const a=l._dialogEdit||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogEditHeader",{value:l.editing.editRow?e.row.visibleIndex+1:e.column.label}):l.editing.dialog.header,o=a.content;a.header.innerHTML=i,a.row=l.editing.editRow,l.editing.recordNavigation&&a.classList.add("disable-animation");let n=null,d=0;if(void 0!==l._settingsDialogRowId){a.btnPrev.classList.remove("smart-hidden"),a.btnNext.classList.remove("smart-hidden");const e=e=>{const t=l.editing.editRow,i=l._recyclingRows.indexOf(t);let o=e?l._recyclingRows[i+1]:l._recyclingRows[i-1];if(l.grouping.enabled&&l.dataSource.groupBy&&l.dataSource.groupBy.length>0){let t=1;for(;o&&!o.leaf;)o=e?l._recyclingRows[i+t]:l._recyclingRows[i-t],t++}if(o){a.classList.add("disable-animation"),l.editing.recordNavigation=!0;const e=a.querySelector("[focus]");if(e){const t=e.closest(".row"),a=t.closest(".smart-grid-edit-dialog-editors-container");let i=-1;if(a&&(i=[...a.children].indexOf(t)),l.cancelEdit(),l._openRowSettingsDialog(o.id),l._dialogEdit&&i>=0){const e=l._dialogEdit.querySelectorAll(".row")[i];if(e){const t=e.querySelector(".smart-grid-dialog-editor");t.setAttribute("focus",""),t.querySelector(".smart-grid-cell-editor").focus()}}}else l.cancelEdit(),l._openRowSettingsDialog(o.id)}};a.btnNext.onmousedown=t=>{e(!0),t.preventDefault(),t.stopPropagation()},a.btnPrev.onmousedown=t=>{e(!1),t.preventDefault(),t.stopPropagation()}}if(!l._dialogEdit)if(a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0,l._settingsDialogRowId&&a.editorsContent&&a.editorsContent.offsetHeight&&(a.editorsContent.style.maxHeight=a.editorsContent.offsetHeight+40+"px")},a.onClose=function(){l.editing.dialog.visible=!1,a.row&&(a.row.showDetail=!1)},a.btnCancel.onclick=function(){l.cancelEdit()},a.btnClose.onclick=function(){l.cancelEdit()},a.btnConfirm.onclick=function(){if(void 0!==l._settingsDialogRowId){if(l.rowById[l._settingsDialogRowId]){const e=l.editing.editRow;if(!e)return!1;const t=e.cells;let i={};e.element.removeAttribute("error");for(let e=0;e<t.length;e++){const a=t[e],o=l._getEditorValue(a);i[a.column.dataField]=o}const o=l.validateRow(e.id,i);if(Object.keys(o).length>0){let e=!0;for(let i=0;i<t.length;i++){const n=t[i],d=o[n.column.dataField],r=a.querySelector(`[label-for="${n.column.dataField}"]`);if(r&&(r.innerHTML=""),d)for(let t in d){const a=d[t];let i="";if(!a)continue;let o=a[t];"minLength"!==t&&"maxLength"!==t||(o=a[t.toLowerCase()]),i=a.message?a.message:"required"===t||"valueMissing"===t?l.localize("requiredValue",{value:n.column.label}):"min"===t?l.localize("invalidMinValue",{value:n.column.label,min:o.min}):"max"===t?l.localize("invalidMaxValue",{value:n.column.label,max:o.max}):"minLength"===t?l.localize("invalidMinLengthValue",{value:n.column.label,min:o.requiredLength}):"maxLength"===t?l.localize("invalidMaxLengthValue",{value:n.column.label,max:o.requiredLength}):l.localize("invalidValue"),e=!1,r&&(r.innerHTML=i)}}if(!e)return}e.updatedDate=new Date,e.updatedBy=l.currentUser,e.style=a._rowStyle,e.comments=a._rowComments}if(a.columnVisibility){let e=!1;const t=l.columns.canNotify;l.columns.canNotify=!1;for(let t in a.columnVisibility){const i=l.columnByDataField[t];i.visible!==a.columnVisibility[t]&&(i.visible=a.columnVisibility[t],e=!0)}if(l.columns.canNotify=t,e)return l.endEdit(),l.refresh(!1),void(l.dataSource&&l.dataSource.boundHierarchy&&(l.dataSource.refreshHierarchy(),l._refreshRowHierarchy(),l.refresh()))}}l.endEdit(),l.dataSource&&l.dataSource.boundHierarchy&&(l.dataSource.refreshHierarchy(),l._refreshRowHierarchy(),l.refresh())},a.onkeydown=function(e){const t=e.key,a=l.editing.commandKeys;for(let e in a){const i=a[e];if(t===i.key){l._applyCommand(i.command);break}}},l.editing.editRow)if(void 0!==l._settingsDialogRowId)l._applySettingsDialogLayout(a,o,l.editing.editRow);else{o.classList.add("smart-grid-layout");for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(!t.allowEdit)continue;d%2==0&&(n=document.createElement("div"),n.classList.add("smart-grid-edit-dialog-row"),o.appendChild(n));const a=document.createElement("div");a.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const r=l._settingsDialogRowId?document.createElement("div"):document.createElement("label");r.innerHTML=l.columns[e].label;const s=document.createElement("div");s.classList.add("smart-grid-dialog-editor"),s.setAttribute("editor",t.dataField),s.setAttribute("template",t.editor.template),a.appendChild(i),n.appendChild(a),i.appendChild(r),i.appendChild(s),d++}}else{const t=e.column,l=document.createElement("div");l.classList.add("smart-grid-dialog-editor"),l.setAttribute("editor",""),l.setAttribute("template",t.editor.template),o.appendChild(l)}if(a.open(),l.editing.editRow){const l=a.querySelector("[editor="+e.column.dataField+"]");l&&(l.innerHTML="",l.appendChild(t.element),t.element.onfocus=()=>{l.setAttribute("focus","")},t.element.onblur=()=>{l.removeAttribute("focus")})}else{const l=e.column,i=a.querySelector("[editor]");i.innerHTML="",i.setAttribute("template",l.editor.template),i.appendChild(t.element),t.element.onfocus=()=>{i.setAttribute("focus","")},t.element.onblur=()=>{i.removeAttribute("focus")}}l._dialogEdit=a}_refreshCurrentUser(){const e=this,t=e.users;let l=e.currentUser,a=!0,i=!0,o=e.editing.enabled,n=!0;t&&null!==l&&(l=t.find((e=>e.id===l)),l&&(a=!1!==l.allowAdd,i=!1!==l.allowComment,o=o&&!1!==l.allowEdit,n=!1!==l.allowRemove)),e._currentUser={allowAdd:a,allowComment:i,allowEdit:o,allowRemove:n,info:l}}_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,l){const a=this;e.classList.add("smart-grid-dialog-expand-row");const i=e._rowStyle=JSON.parse(JSON.stringify(l._style)),o=e._rowComments=JSON.parse(JSON.stringify(l.comments)),n=[];e.columnVisibility=n;const d=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div");s.appendChild(d),s.appendChild(r),t.appendChild(s),s.classList.add("smart-grid-edit-dialog-layout"),d.classList.add("smart-grid-edit-dialog-editors-container"),r.classList.add("smart-grid-edit-dialog-activity-container");let c=0;for(let e=0;e<a.columns.length;e++){const t=a.columns[e];t.allowEdit&&!1!==t._visible&&c++}c>=8?d.classList.add("many"):d.classList.remove("many"),e.editorsContent=d,e.activityContent=r;const m=document.createElement("div"),u=document.createElement("div");r.appendChild(m),r.appendChild(u);let p=o&&o.length?" ("+o.length+")":"";m.innerHTML=`\n <div class="tabs">\n <div view="details" class="active tab"><div class="tab-label">${a.localize("detailsTab")}</div></div>\n <div view="comments" class="tab"><div class="tab-label">${a.localize("commentsTab")}${p}</div></div>\n <div view="history" class="tab smart-hidden"><div class="tab-label">${a.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">${a.localize("format").replace(":","")}\n <span title="${a.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="${a.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="${a.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="${a.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${a.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${a.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="${a.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="${a.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="${a.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">${a.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments">${a.localize("noComments")}</span></div>\n <div class="footer">\n <smart-text-area hint="${a.localize("comment")}" placeholder="${a.localize("comment")}" class="success underlined"></smart-text-area>\n <smart-button class="success">${a.localize("send")}</smart-button>\n </div>\n </div>\n </div>\n <div class="history-tab smart-hidden">\n <div class="history-layout">\n </div>\n </div>\n `;const g=m.querySelectorAll(".tab");a.storeHistory&&g[g.length-1].classList.remove("smart-hidden"),!a.users||a.users&&0===a.users.length?g[g.length-2].classList.add("smart-hidden"):g[g.length-2].classList.remove("smart-hidden"),m.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),l=m.querySelector(".details-tab"),i=m.querySelector(".comments-tab"),o=m.querySelector(".history-tab");l.classList.add("smart-hidden"),i.classList.add("smart-hidden"),o.classList.add("smart-hidden");for(let e=0;e<g.length;e++)g[e].classList.remove("active");switch(t.classList.add("active"),e){case"details":l.classList.remove("smart-hidden");break;case"comments":i.classList.remove("smart-hidden");break;case"history":o.classList.remove("smart-hidden"),a._refreshHistory()}}};const b=a._getColorInput();m.querySelector(".background").appendChild(b),b.onchange=()=>{i.background=b.value},i.background&&(b.value=i.background);const f=a._getColorInput();m.querySelector(".color").appendChild(f),f.onchange=()=>{i.color=f.value},i.color&&(f.value=i.color);const h=a._getColorInput();m.querySelector(".status").appendChild(h),h.onchange=()=>{i.status=h.value},i.status&&(h.value=i.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=()=>{i.fontFamily=v.value},i.fontFamily?v.value=i.fontFamily:v.selectedIndex=0,m.querySelector(".font-family").appendChild(v);const y=document.createElement("smart-input");y.style.width="auto",y.classList.add("underlined"),y.dropDownButtonPosition="right",y.readonly=!0,y.dropDownHeight="auto",y.dataSource=["-","8px","10px","12px","14px","18px","24px","36px"],y.onchange=()=>{i.fontSize=y.value},i.fontSize?y.value=i.fontSize:y.selectedIndex=0,m.querySelector(".font-size").appendChild(y);const C=m.querySelector(".button-group");C.onclick=e=>{const t=e.target.closest(".formatbtn");let l;t.classList.contains("checked")?(t.classList.remove("checked"),l=!1):(t.classList.add("checked"),l=!0),t.classList.contains("bold")?i.fontWeight=l?"bold":null:t.classList.contains("italic")?i.fontStyle=l?"italic":null:t.classList.contains("underline")&&(i.textDecoration=l?"underline":null)},i.fontWeight?C.children[0].classList.add("checked"):C.children[0].classList.remove("checked"),i.fontStyle?C.children[1].classList.add("checked"):C.children[1].classList.remove("checked"),i.textDecoration?C.children[2].classList.add("checked"):C.children[2].classList.remove("checked"),m.querySelector(".reset-format").onclick=()=>{for(let e=0;e<C.children.length;e++)C.children[e].classList.remove("checked");v.selectedIndex=0,y.selectedIndex=0,f.value="",b.value="",h.value="",i.fontWeight=null,i.fontStyle=null,i.textDecoration=null,i.fontSize=null,i.fontFamily=null};const w=m.querySelector(".comments-header"),A=m.querySelector('[view="comments"]'),x=m.querySelector(".comments-layout smart-text-area"),k=m.querySelector(".comments-layout smart-button"),S=m.querySelector(".comments-layout .footer"),L=m.querySelector(".comments-layout .comments");k.disabled=!0,L.innerHTML=`<span class="no-comments">${a.localize("noComments")}</span>`;const z=()=>{const e=L.querySelector(".no-comments");0===o.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},_=e=>{e.querySelector(".remove-button").onclick=e=>{const t=e.target,i=o.indexOf(t.comment);if(i>-1){const e=o[i];o.splice(i,1),a.$.fireEvent("commentRemove",{id:l.id,value:e}),a.onComment&&a.onComment(l.id,o),t.element.remove();const n=o.length?"("+o.length+")":"";w.innerHTML=A.innerHTML=`${a.localize("comments").replace(":","")} ${n}`}}};for(let e=0;e<o.length;e++){const t=o[e],l=a._createComment(t);_(l),L.appendChild(l)}w.innerHTML=`${a.localize("comments").replace(":","")} ${p}`,z(),x.onfocus=()=>{S.classList.add("focus")},x.onblur=()=>{S.classList.remove("focus")},x.onkeyup=()=>{k.disabled=""===x.value},k.onclick=()=>{if(""===x.value)return;a._refreshCurrentUser();const e={text:x.value,id:function(){const e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()}(),userId:a._currentUser.info?a._currentUser.info.id:-1,time:new Date},t=a._createComment(e);_(t),o.push(e),a.$.fireEvent("commentAdd",{id:l.id,value:e}),a.onComment&&a.onComment(l.id,o),x.value="",k.disabled=!0,z(),L.appendChild(t);const i=o.length?"("+o.length+")":"";w.innerHTML=A.innerHTML=`${a.localize("comments").replace(":","")} ${i}`};for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit||!1===t._visible)continue;const l=document.createElement("div");l.classList.add("smart-grid-edit-dialog-row"),d.appendChild(l);const i=document.createElement("div"),o=a._settingsDialogRowId?document.createElement("div"):document.createElement("label"),r=t.validationRules&&t.validationRules.length>0?"*":"";o.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${a.columns[e].icon} show"></span><label>`+a.columns[e].label+r+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const s=document.createElement("div");s.classList.add("smart-grid-dialog-editor"),s.setAttribute("editor",t.dataField),s.setAttribute("template",t.editor.template);const c=o.querySelector("[toggle]");c.column=t,n[t.dataField]=t.visible,c.title=a.localize("columnMenuItemHide"),c.onclick=()=>{n[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=a.localize("columnMenuItemShow")):(c.classList.add("smart-icon-visibility-on"),c.classList.remove("smart-icon-visibility-off"),c.title=a.localize("columnMenuItemHide"))},t.visible||(c.classList.remove("smart-icon-visibility-on"),c.title=a.localize("columnMenuItemShow")),t.visible?c.classList.add("smart-icon-visibility-on"):c.classList.add("smart-icon-visibility-off"),i.appendChild(o),i.appendChild(s);const m=document.createElement("label");m.classList.add("smart-field-editor-error-label"),m.setAttribute("label-for",t.dataField),i.appendChild(m),l.appendChild(i)}}_refreshHistory(){const e=this,t=e._dialogEdit;if(!t)return;const l=t.querySelector(".history-layout");if(!e.storeHistory)return void l.classList.add("smart-hidden");l.classList.remove("smart-hidden");const a=t.row.history;if(!a)return;let i="\n ";for(let t=a.length-1;t>=0;t--){const l=a[t];let o="";if(e._kanban)o=e._kanban._getHistoryItemLabel(l);else if("created"===l.action)o=e.localize("rowCreated",{value:l.action});else{const t=e.columnByDataField[l.action];o=e.localize("propertyUpdated",{value:t?t.label:l.action})}if(i+='<div class="history-row">',void 0!==l.user){const t=(t=>{const l=t?t.image:null;return{image:l?`background-image: url('${l}');`:"",label:t?t.name||t.id:e.localize("guestUser"),cssClass:l?"image":""}})(e.users.find((e=>e.id===l.user)));i+=`<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(l.date).toString("dd/MM/yyyy hh:mm")}</div></div>`}else i+="<div></div>";if(i+='<div class="history-action">',i+=`<div>${o}</div>`,"created"!==l.action){let t=l.details.oldValue,a=l.details.value;if("user"===l.action){const l=e.users.find((e=>e.id===t||e.id===parseFloat(t))),i=e.users.find((e=>e.id===a||e.id===parseFloat(a)));l?t=l.name:(t="",t||(t=e.localize("unassigned"))),i?a=i.name:(a="",a||(a=e.localize("unassigned")))}if("subtasks"===l.action){const t=l.details.value.filter((e=>e.completed));e._kanban?i+=`<span class="detail smart-truncate">${e._kanban.localize("taskSubtasksCompleted",{value:t.length+"/"+l.details.value.length})}</span>`:i+=`<span class="detail smart-truncate">${e.localize("nullRange",{value:t.length})}</span>`}else{t&&"object"==typeof t&&t instanceof Date&&(t=t.toLocaleString()),a&&"object"==typeof a&&a instanceof Date&&(a=a.toLocaleString());let o=e.columnByDataField[l.action];o||(o=e.columnByDataField["task"+l.action.substring(0,1).toUpperCase()+l.action.substring(1)]),"user"===l.action&&(o=e.columnByDataField.taskUserId);let n="";o&&o.label&&(n='"'+o.label+'"'),o&&"date"===o.dataType&&(t&&"string"==typeof t&&(t=new Date(t).toLocaleString()),a&&"string"==typeof a&&(a=new Date(a).toLocaleString())),i+=t?`<span class="detail smart-truncate">${e.localize("range",{column:n,oldValue:t,newValue:a})}</span>`:`<span class="detail smart-truncate">${e.localize("nullRange",{column:n,oldValue:t,newValue:a})}</span>`}}else i+=`<div>${l.details.value}</div>`;i+="</div>\n </div>"}i+="",l.innerHTML=i}_createComment(e){const t=this,l=t.users.find((t=>t.id===e.userId)),a=document.createElement("div"),i=l?l.name||l.id:t.localize("guestUser"),o=l?l.name:t.localize("guestUser"),n=l.image?l.image:"";if(a.className="comment",a.setAttribute("role","listitem"),a.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${i}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${o}</div>\n <div class="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&&l.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>`,n){const e=a.querySelector(".user-icon");e.style.backgroundImage=`url('${n}')`,e.classList.add("image")}a.comment=e;const d=a.querySelector(".remove-button");return d.comment=e,d.element=a,e.userId!==t._currentUser.info.id&&d.classList.add("smart-visibility-hidden"),a}_openSummaryRowDialog(e){const t=this,l=t._summaryRowDialog||t._createDialog(),a="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(l.header.innerHTML=a,!l.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",l.content.innerHTML="",l.listBox=e}const i=l.listBox;l.summaryValueElement&&l.summaryValueElement.classList.remove("summary-chooser");const o=e.element.querySelector(".summary-value");if(!o)return;o.classList.add("summary-chooser"),l.summaryValueElement=o;let n=[];l.dataField=e.column.dataField,n="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"}],i.dataSource=n,i.style.position="absolute",i.style.visibility="hidden",i.style.height="auto",document.body.appendChild(i);const d=e.column;d.summary&&d.summary.forEach((e=>{i.select(e)}));const r=i.offsetHeight;l.column=d,l.content.appendChild(i),l.classList.add("smart-grid-dialog-summary"),l.header.parentElement.classList.add("smart-hidden"),l.footer.classList.add("smart-hidden"),i.style.visibility="",i.style.position="",i.style.width="100%",t._summaryRowDialog||(l.btnConfirm.innerHTML=t.localize("apply"),l.btnCancel.innerHTML=t.localize("cancel"),l.style.width=l.style.minWidth="120px",l.onOpen=function(){t.editing.dialog.visible=!0},l.onClose=function(){t.editing.dialog.visible=!1,l.summaryValueElement&&l.summaryValueElement.classList.remove("summary-chooser")},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){const e=l.column.summary;l.column.summary=i.selectedValues,t.$.fireEvent("columnSummaryChange",{column:l.column,dataField:d.dataField,oldSummary:[...e],summary:[...l.column.summary]}),l.close(),t._calculateSummary(),t._recycle(!1)},l.confirm=function(){l.btnConfirm.click()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},t._summaryRowDialog=l);const s=e.element,c=t.offset(s),m=t.offset(t);let u=s.offsetWidth+c.left-m.left-120;u<0&&(u=c.left-m.left),l.open(u,c.top-m.top-r-0),setTimeout((function(){l.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const l=this;if(!l.editing.deleteDialog.enabled)return!1;const a=l._dialogDelete||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):l.editing.dialog.header;a.header.innerHTML=i,a.content.innerHTML=l.localize("dialogDeleteContent"),a.row=e,l._dialogDelete||(a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogDeleteButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogDeleteButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0},a.onClose=function(){l.editing.dialog.visible=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){t(a.row),a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},l._dialogDelete=a),a.open(),setTimeout((function(){a.btnConfirm.focus()}),100)}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),l=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:[{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")}],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(l).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(l).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(l).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:"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")}]}_addColumnDialogShowHideEditors(e){const t=this,l=t._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input").getSelectedItem().value,a=t._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),i=t._dialogAddColumn.querySelector('[field-name="kanbanNotes"]');i&&("kanban"!==t.view?i.classList.add("smart-hidden"):i.classList.remove("smart-hidden"));let o=!!e;for(let i=0;i<a.length;i++){const n=a[i],d=n.getAttribute("filter"),r=n.getAttribute("bind"),s=n.parentNode;if(s.classList.add("smart-hidden"),"cellsAlign"!==r||"boolean"!==l&&"image"!==l&&"email"!==l&&"url"!==l&&"collaborator"!==l&&"createdBy"!==l&&"password"!==l&&"phone"!==l&&"createdTime"!==l&&"updatedBy"!==l&&"updatedTime"!==l)if("type"===r&&o)s.classList.add("smart-hidden");else if("allowEdit"!==r||!1!==t.editing.enabled&&"autoNumber"!==l&&"createdBy"!==l&&"updatedBy"!==l&&"createdTime"!==l&&"updatedTime"!==l)if("allowResize"!==r||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==r||!1!==t.filtering.enabled)if("allowSort"!==r||!1!==t.sorting.enabled)if("required"!==r||!1!==t.editing.enabled&&("string"===l||"multiText"===l))if(e&&e.disabledDialogOptions&&e.disabledDialogOptions.length>0&&e.disabledDialogOptions.indexOf(r)>=0)s.classList.add("smart-hidden");else{if(e&&"kanban"===t.view){switch(r){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":s.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===d&&s.classList.remove("smart-hidden")}if("any"!==d)switch(l){default:case"text":"text"===d&&s.classList.remove("smart-hidden"),e&&"any"===e.dataType&&s.classList.add("smart-hidden");break;case"slider":case"number":if("number"===d&&s.classList.remove("smart-hidden"),"unit"===r){s.classList.add("smart-hidden");const e=t._dialogAddColumn.querySelector('[field-name="numberFormat"]'),l=t._dialogAddColumn.querySelector('[field-name="unit"]'),a=e.querySelector("smart-input"),i=()=>{const e=a.getSelectedItem();e&&"unit"===e.value.style?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};e.onchange=()=>{i()},i()}break;case"select":case"multiSelect":d.indexOf("list")>=0&&s.classList.remove("smart-hidden");break;case"collaborator":d.indexOf("collaborator")>=0&&s.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"boolean":break;case"date":{const e=t._dialogAddColumn.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;"date"===d&&s.classList.remove("smart-hidden");const l=e=>{const l=t._dialogAddColumn.querySelector('[field-filter="time"]'),a=t._dialogAddColumn.querySelector('[field-name="dateFormat"]');e?(l.classList.remove("smart-hidden"),a.style.width="50%",a.style.float="left"):(l.classList.add("smart-hidden"),a.style.width="",a.style.float="")},a=e=>{const l=t._dialogAddColumn.querySelector('[field-name="allowTimeFormat"]'),a=l.querySelector(".smart-grid-dialog-editor");e.indexOf("T")>=0?(l.classList.add("smart-hidden"),a.uncheck()):l.classList.remove("smart-hidden")},i=e=>{const l=t._dialogAddColumn.querySelector('[field-name="dateFormatSeparator"]');e?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};if("allowTimeFormat"===r){const e=n.querySelector(".smart-input").value;n.onchange=e=>{l(e)},l(e)}if("dateFormat"===r){const e=n.querySelector(".smart-input").value;n.onchange=e=>{a(e.detail.value)},a(e)}if("dateFormatSeparator"===r){const e=t._dialogAddColumn.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;i(e)}if("allowCustomDateSeparator"===r){e.indexOf("T")>=0&&e.indexOf("-")>0&&n.uncheck();const t=n.querySelector(".smart-input").value;n.onchange=e=>{i(e)},i(t)}a(e);break}}else s.classList.remove("smart-hidden")}else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden")}}_addColumnDialogInitEditors(){const e=this,t=e._dialogAddColumn.editColumn,l=e._getAddColumnDialogTemplate();for(let a in e._addColumnDialogEditors){const i=e._addColumnDialogEditors[a],o=i.querySelector("input"),n=i.querySelector("smart-input");switch(a){case"allowTimeFormat":{const e=i.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 l=i.querySelector(".smart-input");l.value=!1,l.removeAttribute("checked");let a=0;t&&t.cellsFormat&&(t.cellsFormat.indexOf(".")>=0?(l.value=!0,l.setAttribute("checked",""),a=2):(t.cellsFormat.indexOf("M-d-yyyy")>=0||t.cellsFormat.indexOf("d-M-yyyy")>=0||t.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(l.value=!0,l.setAttribute("checked",""),a=1));const o=e._addColumnDialogEditors.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");o.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),o[a].setAttribute("checked",""),o[a].value=!0;break}case"kanban":{const t=i.querySelectorAll(".smart-grid-dialog-boolean-field");for(let l=0;l<t.length;l++)t[l].onchange=t=>{const l=[...t.parentElement.children].indexOf(t),a=t.parentElement.parentElement.previousElementSibling,i=e._dialogAddColumn.querySelector('[field-name="options"]'),o=e._dialogAddColumn.querySelector('[field-name="allowColorItems"]'),n=e._addColumnDialogEditors.name,d=()=>{const t=i.querySelector("smart-sortable");t&&(t._validate(),e._dialogAddColumn&&e._dialogAddColumn.offsetHeight&&e._dialogAddColumn.setPosition("center"))};switch(l){case 0:a.innerHTML=e.localize("kanbanNoneDescription"),o.classList.add("smart-hidden"),i.classList.add("smart-hidden"),n.querySelector("input").value=e.localize("dialogNewColumn"),d();break;case 1:a.innerHTML=e.localize("kanbanBasicDescription"),o.classList.remove("smart-hidden"),i.classList.remove("smart-hidden"),n.querySelector("input").value=e.localize("status"),d()}};break}case"dateFormat":t&&t.cellsFormat?t.cellsFormat.indexOf("M/d/yyyy")>=0?n.selectedIndex=0:t.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?n.selectedIndex=1:t.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?n.selectedIndex=2:t.cellsFormat.indexOf("d/M/yyyy")>=0?n.selectedIndex=3:t.cellsFormat.indexOf("yyyy-MM-dd")>=0?n.selectedIndex=4:t.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(n.selectedIndex=5):n.selectedIndex=0;break;case"timeFormat":t&&t.cellsFormat&&t.cellsFormat.indexOf("HH")>=0&&-1===t.cellsFormat.indexOf("T")?n.selectedIndex=1:n.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!0;t&&t.editor&&t.editor.singleSelect&&(e=!1);const l=i.querySelector(".smart-input");t?e?(l.value=!0,l.setAttribute("checked","")):(l.value=!1,l.removeAttribute("checked")):(l.value=!0,l.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)n.selectedIndex=0;else if("decimal"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)n.selectedIndex=1;else if("percent"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)n.selectedIndex=2;else if("percent"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)n.selectedIndex=3;else if("decimal"===t.editor.numberFormat.style&&"scientific"===t.editor.numberFormat.notation)n.selectedIndex=4;else if("decimal"===t.editor.numberFormat.style&&"engineering"===t.editor.numberFormat.notation)n.selectedIndex=5;else if("currency"===t.editor.numberFormat.style&&"accounting"===t.editor.numberFormat.currencySign)n.selectedIndex=6;else if("unit"===t.editor.numberFormat.style){n.selectedIndex=7;const l=t.editor.numberFormat.unit,a=e._addColumnDialogEditors.unit.querySelector("smart-input");a.dataSource.forEach(((e,t)=>{if(e.value===l)return a.selectedIndex=t,!0}))}else"currency"===t.editor.numberFormat.style?n.selectedIndex=8:"currency"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits&&0===t.editor.numberFormat.minimumFractionDigits&&(n.selectedIndex=9);else n.selectedIndex=0;break;case"allowCheckItems":{const e=i.querySelector(".smart-input");t?t.editor&&!t.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===t[a]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!1,e.setAttribute("checked",""));break}case"allowColorItems":{const e=i.querySelector(".smart-input");t?t.editor&&t.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===t[a]&&(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=i.querySelector(".smart-input"),o=l.find((e=>{if(e.bind===a)return e}));t?t[a]?(e.value=!0,e.setAttribute("checked","")):!1===t[a]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,o&&void 0!==o.value&&(e.value=o.value),e.value&&e.setAttribute("checked",""));break}}if(!t||"options"!==a&&"users"!==a){const t=i.querySelector("smart-sortable");if(t&&t._init)if("users"===a){let l=[];for(let t=0;t<e.users.length;t++)l.push({color:e.users[t].color,label:e.users[t].name,id:e.users[t].id,image:e.users[t].image});t._init(l)}else t._init()}else{const e=i.querySelector("smart-sortable");if(e&&e._init)if(t.editor.singleSelect){const l=t.editor.dataSource.filter((e=>""!==e));e._init(l)}else"multiComboInput"===t.editor.template&&e._init(JSON.parse(JSON.stringify(t.editor.dataSource)))}if(t&&"type"===a?("number"===t.dataType||"int"===t.dataType?n.selectedIndex=3:"date"===t.dataType?n.selectedIndex=7:"bool"!==t.dataType&&"boolean"!==t.dataType||(n.selectedIndex=6),t.editor&&t.editor.template&&n.dataSource.forEach(((e,l)=>{switch(e.value){case"string":"input"===t.editor.template&&(n.selectedIndex=l);break;case"number":"numberInput"===t.editor.template&&(n.selectedIndex=l);break;case"select":"multiComboInput"===t.editor.template&&t.editor.singleSelect&&"tags"===t.template&&(n.selectedIndex=l);break;case"multiSelect":"multiComboInput"!==t.editor.template||t.editor.singleSelect||"tags"!==t.template||(n.selectedIndex=l);break;case"multiText":"textarea"===t.editor.template&&(n.selectedIndex=l);break;case"date":"dateInput"!==t.editor.template&&"dateTimePicker"!==t.editor.template||(n.selectedIndex=l);break;case"checkBox":"checkBox"===t.editor.template&&(n.selectedIndex=l);break;case"slider":"slider"===t.editor.template&&(n.selectedIndex=l);break;case"image":"image"===t.editor.template&&(n.selectedIndex=l);break;case"updatedTime":"updatedTime"===t.template&&(n.selectedIndex=l);break;case"createdTime":"createdTime"===t.template&&(n.selectedIndex=l);break;case"createdBy":"createdBy"===t.template&&(n.selectedIndex=l);break;case"updatedBy":"updatedBy"===t.template&&(n.selectedIndex=l);break;case"collaborator":"collaborator"===t.template&&t.editor&&t.editor.collaborator&&(n.selectedIndex=l);break;case"autoNumber":"autoNumber"===t.template&&(n.selectedIndex=l);break;case"phone":"phone"===t.template&&(n.selectedIndex=l);break;case"password":"password"===t.template&&(n.selectedIndex=l);break;case"url":"url"===t.template&&(n.selectedIndex=l);break;case"email":"email"===t.template&&(n.selectedIndex=l)}}))):"type"===a&&(n.selectedIndex=0),"cellsAlign"===a&&t&&("center"===t.cellsAlign||"middle"===t.cellsAlign?n.selectedIndex=2:"right"===t.cellsAlign&&(n.selectedIndex=1)),!o)continue;"dataField"!==a&&"type"!==a&&"timeFormat"!==a&&"dateFormat"!==a&&"numberFormat"!==a&&"unit"!==a&&"cellsAlign"!==a&&n&&(n.selectedIndex=0),"name"===a&&(n.value=t?t.label:"",n.placeholder=l.find((e=>{if(e.bind===a)return e})).placeholder),"description"===a&&(n.value=t?t.description:"",n.placeholder=l.find((e=>{if(e.bind===a)return e})).placeholder);const d=(e,l)=>{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?(l.value=t.value,!0):void 0))};if("minValue"===a?(o.value=0,d(a,o)):"maxValue"===a?(o.value=100,d(a,o)):"minLength"===a?(o.value=0,d(a,o)):"maxLength"===a&&(o.value=500,d(a,o)),"minDateTime"===a){const e=i.querySelector("smart-date-input");e.value=new Date(1900,0,1),d(a,e)}else if("maxDateTime"===a){const e=i.querySelector("smart-date-input");e.value=new Date(2100,0,1),d(a,e)}}}_createColumnBooleanEditor(e,t,l,a,i){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const o=document.createElement("div");return o.classList.add("smart-input"),o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-check-box-cell-editor"),o.setAttribute("checked",""),o.value=!0,t.width&&(l.style.width=t.width,l.style.float="left"),!1===t.value&&(o.value=!1,o.removeAttribute("checked")),e.appendChild(o),e.getValue=function(){return o.value},e.check=function(){o.setAttribute("checked",""),o.value=!0,e.onchange&&e.onchange(o.value)},e.uncheck=function(){o.removeAttribute("checked"),o.value=!1,e.onchange&&e.onchange(o.value)},e.toggle=function(){!0!==o.value&&!1!==o.value&&null!==o.value&&(o.value=!1),null===o.value?o.value=!1:o.value=!o.value,!1===o.value?o.removeAttribute("checked"):o.setAttribute("checked",o.value?"":"indeterminate"),e.onchange&&e.onchange(o.value)},e.onclick=i.onclick=()=>{e.toggle()},a.appendChild(l),l.classList.add("smart-grid-dialog-boolean-field"),l.appendChild(e),l.appendChild(i),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,l=e._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),a=[];let i,o,n={};for(let t=0;t<l.length;t++){const a=l[t],i=a.querySelector(".smart-input"),o=a.getAttribute("bind"),d=a.parentElement;if("kanban"!==o)if("minLength"!==o&&"maxLength"!==o&&"minValue"!==o&&"maxValue"!==o&&"minDateTime"!==o&&"maxDateTime"!==o)if("options"!==o&&"users"!==o){if("allowEdit"===o&&d.classList.contains("smart-hidden"))i.value=!1;else if("required"===o&&d.classList.contains("smart-hidden"))i.value=!1;else if("dateFormatSeparator"===o){const e=a.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:n.dateFormatSeparatorType="/";break;case 1:n.dateFormatSeparatorType="-";break;case 2:n.dateFormatSeparatorType="."}break}}i&&(i.getSelectedItem?n[o]=i.getSelectedItem().value:n[o]=i.value)}else{const t=[],l=a.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),i=a.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<l.length;e++){const a=l[e],o={label:a.value,value:a.getAttribute("data-item-value"),id:parseInt(a.getAttribute("data-id")),color:i[e].value};o.color=i[e].value,t.push(o)}if("users"===o&&"collaborator"===n.type){e.users||(e.users=[]);for(let l=0;l<t.length;l++){const a=t[l],i=e.users.find((e=>e.id===a.id));i&&(i.name=a.label,i.color=a.color)}}n[o]=t}else n[o]=i.getValue();else{const e=a.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:n.kanban="blank";break;case 1:n.kanban="basic"}break}}}t.data=n;let d={},r={},s="";if(i=n.minDateTime,o=n.maxDateTime,"date"===n.type){d={template:"dateInput",min:i,max:o};let e=!1;"-"!==n.dateFormat&&(s=n.dateFormat,n.allowCustomDateSeparator&&(s.indexOf("/")>=0?s=s.replaceAll("/",n.dateFormatSeparatorType):s.indexOf("-")>=0?s=s.replaceAll("-",n.dateFormatSeparatorType):s.indexOf(".")>=0&&(s=s.replaceAll(".",n.dateFormatSeparatorType))),n.dateFormat.indexOf("T")>=0&&(d.template="dateTimePicker",d.dropDownDisplayMode="auto",d.formatString=s),e=!0),d.autoOpen=!0,n.allowTimeFormat&&"-"!==n.timeFormat&&(e&&(s+=" "),s+=n.timeFormat,d.template="dateTimePicker",d.dropDownDisplayMode="auto",d.formatString=s),a.push({type:"minDate",value:i}),a.push({type:"maxDate",value:o})}else if("number"===n.type||"slider"===n.type)i=parseInt(n.minValue),o=parseInt(n.maxValue),"unit"===n.numberFormat.style&&(n.numberFormat.unit=n.unit),d={template:"number"===n.type?"numberInput":"slider",min:i,max:o,numberFormat:n.numberFormat},r={Intl:{NumberFormat:n.numberFormat}},s="d",a.push({type:"min",value:i}),a.push({type:"max",value:o});else if("boolean"===n.type)d={template:"checkBox"};else if("image"===n.type)d={template:"image"};else if("select"===n.type||"multiSelect"===n.type){let e=n.options;if("select"===n.type)if(t.editColumn&&!t.editColumn.editor.allowEmptyItem)e=n.options;else{let t=!1;for(let e=0;e<n.options.length;e++)if(""===n.options[e].label){t=!0,n.options[e].value="";break}e=t?n.options:[""].concat(n.options)}d={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:n.allowColorItems,autoOpen:!0,pills:!n.allowCheckItems,singleSelect:"select"===n.type,dataSource:e}}else if("collaborator"===n.type){let t=n.users;n.allowMultipleCollaborators||(t=[""].concat(n.users));for(let l=0;l<e.users.length;l++)t.forEach((t=>{t.value===e.users[l].id&&(t.image=e.users[l].image,t.id=e.users[l].id)}));d={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:n.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!n.allowCheckItems,singleSelect:!n.allowMultipleCollaborators,dataSource:t}}else"multiText"===n.type?(i=n.minLength,o=n.maxLength,d={template:"textarea",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o})):"password"===n.type?(i=n.minLength,o=n.maxLength,d={template:"password",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o})):"phone"===n.type?d={template:"phone",required:n.required}:(i=n.minLength,o=n.maxLength,d={template:"input",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o}));let c="string";switch(n.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=n.name,t.description=n.description,t.showDescriptionButton=!0,t.allowResize=n.allowResize,t.allowSort=n.allowSort,t.allowFilter=n.allowFilter,t.allowEdit=n.allowEdit,t.align=t.cellsAlign=n.cellsAlign,t.cellsFormat=s;const l=t._editorId?t._editorId:"",i=d.template+"_"+t.dataField+l;e._cellEditors[i]&&delete e._cellEditors[i];let o=!0;"list"!==t.template&&"dropDownList"!==t.template||(o=!1),"autoNumber"!==t.template&&"createdBy"!==t.template&&"updatedBy"!==t.template&&"createdTime"!==t.template&&"updatedTime"!==t.template||(o=!1),t.editor&&t.editor.template.indexOf("custom")>=0&&(o=!1),t.editor&&t.editor.disabledDialogOptions&&(o=!1),o&&(t.editor=d,t.template=e._getColumnTemplateByType(n.type)),t.formatSettings=r,t._isDirty=!0,n.required&&a.push({type:"required"}),t.validationRules=a,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,n),e._recycle(!0),t.refresh(),t._isDirty=!1}else{let t=[];"number"===c&&(t=["sum"]);const l=new Smart.Grid.Column({label:n.name,description:n.description,dataField:n.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:n.allowResize,allowSort:n.allowSort,allowFilter:n.allowFilter,allowEdit:n.allowEdit,showDescriptionButton:!0,dataType:c,editor:d,summary:t,template:e._getColumnTemplateByType(n.type),formatSettings:r,cellsAlign:n.cellsAlign,align:n.cellsAlign,cellsFormat:s,visibleIndex:e.columns.length-1,grid:e});"autoNumber"===l.template&&(l.autoGenerated=!0,t=[]),n.required&&(a.push({type:"required"}),l.validationRules=a),e.columns.push(l),e._refreshHeaderBar(),e.$.fireEvent("closeColumnDialog",{dataField:l.dataField})}}_openAddColumnDialog(e,t,l){const a=this,i=a._dialogAddColumn||a._createDialog(a.editing.addColumnDialog),o=e?a.localize("dialogEditColumn",{value:e.label}):a.localize("dialogAddColumn"),n=i.querySelector(".smart-footer").querySelector(".smart-stack-layout");i.classList.add("smart-grid-dialog-add-column"),i.type=e?"customize":"add",i.editColumn=e||null,e&&e.element&&e.element.setAttribute("focus",""),n.classList.remove("right"),n.classList.add("center"),a._cellEditors||(a._cellEditors=[]);const d=a._getAddColumnDialogTemplate();if(i.header.innerHTML=o,i.header.parentElement.classList.add("smart-hidden"),i.callback=l,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===a.view&&(i.header.innerHTML=a.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"))),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),"kanban"===a.view?i.btnCancel.classList.add("smart-hidden"):i.btnCancel.classList.remove("smart-hidden"),a.cancelEdit(),!a._dialogAddColumn){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){a._addColumnDialogInitEditors(),a._addColumnDialogShowHideEditors(i.editColumn),a.$.fireEvent("openColumnDialog",{dataField:i.editColumn?i.editColumn.dataField:null});const e=a.offset(i);if(e.top+i.offsetHeight>window.innerHeight){const t=e.top+i.offsetHeight-window.innerHeight;i.style.maxHeight=Math.max(250,i.offsetHeight-t)+"px",i.style.minHeight="250px"}else i.style.maxHeight="",i.style.minHeight=""},i.onClose=function(){i.editColumn&&i.editColumn.element&&i.editColumn.element.removeAttribute("focus"),i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){a._confirmAddColumnDialog(),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&"kanban"!==a.view&&(i.result=!1,i.close())},a._dialogAddColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e),a._addColumnDialogEditors=[];for(let t=0;t<d.length;t++){const l=d[t],o=document.createElement("div"),n=document.createElement("label");n.innerHTML=l.label;const r=document.createElement("div");if(r.classList.add("smart-grid-dialog-editor","add-column"),r.innerHTML="",r.setAttribute("filter",l.filter),r.setAttribute("bind",l.bind),o.setAttribute("field-name",l.bind),o.setAttribute("field-filter",l.filter),a._addColumnDialogEditors[l.bind]=r,"type"===l.bind&&r.addEventListener("change",(()=>{a._addColumnDialogShowHideEditors(i.editColumn);const e=a._dialogAddColumn.querySelector('[bind="type"]'),t=e.querySelector("smart-input"),l=t.getSelectedItem().value;let o="smart-icon-font";switch(l){case"multiText":o="smart-icon-fontsize";break;case"image":o="smart-icon-image";break;case"number":o="smart-icon-number";break;case"select":o="smart-icon-sort-down";break;case"multiSelect":o="smart-icon-list-unordered";break;case"boolean":o="smart-icon-check-squared";break;case"date":o="smart-icon-calendar";break;case"createdTime":case"updatedTime":o="smart-icon-clock";break;case"createdBy":case"updatedBy":case"collaborator":o="smart-icon-user";break;case"slider":o="smart-icon-number";break;case"autoNumber":o="smart-icon-list-ordered";break;case"url":o="smart-icon-link";break;case"email":o="smart-icon-mail";break;case"password":o="smart-icon-lock";break;case"phone":o="smart-icon-phone"}if(a._addColumnDialogEditors.type.icon=o,a._addColumnDialogEditors.name.querySelector("input").setAttribute("data-label",t.value),e.firstElementChild.className="smart-grid-icon show smart-description-button "+o,"select"===l||"multiSelect"===l){const e=a._addColumnDialogEditors.options.querySelector("smart-sortable");e&&e._validate&&e._validate()}else i.btnConfirm.disabled=!1})),"boolean"===l.type)a._createColumnBooleanEditor(r,l,o,e,n);else{if("label"===l.type){e.appendChild(o),o.classList.add("smart-grid-dialog-field"),o.appendChild(n);const t=document.createElement("div");t.style.height="10px",o.appendChild(t);continue}{let s=document.createElement("smart-input");if(s.classList.add("underlined","edit-column-input"),s.style.width="100%",s.style.height="30px",l.width&&(o.style.width=l.width,o.style.float="left"),"items"===l.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>'+a.localize("commandBarAddRow")+"</span></div>";const t=document.createElement("div");t.classList.add("smart-grid-add-column-dialog-color-panel");const o=document.createElement("smart-sortable");o.disableMode="manual",o.dragMode="handle",o.handleVisibility="visible",o.handlePosition="left";const n=()=>{if(i.btnConfirm.disabled=!1,0===t.offsetHeight)return;let e=0;t.querySelectorAll(".edit-column-input").forEach((t=>{""===t.value&&e++,e>1&&(i.btnConfirm.disabled=!0)}))},d=(t,i,d,r)=>{const s=document.createElement("div"),c=a._getColorInput(),m=document.createElement("div"),u=document.createElement("smart-input"),p=a._addColumnDialogEditors.allowColorItems;if(void 0!==d)u.setAttribute("data-id",d),u.setAttribute("data-item-value",d);else{const e=o.querySelectorAll(".smart-sortable-item").length;u.setAttribute("data-id",e),u.setAttribute("data-item-value",e)}return void 0!==r&&u.setAttribute("data-item-value",r),c.disabled=!p.querySelector(".smart-input").value,m.className="smart-grid-icon smart-icon-close show",m.setAttribute("role","button"),m.setAttribute("aria-label","button"),u.classList.add("underlined","edit-column-input"),u.style.width="100%",u.style.height="30px",u.required=!0,t&&(u.value=t),i&&(c.value=i),u.onkeyup=u.onchange=u.onblur=t=>{n(),"Enter"===t.key&&(u.parentElement.nextElementSibling||(e.click(),n()))},s.appendChild(c),s.appendChild(u),"users"!==l.bind&&s.appendChild(m),m.onclick=()=>{s.remove(),o.updateItems(),n()},s.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),s};o._init=e=>{o.clearContent(),e&&(e.forEach(((e,t)=>{const l=void 0!==e.id?e.id:t,a=d(e.label,e.color,l,e.value);o.$.container.appendChild(a)})),o.updateItems())},o._validate=n,a._addColumnDialogEditors.allowColorItems.onchange=e=>{let t=a._addColumnDialogEditors.allowColorItems.parentElement.nextElementSibling,l=null;for(;t;){if("options"===t.getAttribute("field-name")){l=t;break}t=t.nextElementSibling}l&&l.querySelectorAll("smart-color-input").forEach((t=>{t.disabled=!e}))},t.appendChild(o),"users"!==l.bind&&(t.appendChild(e),e.onclick=()=>{const e=d();o.$.container.appendChild(e),o.updateItems(),e.querySelector(".edit-column-input").focus(),i.btnConfirm.disabled=!0}),s=t,r.style.height="auto"}else if("number"===l.type)s=document.createElement("smart-number-input"),s.classList.add("underlined"),s.style.width="100%",s.style.height="30px","minValue"===l.bind?(s.value=0,s.min=-9999999,s.max=9999999):"maxValue"===l.bind?(s.value=1e6,s.min=-9999999,s.max=9999999):"minLength"===l.bind?s.value=0:"maxLength"===l.bind&&(s.value=500);else if("datetime"===l.type)s=document.createElement("smart-date-input"),s.classList.add("underlined"),s.style.width="100%",s.style.height="30px","minDateTime"===l.bind?s.value=new Date(1900,0,1):"maxDateTime"===l.bind&&(s.value=new Date(2100,0,1));else if("radio"===l.type){const e=(e,t,l)=>{const a=document.createElement("div"),i=document.createElement("label"),o=document.createElement("div");return i.innerHTML=e,o.classList.add("smart-input"),o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-check-box-cell-editor"),t&&o.setAttribute("checked",""),o.value=void 0!==t&&t,r.appendChild(o),a.onclick=function(){if(o.value=!0,!1===o.value?o.removeAttribute("checked"):o.setAttribute("checked",o.value?"":"indeterminate"),a.onchange&&a.onchange(a),o.value){const e=o.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),o.value=!0,o.setAttribute("checked",o.value?"":"indeterminate"),e.value=l}},a.appendChild(o),a.appendChild(i),a.classList.add("smart-grid-dialog-boolean-field"),a.setAttribute("template","checkBox"),a.setAttribute("editor",""),a},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),r.classList.add("radio-group");for(let a=0;a<l.options.length;a++){const i=l.options[a],o=e(i.label,i.checked);if(l.columns){const e=100/l.columns;o.style.width=e+"%",o.style.float="left"}t.appendChild(o),i.checked&&(r.value=i.value)}const a=document.createElement("div");a.style.clear="both",t.appendChild(a),s=t}if(l.options){s.readonly=!0;let e=l.options;"type"===l.bind&&(void 0!==a.currentUser&&null!==a.currentUser||(e=e.filter((e=>"updatedBy"!==e.value&&"createdBy"!==e.value))),(void 0===a.users||null===a.users||a.users&&0===a.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),s.dataSource=e,s.dropDownButtonPosition="right","dataField"!==l.bind&&(s.selectedIndex=0),l.options.length<15?s.dropDownHeight="auto":s.dropDownHeight=300}if(l.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",l.icon,"show","smart-description-button"),r.appendChild(e),s.style.width="calc(100% - 25px)"}if(r.appendChild(s),l.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=l.info,r.appendChild(e),s.style.width="calc(100% - 25px)"}if(e.appendChild(o),o.classList.add("smart-grid-dialog-field"),o.appendChild(n),o.appendChild(r),l.width&&!d[t+1].width){const t=document.createElement("div");t.style.clear="both",e.appendChild(t)}}}}}const r=()=>{const t=parseInt(i.style.width),l=a.offset(a);if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=a.offsetWidth+"px",void(i.style.height=a.offsetHeight+"px");{const e=a.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const o=e.element;if(o){const e=a.offset(o),n=e.left-l.left,d=l.left,r=Math.max(d,n);if(r+t+o.offsetWidth>l.left+a.offsetWidth){const a=r-t+o.offsetWidth;a<0?i.open("center",e.top+o.offsetHeight-l.top):i.open(Math.max(d,a),e.top+o.offsetHeight-l.top)}else i.open(r,e.top+o.offsetHeight-l.top)}else i.classList.add("center"),i.open("center","center")}else if(a._addNewColumn){let e=a._addNewColumn.element,o=a.offset(e),n=o.left-l.left-t+e.offsetWidth,d=l.left,r=Math.max(d,n);a.editing.addNewColumn._addButton&&a.editing.addNewColumn._addButton.classList.contains("show")&&(e=a.editing.addNewColumn._addButton,o=a.offset(a.editing.addNewColumn._addButton),n=o.left-l.left-t+e.offsetWidth,d=l.left,r=Math.max(d,n)),i.open(r,o.top+e.offsetHeight-l.top)}else i.open("center","center"),i.classList.add("center")};r(),i.refresh=()=>{r()}}});
1445
1445
 
1446
1446
  /***/ }),
1447
1447
 
1448
1448
  /***/ 7422:
1449
1449
  /***/ (() => {
1450
1450
 
1451
- (()=>{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.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){const o=e=>{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)};!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;"cell"===i.editing.mode?i._beginCellEdit(o):"row"===i.editing.mode&&i._beginRowEdit(e,o),i.$.fireEvent("beginEdit",{id:e.id,dataField:n.dataField,row:e,column:n,cell:o,value:o.value})}_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();return 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,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._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,s,n)}))}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._onRowUpdated&&t._onRowUpdated(i.row.index,i.row,i.row.data)}))}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.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),e.onRowUpdate(t.index,t,o,l,(function(o){o?i():e.cancelEdit(),e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),n.parentNode.removeChild(n),e.endUpdate(),e.onRowUpdated&&e.onRowUpdated(t.index,t,t.data)}))}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.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){t._applyCommand(l.command),"Enter"===i&&e&&(e.stopPropagation(),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",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.onscroll=function(){c()},a.onkeydown=function(e){a._key=e.key,"Escape"===e.key&&(n.parentNode.contains(n)&&n.parentNode.removeChild(n),t.editing.editCell&&t.cancelEdit()),("Tab"===e.key||"Enter"===e.key&&e.shiftKey)&&(o.value=a.value,t.editing.editCell?t.endEdit():a.blur(),e.preventDefault(),e.stopPropagation())},n.classList.add("smart-grid-text-area-dialog"),n.appendChild(r),document.body.appendChild(n),setTimeout((function(){Smart.Utilities.Core.isMobile||a.select(),c()}),50),c(),n.style.top=t._offsetTop(d)+"px",n.style.left=t._offsetLeft(d)+"px",n.style.width=d.offsetWidth+"px",t.grouping.enabled&&e.column._treeColumn){const e=d.parentNode.parentNode;n.style.top=t._offsetTop(e)+"px",n.style.left=t._offsetLeft(e)+"px",n.style.width=e.offsetWidth+"px"}a.onblur=()=>{"Escape"!==a._key&&(o.value=l.popupTextArea.value),o.focus();try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}},n.appendChild(o);return t._cellEditors[i]={element:n,focus:function(){l.click()},blur:function(){},setValue:function(e){o.value=e,l.popupTextArea&&(l.popupTextArea.value=o.value)},getValue:function(){const e=o.value;return l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode?(o.value=l.popupTextArea.value,o.value):e},attach:function(){o.addEventListener("keydown",a)},detach:function(){if(o.removeEventListener("keydown",a),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode){o.value=l.popupTextArea.value;try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}}},t._cellEditors[i]}_getColorInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=t._getColorInput();t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-color-input-cell-editor"),n.dropDownWidth=50,n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.rightToLeft=!0);const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(e){n.value=e},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("input");t._applyCellEditorUserSettings(n,e),e.editor.min&&(n.minLength=e.editor.min),e.editor.max&&(n.maxLength=e.editor.max),n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-input-cell-editor"),n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.style.direction="rtl");const o=function(i){if("keydown"===i.type)return"number"!==e.column.dataType&&"int"!==e.column.dataType&&"float"!==e.column.dataType||t.editing.editColumn||i.key.match(/[0-9]/)||"-"===i.key||1!==i.key.length?void t._handleEditKeyDown(i):(i.preventDefault(),void i.stopPropagation())},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(t){if(!e.column.rowHeaderColumn||t){if("number"===e.column.dataType||"int"===e.column.dataType||"float"===e.column.dataType){if(""===t)return;if(t&&!t.toString().match(/[0-9]/)&&"-"!==t)return}n.value=t}else n.value=e.editor.row.visibleIndex+1},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_applyCellEditorUserSettings(e,t){for(let i in t.editor)"template"!==i&&("list"!==i?"onInit"!==i&&"onRender"!==i&&(e[i]=t.editor[i]):e.setAttribute(i,t.editor[i]));if(t.editor.settings)for(let i in t.editor.settings)e[i]=t.editor.settings[i]}_getCheckInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-check-input")}_getMultiInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-multi-input")}_getMultiComboInputCellEditor(e){const t=this._getAutoCompleteCellEditor(e,"smart-multi-combo-input");return"tags"===e.column.template&&(t.getValue=()=>{const e=t.element.selectedItems;if(e&&0===e.length)return"";let i=[];for(let t=0;t<e.length;t++){const n=e[t];"string"==typeof n?i.push(n):i.push(n.value)}return i.toString()},t.setValue=e=>{if(e&&e.indexOf("{")>=0||e&&e.indexOf("[")>=0)t.element.selectedItems=JSON.parse(e);else if(e&&e.indexOf(",")>=0)if(e=e.split(",").map((e=>e.trim())),t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{for(let n=0;n<e.length;n++){const o=e[n];("string"==typeof t&&""+t===o||t&&void 0!==t.label&&""+t.value===o)&&i.push(t)}})),t.element.selectedItems=i}else t.element.selectedItems=e;else if(t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{("string"==typeof t&&""+t===e||t&&void 0!==t.label&&""+t.value===e)&&i.push(t)})),t.element.selectedItems=i}else t.element.value=e},t.focus=function(){if(Smart.Utilities.Core.isMobile)return;const e=t.element;setTimeout((()=>{t.element.readonly?t.element.focus():e&&e.select&&e.select()}),50)}),t}_getAutoCompleteCellEditor(e,t){const i=this,n=i._getEditorId(e);if(i._cellEditors[n]&&e.column.editor.isDirty&&(delete e.column.editor.isDirty,delete i._cellEditors[n]),!i._cellEditors[n]){let o=document.createElement("smart-input");t&&(o=document.createElement(t)),i._applyCellEditorUserSettings(o,e),o.readonly&&(o.dropDownButtonPosition="right");const l=function(e){o.opened||"keydown"!==e.type||i._handleEditKeyDown(e)};o.rightToLeft=i.rightToLeft,o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-auto-complete-cell-editor");const a=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{o&&o.select&&o.select()}),50)},d=function(e){e&&1===e.length&&o.readonly||(o.value=e)},r=function(){return o.value},s=function(){o&&o.close&&(o.value="",o.close(),o.removeEventListener("keydown",l))},c=function(){},u=function(){o.addEventListener("keydown",l)};i._cellEditors[n]={element:o,focus:a,blur:c,setValue:d,getValue:r,attach:u,detach:s}}if(!e.editor.dataSource&&!e.editor.isInitialized){const t=i.getVisibleRows(),o=[];for(let n=0;n<t.length;n++){let l=i.dataSource[t[n].index];if(l){if(l=l[e.column.dataField],!l)continue;-1===o.indexOf(l)&&o.push(l)}}i._cellEditors[n].element.dataSource=o}return i._cellEditors[n]}_getDateRangeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-range-input");n.dropDownButtonPosition="right",n.dropDownAppendTo="body",n.autoClose=!0,n.selectionMode="default",n.rightToLeft=t.rightToLeft,n.timepicker=!0,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},d=function(){return n._performSelect(),n.selectedDates},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getDateTimePickerCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-time-picker");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,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)}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){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))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"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,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,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,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,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,value:e.value})}}}_onCellDoubleClick(e,t){const i=this;i.editing.enabled&&("doubleClick"!==i.editing.action||i.editing.isEditing||e.column.autoGenerated||("cell"===i.editing.mode?i._beginCellEdit(e,t):"row"===i.editing.mode&&i._beginRowEdit(e.row,e,t)))}_onRowClick(){}_onRowDoubleClick(){}beginEdit(e,t){const i=this,n=i.rowById[e];n&&i._beginEdit(n,t)}cancelEdit(){const e=this;if(e.editing.isEditing){if(e._errorOverlay){if(e._errorOverlay.remove(),e._errorMessage.remove(),e.editing.editCell&&(e.editing.editCell.error=""),e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){t[e].error=""}e.editing.editRow.element.removeAttribute("error"),e.editing.editRow.error=null}e._isUpdating=!1}if(e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){const i=t[e],n=i.element;0===e&&i.row.element.removeAttribute("edit"),n&&(n.removeAttribute("editor"),n.removeAttribute("error"),n.content.innerHTML=""),i.isEditing=!1}e.editing.editRow=null}else e.editing.editCell?(e.editing.editCell.row.element.removeAttribute("edit"),e.editing.editCell.row.element.removeAttribute("error"),e.editing.editCell.element.removeAttribute("editor"),e.editing.editCell.element.removeAttribute("error"),e.editing.editCell.element.content.innerHTML="",e.editing.editCell.isEditing=!1,e.editing.editCell=null):e.editing.editColumn&&e._cancelColumnEdit();e.editing.dialog.visible&&e.editing.dialog.enabled&&e._dialogEdit.close(),e.editing.isEditing=!1,e._recycle(!1),e.editing.commandColumn.visible&&e.refresh(),e.$.fireEvent("cancelEdit"),e.focus()}}removeRow(e,t){return this.deleteRow(e,t)}deleteRow(e,t){const i=this;if(e&&Array.isArray(e)){if(i.onRowRemove){if(!1===i.onRowRemove(e))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))}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)}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]}getColumnProperty(e,t){const i=this.columnByDataField[e];if(i)return i[t]}setColumnProperty(e,t,i){const n=this.columnByDataField[e];n&&(n[t]=i)}getCellValue(e,t){const i=this.rowById[e],n=this.columnByDataField[t];if(!i||!n)return;return i.getCell(t).value}setCellValue(e,t,n,o){const l=this,a=l.rowById[e],d=l.columnByDataField[t];if(!a||!d)return!1;let r=[];if(d.validationRules&&d.validationRules.length>0&&(r=((e,t)=>{let n=[];for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}return n})(d.validationRules,n),Object.keys(r).length>0))return!1;const s=()=>{l.beginUpdate();const e=a.getCell(t);l._setCellUndoRedo(e,e.value,n),e.value=n,l.endUpdate(),o&&o(a)};if(l.dataSource&&l.dataSource.virtualDataSource){l.dataSource.id?a[l.dataSource.id]=e:a.id||(a.id=e);const i={};for(let e=0;e<l.columns.length;e++){const o=l.columns[e],d=a.getCell(o.dataField);i[o.dataField]=d.value,o.dataField===t&&(i[o.dataField]=n)}l._editInfo={row:i},l._virtualDataRequest("update",(function(e){e&&s(),l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility()}))}else s()}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}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},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[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()}))):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)}}}_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;if(e._fireEndEdit=!0,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(),t&&(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;let a=null;e.storeHistory&&(a=e._stringifyRow(o));const d=void 0!==n.value?n.value:"";if(t=e._endCellEdit(),t&&n.value!==d&&(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory)){const t=e._stringifyRow(o);e._updateRowHistory(o,a,t)}}else e.editing.editColumn&&(i=null,l=e.editing.editColumn,t=e._endColumnEdit());return 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,value:n?n.value:l?l.label:null}),e.summaryRow.visible&&t&&(e.editing.isEditing=!1,e._calculateSummary(),e._recycle(!1)),e._refreshDataFilters(),t}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})();
1451
+ (()=>{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.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){const o=e=>{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)};!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,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();return 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,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._onCellUpdated&&t._onCellUpdated(i.row.index,i.row,i.column,i.row.data,s,n)}))}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._onRowUpdated&&t._onRowUpdated(i.row.index,i.row,i.row.data)}))}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.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),e.onRowUpdate(t.index,t,o,l,(function(o){o?i():e.cancelEdit(),e.appearance.displayLoadingIndicator=!1,e._setLoadingIndicatorVisibility(),n.parentNode.removeChild(n),e.endUpdate(),e.onRowUpdated&&e.onRowUpdated(t.index,t,t.data)}))}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){t._applyCommand(l.command),"Enter"===i&&e&&(e.stopPropagation(),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",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.onscroll=function(){c()},a.onkeydown=function(e){a._key=e.key,"Escape"===e.key&&(n.parentNode.contains(n)&&n.parentNode.removeChild(n),t.editing.editCell&&t.cancelEdit()),("Tab"===e.key||"Enter"===e.key&&e.shiftKey)&&(o.value=a.value,t.editing.editCell?t.endEdit():a.blur(),e.preventDefault(),e.stopPropagation())},n.classList.add("smart-grid-text-area-dialog"),n.appendChild(r),document.body.appendChild(n),setTimeout((function(){Smart.Utilities.Core.isMobile||a.select(),c()}),50),c(),n.style.top=t._offsetTop(d)+"px",n.style.left=t._offsetLeft(d)+"px",n.style.width=d.offsetWidth+"px",t.grouping.enabled&&e.column._treeColumn){const e=d.parentNode.parentNode;n.style.top=t._offsetTop(e)+"px",n.style.left=t._offsetLeft(e)+"px",n.style.width=e.offsetWidth+"px"}a.onblur=()=>{"Escape"!==a._key&&(o.value=l.popupTextArea.value),o.focus();try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}},n.appendChild(o);return t._cellEditors[i]={element:n,focus:function(){l.click()},blur:function(){},setValue:function(e){o.value=e,l.popupTextArea&&(l.popupTextArea.value=o.value)},getValue:function(){const e=o.value;return l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode?(o.value=l.popupTextArea.value,o.value):e},attach:function(){o.addEventListener("keydown",a)},detach:function(){if(o.removeEventListener("keydown",a),l.textAreaEditorDialog&&l.textAreaEditorDialog.parentNode){o.value=l.popupTextArea.value;try{l.textAreaEditorDialog.parentNode&&l.textAreaEditorDialog.parentNode.removeChild(l.textAreaEditorDialog)}catch(e){l.error=e}}}},t._cellEditors[i]}_getColorInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=t._getColorInput();t._applyCellEditorUserSettings(n,e),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-color-input-cell-editor"),n.dropDownWidth=50,n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.rightToLeft=!0);const o=function(e){"keydown"!==e.type||t._handleEditKeyDown(e)},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(e){n.value=e},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_getInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("input");t._applyCellEditorUserSettings(n,e),e.editor.min&&(n.minLength=e.editor.min),e.editor.max&&(n.maxLength=e.editor.max),n.classList.add("smart-input"),n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-input-cell-editor"),n.autocomplete="off",n.style.direction="",t.rightToLeft&&(n.style.direction="rtl");const o=function(i){if("keydown"===i.type)return"number"!==e.column.dataType&&"int"!==e.column.dataType&&"float"!==e.column.dataType||t.editing.editColumn||i.key.match(/[0-9]/)||"-"===i.key||1!==i.key.length?void t._handleEditKeyDown(i):(i.preventDefault(),void i.stopPropagation())},l=function(){Smart.Utilities.Core.isMobile||setTimeout((function(){n.select()}),50)},a=function(){},d=function(t){if(!e.column.rowHeaderColumn||t){if("number"===e.column.dataType||"int"===e.column.dataType||"float"===e.column.dataType){if(""===t)return;if(t&&!t.toString().match(/[0-9]/)&&"-"!==t)return}n.value=t}else n.value=e.editor.row.visibleIndex+1},r=function(){return n.value},s=function(){n.removeEventListener("keydown",o)},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:a,getValue:r,setValue:d,attach:c,detach:s}}return t._cellEditors[i]}_applyCellEditorUserSettings(e,t){for(let i in t.editor)"template"!==i&&("list"!==i?"onInit"!==i&&"onRender"!==i&&(e[i]=t.editor[i]):e.setAttribute(i,t.editor[i]));if(t.editor.settings)for(let i in t.editor.settings)e[i]=t.editor.settings[i]}_getCheckInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-check-input")}_getMultiInputCellEditor(e){return this._getAutoCompleteCellEditor(e,"smart-multi-input")}_getMultiComboInputCellEditor(e){const t=this._getAutoCompleteCellEditor(e,"smart-multi-combo-input");return"tags"===e.column.template&&(t.getValue=()=>{const e=t.element.selectedItems;if(e&&0===e.length)return"";let i=[];for(let t=0;t<e.length;t++){const n=e[t];"string"==typeof n?i.push(n):i.push(n.value)}return i.toString()},t.setValue=e=>{if(e&&e.indexOf("{")>=0||e&&e.indexOf("[")>=0)t.element.selectedItems=JSON.parse(e);else if(e&&e.indexOf(",")>=0)if(e=e.split(",").map((e=>e.trim())),t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{for(let n=0;n<e.length;n++){const o=e[n];("string"==typeof t&&""+t===o||t&&void 0!==t.label&&""+t.value===o)&&i.push(t)}})),t.element.selectedItems=i}else t.element.selectedItems=e;else if(t.element.readonly){let i=[];t.element.dataSource.forEach((t=>{("string"==typeof t&&""+t===e||t&&void 0!==t.label&&""+t.value===e)&&i.push(t)})),t.element.selectedItems=i}else t.element.value=e},t.focus=function(){if(Smart.Utilities.Core.isMobile)return;const e=t.element;setTimeout((()=>{t.element.readonly?t.element.focus():e&&e.select&&e.select()}),50)}),t}_getAutoCompleteCellEditor(e,t){const i=this,n=i._getEditorId(e);if(i._cellEditors[n]&&e.column.editor.isDirty&&(delete e.column.editor.isDirty,delete i._cellEditors[n]),!i._cellEditors[n]){let o=document.createElement("smart-input");t&&(o=document.createElement(t)),i._applyCellEditorUserSettings(o,e),o.readonly&&(o.dropDownButtonPosition="right");const l=function(e){o.opened||"keydown"!==e.type||i._handleEditKeyDown(e)};o.rightToLeft=i.rightToLeft,o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-auto-complete-cell-editor");const a=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{o&&o.select&&o.select()}),50)},d=function(e){e&&1===e.length&&o.readonly||(o.value=e)},r=function(){return o.value},s=function(){o&&o.close&&(o.value="",o.close(),o.removeEventListener("keydown",l))},c=function(){},u=function(){o.addEventListener("keydown",l)};i._cellEditors[n]={element:o,focus:a,blur:c,setValue:d,getValue:r,attach:u,detach:s}}if(!e.editor.dataSource&&!e.editor.isInitialized){const t=i.getVisibleRows(),o=[];for(let n=0;n<t.length;n++){let l=i.dataSource[t[n].index];if(l){if(l=l[e.column.dataField],!l)continue;-1===o.indexOf(l)&&o.push(l)}}i._cellEditors[n].element.dataSource=o}return i._cellEditors[n]}_getDateRangeInputCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-range-input");n.dropDownButtonPosition="right",n.dropDownAppendTo="body",n.autoClose=!0,n.selectionMode="default",n.rightToLeft=t.rightToLeft,n.timepicker=!0,t._applyCellEditorUserSettings(n,e);const o=function(e){n.opened||"keydown"!==e.type||t._handleEditKeyDown(e)};n.classList.add("smart-grid-cell-editor"),n.classList.add("smart-grid-date-time-picker-cell-editor");const l=function(){Smart.Utilities.Core.isMobile||setTimeout((()=>{n.select()}),50)},a=function(e){n.value=e},d=function(){return n._performSelect(),n.selectedDates},r=function(){n.value="",n.close(),n.removeEventListener("keydown",o)},s=function(e){const i=n.getAttribute("aria-controls");if(i&&n.opened){const n=t.getBoundingRect(document.getElementById(i));e.pageX<n.left||e.pageX>n.right||e.pageY<n.top||e.pageY>n.bottom||e.preventDefault()}},c=function(){n.addEventListener("keydown",o)};t._cellEditors[i]={element:n,focus:l,blur:s,setValue:a,getValue:d,attach:c,detach:r}}return t._cellEditors[i]}_getDateTimePickerCellEditor(e){const t=this,i=t._getEditorId(e);if(!t._cellEditors[i]){const n=document.createElement("smart-date-time-picker");n.calendarButton=!0,n.dropDownAppendTo="body",n.autoClose=!0,n.dropDownDisplayMode="calendar",n.rightToLeft=t.rightToLeft,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)}else if(e.column.cellsFormat.indexOf("f")>=0||e.column.cellsFormat.indexOf("n")>=0){i={style:"decimal"};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);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){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))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"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,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,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,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,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,value:e.value})}}}_onCellDoubleClick(e,t){const i=this;i.editing.enabled&&("doubleClick"!==i.editing.action||i.editing.isEditing||e.column.autoGenerated||("cell"===i.editing.mode?i._beginCellEdit(e,t):"row"===i.editing.mode&&i._beginRowEdit(e.row,e,t)))}_onRowClick(){}_onRowDoubleClick(){}beginEdit(e,t){const i=this,n=i.rowById[e];n&&i._beginEdit(n,t)}cancelEdit(){const e=this;if(e.editing.isEditing){if(e._errorOverlay){if(e._errorOverlay.remove(),e._errorMessage.remove(),e.editing.editCell&&(e.editing.editCell.error=""),e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){t[e].error=""}e.editing.editRow.element.removeAttribute("error"),e.editing.editRow.error=null}e._isUpdating=!1}if(e.editing.editRow){const t=e.editing.editRow.cells;for(let e=0;e<t.length;e++){const i=t[e],n=i.element;0===e&&i.row.element.removeAttribute("edit"),n&&(n.removeAttribute("editor"),n.removeAttribute("error"),n.content.innerHTML=""),i.isEditing=!1}e.editing.editRow=null}else e.editing.editCell?(e.editing.editCell.row.element.removeAttribute("edit"),e.editing.editCell.row.element.removeAttribute("error"),e.editing.editCell.element.removeAttribute("editor"),e.editing.editCell.element.removeAttribute("error"),e.editing.editCell.element.content.innerHTML="",e.editing.editCell.isEditing=!1,e.editing.editCell=null):e.editing.editColumn&&e._cancelColumnEdit();e.editing.dialog.visible&&e.editing.dialog.enabled&&e._dialogEdit.close(),e.editing.isEditing=!1,e._recycle(!1),e.editing.commandColumn.visible&&e.refresh(),e.$.fireEvent("cancelEdit"),e.focus()}}removeRow(e,t){return this.deleteRow(e,t)}deleteRow(e,t){const i=this;if(e&&Array.isArray(e)){if(i.onRowRemove){if(!1===i.onRowRemove(e))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))}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)}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]}getColumnProperty(e,t){const i=this.columnByDataField[e];if(i)return i[t]}setColumnProperty(e,t,i){const n=this.columnByDataField[e];n&&(n[t]=i)}getCellValue(e,t){const i=this.rowById[e],n=this.columnByDataField[t];if(!i||!n)return;return i.getCell(t).value}setCellValue(e,t,n,o){const l=this,a=l.rowById[e],d=l.columnByDataField[t];if(!a||!d)return!1;let r=[];if(d.validationRules&&d.validationRules.length>0&&(r=((e,t)=>{let n=[];for(let o of e)switch(o.type){case"min":n.min=i.min(t,o.value);break;case"max":n.max=i.max(t,o.value);break;case"minLength":n.minLength=i.minLength(t,o.value);break;case"maxLength":n.maxLength=i.maxLength(t,o.value);break;case"minDate":n.minDate=i.minDate(t,o.value);break;case"maxDate":n.maxDate=i.maxDate(t,o.value);break;case"required":n.required=i.required(t);break;case"requiredTrue":n.requiredTrue=i.requiredTrue(t);break;case"pattern":n.pattern=i.pattern(t,o.value);break;case"email":n.email=i.email(t);break;case"null":n.null=i.null(t)}return n})(d.validationRules,n),Object.keys(r).length>0))return!1;const s=()=>{l.beginUpdate();const e=a.getCell(t);l._setCellUndoRedo(e,e.value,n),e.value=n,l.endUpdate(),o&&o(a)};if(l.dataSource&&l.dataSource.virtualDataSource){l.dataSource.id?a[l.dataSource.id]=e:a.id||(a.id=e);const i={};for(let e=0;e<l.columns.length;e++){const o=l.columns[e],d=a.getCell(o.dataField);i[o.dataField]=d.value,o.dataField===t&&(i[o.dataField]=n)}l._editInfo={row:i},l._virtualDataRequest("update",(function(e){e&&s(),l.appearance.displayLoadingIndicator=!1,l._setLoadingIndicatorVisibility()}))}else s()}setRowData(e,t){this.updateRow(e,t,null)}getRowData(e){const t=this.rowById[e];if(!t)return null;const i=JSON.parse(JSON.stringify((e=>{const t={};for(let i in e)"leaf"!==i&&"$"!==i&&"parent"!==i&&"history"!==i&&"comments"!==i&&"style"!==i&&(t[i]=e[i]);return t})(t.data)));return delete i.$,i}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},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[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()})):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)}}}_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&&(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:"";if(t=e._endCellEdit(),d=c,a=s,t&&n.value!==c&&(o.updatedDate=new Date,o.updatedBy=e.currentUser,e.storeHistory)){const t=e._stringifyRow(o);e._updateRowHistory(o,s,t)}}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,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}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})();
1452
1452
 
1453
1453
  /***/ }),
1454
1454
 
@@ -1462,7 +1462,7 @@ Smart.Utilities.Assign("Grid.Export",class{exportData(t,e){const o=this,a=new Sm
1462
1462
  /***/ 884:
1463
1463
  /***/ (() => {
1464
1464
 
1465
- 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])),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()}}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._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=!1;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||"and";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)}});
1465
+ 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}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._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 c=document.createElement("label");c.innerHTML=0===t?l.localize("dialogFilterMinLabel"):l.localize("dialogFilterMaxLabel");const u=document.createElement("div");u.classList.add("smart-grid-dialog-editor"),u.setAttribute("editor",i.dataField),u.setAttribute("template",i.editor.template),a.appendChild(d),r.appendChild(a),d.appendChild(c),d.appendChild(u),o++,u.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=u.querySelector("input");f.onchange=()=>{s()},l._handleFilterNumberCellEditor(e,u,(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(),c=l.offset(l);let u=d.left+window.pageXOffset-c.left,f=d.bottom+l.layout.rowMinHeight+window.pageYOffset-c.top,m=Math.max(i.offsetWidth,314);u+m>c.left+l.offsetWidth&&(u=d.left+d.width+window.pageXOffset-c.left-m),e.column.filterRowMenu&&e.column.filterRowMenu.classList.contains("open")&&l._closeMenu(e.column.filterRowMenu),i.open(u,f)}});
1466
1466
 
1467
1467
  /***/ }),
1468
1468
 
@@ -1476,7 +1476,7 @@ Smart.Utilities.Assign("Grid.Filter",class{addFilter(e,t,l){const i=this,a=i.col
1476
1476
  /***/ 7333:
1477
1477
  /***/ (() => {
1478
1478
 
1479
- 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}_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.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()}}removeGroupByCommand(e){this.removeGroup(e.dataField)}groupByCommand(e){this.dataSource&&this.addGroup(e.dataField)}sortAscCommand(e){this.sortBy(e.dataField,"asc")}sortDescCommand(e){this.sortBy(e.dataField,"desc")}removeSortCommand(e){this.sortBy(e.dataField,null)}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)}_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)}}_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=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){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)},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))}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))}_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}))}}if(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),"none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"),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:"",m=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:m},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++,"columnMenuItemFilter"!==o||e.allowFilter||l++,"columnMenuItemRemoveFilter"!==o||e.allowFilter||l++,"columnMenuItemGroupBy"!==o||e.allowGroup||l++,"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||e.allowSort&&t.sorting.enabled||l++)}return!!(t.filtering.enabled&&t.filtering.filterMenu.visible&&"none"!==e.filterMenuMode&&Smart.FilterPanel||Smart.Menu&&!(l>=i))}_filterMenuItemsVisibility(e){const t=this,n=(t.menu.parentElement&&(t.enableShadowDOM||t.isInShadowDOM)?t.menu.firstElementChild.shadowRoot:t.menu).querySelectorAll("smart-menu-item"),l=e.menuItems||t.columnMenu.dataSource;let i=0;for(let o in l){const a=n[i++],r=l[o];if(a.disabled=!r.enabled,a.classList.remove("smart-hidden"),"columnMenuItemDelete"!==o||e.allowDelete)if("columnMenuItemHide"!==o||e.allowHide){if("columnMenuItemRemoveSort"===o&&(e.sortOrder?a.disabled=!1:a.disabled=!0),("columnMenuItemSortAsc"===o&&"asc"===e.sortOrder||"columnMenuItemSortDesc"===o&&"desc"===e.sortOrder)&&(a.disabled=!0),!0===r.visible)a.classList.remove("smart-hidden");else if(!1===r.visible)a.classList.add("smart-hidden");else if("auto"===r.visible){if("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(!1===t.filtering.enabled?a.classList.add("smart-hidden"):((t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("filter")>=0&&a.classList.remove("smart-hidden"),e.filtered||"columnMenuItemRemoveFilter"!==o||a.classList.add("smart-hidden"))),"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");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n<0}"columnMenuItemFilter"!==o||e.allowFilter||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"))}}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._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()}}}});
1479
+ 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}_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.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()}}removeGroupByCommand(e){this.removeGroup(e.dataField)}groupByCommand(e){this.dataSource&&this.addGroup(e.dataField)}sortAscCommand(e){this.sortBy(e.dataField,"asc")}sortDescCommand(e){this.sortBy(e.dataField,"desc")}removeSortCommand(e){this.sortBy(e.dataField,null)}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)}_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)}}_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))}_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}))}}if(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),"none"!==e.filterMenuMode&&t.filtering.filterMenu.visible&&Smart.FilterPanel?t._filterContainer.classList.remove("smart-hidden"):t._filterContainer.classList.add("smart-hidden"),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:"",m=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:m},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++,"columnMenuItemFilter"!==o||e.allowFilter||l++,"columnMenuItemRemoveFilter"!==o||e.allowFilter||l++,"columnMenuItemGroupBy"!==o||e.allowGroup||l++,"columnMenuItemSortAsc"!==o&&"columnMenuItemSortDesc"!==o&&"columnMenuItemRemoveSort"!==o||e.allowSort&&t.sorting.enabled||l++)}return!!(t.filtering.enabled&&t.filtering.filterMenu.visible&&"none"!==e.filterMenuMode&&Smart.FilterPanel||Smart.Menu&&!(l>=i))}_filterMenuItemsVisibility(e){const t=this,n=(t.menu.parentElement&&(t.enableShadowDOM||t.isInShadowDOM)?t.menu.firstElementChild.shadowRoot:t.menu).querySelectorAll("smart-menu-item"),l=e.menuItems||t.columnMenu.dataSource;let i=0;for(let o in l){const a=n[i++],r=l[o];if(a.disabled=!r.enabled,a.classList.remove("smart-hidden"),"columnMenuItemDelete"!==o||e.allowDelete)if("columnMenuItemHide"!==o||e.allowHide){if("columnMenuItemRemoveSort"===o&&(e.sortOrder?a.disabled=!1:a.disabled=!0),("columnMenuItemSortAsc"===o&&"asc"===e.sortOrder||"columnMenuItemSortDesc"===o&&"desc"===e.sortOrder)&&(a.disabled=!0),!0===r.visible)a.classList.remove("smart-hidden");else if(!1===r.visible)a.classList.add("smart-hidden");else if("auto"===r.visible){if("columnMenuItemFilter"!==o&&"columnMenuItemRemoveFilter"!==o||(!1===t.filtering.enabled?a.classList.add("smart-hidden"):((t.filtering.filterMenu.visible||t.filtering.filterRow.visible)&&a.classList.add("smart-hidden"),t.header.visible&&t.header.buttons.indexOf("filter")>=0&&a.classList.remove("smart-hidden"),e.filtered||"columnMenuItemRemoveFilter"!==o||a.classList.add("smart-hidden"))),"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");const n=t.dataSource.groupBy.indexOf(e.dataField);a.disabled=n<0}"columnMenuItemFilter"!==o||e.allowFilter||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"))}}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._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()}}}});
1480
1480
 
1481
1481
  /***/ }),
1482
1482
 
@@ -1504,14 +1504,14 @@ Smart.Utilities.Assign("Grid.Resize",class{autoSizeRows(e){const t=this,o=e||t._
1504
1504
  /***/ 1193:
1505
1505
  /***/ (() => {
1506
1506
 
1507
- 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.selected=!0)):t.selected&&t.grid&&(t.grid._selection.rows[t.id]=!0),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){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 r=(e,t,a)=>{if(!a||!t||t.autoGenerated)return 0;i.__autoHeightRows[t.dataField]||(i.__autoHeightRows[t.dataField]=[]);let r=""+e.data[t.dataField];"date"===t.dataType&&e.data[t.dataField]&&(r=""+e.data[t.dataField].toLocaleString());let n=r.length;e._templatesHeight&&e._templatesHeight[t.dataField]&&(n=e._templatesHeight[t.dataField]);const o=i.__autoHeightRows[t.dataField][n],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;e.canNotify=!1,a.cell.row=e,"function"==typeof t.template?(a.content.textContent=e.data[t.dataField],e._templatesHeight&&e._templatesHeight[t.dataField]&&(i=e._templatesHeight[t.dataField])):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][n]=d};for(let t=0;t<i._frozenNearColumns.length;t++)r(e,i._frozenNearColumns[t],a.children[0].children[t]);for(let t=0;t<i._frozenFarColumns.length;t++)r(e,i._frozenFarColumns[t],a.children[2].children[t]);for(let t=0;t<a.children[1].children.length;t++)r(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._handleExpandCollapse(!0)}collapse(){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);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:!1===i&&l.grid._selection.rows[l.id]&&delete l.grid._selection.rows[l.id],!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,r=i._frozenFarColumns,n=document.createElement("div"),o=document.createElement("div"),d=document.createElement("div"),s=document.createDocumentFragment(),c=document.createDocumentFragment(),h=document.createDocumentFragment();i.rightToLeft?(o.classList.add("far","smart-grid-cell-container"),n.classList.add("center","smart-grid-cell-container"),d.classList.add("near","smart-grid-cell-container")):(o.classList.add("near","smart-grid-cell-container"),n.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,n.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<r.length;t++){const i=r[t],l=e.getCell(i).createElement();h.appendChild(l)}for(let i=0;i<l.length;i++){const a=l[i],r=a.column;if(!a.parentNode||!r)break;const n=e.getCell(r).createElement();r&&r._treeColumn&&(t.toggleButton=n.toggleButton),s.appendChild(n)}o.appendChild(c),n.appendChild(s),d.appendChild(h);const g=document.createElement("div");g.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(n),t._rowFragment.appendChild(d),t._rowFragment.appendChild(g),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 r={row:l,id:l.id};t&&(r.originalEvent=t.originalEvent),a.$.fireEvent(e?"rowExpand":"rowCollapse",r);const n=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||n)a.rows.canNotify=!1,l.expanded=e,a.rows.canNotify=!0,l.data.expanded=e,n&&(l.data._loaded=!0,a._virtualDataRequest("expand")),a._toggledRow=null,a._refresh(),n&&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",r),e.element.rowContainer.removeEventListener("transitioncancel",r),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()},r=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",r),i.rowContainer.addEventListener("transitioncancel",r),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",r),i.rowContainer.addEventListener("transitioncancel",r),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 r=i.editing.addNewRow.label;r.indexOf("{{")>=0&&(r=i.localize("addNewRow")),l.innerHTML="<smart-grid-cell><div>"+r+"</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,r=e=>a._style&&a._style[e]?a._style[e]:a.style[e];r("backgroundColor")===l.background&&r("fontFamily")===l.fontFamily&&r("fontSize")===l.fontSize&&r("fontStyle")===l.fontStyle&&r("textDecoration")===l.textDecoration&&r("fontWeight")===l.fontWeight&&r("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&&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 r="{{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=r,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,r=l.detailTemplate||i.rowDetail.template;if(r.startsWith("#")&&(r=document.querySelector(r)),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(r instanceof HTMLTemplateElement){const t=r.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>"+r.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"),r=i.rowById[a];l.getAttribute("data-rendered")||(l.setAttribute("data-rendered",!0),r.element=l,r.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 r=parseFloat(i.$.columnNearContainer.style.width),n=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");s.classList.remove("smart-hidden"),c.classList.remove("smart-hidden"),s.style.width!==r+"px"&&(s.style.width=r+"px"),d.style.width!==n+"px"&&(d.style.width=n+"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===r&&s.classList.add("smart-hidden"),r>0&&(parseInt(r),parseInt(i._autoGeneratedColumnsNearWidth)),o>0&&parseInt(o)===parseInt(i._autoGeneratedColumnsFarWidth)&&c.classList.add("border-collapse");for(let l=0;l<i._frozenNearColumns.length;l++){const a=i._frozenNearColumns[l];let r=e.children[0].children[l];r||(r=t.getCell(a).createElement(),e.children[0].appendChild(r)),!1!==a.visbile&&e._renderCell(t,a,r)}for(let l=0;l<i._frozenFarColumns.length;l++){const a=i._frozenFarColumns[l];let r=e.children[2].children[l];r||(r=t.getCell(a).createElement(),e.children[2].appendChild(r)),!1!==a.visbile&&e._renderCell(t,a,r)}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],r=a.column;if(!a.parentNode||!r){if(a&&!r){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}continue}let n=e.children[1].children[l];n||(a.column||(a.column=r),n=t.getCell(r).createElement(),e.children[1].appendChild(n)),a.classList.contains("smart-visibility-hidden")?n.classList.add("smart-visibility-hidden"):(n.classList.remove("smart-visibility-hidden"),e._renderCell(t,r,n))}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 r=i.editing.addNewColumn.visible?i._addNewColumn.width:0;t.style.width=l.width-a.width-r+"px",t.style.left=a.width+"px",i.selection.enabled?(t.content.innerHTML=i.localize("addNewRowAlt"),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&&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()}});
1507
+ 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){t.data.comments&&(t.comments=t.data.comments),t.data.rowStyle&&(t.style=t._style=e.rowStyle);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 n=t.element;if(e||(e=t),e&&(t.data=e.data),!n)return t.height;i.__autoHeightRows||(i.__autoHeightRows=[]);const a=(e,t,n)=>{if(!n||!t||t.autoGenerated)return 0;i.__autoHeightRows[t.dataField]||(i.__autoHeightRows[t.dataField]=[]);let a=""+e.data[t.dataField];"date"===t.dataType&&e.data[t.dataField]&&(a=""+e.data[t.dataField].toLocaleString());let r=a.length;e._templatesHeight&&e._templatesHeight[t.dataField]&&(r=e._templatesHeight[t.dataField]);const o=i.__autoHeightRows[t.dataField][r],d=o||function(e){n.style.height="auto",t.cellsWrap?n.content.classList.add("wrap"):n.content.classList.add("nowrap");let i=0;if(e&&t)if(t.template){const l=e.canNotify;e.canNotify=!1,n.cell.row=e,"function"==typeof t.template?(n.content.textContent=e.data[t.dataField],e._templatesHeight&&e._templatesHeight[t.dataField]&&(i=e._templatesHeight[t.dataField])):n._setTemplate(e.data[t.dataField]||"",t.template,n.content),e.canNotify=l}else if("date"===t.dataType){const i=n.cell.getFormattedValue(e.data[t.dataField],t.cellsFormat);n.content.textContent=i}else n.content.textContent=e.data[t.dataField];let l=n.offsetHeight;return"function"==typeof t.template&&i>0&&(l=i),n.style.height="",n.content.classList.remove("wrap"),n.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++)a(e,i._frozenNearColumns[t],n.children[0].children[t]);for(let t=0;t<i._frozenFarColumns.length;t++)a(e,i._frozenFarColumns[t],n.children[2].children[t]);for(let t=0;t<n.children[1].children.length;t++)a(e,i._columnElements[t].column,n.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._handleExpandCollapse(!0)}collapse(){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||n(t)},n=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,n=i._frozenNearColumns,a=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 n=null;for(let e=0;e<l.length;e++)if(l[e].classList.contains("smart-grid-command-item")){n=l[e];break}if(n){const l=n.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<n.length;t++){const i=n[t],l=e.getCell(i).createElement();c.appendChild(l)}for(let t=0;t<a.length;t++){const i=a[t],l=e.getCell(i).createElement();g.appendChild(l)}for(let i=0;i<l.length;i++){const n=l[i],a=n.column;if(!n.parentNode||!a)break;const r=e.getCell(a).createElement();a&&a._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,n=l.grid;if(!l.allowToggle)return null;n._toggledRow=l;let a={row:l,id:l.id};t&&(a.originalEvent=t.originalEvent),n.$.fireEvent(e?"rowExpand":"rowCollapse",a);const r=n.dataSource.virtualDataSourceOnExpand&&e&&!0!==l.data._loaded;if(e?n.dataSource._expandedRowIds[l.data.$.id]=!0:delete n.dataSource._expandedRowIds[l.data.$.id],!n.appearance.allowRowToggleAnimation||r)n.rows.canNotify=!1,l.expanded=e,n.rows.canNotify=!0,l.data.expanded=e,r&&(l.data._loaded=!0,n._virtualDataRequest("expand")),n._toggledRow=null,n._refresh(),r&&n.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,n.$.content.style.transition="",e.element.rowContainer.innerHTML="",e.element.rowContainer.classList.add("smart-hidden"),e.element.rowContainer.removeEventListener("transitionend",a),e.element.rowContainer.removeEventListener("transitioncancel",a),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"),n._refresh()},a=function(e){const l=n._toggledRow;i._toggleTimer=null,n._toggledRow=null,!l||"transform"!==e.propertyName&&"height"!==e.propertyName||setTimeout((()=>{t(l)}),50)};if(i._toggleTimer){clearTimeout(i._toggleTimer);const e=n._toggledRow;n._toggledRow=null,t(e)}i._toggleTimer=setTimeout((()=>{const t=function(){!function(){const e=n._toggledRow;n._refresh(),n._refreshRowHierarchy();let t=0;for(let e=0;e<n.rowHierarchy.length;e++){const i=n.rowHierarchy[e];let l=i.parent;for(;l;)l.id===n._toggledRow.id&&(t+=i.height),l=l.parent}const i=n._scrollView.scrollTop,l=n._contentHeight-(e.cellHeight+e.top-i);e.expandHeight=Math.min(l,t),e.height=e.cellHeight+e.expandHeight}(),n._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"),n._autoHeight&&(n.$.content.style.height=parseInt(n.$.content.style.height)-l.expandHeight+"px"),setTimeout((function(){i.toggleButton&&(i.toggleButton.classList.add("smart-animate"),i.toggleButton.setAttribute("toggled","")),i.rowContainer.addEventListener("transitionend",a),i.rowContainer.addEventListener("transitioncancel",a),n._autoHeight&&(n.$.content.style.transition="0.25s height ease-in-out",n.$.content.style.height=parseInt(n.$.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",n._autoHeight&&(n.$.content.style.height=parseInt(n.$.content.style.height)-l.expandHeight+"px",n.$.content.style.transition="",n.$.content.style.height=parseInt(n.$.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",""),n._autoHeight&&(n.$.content.style.transition="0.25s height ease-in-out",n.$.content.style.height=parseInt(n.$.content.style.height)-l.expandHeight+"px"),i.rowContainer.addEventListener("transitionend",a),i.rowContainer.addEventListener("transitioncancel",a),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,n=new Smart.Grid.Cell(t,i.columns[0],i);t.visible?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden");let a=i.editing.addNewRow.label;a.indexOf("{{")>=0&&(a=i.localize("addNewRow")),l.innerHTML="<smart-grid-cell><div>"+a+"</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=n,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 n=i.firstElementChild,a=e=>n._style&&n._style[e]?n._style[e]:"backgroundColor"===e&&null===l.background&&""===n.style[e]||null===l[e]&&""===n.style[e]?null:n.style[e];a("backgroundColor")===l.background&&a("fontFamily")===l.fontFamily&&a("fontSize")===l.fontSize&&a("fontStyle")===l.fontStyle&&a("textDecoration")===l.textDecoration&&a("fontWeight")===l.fontWeight&&a("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&&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,n=i.appearance.alternationEnd>0?i.appearance.alternationEnd:1/0;if(!(i.appearance.alternationCount<=0)&&(e.removeAttribute("alternation-index"),t.visibleIndex>=l&&t.visibleIndex<=n)){const n=(t.visibleIndex-l)%i.appearance.alternationCount;e.setAttribute("alternation-index",n)}}_openRowDetailDialog(e){const t=this,i=t.row.grid,l=t.row;if(!i.rowDetail.dialog.enabled||!l.showDetail)return!1;const n=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&&n.row!==l)return void(l.showDetail=!1);const a="{{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?(n.header.innerHTML=a,n.content.innerHTML="",n.content.style.width="100%",n.content.style.height="100%",n.row=l,n.querySelector(".smart-footer").classList.add("smart-hidden"),i._dialogRowDetail||(n.setAttribute("tabindex",0),n.modal=!0,n.btnConfirm.innerHTML=i.localize("dialogRowDetailButtonConfirm"),n.btnCancel.innerHTML=i.localize("dialogRowDetailButtonCancel"),n.btnCancel.classList.add("smart-hidden"),n.onOpen=function(){i.rowDetail.dialog.visible=!0},n.onClose=function(){i.rowDetail.dialog.visible=!1,n.row.showDetail=!1},n.btnCancel.onclick=function(){n.close()},n.btnClose.onclick=function(){n.close()},n.btnConfirm.onclick=function(){n.close()},n.onkeydown=function(e){"Escape"===e.key&&n.close()},i._dialogRowDetail=n),n.open(),setTimeout((function(){n.focus()}),100),n.content.appendChild(e)):n.close()}_renderDetail(e){const t=this,i=t.row.grid,l=t.row;let n=l.id,a=l.detailTemplate||i.rowDetail.template;if(a.startsWith("#")&&(a=document.querySelector(a)),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(a instanceof HTMLTemplateElement){const t=a.content.cloneNode(!0).firstElementChild;n=n.toString(),n=n.replace(/'/gi,"\\'"),n=n.replace(/"/gi,'\\"');let i=t.outerHTML.replace(/{{value}}/gi,n).replace(/{{id}}/gi,l.id);i.indexOf("{{value=")>=0&&(n?(i=i.substring(0,i.indexOf("{{value="))+n+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>"+a.replace(/{{value}}/gi,n).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 n=!1;if(t.addNewRow&&t.inline&&(n=!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],n=l.getAttribute("data-id"),a=i.rowById[n];l.getAttribute("data-rendered")||(l.setAttribute("data-rendered",!0),a.element=l,a.render())}}for(;l;){if(l.id===i._toggledRow.id){const n=l.element.rowContainer;if(i._toggledRow.expanded){e.classList.add("smart-hidden");let l=t.createElement(i);for(let e=0;e<n.children.length;e++){const i=n.children[e];if(i.getAttribute("data-id")===t.id.toString())return void(l=i)}t.element=l,n.appendChild(l),n.classList.remove("smart-hidden"),l.row=t,e=l}break}l=l.parent}}e._alternate();const a=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");s.classList.remove("smart-hidden"),c.classList.remove("smart-hidden"),s.style.width!==a+"px"&&(s.style.width=a+"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===a&&s.classList.add("smart-hidden"),a>0&&(parseInt(a),parseInt(i._autoGeneratedColumnsNearWidth)),o>0&&parseInt(o)===parseInt(i._autoGeneratedColumnsFarWidth)&&c.classList.add("border-collapse");for(let l=0;l<i._frozenNearColumns.length;l++){const n=i._frozenNearColumns[l];let a=e.children[0].children[l];a||(a=t.getCell(n).createElement(),e.children[0].appendChild(a)),!1!==n.visbile&&e._renderCell(t,n,a)}for(let l=0;l<i._frozenFarColumns.length;l++){const n=i._frozenFarColumns[l];let a=e.children[2].children[l];a||(a=t.getCell(n).createElement(),e.children[2].appendChild(a)),!1!==n.visbile&&e._renderCell(t,n,a)}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 n=i._columnElements[l],a=n.column;if(!n.parentNode||!a){if(n&&!a){let t=e.children[1].children[l];t&&t.classList.add("smart-visibility-hidden")}continue}let r=e.children[1].children[l];r||(n.column||(n.column=a),r=t.getCell(a).createElement(),e.children[1].appendChild(r)),n.classList.contains("smart-visibility-hidden")?r.classList.add("smart-visibility-hidden"):(r.classList.remove("smart-visibility-hidden"),e._renderCell(t,a,r))}if(n){let t=e.children[1].children[0];const l=d.getBoundingClientRect(),n=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 a=i.editing.addNewColumn.visible?i._addNewColumn.width:0;t.style.width=l.width-n.width-a+"px",t.style.left=n.width+"px",i.selection.enabled?(t.content.innerHTML=i.localize("addNewRowAlt"),s.children[1]&&(t.content.title=s.children[1].title=i.localize("addNewRow")),i.rightToLeft&&(t.style.left="initial",t.style.right=n.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&&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()}});
1508
1508
 
1509
1509
  /***/ }),
1510
1510
 
1511
1511
  /***/ 8469:
1512
1512
  /***/ (() => {
1513
1513
 
1514
- 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();for(let e=0;e<n.length;e++)n[e].selected=l;if(t._selectionColumn._selecting=!1,t.endUpdate(!1),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;return t.endUpdate(!1),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=[]),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.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 r=n._getParentCell(i,t);r&&(a=r.row.getCell(r.column.dataField)),a&&a.column.allowSelect&&(o(),!l||l.ctrlKey||l.metaKey||(n._selection.rows=[],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)&&(r?n._renderCellSelectionRect(a.row,a.column,r.endRow,r.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(),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),r=i.indexOf(l);if(!(o.grouping.enabled&&"advanced"===o.grouping.renderMode&&o.dataSource&&o.dataSource.groupBy.length>0)&&a>=0&&r>=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 r=t.clientX,s=t.clientY;t.touches&&(r=t.touches[0].clientX,s=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:r,clientY:s}),l=d({clientX:r,clientY:s+a.top}).row,n=d({clientX:r+a.left,clientY:s}).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(r-e.left)>=30?l=!0:Math.abs(s-e.top)>=30&&(n=!0)),a.lastPoint&&Math.abs(a.lastPoint.top-s)>=40?(l=null,n=!0):a.lastPoint&&Math.abs(a.lastPoint.left-r)>=40&&(n=null,l=!0),l){const t=a.endDragColumn.dataField,l=d({clientX:r,clientY:e.top-5});l.row&&l.column&&(a.endDragRow=a.endRow,a.endDragColumn=l.column,a.endDragColumn.dataField!==t&&(a.lastPoint={left:r,top:s}),o._resizeSelectionRect())}else if(n){const t=a.endDragRow,l=d({clientX:e.left-5,clientY:s});l.row&&l.column&&(a.endDragRow=l.row,a.endDragColumn=a.endColumn,a.endDragRow.id&&a.endDragRow.id!==t.id&&(a.lastPoint={left:r,top:s}),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();r<=e.left+20?(o.scrollLeft-=15,o._resizeSelectionRect()):r>=e.left+e.width-20&&(o.scrollLeft+=15,o._resizeSelectionRect()),s<=e.top+20?(o.scrollTop-=15,o._resizeSelectionRect()):s>=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 r=e.viewColumns,s=l.indexOf(n),d=l.indexOf(o),c=l.indexOf(t.endRow),u=r.indexOf(i),f=r.indexOf(a),g=r.indexOf(t.endColumn),_=Math.min(c,Math.min(s,d)),m=Math.max(c,Math.max(s,d)),w=Math.min(g,Math.min(u,f)),p=Math.max(g,Math.max(u,f));c<=Math.min(s,d)?t.minRow=t.endRow:t.minRow=s<=d?n:o,c>=Math.max(s,d)?t.maxRow=t.endRow:t.maxRow=s>=d?n:o,g<=Math.min(u,f)?t.minColumn=t.endColumn:t.minColumn=u<=f?i:a,g>=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=_;e<=m;e++){const t=l[e];if(t){e===_&&(h=t.top),e===m&&(y=t.top+t.height-h);for(let e=w;e<=p;e++){const l=r[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=[],r=[],s=[];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 s=d.names,d.names.indexOf(e);if(d.namesAbbr.indexOf(e)>=0)return s=d.namesAbbr,d.namesAbbr.indexOf(e);if(d.namesShort.indexOf(e)>=0)return s=d.namesShort,d.namesShort.indexOf(e);if(c.names.indexOf(e)>=0)return s=c.names,c.names.indexOf(e);if(c.namesAbbr.indexOf(e)>=0)return s=c.namesAbbr,c.namesAbbr.indexOf(e);if(void 0!==e&&(null===e&&(e=""),/\d+/.test(e.toString()))){r.push(e.toString().replace(/[0-9]/,"#")),r[r.length-1]=r[r.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),(s.length>0||r.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),(s.length>0||r.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,s.length>1&&n[o][e]>=s.length&&(n[o][e]=0)))}return s.length>0?s[n[e][t]]:r.length>0?r[e%r.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,s.length>1&&n[e][o]>=s.length&&(n[e][o]=0)));return s.length>0?s[n[e][t]]:r.length>0?r[e%r.length].replace("#",n[e][t]):n[e][t]}return n[e]&&n[e][t]?r.length>0?r[e%r.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,i=e.value,a=e.dataField;let r=i,s=!1;if("string"===n)r=i,s=!0;else if("bool"===n||"boolean"===n)1!==i&&"1"!==i&&!0!==i&&"true"!==i&&"TRUE"!==i&&"True"!==i||(r=!0,s=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[a];l?(r=i,s=!0):e&&e.dataType!==n?(r=null,s=!0):(r=i,s=!0)}else if("number"===n||"float"===n||"int"===n){const e=t.columnByDataField[a];l?(r=i,s=!0):e&&e.dataType!==n?(r=null,s=!0):null!==i?"int"===n||"integer"===n?(r=parseInt(i),s=!0):(r=parseFloat(i),isNaN(r)&&(r=null),s=!0):(r=null,s=!0)}if(s)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)}}))}else t.onCellUpdate([o],[e],[r],(function(e){e&&(l(o,r),o.value=r)}));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)}))}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,r=e.minColumnIndex,s=e.currentRowIndex,d=e.currentColumnIndex,c=e.dataField;let u=e.value;if("string"===n)/\d+/.test(u.toString())?(u=t._getPatternValue(s-a,d-r,i),void 0===u&&i[s-a]&&i[s-a][d-r]&&(u=i[s-a][d-r])):(u=t._getPatternValue(s-a,d-r,i),u=void 0===u&&i[s-a]?i[s-a][d-r]: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[s-a]&&(u=i[s-a][d-r],void 0!==u&&(o.value=u))}else if("number"===n||"float"===n||"int"===n){u=t._getPatternValue(s-a,d-r,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,r=e.endColumn;const s=n.indexOf(o),d=n.indexOf(i),c=n.indexOf(e.endRow),u=l.viewColumns,f=u.indexOf(a),g=u.indexOf(r),_=u.indexOf(e.endColumn),m=Math.min(c,Math.min(s,d)),w=Math.max(c,Math.max(s,d)),p=Math.min(_,Math.min(f,g)),h=Math.max(_,Math.max(f,g));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++){const i=u[n].dataField,a=o.getCell(i);let r=0;for(let s in t){if(r===R){let r=0,d=t[s];for(let c in d){if(v===r){let r=d[c],u=!0;if(t[o.id]&&t[o.id][i]&&(u=!1),u&&"none"!==l.clipboard.autoFillMode){const o={value:r,oldValue:a.value,dataField:c,id:s};l.clipboard.onPasteValue?(l.clipboard.onPasteValue(o),a.value=o.value):(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))}}r++}}r++}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 r=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=r.indexOf(i),l=r.indexOf(a);i=null,a=null;for(let t=e;t<l;t++){const e=r[t];e.allowSelect&&!i&&(i=e),a=e}if(!i||!a)return t.style.width="0px",void(t.style.height="0px")}}const s=l.indexOf(n),d=l.indexOf(o),c=r.indexOf(i),u=r.indexOf(a);let f=Math.min(s,d),g=Math.max(s,d),_=Math.min(c,u),m=Math.max(c,u);_=Math.max(0,_),f=Math.max(0,f);const w=function(e){const t=l.indexOf(e.row),n=l.indexOf(e.endRow),o=r.indexOf(e.column),i=r.indexOf(e.endColumn);f=Math.min(f,t),f=Math.min(f,n),f=Math.max(0,f),g=Math.max(g,t),g=Math.max(g,n),_=Math.min(_,o),_=Math.min(_,i),_=Math.max(0,_),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<=g;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===g){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=_;l<=m;l++){const n=r[l].dataField,i=o.getCell(n);if(t.cellValues[o.id][n]=i.value,l===_&&(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.selected=!0:n.selected=!n.selected}}_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=[],r=[];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(r.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++)r[t]&&-1===r.indexOf(r[t].dataField)&&r.push(r[t].dataField)}if(a.indexOf(e)>=0&&r.indexOf(t)>=0)return{row:i.row,column:i.column,endRow:a[a.length-1],endColumn:l.columnByDataField[r[r.length-1]]}}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 r=o.viewColumns;let s=-1,d=-1,c=a.indexOf(e),u=a.indexOf(t),f=-1;for(let e=0;e<r.length;e++){const t=r[e];t.allowSelect&&(-1===f&&(f=e),t.dataField===l&&(s=e),t.dataField===n&&(d=e))}if(-1===f)return o.endUpdate(!1),void o._recycle();-1===s?s=f:-1===d&&(d=f);let g=Math.min(c,u),_=Math.max(c,u),m=Math.min(s,d),w=Math.max(s,d);const p=function(e){const t=a.indexOf(e.row),l=a.indexOf(e.endRow),n=r.indexOf(e.column),o=r.indexOf(e.endColumn);g=Math.min(g,t),g=Math.min(g,l),_=Math.max(_,t),_=Math.max(_,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),_<0||g<0||m<0||w<0)return o.endUpdate(!1),void o._recycle();for(let e=g;e<=_;e++){const t=a[e];if(t.allowSelect)for(let e=0;e<r.length;e++){const l=r[e];l.allowSelect&&e>=m&&e<=w&&(t.getCell(l.dataField).selected=!0)}}o.endUpdate(!1,!1),o._recycle(!1),o._selectionTimer&&clearTimeout(o._selectionTimer),o._selectionTimer=setTimeout((()=>{o._recycle()}),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),r=Math.min(i,a),s=Math.max(i,a);if(s<0)return n.endUpdate(!1),void n._recycle();for(let e=r;e<=s;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),r=Math.max(o,i);for(let e=0;e<n.length;e++){const t=n[e];t.allowSelect&&e>=a&&e<=r&&(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;l.rows.canNotify=!1,e&&(o=l.getVisibleRows()),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((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),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())}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()}))}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);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}getSelectedRowIds(){const e=this;let t=[];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}}_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._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=[],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]=[]),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 r="",s=Object.keys(t[a]).length,d=0;for(let e in t[a])r+=t[a][e],d++,d<s&&(r+="\t");if(n+=r,i++,i<o&&(n+="\r\n"),"x"===e){const e=l.getSelection();if(e.cells){l.beginUpdate();for(let t=0;t<e.cells.length;t++){const n=e.cells[t],o=l.rowById[n.id];if(o){const e=o.getCell(n.dataField),t=l._pasteDataType({cell:e,value:e.value});let i=null;"int"!==t&&"number"!==t||(i=0),"string"===t&&(i=""),"boolean"!==t&&"bool"!==t||(i=!1),"date"===t&&(i=new Date),e.column.allowNull&&(i=null);const a=e.oldValue;if(l.onCellUpdate)l.onCellUpdate([e],[a],[i],(function(t){t&&(e.value=i)}));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)}))}else e.value=i}}l.endUpdate(!1),l._recycle()}}}if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(n).then((function(){}),(function(){}));else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),e.remove(),l._clipboardText=n}),25)}}if(t.shiftKey&&" "===e&&(l._keyboardAdd=!0,l._addNewGridRow(),l._keyboardAddTimer&&clearTimeout(l._keyboardAddTimer),l._keyboardAddTimer=setTimeout((()=>{l._keyboardAdd=!1}),300)),(t.ctrlKey||t.metaKey)&&"v"===e){if(navigator.clipboard&&!navigator.clipboard.readText)return;const e=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();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 r=l.rowById[o[t][0]];if(!r)continue;e||(e=r),n||(n=r);const s=l.columnByDataField[o[t][1]];i||(i=a=s),i&&i.visibleIndex>s.visibleIndex&&(i=s),a&&a.visibleIndex<s.visibleIndex&&(a=s),e.visibleIndex>r.visibleIndex&&(e=r),n.visibleIndex<r.visibleIndex&&(n=r)}l._pasteSelectedCells({row:e,endRow:n,column:i,endColumn:a},t)}}};if(!window.isSecureContext)return void e(l._clipboardText);navigator.clipboard.readText().then((t=>{e(t)}))}}}_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.index,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.index,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.index,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){const n=(e,l)=>{let n=9999999,o=0,i=999999,a=0,r=t._recyclingRows;t.beginUpdate();for(let s=0;s<e.items.length;s++){const d=e.items[s],c=r[d.index];if(c){const e=c.id,r=d.dataField,s=l?d.oldValue:d.newValue,u=t.columnByDataField[r],f=t.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),t.setCellValue(e,r,s)}}t._focusCell(r[n].id,t.viewColumns[i].dataField),t._selectCellsRange(r[n],r[o],t.viewColumns[i].dataField,t.viewColumns[a].dataField),delete t._undoRedoAction,t.endUpdate(!1)};if("z"===l){const l=t._undoRedoIndex,o=t._undoRedo[l];if(o){switch(t._undoRedoIndex--,t._undoRedoAction=!0,o.action){case"add":{const e=t._recyclingRows[o.index];e&&(t.removeRow(e.id),delete t._undoRedoAction);break}case"remove":{const e=o.data;e&&(t._recyclingRows[o.index]?t.insertRow(e,o.index):t.addRow(e,!0));break}case"update":{const e=t.rows[o.index];if(e){const l=e.id,n=o.dataField,i=o.oldValue;t.setCellValue(l,n,i),t._focusCell(l,n)}delete t._undoRedoAction;break}case"updateMultiple":n(o,!0)}return void e.preventDefault()}t._currentUndoRedo=t._undoRedo[0],delete t._undoRedoAction}if("y"===l){const l=t._undoRedoIndex,o=t._undoRedo[l+1];if(o)switch(t._undoRedoIndex++,t._undoRedoAction=!0,o.action){case"add":t.addRow(o.data,!0);break;case"remove":{const e=t._recyclingRows[o.index];e&&(t.removeRow(e.id),delete t._undoRedoAction);break}case"update":{const e=t.rows[o.index];if(e){const l=e.id,n=o.dataField,i=o.newValue;t.setCellValue(l,n,i),t._focusCell(l,n)}delete t._undoRedoAction;break}case"updateMultiple":n(o,!1)}else delete t._undoRedoAction;return void e.preventDefault()}}}_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=[]),"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=JSON.parse(JSON.stringify(t._selection.focusedCell));t._selection.focusedCell.index=l,t._selection.focusedCell.dataField=n;const a=t.rows[0],r=a.height,s=l;if(-1===s)return;const d=t._scrollView.hScrollBar,c="virtual"!==t.scrolling?a.top:s*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=i),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=i}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.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;" "===l&&t.dataSource.boundHierarchy&&(n.checked=!n.checked),t.editing.enabled&&!e.shiftKey?(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)):t.selection.enabled&&"many"===t.selection.mode&&a(o.id,o.dataField);break}case"Delete":case"Backspace":{const e=t.rowById[o.id];if(!e||t.editing.editCell)return;const i=e.getCell(o.dataField),a=i.value;if(n.cells){t.beginUpdate();for(let e=0;e<n.cells.length;e++){const l=n.cells[e],o=t.rowById[l.id];if(o){const e=o.getCell(l.dataField);if(!e.column.allowEdit)continue;const n=t._pasteDataType({cell:e,value:e.value});let i=null;"int"!==n&&"number"!==n||(i=0),"string"===n&&(i=""),"boolean"!==n&&"bool"!==n||(i=!1),"date"===n&&(i=new Date),e.column.allowNull&&(i=null);const a=e.value;if(t.dataSource&&t.dataSource.virtualDataSource){const l={};l[e.column.dataField]=i,t.updateRow(e.row.id,l)}else if(t._setCellUndoRedo(e,a,i),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]);const n=i;t._pasteTempValues.push({id:e.row.id,cell:e,dataField:l.column.dataField,oldValue:a,newValue:n}),t._pasteTimer&&clearTimeout(t._pasteTimer),t._pasteTimer=setTimeout((()=>{const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1)}}))}else t.onCellUpdate([e],[a],[n],(function(t){t&&(l(e,n),e.value=n)}));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)}))}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);if(n>=0&&t[n+1]&&!t[n+1].autoGenerated){const e=t[n+1];if(e.allowSelect&&!e.disabled)return e;for(let e=n+1;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,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)return l.setVerticalScrollValue(e*l.layout.rowMinHeight),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()}});
1514
+ 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 r=n._getParentCell(i,t);r&&(a=r.row.getCell(r.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)&&(r?n._renderCellSelectionRect(a.row,a.column,r.endRow,r.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(),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),r=i.indexOf(l);if(!(o.grouping.enabled&&"advanced"===o.grouping.renderMode&&o.dataSource&&o.dataSource.groupBy.length>0)&&a>=0&&r>=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 r=t.clientX,s=t.clientY;t.touches&&(r=t.touches[0].clientX,s=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:r,clientY:s}),l=d({clientX:r,clientY:s+a.top}).row,n=d({clientX:r+a.left,clientY:s}).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(r-e.left)>=30?l=!0:Math.abs(s-e.top)>=30&&(n=!0)),a.lastPoint&&Math.abs(a.lastPoint.top-s)>=40?(l=null,n=!0):a.lastPoint&&Math.abs(a.lastPoint.left-r)>=40&&(n=null,l=!0),l){const t=a.endDragColumn.dataField,l=d({clientX:r,clientY:e.top-5});l.row&&l.column&&(a.endDragRow=a.endRow,a.endDragColumn=l.column,a.endDragColumn.dataField!==t&&(a.lastPoint={left:r,top:s}),o._resizeSelectionRect())}else if(n){const t=a.endDragRow,l=d({clientX:e.left-5,clientY:s});l.row&&l.column&&(a.endDragRow=l.row,a.endDragColumn=a.endColumn,a.endDragRow.id&&a.endDragRow.id!==t.id&&(a.lastPoint={left:r,top:s}),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();r<=e.left+20?(o.scrollLeft-=15,o._resizeSelectionRect()):r>=e.left+e.width-20&&(o.scrollLeft+=15,o._resizeSelectionRect()),s<=e.top+20?(o.scrollTop-=15,o._resizeSelectionRect()):s>=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 r=e.viewColumns,s=l.indexOf(n),d=l.indexOf(o),c=l.indexOf(t.endRow),u=r.indexOf(i),f=r.indexOf(a),_=r.indexOf(t.endColumn),g=Math.min(c,Math.min(s,d)),m=Math.max(c,Math.max(s,d)),p=Math.min(_,Math.min(u,f)),w=Math.max(_,Math.max(u,f));c<=Math.min(s,d)?t.minRow=t.endRow:t.minRow=s<=d?n:o,c>=Math.max(s,d)?t.maxRow=t.endRow:t.maxRow=s>=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=p;e<=w;e++){const l=r[e].dataField,n=t.getCell(l);e===p&&(S=n.column.left),e===w&&(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=[],r=[],s=[];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 s=d.names,d.names.indexOf(e);if(d.namesAbbr.indexOf(e)>=0)return s=d.namesAbbr,d.namesAbbr.indexOf(e);if(d.namesShort.indexOf(e)>=0)return s=d.namesShort,d.namesShort.indexOf(e);if(c.names.indexOf(e)>=0)return s=c.names,c.names.indexOf(e);if(c.namesAbbr.indexOf(e)>=0)return s=c.namesAbbr,c.namesAbbr.indexOf(e);if(void 0!==e&&(null===e&&(e=""),/\d+/.test(e.toString()))){r.push(e.toString().replace(/[0-9]/,"#")),r[r.length-1]=r[r.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),(s.length>0||r.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),(s.length>0||r.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,s.length>1&&n[o][e]>=s.length&&(n[o][e]=0)))}return s.length>0?s[n[e][t]]:r.length>0?r[e%r.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,s.length>1&&n[e][o]>=s.length&&(n[e][o]=0)));return s.length>0?s[n[e][t]]:r.length>0?r[e%r.length].replace("#",n[e][t]):n[e][t]}return n[e]&&n[e][t]?r.length>0?r[e%r.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,i=e.value,a=e.dataField;let r=i,s=!1;if("string"===n)r=i,s=!0;else if("bool"===n||"boolean"===n)1!==i&&"1"!==i&&!0!==i&&"true"!==i&&"TRUE"!==i&&"True"!==i||(r=!0,s=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[a];l?(r=i,s=!0):e&&e.dataType!==n?(r=null,s=!0):(r=i,s=!0)}else if("number"===n||"float"===n||"int"===n){const e=t.columnByDataField[a];l?(r=i,s=!0):e&&e.dataType!==n?(r=null,s=!0):null!==i?"int"===n||"integer"===n?(r=parseInt(i),s=!0):(r=parseFloat(i),isNaN(r)&&(r=null),s=!0):(r=null,s=!0)}if(s)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)}}))}else t.onCellUpdate([o],[e],[r],(function(e){e&&(l(o,r),o.value=r)}));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)}))}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,r=e.minColumnIndex,s=e.currentRowIndex,d=e.currentColumnIndex,c=e.dataField;let u=e.value;if("string"===n)/\d+/.test(u.toString())?(u=t._getPatternValue(s-a,d-r,i),void 0===u&&i[s-a]&&i[s-a][d-r]&&(u=i[s-a][d-r])):(u=t._getPatternValue(s-a,d-r,i),u=void 0===u&&i[s-a]?i[s-a][d-r]: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[s-a]&&(u=i[s-a][d-r],void 0!==u&&(o.value=u))}else if("number"===n||"float"===n||"int"===n){u=t._getPatternValue(s-a,d-r,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,r=e.endColumn;const s=n.indexOf(o),d=n.indexOf(i),c=n.indexOf(e.endRow),u=l.viewColumns,f=u.indexOf(a),_=u.indexOf(r),g=u.indexOf(e.endColumn),m=Math.min(c,Math.min(s,d)),p=Math.max(c,Math.max(s,d)),w=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<=p;e++){const o=n[e];v=0;for(let n=w;n<=h;n++){const i=u[n].dataField,a=o.getCell(i);let r=0;for(let s in t){if(r===R){let r=0,d=t[s];for(let c in d){if(v===r){let r=d[c],u=!0;if(t[o.id]&&t[o.id][i]&&(u=!1),u&&"none"!==l.clipboard.autoFillMode){const o={value:r,oldValue:a.value,dataField:c,id:s};l.clipboard.onPasteValue?(l.clipboard.onPasteValue(o),a.value=o.value):(o.cell=a,o.selectedValues=t,o.minRowIndex=m,o.maxRowIndex=p,o.minColumnIndex=w,o.maxColumnIndex=h,o.currentColumnIndex=n,o.currentRowIndex=e,"copy"===l.clipboard.autoFillMode?l._pasteModeCopy(o):"fillSeries"===l.clipboard.autoFillMode&&l._pasteModeFill(o))}}r++}}r++}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 r=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=r.indexOf(i),l=r.indexOf(a);i=null,a=null;for(let t=e;t<l;t++){const e=r[t];e.allowSelect&&!i&&(i=e),a=e}if(!i||!a)return t.style.width="0px",void(t.style.height="0px")}}const s=l.indexOf(n),d=l.indexOf(o),c=r.indexOf(i),u=r.indexOf(a);let f=Math.min(s,d),_=Math.max(s,d),g=Math.min(c,u),m=Math.max(c,u);g=Math.max(0,g),f=Math.max(0,f);const p=function(e){const t=l.indexOf(e.row),n=l.indexOf(e.endRow),o=r.indexOf(e.column),i=r.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)},w=e._getParentCell(n,i.dataField),h=e._getParentCell(n,a.dataField),y=e._getParentCell(o,a.dataField),S=e._getParentCell(o,i.dataField);w&&p(w),h&&p(h),y&&p(y),S&&p(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=r[l].dataField,i=o.getCell(n);if(t.cellValues[o.id][n]=i.value,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.selected=!0:n.selected=!n.selected}}_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=[],r=[];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(r.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++)r[t]&&-1===r.indexOf(r[t].dataField)&&r.push(r[t].dataField)}if(a.indexOf(e)>=0&&r.indexOf(t)>=0)return{row:i.row,column:i.column,endRow:a[a.length-1],endColumn:l.columnByDataField[r[r.length-1]]}}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 r=o.viewColumns;let s=-1,d=-1,c=a.indexOf(e),u=a.indexOf(t),f=-1;for(let e=0;e<r.length;e++){const t=r[e];t.allowSelect&&(-1===f&&(f=e),t.dataField===l&&(s=e),t.dataField===n&&(d=e))}if(-1===f)return o.endUpdate(!1),void o._recycle();-1===s?s=f:-1===d&&(d=f);let _=Math.min(c,u),g=Math.max(c,u),m=Math.min(s,d),p=Math.max(s,d);const w=function(e){const t=a.indexOf(e.row),l=a.indexOf(e.endRow),n=r.indexOf(e.column),o=r.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),p=Math.max(p,n),p=Math.max(p,o)},h=o._getParentCell(e,l),y=o._getParentCell(t,n);if(h&&w(h),y&&w(y),g<0||_<0||m<0||p<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<r.length;e++){const l=r[e];l.allowSelect&&e>=m&&e<=p&&(t.getCell(l.dataField).selected=!0)}}o.endUpdate(!1,!1),o._recycle(!1),o._selectionTimer&&clearTimeout(o._selectionTimer),o._selectionTimer=setTimeout((()=>{o._recycle()}),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),r=Math.min(i,a),s=Math.max(i,a);if(s<0)return n.endUpdate(!1),void n._recycle();for(let e=r;e<=s;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),r=Math.max(o,i);for(let e=0;e<n.length;e++){const t=n[e];t.allowSelect&&e>=a&&e<=r&&(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((()=>{"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),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())}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()}))}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}}_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]=[]),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 r="",s=Object.keys(t[a]).length,d=0;for(let e in t[a])r+=t[a][e],d++,d<s&&(r+="\t");if(n+=r,i++,i<o&&(n+="\r\n"),"x"===e){const e=l.getSelection();if(e.cells){l.beginUpdate();for(let t=0;t<e.cells.length;t++){const n=e.cells[t],o=l.rowById[n.id];if(o){const e=o.getCell(n.dataField),t=l._pasteDataType({cell:e,value:e.value});let i=null;"int"!==t&&"number"!==t||(i=0),"string"===t&&(i=""),"boolean"!==t&&"bool"!==t||(i=!1),"date"===t&&(i=new Date),e.column.allowNull&&(i=null);const a=e.oldValue;if(l.onCellUpdate)l.onCellUpdate([e],[a],[i],(function(t){t&&(e.value=i)}));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)}))}else e.value=i}}l.endUpdate(!1),l._recycle()}}}if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(n).then((function(){}),(function(){}));else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),e.remove(),l._clipboardText=n}),25)}}if(t.shiftKey&&" "===e&&(l._keyboardAdd=!0,l._addNewGridRow(),l._keyboardAddTimer&&clearTimeout(l._keyboardAddTimer),l._keyboardAddTimer=setTimeout((()=>{l._keyboardAdd=!1}),300)),(t.ctrlKey||t.metaKey)&&"v"===e){if(navigator.clipboard&&!navigator.clipboard.readText)return;const e=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();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 r=l.rowById[o[t][0]];if(!r)continue;e||(e=r),n||(n=r);const s=l.columnByDataField[o[t][1]];i||(i=a=s),i&&i.visibleIndex>s.visibleIndex&&(i=s),a&&a.visibleIndex<s.visibleIndex&&(a=s),e.visibleIndex>r.visibleIndex&&(e=r),n.visibleIndex<r.visibleIndex&&(n=r)}l._pasteSelectedCells({row:e,endRow:n,column:i,endColumn:a},t)}}};if(!window.isSecureContext)return void e(l._clipboardText);navigator.clipboard.readText().then((t=>{e(t)}))}}}_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.index,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.index,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.index,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,r=l._recyclingRows;l.beginUpdate();for(let s=0;s<e.items.length;s++){const d=e.items[s],c=r[d.index];if(c){const e=c.id,r=d.dataField,s=t?d.oldValue:d.newValue,u=l.columnByDataField[r],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,r,s)}}l._focusCell(r[n].id,l.viewColumns[i].dataField),l._selectCellsRange(r[n],r[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 r=t.rows[0],s=r.height;if(-1===i)return;const d=t._scrollView.hScrollBar,c="virtual"!==t.scrolling?r.top:i*s;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.focus(),e.stopPropagation(),e.preventDefault()}else{let l=e.shiftKey?t.prevRow(o.id):t.nextRow(o.id),n=e.shiftKey?t.lastColumn().dataField:t.firstColumn().dataField;if(t.editing.addNewRow.autoCreate&&!e.shiftKey&&o.id===t.lastRow().id&&(t.addUnboundRow(1),l=t.lastRow()),!l)return;e.shiftKey&&(t._selection.focusedCell=null),a(t._isVirtualMode()?l.index:l.id,n)}break}case" ":case"F2":{const n=t.rowById[o.id];if(!n||t.editing.editCell)return;if(e.ctrlKey||e.metaKey)return;if(" "===l&&t.dataSource.boundHierarchy&&(n.checked=!n.checked),t.editing.enabled&&!e.shiftKey){const e=t.getSelectedCells();let i=!1;if(e.length>0){let l=[];for(let n=0;n<e.length;n++){const o=e[n],i=o[1],a=t.columnByDataField[i];!a||"bool"!==a.dataType&&"boolean"!==a.dataType||l.push(o)}if(l.length>0){i=!0,t.beginUpdate();for(let e=0;e<l.length;e++){const n=l[e],o=n[1],i=n[0],a=n[2];t.setCellValue(i,o,!a)}t.endUpdate(!1)}}i||(t._beginEdit(n,o.dataField),setTimeout((function(){if(t.editing.editCell&&t.editing.editCell.column.dataType.indexOf("bool")>=0){const e=t.editing.editCell.editor.instance,n=e.getValue();" "===l&&e.setValue(!n)}}),50))}else t.selection.enabled&&"many"===t.selection.mode&&(t._isVirtualMode()?a(o.index,o.dataField):a(o.id,o.dataField));break}case"Delete":case"Backspace":{const e=t.rowById[o.id];if(!e||t.editing.editCell)return;const i=e.getCell(o.dataField),a=i.value;if(n.cells){t.beginUpdate();for(let e=0;e<n.cells.length;e++){const l=n.cells[e],o=t.rowById[l.id];if(o){const e=o.getCell(l.dataField);if(!e.column.allowEdit)continue;const n=t._pasteDataType({cell:e,value:e.value});let i=null;"int"!==n&&"number"!==n||(i=0),"string"===n&&(i=""),"boolean"!==n&&"bool"!==n||(i=!1),"date"===n&&(i=new Date),e.column.allowNull&&(i=null);const a=e.value;if(t.dataSource&&t.dataSource.virtualDataSource){const l={};l[e.column.dataField]=i,t.updateRow(e.row.id,l)}else if(t._setCellUndoRedo(e,a,i),t.onCellUpdate){t._pasteTempValues||(t._pasteTempValues=[]);const n=i;t._pasteTempValues.push({id:e.row.id,cell:e,dataField:l.column.dataField,oldValue:a,newValue:n}),t._pasteTimer&&clearTimeout(t._pasteTimer),t._pasteTimer=setTimeout((()=>{const l=(e,l)=>{const n=e.row;if(n){let o=null;if(t.storeHistory&&(o=t._stringifyRow(n)),l!==(void 0!==e.value?e.value:"")&&(n.updatedDate=new Date,n.updatedBy=t.currentUser,t.storeHistory)){e.value=l;const i=t._stringifyRow(n);t._updateRowHistory(n,o,i)}}};if(t._pasteTempValues&&t._pasteTempValues.length>1){let e=[],n=[],o=[];for(let l=0;l<t._pasteTempValues.length;l++){const i=t._pasteTempValues[l];e.push(i.cell),n.push(i.oldValue),o.push(i.newValue)}t.onCellUpdate(e,n,o,(function(n){if(n){t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1)}}))}else t.onCellUpdate([e],[a],[n],(function(t){t&&(l(e,n),e.value=n)}));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)}))}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);if(n>=0&&t[n+1]&&!t[n+1].autoGenerated){const e=t[n+1];if(e.allowSelect&&!e.disabled)return e;for(let e=n+1;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()}});
1515
1515
 
1516
1516
  /***/ }),
1517
1517
 
@@ -1525,7 +1525,7 @@ Smart.Utilities.Assign("Grid.Sort",class{clearSort(){const t=this;if(!t._isSorti
1525
1525
  /***/ 238:
1526
1526
  /***/ (() => {
1527
1527
 
1528
- Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden")})),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;(t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled")})(e.dataSource&&0===e.dataSource.length),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget),t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight+"px";const a=()=>{if(e){const a=t.grid.offset(e);a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px"}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",a())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));if(super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t.grid.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),50)}}openSortPanel(){const e=this,t=e.dataSource;e._refreshColumns("sort");const a=e.columns.map((a=>{const o=Object.assign({},a),s=e._appliedSorting.dataFields.indexOf(o.dataField),n=t.dataFields.find((e=>e.name===o.dataField));return n&&(o.dataType=n.dataType,o.sortIndex=s,-1!==s&&(o.sortDirection=e._appliedSorting.orderBy[s])),o})).filter((e=>e.allowSort));super.openSortPanel(a),e._closeDownloadMenu(),e._closeViewsMenu(),e.grid.closeMenu();const o=e.$.headerDropDown.querySelector("smart-sort-panel");if(!o)return;const s=o.$.inputNotSorted,n=()=>{const t=o.querySelectorAll(".smart-grid-panel-item");"many"===e.grid.sorting.mode||t.length<1?s.classList.remove("smart-visibility-hidden"):t.length>=1&&s.classList.add("smart-visibility-hidden")};o.onDataSourceChange=()=>{n()},n()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,s=0,n=[],r=[];e.columns.forEach((a=>{const i={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===i.allowHide&&(o--,r.push(i.dataField)),i.visible||(s++,n.push(i.dataField)),t.push(i)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===s||o===s&&r.toString()!==n.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,s=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let n;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)n=o.querySelector("smart-column-panel"),n.locale=e.locale,n.messages=e._innerElementMessages.columnPanel,n.set("dataSource",s),n.propertyChangedHandler("dataSource",void 0,s),n.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=s,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],s=o[0],n=o[1];a.grid.columnByDataField[s].filter=n}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")&&(t="customize"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,s=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&s.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();s.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)&&t.addSort(o.sortByInfo),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target;const o=t.grid.$.header;if(t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]),t._closeDownloadMenu(),t._closeViewsMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||a!==o&&o.contains(a))){const s=a.closest("smart-scroll-viewer"),n=a.closest(".smart-drop-down");if((!s||!o.contains(s.ownerElement))&&(!n||n.ownerElement&&!o.contains(n.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,s=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((e=>!1!==e._visible)),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;s.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;s.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.grid._openRowSettingsDialog=t._openRowSettingsDialog,t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),e.header.onInit&&e.header.onInit(t)}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-views-menu"),a.rightToLeft=t.rightToLeft;const s=(e,a)=>{const o=document.createElement("smart-menu-item");let s="#D50000",n="smart-icon-table-alt";switch(a){case"grid":s="#3f51b5",n="smart-icon-table-alt","grid"===t.view&&o.setAttribute("focus","");break;case"pdf":s="#f4511e";break;case"kanban":s="#0b8043",n="smart-icon-kanban","kanban"===t.view&&o.setAttribute("focus","");break;case"json":s="#8e24aa"}return o.label='<span style="color: '+s+'" class="smart-grid-icon '+n+'"></span>'+e,o.value=a,o};o.appendChild(s(t.localize("viewGrid"),"grid")),o.appendChild(s(t.localize("viewKanban"),"kanban")),a.appendChild(o),e.viewsMenu.appendChild(a),a.onItemClick=t=>{e._setView(t.detail.value)}}_setView(e){const t=this,a=t.grid;if(a.view!==e){if("kanban"===e){const e=a.context;a.context=a,a.view="kanban",a.context=e,a._kanbanInitialized?(a._showKanbanView(),t._refresh()):a._initKanbanView()}else"grid"===e&&(a.view="grid",a._hideKanbanView(),t._refresh());a.$.fireEvent("viewChanged",{view:e}),t._refresh()}}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const s=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const s='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+s+e,a.value=t,a};o.appendChild(s(t.localize("download")+" CSV","csv")),o.appendChild(s(t.localize("download")+" XLSX","xlsx")),o.appendChild(s(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")&&e._closeViewsMenu()}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled&&"grid"===t.view?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},t._sortedColumns){const a=[],o=[],s=[];for(let e=0;e<t._sortedColumns.length;e++){const n=t._sortedColumns[e];a.push(n.dataField),o.push(n.sortOrder),s.push(n.dataType)}e._appliedSorting={dataFields:a,dataTypes:s,orderBy:o},e._refreshSortButton()}if("grid"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumns();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const s=t.filters[o];a.filters.push([e,s.condition,s.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e.refreshTools()}_refreshViewsButton(){const e=this;let t=e.grid.localize("viewGrid");switch(e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":e.$.viewsButton.classList.remove("kanban"),t=e.grid.localize("viewGrid")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>"}_refreshDownloadButton(){this.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation">'+this.grid.localize("download")+"</div>"}_openRowSettingsDialog(e){let t=this;t.getSelectedRows||(t=t.grid);const a=t.editing.dialog.enabled,o=t.editing.mode,s=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=e,t.beginEdit(e),t._endToolbarEdit?(t.removeEventListener("endEdit",t._endToolbarEdit,null),t.removeEventListener("cancelEdit",t._endToolbarEdit,null)):t._endToolbarEdit=()=>{t.context=t,t.editing.dialog.enabled=a,t.editing.mode=o,t.context=s,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endToolbarEdit),t.addEventListener("cancelEdit",t._endToolbarEdit)}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.querySelector("smart-grid-toolbar").$.deleteButton;0!==t?(a.classList.remove("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.querySelector("smart-grid-toolbar")._refreshDeleteButton()}openGroupPanel(){const e=this;let t;const a=e.grid;e.$.headerDropDown.classList.add("group-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._closeDownloadMenu(),e._closeViewsMenu(),e._refreshColumns("group"),a.closeMenu();const o=e.columns.map((t=>{const a=Object.assign({},t);if(e._appliedGrouping&&e._appliedGrouping.dataFields){const t=e._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=t}return a})).filter((e=>e.allowGroup));e._groupPartCreated?(t=e.$.group.firstElementChild,t.rightToLeft=e.rightToLeft,t.dataSource=o,t.locale=e.locale,t.messages=e._innerElementMessages.groupPanel):(t=document.createElement("smart-group-panel"),t.rightToLeft=e.rightToLeft,t.animation=e.animation,t.locale=e.locale,t.messages=e._innerElementMessages.groupPanel,t.theme=e.theme,t.dataSource=o,e.$.group.appendChild(t),e._groupPartCreated=!0,t.onExpandAll=()=>{e._appliedGrouping.expandAll=!0,e._appliedGrouping.collapseAll=!1,t.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),t.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},t.onCollapseAll=()=>{e._appliedGrouping.expandAll=!1,e._appliedGrouping.collapseAll=!0,t.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),t.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},t.addEventListener("apply",(t=>{const o=t.detail.sortByInfo,s=e._appliedGrouping.dataFields;e._appliedGrouping.dataFields=o.dataFields;const n=a.onRowInserted;if(a.onRowInserted=null,a.beginUpdate(),a.grouping.autoHideGroupColumn&&s)for(let e=0;e<s.length;e++){const t=a.columnByDataField[s[e]];t&&(t.visible=!0)}a.clearGroups();for(let e=0;e<o.dataFields.length;e++){const t=o.dataFields[e];a.addGroup(t)}e._appliedGrouping.expandAll&&a.expandAllRows(),e._appliedGrouping.collapseAll&&a.collapseAllRows(),a.endUpdate(),a.$.fireEvent("group",{groups:a.dataSource.groupBy}),a.paging.enabled&&a._refreshPagesCount(),a.onRowInserted=n}))),e._refreshGroupButton(),e._openHeaderDropDown(e.$.groupButton)}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search("",!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),t.closeMenu();const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const s=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:s,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,void a.grid._recycle(!1);const o=a._searchInfo.source,s=[],n=[],r={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),s.push([t,a])})),o._filter(s,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(n.push(t.$.id),r[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=n,a._searchInfo.foundIdsObject=r,a.grid.highlighted=null,n.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:n.length}),a._searchInfo.highlighted=n[0],a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if("kanban"===t.view&&t._kanban)return e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",void e.$.customizeButton.classList.remove("hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++)}a>0?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"))}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let s=0;for(let t in e){const a=e[t],n=o.columnByDataField[a.dataField];n&&(n.visible=a.visible,a.visible||s++)}s>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n:s})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],s=a.oldIndex,n=a.newIndex,r=o.columns[n+1],i=o.columns[n-1],l=o.columns[s];r?l.columnGroup=r.columnGroup:i&&(l.columnGroup=i.columnGroup),o.reorderColumns(s,n,!0)}o.endUpdate()}});
1528
+ Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div id="container" role="presentation">\n <div id="header" class="smart-data-view-header" role="toolbar">\n <div id="viewsButton" class="smart-data-view-header-button smart-data-view-views-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Views"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="customizeButton" class="smart-data-view-header-button smart-data-view-customize-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Customize cards"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="filterButton" class="smart-data-view-header-button smart-data-view-filter-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Filter"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="sortButton" class="smart-data-view-header-button smart-data-view-sort-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Sort"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="groupButton" class="smart-data-view-header-button smart-data-view-group-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Group"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="formatButton" class="smart-data-view-header-button smart-data-view-format-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Format"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="deleteButton" class="smart-data-view-header-button smart-data-view-delete-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Delete"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="downloadButton" class="smart-data-view-header-button smart-data-view-download-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Download"><div class="smart-tool-label" role="presentation"></div></div>\n <div id="searchButton" class="smart-data-view-header-button smart-data-view-search-button smart-unselectable" role="button" aria-expanded="false" aria-haspopup="dialog" aria-label="Search"></div>\n <div id="headerDropDown" owner class="smart-data-view-header-drop-down smart-visibility-hidden" role="dialog">\n <div id="customize" class="smart-hidden" role="presentation"></div>\n <div id="filter" class="smart-hidden" role="presentation"></div>\n <div id="sort" class="smart-hidden" role="presentation"></div>\n <div id="group" class="smart-hidden" role="presentation"></div>\n <div id="format" class="smart-hidden" role="presentation"></div>\n <div id="search" class="smart-data-view-search-box smart-hidden" role="presentation">\n <input type="text" id="searchInput" spellcheck="false" aria-label="Search" />\n <div id="searchLabel" class="smart-data-view-search-label smart-unselectable"></div>\n <div id="searchPrev" class="smart-data-view-search-prev" role="button" aria-label="Previous"></div>\n <div id="searchNext" class="smart-data-view-search-next" role="button" aria-label="Next"></div>\n <div id="searchClose" class="smart-data-view-search-close" role="button" aria-label="Close search box"></div>\n </div>\n </div>\n </div>\n </div>'}refreshTools(){const e=this;if(e.isRendered&&e.grid&&(e.grid.offsetWidth<600?e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.add("smart-hidden")})):e.querySelectorAll(".smart-tool-label").forEach((e=>{e.classList.remove("smart-hidden")})),e.refreshHeaderDropDownPosition(),e.grid)){const t=e.grid;if(t.dataSource&&t.dataSource.boundSource){const a=t.dataSource&&t.dataSource.virtualDataSource&&!t.dataSource.virtualDataSourceOnExpand&&t.dataSource.length>t.virtualModeCachedRowsCount&&"infinite"!==t.scrolling;if(e.dataSource&&t.dataSource&&e.dataSource.length!==t.dataSource.length||a)if(a){const a=Array.isArray(t.dataSource.boundSource)?t.dataSource.boundSource:t.dataSource.boundSource.toArray();e.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:t.dataSource.dataFields})}else e.dataSource=t.dataSource;(t=>{const a=t?"add":"remove";e.$.filterButton.classList[a]("smart-disabled"),e.$.sortButton.classList[a]("smart-disabled"),e.$.groupButton.classList[a]("smart-disabled"),e.$.formatButton.classList[a]("smart-disabled"),e.$.searchButton.classList[a]("smart-disabled"),e.$.downloadButton.classList[a]("smart-disabled")})(e.dataSource&&0===e.dataSource.length),0===t.columns.length?e.$.customizeButton.classList.add("smart-disabled"):e.$.customizeButton.classList.remove("smart-disabled")}}}get hasStyleObserver(){return!1}render(){const e=this;e._appliedFiltering={filters:[],operator:"and"},e._appliedSorting={dataFields:[],dataTypes:[],orderBy:[]},e._localizeHeader(),e._getInnerElementMessages(),super.render()}openFormatPanel(){const e=this,t=e.dataSource;if(!t||0===t.length||e.disabled||"none"===e.headerPosition)return;let a;if(e._refreshColumns("format"),e.grid.closeMenu(),e._editInfo&&e._editInfo.window.close(),e._closeDownloadMenu(),e._closeViewsMenu(),e.$.headerDropDown.classList.add("format-panel"),e.$.headerDropDown.classList.remove("customize-panel","sort-panel","search-panel","filter-panel"),e.$.format.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.group&&e.$.group.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e._closeSearchPanel(),e._formatPartCreated)a=e.$.format.firstElementChild,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft;else{a=document.createElement("smart-formatting-panel"),a.animation=e.animation,a.columns=e.columns,a.dataSource=e.dataSource,a.locale=e.locale,a.messages=e._innerElementMessages.formattingPanel,a.rightToLeft=e.rightToLeft,a.theme=e.theme,a.unfocusable=!1,a.ownerElement=e,a.dropDownAppendTo="body",e._formattingPanel=a,e.$.format.appendChild(a);const t=document.createElement("div");t.className="smart-format-panel smart-grid-panel-container-footer",t.setAttribute("role","presentation"),t.innerHTML=`<div id="buttonsContainer" class="smart-grid-panel-buttons-container smart-unselectable" role="presentation"><span class="smart-grid-panel-cancel-button" role="button">${e.localize("cancel")}</span><span class="smart-grid-panel-apply-button" role="button">${e.localize("apply")}</span></div>`,e._formattingPanel.$.apply=t.querySelector(".smart-grid-panel-apply-button"),e._formattingPanel.$.cancel=t.querySelector(".smart-grid-panel-cancel-button"),e.$.format.appendChild(t),e._formatPartCreated=!0,t.applyButton=t.querySelector(".smart-grid-panel-apply-button"),t.cancelButton=t.querySelector(".smart-grid-panel-cancel-button"),t.applyButton.onclick=()=>{a.$.fireEvent("apply"),e.grid._conditionalFormattingChanged=!0,e.grid._conditionalFormatting=a.apply(),e.grid.conditionalFormatting=a.getItems(),e.grid._recycle(!1),e.grid._conditionalFormattingChanged=!1},t.cancelButton.onclick=()=>{a.$.fireEvent("cancel")},e.grid.conditionalFormatting&&(a.items=e.grid.conditionalFormatting)}a.focus(),e._openHeaderDropDown(e.$.formatButton)}_openHeaderDropDown(e){const t=this;t.$.headerDropDown.parentElement!==document.body&&(document.body.appendChild(t.$.headerDropDown),t.$.headerDropDown.addEventListener("apply",(e=>{const a=t._getDropDownType();t._applyHandler(e),t.grid.$.fireEvent("batchChange",{type:a})})),t.$.headerDropDown.addEventListener("cancel",(()=>{const e=t._getDropDownType();t.closePanel(),t.grid.$.fireEvent("batchCancel",{type:e})}))),super._openHeaderDropDown(e),t.refreshHeaderDropDownPosition(e)}refreshHeaderDropDownPosition(e){const t=this;if(!t.$.headerDropDown||t.$.headerDropDown&&!t.$.headerDropDown.classList.contains("open"))return void(t._dropDownTarget=e);e?t._dropDownTarget=e:t._dropDownTarget&&(e=t._dropDownTarget),t.$.headerDropDown.style.top=t.grid.offset(t.grid).top+t.grid.$.header.offsetHeight+"px";const a=()=>{if(e){const a=t.grid.offset(e);a.left+t.$.headerDropDown.offsetWidth<document.body.scrollLeft+document.body.offsetWidth?t.$.headerDropDown.style.left=a.left+"px":t.$.headerDropDown.style.left=document.body.scrollLeft+document.body.offsetWidth-t.$.headerDropDown.offsetWidth+"px"}else t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"};t.grid.offsetWidth<600&&t.$.headerDropDown.offsetWidth>t.grid.offsetWidth?(t.$.headerDropDown.style.width="90%",t.$.headerDropDown.style.left=t.grid.offset(t.grid).left+"px"):(t.$.headerDropDown.style.width="",a())}openFilterPanel(e){const t=this,a=t.dataSource;t._refreshColumns("filter");const o=this.columns.map((e=>{const t=Object.assign({},e),o=a.dataFields.find((e=>e.name===t.dataField));return o&&(t.dataType=o.dataType),t})).filter((e=>e.allowFilter));if(super.openFilterPanel(o,null),t._closeDownloadMenu(),t._closeViewsMenu(),t.grid.closeMenu(),e){const a=t.$.headerDropDown.querySelector("smart-multi-column-filter-panel");a.$.itemsContainer.appendChild(a._createItem(t.columns.find((t=>t.dataField===e.dataField)),"string"===e.dataType?"CONTAINS":"EQUAL",""));const o=a.querySelectorAll(".smart-grid-panel-item");setTimeout((()=>{o[o.length-1].querySelector(".editor").focus()}),50)}}openSortPanel(){const e=this,t=e.dataSource;e._refreshColumns("sort");const a=e.columns.map((a=>{const o=Object.assign({},a),s=e._appliedSorting.dataFields.indexOf(o.dataField),n=t.dataFields.find((e=>e.name===o.dataField));return n&&(o.dataType=n.dataType,o.sortIndex=s,-1!==s&&(o.sortDirection=e._appliedSorting.orderBy[s])),o})).filter((e=>e.allowSort));super.openSortPanel(a),e._closeDownloadMenu(),e._closeViewsMenu(),e.grid.closeMenu();const o=e.$.headerDropDown.querySelector("smart-sort-panel");if(!o)return;const s=o.$.inputNotSorted,n=()=>{const t=o.querySelectorAll(".smart-grid-panel-item");"many"===e.grid.sorting.mode||t.length<1?s.classList.remove("smart-visibility-hidden"):t.length>=1&&s.classList.add("smart-visibility-hidden")};o.onDataSourceChange=()=>{n()},n()}openCustomizePanel(){const e=this;if(e.disabled||"none"===e.headerPosition)return;e._closeDownloadMenu(),e._closeViewsMenu(),e._refreshColumns("customize");let t=e.columns;const a=e.grid;a.closeMenu(),a.appearance.showColumnGroupsInColumnPanel&&(t=[],a.columns.forEach((e=>{if(!e.columnGroup){const a={label:e.label,dataField:e.dataField,level:0,parentDataField:null,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||e.allowHide,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible};t.push(a)}})),a._columnGroups.forEach((e=>{const a={dataField:e.name,label:e.label,level:0,disableDrag:!0,disableToggle:!1,allowHide:!0};if(t.push(a),e.columns){let o=e.columns.length,s=0,n=[],i=[];e.columns.forEach((a=>{const r={label:a.label,dataField:a.dataField,level:1,parentDataField:e.name,dataType:a.dataType||"string",columnGroup:a.columnGroup||null,allowHide:void 0===a.allowHide||a.allowHide,allowSort:void 0===a.allowSort||a.allowSort,allowFilter:void 0===a.allowFilter||a.allowFilter,allowGroup:void 0===a.allowGroup||a.allowGroup,visible:void 0===a.visible||a.visible};!1===r.allowHide&&(o--,i.push(r.dataField)),r.visible||(s++,n.push(r.dataField)),t.push(r)})),o<=0&&(a.allowHide=!1,a.disableToggle=!0),e.columns.length===s||o===s&&i.toString()!==n.toString()?a.visible=!1:a.visible=!0}})));const o=e.$.customize,s=t.map((t=>{const a={};return a.visible=t.visible,a.label=t.label,a.dataField=t.dataField,-1!==[e.coverField,e.titleField].indexOf(a.dataField)?a.disableToggle=!0:a.disableToggle=!1,void 0!==t.level&&(a.level=t.level),t.disableDrag&&(a.disableDrag=!0),t.parentDataField&&(a.parentDataField=t.parentDataField),t.allowHide||(a.disableToggle=!0),a}));let n;if(e._closeDialog(),e.$.headerDropDown.classList.add("customize-panel"),e.$.headerDropDown.classList.remove("filter-panel","sort-panel","search-panel","group-panel","format-panel"),o.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._closeSearchPanel(),e._customizePartCreated)n=o.querySelector("smart-column-panel"),n.locale=e.locale,n.messages=e._innerElementMessages.columnPanel,n.set("dataSource",s),n.propertyChangedHandler("dataSource",void 0,s),n.rightToLeft=e.rightToLeft;else{const t=document.createDocumentFragment(),a=document.createElement("smart-column-panel");a.rightToLeft=e.rightToLeft,a.animation=e.animation,a.dataSource=s,a.locale=e.locale,a.messages=e._innerElementMessages.columnPanel,a.theme=e.theme,t.appendChild(a),e.$.customize.appendChild(t),e._customizePartCreated=!0}e._changedVisibility=new Map,e._openHeaderDropDown(e.$.customizeButton)}_applyFilter(e,t){const a=this;a.grid.beginUpdate(),a.grid.context=a.grid,a.grid.clearFilter();for(let t=0;t<e.length;t++){const o=e[t],s=o[0],n=o[1];a.grid.columnByDataField[s].filter=n}a.grid._filterOperator=t,a.grid.endUpdate(),a.grid.refreshFilters(),a.grid.context=document}_applySort(){const e=this,t=e._appliedSorting;e.grid.beginUpdate(),e.grid.context=e.grid,e.grid.clearSort();for(let a=0;a<t.dataFields.length;a++)e.grid.sortBy(t.dataFields[a],t.orderBy[a]);e.grid.endUpdate(),e.grid.context=document}_getDropDownType(){const e=this;let t=null;return e.$.headerDropDown.classList.contains("filter-panel")?t="filter":e.$.headerDropDown.classList.contains("sort-panel")?t="sort":e.$.headerDropDown.classList.contains("search-panel")?t="search":e.$.headerDropDown.classList.contains("group-panel")?t="group":e.$.headerDropDown.classList.contains("format-panel")?t="format":e.$.headerDropDown.classList.contains("customize-panel")&&(t="customize"),t}_applyHandler(e){const t=this,a=e.target,o=e.detail,s=t.$.customize;if(t.grid&&"kanban"===t.grid.view&&t.grid._kanban&&s.contains(a))return t.grid._kanban._applyHandler(e,"customize"),void t.closePanel();s.contains(a)?t._applyColumns(o.value,o.moves):t.$.filter.contains(a)?t.addFilter(o.filters,o.operator,o.value):t.$.sort.contains(a)&&t.addSort(o.sortByInfo),t.closePanel()}_documentUpHandler(e){const t=this;let a=e.originalEvent.target;const o=t.grid.$.header;if(t.shadowRoot&&a===t&&(a=e.originalEvent.composedPath()[0]),t._closeDownloadMenu(),t._closeViewsMenu(),!("none"===t.headerPosition||t.$.headerDropDown.classList.contains("smart-visibility-hidden")||t.$.headerDropDown.classList.contains("search-panel")||a!==o&&o.contains(a))){const s=a.closest("smart-scroll-viewer"),n=a.closest(".smart-drop-down");if((!s||!o.contains(s.ownerElement))&&(!n||n.ownerElement&&!o.contains(n.ownerElement))){const a=e.originalEvent.composedPath();for(let e=0;e<a.length;e++){const t=a[e];if(t&&t.classList&&t.classList.contains("smart-data-view-header-drop-down"))return;if(t&&t.classList&&t.classList.contains("smart-formatting-panel-popup"))return}if(s&&s.ownerElement){const e=s.ownerElement.parents;for(let t=0;t<e.length;t++){const a=e[t];if(a&&a.classList&&a.classList.contains("smart-data-view-header-drop-down"))return}}if(t.$.headerDropDown.querySelector("[open]"))return;t.closePanel()}}}_refreshColumns(e){const t=this,a=t.grid;let o,s=new Map;if("kanban"===a.view&&a._kanban)switch(e){case"customize":return o=a._kanban._getCustomizeColumnPanelDataSource(),o=JSON.parse(JSON.stringify(o)),t._refreshCustomizeButton(),void(t.columns=o)}o=Array.isArray(a.columns)?[...a.columns]:[...a.columns.toArray()],o=o.filter((e=>!1!==e._visible)),o=o.map((e=>{let t=e.allowHide;return a.grouping&&a.grouping.autoHideGroupColumn&&a.dataSource.groupBy.indexOf(e.dataField)>=0&&(t=!1),{label:e.label,dataField:e.dataField,dataType:e.dataType||"string",columnGroup:e.columnGroup||null,allowHide:void 0===e.allowHide||t,allowSort:void 0===e.allowSort||e.allowSort,allowFilter:void 0===e.allowFilter||e.allowFilter,allowGroup:void 0===e.allowGroup||e.allowGroup,visible:void 0===e.visible||e.visible}})),o=JSON.parse(JSON.stringify(o)),o.forEach((e=>{let t=e.columnGroup?e.columnGroup+"."+e.label:e.label,a=1;for(;s.get(t);)t=e.columnGroup?e.columnGroup+"."+e.label+` (${a})`:e.label+` (${a})`,a++;s.set(t,e),e.label=t})),t.columns=o,t._refreshCustomizeButton()}_init(e){const t=this;if(t.grid=e,e.dataSource&&e.dataSource.boundSource){t._refreshColumns("init");const a=Array.isArray(e.dataSource.boundSource)?e.dataSource.boundSource:e.dataSource.boundSource.toArray();t.dataSource=new Smart.DataAdapter({observable:!1,dataSource:[...a],dataFields:e.dataSource.dataFields})}t.grid._openRowSettingsDialog=t._openRowSettingsDialog,t.rightToLeft=t.grid.rightToLeft,t.refreshTools(),t.$.headerDropDown.onclick=e=>{t.grid._headerClickHandler(e),e.stopPropagation(),e.preventDefault()},t.grid.removeEventListener("change",t._refreshFromSelection),t.grid.addEventListener("change",t._refreshFromSelection),e.header.onInit&&e.header.onInit(t)}_removeMenu(){const e=this;if(e.downloadMenu){const t=e.downloadMenu.querySelector("smart-menu");t&&e.downloadMenu.removeChild(t)}}_removeViewsMenu(){const e=this;if(e.viewsMenu){const t=e.viewsMenu.querySelector("smart-menu");t&&e.viewsMenu.removeChild(t)}}_createViewsMenuItems(){const e=this,t=e.grid;e._removeViewsMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-views-menu"),a.rightToLeft=t.rightToLeft;const s=(e,a)=>{const o=document.createElement("smart-menu-item");let s="#D50000",n="smart-icon-table-alt";switch(a){case"grid":s="#3f51b5",n="smart-icon-table-alt","grid"===t.view&&o.setAttribute("focus","");break;case"pdf":s="#f4511e";break;case"kanban":s="#C40093",n="smart-icon-kanban","kanban"===t.view&&o.setAttribute("focus","");break;case"json":s="#8e24aa"}return o.label='<span style="color: '+s+'" class="smart-grid-icon '+n+'"></span>'+e,o.value=a,o};o.appendChild(s(t.localize("viewGrid"),"grid")),o.appendChild(s(t.localize("viewKanban"),"kanban")),a.appendChild(o),e.viewsMenu.appendChild(a),a.onItemClick=t=>{e._setView(t.detail.value)}}_setView(e){const t=this,a=t.grid;if(a.view!==e){if("kanban"===e){const e=a.context;a.context=a,a.view="kanban",a.context=e,a._kanbanInitialized?(a._showKanbanView(),t._refresh()):a._initKanbanView()}else"grid"===e&&(a.view="grid",a._hideKanbanView(),t._refresh());a.$.fireEvent("viewChanged",{view:e}),t._refresh()}}_createMenuItems(){const e=this,t=e.grid;e._removeMenu();const a=document.createElement("smart-menu"),o=document.createDocumentFragment();a.mode="vertical",a.dropDownAppendTo="body",a.classList.add("smart-grid-download-menu"),a.rightToLeft=t.rightToLeft;const s=(e,t)=>{const a=document.createElement("smart-menu-item");let o="#D50000";switch(t){case"csv":o="#3f51b5";break;case"pdf":o="#f4511e";break;case"xlsx":o="#0b8043";break;case"json":o="#8e24aa"}const s='<span style="position: absolute; top: 0px; font-size: 10px; color: '+o+'">'+t+"</span>";return a.label='<span style="color: '+o+'" class="smart-grid-icon smart-icon-docs"></span>'+s+e,a.value=t,a};o.appendChild(s(t.localize("download")+" CSV","csv")),o.appendChild(s(t.localize("download")+" XLSX","xlsx")),o.appendChild(s(t.localize("download")+" JSON","json")),a.appendChild(o),e.downloadMenu.appendChild(a),a.onItemClick=e=>{const a=new Date;t.dataExport.fileName="data_"+a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate(),t.exportData(e.detail.value)}}closePanel(){const e=this;super.closePanel(),e.grid&&e.grid.focus(),e.downloadMenu&&e.downloadMenu.classList.contains("open")?e._closeDownloadMenu():e.viewsMenu&&e.viewsMenu.classList.contains("open")&&e._closeViewsMenu()}_closeDownloadMenu(){const e=this,t=e.downloadMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),e.$.downloadButton.classList.remove("selected"),e.$.downloadButton.removeAttribute("aria-expanded"),t.classList.remove("open"))}_openDownloadMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.downloadMenu&&e.downloadMenu.classList.contains("open"))return void e._closeDownloadMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.downloadButton.classList.add("selected"),e.$.downloadButton.setAttribute("aria-expanded",!0),e.downloadMenu||(e.downloadMenu=document.createElement("div"),e.downloadMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.downloadMenu.setAttribute("theme",e.getAttribute("theme")),e.downloadMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.downloadMenu.classList.add("smart-animate"),e._createMenuItems(),e.downloadMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.downloadMenu):document.body.appendChild(e.downloadMenu);const t=e.$.downloadButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.downloadMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.downloadMenu.offsetWidth)),e.downloadMenu.style.left=a+"px",e.downloadMenu.style.top=o+"px",e.downloadMenu.classList.remove("smart-hidden"),e.downloadMenu.classList.add("open")}_closeViewsMenu(){const e=this,t=e.viewsMenu;t&&(t.parentNode&&(t.classList.remove("open"),setTimeout((()=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),100)),t.classList.remove("open"),e.$.viewsButton.classList.remove("selected"),e.$.viewsButton.removeAttribute("aria-expanded"))}_openViewsMenu(){const e=this;if(e.grid.editing.isEditing&&e.grid.cancelEdit(),e.viewsMenu&&e.viewsMenu.classList.contains("open"))return void e._closeViewsMenu();e.$.headerDropDown.classList.remove("group-panel","customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e.closePanel(),e.$.viewsButton.classList.add("selected"),e.$.viewsButton.setAttribute("aria-expanded",!0),e.viewsMenu||(e.viewsMenu=document.createElement("div"),e.viewsMenu.classList.add("smart-grid-column-menu","smart-grid-download-menu"),e.viewsMenu.setAttribute("theme",e.getAttribute("theme")),e.viewsMenu.id=e.id+"_"+e.tagName.toLowerCase()+"_menu_"+Math.floor(65536*(1+Math.random())).toString(16).substring(1)),e.viewsMenu.classList.add("smart-animate"),e._createViewsMenuItems("views"),e.viewsMenu.style.height="auto",e.isInShadowDOM?e.getRootNode().appendChild(e.viewsMenu):document.body.appendChild(e.viewsMenu);const t=e.$.viewsButton.getBoundingClientRect();let a=t.left+window.pageXOffset,o=t.bottom+window.pageYOffset;a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=t.right+window.pageXOffset-e.downloadMenu.offsetWidth,a+e.viewsMenu.offsetWidth>window.innerWidth&&(a=window.innerWidth-e.viewsMenu.offsetWidth)),e.viewsMenu.style.left=a+"px",e.viewsMenu.style.top=o+"px",e.viewsMenu.classList.remove("smart-hidden"),e.viewsMenu.classList.add("open")}_refresh(){const e=this,t=e.grid;e._refreshColumns("refresh");let a=!1;for(let t=0;t<e.columns.length;t++)if("number"===e.columns[t].dataType){a=!0;break}if(t.header.buttons.indexOf("sort")>=0&&t.sorting.enabled?e.$.sortButton.classList.remove("smart-hidden"):e.$.sortButton.classList.add("smart-hidden"),t.header.buttons.indexOf("filter")>=0&&t.filtering.enabled?e.$.filterButton.classList.remove("smart-hidden"):e.$.filterButton.classList.add("smart-hidden"),t.header.buttons.indexOf("group")>=0&&t.grouping.enabled&&"grid"===t.view?e.$.groupButton.classList.remove("smart-hidden"):e.$.groupButton.classList.add("smart-hidden"),t.header.buttons.indexOf("columns")>=0?e.$.customizeButton.classList.remove("smart-hidden"):e.$.customizeButton.classList.add("smart-hidden"),t.header.buttons.indexOf("search")>=0?e.$.searchButton.classList.remove("smart-hidden"):e.$.searchButton.classList.add("smart-hidden"),t.header.buttons.indexOf("format")>=0&&a?e.$.formatButton.classList.remove("smart-hidden"):e.$.formatButton.classList.add("smart-hidden"),t.header.buttons.indexOf("delete")>=0?e.$.deleteButton.classList.remove("smart-hidden"):e.$.deleteButton.classList.add("smart-hidden"),t.header.buttons.indexOf("download")>=0?e.$.downloadButton.classList.remove("smart-hidden"):e.$.downloadButton.classList.add("smart-hidden"),t.header.buttons.indexOf("views")>=0?e.$.viewsButton.classList.remove("smart-hidden"):e.$.viewsButton.classList.add("smart-hidden"),e.$.downloadButton.onpointerup=a=>{t.closeMenu(),e._openDownloadMenu(),a.stopPropagation()},e.$.viewsButton.onpointerup=a=>{t.closeMenu(),e._openViewsMenu(),a.stopPropagation()},t._sortedColumns){const a=[],o=[],s=[];for(let e=0;e<t._sortedColumns.length;e++){const n=t._sortedColumns[e];a.push(n.dataField),o.push(n.sortOrder),s.push(n.dataType)}e._appliedSorting={dataFields:a,dataTypes:s,orderBy:o},e._refreshSortButton()}if("grid"===t.view){const a={filters:[],operator:"and"},o=t.getFilteredColumns();if(o)for(let e in o){const t=o[e];for(let o=0;o<t.filters.length;o++){const s=t.filters[o];a.filters.push([e,s.condition,s.value])}}e._appliedFiltering&&(a.operator=e._appliedFiltering.operator),e._appliedFiltering=a,e._refreshFilterButton()}else e.$.sortButton.classList.add("smart-hidden"),e.$.filterButton.classList.add("smart-hidden");e._appliedGrouping?e._appliedGrouping.dataFields=t.dataSource.groupBy:e._appliedGrouping={dataFields:t.dataSource.groupBy,expandAll:!1,collapseAll:!1},e._refreshGroupButton(),e._refreshDeleteButton(),e._refreshDownloadButton(),e._refreshCustomizeButton(),e._refreshViewsButton(),e.refreshTools()}_refreshViewsButton(){const e=this;let t=e.grid.localize("viewGrid");switch(e.grid.view){case"kanban":t=e.grid.localize("viewKanban"),e.$.viewsButton.classList.add("kanban");break;case"grid":e.$.viewsButton.classList.remove("kanban"),t=e.grid.localize("viewGrid")}e.$.viewsButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t+"</div>"}_refreshDownloadButton(){this.$.downloadButton.innerHTML='<div class="smart-tool-label" role="presentation">'+this.grid.localize("download")+"</div>"}_openRowSettingsDialog(e){let t=this;t.getSelectedRows||(t=t.grid);const a=t.editing.dialog.enabled,o=t.editing.mode,s=t.context;t.context=t,t.editing.dialog.enabled=!0,t.editing.mode="row",t._settingsDialogRowId=e,t.beginEdit(e),t._endToolbarEdit?(t.removeEventListener("endEdit",t._endToolbarEdit,null),t.removeEventListener("cancelEdit",t._endToolbarEdit,null)):t._endToolbarEdit=()=>{t.context=t,t.editing.dialog.enabled=a,t.editing.mode=o,t.context=s,delete t._settingsDialogRowId,delete t._dialogEdit},t.addEventListener("endEdit",t._endToolbarEdit),t.addEventListener("cancelEdit",t._endToolbarEdit)}_refreshDeleteButton(){let e=this;if(e.getSelectedRows||(e=e.grid),-1===e.header.buttons.indexOf("delete"))return;const t=e.getSelectedRows().length,a=e.querySelector("smart-grid-toolbar").$.deleteButton;0!==t?(a.classList.remove("smart-hidden"),a.firstElementChild.innerHTML=1===t?e.localize("deleteByOne"):e.localize("deleteByMultiple",{n:t}),a.classList.add("selected"),a.onclick=()=>{const t=e.getSelectedRows().map((e=>e[0]));this.grid.removeRow(t)}):a.classList.add("smart-hidden")}_refreshFromSelection(){this.querySelector("smart-grid-toolbar")._refreshDeleteButton()}openGroupPanel(){const e=this;let t;const a=e.grid;e.$.headerDropDown.classList.add("group-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","search-panel","format-panel"),e.$.group.classList.remove("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.search.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._closeDownloadMenu(),e._closeViewsMenu(),e._refreshColumns("group"),a.closeMenu();const o=e.columns.map((t=>{const a=Object.assign({},t);if(e._appliedGrouping&&e._appliedGrouping.dataFields){const t=e._appliedGrouping.dataFields.indexOf(a.dataField);a.groupIndex=t}return a})).filter((e=>e.allowGroup));e._groupPartCreated?(t=e.$.group.firstElementChild,t.rightToLeft=e.rightToLeft,t.dataSource=o,t.locale=e.locale,t.messages=e._innerElementMessages.groupPanel):(t=document.createElement("smart-group-panel"),t.rightToLeft=e.rightToLeft,t.animation=e.animation,t.locale=e.locale,t.messages=e._innerElementMessages.groupPanel,t.theme=e.theme,t.dataSource=o,e.$.group.appendChild(t),e._groupPartCreated=!0,t.onExpandAll=()=>{e._appliedGrouping.expandAll=!0,e._appliedGrouping.collapseAll=!1,t.querySelector(".smart-group-panel-expand-button").setAttribute("active",""),t.querySelector(".smart-group-panel-collapse-button").removeAttribute("active")},t.onCollapseAll=()=>{e._appliedGrouping.expandAll=!1,e._appliedGrouping.collapseAll=!0,t.querySelector(".smart-group-panel-collapse-button").setAttribute("active",""),t.querySelector(".smart-group-panel-expand-button").removeAttribute("active")},t.addEventListener("apply",(t=>{const o=t.detail.sortByInfo,s=e._appliedGrouping.dataFields;e._appliedGrouping.dataFields=o.dataFields;const n=a.onRowInserted;if(a.onRowInserted=null,a.beginUpdate(),a.grouping.autoHideGroupColumn&&s)for(let e=0;e<s.length;e++){const t=a.columnByDataField[s[e]];t&&(t.visible=!0)}a.clearGroups();for(let e=0;e<o.dataFields.length;e++){const t=o.dataFields[e];a.addGroup(t)}e._appliedGrouping.expandAll&&a.expandAllRows(),e._appliedGrouping.collapseAll&&a.collapseAllRows(),a.endUpdate(),a.$.fireEvent("group",{groups:a.dataSource.groupBy}),a.paging.enabled&&a._refreshPagesCount(),a.onRowInserted=n}))),e._refreshGroupButton(),e._openHeaderDropDown(e.$.groupButton)}_refreshGroupButton(){const e=this,t=e._appliedGrouping.dataFields?e._appliedGrouping.dataFields.length:0;if(0===t){const t=e.localize("group");return e.$.groupButton.firstElementChild.innerHTML!==t&&(e.$.groupButton.firstElementChild.innerHTML=t),void e.$.groupButton.classList.remove("grouped")}e.$.groupButton.firstElementChild.innerHTML=1===t?e.localize("groupedByOne"):e.localize("groupedByMultiple",{n:t}),e.$.groupButton.classList.add("grouped")}openSearchPanel(){this._openSearchPanel()}_closeSearchPanel(){this._search("",!1),super._closeSearchPanel()}_openSearchPanel(){const e=this,t=e.grid;e.$.headerDropDown.classList.add("search-panel"),e.$.headerDropDown.classList.remove("customize-panel","filter-panel","sort-panel","group-panel","format-panel"),e.$.search.classList.remove("smart-hidden"),e.$.customize.classList.add("smart-hidden"),e.$.group.classList.add("smart-hidden"),e.$.filter.classList.add("smart-hidden"),e.$.sort.classList.add("smart-hidden"),e.$.format.classList.add("smart-hidden"),e._openHeaderDropDown(e.$.searchButton),e._closeDownloadMenu(),e._closeViewsMenu(),t.closeMenu();const a=[],o=t.getVisibleRows();for(let e=0;e<o.length;e++)a.push(Object.assign(o[e].data));const s=new Smart.DataAdapter({id:"id",observable:!1,dataSource:a,dataFields:t.dataSource.dataFields});e._searchInfo={source:s,stringDataFields:e.dataSource.dataFields.filter((e=>"string"===e.dataType)).map((e=>e.name))},""!==e.$.searchInput.value&&e._search(e.$.searchInput.value,!1)}_search(e,t=!0){const a=this;if(!a._searchInfo)return;if(a._searchInfo.query=e,""===e)return a.$.search.classList.remove("matches","no-matches"),delete a._searchInfo.foundIdsArray,delete a._searchInfo.foundIdsObject,delete a._searchInfo.highlighted,a.grid.highlighted=null,void a.grid._recycle(!1);const o=a._searchInfo.source,s=[],n=[],i={};a._searchInfo.stringDataFields.forEach((t=>{const a=new Smart.Utilities.FilterGroup,o=a.createFilter("string",e,"CONTAINS");a.addFilter("or",o),s.push([t,a])})),o._filter(s,"or");for(let e=0;e<o.length;e++){const t=o[e];!1!==t.$.filtered&&(n.push(t.$.id),i[t.$.id]=!0)}if(a._searchInfo.foundIdsArray=n,a._searchInfo.foundIdsObject=i,a.grid.highlighted=null,n.length>0)return a.$.search.classList.remove("no-matches"),a.$.search.classList.add("matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:t?1:0,n:n.length}),a._searchInfo.highlighted=n[0],a.grid.highlighted=a._searchInfo.highlighted,a.grid.ensureVisible(a._searchInfo.highlighted),void a.grid._recycle(!1);a.$.search.classList.remove("matches"),a.$.search.classList.add("no-matches"),a.$.searchLabel.innerHTML=a.localize("found",{nth:0,n:0})}_refreshCustomizeButton(){const e=this,t=e.grid;let a=0;if("kanban"===t.view&&t._kanban)return e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t._kanban.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"),void e.$.customizeButton.classList.add("smart-hidden");for(let e=0;e<t.columns.length;e++){const o=t.columns[e];o.autoGenerated||!1!==o._visible&&(t.grouping&&t.grouping.autoHideGroupColumn&&t.dataSource.groupBy.indexOf(o.dataField)>=0||o.visible||a++)}const o=-1===t.header.buttons.indexOf("views");a>0&&o?(e.$.customizeButton.innerHTML=1===a?'<div class="smart-tool-label" role="presentation">'+t.localize("customizeOne",{n:a})+"</div>":'<div class="smart-tool-label" role="presentation">'+t.localize("customizeHidden",{n:a})+"</div>",e.$.customizeButton.classList.add("hidden")):(e.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+t.localize("customize")+"</div>",e.$.customizeButton.classList.remove("hidden"))}_applyColumns(e,t){const a=this,o=a.grid;o.beginUpdate();let s=0;for(let t in e){const a=e[t],n=o.columnByDataField[a.dataField];n&&(n.visible=a.visible,a.visible||s++)}s>0?(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customizeHidden",{n:s})+"</div>",a.$.customizeButton.classList.add("hidden")):(a.$.customizeButton.innerHTML='<div class="smart-tool-label" role="presentation">'+o.localize("customize")+"</div>",a.$.customizeButton.classList.remove("hidden"));for(let e=0;e<t.length;e++){const a=t[e],s=a.oldIndex,n=a.newIndex,i=o.columns[n+1],r=o.columns[n-1],l=o.columns[s];i?l.columnGroup=i.columnGroup:r&&(l.columnGroup=r.columnGroup),o.reorderColumns(s,n,!0)}o.endUpdate()}});
1529
1529
 
1530
1530
  /***/ }),
1531
1531
 
@@ -1539,7 +1539,7 @@ Smart("smart-grid-toolbar",class extends Smart.DataView{template(){return'<div i
1539
1539
  /***/ 2292:
1540
1540
  /***/ (() => {
1541
1541
 
1542
- Smart.Utilities.Assign("Grid.View",class{createBasicKanban(){this._initKanbanView("basic")}createBlankKanban(){this._initKanbanView("blank")}_setupKanbanView(){const e=this,t=e._getStatusColumn("basic");e._createKanban(t),e._addDefaultKanbanColumns(t)}_addDefaultKanbanColumns(e){const t=this;e||(e=t._getStatusColumn("basic"));const a=t._getKanbanTaskFields(e);let l=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a._dataField){if(t.rows)for(let e=0;e<t.rows.length;e++){const l=t.rows[e];l.data[a._dataField]=l.data[a.dataField]}l.push(a)}}if(t.columnByDataField&&t.columnByDataField[e.dataField]){const a=t.columnByDataField[e.dataField];if(t.columnByDataField[e.dataField].dataField="taskStatusDefault",delete t.columnByDataField[e.dataField].displayField,delete t.columnByDataField[e.dataField],t.columnByDataField.taskStatusDefault=a,t.dataSource&&t.dataSource.length)for(let e=0;e<t.dataSource.length;e++){const a=t.dataSource[e];a.taskStatusDefault=a.taskStatus,delete a.taskStatus}}a.forEach((e=>{(!t.columnByDataField||t.columnByDataField&&!t.columnByDataField[e.dataField])&&t.columns.push(e)})),l.forEach((e=>{const a=t.columns.indexOf(e);a>=0&&t.columns.splice(a,1)}))}_getStatusColumn(e){const t=this;return new Smart.Grid.Column({label:!e||e&&"blank"===e?t.localize("dialogNewColumn"):t.localize("status"),description:t.localize("dialogAddColumnStatusDescription"),dataField:"taskStatus",showDescriptionButton:!0,dataType:"string",defaultValue:"",editor:{template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""},{color:"#33B679",label:t.localize("toDo"),value:"toDo"},{color:"#039BE5",label:t.localize("inProgress"),value:"inProgress"},{color:"#8E24AA",label:t.localize("done"),value:"done"}]},template:"tags",cellsAlign:"left",align:"left",grid:t,_view:!0})}_initKanbanView(e){const t=this;if(t._kanbanInitialized)return;t._kanbanInitialized=!0;const a=t._getStatusColumn(e);return t._onColumnUpdated=(e,a)=>{e._view&&(delete e._view,delete t._onColumnUpdated,e.allowSort=e.allowEdit=e.allowFilter=!0,"blank"===a.kanban&&(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"",singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""}]}),t.beginUpdate(),t._createKanban(e),t._addDefaultKanbanColumns(e),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())},e&&"blank"===e?(delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label="New Column",t.beginUpdate(),t._createKanban(a),t._addDefaultKanbanColumns(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate()):e&&"basic"===e?(delete a._view,t.beginUpdate(),t._createKanban(a),t._addDefaultKanbanColumns(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate()):void t._openAddColumnDialog(a,!0,(e=>{!1===e&&(delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"uncategorized",singleSelect:!0,dataSource:[{color:"#DD5347",label:t.localize("uncategorized"),value:"uncategorized"}]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label=t.localize("dialogNewColumn"),t.beginUpdate(),t._createKanban(a),t._getKanbanTaskFields(a).forEach((e=>{t.columns.push(e)})),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())}))}_showKanbanView(){const e=this;e.beginUpdate(),e.$.viewContent.classList.remove("smart-hidden"),e.$.content.classList.add("smart-hidden"),e._showAddNewRowButton("float"),e.$.viewContent.appendChild(e._kanban),e.classList.add("smart-kanban-view"),e._updateKanbanView(),e._kanban.refresh(),e._onFilter=e._onSort=()=>{"kanban"===e.view&&(e._updateKanbanView(),e._kanban.refresh())}}_hideKanbanView(){const e=this;e.classList.contains("smart-kanban-view")&&(e.$.viewContent.classList.add("smart-hidden"),e.$.content.classList.remove("smart-hidden"),e._kanban.remove(),e.classList.remove("smart-kanban-view"),e._resetCachedLayout(),e.dataSource.boundHierarchy&&(e.dataSource.refreshHierarchy(),e._refreshRowHierarchy(!0,!0)),e.endUpdate(),e.dataSource.boundHierarchy&&e._recycle())}_getPriorityDataSource(){const e=this;return[{color:"#33B679",label:e._kanban.localize("low"),value:"low"},{color:"#039BE5",label:e._kanban.localize("average"),value:"average"},{color:"#DD5347",label:e._kanban.localize("high"),value:"high"},{color:"#AF0020",label:e._kanban.localize("critical"),value:"critical"}]}_getKanbanTaskFields(e){const t=this,a=[],l=new Smart.Grid.Column({label:t._kanban.localize("startDate"),dataField:"taskStartDate",cellsFormat:"d",showDescriptionButton:!0,dataType:"date",allowDelete:!1,editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e>a.taskDueDate&&a.taskDueDate&&e)||t.localize("invalidMaxValue",{value:t._kanban.localize("startDate"),max:a.taskDueDate.toLocaleDateString()})},visible:!1,_visible:!1,grid:t}),o=new Smart.Grid.Column({label:t._kanban.localize("dueDate"),dataField:"taskDueDate",cellsFormat:"d",showDescriptionButton:!0,allowDelete:!1,dataType:"date",editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e<a.taskStartDate&&a.taskStartDate&&e)||t.localize("invalidMinValue",{value:t._kanban.localize("dueDate"),min:a.taskStartDate.toLocaleDateString()})},visible:!0,_visible:!0,grid:t}),n=new Smart.Grid.Column({label:t._kanban.localize("priority"),dataField:"taskPriority",showDescriptionButton:!0,dataType:"string",visible:!1,_visible:!1,allowDelete:!1,defaultValue:"average",disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,allowEmptyItem:!1,disabledDialogOptions:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:t._getPriorityDataSource()},template:"tags",grid:t}),i=new Smart.Grid.Column({label:t._kanban.localize("tags"),dataField:"taskTags",allowDelete:!1,visible:!1,_visible:!1,showDescriptionButton:!0,dataType:"string",template:"tags",grid:t}),s=new Smart.Grid.Column({label:t._kanban.localize("progress"),dataField:"taskProgress",showDescriptionButton:!0,allowDelete:!1,visible:!1,_visible:!1,disabledDialogOptions:["numberFormat","minValue","maxValue"],dataType:"number",cellsFormat:"p0",template:"progress",editor:{disabledDialogOptions:!0,template:"numberInput",min:0,max:1},grid:t}),r=new Smart.Grid.Column({label:t._kanban.localize("description"),dataField:"taskDescription",allowDelete:!1,showDescriptionButton:!0,editor:{template:"textarea"},dataType:"string",visible:!0,grid:t}),d=new Smart.Grid.Column({label:t._kanban.localize("text"),allowDelete:!1,dataField:"taskText",showDescriptionButton:!0,dataType:"string",visible:!0,grid:t}),u=new Smart.Grid.Column({label:t._kanban.localize("color"),allowDelete:!1,dataField:"taskColor",showDescriptionButton:!0,dataType:"string",editor:{template:"colorInput"},template:"color",width:60,visible:!1,_visible:!1,grid:t}),c=new Smart.Grid.Column({label:t._kanban.localize("checklist"),dataField:"taskChecklist",showDescriptionButton:!0,allowSort:!1,allowDelete:!1,allowFilter:!1,visible:!1,_visible:!1,disabledDialogOptions:["allowFilter","allowSort"],formatFunction(e){if(e.value&&Array.isArray(e.value)){const a=e.value.filter((e=>e.completed)).length;e.value=t.localize("completed",{value:a})+"/"+e.value.length}else e.value=""},editor:{template:"<smart-multi-combo-input></smart-multi-combo-input>",settings:{inputTagsMode:"one",readonly:!0,allowItemsAdd:!0,allowItemsRemove:!0},onRender:function(e,a,l,o){const n="string"==typeof o[a]&&o[a]?JSON.parse(o[a]):o[a],i=[],s=l.firstElementChild;if(s.isInitialized&&(s.messages[t.locale].tagLabel=t._kanban.messages[t.locale].taskCompleted,s.messages[t.locale].tagLabelOne=t._kanban.messages[t.locale].taskCompleted),n){const e=n.map((e=>{const t={label:e.text,value:e.text};return e.completed&&i.push(t),t}));s.dataSource=e}else s.dataSource=[];s.selectedItems=i,!t.editing.editRow&&s.open&&s.open()},setValue:function(){},getValue:function(){const e=this.firstElementChild;return e.dataSource.map((t=>{const a=e.selectedItems.find((e=>t.value===e.value));return{text:t.label,completed:void 0!==a}}))}},dataType:"any",grid:t});let m=!0;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.editor&&a.editor.collaborator){m=!1;break}}if(a.push(d),a.push(r),a.push(e),a.push(l),a.push(o),a.push(s),a.push(n),a.push(i),a.push(c),a.push(u),m){let e=[""];for(let a=0;a<t.users.length;a++)e.push({label:t.users[a].name,value:t.users[a].id,id:t.users[a].id,image:t.users[a].image,color:t.users[a].color||""});const o=new Smart.Grid.Column({label:t._kanban.localize("assignedTo"),allowDelete:!1,dataField:"taskUserId",showDescriptionButton:!0,disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,collaborator:!0,disabledDialogOptions:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!0,dataSource:e},dataType:"string",visible:!1,_visible:!1,template:"tags",grid:t});a.push(o),t._kanbanViewColumns=[l,o,s,n,i,c,u]}else t._kanbanViewColumns=[l,s,n,i,c,u];return a}getKanbanProperties(){const e=this;return e._kanbanProperties||(e._kanbanProperties={},e._kanbanProperties=Object.assign({},{taskColorEntireSurface:!1,collapsible:!0,addNewButton:!0,addNewButtonDisplayMode:"both",addNewColumn:!0,allowColumnRemove:!0,editable:!0,columnActions:!0,columnEditMode:"headerAndMenu",allowColumnEdit:!0,allowColumnReorder:!0,taskActions:!0,taskDue:!0,taskComments:!0,taskProgress:!0,columnSummary:!0,columnColors:!0,taskPriority:!0,taskUserIcon:!0,taskSubTasks:"none",columnColorEntireSurface:!0,columnFooter:!0})),e._kanbanProperties}setKanbanProperties(e){const t=this,a=t.getKanbanProperties();for(let t in e)void 0!==e[t]&&void 0!==a[t]&&(a[t]=e[t]);t._kanbanProperties=a,t.classList.contains("smart-kanban-view")&&(t._updateKanbanView(),t._kanban.refresh())}_updateKanbanView(e){const t=this;if(!t._kanban)return;if(!t.isInitialized)return;e||(e=t.columnByDataField.taskStatus);const a=t._kanban,l=a.context;a.context=a;const o=e.editor.dataSource&&e.editor.dataSource.length>0?e.editor.dataSource:[{label:e.label,value:e.value,color:"#DD5347"}];a.users=t.users,a.currentUser=t.currentUser;const n=t.getKanbanProperties();for(let e in n)a[e]=n[e];let i=[];for(let e=0;e<o.length;e++){const a=o[e];let l=a.label;""===a.label&&(l=a.labelAlt?a.labelAlt:t.localize("uncategorized")),i.push({label:l,value:a.value,status:a.value,dataField:a.value,color:a.color})}a.columns=i;let s=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.dataField.startsWith("task"))continue;if(a._dataField)continue;if(!1===a.allowEdit)continue;s.push({label:a.label||"",dataField:a.dataField,dataType:a.dataType,editor:a.editor.template});const l=s[s.length-1];a.editor.dataSource&&(l.dataSource=[...a.editor.dataSource]),a.editor.colorItems&&(l.colorItems=a.editor.colorItems),a.editor.colorItems&&(l.pills=a.editor.pills),a.editor.colorItems&&(l.singleSelect=a.editor.singleSelect),a.editor.dropDownButtonPosition&&(l.dropDownButtonPosition=a.editor.dropDownButtonPosition),["min","max","minLength","maxLength","minDate","maxDate"].forEach((e=>{void 0!==a.editor[e]&&(l[e]=a.editor[e])}))}a.taskCustomFields=s;const r=[];for(let e=0;e<t.dataSource.length;e++){const a=t.dataSource[e],l={},o=a.$.id;if(!1===a.$.filtered)continue;const n=t.rowById[o];n&&(l.history=n.history,n.comments&&(l.comments=n.comments)),void 0===a.taskStatus&&(a.taskStatus="");for(let e in a){if(e.startsWith("$"))continue;let t=a[e];if(e.startsWith("task")){let a=e.replace("task","");a=a.substring(0,1).toLowerCase()+a.substring(1),"progress"===a&&(t=100*parseFloat(t)),l[a]=t}else l[e]=t}l.id=a.$.id,r.push(l)}a.dataSource=r,a.context=l}_getTaskData(e){const t=this,a={},l=t._kanban;for(let o=0;o<t.columns.length;o++){const n=t.columns[o].dataField;if(n.startsWith("task")){let t=n.replace("task","");if(t=t.substring(0,1).toLowerCase()+t.substring(1),"checklist"===t){a[n]=e.checklist;continue}if("history"===t&&(a[n]=e.history),void 0===e[t])continue;if("status"===t)a[n]=e[t];else if("priority"===t){const l=e[t];a[n]=l}else a[n]="progress"===t?parseFloat(e[t])/100:e[t]}else l.taskCustomFields&&l.taskCustomFields.length&&l.taskCustomFields.find((e=>e.dataField===n))&&(a[n]=e[n])}return a}_createKanban(e){const t=this;if(t._kanban)return;const a=document.createElement("smart-kanban");t._kanban=a,t._updateKanbanView(e),a.style.width="100%",a.style.height="100%",a.style.borderTopColor="transparent",a.style.borderLeftColor="transparent",a.style.borderRightColor="transparent",a.style.borderBottomColor="transparent",a.style.background="inherit","kanban"===t.view&&(t.$.viewContent.classList.remove("smart-hidden"),t.$.content.classList.add("smart-hidden")),t.onViewInit&&t.onViewInit(a),t.$.viewContent.appendChild(a),"kanban"===t.view&&t.classList.add("smart-kanban-view"),t.editing.addNewColumn._addButton&&t.editing.addNewColumn._addButton.classList.remove("show");const l=()=>{const e=this,t=e.columnByDataField.taskStatus,a=e._kanban,l=[];for(let e=0;e<a.columns.length;e++){const t=a.columns[e],o={label:t.dataField?t.label:"",labelAlt:t.label,value:t.dataField,color:t.color};l.push(o)}if(t.editor.isDirty=!0,t.editor.dataSource=l,delete t.editor._items,e.onColumnUpdated){const a=e.viewColumns.indexOf(t);e.onColumnUpdated(a,t)}};a.addEventListener("columnUpdate",(()=>{l()})),a.addEventListener("columnAdd",(()=>{l()})),a.addEventListener("columnRemove",(()=>{l()})),a.addEventListener("taskAdd",(e=>{const a=e.detail.value,l=t._getTaskData(a);t._onRowInserted=e=>{a.id=e.id},t.addRow(l,!0,(e=>{a.id=e.id})),t._refreshHeaderBar(),delete t._onRowInserted})),a.addEventListener("taskRemove",(e=>{t.removeRow(e.detail.id),t._refreshHeaderBar()})),a.addEventListener("taskUpdate",(e=>{const a=e.detail.value,l=t._getTaskData(a);t.updateRow(e.detail.id,l);const o=t.rowById[e.detail.id];o&&(o.history=a.history,o.comments=a.comments)}))}});
1542
+ Smart.Utilities.Assign("Grid.View",class{createBasicKanban(){this._initKanbanView("basic")}createBlankKanban(){this._initKanbanView("blank")}_setupKanbanView(){const e=this;let t=e._getStatusColumn("basic"),a=[];e.columnByDataField||(e.columnByDataField=[]);for(let l=0;l<e.columns.length;l++){const o=e.columns[l];if(e.columnByDataField[o.dataField]||(e.columnByDataField[o.dataField]=o),"taskStatus"===o.dataField&&(t=o),o._dataField){if(e.rows)for(let t=0;t<e.rows.length;t++){const a=e.rows[t];a.data[o._dataField]=a.data[o.dataField]}a.push(o)}}0!==a.length&&(e._createKanban(t),e._addDefaultKanbanColumns(t))}_addDefaultKanbanColumns(e){const t=this;e||(e=t._getStatusColumn("basic"));const a=t._getKanbanTaskFields(e);let l=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a._dataField){if(t.rows)for(let e=0;e<t.rows.length;e++){const l=t.rows[e];l.data[a._dataField]=l.data[a.dataField]}l.push(a)}}let o=[],n=[];const i=t.isInitialized;t.isInitialized=!0,a.forEach((e=>{if(!t.columnByDataField||t.columnByDataField&&!t.columnByDataField[e.dataField])l.forEach((t=>{t._dataField===e.dataField&&(t.visible=!1,t._visible=!1)})),t.columns.push(e),o.push(t.columns.length-1),n.push(e);else if(t.columnByDataField&&t.columnByDataField[e.dataField]){const a=t.columnByDataField[e.dataField];a.editor=e.editor,a.formatFunction=e.formatFunction}})),void 0===t.columns.canNotify&&t.onColumnInserted&&t.onColumnInserted(o,n),t.isInitialized=i}_getStatusColumn(e){const t=this;return new Smart.Grid.Column({label:!e||e&&"blank"===e?t.localize("dialogNewColumn"):t.localize("status"),description:t.localize("dialogAddColumnStatusDescription"),dataField:"taskStatus",showDescriptionButton:!0,dataType:"string",defaultValue:"",editor:{template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""},{color:"#33B679",label:t.localize("toDo"),value:"toDo"},{color:"#039BE5",label:t.localize("inProgress"),value:"inProgress"},{color:"#8E24AA",label:t.localize("done"),value:"done"}]},template:"tags",cellsAlign:"left",align:"left",grid:t,_view:!0})}_initKanbanView(e){const t=this;if(t._kanbanInitialized)return;t._kanbanInitialized=!0;const a=t._getStatusColumn(e);if(t._onColumnUpdated=(e,a)=>{e._view&&(delete e._view,delete t._onColumnUpdated,e.allowSort=e.allowEdit=e.allowFilter=!0,"blank"===a.kanban&&(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"",singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""}]}),t.beginUpdate(),t._createKanban(e),t._addDefaultKanbanColumns(e),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())},e&&"blank"===e)return delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label="New Column",t.beginUpdate(),t._createKanban(a),t._addDefaultKanbanColumns(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate();if(e&&"basic"===e)return delete a._view,t.beginUpdate(),t._createKanban(a),t._addDefaultKanbanColumns(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate();if(t._kanbanViewColumns){let e=!1;if(t._kanbanViewColumns.forEach((a=>{if(!t.columnByDataField[a.dataField])return e=!0,!0})),!e)return void t._showKanbanView()}t._openAddColumnDialog(a,!0,(e=>{!1===e&&(delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"uncategorized",singleSelect:!0,dataSource:[{color:"#DD5347",label:t.localize("uncategorized"),value:"uncategorized"}]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label=t.localize("dialogNewColumn"),t.beginUpdate(),t._createKanban(a),t._getKanbanTaskFields(a).forEach((e=>{t.columns.push(e)})),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())}))}_showKanbanView(){const e=this;e.beginUpdate(),e.$.viewContent.classList.remove("smart-hidden"),e.$.content.classList.add("smart-hidden"),e._showAddNewRowButton("float"),e.$.viewContent.appendChild(e._kanban),e.classList.add("smart-kanban-view"),e._updateKanbanView(),e._kanban.refresh(),e._onFilter=e._onSort=()=>{"kanban"===e.view&&(e._updateKanbanView(),e._kanban.refresh())}}_hideKanbanView(){const e=this;e.classList.contains("smart-kanban-view")&&(e.$.viewContent.classList.add("smart-hidden"),e.$.content.classList.remove("smart-hidden"),e._kanban.remove(),e.classList.remove("smart-kanban-view"),e._resetCachedLayout(),e.dataSource.boundHierarchy&&(e.dataSource.refreshHierarchy(),e._refreshRowHierarchy(!0,!0)),e.endUpdate(),e.dataSource.boundHierarchy&&e._recycle())}_getPriorityDataSource(){const e=this;return[{color:"#33B679",label:e._kanban.localize("low"),value:"low"},{color:"#039BE5",label:e._kanban.localize("average"),value:"average"},{color:"#DD5347",label:e._kanban.localize("high"),value:"high"},{color:"#AF0020",label:e._kanban.localize("critical"),value:"critical"}]}_getKanbanTaskFields(e){const t=this,a=[],l=new Smart.Grid.Column({label:t._kanban.localize("startDate"),dataField:"taskStartDate",cellsFormat:"d",showDescriptionButton:!0,dataType:"date",allowDelete:!1,editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e>a.taskDueDate&&a.taskDueDate&&e)||t.localize("invalidMaxValue",{value:t._kanban.localize("startDate"),max:a.taskDueDate.toLocaleDateString()})},visible:!1,grid:t}),o=new Smart.Grid.Column({label:t._kanban.localize("dueDate"),dataField:"taskDueDate",cellsFormat:"d",showDescriptionButton:!0,allowDelete:!1,dataType:"date",editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e<a.taskStartDate&&a.taskStartDate&&e)||t.localize("invalidMinValue",{value:t._kanban.localize("dueDate"),min:a.taskStartDate.toLocaleDateString()})},visible:!0,_visible:!0,grid:t}),n=new Smart.Grid.Column({label:t._kanban.localize("priority"),dataField:"taskPriority",showDescriptionButton:!0,dataType:"string",visible:!1,allowDelete:!1,defaultValue:"average",disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,allowEmptyItem:!1,disabledDialogOptions:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:t._getPriorityDataSource()},template:"tags",grid:t}),i=new Smart.Grid.Column({label:t._kanban.localize("tags"),dataField:"taskTags",allowDelete:!1,allowGroup:!1,visible:!1,showDescriptionButton:!0,dataType:"string",template:"tags",grid:t}),s=new Smart.Grid.Column({label:t._kanban.localize("progress"),dataField:"taskProgress",showDescriptionButton:!0,allowDelete:!1,visible:!1,disabledDialogOptions:["numberFormat","minValue","maxValue"],dataType:"number",cellsFormat:"p0",template:"progress",editor:{disabledDialogOptions:!0,template:"numberInput",min:0,max:1},grid:t}),r=new Smart.Grid.Column({label:t._kanban.localize("description"),dataField:"taskDescription",allowGroup:!1,allowDelete:!1,showDescriptionButton:!0,editor:{template:"textarea"},dataType:"string",visible:!0,grid:t}),d=new Smart.Grid.Column({label:t._kanban.localize("text"),allowDelete:!1,allowGroup:!1,dataField:"taskText",showDescriptionButton:!0,dataType:"string",visible:!0,grid:t}),u=new Smart.Grid.Column({label:t._kanban.localize("color"),allowDelete:!1,dataField:"taskColor",showDescriptionButton:!0,dataType:"string",editor:{template:"colorInput"},template:"color",width:60,visible:!1,grid:t}),c=new Smart.Grid.Column({label:t._kanban.localize("checklist"),dataField:"taskChecklist",allowGroup:!1,showDescriptionButton:!0,allowSort:!1,allowDelete:!1,allowFilter:!1,visible:!1,disabledDialogOptions:["allowFilter","allowSort"],formatFunction(e){if(e.value&&e.value.indexOf("[")>=0&&(e.value=JSON.parse(e.value)),e.value&&Array.isArray(e.value)&&e.value.length>0){const a=e.value.filter((e=>e.completed)).length;e.value=t.localize("completed",{value:a})+"/"+e.value.length}else e.value=""},editor:{template:"<smart-multi-combo-input></smart-multi-combo-input>",settings:{inputTagsMode:"one",readonly:!0,allowItemsAdd:!0,allowItemsRemove:!0},onRender:function(e,a,l,o){const n="string"==typeof o[a]&&o[a]?JSON.parse(o[a]):o[a],i=[],s=l.firstElementChild;if(s.isInitialized&&(s.messages[t.locale].tagLabel=t._kanban.messages[t.locale].taskCompleted,s.messages[t.locale].tagLabelOne=t._kanban.messages[t.locale].taskCompleted),n){const e=n.map((e=>{const t={label:e.text,value:e.text};return e.completed&&i.push(t),t}));s.dataSource=e}else s.dataSource=[];s.selectedItems=i,!t.editing.editRow&&s.open&&s.open()},setValue:function(){},getValue:function(){const e=this.firstElementChild;return e.dataSource.map((t=>{const a=e.selectedItems.find((e=>t.value===e.value));return{text:t.label,completed:void 0!==a}}))}},dataType:"any",grid:t});let m=!0;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.editor&&a.editor.collaborator){m=!1;break}}if(a.push(d),a.push(r),a.push(e),a.push(l),a.push(o),a.push(s),a.push(n),a.push(i),a.push(c),a.push(u),m){let e=[""];for(let a=0;a<t.users.length;a++)e.push({label:t.users[a].name,value:t.users[a].id,id:t.users[a].id,image:t.users[a].image,color:t.users[a].color||""});const o=new Smart.Grid.Column({label:t._kanban.localize("assignedTo"),allowDelete:!1,dataField:"taskUserId",showDescriptionButton:!0,disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,collaborator:!0,disabledDialogOptions:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!0,dataSource:e},dataType:"string",visible:!1,template:"tags",grid:t});a.push(o),t._kanbanViewColumns=[l,o,s,n,i,c,u]}else t._kanbanViewColumns=[l,s,n,i,c,u];return a}getKanbanProperties(){const e=this;return e._kanbanProperties||(e._kanbanProperties={},e._kanbanProperties=Object.assign({},{taskColorEntireSurface:!1,collapsible:!0,addNewButton:!0,addNewButtonDisplayMode:"both",addNewColumn:!0,allowColumnRemove:!0,editable:!0,columnActions:!0,columnEditMode:"headerAndMenu",allowColumnEdit:!0,allowColumnReorder:!0,taskActions:!0,taskDue:!0,autoColumnHeight:!0,columnWidth:275,taskComments:!0,taskProgress:!0,columnSummary:!0,columnColors:!0,taskPriority:!0,taskUserIcon:!0,taskSubTasks:"none",columnColorEntireSurface:!0,columnFooter:!0})),e._kanbanProperties}setKanbanProperties(e){const t=this,a=t.getKanbanProperties();for(let t in e)void 0!==e[t]&&void 0!==a[t]&&(a[t]=e[t]);t._kanbanProperties=a,t.classList.contains("smart-kanban-view")&&(t._updateKanbanView(),t._kanban.refresh())}_updateKanbanView(e){const t=this;if(!t._kanban)return;if(!t.isInitialized)return;e||(e=t.columnByDataField.taskStatus);const a=t._kanban,l=a.context;a.context=a;const o=e.editor.dataSource&&e.editor.dataSource.length>0?e.editor.dataSource:[{label:e.label,value:e.value,color:"#DD5347"}];a.users=t.users,a.currentUser=t.currentUser;const n=t.getKanbanProperties();for(let e in n)a[e]=n[e];let i=[];for(let e=0;e<o.length;e++){const a=o[e];let l=a.label;""===a.label&&(l=a.labelAlt?a.labelAlt:t.localize("uncategorized")),i.push({label:l,value:a.value,status:a.value,dataField:a.value,color:a.color})}a.columns=i;let s=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.dataField.startsWith("task"))continue;if(a._dataField)continue;if(!1===a.allowEdit)continue;s.push({label:a.label||"",dataField:a.dataField,dataType:a.dataType,editor:a.editor.template});const l=s[s.length-1];a.editor.dataSource&&(l.dataSource=[...a.editor.dataSource]),a.editor.colorItems&&(l.colorItems=a.editor.colorItems),a.editor.colorItems&&(l.pills=a.editor.pills),a.editor.colorItems&&(l.singleSelect=a.editor.singleSelect),a.editor.dropDownButtonPosition&&(l.dropDownButtonPosition=a.editor.dropDownButtonPosition),["min","max","minLength","maxLength","minDate","maxDate"].forEach((e=>{void 0!==a.editor[e]&&(l[e]=a.editor[e])}))}a.taskCustomFields=s;const r=[];for(let e=0;e<t.dataSource.length;e++){const a=t.dataSource[e],l={},o=a.$.id;if(!1===a.$.filtered)continue;const n=t.rowById[o];n&&(l.history=n.history,n.comments&&(l.comments=n.comments)),void 0===a.taskStatus&&(a.taskStatus="");for(let e in a){if(e.startsWith("$"))continue;let t=a[e];if(e.startsWith("task")){let a=e.replace("task","");a=a.substring(0,1).toLowerCase()+a.substring(1),"progress"===a&&(t=100*parseFloat(t)),"checklist"===a&&(t=t.length?JSON.parse(t):[]),l[a]=t}else l[e]=t}l.id=a.$.id,r.push(l)}a.dataSource=r,a.context=l}_getTaskData(e){const t=this,a={},l=t._kanban;for(let o=0;o<t.columns.length;o++){const n=t.columns[o].dataField;if(n.startsWith("task")){let t=n.replace("task","");if(t=t.substring(0,1).toLowerCase()+t.substring(1),"checklist"===t){a[n]=e.checklist;continue}if("history"===t&&(a[n]=e.history),void 0===e[t])continue;if("status"===t)a[n]=e[t];else if("priority"===t){const l=e[t];a[n]=l}else a[n]="progress"===t?parseFloat(e[t])/100:e[t]}else l.taskCustomFields&&l.taskCustomFields.length&&l.taskCustomFields.find((e=>e.dataField===n))&&(a[n]=e[n])}return a}_createKanban(e){const t=this;if(t._kanban)return;const a=document.createElement("smart-kanban");t._kanban=a,t._updateKanbanView(e),a.style.width="100%",a.style.height="100%",a.style.borderTopColor="transparent",a.style.borderLeftColor="transparent",a.style.borderRightColor="transparent",a.style.borderBottomColor="transparent",a.style.background="inherit","kanban"===t.view&&(t.$.viewContent.classList.remove("smart-hidden"),t.$.content.classList.add("smart-hidden")),t.onViewInit&&t.onViewInit(a),t.$.viewContent.appendChild(a),"kanban"===t.view&&t.classList.add("smart-kanban-view"),t.editing.addNewColumn._addButton&&t.editing.addNewColumn._addButton.classList.remove("show");const l=()=>{const e=this,t=e.columnByDataField.taskStatus,a=e._kanban,l=[];for(let e=0;e<a.columns.length;e++){const t=a.columns[e],o={label:t.dataField?t.label:"",labelAlt:t.label,value:t.dataField,color:t.color};l.push(o)}if(t.editor.isDirty=!0,t.editor.dataSource=l,t._state&&(t._state.editor=t.editor),delete t.editor._items,e.onColumnUpdated){const a=e.viewColumns.indexOf(t);e.onColumnUpdated(a,t)}};a.addEventListener("columnUpdate",(()=>{l()})),a.addEventListener("columnAdd",(()=>{l()})),a.addEventListener("columnRemove",(()=>{l()})),a.addEventListener("taskAdd",(e=>{const a=e.detail.value,l=t._getTaskData(a);t._onRowInserted=e=>{a.id=e.id},t.addRow(l,!0,(e=>{a.id=e.id})),t._refreshHeaderBar(),delete t._onRowInserted})),a.addEventListener("taskRemove",(e=>{t.removeRow(e.detail.id),t._refreshHeaderBar()})),a.addEventListener("taskUpdate",(e=>{const a=e.detail.value,l=t._getTaskData(a);t.updateRow(e.detail.id,l);const o=t.rowById[e.detail.id];o&&(o.history=a.history,o.comments=a.comments,t.onComment&&t.onComment(e.detail.id,o.comments))}))}});
1543
1543
 
1544
1544
  /***/ }),
1545
1545
 
@@ -1686,7 +1686,7 @@ Smart("smart-tooltip",class extends Smart.ContentElement{static get properties()
1686
1686
  /***/ 5482:
1687
1687
  /***/ (() => {
1688
1688
 
1689
- Smart("smart-tree-item",class extends Smart.MenuItem{static get properties(){return{selected:{value:!1,type:"boolean"}}}ready(){const e=this;Object.defineProperty(e,"hasStyleObserver",{get:function(){return!1}}),super.ready(),e.setAttribute("role","treeitem"),e.setAttribute("aria-label",e.label)}propertyChangedHandler(e,t,r){const n=this,l=n.menu;if(super.propertyChangedHandler(e,t,r),"level"===e)return void(n.level=t);if("disabled"===e||"separator"===e||!l)return;const a=l.context;switch(l.context=l,e){case"label":{const e=l.sorted&&l.autoSort;n.firstElementChild.firstElementChild.firstElementChild.innerHTML=r,e&&(l._unsortItems(l.$.mainContainer),l._applyGrouping(l.$.mainContainer)),l._state.filter&&l._applyFilter(l._state.filter),n.setAttribute("aria-label",r);break}case"selected":n.selected=t,r?l.select(n):l.unselect(n);break;case"shortcut":{let e=n.firstElementChild.children[1];e||(e=document.createElement("div"),e.className="smart-tree-item-shortcut",n.firstElementChild.appendChild(e)),e.innerHTML=r;break}case"value":l.sort&&l.sorted&&l.autoSort&&l._refreshSorting()}l.context=a}_setId(){}}),Smart("smart-tree-items-group",class extends Smart.MenuItemsGroup{static get properties(){return{selected:{value:!1,type:"boolean"}}}ready(){const e=this;Object.defineProperty(e,"hasStyleObserver",{get:function(){return!1}}),super.ready(),e.setAttribute("role","treeitem"),e.removeAttribute("aria-haspopup"),e.setAttribute("aria-label",e.label)}propertyChangedHandler(e,t,r){const n=this,l=n.menu;if(super.propertyChangedHandler(e,t,r),"level"===e)return void(n.level=t);if("disabled"===e||"separator"===e||!l)return;const a=l.context;switch(l.context=l,e){case"expanded":n.expanded=t,r?l.expandItem(n):l.collapseItem(n);break;case"label":{const e=l.sorted&&l.autoSort;n.firstElementChild.firstElementChild.firstElementChild.innerHTML=r,e&&(l._unsortItems(l.$.mainContainer),l._applyGrouping(l.$.mainContainer)),l._state.filter&&l._applyFilter(l._state.filter),n.setAttribute("aria-label",r);break}case"selected":n.selected=t,r?l.select(n):l.unselect(n);break;case"value":l.sort&&l.sorted&&l.autoSort&&l._refreshSorting()}l.context=a}_setId(){}}),Smart("smart-tree",class extends Smart.Menu{static get properties(){return{allowDrag:{value:!1,type:"boolean"},allowDrop:{value:!1,type:"boolean"},autoHideToggleElement:{value:!1,type:"boolean"},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},autoSort:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},dragFeedbackFormatFunction:{value:null,type:"function?"},dragOffset:{value:[10,10],type:"array"},editable:{value:!1,type:"boolean"},expandMode:{value:"multiple",allowedValues:["multiple","single"],type:"string"},filterable:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterMember:{value:"label",type:"string"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},hasThreeStates:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{value:{en:{noId:"smart-tree: Saving and loading the element's state are not available if the element has no id."}},type:"object",extend:!0},scrollMode:{value:"scrollbar",allowedValues:["scrollbar","scrollButtons"],type:"string"},selectedIndexes:{value:[],type:"array"},selectionDisplayMode:{value:"row",allowedValues:["row","label"],type:"string"},selectionMode:{value:"one",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectionTarget:{value:"all",allowedValues:["all","leaf"],type:"string"},showLines:{value:!1,type:"boolean"},showRootLines:{value:!1,type:"boolean"},sort:{value:null,type:"function?",reflectToAttribute:!1},sortDirection:{value:"asc",allowedValues:["asc","desc"],type:"string"},sorted:{value:!1,type:"boolean"},toggleElementPosition:{value:"near",allowedValues:["near","far"],type:"string"},toggleMode:{value:"dblclick",allowedValues:["click","dblclick","arrow"],type:"string"}}}static get listeners(){return{blur:"_blurHandler",focus:"_focusHandler",keydown:"_keydownHandler",mouseenter:"_mouseenterHandler",mouseleave:"_mouseleaveHandler",resize:"_checkOverflow",styleChanged:"_styleChangedHandler",transitionend:"_overriddenMenuHandler","container.click":"_overriddenMenuHandler","container.mouseout":"_overriddenMenuHandler","container.mouseover":"_overriddenMenuHandler","container.pointerover":"_pointeroverHandler","editInput.blur":"_editInputBlurHandler","filterInput.keydown":"_filterInputKeydownHandler","filterInput.keyup":"_filterInputKeyupHandler","mainContainer.click":"_overriddenMenuHandler","mainContainer.mouseleave":"_overriddenMenuHandler","mainContainer.mouseout":"_overriddenMenuHandler","mainContainer.mouseover":"_overriddenMenuHandler","mainContainer.swipeleft":"_mainContainerSwipeHandler","mainContainer.swiperight":"_mainContainerSwipeHandler","scrollButtonFar.click":"_scrollButtonFarClickHandler","scrollButtonNear.click":"_scrollButtonNearClickHandler","scrollViewer.down":"_scrollViewerDownHandler","scrollViewer.kineticScroll":"_scrollViewerWheelHandler","scrollViewer.touchmove":"_scrollViewerTouchmoveHandler","mainContainer.wheel":"_scrollViewerWheelHandler","document.move":"_moveHandler","document.selectstart":"_selectstartHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}static get styleUrls(){return["smart.scrollbar.css","smart.scrollviewer.css","smart.tree.css"]}template(){return'<div id="container" role="presentation">\n <div class="smart-tree-filter-input-container" role="presentation"><input id="filterInput" class="smart-filter-input" disabled="[[disabled]]" placeholder="[[filterInputPlaceholder]]" type="text" role="searchbox" aria-label="[[filterInputPlaceholder]]" /></div>\n <smart-repeat-button id="scrollButtonNear" class="smart-tree-scroll-button smart-spin-button smart-scroll-button-near smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll up">\n <div id="arrowNear" class="smart-arrow smart-arrow-up"></div>\n </smart-repeat-button>\n <smart-scroll-viewer id="scrollViewer" animation="[[animation]]" horizontal-scroll-bar-visibility="hidden" right-to-left="[[rightToLeft]]">\n <div id="mainContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-tree-main-container" role="presentation">\n <content></content>\n </div>\n <input type="text" id="editInput" class="smart-tree-edit-input smart-hidden" />\n </smart-scroll-viewer>\n <smart-repeat-button id="scrollButtonFar" class="smart-tree-scroll-button smart-spin-button smart-scroll-button-far smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll down">\n <div id="arrowFar" class="smart-arrow smart-arrow-down"></div>\n </smart-repeat-button>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" role="presentation">\n <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n </div>\n </div>'}detached(){const e=this,t=e._dragDetails;if(super.detached(),!t)return;const r=Smart.Tree.hoveredTree,n=Smart.Tree.hoveredItem;delete e._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,e.$.scrollViewer._scrollView.disableSwipeScroll=!1,t.FeedbackShown&&(n.classList.remove("drop-target","top","bottom"),document.body.classList.remove("smart-dragging"),t.Feedback.remove(),r&&clearInterval(r._dragInterval))}addAfter(e,t){void 0!==(t=this.getItem(t))&&this.addTo(e,t.parentItem,t,!0)}addBefore(e,t){void 0!==(t=this.getItem(t))&&this.addTo(e,t.parentItem,t)}addTo(e,t){const r=this;if(!(e instanceof Smart.TreeItem||e instanceof Smart.TreeItemsGroup))if("string"==typeof e){const t=document.createElement("smart-tree-item");t.label=e,e=t}else{if(!e||!e.label)return;{const t=document.createElement("smart-tree-item");t.label=e.label,e=t}}let n,l;if(e.isDirty=!1,void 0===t)n=1,l=t=r.$.mainContainer;else{if((t=r.getItem(t))instanceof Smart.TreeItemsGroup==0)return;n=t.level+1,l=t.itemContainer}r._createItemHTMLStructure(e,n,t,l.childElementCount,0);const a=r.sorted&&r.autoSort,o=r._state.filter,s=r.selectedIndexes.slice(0);a&&r._unsortItems(r.$.mainContainer),e instanceof Smart.TreeItemsGroup&&(Array.from(e.querySelectorAll("smart-tree-item, smart-tree-items-group")).forEach((e=>e.isDirty=!1)),r._processHTML(e,n+1,!1));let i=arguments[2];i&&arguments[3]&&(i=i.nextElementSibling),i?(l.insertBefore(e,i),r._menuItems={},r._refreshItemPaths(r.$.mainContainer,!0,void 0,r.sorted&&!r.autoSort)):l.appendChild(e),a&&r._applyGrouping(r.$.mainContainer),o&&r._applyFilter(o),r._checkOverflow(),r._expandItemsByDefault(),r.selectedIndexes=[],r._applySelection(!0,s)}getSelectedValues(){const e=this,t=[];for(let r=0;r<e.selectedIndexes.length;r++){const n=e._menuItems[e.selectedIndexes[r]];n.hasAttribute("value")?t.push(n.getAttribute("value")):n.hasAttribute("label")&&t.push(n.getAttribute("label"))}return t}unselectValues(e){const t=this;e&&Object.keys(t._menuItems).forEach((r=>{const n=t._menuItems[r];let l=null;n.hasAttribute("value")?l=n.getAttribute("value"):n.hasAttribute("label")&&(l=n.getAttribute("label")),"string"==typeof e?e===l&&t.unselect(r):e.indexOf(l)>=0&&t.unselect(r)}))}setSelectedValues(e){const t=this;e&&Object.keys(t._menuItems).forEach((r=>{const n=t._menuItems[r];let l=null;n.hasAttribute("value")?l=n.getAttribute("value"):n.hasAttribute("label")&&(l=n.getAttribute("label")),"string"==typeof e?e===l&&t._canItemBeSelected(n)&&t._handleSelection(n,{type:"programmatic"}):e.indexOf(l)>=0&&t._canItemBeSelected(n)&&t._handleSelection(n,{type:"programmatic"})}))}clearSelection(){const e=this,t=e.selectedIndexes.slice(0);e.selectedIndexes=[],e._applySelection(!1,t)}collapseAll(e){const t=this,r=t.animation,n=!1===e&&t.hasAnimation;n&&(t.animation="none"),t._collapseAll(!0),n&&(t.animation=r)}ensureVisible(e){const t=this;if(void 0===(e=t.getItem(e))||e.hidden)return;let r=!1;e.level>1&&!t._isBranchExpanded(e)&&(super.expandItem(e.parentItem,void 0,!0),r=t.hasAnimation,r&&(t._ensureVisibleOnTransitionend=e)),r||t._ensureVisible(e)}expandAll(e){const t=this,r=t.animation,n=!1===e&&t.hasAnimation;let l=1,a=(t.enableShadowDOM?t.shadowRoot:t).querySelectorAll('smart-tree-items-group[level="1"]');for(n&&(t.animation="none");a.length>0;){for(let e=0;e<a.length;e++){const r=a[e];r.expanded||t._menuItemsGroupSelectionHandler(r,{target:r,type:"expand"})}l++,a=(t.enableShadowDOM?t.shadowRoot:t).querySelectorAll('smart-tree-items-group[level="'+l+'"]')}n&&(t.animation=r)}expandItem(e,t){const r=this;if(void 0===(e=r.getItem(e))||e instanceof Smart.TreeItemsGroup==0||e&&e.container&&r._isContainerOpened(e.container.level,e.container))return;void 0!==Smart.Menu.processTimer&&r._lazyInitItems();const n=!1===t&&r.hasAnimation,l=r.animation;n&&(r.animation="none"),r._discardKeyboardHover(),r._menuItemsGroupSelectionHandler(e,{target:e,type:"expand"},arguments[2]),n&&(r.animation=l)}filter(e){const t=this;t.filterable&&(t._applyFilter(e),t.$.filterInput.value=e)}getState(){return JSON.parse(JSON.stringify(this._state))}insert(e,t){const r=this;let n;if(e instanceof Smart.TreeItem||e instanceof Smart.TreeItemsGroup){if(r.contains(e))return;e.isDirty=!1,n=e}else{if("object"!=typeof e||e.constructor!==Object)return;n=function e(t){const n=t[r.itemsMember],l="smart-tree-items-group"===t.tagName||Array.isArray(n)?"smart-tree-items-group":"smart-tree-item",a=document.createElement(l);if(a.isDirty=!1,t.disabled&&(a.disabled=!0),t[r.displayMember]&&(a.label=t[r.displayMember]),t.selected&&(a.selected=!0),t.separator&&(a.separator=!0),t[r.valueMember]&&(a.value=t[r.valueMember]),"smart-tree-items-group"===l){if(t.expanded&&(a.expanded=!0),n)for(let t=0;t<n.length;t++)a.appendChild(e(n[t]))}else t.shortcut&&(a.shortcut=t.shortcut);return a}(e)}if(void 0===t)return void r.addTo(n);if("number"==typeof t)t=t.toString();else if(t instanceof Smart.TreeItem||t instanceof Smart.TreeItemsGroup){if(!r.contains(t))return;t=t.path}else if("string"!=typeof t)return;const l=t.split(".");let a,o;1===l.length?(o=r._menuItems[l[0]],o?r.addBefore(n,o):r.addTo(n)):(o=r._menuItems[t],a=r._menuItems[l.slice(0,l.length-1).join(".")],o?r.addBefore(n,o):a&&a instanceof Smart.TreeItemsGroup&&r.addTo(n,a))}loadState(e){const t=this,r=t.selectedIndexes.slice(0),n=[];if(!e){if(!t.id)return void t.warn(t.localize("noId"));if(!(e=window.localStorage.getItem("smartTree"+t.id)))return}"string"==typeof e&&(e=JSON.parse(e)),e.filter&&!t.filterable&&(e.filter="");let l=e.filter!==t._state.filter;e.sorted!==t.sorted?(t.sorted=e.sorted,t._updateState("sorted",t.sorted),e.sorted?t._applyGrouping(t.$.mainContainer):t._unsortItems(t.$.mainContainer),(e.filter||l)&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter)):l&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter),t._menuItemsGroupsToExpand=[];for(let r=0;r<e.expanded.length;r++){const n=t.getItem(e.expanded[r]);n&&t._menuItemsGroupsToExpand.push(n)}t._expandItemsByDefault(!0);for(let r=0;r<e.selected.length;r++){const l=t.getItem(e.selected[r]);l&&n.push(l.path)}t.selectedIndexes=n,t._applySelection(!1,r)}moveDown(e){const t=this,r=(e=t.getItem(e)).nextElementSibling;void 0!==e&&r&&!t.sorted&&(t._moveTreeItem(e,r,2,[t]),t.filterable&&t._state.filter&&t._applyFilter(t._state.filter))}moveUp(e){const t=this,r=(e=t.getItem(e)).previousElementSibling;void 0!==e&&r&&!t.sorted&&(t._moveTreeItem(e,r,0,[t]),t.filterable&&t._state.filter&&t._applyFilter(t._state.filter))}refresh(){this._checkOverflow()}removeItem(e){const t=this;if(void 0===(e=t.getItem(e)))return;if(e instanceof Smart.TreeItemsGroup){const r=e.container;t._isContainerOpened(r.level,r)&&t._closeSubContainersTreeMode(r.level,r)}const r=t.sorted&&t.autoSort;r&&t._unsortItems(t.$.mainContainer),e.parentElement.removeChild(e),t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,void 0,t.sorted&&!t.autoSort),r&&t._applyGrouping(t.$.mainContainer);const n=t._state.filter,l=t.selectedIndexes.slice(0);n&&t._applyFilter(n),t._checkOverflow(),t.selectedIndexes=[],t._applySelection(!0,l),delete t._treeAnimationInProgress}saveState(){const e=this;return e.id?window.localStorage.setItem("smartTree"+e.id,JSON.stringify(e._state)):e.warn(e.localize("noId")),JSON.parse(JSON.stringify(e._state))}select(e){const t=this;void 0!==(e=t.getItem(e))&&!e.selected&&t._canItemBeSelected(e)&&t._handleSelection(e,{type:"programmatic"})}unselect(e){void 0!==(e=this.getItem(e))&&e.selected&&!e.templateApplied&&this._handleSelection(e,{type:"programmatic"})}updateItem(e,t){if(void 0===(e=this.getItem(e))||void 0===t)return;const r=e instanceof Smart.TreeItem;for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r){if(-1===["disabled","label","level","selected","separator","shortcut","value"].indexOf(n))continue}else if(-1===["disabled","expanded","label","level","selected","separator","value"].indexOf(n))continue;e[n]=t[n]}}propertyChangedHandler(e,t,r){const n=this;switch(super.propertyChangedHandler(e,t,r),e){case"allowDrag":case"allowDrop":case"autoLoadState":case"autoSort":case"editable":case"filterInputPlaceholder":case"loadingIndicatorPlaceholder":case"selectionDisplayMode":case"showLines":case"showRootLines":case"toggleElementPosition":case"toggleMode":break;case"autoHideToggleElement":r?n.$mainContainer.addClass("hidden-arrows"):n.$mainContainer.removeClass("hidden-arrows");break;case"autoSaveState":if(!r)return;if(!n.id)return n.warn(n.localize("noId")),void(n.autoSaveState=!1);window.localStorage.setItem("smartTree"+n.id,JSON.stringify(n._state));break;case"dataSource":{const e=n.selectedIndexes.slice(0);n.selectedIndexes=[],n._menuItems={},n._processDataSource(),n._checkOverflow(),n._expandItemsByDefault(),n._applySelection(!0,e);const t=n._state.filter;t&&n._applyFilter(t);break}case"disabled":n._setFocusable(),n.$.scrollButtonNear.disabled=r,n.$.scrollButtonFar.disabled=r,r||n._updateScrollButtonVisibility();break;case"displayLoadingIndicator":r?(n._discardKeyboardHover(!0),n.$loadingIndicatorContainer.removeClass("smart-hidden")):n.$loadingIndicatorContainer.addClass("smart-hidden");break;case"expandMode":if("single"===r){const e=n._state.expanded.map((e=>Object.values(n._menuItems).find((t=>t.id===e)))),t={};for(let r=0;r<e.length;r++){const l=e[r],a=l.parentItem;if(t[a])continue;t[a]=!0;const o=e.filter((e=>e!==l&&e.parentItem===a));o.length>0&&o.forEach((e=>n.collapseItem(e)))}}break;case"filterable":!1===r&&(n._applyFilter(""),n.$.filterInput.value=""),n._checkOverflow();break;case"filterMode":n.filterable&&n._state.filter&&n._applyFilter(n._state.filter);break;case"hasThreeStates":if("checkBox"!==n.selectionMode)return;if(r)n._applySelection(!1);else{const e=(n.enableShadowDOM?n.shadowRoot:n).querySelectorAll("[indeterminate]");for(let t=0;t<e.length;t++)e[t].removeAttribute("indeterminate")}break;case"innerHTML":n.$.mainContainer.innerHTML=r,n._lazyInitItems();break;case"loadingIndicatorPosition":"center"===r?n.$loadingIndicatorPlaceHolder.addClass("smart-hidden"):n.$loadingIndicatorPlaceHolder.removeClass("smart-hidden");break;case"overflow":if("scrollbar"===n.scrollMode)return"hidden"===r?n.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0):n.$.scrollViewer.$.verticalScrollBar.removeAttribute("aria-hidden"),void(n.$.scrollViewer.verticalScrollBarVisibility="scroll"===r?"visible":"auto");n.$.scrollViewer.scrollTop=0,"hidden"===r?(n.$scrollViewer.removeClass("scroll-buttons-shown"),n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden")):(n.$.scrollButtonNear.disabled=n.disabled,n.$.scrollButtonFar.disabled=n.disabled,"auto"===r?(n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden"),n._checkOverflow()):(n.$scrollViewer.addClass("scroll-buttons-shown"),n.$scrollViewer.removeClass("one-button-shown"),n.$scrollButtonNear.removeClass("smart-hidden"),n.$scrollButtonFar.removeClass("smart-hidden"),n._updateScrollButtonVisibility())),n.$.scrollViewer.refresh();break;case"rightToLeft":{let e,t;r?(e="paddingLeft",t="paddingRight"):(e="paddingRight",t="paddingLeft");for(let r in n._menuItems)if(Object.prototype.hasOwnProperty.call(n._menuItems,r)){const l=n._menuItems[r],a=l.firstElementChild;a.style[e]="",n._setIndentation(a,l.level,t)}break}case"scrollMode":if("hidden"===n.overflow)return;if(n.$.scrollViewer.scrollTop=0,"scrollButtons"===r)return"scroll"===n.overflow&&(n.$scrollViewer.addClass("scroll-buttons-shown"),n.$scrollButtonNear.removeClass("smart-hidden"),n.$scrollButtonFar.removeClass("smart-hidden")),n.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0),n.$.scrollViewer.verticalScrollBarVisibility="auto",void n._checkOverflow();n.$.scrollViewer.$.verticalScrollBar.removeAttribute("aria-hidden"),n.$scrollViewer.removeClass("scroll-buttons-shown"),n.$scrollViewer.removeClass("one-button-shown"),n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden"),"auto"===n.overflow?n.$.scrollViewer.verticalScrollBarVisibility="auto":n.$.scrollViewer.verticalScrollBarVisibility="visible";break;case"selectedIndexes":n._applySelection(!1,t);break;case"selectionMode":if(n.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(r)),void 0===n._menuItems[0])return;if("one"===t&&"none"!==r&&"checkBox"!==r&&"radioButton"!==r||-1!==t.indexOf("oneOrMany")&&-1!==r.indexOf("oneOrMany")||"none"===t&&(-1!==r.indexOf("zero")||"checkBox"===r)||"zeroOrMany"===r&&"checkBox"!==t||"radioButton"===t&&-1!==r.indexOf("Many")||!n.hasThreeStates&&("checkBox"===r||"checkBox"===t&&"zeroOrMany"===r))return n._lastSelectedItem="one"===r||"oneOrManyExtended"===r?n._menuItems[n.selectedIndexes[n.selectedIndexes.length-1]]:void 0,void n._applyAriaSelected();if(n.hasThreeStates&&"checkBox"===t){const e=(n.enableShadowDOM?n.shadowRoot:n).querySelectorAll("[indeterminate]");for(let t=0;t<e.length;t++)e[t].removeAttribute("indeterminate")}n._applySelection(!1);break;case"sort":if(!n.sorted)return;n._refreshSorting();break;case"sortDirection":n.sorted&&!n.sort&&(n._unsortItems(n.$.mainContainer),n._applyGrouping(n.$.mainContainer));break;case"sorted":{if(!r&&!n.autoSort)return n._refreshItemPathsAndSelection(),void n._updateState("sorted",!1);r?n._applyGrouping(n.$.mainContainer):n._unsortItems(n.$.mainContainer);const e=n._state.filter;e&&n._applyFilter(e),n._updateState("sorted",r),n._checkOverflow();break}case"unfocusable":n._setFocusable()}}_addDragFeedback(){const e=this,t=document.createElement("div");return t.className="smart-tree-item-feedback",t.setAttribute("parent-tree-id",e.id),e.theme&&t.setAttribute("theme",e.theme),e.dragFeedbackFormatFunction?t.innerHTML=e.dragFeedbackFormatFunction(e._dragDetails.Items):1===e._dragDetails.Items.length?t.innerHTML=e._dragDetails.Item.label:(t.classList.add("multiple"),t.innerHTML="&#xf0c5;"),document.body.appendChild(t),t}_applyFilter(e){const t=this;function r(e,t){e?(t.hidden&&t.$.removeClass("smart-hidden"),t.hidden=!1):(t.hidden||t.$.addClass("smart-hidden"),t.hidden=!0)}if(""===e&&!t.hasAttribute("filter-applied"))return;const n=Array.from(t.$.mainContainer.getElementsByClassName("last-filtered-child"));for(let e=0;e<n.length;e++)n[e].$.removeClass("last-filtered-child");!function n(l,a){let o,s=!1,i=0;a=Array.from(a);for(let l=0;l<a.length;l++){const d=a[l];d instanceof Smart.TreeItem?r(t._findItem(d,e),d):n(d,d.itemContainer.children),d.hidden||(i++,o=d),s=s||!d.hidden}if(l!==t.$.mainContainer){const n=t._findItem(l,e);r(s||n,l),s&&null===n?l.$.addClass("filtered-child"):l.$.removeClass("filtered-child"),!s&&a.length>0?(l.hiddenChildren=!0,l.$.addClass("hidden-children"),t.collapseItem(l,void 0,!1)):(l.hiddenChildren=!1,l.$.removeClass("hidden-children"))}""!==e&&i>0&&o.$.addClass("last-filtered-child")}(t.$.mainContainer,t.$.mainContainer.children),""!==e?t.setAttribute("filter-applied",""):t.removeAttribute("filter-applied"),t._updateState("filter",e),t._checkOverflow()}_applyHierarchicalSelection(e,t){const r=this,n=e!==r.$.mainContainer,l=n?e.itemContainer.children:e.children;let a=0,o=0;for(let s=0;s<l.length;s++){const i=l[s];e.selected&&i.set("selected",!0),i instanceof Smart.TreeItemsGroup?r._applyHierarchicalSelection(i,t):i.selected&&t.push(i.path),n&&(i.selected?a++:i.hasAttribute("indeterminate")&&o++)}n&&(r._setThreeStateCheckbox(e,a,o),e.selected&&t.push(e.path))}_applyRadioButtonSelection(e,t,r){const n=this,l=e!==n.$.mainContainer?e.itemContainer.children:e.children,a=[];let o;for(let e=0;e<l.length;e++){const o=l[e];o instanceof Smart.TreeItemsGroup&&n._applyRadioButtonSelection(o,t,r),o.set("selected",!1),-1!==t.indexOf(o.path)&&a.push(o)}o=0===a.length?l[0]:a[a.length-1],o.set("selected",!0),r.push(o.path)}_applySelection(e,t){const r=this;let n=r.selectedIndexes.slice(0);function l(e){const t=Object.values(r._menuItems).filter((t=>t.level===e));if(0!==t.length){for(let e=0;e<t.length;e++)if(r._canItemBeSelected(t[e]))return t[e].path;return l(e+1)}}if(void 0===t&&(t=n.slice(0)),void 0===r._menuItems[0])return r.selectedIndexes=[],r._lastSelectedItem=void 0,void(r.isRendered&&JSON.stringify(t)!==JSON.stringify([])&&r.$.fireEvent("change",{selectedIndexes:r.selectedIndexes,oldSelectedIndexes:t}));const a=r.selectionMode,o=Array.from((r.shadowRoot||r).querySelectorAll("smart-tree-item[selected], smart-tree-items-group[selected]"));for(let e=n.length-1;e>=0;e--){const t=r._menuItems[n[e]];void 0!==t&&r._canItemBeSelected(t)||n.splice(e,1)}if(e)for(let e=0;e<o.length;e++)r._canItemBeSelected(o[e])?-1===n.indexOf(o[e].path)&&n.push(o[e].path):o[e].set("selected",!1);else{for(let e=0;e<o.length;e++)o[e].set("selected",!1);o.length=0}switch(r._sortPathCollection(n),a){case"none":n.length=0;for(let e=0;e<o.length;e++)o[e].set("selected",!1);break;case"one":case"zeroAndOne":case"zeroOrOne":"one"===a&&0===n.length&&n.push(l(1));for(let e=0;e<n.length;e++){const t=r._menuItems[n[e]];if(e===n.length-1){t.set("selected",!0),n=[n[e]];break}-1!==o.indexOf(t)&&t.set("selected",!1)}break;case"oneOrMany":case"oneOrManyExtended":0===n.length&&n.push(l(1));for(let e=0;e<n.length;e++)r._menuItems[n[e]].set("selected",!0);break;case"zeroOrMany":case"checkBox":for(let e=0;e<n.length;e++)r._menuItems[n[e]].set("selected",!0);if("checkBox"===a&&r.hasThreeStates){const e=[];r._applyHierarchicalSelection(r.$.mainContainer,e),r._sortPathCollection(e),n=e}break;case"radioButton":{const e=[];r._applyRadioButtonSelection(r.$.mainContainer,n,e),r._sortPathCollection(e),n=e;break}}r.selectedIndexes=n,r._updateState("selected"),r._lastSelectedItem="one"===a||"oneOrManyExtended"===a?r._menuItems[n[n.length-1]]:void 0,r.isRendered&&!1!==arguments[2]&&JSON.stringify(t)!==JSON.stringify(n)&&r.$.fireEvent("change",{selectedIndexes:r.selectedIndexes,oldSelectedIndexes:t}),r._applyAriaSelected()}_applyAriaSelected(){const e=this,t=e.selectionMode;for(let r in e._menuItems){const n=e._menuItems[r];n.selected?n.setAttribute("aria-selected",!0):e._canItemBeSelected(n)&&-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(t)?n.setAttribute("aria-selected",!1):n.removeAttribute("aria-selected")}}_autoLoadState(e){const t=this,r=[];for(let e=0;e<t._menuItemsGroupsToExpand.length;e++)t._menuItemsGroupsToExpand[e].set("expanded",!1);t._menuItemsGroupsToExpand=[];for(let r=0;r<e.expanded.length;r++){const n=t.getItem(e.expanded[r]);n&&t._menuItemsGroupsToExpand.push(n)}t.filterable&&e.filter&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter);for(let n=0;n<e.selected.length;n++){const l=t.getItem(e.selected[n]);l&&r.push(l.path)}t.selectedIndexes=r}_blurHandler(){this._discardKeyboardHover(!0)}_canItemBeHovered(e){const t=e.level;return!1===e.disabled&&!0!==e.templateApplied&&!0!==e.hidden&&(1===t||t>1&&this._isContainerOpened(t,e.parentElement.container)&&e.getBoundingClientRect().height>0)}_canItemBeSelected(e,t){return!(!0!==t&&"leaf"===this.selectionTarget&&e instanceof Smart.TreeItemsGroup)&&!1===e.disabled&&!0!==e.templateApplied}_checkOverflow(){const e=this,t=e.$.scrollViewer,r=e.overflow;if("scrollbar"===e.scrollMode||"hidden"===r)return void t.refresh();const n=t.scrollTop;"auto"===r&&(t.$.removeClass("scroll-buttons-shown"),t.$.removeClass("one-button-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"));const l=Math.round(t.$.scrollViewerContentContainer.offsetHeight)>Math.round(t.$.scrollViewerContainer.offsetHeight),a=Math.round(t.scrollTop)>0,o=Math.round(t.$.scrollViewerContainer.offsetHeight+t.scrollTop)<Math.round(t.$.scrollViewerContentContainer.offsetHeight);l?"auto"===r?(t.$.addClass("scroll-buttons-shown"),a&&e.$scrollButtonNear.removeClass("smart-hidden"),o&&e.$scrollButtonFar.removeClass("smart-hidden"),!1===(a&&o)&&t.$.addClass("one-button-shown"),e.disabled||(e.$.scrollButtonNear.disabled=!1,e.$.scrollButtonFar.disabled=!1),t.scrollTop=n):(e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.disabled?(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0):(e.$.scrollButtonNear.disabled=!a,e.$.scrollButtonFar.disabled=!o)):"scroll"===r&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),t.refresh()}_createElement(){const e=this,t=window.getComputedStyle(e.$.scrollViewer);if(e.setAttribute("role","tree"),e.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(e.selectionMode)),e.setAttribute("aria-orientation","vertical"),e.$.scrollViewer.onVerticalChange=e._verticalScrollbarHandler,e.isRendered||Object.defineProperty(e,"dataSource",{get:function(){return e.context===e?e.properties.dataSource.value:e._getDataSource()},set(t){e.updateProperty(e,e._properties.dataSource,t)}}),e.id||!e.autoLoadState&&!e.autoSaveState||(e.warn(e.localize("noId")),e.autoLoadState=!1,e.autoSaveState=!1),e.mode="tree",e._element="tree",e._isMobile=Smart.Utilities.Core.isMobile,e._edgeMacFF=!1,e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._scrollViewerPadding=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)||0,e._state={expanded:[],filter:"",selected:[]},e._dblclickObject={numberOfClicks:0},e.autoHideToggleElement&&e.$mainContainer.addClass("hidden-arrows"),e.disabled&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),"scrollbar"===e.scrollMode&&"scroll"===e.overflow&&(e.$.scrollViewer.verticalScrollBarVisibility="visible"),null===e.dataSource&&e.$.mainContainer.firstElementChild instanceof HTMLUListElement&&e._processUList(),e.isRendered)return e._menuItems={},void(null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource());const r=(e.shadowRoot||e).querySelectorAll("smart-tree-item, smart-tree-items-group"),n=function(){let t;e.autoLoadState&&(t=window.localStorage.getItem("smartTree"+e.id),t&&(t=JSON.parse(t),e.sorted=t.sorted)),e._setFocusable(),e._menuItems={},null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource(),"scrollButtons"!==e.scrollMode&&"hidden"!==e.overflow||e.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0),"scrollButtons"===e.scrollMode&&"scroll"===e.overflow&&(e.$scrollViewer.addClass("scroll-buttons-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility()),e._checkOverflow(),t&&e._autoLoadState(t),e._expandItemsByDefault(),e._applySelection(!0),e._updateState("sorted",e.sorted),e.displayLoadingIndicator&&e.$loadingIndicatorContainer.removeClass("smart-hidden"),"center"!==e.loadingIndicatorPosition&&e.$loadingIndicatorPlaceHolder.removeClass("smart-hidden"),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted())};0===r.length||e.enableShadowDOM||e.isInShadowDOM?n():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(r,n))}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.$.mainContainer&&t.$.mainContainer.appendChild(e)}_dblclickHandler(e,t,r){"dblclick"!==this.toggleMode||e instanceof Smart.TreeItem||t||this._menuItemsGroupSelectionHandler(e,r)}_discardKeyboardHover(e,t){const r=this;!t&&r._hoveredViaKeyboard&&(!e&&r._hoveredViaKeyboard instanceof Smart.MenuItemsGroup&&r._isContainerOpened(r._hoveredViaKeyboard.level+1,r._hoveredViaKeyboard.container)||(r._hoveredViaKeyboard.removeAttribute("focus"),r._hoveredViaKeyboard=void 0))}_documentUpHandler(e){if("pointercancel"===e.originalEvent.type)return;const t=this,r=t._downTimeoutInfo,n=t._dragDetails;!r||n&&n.FeedbackShown||(clearTimeout(r.timeout),t.$.scrollViewer.scrollTop!==r.scrollTop&&t.getBoundingClientRect().top===r.top||t._continueSelection(r.target,r.event)),delete t._downTimeoutInfo;const l=t._downItem,a=t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(delete t._downItem,t._editedItem&&!t._editInputDown&&(!t._isMobile&&a!==t.$.editInput||t._isMobile&&t.getRootNode().elementFromPoint(e.clientX,e.clientY)!==t.$.editInput))return void t._endEditing();if(delete t._editInputDown,l){const r=a.closest("smart-tree-item")||a.closest("smart-tree-items-group");!r||!r.selected||r!==l||t._dragDetails&&t._dragDetails.FeedbackShown||r instanceof Smart.TreeItemsGroup&&(a.closest(".smart-tree-items-group-arrow")||a===r.container||a===r.container.firstElementChild)||t._handleSelection(r,e)}if(!n)return;const o=Smart.Tree.hoveredTree,s=Smart.Tree.hoveredItem;if(delete t._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,t.$.scrollViewer._scrollView.disableSwipeScroll=!1,!n.FeedbackShown)return;const i=o||t.getRootNode().elementFromPoint(e.clientX,e.clientY);let d;document.body.classList.remove("smart-dragging"),document.body.removeChild(n.Feedback),o&&clearInterval(o._dragInterval);const c=n.Item,m=n.Items,u=n.ValidItems;if(!i)return;if(!s||c.contains(s))return void t.$.fireEvent("dragEnd",{item:c,items:m,target:i,data:n,previousContainer:t,container:o||i,originalEvent:e});if(!o||!o.allowDrop||o.disabled)return;const p=[o];let h;if(s.classList.remove("drop-target"),s.classList.contains("top")?(s.classList.remove("top"),h="top",d=0):s.classList.contains("bottom")?(s.classList.remove("bottom"),h="bottom",d=2):(h="inside",d=1),n.DropDetails={item:s,position:h},o!==t)p.push(t);else if(n.ValidateOnDrop)for(let e=0;e<u.length;e++)if(u[e].contains(s))return;if(!t.$.fireEvent("dragEnd",{item:c,items:m,target:s,data:n,previousContainer:t,container:o,originalEvent:e}).defaultPrevented){o.sorted&&o.autoSort&&o._unsortItems(o.$.mainContainer);for(let e=0;e<u.length;e++)t._moveTreeItem(u[e],s,d,p);o.sorted&&o.autoSort&&o._applyGrouping(o.$.mainContainer),o!==t&&o._state.filter&&o._applyFilter(o._state.filter)}}_editInputBlurHandler(){this._endEditing()}_endEditing(e){const t=this,r=t._editedItem;if(!r)return;if(delete t._editedItem,t.$editInput.addClass("smart-hidden"),t.focus(),e)return;const n=t.$.editInput.value,l=t.sorted&&t.autoSort,a=t._state.filter;n!==r.label&&(r.set("label",n),r.setAttribute("aria-label",n),r.firstElementChild.firstElementChild.firstElementChild.innerHTML=n,l&&(t._unsortItems(t.$.mainContainer),t._applyGrouping(t.$.mainContainer)),a&&t._applyFilter(a))}_ensureVisible(e){const t=this;t._ensureVisibleTreeMode(e,e.getBoundingClientRect(),t.$.scrollViewer,t.$.scrollViewer.getBoundingClientRect(),t._scrollViewerPadding),t._ensureVisibleCallback&&t._ensureVisibleCallback(e)}_pointeroverHandler(e){const t=(this.isInShadowDOM?e.composedPath()[0]:e.target).closest(".smart-tree-item-label-element>span");if(!t)return;const r=this.$.container.querySelector(".tooltip");r&&(r.classList.remove("tooltip"),r.removeAttribute("title")),t.scrollWidth>t.offsetWidth&&(t.classList.add("tooltip"),t.title=t.innerText)}_filterInputKeydownHandler(e){if("PageDown"!==e.key)return void("PageUp"===e.key&&(e.preventDefault(),e.stopPropagation()));const t=this;let r;if(e.preventDefault(),e.stopPropagation(),t.selectedIndexes.length>0){const e=t.selectedIndexes.slice(0);r=t._lastSelectedItem||t._menuItems[t.selectedIndexes[t.selectedIndexes.length-1]],"checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&(t.selectedIndexes=[r.path],t._applySelection(!1,e)),t.focus()}else r=t._getFirstEnabledChild(t.$.mainContainer),t.focus(),r&&t._hoverViaKeyboard(r);t._ensureVisible(r)}_focusHandler(){const e=this;e.selectedIndexes.length>0&&!e._hoveredViaKeyboard&&(e._lastSelectedItem?e._hoverViaKeyboard(e._lastSelectedItem,!1,void 0,!1):e._hoverViaKeyboard(e._menuItems[e.selectedIndexes[e.selectedIndexes.length-1]],!1,void 0,!1))}_getDataSource(){const e=[];return function e(t,r){for(let n=0;n<t.length;n++){const l=t[n],a={label:l.label};l.disabled&&(a.disabled=!0),l.selected&&(a.selected=!0),l.separator&&(a.separator=!0),null!==l.value&&(a.value=l.value),l instanceof Smart.TreeItem?l.shortcut&&(a.shortcut=l.shortcut):(l.expanded&&(a.expanded=!0),a.items=[],e(l.itemContainer.children,a.items)),r.push(a)}}(this.$.mainContainer.children,e),e}_handleHierarchicalSelection(e,t){const r=this;let n=e;for(e.selected?(e.set("selected",!1),e.setAttribute("aria-selected",!1)):(e.set("selected",!0),e.setAttribute("aria-selected",!0),e.removeAttribute("indeterminate"));n.parentItem;){const e=n.parentItem,t=e.itemContainer.children;let l=0,a=0;for(let e=0;e<t.length;e++)t[e].selected?l++:t[e].hasAttribute("indeterminate")&&a++;r._setThreeStateCheckbox(e,l,a),n=e}e instanceof Smart.TreeItemsGroup&&function e(t,r){const n=t.itemContainer.children;for(let t=0;t<n.length;t++){const l=n[t];l.set("selected",r),l.setAttribute("aria-selected",r),l.removeAttribute("indeterminate"),l instanceof Smart.TreeItemsGroup&&e(l,r)}}(e,e.selected),t.length=0;const l=Array.from((r.enableShadowDOM?r.shadowRoot:r).querySelectorAll("[selected]"));for(let e=0;e<l.length;e++)t.push(l[e].path);r._sortPathCollection(t)}_handleSelection(e,t){const r=this,n=r.selectionMode;if("none"===n||"programmatic"!==t.type&&!r._canItemBeSelected(e))return;const l=e.selected;if(l&&"down"===t.type)return;const a=r.selectedIndexes.slice(0);let o=a.slice(0);switch(n){case"one":case"zeroAndOne":if(l)return;r._menuItems[o[0]]&&(r._menuItems[o[0]].set("selected",!1),r._menuItems[o[0]].removeAttribute("aria-selected")),r.selectedIndexes=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e;break;case"zeroOrOne":l?(r.selectedIndexes=[],e.set("selected",!1),e.removeAttribute("aria-selected")):(void 0!==o[0]&&(r._menuItems[o[0]].set("selected",!1),r._menuItems[o[0]].removeAttribute("aria-selected")),r.selectedIndexes=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0));break;case"oneOrMany":case"zeroOrMany":if(l){if(1===o.length&&"zeroOrMany"!==n)return;o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)}else o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0);r.selectedIndexes=o;break;case"oneOrManyExtended":{const n=t.ctrlKey||t.metaKey,l=t.shiftKey;if(!n&&!l||l&&e===r._lastSelectedItem){for(let e=0;e<o.length;e++)r._menuItems[o[e]].set("selected",!1),r._menuItems[o[e]].setAttribute("aria-selected",!1);o=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e}else if(n)e.selected&&o.length>1?(o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)):e.selected||(o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e);else if(l){for(let e=0;e<o.length;e++)r._menuItems[o[e]].set("selected",!1),r._menuItems[o[e]].setAttribute("aria-selected",!1);o=r._selectItemRange(r._lastSelectedItem,e)}r.selectedIndexes=o;break}case"checkBox":r.hasThreeStates?r._handleHierarchicalSelection(e,o):l?(o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)):(o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0)),r.selectedIndexes=o;break;case"radioButton":{if(e.selected)return;let t;for(let r=0;r<e.parentElement.children.length;r++){const n=e.parentElement.children[r];if(n.selected){t=n;break}}const n=o.indexOf(t.path);t.set("selected",!1),e.setAttribute("aria-selected",!1),e.set("selected",!0),e.setAttribute("aria-selected",!0),o.splice(n,1),o.push(e.path),r._sortPathCollection(o),r.selectedIndexes=o;break}}if(r._discardKeyboardHover(!0),r._hoverViaKeyboard(e,!1,void 0,!r._treeAnimationInProgress),r._updateState("selected"),JSON.stringify(a)!==JSON.stringify(r.selectedIndexes)){if(r.ownerElement&&!r.ownerElement.isRendered)return;r.$.fireEvent("change",{item:e,selectedIndexes:r.selectedIndexes,oldSelectedIndexes:a})}}_hoverViaKeyboard(e,t,r,n){if(!e)return;const l=this;e.setAttribute("focus",""),l._hoveredViaKeyboard=e,!1!==n&&l._ensureVisible(e),t&&l._handleSelection(e,r),l._hoverViaKeyboardCallback&&l._hoverViaKeyboardCallback(e)}_keydownHandler(e){const t=this,r=e.key;if(t._editedItem)return void("Enter"===r?t._endEditing():"Escape"===r&&t._endEditing(!0));if(t.getRootNode().activeElement!==t||-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","F2","Home","PageDown","PageUp"," "].indexOf(r)||t.disabled||t.displayLoadingIndicator)return;"Enter"!==r&&e.preventDefault();const n=Array.from(t.$.mainContainer.querySelectorAll("smart-tree-item, smart-tree-items-group")),l="one"===t.selectionMode||"oneOrManyExtended"===t.selectionMode&&!e.ctrlKey&&!e.metaKey,a=t.$.mainContainer.querySelector("[focus]");function o(r){for(let o=r;o<n.length;o++){const r=n[o];if(t._canItemBeHovered(r)){if(a){if(a===r)break;a.removeAttribute("focus")}t._hoverViaKeyboard(r,l,e);break}}}function s(r){for(let o=r;o>=0;o--){const r=n[o];if(t._canItemBeHovered(r)){if(a){if(a===r)break;a.removeAttribute("focus")}t._hoverViaKeyboard(r,l,e);break}}}function i(){a.level>1&&t._canItemBeSelected(a.parentItem)&&(a.removeAttribute("focus"),t._hoverViaKeyboard(a.parentItem,l,e))}let d;switch(r){case"ArrowDown":d=a?n.indexOf(a)+1:0,o(d);break;case"ArrowLeft":if(!a)return;if(a instanceof Smart.TreeItem)i();else{if(t._isContainerOpened(a.level+1,a.container))return void t._closeSubContainersTreeMode(a.level+1,a.container,!0,!0);i()}break;case"ArrowRight":if(!a||a instanceof Smart.TreeItem)return;if(t._isContainerOpened(a.level+1,a.container)){const r=t._getFirstEnabledChild(a.itemContainer);r&&(a.removeAttribute("focus"),t._hoverViaKeyboard(r,l,e))}else t._menuItemsGroupSelectionHandler(a,{target:a,type:"keydown"});break;case"ArrowUp":d=a?n.indexOf(a)-1:n.length-1,s(d);break;case"End":s(n.length-1);break;case"Enter":a&&a instanceof Smart.TreeItemsGroup&&t._menuItemsGroupSelectionHandler(a,{target:a,type:"keydown"});break;case"F2":t.editable&&t._startEditing(a);break;case"Home":o(0);break;case"PageDown":t._pageDownHandler(n,a,l,e);break;case"PageUp":t._pageUpHandler(n,a,l,e);break;case" ":a&&t._handleSelection(a,e)}}_mainContainerSwipeHandler(e){Smart.Tree.treeItemDragged&&e.stopPropagation()}_menuItemsGroupSelectionHandler(e,t,r){const n=this,l=n.toggleMode,a=!!t.originalEvent&&t.originalEvent.target.classList.contains("smart-tree-items-group-arrow"),o=e.container;if(n._waitAnimation&&n._treeAnimationInProgress)return;if("down"!==t.type||a||"dblclick"===l&&1!==n._dblclickObject.numberOfClicks||n._handleSelection(e,t),"down"===t.type&&!a&&("dblclick"===l&&2!==n._dblclickObject.numberOfClicks||"click"===l&&n._dblclickObject.numberOfClicks>1||"arrow"===l)||e.hiddenChildren)return;const s=o.level;let i=n.hasAnimation;if("keydown"===t.type&&n._discardKeyboardHover(),n._treeAnimationInProgress&&(o.removeEventListener("transitionend",n._transitionendHandlerExpand),o.removeEventListener("transitionend",n._transitionendHandlerCollapse)),n._isContainerOpened(s,o))n._closeSubContainersTreeMode(s,o,!0,!1!==r);else{if(n.$.fireEvent("expanding",{item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children}).defaultPrevented)return;if(n._handleSingleExpandMode(e),i&&("expand"!==t.type&&(n._ensureVisibleOnTransitionend=e),n._expandSection(o)),o.$.removeClass("smart-visibility-hidden"),"keydown"===t.type&&(e.setAttribute("focus",""),n._hoveredViaKeyboard=e),e.$.addClass("smart-tree-items-group-opened"),e.$.addClass("smart-tree-items-group-expanded"),n._addOpenedContainer(s,o),void 0===t.type&&n._hoverViaKeyboard(n._getFirstEnabledChild(e.itemContainer)),!1!==r){const t={item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children};n.toggleCallback?(t.type="expand",n.toggleCallback(t)):n.$.fireEvent("expand",t)}}i||(n._checkOverflow(),"expand"!==t.type&&n._ensureVisible(e))}_handleSingleExpandMode(e){const t=this;if("single"!==t.expandMode)return;const r=e.parentItem,n=t._state.expanded.map((e=>Object.values(t._menuItems).find((t=>t.id===e)))).filter((e=>e.parentItem===r));n.length>0&&n.forEach((e=>t.collapseItem(e)))}_mouseenterHandler(){const e=this;e.autoHideToggleElement&&e.$mainContainer.removeClass("hidden-arrows"),Smart.Tree.treeItemDragged&&e.allowDrop&&!e.disabled&&(Smart.Tree.hoveredTree=e)}_mouseleaveHandler(){const e=this;if(e.autoHideToggleElement&&e.$mainContainer.addClass("hidden-arrows"),Smart.Tree.treeItemDragged){Smart.Tree.hoveredTree&&(clearInterval(Smart.Tree.hoveredTree._dragInterval),delete Smart.Tree.hoveredTree);const e=Smart.Tree.hoveredItem;e&&(e.classList.remove("drop-target"),e.classList.remove("top"),e.classList.remove("bottom"),delete Smart.Tree.hoveredItem)}}_moveHandler(e){const t=this,r=t._dragDetails;if(!r)return;if(!r.FeedbackShown){if(!(Math.abs(r.StartPosition.left-e.pageX)>5||Math.abs(r.StartPosition.top-e.pageY)>5))return;if(t.$.fireEvent("dragStart",{item:r.Item,items:r.Items,data:r,container:t,previousContainer:t,originalEvent:r.OriginalEvent}).defaultPrevented)return delete t._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,void(t.$.scrollViewer._scrollView.disableSwipeScroll=!1);document.body.classList.add("smart-dragging"),r.Feedback=t._addDragFeedback(),r.FeedbackShown=!0}const n=t.dragOffset;let l,a,o;if(t.$.fireEvent("dragging",{item:r.Item,items:r.Items,data:r,originalEvent:e}),r.Feedback.style.left=e.pageX+n[0]+"px",r.Feedback.style.top=e.pageY+n[1]+"px",t._isMobile){const r=Smart.Tree.hoveredItem;r&&(r.classList.remove("drop-target"),r.classList.remove("top"),r.classList.remove("bottom"),delete Smart.Tree.hoveredItem);const n=t.getRootNode().elementFromPoint(e.clientX,e.clientY);Smart.Tree.hoveredTree&&(clearInterval(Smart.Tree.hoveredTree._dragInterval),delete Smart.Tree.hoveredTree),n&&(l=n.closest("smart-tree"),l&&l.allowDrop&&(Smart.Tree.hoveredTree=l,a=n.closest("smart-tree-item")||n.closest("smart-tree-items-group"),a?o=a:a=n))}if(l=Smart.Tree.hoveredTree,!l)return;const s=l.filterable?l.$.filterInput.offsetHeight+10:0;if(clearInterval(l._dragInterval),l._dragInterval=setInterval((function(){const r=l.getBoundingClientRect();l.$.scrollViewer.scrollHeight>0&&r.left<=e.clientX&&r.left+r.width>=e.clientX?e.clientY>=r.top+s&&e.clientY<=r.top+20+s?(l.$.scrollViewer.scrollTop-=t._autoScrollCoefficient,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility()):e.clientY>=r.top+r.height-20&&e.clientY<=r.top+r.height?(l.$.scrollViewer.scrollTop+=t._autoScrollCoefficient,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility()):clearInterval(l._dragInterval):clearInterval(l._dragInterval)}),1),t._isMobile||(a=e.originalEvent.target,a&&a.enableShadowDOM&&(a=e.originalEvent.composedPath()[0]),a&&a.closest&&(o=a.closest("smart-tree-item")||a.closest("smart-tree-items-group"))),o){if(Smart.Tree.hoveredItem&&o!==Smart.Tree.hoveredItem&&(Smart.Tree.hoveredItem.classList.remove("drop-target"),Smart.Tree.hoveredItem.classList.remove("top"),Smart.Tree.hoveredItem.classList.remove("bottom")),Smart.Tree.hoveredItem=o,r.Item.contains(o))return;const t=o.getBoundingClientRect();o instanceof Smart.TreeItem?e.clientY-t.top<=t.height/2?(o.classList.remove("bottom"),o.classList.add("top")):(o.classList.remove("top"),o.classList.add("bottom")):e.clientY-t.top<=10?(o.classList.remove("bottom"),o.classList.add("top")):!o.expanded&&t.bottom-e.clientY<=10?(o.classList.remove("top"),o.classList.add("bottom")):(o.classList.remove("top"),o.classList.remove("bottom")),o.classList.add("drop-target")}else if(Smart.Tree.hoveredItem&&(Smart.Tree.hoveredItem.classList.remove("drop-target"),Smart.Tree.hoveredItem.classList.remove("top"),Smart.Tree.hoveredItem.classList.remove("bottom")),a===l.$.scrollViewer.$.scrollViewerContainer)if(l._menuItems[0]){let e=l.$.mainContainer.lastElementChild,t=l.$.mainContainer.childElementCount-1;for(;e.hidden&&(t--,e=l.$.mainContainer.children[t],e););if(e){if(r.Item===e)return;Smart.Tree.hoveredItem=e,Smart.Tree.hoveredItem.classList.add("bottom")}else Smart.Tree.hoveredItem=l.$.container;Smart.Tree.hoveredItem.classList.add("drop-target")}else Smart.Tree.hoveredItem=l.$.container,Smart.Tree.hoveredItem.classList.add("drop-target");else delete Smart.Tree.hoveredItem}_moveSubItems(e,t,r){const n=this;for(let l=0;l<e.length;l++){const a=e[l];a.menu=t,a.set("level",a.parentItem.level+1),a.firstElementChild.style.paddingLeft="",a.firstElementChild.style.paddingRight="",n._setIndentation(a.firstElementChild,a.level,r),a.hidden=!1,a.$.removeClass("smart-hidden"),a.$.removeClass("filtered-child"),a.$.removeClass("last-filtered-child"),a instanceof Smart.TreeItemsGroup&&(a.$.removeClass("hidden-children"),a.container.level=a.level+1,n._moveSubItems(a.itemContainer.children,t,r),t!==n&&a.expanded&&(t._menuItemsGroupsToExpand.push(a),n._updateState("expanded",a.id,!1)))}}_moveTreeItem(e,t,r,n){const l=this,a=e.level;if(0===r){if(t.previousElementSibling===e)return;t.parentElement.insertBefore(e,t),e.set("level",t.level),e.parentItem=t.parentItem}else if(2===r){if(t.nextElementSibling===e)return;t.parentElement.insertBefore(e,t.nextElementSibling||null),e.set("level",t.level),e.parentItem=t.parentItem}else if(t===n[0].$.container)n[0].$.mainContainer.appendChild(e),e.set("level",1),e.parentItem=void 0;else{if(t.itemContainer.lastElementChild===e)return;t.itemContainer.appendChild(e),e.set("level",t.level+1),e.parentItem=t}const o=n[0].rightToLeft?"paddingRight":"paddingLeft";if(e.menu=n[0],e.parentItem=e.parentElement.menuItemsGroup,e.firstElementChild.style.paddingLeft="",e.firstElementChild.style.paddingRight="",l._setIndentation(e.firstElementChild,e.level,o),e.hidden=!1,e.$.removeClass("smart-hidden"),e.$.removeClass("filtered-child"),e.$.removeClass("last-filtered-child"),e instanceof Smart.TreeItemsGroup&&(e.$.removeClass("hidden-children"),e.container.level=e.level+1,l._moveSubItems(e.itemContainer.children,n[0],o),e.expanded)){const t=l._openedContainers[a+1].indexOf(e.container);-1!==t&&l._openedContainers[a+1].splice(t,1),n[0]._menuItemsGroupsToExpand.push(e),2===n.length&&l._updateState("expanded",e.id,!1)}for(let e=0;e<n.length;e++){const t=n[e],r=t.context,l=t.selectedIndexes.slice(0);t.context=t,t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,void 0,t.sorted&&!t.autoSort),t.selectedIndexes=[],t._applySelection(!0,l,!1),t._checkOverflow(),t.context=r}n[0]._expandItemsByDefault()}_overriddenMenuHandler(){}_pageDownHandler(e,t,r,n){const l=this,a=l.$.scrollViewer;function o(){for(let t=e.length-1;t>=0;t--){const r=e[t];if(l._canItemBeHovered(r)&&l._getOffsetTop(r)+r.firstElementChild.offsetHeight<=a.scrollTop+a.$.container.offsetHeight)return r}}if(!t)return;let s=o();s&&(t!==s?(t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):a.scrollTop+a.$.container.offsetHeight!==a.$.scrollViewerContentContainer.offsetHeight&&(l.$.scrollViewer.scrollTop+=a.$.container.offsetHeight,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility(),s=o(),t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)))}_pageUpHandler(e,t,r,n){const l=this,a=l.$.scrollViewer;function o(){for(let t=0;t<e.length;t++){const r=e[t];if(l._canItemBeHovered(r)&&l._getOffsetTop(r)>=a.scrollTop)return r}}if(!t)return;let s=o();s&&(t!==s?(t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):0!==a.scrollTop?(l.$.scrollViewer.scrollTop-=a.$.container.offsetHeight,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility(),s=o(),t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):l.filterable&&l.$.filterInput.focus())}_refreshItemPathsAndSelection(){const e=this,t=e.selectedIndexes.slice(0);e._menuItems={},e._refreshItemPaths(e.$.mainContainer,!0),e.selectedIndexes=[],e._applySelection(!0,t)}_refreshSorting(){const e=this;e._unsortItems(e.$.mainContainer),e._applyGrouping(e.$.mainContainer);const t=e._state.filter;t&&e._applyFilter(t),e._checkOverflow()}_scroll(e){const t=this;t.$.scrollViewer.scrollTop=t.$.scrollViewer.scrollTop+10*e,t._updateScrollButtonVisibility(),t.focus()}_scrollButtonFarClickHandler(){this.$.scrollButtonFar.disabled||this._scroll(1)}_scrollButtonNearClickHandler(){this.$.scrollButtonNear.disabled||this._scroll(-1)}_scrollViewerDownHandler(e){const t=this;if(e.target!==t.$.scrollViewer||t.disabled||t.displayLoadingIndicator||!t._isMobile&&1!==e.which)return;const r=e.originalEvent.target;if(r!==t.$.editInput)if(t._isMobile){const n=t.$.scrollViewer.scrollTop,l=t.getBoundingClientRect().top,a=setTimeout((function(){if(!t._dragDetails&&t.$.scrollViewer.scrollTop===n&&t.getBoundingClientRect().top===l){const n=t.context;t.context=t,t._continueSelection(r,e),t.context=n}}),250);t._downTimeoutInfo={target:r,event:e,scrollTop:n,top:l,timeout:a}}else t._continueSelection(r,e);else t._editInputDown=!0}_continueSelection(e,t){const r=this,n=e.closest("smart-tree-item")||e.closest("smart-tree-items-group");if(!(n&&n.parentElement&&r._canItemBeSelected(n,!0)))return;const l=e.closest(".smart-tree-items-group-arrow");let a;if(n instanceof Smart.TreeItem)a="_handleSelection";else{if(e===n.container||e===n.container.firstElementChild)return;a="_menuItemsGroupSelectionHandler"}if(clearTimeout(r._dblclickTimeout),n!==r._dblclickObject.target&&(r._dblclickObject.numberOfClicks=0),r._dblclickObject.target=n,r._dblclickObject.numberOfClicks++,r._dblclickTimeout=setTimeout((function(){r._dblclickObject.numberOfClicks=0}),300),2===r._dblclickObject.numberOfClicks){if(r.editable)return void r._startEditing(n);r._dblclickHandler(n,l,t),r._dblclickObject.numberOfClicks=0}n.selected&&(r._downItem=n),r[a](n,t),r._discardKeyboardHover(!0),r._hoverViaKeyboard(n,!1,void 0,!1),l||r._startDragging(n,t)}_scrollViewerTouchmoveHandler(e){this._dragDetails&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_scrollViewerWheelHandler(){const e=this;"scrollButtons"===e.scrollMode&&"hidden"!==e.overflow&&e._updateScrollButtonVisibility()}_selectItemRange(e,t){const r=this,n=Array.from(r.$.mainContainer.querySelectorAll("smart-tree-item, smart-tree-items-group")),l=n.indexOf(e),a=n.indexOf(t),o=[];for(let e=Math.min(l,a);e<=Math.max(l,a);e++){const t=n[e];r._canItemBeHovered(t)&&(o.push(t.path),t.set("selected",!0))}return o}_selectstartHandler(e){this._dragDetails&&e.preventDefault()}_setFocusable(){super._setFocusable();const e=this;e.disabled||e.unfocusable?e.$.filterInput.tabIndex=-1:e.$.filterInput.removeAttribute("tabindex")}_setIndentation(e,t,r){const n=this;let l=n._paddingSize;void 0===l&&(l=parseFloat(getComputedStyle(n).getPropertyValue("--smart-tree-indent")),isNaN(l)?l=20:l+=4,n._paddingSize=l),e.style[r]=t*l-l/2+"px"}_setThreeStateCheckbox(e,t,r){t===e.itemContainer.childElementCount&&t>0?(e.removeAttribute("indeterminate"),e.set("selected",!0),e.setAttribute("aria-selected",!0)):0===t&&0===r?(e.removeAttribute("indeterminate"),e.set("selected",!1),e.setAttribute("aria-selected",!1)):(e.setAttribute("indeterminate",""),e.set("selected",!1),e.setAttribute("aria-selected",!1))}_sortItems(e){const t=this;if(!t.sorted)return;let r;e instanceof Smart.TreeItemsGroup?r=e.container.firstElementChild:e===t.$.mainContainer&&(r=e);let n=Array.from(r.children);if(t.sort){const r=t.sort(n,e);Array.isArray(r)&&(n=r)}else"asc"===t.sortDirection?n.sort((function(e,t){return e.label.localeCompare(t.label)})):n.sort((function(e,t){return t.label.localeCompare(e.label)}));for(let e=n.length-1;e>=0;e--)r.insertBefore(n[e],r.firstElementChild)}_sortPathCollection(e){e.sort((function(e,t){const r=e.split("."),n=t.split("."),l=Math.max(r.length,n.length);for(let e=0;e<l;e++){const t=parseFloat(r[e]),l=parseFloat(n[e]);if(isNaN(t))return-1;if(isNaN(l))return 1;if(t<l)return-1;if(t>l)return 1}}))}_startDragging(e,t){const r=this,n=r.selectionMode;if(!r.allowDrag||r._editedItem||"none"===n)return;const l=[],a=[];let o;if(-1!==["one","zeroAndOne","zeroOrOne","checkBox","radioButton"].indexOf(n))o=!1,l.push(e),a.push(e);else{o=!0;for(let e=0;e<r.selectedIndexes.length;e++)l.push(r._menuItems[r.selectedIndexes[e]]),a.push(l[e]);for(let e=0;e<l.length;e++){const t=l[e];if(-1!==a.indexOf(t))for(let e=a.length-1;e>=0;e--){const r=a[e];if(r===t)break;t.contains(r)&&a.splice(e,1)}}}r._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:l,ValidItems:a,Item:e,FeedbackShown:!1,ValidateOnDrop:o,OriginalEvent:t,StartTime:new Date,Dragging:!0},Smart.Tree.treeItemDragged=!0,r.$.scrollViewer._scrollView.disableSwipeScroll=!0,r.allowDrop&&(Smart.Tree.hoveredTree=r,Smart.Tree.hoveredItem=e)}_startEditing(e){const t=this,r=t.$.editInput;let n,l;if(!t._canItemBeSelected(e,!0))return;const a=e.firstElementChild,o=a.firstElementChild;t.rightToLeft?(n=function(){return a.offsetWidth-o.offsetLeft-o.offsetWidth},l="paddingRight"):(n=function(){return o.offsetLeft+parseFloat(window.getComputedStyle(a).borderLeftWidth)},l="paddingLeft"),e instanceof Smart.TreeItemsGroup?(r.style[l]=n()+(t.showLines?parseFloat(window.getComputedStyle(o.firstElementChild).paddingLeft):0)-1+"px",r.style.height=a.offsetHeight+"px"):(r.style[l]=e.offsetWidth+parseInt(a.style[l],10)-a.offsetWidth+parseFloat(window.getComputedStyle(o.firstElementChild).paddingLeft)-2+"px",r.style.height=e.offsetHeight+"px"),r.style.top=t._getOffsetTop(e)+"px",t.$editInput.removeClass("smart-hidden"),r.value=e.label,t._editedItem=e,r.setAttribute("aria-label","Edit item "+e.label),setTimeout((function(){r.focus()}),0)}_styleChangedHandler(e){e.detail.styleProperties&&e.detail.styleProperties["font-size"]&&this._checkOverflow()}_updateScrollButtonVisibility(){const e=this,t=e.overflow;if("scrollbar"===e.scrollMode||"hidden"===t)return;let r=!0,n=!0;if(0===Math.round(e.$.scrollViewer.scrollTop)&&(r=!1),Math.round(e.$.scrollViewer.$.scrollViewerContainer.offsetHeight+e.$.scrollViewer.scrollTop)>=Math.round(e.$.scrollViewer.$.scrollViewerContentContainer.offsetHeight)&&(n=!1),"auto"===t){if(r&&n)return e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.$scrollViewer.removeClass("one-button-shown"),void e.$.scrollViewer.refresh();r?e.$scrollButtonNear.removeClass("smart-hidden"):e.$scrollButtonNear.addClass("smart-hidden"),n?e.$scrollButtonFar.removeClass("smart-hidden"):e.$scrollButtonFar.addClass("smart-hidden"),e.$scrollViewer.addClass("one-button-shown"),e.$.scrollViewer.refresh()}else"scroll"!==t||e.disabled||(e.$.scrollButtonNear.disabled=!r,e.$.scrollButtonFar.disabled=!n)}_updateState(e,t,r){const n=this;switch(e){case"expanded":{const e=n._state.expanded.indexOf(t);if(r&&-1===e)n._state.expanded.push(t);else{if(r||-1===e)return;n._state.expanded.splice(e,1)}break}case"filter":n._state.filter=void 0!==t?t:n.$.filterInput.value;break;case"selected":n._state.selected=[];for(let e=0;e<n.selectedIndexes.length;e++){const t=n._menuItems[n.selectedIndexes[e]];n._state.selected.push(t.id)}break;case"sorted":n._state.sorted=t}n.autoSaveState&&window.localStorage.setItem("smartTree"+n.id,JSON.stringify(n._state))}_verticalScrollbarHandler(){const e=this,t=e.$.verticalScrollBar,r=t.value;e.disabled||(t.max!==r?t.min!==r?(delete e._topReached,delete e._bottomReached):e._topReached||(e.$.fireEvent("scrollTopReached"),delete e._bottomReached,e._topReached=!0):e._bottomReached||(e.$.fireEvent("scrollBottomReached"),delete e._topReached,e._bottomReached=!0))}});
1689
+ Smart("smart-tree-item",class extends Smart.MenuItem{static get properties(){return{selected:{value:!1,type:"boolean"}}}ready(){const e=this;Object.defineProperty(e,"hasStyleObserver",{get:function(){return!1}}),super.ready(),e.setAttribute("role","treeitem"),e.setAttribute("aria-label",e.label)}propertyChangedHandler(e,t,r){const n=this,l=n.menu;if(super.propertyChangedHandler(e,t,r),"level"===e)return void(n.level=t);if("disabled"===e||"separator"===e||!l)return;const a=l.context;switch(l.context=l,e){case"label":{const e=l.sorted&&l.autoSort;n.firstElementChild.firstElementChild.firstElementChild.innerHTML=r,e&&(l._unsortItems(l.$.mainContainer),l._applyGrouping(l.$.mainContainer)),l._state.filter&&l._applyFilter(l._state.filter),n.setAttribute("aria-label",r);break}case"selected":n.selected=t,r?l.select(n):l.unselect(n);break;case"shortcut":{let e=n.firstElementChild.children[1];e||(e=document.createElement("div"),e.className="smart-tree-item-shortcut",n.firstElementChild.appendChild(e)),e.innerHTML=r;break}case"value":l.sort&&l.sorted&&l.autoSort&&l._refreshSorting()}l.context=a}_setId(){}}),Smart("smart-tree-items-group",class extends Smart.MenuItemsGroup{static get properties(){return{selected:{value:!1,type:"boolean"}}}ready(){const e=this;Object.defineProperty(e,"hasStyleObserver",{get:function(){return!1}}),super.ready(),e.setAttribute("role","treeitem"),e.removeAttribute("aria-haspopup"),e.setAttribute("aria-label",e.label)}propertyChangedHandler(e,t,r){const n=this,l=n.menu;if(super.propertyChangedHandler(e,t,r),"level"===e)return void(n.level=t);if("disabled"===e||"separator"===e||!l)return;const a=l.context;switch(l.context=l,e){case"expanded":n.expanded=t,r?l.expandItem(n):l.collapseItem(n);break;case"label":{const e=l.sorted&&l.autoSort;n.firstElementChild.firstElementChild.firstElementChild.innerHTML=r,e&&(l._unsortItems(l.$.mainContainer),l._applyGrouping(l.$.mainContainer)),l._state.filter&&l._applyFilter(l._state.filter),n.setAttribute("aria-label",r);break}case"selected":n.selected=t,r?l.select(n):l.unselect(n);break;case"value":l.sort&&l.sorted&&l.autoSort&&l._refreshSorting()}l.context=a}_setId(){}}),Smart("smart-tree",class extends Smart.Menu{static get properties(){return{allowDrag:{value:!1,type:"boolean"},allowDrop:{value:!1,type:"boolean"},autoHideToggleElement:{value:!1,type:"boolean"},autoLoadState:{value:!1,type:"boolean"},autoSaveState:{value:!1,type:"boolean"},autoSort:{value:!0,type:"boolean"},displayLoadingIndicator:{value:!1,type:"boolean"},dragFeedbackFormatFunction:{value:null,type:"function?"},dragOffset:{value:[10,10],type:"array"},editable:{value:!1,type:"boolean"},expandMode:{value:"multiple",allowedValues:["multiple","single"],type:"string"},filterable:{value:!1,type:"boolean"},filterOnEnter:{value:!1,type:"boolean"},filterInputPlaceholder:{value:"",type:"string"},filterMember:{value:"label",type:"string"},filterMode:{value:"containsIgnoreCase",allowedValues:["contains","containsIgnoreCase","doesNotContain","doesNotContainIgnoreCase","equals","equalsIgnoreCase","startsWith","startsWithIgnoreCase","endsWith","endsWithIgnoreCase"],type:"string"},hasThreeStates:{value:!1,type:"boolean"},loadingIndicatorPlaceholder:{value:"Loading...",type:"string"},loadingIndicatorPosition:{value:"center",allowedValues:["bottom","center","top"],type:"string"},messages:{value:{en:{noId:"smart-tree: Saving and loading the element's state are not available if the element has no id."}},type:"object",extend:!0},scrollMode:{value:"scrollbar",allowedValues:["scrollbar","scrollButtons"],type:"string"},selectedIndexes:{value:[],type:"array"},selectionDisplayMode:{value:"row",allowedValues:["row","label"],type:"string"},selectionMode:{value:"one",allowedValues:["none","oneOrManyExtended","zeroOrMany","oneOrMany","zeroOrOne","zeroAndOne","one","checkBox","radioButton"],type:"string"},selectionTarget:{value:"all",allowedValues:["all","leaf"],type:"string"},showLines:{value:!1,type:"boolean"},showRootLines:{value:!1,type:"boolean"},sort:{value:null,type:"function?",reflectToAttribute:!1},sortDirection:{value:"asc",allowedValues:["asc","desc"],type:"string"},sorted:{value:!1,type:"boolean"},toggleElementPosition:{value:"near",allowedValues:["near","far"],type:"string"},toggleMode:{value:"dblclick",allowedValues:["click","dblclick","arrow"],type:"string"}}}static get listeners(){return{blur:"_blurHandler",focus:"_focusHandler",keydown:"_keydownHandler",mouseenter:"_mouseenterHandler",mouseleave:"_mouseleaveHandler",resize:"_checkOverflow",styleChanged:"_styleChangedHandler",transitionend:"_overriddenMenuHandler","container.click":"_overriddenMenuHandler","container.mouseout":"_overriddenMenuHandler","container.mouseover":"_overriddenMenuHandler","container.pointerover":"_pointeroverHandler","editInput.blur":"_editInputBlurHandler","filterInput.keydown":"_filterInputKeydownHandler","filterInput.keyup":"_filterInputKeyupHandler","mainContainer.click":"_overriddenMenuHandler","mainContainer.mouseleave":"_overriddenMenuHandler","mainContainer.mouseout":"_overriddenMenuHandler","mainContainer.mouseover":"_overriddenMenuHandler","mainContainer.swipeleft":"_mainContainerSwipeHandler","mainContainer.swiperight":"_mainContainerSwipeHandler","scrollButtonFar.click":"_scrollButtonFarClickHandler","scrollButtonNear.click":"_scrollButtonNearClickHandler","scrollViewer.down":"_scrollViewerDownHandler","scrollViewer.kineticScroll":"_scrollViewerWheelHandler","scrollViewer.touchmove":"_scrollViewerTouchmoveHandler","mainContainer.wheel":"_scrollViewerWheelHandler","document.move":"_moveHandler","document.selectstart":"_selectstartHandler","document.up":"_documentUpHandler"}}static get requires(){return{"Smart.ScrollBar":"smart.scrollbar.js"}}static get styleUrls(){return["smart.scrollbar.css","smart.scrollviewer.css","smart.tree.css"]}template(){return'<div id="container" role="presentation">\n <div class="smart-tree-filter-input-container" role="presentation"><input id="filterInput" class="smart-filter-input" disabled="[[disabled]]" placeholder="[[filterInputPlaceholder]]" type="text" role="searchbox" aria-label="[[filterInputPlaceholder]]" /></div>\n <smart-repeat-button id="scrollButtonNear" class="smart-tree-scroll-button smart-spin-button smart-scroll-button-near smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll up">\n <div id="arrowNear" class="smart-arrow smart-arrow-up"></div>\n </smart-repeat-button>\n <smart-scroll-viewer id="scrollViewer" animation="[[animation]]" horizontal-scroll-bar-visibility="hidden" right-to-left="[[rightToLeft]]">\n <div id="mainContainer" inner-h-t-m-l=\'[[innerHTML]]\' class="smart-tree-main-container" role="presentation">\n <content></content>\n </div>\n <input type="text" id="editInput" class="smart-tree-edit-input smart-hidden" />\n </smart-scroll-viewer>\n <smart-repeat-button id="scrollButtonFar" class="smart-tree-scroll-button smart-spin-button smart-scroll-button-far smart-hidden" animation="[[animation]]" unfocusable aria-label="Scroll down">\n <div id="arrowFar" class="smart-arrow smart-arrow-down"></div>\n </smart-repeat-button>\n <div id="loadingIndicatorContainer" class="smart-loader-container smart-hidden" role="presentation">\n <span id="loadingIndicator" class="smart-loader" role="img" aria-label="[[loadingIndicatorPlaceholder]]"></span>\n <span id="loadingIndicatorPlaceHolder" class="smart-loader-label smart-hidden">[[loadingIndicatorPlaceholder]]</span>\n </div>\n </div>'}detached(){const e=this,t=e._dragDetails;if(super.detached(),!t)return;const r=Smart.Tree.hoveredTree,n=Smart.Tree.hoveredItem;delete e._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,e.$.scrollViewer._scrollView.disableSwipeScroll=!1,t.FeedbackShown&&(n.classList.remove("drop-target","top","bottom"),document.body.classList.remove("smart-dragging"),t.Feedback.remove(),r&&clearInterval(r._dragInterval))}addAfter(e,t){void 0!==(t=this.getItem(t))&&this.addTo(e,t.parentItem,t,!0)}addBefore(e,t){void 0!==(t=this.getItem(t))&&this.addTo(e,t.parentItem,t)}addTo(e,t){const r=this;if(!(e instanceof Smart.TreeItem||e instanceof Smart.TreeItemsGroup))if("string"==typeof e){const t=document.createElement("smart-tree-item");t.label=e,e=t}else{if(!e||!e.label)return;{const t=document.createElement("smart-tree-item");t.label=e.label,e=t}}let n,l;if(e.isDirty=!1,void 0===t)n=1,l=t=r.$.mainContainer;else{if((t=r.getItem(t))instanceof Smart.TreeItemsGroup==0){const n=document.createElement("smart-tree-items-group");return n.innerHTML=t.innerHTML,n.appendChild(e),r.addBefore(n,t),void t.remove()}n=t.level+1,l=t.itemContainer}r._createItemHTMLStructure(e,n,t,l.childElementCount,0);const a=r.sorted&&r.autoSort,o=r._state.filter,s=r.selectedIndexes.slice(0);a&&r._unsortItems(r.$.mainContainer),e instanceof Smart.TreeItemsGroup&&(Array.from(e.querySelectorAll("smart-tree-item, smart-tree-items-group")).forEach((e=>e.isDirty=!1)),r._processHTML(e,n+1,!1));let i=arguments[2];i&&arguments[3]&&(i=i.nextElementSibling),i?(l.insertBefore(e,i),r._menuItems={},r._refreshItemPaths(r.$.mainContainer,!0,void 0,r.sorted&&!r.autoSort)):l.appendChild(e),a&&r._applyGrouping(r.$.mainContainer),o&&r._applyFilter(o),r._checkOverflow(),r._expandItemsByDefault(),r.selectedIndexes=[],r._applySelection(!0,s)}getSelectedValues(){const e=this,t=[];for(let r=0;r<e.selectedIndexes.length;r++){const n=e._menuItems[e.selectedIndexes[r]];n.hasAttribute("value")?t.push(n.getAttribute("value")):n.hasAttribute("label")&&t.push(n.getAttribute("label"))}return t}unselectValues(e){const t=this;e&&Object.keys(t._menuItems).forEach((r=>{const n=t._menuItems[r];let l=null;n.hasAttribute("value")?l=n.getAttribute("value"):n.hasAttribute("label")&&(l=n.getAttribute("label")),"string"==typeof e?e===l&&t.unselect(r):e.indexOf(l)>=0&&t.unselect(r)}))}setSelectedValues(e){const t=this;e&&Object.keys(t._menuItems).forEach((r=>{const n=t._menuItems[r];let l=null;n.hasAttribute("value")?l=n.getAttribute("value"):n.hasAttribute("label")&&(l=n.getAttribute("label")),"string"==typeof e?e===l&&t._canItemBeSelected(n)&&t._handleSelection(n,{type:"programmatic"}):e.indexOf(l)>=0&&t._canItemBeSelected(n)&&t._handleSelection(n,{type:"programmatic"})}))}clearSelection(){const e=this,t=e.selectedIndexes.slice(0);e.selectedIndexes=[],e._applySelection(!1,t)}collapseAll(e){const t=this,r=t.animation,n=!1===e&&t.hasAnimation;n&&(t.animation="none"),t._collapseAll(!0),n&&(t.animation=r)}ensureVisible(e){const t=this;if(void 0===(e=t.getItem(e))||e.hidden)return;let r=!1;e.level>1&&!t._isBranchExpanded(e)&&(super.expandItem(e.parentItem,void 0,!0),r=t.hasAnimation,r&&(t._ensureVisibleOnTransitionend=e)),r||t._ensureVisible(e)}expandAll(e){const t=this,r=t.animation,n=!1===e&&t.hasAnimation;let l=1,a=(t.enableShadowDOM?t.shadowRoot:t).querySelectorAll('smart-tree-items-group[level="1"]');for(n&&(t.animation="none");a.length>0;){for(let e=0;e<a.length;e++){const r=a[e];r.expanded||t._menuItemsGroupSelectionHandler(r,{target:r,type:"expand"})}l++,a=(t.enableShadowDOM?t.shadowRoot:t).querySelectorAll('smart-tree-items-group[level="'+l+'"]')}n&&(t.animation=r)}expandItem(e,t){const r=this;if(void 0===(e=r.getItem(e))||e instanceof Smart.TreeItemsGroup==0||e&&e.container&&r._isContainerOpened(e.container.level,e.container))return;void 0!==Smart.Menu.processTimer&&r._lazyInitItems();const n=!1===t&&r.hasAnimation,l=r.animation;n&&(r.animation="none"),r._discardKeyboardHover(),r._menuItemsGroupSelectionHandler(e,{target:e,type:"expand"},arguments[2]),n&&(r.animation=l)}filter(e){const t=this;t.filterable&&(t._applyFilter(e),t.$.filterInput.value=e)}getState(){return JSON.parse(JSON.stringify(this._state))}insert(e,t){const r=this;let n;if(e instanceof Smart.TreeItem||e instanceof Smart.TreeItemsGroup){if(r.contains(e))return;e.isDirty=!1,n=e}else{if("object"!=typeof e||e.constructor!==Object)return;n=function e(t){const n=t[r.itemsMember],l="smart-tree-items-group"===t.tagName||Array.isArray(n)?"smart-tree-items-group":"smart-tree-item",a=document.createElement(l);if(a.isDirty=!1,t.disabled&&(a.disabled=!0),t[r.displayMember]&&(a.label=t[r.displayMember]),t.selected&&(a.selected=!0),t.separator&&(a.separator=!0),t[r.valueMember]&&(a.value=t[r.valueMember]),"smart-tree-items-group"===l){if(t.expanded&&(a.expanded=!0),n)for(let t=0;t<n.length;t++)a.appendChild(e(n[t]))}else t.shortcut&&(a.shortcut=t.shortcut);return a}(e)}if(void 0===t)return void r.addTo(n);if("number"==typeof t)t=t.toString();else if(t instanceof Smart.TreeItem||t instanceof Smart.TreeItemsGroup){if(!r.contains(t))return;t=t.path}else if("string"!=typeof t)return;const l=t.split(".");let a,o;1===l.length?(o=r._menuItems[l[0]],o?r.addBefore(n,o):r.addTo(n)):(o=r._menuItems[t],a=r._menuItems[l.slice(0,l.length-1).join(".")],o?r.addBefore(n,o):a&&a instanceof Smart.TreeItemsGroup&&r.addTo(n,a))}loadState(e){const t=this,r=t.selectedIndexes.slice(0),n=[];if(!e){if(!t.id)return void t.warn(t.localize("noId"));if(!(e=window.localStorage.getItem("smartTree"+t.id)))return}"string"==typeof e&&(e=JSON.parse(e)),e.filter&&!t.filterable&&(e.filter="");let l=e.filter!==t._state.filter;e.sorted!==t.sorted?(t.sorted=e.sorted,t._updateState("sorted",t.sorted),e.sorted?t._applyGrouping(t.$.mainContainer):t._unsortItems(t.$.mainContainer),(e.filter||l)&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter)):l&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter),t._menuItemsGroupsToExpand=[];for(let r=0;r<e.expanded.length;r++){const n=t.getItem(e.expanded[r]);n&&t._menuItemsGroupsToExpand.push(n)}t._expandItemsByDefault(!0);for(let r=0;r<e.selected.length;r++){const l=t.getItem(e.selected[r]);l&&n.push(l.path)}t.selectedIndexes=n,t._applySelection(!1,r)}moveDown(e){const t=this,r=(e=t.getItem(e)).nextElementSibling;void 0!==e&&r&&!t.sorted&&(t._moveTreeItem(e,r,2,[t]),t.filterable&&t._state.filter&&t._applyFilter(t._state.filter))}moveUp(e){const t=this,r=(e=t.getItem(e)).previousElementSibling;void 0!==e&&r&&!t.sorted&&(t._moveTreeItem(e,r,0,[t]),t.filterable&&t._state.filter&&t._applyFilter(t._state.filter))}refresh(){this._checkOverflow()}removeItem(e){const t=this;if(void 0===(e=t.getItem(e)))return;if(e instanceof Smart.TreeItemsGroup){const r=e.container;t._isContainerOpened(r.level,r)&&t._closeSubContainersTreeMode(r.level,r)}const r=t.sorted&&t.autoSort;r&&t._unsortItems(t.$.mainContainer);const n=e.closest("smart-tree-items-group");e.parentElement.removeChild(e),t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,void 0,t.sorted&&!t.autoSort),r&&t._applyGrouping(t.$.mainContainer);const l=t._state.filter,a=t.selectedIndexes.slice(0);if(l&&t._applyFilter(l),t._checkOverflow(),t.selectedIndexes=[],t._applySelection(!0,a),delete t._treeAnimationInProgress,!n.querySelector("smart-tree-item")){const e=document.createElement("smart-tree-item");return e.innerHTML=n.innerHTML,t.addBefore(e,n),void n.remove()}}saveState(){const e=this;return e.id?window.localStorage.setItem("smartTree"+e.id,JSON.stringify(e._state)):e.warn(e.localize("noId")),JSON.parse(JSON.stringify(e._state))}select(e){const t=this;void 0!==(e=t.getItem(e))&&!e.selected&&t._canItemBeSelected(e)&&t._handleSelection(e,{type:"programmatic"})}unselect(e){void 0!==(e=this.getItem(e))&&e.selected&&!e.templateApplied&&this._handleSelection(e,{type:"programmatic"})}updateItem(e,t){if(void 0===(e=this.getItem(e))||void 0===t)return;const r=e instanceof Smart.TreeItem;for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r){if(-1===["disabled","label","level","selected","separator","shortcut","value"].indexOf(n))continue}else if(-1===["disabled","expanded","label","level","selected","separator","value"].indexOf(n))continue;e[n]=t[n]}}propertyChangedHandler(e,t,r){const n=this;switch(super.propertyChangedHandler(e,t,r),e){case"allowDrag":case"allowDrop":case"autoLoadState":case"autoSort":case"editable":case"filterInputPlaceholder":case"loadingIndicatorPlaceholder":case"selectionDisplayMode":case"showLines":case"showRootLines":case"toggleElementPosition":case"toggleMode":break;case"autoHideToggleElement":r?n.$mainContainer.addClass("hidden-arrows"):n.$mainContainer.removeClass("hidden-arrows");break;case"autoSaveState":if(!r)return;if(!n.id)return n.warn(n.localize("noId")),void(n.autoSaveState=!1);window.localStorage.setItem("smartTree"+n.id,JSON.stringify(n._state));break;case"dataSource":{const e=n.selectedIndexes.slice(0);n.selectedIndexes=[],n._menuItems={},n._processDataSource(),n._checkOverflow(),n._expandItemsByDefault(),n._applySelection(!0,e);const t=n._state.filter;t&&n._applyFilter(t);break}case"disabled":n._setFocusable(),n.$.scrollButtonNear.disabled=r,n.$.scrollButtonFar.disabled=r,r||n._updateScrollButtonVisibility();break;case"displayLoadingIndicator":r?(n._discardKeyboardHover(!0),n.$loadingIndicatorContainer.removeClass("smart-hidden")):n.$loadingIndicatorContainer.addClass("smart-hidden");break;case"expandMode":if("single"===r){const e=n._state.expanded.map((e=>Object.values(n._menuItems).find((t=>t.id===e)))),t={};for(let r=0;r<e.length;r++){const l=e[r],a=l.parentItem;if(t[a])continue;t[a]=!0;const o=e.filter((e=>e!==l&&e.parentItem===a));o.length>0&&o.forEach((e=>n.collapseItem(e)))}}break;case"filterable":!1===r&&(n._applyFilter(""),n.$.filterInput.value=""),n._checkOverflow();break;case"filterMode":n.filterable&&n._state.filter&&n._applyFilter(n._state.filter);break;case"hasThreeStates":if("checkBox"!==n.selectionMode)return;if(r)n._applySelection(!1);else{const e=(n.enableShadowDOM?n.shadowRoot:n).querySelectorAll("[indeterminate]");for(let t=0;t<e.length;t++)e[t].removeAttribute("indeterminate")}break;case"innerHTML":n.$.mainContainer.innerHTML=r,n._lazyInitItems();break;case"loadingIndicatorPosition":"center"===r?n.$loadingIndicatorPlaceHolder.addClass("smart-hidden"):n.$loadingIndicatorPlaceHolder.removeClass("smart-hidden");break;case"overflow":if("scrollbar"===n.scrollMode)return"hidden"===r?n.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0):n.$.scrollViewer.$.verticalScrollBar.removeAttribute("aria-hidden"),void(n.$.scrollViewer.verticalScrollBarVisibility="scroll"===r?"visible":"auto");n.$.scrollViewer.scrollTop=0,"hidden"===r?(n.$scrollViewer.removeClass("scroll-buttons-shown"),n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden")):(n.$.scrollButtonNear.disabled=n.disabled,n.$.scrollButtonFar.disabled=n.disabled,"auto"===r?(n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden"),n._checkOverflow()):(n.$scrollViewer.addClass("scroll-buttons-shown"),n.$scrollViewer.removeClass("one-button-shown"),n.$scrollButtonNear.removeClass("smart-hidden"),n.$scrollButtonFar.removeClass("smart-hidden"),n._updateScrollButtonVisibility())),n.$.scrollViewer.refresh();break;case"rightToLeft":{let e,t;r?(e="paddingLeft",t="paddingRight"):(e="paddingRight",t="paddingLeft");for(let r in n._menuItems)if(Object.prototype.hasOwnProperty.call(n._menuItems,r)){const l=n._menuItems[r],a=l.firstElementChild;a.style[e]="",n._setIndentation(a,l.level,t)}break}case"scrollMode":if("hidden"===n.overflow)return;if(n.$.scrollViewer.scrollTop=0,"scrollButtons"===r)return"scroll"===n.overflow&&(n.$scrollViewer.addClass("scroll-buttons-shown"),n.$scrollButtonNear.removeClass("smart-hidden"),n.$scrollButtonFar.removeClass("smart-hidden")),n.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0),n.$.scrollViewer.verticalScrollBarVisibility="auto",void n._checkOverflow();n.$.scrollViewer.$.verticalScrollBar.removeAttribute("aria-hidden"),n.$scrollViewer.removeClass("scroll-buttons-shown"),n.$scrollViewer.removeClass("one-button-shown"),n.$scrollButtonNear.addClass("smart-hidden"),n.$scrollButtonFar.addClass("smart-hidden"),"auto"===n.overflow?n.$.scrollViewer.verticalScrollBarVisibility="auto":n.$.scrollViewer.verticalScrollBarVisibility="visible";break;case"selectedIndexes":n._applySelection(!1,t);break;case"selectionMode":if(n.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(r)),void 0===n._menuItems[0])return;if("one"===t&&"none"!==r&&"checkBox"!==r&&"radioButton"!==r||-1!==t.indexOf("oneOrMany")&&-1!==r.indexOf("oneOrMany")||"none"===t&&(-1!==r.indexOf("zero")||"checkBox"===r)||"zeroOrMany"===r&&"checkBox"!==t||"radioButton"===t&&-1!==r.indexOf("Many")||!n.hasThreeStates&&("checkBox"===r||"checkBox"===t&&"zeroOrMany"===r))return n._lastSelectedItem="one"===r||"oneOrManyExtended"===r?n._menuItems[n.selectedIndexes[n.selectedIndexes.length-1]]:void 0,void n._applyAriaSelected();if(n.hasThreeStates&&"checkBox"===t){const e=(n.enableShadowDOM?n.shadowRoot:n).querySelectorAll("[indeterminate]");for(let t=0;t<e.length;t++)e[t].removeAttribute("indeterminate")}n._applySelection(!1);break;case"sort":if(!n.sorted)return;n._refreshSorting();break;case"sortDirection":n.sorted&&!n.sort&&(n._unsortItems(n.$.mainContainer),n._applyGrouping(n.$.mainContainer));break;case"sorted":{if(!r&&!n.autoSort)return n._refreshItemPathsAndSelection(),void n._updateState("sorted",!1);r?n._applyGrouping(n.$.mainContainer):n._unsortItems(n.$.mainContainer);const e=n._state.filter;e&&n._applyFilter(e),n._updateState("sorted",r),n._checkOverflow();break}case"unfocusable":n._setFocusable()}}_addDragFeedback(){const e=this,t=document.createElement("div");return t.className="smart-tree-item-feedback",t.setAttribute("parent-tree-id",e.id),e.theme&&t.setAttribute("theme",e.theme),e.dragFeedbackFormatFunction?t.innerHTML=e.dragFeedbackFormatFunction(e._dragDetails.Items):1===e._dragDetails.Items.length?t.innerHTML=e._dragDetails.Item.label:(t.classList.add("multiple"),t.innerHTML="&#xf0c5;"),document.body.appendChild(t),t}_applyFilter(e){const t=this;function r(e,t){e?(t.hidden&&t.$.removeClass("smart-hidden"),t.hidden=!1):(t.hidden||t.$.addClass("smart-hidden"),t.hidden=!0)}if(""===e&&!t.hasAttribute("filter-applied"))return;const n=Array.from(t.$.mainContainer.getElementsByClassName("last-filtered-child"));for(let e=0;e<n.length;e++)n[e].$.removeClass("last-filtered-child");!function n(l,a){let o,s=!1,i=0;a=Array.from(a);for(let l=0;l<a.length;l++){const d=a[l];d instanceof Smart.TreeItem?r(t._findItem(d,e),d):n(d,d.itemContainer.children),d.hidden||(i++,o=d),s=s||!d.hidden}if(l!==t.$.mainContainer){const n=t._findItem(l,e);r(s||n,l),s&&null===n?l.$.addClass("filtered-child"):l.$.removeClass("filtered-child"),!s&&a.length>0?(l.hiddenChildren=!0,l.$.addClass("hidden-children"),t.collapseItem(l,void 0,!1)):(l.hiddenChildren=!1,l.$.removeClass("hidden-children"))}""!==e&&i>0&&o.$.addClass("last-filtered-child")}(t.$.mainContainer,t.$.mainContainer.children),""!==e?t.setAttribute("filter-applied",""):t.removeAttribute("filter-applied"),t._updateState("filter",e),t._checkOverflow()}_applyHierarchicalSelection(e,t){const r=this,n=e!==r.$.mainContainer,l=n?e.itemContainer.children:e.children;let a=0,o=0;for(let s=0;s<l.length;s++){const i=l[s];e.selected&&i.set("selected",!0),i instanceof Smart.TreeItemsGroup?r._applyHierarchicalSelection(i,t):i.selected&&t.push(i.path),n&&(i.selected?a++:i.hasAttribute("indeterminate")&&o++)}n&&(r._setThreeStateCheckbox(e,a,o),e.selected&&t.push(e.path))}_applyRadioButtonSelection(e,t,r){const n=this,l=e!==n.$.mainContainer?e.itemContainer.children:e.children,a=[];let o;for(let e=0;e<l.length;e++){const o=l[e];o instanceof Smart.TreeItemsGroup&&n._applyRadioButtonSelection(o,t,r),o.set("selected",!1),-1!==t.indexOf(o.path)&&a.push(o)}o=0===a.length?l[0]:a[a.length-1],o.set("selected",!0),r.push(o.path)}_applySelection(e,t){const r=this;let n=r.selectedIndexes.slice(0);function l(e){const t=Object.values(r._menuItems).filter((t=>t.level===e));if(0!==t.length){for(let e=0;e<t.length;e++)if(r._canItemBeSelected(t[e]))return t[e].path;return l(e+1)}}if(void 0===t&&(t=n.slice(0)),void 0===r._menuItems[0])return r.selectedIndexes=[],r._lastSelectedItem=void 0,void(r.isRendered&&JSON.stringify(t)!==JSON.stringify([])&&r.$.fireEvent("change",{selectedIndexes:r.selectedIndexes,oldSelectedIndexes:t}));const a=r.selectionMode,o=Array.from((r.shadowRoot||r).querySelectorAll("smart-tree-item[selected], smart-tree-items-group[selected]"));for(let e=n.length-1;e>=0;e--){const t=r._menuItems[n[e]];void 0!==t&&r._canItemBeSelected(t)||n.splice(e,1)}if(e)for(let e=0;e<o.length;e++)r._canItemBeSelected(o[e])?-1===n.indexOf(o[e].path)&&n.push(o[e].path):o[e].set("selected",!1);else{for(let e=0;e<o.length;e++)o[e].set("selected",!1);o.length=0}switch(r._sortPathCollection(n),a){case"none":n.length=0;for(let e=0;e<o.length;e++)o[e].set("selected",!1);break;case"one":case"zeroAndOne":case"zeroOrOne":"one"===a&&0===n.length&&n.push(l(1));for(let e=0;e<n.length;e++){const t=r._menuItems[n[e]];if(e===n.length-1){t.set("selected",!0),n=[n[e]];break}-1!==o.indexOf(t)&&t.set("selected",!1)}break;case"oneOrMany":case"oneOrManyExtended":0===n.length&&n.push(l(1));for(let e=0;e<n.length;e++)r._menuItems[n[e]].set("selected",!0);break;case"zeroOrMany":case"checkBox":for(let e=0;e<n.length;e++)r._menuItems[n[e]].set("selected",!0);if("checkBox"===a&&r.hasThreeStates){const e=[];r._applyHierarchicalSelection(r.$.mainContainer,e),r._sortPathCollection(e),n=e}break;case"radioButton":{const e=[];r._applyRadioButtonSelection(r.$.mainContainer,n,e),r._sortPathCollection(e),n=e;break}}r.selectedIndexes=n,r._updateState("selected"),r._lastSelectedItem="one"===a||"oneOrManyExtended"===a?r._menuItems[n[n.length-1]]:void 0,r.isRendered&&!1!==arguments[2]&&JSON.stringify(t)!==JSON.stringify(n)&&r.$.fireEvent("change",{selectedIndexes:r.selectedIndexes,oldSelectedIndexes:t}),r._applyAriaSelected()}_applyAriaSelected(){const e=this,t=e.selectionMode;for(let r in e._menuItems){const n=e._menuItems[r];n.selected?n.setAttribute("aria-selected",!0):e._canItemBeSelected(n)&&-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(t)?n.setAttribute("aria-selected",!1):n.removeAttribute("aria-selected")}}_autoLoadState(e){const t=this,r=[];for(let e=0;e<t._menuItemsGroupsToExpand.length;e++)t._menuItemsGroupsToExpand[e].set("expanded",!1);t._menuItemsGroupsToExpand=[];for(let r=0;r<e.expanded.length;r++){const n=t.getItem(e.expanded[r]);n&&t._menuItemsGroupsToExpand.push(n)}t.filterable&&e.filter&&(t._applyFilter(e.filter),t.$.filterInput.value=e.filter);for(let n=0;n<e.selected.length;n++){const l=t.getItem(e.selected[n]);l&&r.push(l.path)}t.selectedIndexes=r}_blurHandler(){this._discardKeyboardHover(!0)}_canItemBeHovered(e){const t=e.level;return!1===e.disabled&&!0!==e.templateApplied&&!0!==e.hidden&&(1===t||t>1&&this._isContainerOpened(t,e.parentElement.container)&&e.getBoundingClientRect().height>0)}_canItemBeSelected(e,t){return!(!0!==t&&"leaf"===this.selectionTarget&&e instanceof Smart.TreeItemsGroup)&&!1===e.disabled&&!0!==e.templateApplied}_checkOverflow(){const e=this,t=e.$.scrollViewer,r=e.overflow;if("scrollbar"===e.scrollMode||"hidden"===r)return void t.refresh();const n=t.scrollTop;"auto"===r&&(t.$.removeClass("scroll-buttons-shown"),t.$.removeClass("one-button-shown"),e.$scrollButtonNear.addClass("smart-hidden"),e.$scrollButtonFar.addClass("smart-hidden"));const l=Math.round(t.$.scrollViewerContentContainer.offsetHeight)>Math.round(t.$.scrollViewerContainer.offsetHeight),a=Math.round(t.scrollTop)>0,o=Math.round(t.$.scrollViewerContainer.offsetHeight+t.scrollTop)<Math.round(t.$.scrollViewerContentContainer.offsetHeight);l?"auto"===r?(t.$.addClass("scroll-buttons-shown"),a&&e.$scrollButtonNear.removeClass("smart-hidden"),o&&e.$scrollButtonFar.removeClass("smart-hidden"),!1===(a&&o)&&t.$.addClass("one-button-shown"),e.disabled||(e.$.scrollButtonNear.disabled=!1,e.$.scrollButtonFar.disabled=!1),t.scrollTop=n):(e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.disabled?(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0):(e.$.scrollButtonNear.disabled=!a,e.$.scrollButtonFar.disabled=!o)):"scroll"===r&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),t.refresh()}_createElement(){const e=this,t=window.getComputedStyle(e.$.scrollViewer);if(e.setAttribute("role","tree"),e.setAttribute("aria-multiselectable",-1!==["oneOrManyExtended","zeroOrMany","oneOrMany","checkBox","radioButton"].indexOf(e.selectionMode)),e.setAttribute("aria-orientation","vertical"),e.$.scrollViewer.onVerticalChange=e._verticalScrollbarHandler,e.isRendered||Object.defineProperty(e,"dataSource",{get:function(){return e.context===e?e.properties.dataSource.value:e._getDataSource()},set(t){e.updateProperty(e,e._properties.dataSource,t)}}),e.id||!e.autoLoadState&&!e.autoSaveState||(e.warn(e.localize("noId")),e.autoLoadState=!1,e.autoSaveState=!1),e.mode="tree",e._element="tree",e._isMobile=Smart.Utilities.Core.isMobile,e._edgeMacFF=!1,e._autoScrollCoefficient=Smart.Utilities.Core.Browser.Firefox?4:Smart.Utilities.Core.Browser.Edge?8:2,e._scrollViewerPadding=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)||0,e._state={expanded:[],filter:"",selected:[]},e._dblclickObject={numberOfClicks:0},e.autoHideToggleElement&&e.$mainContainer.addClass("hidden-arrows"),e.disabled&&(e.$.scrollButtonNear.disabled=!0,e.$.scrollButtonFar.disabled=!0),"scrollbar"===e.scrollMode&&"scroll"===e.overflow&&(e.$.scrollViewer.verticalScrollBarVisibility="visible"),null===e.dataSource&&e.$.mainContainer.firstElementChild instanceof HTMLUListElement&&e._processUList(),e.isRendered)return e._menuItems={},void(null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource());const r=(e.shadowRoot||e).querySelectorAll("smart-tree-item, smart-tree-items-group"),n=function(){let t;e.autoLoadState&&(t=window.localStorage.getItem("smartTree"+e.id),t&&(t=JSON.parse(t),e.sorted=t.sorted)),e._setFocusable(),e._menuItems={},null===e.dataSource?e._processHTML(e.$.mainContainer,1):e._processDataSource(),"scrollButtons"!==e.scrollMode&&"hidden"!==e.overflow||e.$.scrollViewer.$.verticalScrollBar.setAttribute("aria-hidden",!0),"scrollButtons"===e.scrollMode&&"scroll"===e.overflow&&(e.$scrollViewer.addClass("scroll-buttons-shown"),e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e._updateScrollButtonVisibility()),e._checkOverflow(),t&&e._autoLoadState(t),e._expandItemsByDefault(),e._applySelection(!0),e._updateState("sorted",e.sorted),e.displayLoadingIndicator&&e.$loadingIndicatorContainer.removeClass("smart-hidden"),"center"!==e.loadingIndicatorPosition&&e.$loadingIndicatorPlaceHolder.removeClass("smart-hidden"),e.__onCompleted&&(e._onCompleted=e.__onCompleted,e.__onCompleted=null,e._onCompleted())};0===r.length||e.enableShadowDOM||e.isInShadowDOM?n():(e._onCompleted&&(e.__onCompleted=e._onCompleted,e._onCompleted=null),e._ensureItemsReady(r,n))}appendChild(e){const t=this;if(!t.isCompleted){const e=Array.prototype.slice.call(arguments,2);return HTMLElement.prototype.appendChild.apply(t,e.concat(Array.prototype.slice.call(arguments)))}t.$.mainContainer&&t.$.mainContainer.appendChild(e)}_dblclickHandler(e,t,r){"dblclick"!==this.toggleMode||e instanceof Smart.TreeItem||t||this._menuItemsGroupSelectionHandler(e,r)}_discardKeyboardHover(e,t){const r=this;!t&&r._hoveredViaKeyboard&&(!e&&r._hoveredViaKeyboard instanceof Smart.MenuItemsGroup&&r._isContainerOpened(r._hoveredViaKeyboard.level+1,r._hoveredViaKeyboard.container)||(r._hoveredViaKeyboard.removeAttribute("focus"),r._hoveredViaKeyboard=void 0))}_documentUpHandler(e){if("pointercancel"===e.originalEvent.type)return;const t=this,r=t._downTimeoutInfo,n=t._dragDetails;!r||n&&n.FeedbackShown||(clearTimeout(r.timeout),t.$.scrollViewer.scrollTop!==r.scrollTop&&t.getBoundingClientRect().top===r.top||t._continueSelection(r.target,r.event)),delete t._downTimeoutInfo;const l=t._downItem,a=t.isInShadowDOM?e.originalEvent.composedPath()[0]:e.originalEvent.target;if(delete t._downItem,t._editedItem&&!t._editInputDown&&(!t._isMobile&&a!==t.$.editInput||t._isMobile&&t.getRootNode().elementFromPoint(e.clientX,e.clientY)!==t.$.editInput))return void t._endEditing();if(delete t._editInputDown,l){const r=a.closest("smart-tree-item")||a.closest("smart-tree-items-group");!r||!r.selected||r!==l||t._dragDetails&&t._dragDetails.FeedbackShown||r instanceof Smart.TreeItemsGroup&&(a.closest(".smart-tree-items-group-arrow")||a===r.container||a===r.container.firstElementChild)||t._handleSelection(r,e)}if(!n)return;const o=Smart.Tree.hoveredTree,s=Smart.Tree.hoveredItem;if(delete t._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,t.$.scrollViewer._scrollView.disableSwipeScroll=!1,!n.FeedbackShown)return;const i=o||t.getRootNode().elementFromPoint(e.clientX,e.clientY);let d;document.body.classList.remove("smart-dragging"),document.body.removeChild(n.Feedback),o&&clearInterval(o._dragInterval);const c=n.Item,m=n.Items,u=n.ValidItems;if(!i)return;if(!s||c.contains(s))return void t.$.fireEvent("dragEnd",{item:c,items:m,target:i,data:n,previousContainer:t,container:o||i,originalEvent:e});if(!o||!o.allowDrop||o.disabled)return;const p=[o];let h;if(s.classList.remove("drop-target"),s.classList.contains("top")?(s.classList.remove("top"),h="top",d=0):s.classList.contains("bottom")?(s.classList.remove("bottom"),h="bottom",d=2):(h="inside",d=1),n.DropDetails={item:s,position:h},o!==t)p.push(t);else if(n.ValidateOnDrop)for(let e=0;e<u.length;e++)if(u[e].contains(s))return;if(!t.$.fireEvent("dragEnd",{item:c,items:m,target:s,data:n,previousContainer:t,container:o,originalEvent:e}).defaultPrevented){o.sorted&&o.autoSort&&o._unsortItems(o.$.mainContainer);for(let e=0;e<u.length;e++)t._moveTreeItem(u[e],s,d,p);o.sorted&&o.autoSort&&o._applyGrouping(o.$.mainContainer),o!==t&&o._state.filter&&o._applyFilter(o._state.filter)}}_editInputBlurHandler(){this._endEditing()}_endEditing(e){const t=this,r=t._editedItem;if(!r)return;if(delete t._editedItem,t.$editInput.addClass("smart-hidden"),t.focus(),e)return;const n=t.$.editInput.value,l=t.sorted&&t.autoSort,a=t._state.filter;n!==r.label&&(r.set("label",n),r.setAttribute("aria-label",n),r.firstElementChild.firstElementChild.firstElementChild.innerHTML=n,l&&(t._unsortItems(t.$.mainContainer),t._applyGrouping(t.$.mainContainer)),a&&t._applyFilter(a))}_ensureVisible(e){const t=this;t._ensureVisibleTreeMode(e,e.getBoundingClientRect(),t.$.scrollViewer,t.$.scrollViewer.getBoundingClientRect(),t._scrollViewerPadding),t._ensureVisibleCallback&&t._ensureVisibleCallback(e)}_pointeroverHandler(e){const t=(this.isInShadowDOM?e.composedPath()[0]:e.target).closest(".smart-tree-item-label-element>span");if(!t)return;const r=this.$.container.querySelector(".tooltip");r&&(r.classList.remove("tooltip"),r.removeAttribute("title")),t.scrollWidth>t.offsetWidth&&(t.classList.add("tooltip"),t.title=t.innerText)}_filterInputKeyupHandler(e){const t=this;if(t._filterTimer&&clearTimeout(t._filterTimer),t.filterOnEnter){if("Enter"!==e.key)return;{const e=t.context;t.context=t,t._applyFilter(t.$.filterInput.value,t._view),t._checkOverflow(),t.context=e}}t._filterTimer=setTimeout((function(){const e=t.context;t.context=t,t._applyFilter(t.$.filterInput.value,t._view),t._checkOverflow(),t.context=e}),300)}_filterInputKeydownHandler(e){if("PageDown"!==e.key)return void("PageUp"===e.key&&(e.preventDefault(),e.stopPropagation()));const t=this;let r;if(e.preventDefault(),e.stopPropagation(),t.selectedIndexes.length>0){const e=t.selectedIndexes.slice(0);r=t._lastSelectedItem||t._menuItems[t.selectedIndexes[t.selectedIndexes.length-1]],"checkBox"!==t.selectionMode&&"radioButton"!==t.selectionMode&&(t.selectedIndexes=[r.path],t._applySelection(!1,e)),t.focus()}else r=t._getFirstEnabledChild(t.$.mainContainer),t.focus(),r&&t._hoverViaKeyboard(r);t._ensureVisible(r)}_focusHandler(){const e=this;e.selectedIndexes.length>0&&!e._hoveredViaKeyboard&&(e._lastSelectedItem?e._hoverViaKeyboard(e._lastSelectedItem,!1,void 0,!1):e._hoverViaKeyboard(e._menuItems[e.selectedIndexes[e.selectedIndexes.length-1]],!1,void 0,!1))}_getDataSource(){const e=[];return function e(t,r){for(let n=0;n<t.length;n++){const l=t[n],a={label:l.label};l.disabled&&(a.disabled=!0),l.selected&&(a.selected=!0),l.separator&&(a.separator=!0),null!==l.value&&(a.value=l.value),l instanceof Smart.TreeItem?l.shortcut&&(a.shortcut=l.shortcut):(l.expanded&&(a.expanded=!0),a.items=[],e(l.itemContainer.children,a.items)),r.push(a)}}(this.$.mainContainer.children,e),e}_handleHierarchicalSelection(e,t){const r=this;let n=e;for(e.selected?(e.set("selected",!1),e.setAttribute("aria-selected",!1)):(e.set("selected",!0),e.setAttribute("aria-selected",!0),e.removeAttribute("indeterminate"));n.parentItem;){const e=n.parentItem,t=e.itemContainer.children;let l=0,a=0;for(let e=0;e<t.length;e++)t[e].selected?l++:t[e].hasAttribute("indeterminate")&&a++;r._setThreeStateCheckbox(e,l,a),n=e}e instanceof Smart.TreeItemsGroup&&function e(t,r){const n=t.itemContainer.children;for(let t=0;t<n.length;t++){const l=n[t];l.set("selected",r),l.setAttribute("aria-selected",r),l.removeAttribute("indeterminate"),l instanceof Smart.TreeItemsGroup&&e(l,r)}}(e,e.selected),t.length=0;const l=Array.from((r.enableShadowDOM?r.shadowRoot:r).querySelectorAll("[selected]"));for(let e=0;e<l.length;e++)t.push(l[e].path);r._sortPathCollection(t)}_handleSelection(e,t){const r=this,n=r.selectionMode;if("none"===n||"programmatic"!==t.type&&!r._canItemBeSelected(e))return;const l=e.selected;if(l&&"down"===t.type)return;const a=r.selectedIndexes.slice(0);let o=a.slice(0);switch(n){case"one":case"zeroAndOne":if(l)return;r._menuItems[o[0]]&&(r._menuItems[o[0]].set("selected",!1),r._menuItems[o[0]].removeAttribute("aria-selected")),r.selectedIndexes=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e;break;case"zeroOrOne":l?(r.selectedIndexes=[],e.set("selected",!1),e.removeAttribute("aria-selected")):(void 0!==o[0]&&(r._menuItems[o[0]].set("selected",!1),r._menuItems[o[0]].removeAttribute("aria-selected")),r.selectedIndexes=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0));break;case"oneOrMany":case"zeroOrMany":if(l){if(1===o.length&&"zeroOrMany"!==n)return;o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)}else o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0);r.selectedIndexes=o;break;case"oneOrManyExtended":{const n=t.ctrlKey||t.metaKey,l=t.shiftKey;if(!n&&!l||l&&e===r._lastSelectedItem){for(let e=0;e<o.length;e++)r._menuItems[o[e]].set("selected",!1),r._menuItems[o[e]].setAttribute("aria-selected",!1);o=[e.path],e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e}else if(n)e.selected&&o.length>1?(o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)):e.selected||(o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0),r._lastSelectedItem=e);else if(l){for(let e=0;e<o.length;e++)r._menuItems[o[e]].set("selected",!1),r._menuItems[o[e]].setAttribute("aria-selected",!1);o=r._selectItemRange(r._lastSelectedItem,e)}r.selectedIndexes=o;break}case"checkBox":r.hasThreeStates?r._handleHierarchicalSelection(e,o):l?(o.splice(o.indexOf(e.path),1),e.set("selected",!1),e.setAttribute("aria-selected",!1)):(o.push(e.path),r._sortPathCollection(o),e.set("selected",!0),e.setAttribute("aria-selected",!0)),r.selectedIndexes=o;break;case"radioButton":{if(e.selected)return;let t;for(let r=0;r<e.parentElement.children.length;r++){const n=e.parentElement.children[r];if(n.selected){t=n;break}}const n=o.indexOf(t.path);t.set("selected",!1),e.setAttribute("aria-selected",!1),e.set("selected",!0),e.setAttribute("aria-selected",!0),o.splice(n,1),o.push(e.path),r._sortPathCollection(o),r.selectedIndexes=o;break}}if(r._discardKeyboardHover(!0),r._hoverViaKeyboard(e,!1,void 0,!r._treeAnimationInProgress),r._updateState("selected"),JSON.stringify(a)!==JSON.stringify(r.selectedIndexes)){if(r.ownerElement&&!r.ownerElement.isRendered)return;r.$.fireEvent("change",{item:e,selectedIndexes:r.selectedIndexes,oldSelectedIndexes:a})}}_hoverViaKeyboard(e,t,r,n){if(!e)return;const l=this;e.setAttribute("focus",""),l._hoveredViaKeyboard=e,!1!==n&&l._ensureVisible(e),t&&l._handleSelection(e,r),l._hoverViaKeyboardCallback&&l._hoverViaKeyboardCallback(e)}_keydownHandler(e){const t=this,r=e.key;if(t._editedItem)return void("Enter"===r?t._endEditing():"Escape"===r&&t._endEditing(!0));if(t.getRootNode().activeElement!==t||-1===["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","F2","Home","PageDown","PageUp"," "].indexOf(r)||t.disabled||t.displayLoadingIndicator)return;"Enter"!==r&&e.preventDefault();const n=Array.from(t.$.mainContainer.querySelectorAll("smart-tree-item, smart-tree-items-group")),l="one"===t.selectionMode||"oneOrManyExtended"===t.selectionMode&&!e.ctrlKey&&!e.metaKey,a=t.$.mainContainer.querySelector("[focus]");function o(r){for(let o=r;o<n.length;o++){const r=n[o];if(t._canItemBeHovered(r)){if(a){if(a===r)break;a.removeAttribute("focus")}t._hoverViaKeyboard(r,l,e);break}}}function s(r){for(let o=r;o>=0;o--){const r=n[o];if(t._canItemBeHovered(r)){if(a){if(a===r)break;a.removeAttribute("focus")}t._hoverViaKeyboard(r,l,e);break}}}function i(){a.level>1&&t._canItemBeSelected(a.parentItem)&&(a.removeAttribute("focus"),t._hoverViaKeyboard(a.parentItem,l,e))}let d;switch(r){case"ArrowDown":d=a?n.indexOf(a)+1:0,o(d);break;case"ArrowLeft":if(!a)return;if(a instanceof Smart.TreeItem)i();else{if(t._isContainerOpened(a.level+1,a.container))return void t._closeSubContainersTreeMode(a.level+1,a.container,!0,!0);i()}break;case"ArrowRight":if(!a||a instanceof Smart.TreeItem)return;if(t._isContainerOpened(a.level+1,a.container)){const r=t._getFirstEnabledChild(a.itemContainer);r&&(a.removeAttribute("focus"),t._hoverViaKeyboard(r,l,e))}else t._menuItemsGroupSelectionHandler(a,{target:a,type:"keydown"});break;case"ArrowUp":d=a?n.indexOf(a)-1:n.length-1,s(d);break;case"End":s(n.length-1);break;case"Enter":a&&a instanceof Smart.TreeItemsGroup&&t._menuItemsGroupSelectionHandler(a,{target:a,type:"keydown"});break;case"F2":t.editable&&t._startEditing(a);break;case"Home":o(0);break;case"PageDown":t._pageDownHandler(n,a,l,e);break;case"PageUp":t._pageUpHandler(n,a,l,e);break;case" ":a&&t._handleSelection(a,e)}}_mainContainerSwipeHandler(e){Smart.Tree.treeItemDragged&&e.stopPropagation()}_menuItemsGroupSelectionHandler(e,t,r){const n=this,l=n.toggleMode,a=!!t.originalEvent&&t.originalEvent.target.classList.contains("smart-tree-items-group-arrow"),o=e.container;if(n._waitAnimation&&n._treeAnimationInProgress)return;if("down"!==t.type||a||"dblclick"===l&&1!==n._dblclickObject.numberOfClicks||n._handleSelection(e,t),"down"===t.type&&!a&&("dblclick"===l&&2!==n._dblclickObject.numberOfClicks||"click"===l&&n._dblclickObject.numberOfClicks>1||"arrow"===l)||e.hiddenChildren)return;const s=o.level;let i=n.hasAnimation;if("keydown"===t.type&&n._discardKeyboardHover(),n._treeAnimationInProgress&&(o.removeEventListener("transitionend",n._transitionendHandlerExpand),o.removeEventListener("transitionend",n._transitionendHandlerCollapse)),n._isContainerOpened(s,o))n._closeSubContainersTreeMode(s,o,!0,!1!==r);else{if(n.$.fireEvent("expanding",{item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children}).defaultPrevented)return;if(n._handleSingleExpandMode(e),i&&("expand"!==t.type&&(n._ensureVisibleOnTransitionend=e),n._expandSection(o)),o.$.removeClass("smart-visibility-hidden"),"keydown"===t.type&&(e.setAttribute("focus",""),n._hoveredViaKeyboard=e),e.$.addClass("smart-tree-items-group-opened"),e.$.addClass("smart-tree-items-group-expanded"),n._addOpenedContainer(s,o),void 0===t.type&&n._hoverViaKeyboard(n._getFirstEnabledChild(e.itemContainer)),!1!==r){const t={item:e,label:e.label,path:e.path,value:e.value,children:e.itemContainer.children};n.toggleCallback?(t.type="expand",n.toggleCallback(t)):n.$.fireEvent("expand",t)}}i||(n._checkOverflow(),"expand"!==t.type&&n._ensureVisible(e))}_handleSingleExpandMode(e){const t=this;if("single"!==t.expandMode)return;const r=e.parentItem,n=t._state.expanded.map((e=>Object.values(t._menuItems).find((t=>t.id===e)))).filter((e=>e.parentItem===r));n.length>0&&n.forEach((e=>t.collapseItem(e)))}_mouseenterHandler(){const e=this;e.autoHideToggleElement&&e.$mainContainer.removeClass("hidden-arrows"),Smart.Tree.treeItemDragged&&e.allowDrop&&!e.disabled&&(Smart.Tree.hoveredTree=e)}_mouseleaveHandler(){const e=this;if(e.autoHideToggleElement&&e.$mainContainer.addClass("hidden-arrows"),Smart.Tree.treeItemDragged){Smart.Tree.hoveredTree&&(clearInterval(Smart.Tree.hoveredTree._dragInterval),delete Smart.Tree.hoveredTree);const e=Smart.Tree.hoveredItem;e&&(e.classList.remove("drop-target"),e.classList.remove("top"),e.classList.remove("bottom"),delete Smart.Tree.hoveredItem)}}_moveHandler(e){const t=this,r=t._dragDetails;if(!r)return;if(!r.FeedbackShown){if(!(Math.abs(r.StartPosition.left-e.pageX)>5||Math.abs(r.StartPosition.top-e.pageY)>5))return;if(t.$.fireEvent("dragStart",{item:r.Item,items:r.Items,data:r,container:t,previousContainer:t,originalEvent:r.OriginalEvent}).defaultPrevented)return delete t._dragDetails,delete Smart.Tree.treeItemDragged,delete Smart.Tree.hoveredTree,delete Smart.Tree.hoveredItem,void(t.$.scrollViewer._scrollView.disableSwipeScroll=!1);document.body.classList.add("smart-dragging"),r.Feedback=t._addDragFeedback(),r.FeedbackShown=!0}const n=t.dragOffset;let l,a,o;if(t.$.fireEvent("dragging",{item:r.Item,items:r.Items,data:r,originalEvent:e}),r.Feedback.style.left=e.pageX+n[0]+"px",r.Feedback.style.top=e.pageY+n[1]+"px",t._isMobile){const r=Smart.Tree.hoveredItem;r&&(r.classList.remove("drop-target"),r.classList.remove("top"),r.classList.remove("bottom"),delete Smart.Tree.hoveredItem);const n=t.getRootNode().elementFromPoint(e.clientX,e.clientY);Smart.Tree.hoveredTree&&(clearInterval(Smart.Tree.hoveredTree._dragInterval),delete Smart.Tree.hoveredTree),n&&(l=n.closest("smart-tree"),l&&l.allowDrop&&(Smart.Tree.hoveredTree=l,a=n.closest("smart-tree-item")||n.closest("smart-tree-items-group"),a?o=a:a=n))}if(l=Smart.Tree.hoveredTree,!l)return;const s=l.filterable?l.$.filterInput.offsetHeight+10:0;if(clearInterval(l._dragInterval),l._dragInterval=setInterval((function(){const r=l.getBoundingClientRect();l.$.scrollViewer.scrollHeight>0&&r.left<=e.clientX&&r.left+r.width>=e.clientX?e.clientY>=r.top+s&&e.clientY<=r.top+20+s?(l.$.scrollViewer.scrollTop-=t._autoScrollCoefficient,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility()):e.clientY>=r.top+r.height-20&&e.clientY<=r.top+r.height?(l.$.scrollViewer.scrollTop+=t._autoScrollCoefficient,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility()):clearInterval(l._dragInterval):clearInterval(l._dragInterval)}),1),t._isMobile||(a=e.originalEvent.target,a&&a.enableShadowDOM&&(a=e.originalEvent.composedPath()[0]),a&&a.closest&&(o=a.closest("smart-tree-item")||a.closest("smart-tree-items-group"))),o){if(Smart.Tree.hoveredItem&&o!==Smart.Tree.hoveredItem&&(Smart.Tree.hoveredItem.classList.remove("drop-target"),Smart.Tree.hoveredItem.classList.remove("top"),Smart.Tree.hoveredItem.classList.remove("bottom")),Smart.Tree.hoveredItem=o,r.Item.contains(o))return;const t=o.getBoundingClientRect();o instanceof Smart.TreeItem?e.clientY-t.top<=t.height/2?(o.classList.remove("bottom"),o.classList.add("top")):(o.classList.remove("top"),o.classList.add("bottom")):e.clientY-t.top<=10?(o.classList.remove("bottom"),o.classList.add("top")):!o.expanded&&t.bottom-e.clientY<=10?(o.classList.remove("top"),o.classList.add("bottom")):(o.classList.remove("top"),o.classList.remove("bottom")),o.classList.add("drop-target")}else if(Smart.Tree.hoveredItem&&(Smart.Tree.hoveredItem.classList.remove("drop-target"),Smart.Tree.hoveredItem.classList.remove("top"),Smart.Tree.hoveredItem.classList.remove("bottom")),a===l.$.scrollViewer.$.scrollViewerContainer)if(l._menuItems[0]){let e=l.$.mainContainer.lastElementChild,t=l.$.mainContainer.childElementCount-1;for(;e.hidden&&(t--,e=l.$.mainContainer.children[t],e););if(e){if(r.Item===e)return;Smart.Tree.hoveredItem=e,Smart.Tree.hoveredItem.classList.add("bottom")}else Smart.Tree.hoveredItem=l.$.container;Smart.Tree.hoveredItem.classList.add("drop-target")}else Smart.Tree.hoveredItem=l.$.container,Smart.Tree.hoveredItem.classList.add("drop-target");else delete Smart.Tree.hoveredItem}_moveSubItems(e,t,r){const n=this;for(let l=0;l<e.length;l++){const a=e[l];a.menu=t,a.set("level",a.parentItem.level+1),a.firstElementChild.style.paddingLeft="",a.firstElementChild.style.paddingRight="",n._setIndentation(a.firstElementChild,a.level,r),a.hidden=!1,a.$.removeClass("smart-hidden"),a.$.removeClass("filtered-child"),a.$.removeClass("last-filtered-child"),a instanceof Smart.TreeItemsGroup&&(a.$.removeClass("hidden-children"),a.container.level=a.level+1,n._moveSubItems(a.itemContainer.children,t,r),t!==n&&a.expanded&&(t._menuItemsGroupsToExpand.push(a),n._updateState("expanded",a.id,!1)))}}_moveTreeItem(e,t,r,n){const l=this,a=e.level;if(0===r){if(t.previousElementSibling===e)return;t.parentElement.insertBefore(e,t),e.set("level",t.level),e.parentItem=t.parentItem}else if(2===r){if(t.nextElementSibling===e)return;t.parentElement.insertBefore(e,t.nextElementSibling||null),e.set("level",t.level),e.parentItem=t.parentItem}else if(t===n[0].$.container)n[0].$.mainContainer.appendChild(e),e.set("level",1),e.parentItem=void 0;else{if(t.itemContainer.lastElementChild===e)return;t.itemContainer.appendChild(e),e.set("level",t.level+1),e.parentItem=t}const o=n[0].rightToLeft?"paddingRight":"paddingLeft";if(e.menu=n[0],e.parentItem=e.parentElement.menuItemsGroup,e.firstElementChild.style.paddingLeft="",e.firstElementChild.style.paddingRight="",l._setIndentation(e.firstElementChild,e.level,o),e.hidden=!1,e.$.removeClass("smart-hidden"),e.$.removeClass("filtered-child"),e.$.removeClass("last-filtered-child"),e instanceof Smart.TreeItemsGroup&&(e.$.removeClass("hidden-children"),e.container.level=e.level+1,l._moveSubItems(e.itemContainer.children,n[0],o),e.expanded)){const t=l._openedContainers[a+1].indexOf(e.container);-1!==t&&l._openedContainers[a+1].splice(t,1),n[0]._menuItemsGroupsToExpand.push(e),2===n.length&&l._updateState("expanded",e.id,!1)}for(let e=0;e<n.length;e++){const t=n[e],r=t.context,l=t.selectedIndexes.slice(0);t.context=t,t._menuItems={},t._refreshItemPaths(t.$.mainContainer,!0,void 0,t.sorted&&!t.autoSort),t.selectedIndexes=[],t._applySelection(!0,l,!1),t._checkOverflow(),t.context=r}n[0]._expandItemsByDefault()}_overriddenMenuHandler(){}_pageDownHandler(e,t,r,n){const l=this,a=l.$.scrollViewer;function o(){for(let t=e.length-1;t>=0;t--){const r=e[t];if(l._canItemBeHovered(r)&&l._getOffsetTop(r)+r.firstElementChild.offsetHeight<=a.scrollTop+a.$.container.offsetHeight)return r}}if(!t)return;let s=o();s&&(t!==s?(t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):a.scrollTop+a.$.container.offsetHeight!==a.$.scrollViewerContentContainer.offsetHeight&&(l.$.scrollViewer.scrollTop+=a.$.container.offsetHeight,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility(),s=o(),t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)))}_pageUpHandler(e,t,r,n){const l=this,a=l.$.scrollViewer;function o(){for(let t=0;t<e.length;t++){const r=e[t];if(l._canItemBeHovered(r)&&l._getOffsetTop(r)>=a.scrollTop)return r}}if(!t)return;let s=o();s&&(t!==s?(t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):0!==a.scrollTop?(l.$.scrollViewer.scrollTop-=a.$.container.offsetHeight,"scrollButtons"===l.scrollMode&&l._updateScrollButtonVisibility(),s=o(),t.removeAttribute("focus"),l._hoverViaKeyboard(s,r,n)):l.filterable&&l.$.filterInput.focus())}_refreshItemPathsAndSelection(){const e=this,t=e.selectedIndexes.slice(0);e._menuItems={},e._refreshItemPaths(e.$.mainContainer,!0),e.selectedIndexes=[],e._applySelection(!0,t)}_refreshSorting(){const e=this;e._unsortItems(e.$.mainContainer),e._applyGrouping(e.$.mainContainer);const t=e._state.filter;t&&e._applyFilter(t),e._checkOverflow()}_scroll(e){const t=this;t.$.scrollViewer.scrollTop=t.$.scrollViewer.scrollTop+10*e,t._updateScrollButtonVisibility(),t.focus()}_scrollButtonFarClickHandler(){this.$.scrollButtonFar.disabled||this._scroll(1)}_scrollButtonNearClickHandler(){this.$.scrollButtonNear.disabled||this._scroll(-1)}_scrollViewerDownHandler(e){const t=this;if(e.target!==t.$.scrollViewer||t.disabled||t.displayLoadingIndicator||!t._isMobile&&1!==e.which)return;const r=e.originalEvent.target;if(r!==t.$.editInput)if(t._isMobile){const n=t.$.scrollViewer.scrollTop,l=t.getBoundingClientRect().top,a=setTimeout((function(){if(!t._dragDetails&&t.$.scrollViewer.scrollTop===n&&t.getBoundingClientRect().top===l){const n=t.context;t.context=t,t._continueSelection(r,e),t.context=n}}),250);t._downTimeoutInfo={target:r,event:e,scrollTop:n,top:l,timeout:a}}else t._continueSelection(r,e);else t._editInputDown=!0}_continueSelection(e,t){const r=this,n=e.closest("smart-tree-item")||e.closest("smart-tree-items-group");if(!(n&&n.parentElement&&r._canItemBeSelected(n,!0)))return;const l=e.closest(".smart-tree-items-group-arrow");let a;if(n instanceof Smart.TreeItem)a="_handleSelection";else{if(e===n.container||e===n.container.firstElementChild)return;a="_menuItemsGroupSelectionHandler"}if(clearTimeout(r._dblclickTimeout),n!==r._dblclickObject.target&&(r._dblclickObject.numberOfClicks=0),r._dblclickObject.target=n,r._dblclickObject.numberOfClicks++,r._dblclickTimeout=setTimeout((function(){r._dblclickObject.numberOfClicks=0}),300),2===r._dblclickObject.numberOfClicks){if(r.editable)return void r._startEditing(n);r._dblclickHandler(n,l,t),r._dblclickObject.numberOfClicks=0}n.selected&&(r._downItem=n),r[a](n,t),r._discardKeyboardHover(!0),r._hoverViaKeyboard(n,!1,void 0,!1),l||r._startDragging(n,t)}_scrollViewerTouchmoveHandler(e){this._dragDetails&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_scrollViewerWheelHandler(){const e=this;"scrollButtons"===e.scrollMode&&"hidden"!==e.overflow&&e._updateScrollButtonVisibility()}_selectItemRange(e,t){const r=this,n=Array.from(r.$.mainContainer.querySelectorAll("smart-tree-item, smart-tree-items-group")),l=n.indexOf(e),a=n.indexOf(t),o=[];for(let e=Math.min(l,a);e<=Math.max(l,a);e++){const t=n[e];r._canItemBeHovered(t)&&(o.push(t.path),t.set("selected",!0))}return o}_selectstartHandler(e){this._dragDetails&&e.preventDefault()}_setFocusable(){super._setFocusable();const e=this;e.disabled||e.unfocusable?e.$.filterInput.tabIndex=-1:e.$.filterInput.removeAttribute("tabindex")}_setIndentation(e,t,r){const n=this;let l=n._paddingSize;void 0===l&&(l=parseFloat(getComputedStyle(n).getPropertyValue("--smart-tree-indent")),isNaN(l)?l=20:l+=4,n._paddingSize=l),e.style[r]=t*l-l/2+"px"}_setThreeStateCheckbox(e,t,r){t===e.itemContainer.childElementCount&&t>0?(e.removeAttribute("indeterminate"),e.set("selected",!0),e.setAttribute("aria-selected",!0)):0===t&&0===r?(e.removeAttribute("indeterminate"),e.set("selected",!1),e.setAttribute("aria-selected",!1)):(e.setAttribute("indeterminate",""),e.set("selected",!1),e.setAttribute("aria-selected",!1))}_sortItems(e){const t=this;if(!t.sorted)return;let r;e instanceof Smart.TreeItemsGroup?r=e.container.firstElementChild:e===t.$.mainContainer&&(r=e);let n=Array.from(r.children);if(t.sort){const r=t.sort(n,e);Array.isArray(r)&&(n=r)}else"asc"===t.sortDirection?n.sort((function(e,t){return e.label.localeCompare(t.label)})):n.sort((function(e,t){return t.label.localeCompare(e.label)}));for(let e=n.length-1;e>=0;e--)r.insertBefore(n[e],r.firstElementChild)}_sortPathCollection(e){e.sort((function(e,t){const r=e.split("."),n=t.split("."),l=Math.max(r.length,n.length);for(let e=0;e<l;e++){const t=parseFloat(r[e]),l=parseFloat(n[e]);if(isNaN(t))return-1;if(isNaN(l))return 1;if(t<l)return-1;if(t>l)return 1}}))}_startDragging(e,t){const r=this,n=r.selectionMode;if(!r.allowDrag||r._editedItem||"none"===n)return;const l=[],a=[];let o;if(-1!==["one","zeroAndOne","zeroOrOne","checkBox","radioButton"].indexOf(n))o=!1,l.push(e),a.push(e);else{o=!0;for(let e=0;e<r.selectedIndexes.length;e++)l.push(r._menuItems[r.selectedIndexes[e]]),a.push(l[e]);for(let e=0;e<l.length;e++){const t=l[e];if(-1!==a.indexOf(t))for(let e=a.length-1;e>=0;e--){const r=a[e];if(r===t)break;t.contains(r)&&a.splice(e,1)}}}r._dragDetails={StartPosition:{left:t.pageX,top:t.pageY},Items:l,ValidItems:a,Item:e,FeedbackShown:!1,ValidateOnDrop:o,OriginalEvent:t,StartTime:new Date,Dragging:!0},Smart.Tree.treeItemDragged=!0,r.$.scrollViewer._scrollView.disableSwipeScroll=!0,r.allowDrop&&(Smart.Tree.hoveredTree=r,Smart.Tree.hoveredItem=e)}_startEditing(e){const t=this,r=t.$.editInput;let n,l;if(!t._canItemBeSelected(e,!0))return;const a=e.firstElementChild,o=a.firstElementChild;t.rightToLeft?(n=function(){return a.offsetWidth-o.offsetLeft-o.offsetWidth},l="paddingRight"):(n=function(){return o.offsetLeft+parseFloat(window.getComputedStyle(a).borderLeftWidth)},l="paddingLeft"),e instanceof Smart.TreeItemsGroup?(r.style[l]=n()+(t.showLines?parseFloat(window.getComputedStyle(o.firstElementChild).paddingLeft):0)-1+"px",r.style.height=a.offsetHeight+"px"):(r.style[l]=e.offsetWidth+parseInt(a.style[l],10)-a.offsetWidth+parseFloat(window.getComputedStyle(o.firstElementChild).paddingLeft)-2+"px",r.style.height=e.offsetHeight+"px"),r.style.top=t._getOffsetTop(e)+"px",t.$editInput.removeClass("smart-hidden"),r.value=e.label,t._editedItem=e,r.setAttribute("aria-label","Edit item "+e.label),setTimeout((function(){r.focus()}),0)}_styleChangedHandler(e){e.detail.styleProperties&&e.detail.styleProperties["font-size"]&&this._checkOverflow()}_updateScrollButtonVisibility(){const e=this,t=e.overflow;if("scrollbar"===e.scrollMode||"hidden"===t)return;let r=!0,n=!0;if(0===Math.round(e.$.scrollViewer.scrollTop)&&(r=!1),Math.round(e.$.scrollViewer.$.scrollViewerContainer.offsetHeight+e.$.scrollViewer.scrollTop)>=Math.round(e.$.scrollViewer.$.scrollViewerContentContainer.offsetHeight)&&(n=!1),"auto"===t){if(r&&n)return e.$scrollButtonNear.removeClass("smart-hidden"),e.$scrollButtonFar.removeClass("smart-hidden"),e.$scrollViewer.removeClass("one-button-shown"),void e.$.scrollViewer.refresh();r?e.$scrollButtonNear.removeClass("smart-hidden"):e.$scrollButtonNear.addClass("smart-hidden"),n?e.$scrollButtonFar.removeClass("smart-hidden"):e.$scrollButtonFar.addClass("smart-hidden"),e.$scrollViewer.addClass("one-button-shown"),e.$.scrollViewer.refresh()}else"scroll"!==t||e.disabled||(e.$.scrollButtonNear.disabled=!r,e.$.scrollButtonFar.disabled=!n)}_updateState(e,t,r){const n=this;switch(e){case"expanded":{const e=n._state.expanded.indexOf(t);if(r&&-1===e)n._state.expanded.push(t);else{if(r||-1===e)return;n._state.expanded.splice(e,1)}break}case"filter":n._state.filter=void 0!==t?t:n.$.filterInput.value;break;case"selected":n._state.selected=[];for(let e=0;e<n.selectedIndexes.length;e++){const t=n._menuItems[n.selectedIndexes[e]];n._state.selected.push(t.id)}break;case"sorted":n._state.sorted=t}n.autoSaveState&&window.localStorage.setItem("smartTree"+n.id,JSON.stringify(n._state))}_verticalScrollbarHandler(){const e=this,t=e.$.verticalScrollBar,r=t.value;e.disabled||(t.max!==r?t.min!==r?(delete e._topReached,delete e._bottomReached):e._topReached||(e.$.fireEvent("scrollTopReached"),delete e._bottomReached,e._topReached=!0):e._bottomReached||(e.$.fireEvent("scrollBottomReached"),delete e._topReached,e._bottomReached=!0))}});
1690
1690
 
1691
1691
  /***/ })
1692
1692
 
@@ -1877,7 +1877,7 @@ var __webpack_exports__ = {};
1877
1877
  /* harmony import */ var _smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(5306);
1878
1878
  /* harmony import */ var _smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61___default = /*#__PURE__*/__webpack_require__.n(_smart_grid_core_js__WEBPACK_IMPORTED_MODULE_61__);
1879
1879
 
1880
- /* Smart UI v14.0.2 (2022-04-18)
1880
+ /* Smart UI v14.0.34 (2022-05-09)
1881
1881
  Copyright (c) 2011-2022 jQWidgets.
1882
1882
  License: https://htmlelements.com/license/ */ //
1883
1883