smart-webcomponents-react 25.0.0 → 25.0.3

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 (253) hide show
  1. package/package.json +1 -1
  2. package/source/modules/smart.3dchart.js +2 -2
  3. package/source/modules/smart.accordion.js +2 -2
  4. package/source/modules/smart.array.js +2 -2
  5. package/source/modules/smart.barcode.js +2 -2
  6. package/source/modules/smart.breadcrumb.js +2 -2
  7. package/source/modules/smart.button.js +2 -2
  8. package/source/modules/smart.buttongroup.js +2 -2
  9. package/source/modules/smart.calendar.js +2 -2
  10. package/source/modules/smart.card.js +2 -2
  11. package/source/modules/smart.cardview.js +2 -2
  12. package/source/modules/smart.carousel.js +2 -2
  13. package/source/modules/smart.chart.js +2 -2
  14. package/source/modules/smart.checkbox.js +2 -2
  15. package/source/modules/smart.checkinput.js +2 -2
  16. package/source/modules/smart.chip.js +2 -2
  17. package/source/modules/smart.colorinput.js +2 -2
  18. package/source/modules/smart.colorpanel.js +2 -2
  19. package/source/modules/smart.colorpicker.js +2 -2
  20. package/source/modules/smart.combobox.js +2 -2
  21. package/source/modules/smart.common.js +2 -2
  22. package/source/modules/smart.countryinput.js +2 -2
  23. package/source/modules/smart.dateinput.js +2 -2
  24. package/source/modules/smart.daterangeinput.js +2 -2
  25. package/source/modules/smart.datetimepicker.js +2 -2
  26. package/source/modules/smart.dockinglayout.js +2 -2
  27. package/source/modules/smart.dropdownbutton.js +2 -2
  28. package/source/modules/smart.dropdownlist.js +2 -2
  29. package/source/modules/smart.editor.js +2 -2
  30. package/source/modules/smart.element.js +2 -2
  31. package/source/modules/smart.fileupload.js +2 -2
  32. package/source/modules/smart.form.js +2 -2
  33. package/source/modules/smart.formulaparser.js +2 -2
  34. package/source/modules/smart.ganttchart.js +3 -3
  35. package/source/modules/smart.gauge.js +2 -2
  36. package/source/modules/smart.grid.js +9 -9
  37. package/source/modules/smart.gridpanel.js +2 -2
  38. package/source/modules/smart.gridview.js +9 -9
  39. package/source/modules/smart.input.js +2 -2
  40. package/source/modules/smart.kanban.js +2 -2
  41. package/source/modules/smart.layout.js +2 -2
  42. package/source/modules/smart.led.js +2 -2
  43. package/source/modules/smart.listbox.js +2 -2
  44. package/source/modules/smart.listmenu.js +2 -2
  45. package/source/modules/smart.map.js +2 -2
  46. package/source/modules/smart.maskedtextbox.js +2 -2
  47. package/source/modules/smart.menu.js +2 -2
  48. package/source/modules/smart.multicomboinput.js +2 -2
  49. package/source/modules/smart.multiinput.js +2 -2
  50. package/source/modules/smart.multilinetextbox.js +2 -2
  51. package/source/modules/smart.multisplitbutton.js +2 -2
  52. package/source/modules/smart.numberinput.js +2 -2
  53. package/source/modules/smart.numerictextbox.js +2 -2
  54. package/source/modules/smart.pager.js +2 -2
  55. package/source/modules/smart.passwordinput.js +2 -2
  56. package/source/modules/smart.passwordtextbox.js +2 -2
  57. package/source/modules/smart.path.js +2 -2
  58. package/source/modules/smart.phoneinput.js +2 -2
  59. package/source/modules/smart.pivottable.js +2 -2
  60. package/source/modules/smart.progressbar.js +2 -2
  61. package/source/modules/smart.qrcode.js +2 -2
  62. package/source/modules/smart.querybuilder.js +2 -2
  63. package/source/modules/smart.radiobutton.js +2 -2
  64. package/source/modules/smart.rating.js +2 -2
  65. package/source/modules/smart.ribbon.js +2 -2
  66. package/source/modules/smart.router.js +2 -2
  67. package/source/modules/smart.scheduler.js +2 -2
  68. package/source/modules/smart.scrollbar.js +2 -2
  69. package/source/modules/smart.slider.js +2 -2
  70. package/source/modules/smart.sortable.js +2 -2
  71. package/source/modules/smart.splitter.js +2 -2
  72. package/source/modules/smart.switchbutton.js +2 -2
  73. package/source/modules/smart.table.js +2 -2
  74. package/source/modules/smart.tabs.js +2 -2
  75. package/source/modules/smart.tank.js +2 -2
  76. package/source/modules/smart.textarea.js +2 -2
  77. package/source/modules/smart.textbox.js +2 -2
  78. package/source/modules/smart.timeinput.js +2 -2
  79. package/source/modules/smart.timeline.js +2 -2
  80. package/source/modules/smart.timepicker.js +2 -2
  81. package/source/modules/smart.toast.js +2 -2
  82. package/source/modules/smart.tooltip.js +2 -2
  83. package/source/modules/smart.tree.js +2 -2
  84. package/source/modules/smart.validator.js +2 -2
  85. package/source/modules/smart.window.js +2 -2
  86. package/source/smart.3dchart.js +1 -1
  87. package/source/smart.accordion.js +1 -1
  88. package/source/smart.ajax.js +1 -1
  89. package/source/smart.array.js +1 -1
  90. package/source/smart.barcode.js +1 -1
  91. package/source/smart.bootstrap.js +1 -1
  92. package/source/smart.breadcrumb.js +1 -1
  93. package/source/smart.button.js +1 -1
  94. package/source/smart.buttongroup.js +1 -1
  95. package/source/smart.calendar.js +1 -1
  96. package/source/smart.card.js +1 -1
  97. package/source/smart.cardview.js +1 -1
  98. package/source/smart.carousel.js +1 -1
  99. package/source/smart.chart.annotations.js +1 -1
  100. package/source/smart.chart.api.js +1 -1
  101. package/source/smart.chart.core.js +1 -1
  102. package/source/smart.chart.js +1 -1
  103. package/source/smart.chart.rangeselector.js +1 -1
  104. package/source/smart.chart.waterfall.js +1 -1
  105. package/source/smart.checkbox.js +1 -1
  106. package/source/smart.checkinput.js +1 -1
  107. package/source/smart.chip.js +1 -1
  108. package/source/smart.colorinput.js +1 -1
  109. package/source/smart.colorpanel.js +1 -1
  110. package/source/smart.colorpicker.js +1 -1
  111. package/source/smart.combobox.js +1 -1
  112. package/source/smart.complex.js +1 -1
  113. package/source/smart.core.js +1 -1
  114. package/source/smart.countryinput.js +1 -1
  115. package/source/smart.data.js +1 -1
  116. package/source/smart.date.js +1 -1
  117. package/source/smart.dateformatpanel.js +1 -1
  118. package/source/smart.dateinput.js +1 -1
  119. package/source/smart.daterangeinput.js +1 -1
  120. package/source/smart.datetimepicker.js +1 -1
  121. package/source/smart.dockinglayout.js +1 -1
  122. package/source/smart.draw.js +1 -1
  123. package/source/smart.dropdownbutton.js +1 -1
  124. package/source/smart.dropdownlist.js +1 -1
  125. package/source/smart.editor.js +1 -1
  126. package/source/smart.element.js +1 -1
  127. package/source/smart.elements.js +9 -9
  128. package/source/smart.export.js +1 -1
  129. package/source/smart.fileupload.js +1 -1
  130. package/source/smart.filter.js +1 -1
  131. package/source/smart.filterbuilder.js +1 -1
  132. package/source/smart.filterpanel.js +1 -1
  133. package/source/smart.form.js +1 -1
  134. package/source/smart.format.js +1 -1
  135. package/source/smart.formulaparser.js +1 -1
  136. package/source/smart.ganttchart.js +2 -2
  137. package/source/smart.gauge.js +1 -1
  138. package/source/smart.grid.cell.js +2 -2
  139. package/source/smart.grid.chart.js +1 -1
  140. package/source/smart.grid.column.js +2 -2
  141. package/source/smart.grid.core.js +2 -2
  142. package/source/smart.grid.dialog.js +1 -1
  143. package/source/smart.grid.edit.js +1 -1
  144. package/source/smart.grid.export.js +1 -1
  145. package/source/smart.grid.filter.js +2 -2
  146. package/source/smart.grid.group.js +1 -1
  147. package/source/smart.grid.js +1 -1
  148. package/source/smart.grid.menu.js +2 -2
  149. package/source/smart.grid.pager.js +1 -1
  150. package/source/smart.grid.reorder.js +1 -1
  151. package/source/smart.grid.resize.js +1 -1
  152. package/source/smart.grid.row.js +1 -1
  153. package/source/smart.grid.select.js +2 -2
  154. package/source/smart.grid.sort.js +1 -1
  155. package/source/smart.grid.toolbar.js +2 -2
  156. package/source/smart.grid.tree.js +1 -1
  157. package/source/smart.grid.view.js +1 -1
  158. package/source/smart.gridpanel.js +1 -1
  159. package/source/smart.input.js +1 -1
  160. package/source/smart.kanban.js +1 -1
  161. package/source/smart.layout.js +1 -1
  162. package/source/smart.led.js +1 -1
  163. package/source/smart.listbox.js +1 -1
  164. package/source/smart.listmenu.js +1 -1
  165. package/source/smart.map.js +1 -1
  166. package/source/smart.maskedtextbox.js +1 -1
  167. package/source/smart.math.js +1 -1
  168. package/source/smart.menu.js +1 -1
  169. package/source/smart.multicomboinput.js +1 -1
  170. package/source/smart.multiinput.js +1 -1
  171. package/source/smart.multilinetextbox.js +1 -1
  172. package/source/smart.multisplitbutton.js +1 -1
  173. package/source/smart.numberformatpanel.js +1 -1
  174. package/source/smart.numberinput.js +1 -1
  175. package/source/smart.numeric.js +1 -1
  176. package/source/smart.numerictextbox.js +1 -1
  177. package/source/smart.pager.js +1 -1
  178. package/source/smart.passwordinput.js +1 -1
  179. package/source/smart.passwordtextbox.js +1 -1
  180. package/source/smart.path.js +1 -1
  181. package/source/smart.phoneinput.js +1 -1
  182. package/source/smart.pivottable.js +1 -1
  183. package/source/smart.powerbutton.js +1 -1
  184. package/source/smart.progressbar.js +1 -1
  185. package/source/smart.qrcode.js +1 -1
  186. package/source/smart.radiobutton.js +1 -1
  187. package/source/smart.rating.js +1 -1
  188. package/source/smart.ribbon.js +1 -1
  189. package/source/smart.router.js +1 -1
  190. package/source/smart.scheduler.js +1 -1
  191. package/source/smart.scrollbar.js +1 -1
  192. package/source/smart.slider.js +1 -1
  193. package/source/smart.sortable.js +1 -1
  194. package/source/smart.sparkline.js +1 -1
  195. package/source/smart.splitter.js +1 -1
  196. package/source/smart.switchbutton.js +1 -1
  197. package/source/smart.table.js +1 -1
  198. package/source/smart.tabs.js +1 -1
  199. package/source/smart.tank.js +1 -1
  200. package/source/smart.textarea.js +1 -1
  201. package/source/smart.textbox.js +1 -1
  202. package/source/smart.tickintervalhandler.js +1 -1
  203. package/source/smart.timeinput.js +1 -1
  204. package/source/smart.timeline.js +1 -1
  205. package/source/smart.timepicker.js +1 -1
  206. package/source/smart.toast.js +1 -1
  207. package/source/smart.tooltip.js +1 -1
  208. package/source/smart.tree.js +1 -1
  209. package/source/smart.validationpanel.js +1 -1
  210. package/source/smart.validator.js +1 -1
  211. package/source/smart.window.js +1 -1
  212. package/source/styles/bootstrap/dark/smart.bootstrap.blue.css +3373 -3373
  213. package/source/styles/bootstrap/dark/smart.bootstrap.css +3373 -3373
  214. package/source/styles/bootstrap/dark/smart.bootstrap.cyan.css +3373 -3373
  215. package/source/styles/bootstrap/dark/smart.bootstrap.green.css +3373 -3373
  216. package/source/styles/bootstrap/dark/smart.bootstrap.indigo.css +3373 -3373
  217. package/source/styles/bootstrap/dark/smart.bootstrap.orange.css +3373 -3373
  218. package/source/styles/bootstrap/dark/smart.bootstrap.pink.css +3373 -3373
  219. package/source/styles/bootstrap/dark/smart.bootstrap.purple.css +3373 -3373
  220. package/source/styles/bootstrap/dark/smart.bootstrap.red.css +3373 -3373
  221. package/source/styles/bootstrap/dark/smart.bootstrap.teal.css +3373 -3373
  222. package/source/styles/bootstrap/dark/smart.bootstrap.turquoise.css +3373 -3373
  223. package/source/styles/bootstrap/light/smart.bootstrap.blue.css +3373 -3373
  224. package/source/styles/bootstrap/light/smart.bootstrap.css +3373 -3373
  225. package/source/styles/bootstrap/light/smart.bootstrap.cyan.css +3373 -3373
  226. package/source/styles/bootstrap/light/smart.bootstrap.green.css +3373 -3373
  227. package/source/styles/bootstrap/light/smart.bootstrap.indigo.css +3373 -3373
  228. package/source/styles/bootstrap/light/smart.bootstrap.orange.css +3373 -3373
  229. package/source/styles/bootstrap/light/smart.bootstrap.pink.css +3373 -3373
  230. package/source/styles/bootstrap/light/smart.bootstrap.purple.css +3373 -3373
  231. package/source/styles/bootstrap/light/smart.bootstrap.red.css +3373 -3373
  232. package/source/styles/bootstrap/light/smart.bootstrap.teal.css +3373 -3373
  233. package/source/styles/bootstrap/light/smart.bootstrap.turquoise.css +3373 -3373
  234. package/source/styles/bootstrap/smart.bootstrap.blue.css +234 -215
  235. package/source/styles/bootstrap/smart.bootstrap.css +277 -286
  236. package/source/styles/bootstrap/smart.bootstrap.cyan.css +234 -215
  237. package/source/styles/bootstrap/smart.bootstrap.green.css +234 -215
  238. package/source/styles/bootstrap/smart.bootstrap.indigo.css +234 -215
  239. package/source/styles/bootstrap/smart.bootstrap.orange.css +234 -215
  240. package/source/styles/bootstrap/smart.bootstrap.pink.css +237 -215
  241. package/source/styles/bootstrap/smart.bootstrap.purple.css +237 -215
  242. package/source/styles/bootstrap/smart.bootstrap.red.css +234 -215
  243. package/source/styles/bootstrap/smart.bootstrap.teal.css +234 -215
  244. package/source/styles/bootstrap/smart.bootstrap.turquoise.css +234 -215
  245. package/source/styles/components/smart.datetimeformatpanel.css +1 -1
  246. package/source/styles/components/smart.dropdownbutton.css +1 -1
  247. package/source/styles/components/smart.grid.css +1 -1
  248. package/source/styles/components/smart.ribbon.css +1 -1
  249. package/source/styles/default/scss/smart.dropdownbutton.scss +21 -20
  250. package/source/styles/default/scss/smart.grid.scss +195 -116
  251. package/source/styles/default/smart.dropdownbutton.css +5 -3
  252. package/source/styles/default/smart.grid.css +41 -18
  253. package/source/styles/smart.default.css +2 -2
@@ -1,6 +1,6 @@
1
1
 
2
- /* Smart UI v25.0.0 (2025-11-26)
2
+ /* Smart UI v25.0.1 (2025-11-26)
3
3
  Copyright (c) 2011-2024 jQWidgets.
4
4
  License: https://htmlelements.com/license/ */ //
5
5
 
6
- 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;if(t._selectionColumn._selecting=!0,t.beginUpdate(),t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let e=t.paging.pageIndex*t.paging.pageSize,l=(t.paging.pageIndex+1)*t.paging.pageSize;for(let n=e;n<l;n++)delete t._selection.indexes[n]}else t._selection.indexes=[];if(t.paging.enabled&&"all"===t.selection.checkBoxes.selectAllMode){let e=t.getVisibleRows();for(let t=0;t<e.length;t++)e[t].selected=l}else 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++){if(t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let l=t.paging.pageIndex*t.paging.pageSize,n=(t.paging.pageIndex+1)*t.paging.pageSize;if(e<l||e>=n)continue}l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e)}else{let e=!0;t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode&&(e=!1),e&&(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;t.paging.enabled&&"all"===t.selection.checkBoxes.selectAllMode&&(n=t.getVisibleRows());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++){if(t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let l=t.paging.pageIndex*t.paging.pageSize,n=(t.paging.pageIndex+1)*t.paging.pageSize;if(e<l||e>=n)continue}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;t&&("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(delete n._areAllRowsSelected,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];if(t&&(t.allowSelect||null===t.allowSelect&&!l))if(n.selection.checkBoxes.enabled&&l&&l.originalEvent&&l.originalEvent.target&&l.originalEvent.target.parentNode&&l.originalEvent.target.parentNode.hasAttribute("checkbox")&&(l.ctrlKey=!0),n.selection.allowRowHeaderSelection&&"extended"===n.selection.mode)if(!Object.keys(n._selection.cells).length>0&&n.appearance.showRowHeaderSelectIcon,t.selected){const e=n._selection.focusedCell?JSON.parse(JSON.stringify(n._selection.focusedCell)):null;o(),n._selection.focusedCell=e}else o(),n._selectRow(e,l);else o(),n._selectRow(e,l)};if(n.selection.allowCellSelection&&null!=e&&i&&!i.autoGenerated){const i=n.rowById[e];if(!i)return n.endUpdate(!1),void n._recycle();let a=i.getCell(t);const s=n._getParentCell(i,t);s&&(a=s.row.getCell(s.column.dataField)),a&&a.column.allowSelect&&(o(),!l||l.ctrlKey||l.metaKey||(n._selection.rows=[],n._selection.indexes=[],n._selection.columns=[],"many"!==n.selection.mode&&(n._selection.cells=[])),"extended"===n.selection.mode?l&&(l.ctrlKey||l.metaKey)?a.selected=!a.selected:a.selected=!0:"one"===n.selection.mode?a.selected=!0:a.selected=!a.selected,(l&&!l.shiftKey||!n._selection.focusedCell)&&(n._selection.focusedCell={id:a.row.id,value:a.value,index:a.row.index,dataField:a.column.dataField}),l&&(l.shiftKey||n._selection.focusedCell.id===a.row.id&&n._selection.focusedCell.dataField===a.column.dataField&&"extended"===n.selection.mode)&&(s?n._renderCellSelectionRect(a.row,a.column,s.endRow,s.endColumn):n._renderCellSelectionRect(a.row,a.column,a.row,a.column)))}else n.selection.allowRowHeaderSelection&&null!=e&&void 0===n.columnByDataField[t]||n.selection.checkBoxes.enabled&&null!=e&&"_checkBoxColumn"===t&&void 0===n.columnByDataField[t]?a():null==e||null!=t&&void 0===n.columnByDataField[t]||!n.selection.allowRowSelection?n.selection.allowColumnHeaderSelection&&i&&(o(),n._selectColumn(t,l||new KeyboardEvent("keydown"))):a();n.endUpdate(!1,!1),n._recycle(!0,!0,!1),null==e||i||n._renderInputOverlay(e,l),n.__selectionStarted=new Date}_deleteCopyRects(){const e=this;e._copyRects&&e._copyRects.forEach((e=>{e.remove()})),delete e._copiedRows,e._copyRects=[]}_createCopyRects(){const e=this,t=e._getSelectedRows();let l=[],n=null;e._deleteCopyRects();for(let o=0;o<t.length;o++){const i=t[o];i&&(n?(n&&n.visibleIndex===i.visibleIndex-1||n&&n.visibleIndex===i.visibleIndex+1||(l.length&&e._createCopyRect(l[0],l[l.length-1]),l=[]),l.push(i.id)):l.push(i.id),n=i)}l.length&&e._createCopyRect(l[0],l[l.length-1])}_createCopyRect(e,t,l,n){const o=this,i=document.createElement("div"),a=document.createElement("div"),s=document.createElement("div");s.classList.add("smart-selection-overlay","marching-ants"),s.appendChild(a),a.appendChild(i),i.classList.add("smart-selection-overlay-content"),a.classList.add("smart-selection-overlay-border-content");const r=o.rowById[e],d=o.rowById[t];if(o._deleteCopyRects(),!r||!d)return;const c=r.top,u=d.top-r.top+d.height;let f=o.columns[0].left,p=o.columns[o.columns.length-1].left+o.columns[o.columns.length-1].computedWidth-f;if(l){let e=o.columnByDataField[l],t=o.columnByDataField[n];e.left>t.left&&(e=o.columnByDataField[n],t=o.columnByDataField[l]),e&&(f=e.left,p=t.left+t.computedWidth-f)}const m=s;return m.style.top=c-o.scrollTop-1+"px",m.style.left=Math.max(0,f-o.scrollLeft)+"px",0===r.visibleIndex&&0===c&&0===o.scrollTop&&(m.style.top="0px"),m.style.height=u+1+"px",m.style.width=p+1+"px",p>300&&m.style.setProperty("--alt-duration",12*Math.ceil(p/180)+"s"),u>60&&m.style.setProperty("--duration",12*Math.ceil(u/180)+"s"),o.$.scrollView.appendChild(s),o._copyRects||(o._copyRects=[]),s.onpointerdown=e=>{o._deleteCopyRects(),o._rowDownHandler(e)},m.row=r,m.lastRow=d,m.dataField=l,m.lastDataField=n,o._copyRects.push(m),s}_refreshCopyRects(){const e=this;e._copyRects&&e._copyRects.forEach((t=>{const l=t.row,n=t.lastRow,o=l.top,i=n.top-l.top+n.height;let a=e.columns[0].left,s=e.columns[e.columns.length-1].left+e.columns[e.columns.length-1].computedWidth-a,r=t.dataField,d=t.lastDataField,c=a-e.scrollLeft;const u=e.columns[e.columns.length-1];if(c<e._frozenColumnsNearWidth&&(c=e._frozenColumnsNearWidth,s=u.left+u.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth),s=u.left+u.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth,r){let t=e.columnByDataField[r],l=e.columnByDataField[d];t.left>l.left&&(t=e.columnByDataField[d],l=e.columnByDataField[r]),t&&(a=t.left,s=l.left+l.computedWidth-a,c=a-e.scrollLeft,c<e._frozenColumnsNearWidth&&(c=e._frozenColumnsNearWidth,s=l.left+l.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth))}const f=t;f.style.top=o-e.scrollTop-1+"px",f.style.left=c+"px",0===l.visibleIndex&&0===o&&0===e.scrollTop&&(f.style.top="0px"),f.style.height=i+1+"px",f.style.width=s+1+"px",s<5?f.classList.add("smart-visibility-hidden"):f.classList.remove("smart-visibility-hidden")}))}_renderCellSelectionRect(e,t,l,n,o){const i=this;let a=i._recyclingRows;const s=a.indexOf(e),r=a.indexOf(l);if(!(i.grouping.enabled&&"advanced"===i.grouping.renderMode&&i.dataSource&&i.dataSource.groupBy.length>0)&&(i._mobile&&i._mobileSelect,s>=0&&r>=0)){if(!i._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&&n.classList.add(o),i.selection.allowCellDragSelectionHandle&&e&&l.classList.add("handle"),i.$.scrollView.appendChild(n),n},t=i._selection.selectionRect=e(!0);if(i.selection.allowCellDragSelectionHandle){let e=null,l=null,n=null;t.onMove=function(t){const o=i._selection.selectionRect;let s=t.clientX,r=t.clientY;t.touches&&(s=t.touches[0].clientX,r=t.touches[0].clientY);const d=function(e){const t=(i.enableShadowDOM?i.shadowRoot:i.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:i.columnByDataField[l],row:n}};if(o&&o.capturedDrag){let e=d({clientX:s,clientY:r}),l=d({clientX:s,clientY:r+o.top}).row,n=d({clientX:s+o.left,clientY:r}).column;if(l||(l=a[a.length-1]),n||(n=e.column),l&&n&&e.row&&e.column){o.row=e.row,o.rowId=o.row.id,o.column=e.column,o.endDragRow=o.endRow=l,o.endDragColumn=o.endColumn=n,o.endDragRowId=o.endDragRow.id,i._dragSelectionStartDataField=o.column.dataField,i._dragSelectionStartRow=o.row;const t=o.row.getCell(o.column.dataField);i._selection.focusedCell={index:t.row.index,id:t.row.id,dataField:t.column.dataField,value:t.value}}i._resizeSelectionRect(),t.preventDefault()}else if(o&&o.captured)if(i._dragSelectionStartDataField=i._selection.focusedCell.dataField,i._dragSelectionStartRow=i.rowById[i._selection.focusedCell.id],null===l&&null===n&&(Math.abs(s-e.left)>=30?l=!0:Math.abs(r-e.top)>=20&&(n=!0)),o.lastPoint&&Math.abs(o.lastPoint.top-r)>=30?(l=null,n=!0):o.lastPoint&&Math.abs(o.lastPoint.left-s)>=30&&(n=null,l=!0),l){const t=o.endDragColumn.dataField,l=d({clientX:s,clientY:e.top-5});l.row&&l.column&&(o.endDragRow=o.endRow,o.endDragColumn=l.column,o.endDragColumn.dataField!==t&&(o.lastPoint={left:s,top:r}),i._resizeSelectionRect())}else if(n){const t=o.endDragRow,l=d({clientX:e.left-5,clientY:r});l.row&&l.column&&(o.endDragRow=l.row,o.endDragColumn=o.endColumn,o.endDragRow.id&&o.endDragRow.id!==t.id&&(o.lastPoint={left:s,top:r}),i._resizeSelectionRect())}o&&o.captured&&i.selection.allowDragSelectionAutoScroll&&(i._autoScrollSelectionDragInterval&&clearInterval(i._autoScrollSelectionDragInterval),i.selection.isDragging=!0,i._autoScrollSelectionDragInterval=setInterval((function(){const e=i.$.scrollView.getBoundingClientRect();s<=e.left+20?(i.scrollLeft-=15,i._resizeSelectionRect()):s>=e.left+e.width-20&&(i.scrollLeft+=15,i._resizeSelectionRect()),r<=e.top+20?(i.scrollTop-=15,i._resizeSelectionRect()):r>=e.top+e.height-20&&(i.scrollTop+=15,i._resizeSelectionRect())}),25))},t.onUp=function(){if(!t.captured)return;i._autoScrollSelectionDragInterval&&clearInterval(i._autoScrollSelectionDragInterval),i.editing.editCell||i.editing.editRow||i.focus(),t.capturedDrag=!1,t.captured=!1,l=null,n=null,e=null,t.lastPoint=null;const o=t.cellValues;t.minRow&&t.maxRow&&t.maxRow&&t.maxColumn&&(i._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=o,i._resizeSelectionRect(),i.selection.allowCellDragSelectionAutoFill&&i._pasteSelectedCells({row:t.row,endRow:t.endDragRow,column:t.column,endColumn:t.endColumn},o)),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 o={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(o.down="touchstart",o.move="touchmove",o.up="touchend"),t["on"+o.down]=function(e){const l=t.getBoundingClientRect();let n=e.clientX,o=e.clientY;e.touches&&(n=e.touches[0].clientX,o=e.touches[0].clientY),n>=l.right-5&&o>=l.bottom-5?(t.captured=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn):i.selection.allowCellDragDropSelectionHandle&&o>=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||i._rowDownHandler(e)},document.addEventListener(o.move,t.onMove,{passive:!1}),document.addEventListener(o.up,t.onUp,{passive:!1}),document.addEventListener(o.down,t.onDown,{passive:!1})}}const e=i._selection.selectionRect;e.row=i.rowById[i._selection.focusedCell.id],e.rowId=i._selection.focusedCell.id,e.column=i.columnByDataField[i._selection.focusedCell.dataField],e.endRow=l,e.endRowId=l.id,e.endDragRow=l,e.endColumn=n,e.endDragColumn=n,i._refreshCellSelectionRect()}}_resizeSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t)return;let l=e._recyclingRows,n=t.row,o=t.endDragRow,i=t.column,a=t.endDragColumn;const s=e.viewColumns,r=l.indexOf(n),d=l.indexOf(o),c=l.indexOf(t.endRow),u=s.indexOf(i),f=s.indexOf(a),p=s.indexOf(t.endColumn),m=Math.min(c,Math.min(r,d)),g=Math.max(c,Math.max(r,d)),_=Math.min(p,Math.min(u,f)),h=Math.max(p,Math.max(u,f));c<=Math.min(r,d)?t.minRow=t.endRow:t.minRow=r<=d?n:o,c>=Math.max(r,d)?t.maxRow=t.endRow:t.maxRow=r>=d?n:o,p<=Math.min(u,f)?t.minColumn=t.endColumn:t.minColumn=u<=f?i:a,p>=Math.max(u,f)?t.maxColumn=t.endColumn:t.maxColumn=u>=f?i:a;let w=0,y=0,v=0,S=0;for(let e=m;e<=g;e++){const t=l[e];if(t){e===m&&(w=t.top),e===g&&(y=t.top+t.height-w);for(let e=_;e<=h;e++){const l=s[e].dataField,n=t.getCell(l);e===_&&(v=n.column.left),e===h&&(S=n.column.left+n.column.computedWidth-v)}}}t.style.top=w-e.scrollTop-1+"px",0===m&&0===w&&0===e.scrollTop&&(t.style.top="0px"),e._isVirtualMode()&&(t.style.top=w+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft?t.style.right=v-e.scrollLeft+"px":t.style.left=v-e.scrollLeft+"px",t.style.height=y+1+"px",t.style.width=S+1+"px"}_getPatternValue(e,t,l){let n=[],o=0,i=[],a=[],s=[],r=[];const d={names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},c={names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},u=function(e){if(void 0!==e&&!(e.toString().indexOf("GMT+")>=0||e.toString().indexOf("GMT-")>=0)){if(!isNaN(parseFloat(e)))return/[A-Za-z]/.test(e.toString())?void 0:parseFloat(e);if(d.names.indexOf(e)>=0)return r=d.names,d.names.indexOf(e);if(d.namesAbbr.indexOf(e)>=0)return r=d.namesAbbr,d.namesAbbr.indexOf(e);if(d.namesShort.indexOf(e)>=0)return r=d.namesShort,d.namesShort.indexOf(e);if(c.names.indexOf(e)>=0)return r=c.names,c.names.indexOf(e);if(c.namesAbbr.indexOf(e)>=0)return r=c.namesAbbr,c.namesAbbr.indexOf(e);if(void 0!==e&&(null===e&&(e=""),/\d+/.test(e.toString()))){s.push(e.toString().replace(/[0-9]/,"#")),s[s.length-1]=s[s.length-1].replace(/[0-9]/g,"");const t=parseFloat(e.toString().replace(/\D/g,""));return isNaN(t)?0:t}}};let f=0;for(let e in l){let t=l[e];n[o]=[],f=0;for(let e in t){let l=u(t[e]);void 0!==l&&(n[o].push(l),f++)}if(0===n[o].length)continue;let a=n[o][0],d=0;for(let e=0;e<n[o].length;e++){let t=u(n[o][e-1]),l=u(n[o][e]);0===e&&(t=l),a+=l,d+=l-t}a/=n[o].length,a-=n[o][0],a+=n[o][n[o].length-1],0!==d&&(d/=n[o].length-1),(r.length>0||s.length>0)&&(d=1,a=n[o][0]),n[o].length<=2&&(a=n[o][n[o].length-1]+d),i.push({step:d,stepStart:a}),o++}for(let e=0;e<f;e++){let t=n[0][e],l=0;for(let o=1;o<n.length;o++){const i=u(n[o-1][e]),a=u(n[o][e]);t+=a,l+=a-i}t/=n.length,t-=n[0][e],t+=n[n.length-1][e],0!==l&&(l/=n.length-1),(r.length>0||s.length>0)&&(l=1,t=n[0][e]),n.length<=2&&(t=n[n.length-1][e]+l),a.push({step:l,stepStart:t})}if(!n[e]){let l=n.length;for(let o=l;o<=e;o++){n[o]=[];for(let e=0;e<=t;e++)a[e]||(a[e]=a[e-1]),a[e]&&(o===l?n[o][e]=a[e].stepStart:(n[o][e]=n[o-1][e]+a[e].step,r.length>1&&n[o][e]>=r.length&&(n[o][e]=0)))}return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}if(!n[e][t]){let l=f;for(let o=l;o<=t;o++)i[e]&&(o===l?n[e].push(i[e].stepStart):(n[e][o]=n[e][o-1]+i[e].step,r.length>1&&n[e][o]>=r.length&&(n[e][o]=0)));return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}return n[e]&&n[e][t]?s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]:0}_pasteDataType(e){const t=this.dataSource&&"number"==typeof this.dataSource.dataSource,l=e.cell,n=e.value;let o=l.column.dataType;return o&&!t||(o=isNaN(parseFloat(n))?"string":n instanceof Date?"date":"true"===n||"false"===n?"boolean":"number"),o}_getCellEditorDataSource(e){const t=this;if(e.column.editor){if(e.column.editor.dataSource)return e.column._dataSource=e.column.editor.dataSource,e.column.editor.dataSource;switch(e.column.editor.template){case"list":case"dropDownList":case"comboBox":case"autoComplete":case"multiInput":case"checkInput":case"multiComboInput":case"tags":if(!e.editor.dataSource){const l=t.getVisibleRows(),n=[],o=[];for(let i=0;i<l.length;i++){let a=t.dataSource[l[i].index];if(a){if(e.column.displayField!==e.column.dataField){const t=a[e.column.displayField],l=a[e.column.dataField];-1===o.indexOf(t)&&(n.push({label:t,value:l}),o.push(t));continue}if(a=a[e.column.dataField],!a)continue;-1===n.indexOf(a)&&n.push(a)}}return e.column._dataSource=n,n}if(e.column.editor.collaborator){let l=[];for(let e=0;e<t.users.length;e++)l.push({color:t.users[e].color,label:t.users[e].name,id:t.users[e].id,value:t.users[e].id,name:t.users[e].name,image:t.users[e].image});return e.column._dataSource=l,l}}}return null}_pasteModeCopy(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell;let i=e.value;if(i&&"string"==typeof i&&(i=i.replace(/["]/g,"")),o.column.editor&&(o.column.editor.dataSource||t._getCellEditorDataSource(o))&&i){const e=e=>{let l;const n=t._getCellEditorDataSource(o);for(let t=0;t<n.length;t++){const i=n[t];if("string"!=typeof i&&(i.label===e||i.name===e))return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"!=typeof i&&i.label&&i.label.toLowerCase()===e)return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"!=typeof i&&i.value===e)return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"==typeof i&&i===e)return e;if("object"==typeof i&&i.label===e)return i;if("object"==typeof i&&o.column.editor.relationField&&""+e==""+t)return e}return-1};let l=-1;if(i&&-1!==i.indexOf(",")?(l=[],i.split(",").forEach((t=>{const n=e(t.trim());-1!==n&&l.push(n)})),l=l.join(",")):l=e(i),-1!==l&&(i=l),-1===l)return}if(o.column.editor)switch(o.column.editor.template){case"custom":return}let a=i;const s=e.dataField;if(a&&"string"==typeof a&&a.indexOf("[{")>=0&&"image"!==o.column.template&&"attachment"!==o.column.template)return;if(a&&"string"==typeof a&&a.indexOf("<")>=0&&(""===o.column.template&&"string"===n?a=t.clearPaste(a,"text/html","plainText"):"richText"===o.column.template&&"string"===n&&a&&a.indexOf("data-block")>=0||(a=t.clearPaste(a))),a&&"string"==typeof a&&"richText"===o.column.template&&/^(https?:\/\/)?([\w.-]+\.[a-z]{2,})(\/[^\s]*)?$/i.test(a.trim())){const e=document.createElement("a");e.innerHTML=a,e.href=a,e.target="_blank",e.title="Ctrl + Click to open link",a=e.outerHTML}let r=a,d=!1;if("string"===n){if(r=a,r){if((""+r).indexOf("&#")>=0&&(r=t._fromHTMLEntities(r)),(""+r).indexOf("GMT")>=0&&-1===a.indexOf("[{")){const e=new Smart.Utilities.DateTime(r).toString("d");e&&e.length&&(r=e)}"image"!==o.column.editor.template&&"attachment"!==o.column.editor.template&&"textarea"!==o.column.editor.template&&"richText"!==o.column.editor.template&&(r=t._unescapeString(r),o.column.editor.collaborator||(r=r.replaceAll("\\"," ").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/'/g,"&quot;").replace(/[\r\n]+/g," ").replace(/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/gi,(e=>"&#"+e.codePointAt(0)+";"))))}d=!0}else if("bool"===n||"boolean"===n)1!==a&&"1"!==a&&!0!==a&&"true"!==a&&"TRUE"!==a&&"True"!==a||(r=!0,d=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):(r=a,"string"==typeof a&&(r=o&&o.column.cellsFormat&&"string"==typeof a?Smart.Utilities.DateTime.ParseDate(a,o.column.cellsFormat):new Date(a)),o&&"duration"===o.column.template&&(r=[r,r]),d=!0)}else if("number"===n||"float"===n||"int"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):null!==a?"int"===n||"integer"===n?(r=parseInt(a),d=!0):(r=parseFloat(a),isNaN(r)&&(r=null),d=!0):(r=null,d=!0)}if(!1!==o.column.allowEdit&&!1!==t.editing.enabled||(d=!1),d)if(t.dataSource&&t.dataSource.virtualDataSource){const e={};e[o.column.dataField]=r,t.editing.batch?t._batchUpdateCell(o.row,o.column,r,o.value):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){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let n=0;n<e.length;n++){const i=e[n];l(i,o[n]),t.formulas&&"string"==typeof o[n]&&o[n].startsWith("=")&&/=.+/.test(o[n])?i.formula=t._fromHTMLEntities(o[n]):i.value=o[n],t.flashCell(i.row.id,i.column.dataField)}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([o],[e],[r],(function(e){if(e){const e=t.onRowHistory;t.onRowHistory=null,l(o,r),t.formulas&&"string"==typeof r&&r.startsWith("=")&&/=.+/.test(r)&&-1===r.indexOf("[{")?o.formula=t._fromHTMLEntities(r):o.value=r,t.flashCell(o.row.id,o.column.dataField),t.onRowHistory=e}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const e=Object.assign({},o.row.data),l=Object.assign({},o.row.data);l[o.column.dataField]=r,o.row.updatedDate=new Date,o.row.updatedBy=t.currentUser,t.onRowUpdate([o.row.index],[o.row],[e],[l],(function(e){e&&(o.value=r)}),t)}else t.formulas&&"string"==typeof r&&r.startsWith("=")&&/=.+/.test(r)&&-1===r.indexOf("[{")?o.formula=t._fromHTMLEntities(r):t.editing.batch?t._batchUpdateCell(o.row,o.column,r,o.value):o.value=r,t.flashCell(o.row.id,o.column.dataField)}}_pasteModeFill(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell,i=e.selectedValues,a=e.minRowIndex,s=e.minColumnIndex,r=e.currentRowIndex,d=e.currentColumnIndex,c=e.dataField;let u=e.value;if("string"===n)/\d+/.test(u.toString())?(u=t._getPatternValue(r-a,d-s,i),void 0===u&&i[r-a]&&i[r-a][d-s]&&(u=i[r-a][d-s])):(u=t._getPatternValue(r-a,d-s,i),void 0===u&&(u=i[r-a]?i[r-a][d-s]:e.value),void 0===u&&(u=e.value)),void 0!==u&&(o.value=u);else if("bool"===n||"boolean"===n)1!==u&&"1"!==u&&!0!==u&&"true"!==u&&"TRUE"!==u&&"True"!==u||(o.value=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n&&(o.value=null),i[r-a]&&(u=i[r-a][d-s],void 0!==u&&(o.value=u))}else if("number"===n||"float"===n||"int"===n){u=t._getPatternValue(r-a,d-s,i);const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n?o.value=null:o.value=null!==u?"int"===n||"integer"===n?parseInt(u):parseFloat(u):null}}_pasteSelectedCells(e,t){const l=this;l.beginUpdate();let n=l._recyclingRows,o=e.row,i=e.endRow,a=e.column,s=e.endColumn;l._deleteCopyRects();const r=n.indexOf(o),d=n.indexOf(i),c=n.indexOf(e.endRow),u=l.viewColumns,f=u.indexOf(a),p=u.indexOf(s),m=u.indexOf(e.endColumn),g=Math.min(c,Math.min(r,d));let _=Math.max(c,Math.max(r,d)),h=!1,w=Object.keys(t).length;_-g<w&&(_=g+w-1,h=!0);const y=Math.min(m,Math.min(f,p));let v=Math.max(m,Math.max(f,p));if(t[0]){const e=Object.keys(t[0]).length;v-y<e-1&&(v=v+e-1,h=!0)}let S=0,R=0,C=0,x=0;for(let e in t)0===S&&(R+=Object.keys(t[e]).length),S++;let b=!1;l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(b=!0);for(let e=g;e<=_;e++){const o=n[e];if(o){C=0;for(let n=y;n<=v;n++){if(!u[n])continue;const i=u[n].dataField,a=o.getCell(i);let s=0;b&&(s=x);for(let r in t){if(s===x){let d=0,c=t[r];b&&(c=t[s]);for(let s in c){if(C===d){let r=c[s],d=!0;if(t[o.id]&&t[o.id][i]&&(d=!1),d&&"none"!==l.clipboard.autoFillMode){if(!a)continue;const o={value:r,targetValue:a.value,dataField:s,index:a.row.visibleIndex,targetDataField:i,targetRowIndex:e};if(l.clipboard.onPasteValue){l.clipboard.onPasteValue(o);const e=a.value;a.value=o.value,l._setCellUndoRedo(a,e,o.value)}else if(o.cell=a,o.selectedValues=t,o.minRowIndex=g,o.maxRowIndex=_,o.minColumnIndex=y,o.maxColumnIndex=v,o.currentColumnIndex=n,o.currentRowIndex=e,"copy"===l.clipboard.autoFillMode)if(o.value&&(""+o.value).indexOf("<")>=0){const e=document.createElement("textarea");e.value=o.value,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),o.value=e.value,e.remove(),l.focus(),l._pasteModeCopy(o)}),25)}else l._pasteModeCopy(o);else"fillSeries"===l.clipboard.autoFillMode&&l._pasteModeFill(o)}}d++}}s++}C++,C>=R&&(C=0)}x++,x>=S&&(x=0)}}l.endUpdate(!1),h&&l.viewColumns[v]&&l.viewColumns[y]&&n[_]&&n[g]&&l._selectCellsRange(n[g],n[_],l.viewColumns[y].dataField,l.viewColumns[v].dataField),setTimeout((()=>{l._conditionalColors&&l._conditionalColors.update&&(l._conditionalColors.update(),l._recycle(!1))}),100),l._recycle(!1),l._refreshDataFilters()}_refreshCellSelectionRect(){const e=this,t=e._selection.selectionRect;if(e._copyRects&&e._copyRects.length&&e._refreshCopyRects(),!t||t&&t.captured)return;let l=e._recyclingRows,n=t.row,o=t.endRow,i=t.column,a=t.endColumn;const s=e.viewColumns;if(!a||!i)return;if(e._isVirtualMode()){if(n.id!==t.rowId&&!e.rowById[t.rowId])return t.style.height="0px",void(t.style.width="0px");if(n=e.rowById[t.rowId],o=e.rowById[t.endRowId],!o)return}if(!i.allowSelect||!a.allowSelect){if(i===a)return t.style.width="0px",void(t.style.height="0px");{const e=s.indexOf(i),l=s.indexOf(a);i=null,a=null;for(let t=e;t<l;t++){const e=s[t];e.allowSelect&&!i&&(i=e),a=e}if(!i||!a)return t.style.width="0px",void(t.style.height="0px")}}const r=l.indexOf(n),d=l.indexOf(o),c=s.indexOf(i),u=s.indexOf(a);let f=Math.min(r,d),p=Math.max(r,d),m=Math.min(c,u),g=Math.max(c,u);m=Math.max(0,m),f=Math.max(0,f);const _=function(e){const t=l.indexOf(e.row),n=l.indexOf(e.endRow),o=s.indexOf(e.column),i=s.indexOf(e.endColumn);f=Math.min(f,t),f=Math.min(f,n),f=Math.max(0,f),p=Math.max(p,t),p=Math.max(p,n),m=Math.min(m,o),m=Math.min(m,i),m=Math.max(0,m),g=Math.max(g,o),g=Math.max(g,i)},h=e._getParentCell(n,i.dataField),w=e._getParentCell(n,a.dataField),y=e._getParentCell(o,a.dataField),v=e._getParentCell(o,i.dataField);h&&_(h),w&&_(w),y&&_(y),v&&_(v);let S=0,R=0,C=0,x=0;t.cellValues=[];let b=[],F=[];for(let n=f;n<=p;n++){const o=l[n];if(n===f&&(S=o.top,!0!==o.freeze&&"near"!==o.freeze&&(S+=e.__frozenNearHeight+2),"far"===o.freeze&&(S=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight)),n===p){let t=o.top;"far"===o.freeze&&(t=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight),R=t+o.height-S,!0!==o.freeze&&"near"!==o.freeze&&(R+=e.__frozenNearHeight)}t.cellValues[o.id]=[];const i=e._isUpdating;e._isUpdating=!0,t.style.zIndex="";for(let l=m;l<=g;l++){const n=s[l].dataField,i=o.getCell(n);let a=i?i.value:"";if(void 0===a&&(a=""),s[l].freeze?b.push(s[l]):F.push(s[l]),"tags"===s[l].template)if(null!=a)if("number"==typeof a)a=null;else{const t=a.trim().split(","),n=[];if(s[l].editor&&s[l].editor.dataSource){const o=s[l].editor.collaborator?e.users:s[l].editor.dataSource;for(let e=0;e<t.length;e++)for(let l=0;l<o.length;l++){const i=o[l],a=i.value;if(t[e]===i.value||t[e]===i.id){n.push(i.label||i.name);break}if(a&&(t[e]===a.toLowerCase()||t[e]===i.id)){n.push(i.label||i.name);break}}}a=n.join(", ")}else a=null;else if("createdBy"===s[l].template||"updatedBy"===s[l].template){for(let t=0;t<e.users.length;t++)if(e.users[t].id===o[s[l].template]){a=e.users[t].label||e.users[t].name;break}}else"createdTime"===s[l].template||"createdDate"===s[l].template?(a=o.createdDate,a&&(a=new Smart.Utilities.DateTime(a).toString("d"))):"updatedTime"!==s[l].template&&"updatedDate"!==s[l].template||(a=o.updatedTime,!a)||(a=new Smart.Utilities.DateTime(a).toString("d"));if(i.formula&&(a=i.formula),t.cellValues[o.id][n]=a,l===m&&(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===g){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}let c=!0;-1!==r&&-1!==d||(c=!1),c&&(i.selected=!0)}e._isUpdating=i}if(S-e.scrollTop<e.layout.rowMinHeight&&e.filtering.enabled&&e.filtering.filterRow.visible){const t=S;S=e.layout.rowMinHeight+e.scrollTop,R-=S-t}if(R<=0)t.classList.add("smart-visibility-hidden");else{if(t.classList.remove("smart-visibility-hidden"),0===b.length&&(t.style.zIndex=5),t.style.top=S-e.scrollTop-1+"px",0===f&&0===S&&0===e.scrollTop&&(t.style.top="0px"),e._isVirtualMode(),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;!F.length&&b.length&&(x+=n),x-=n,t.style.left=n+C-e.scrollLeft+"px"}}t.style.height=R+1+"px",t.style.width=x+1+"px",x<0?t.classList.add("smart-visibility-hidden"):t.classList.remove("smart-visibility-hidden")}}_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:parseInt(o.pageX),pageY:parseInt(o.pageY)}),l&&n.$.fireEvent("cellClick",{cell:l,id:t.id,dataField:l.column.dataField,isRightClick:i,originalEvent:o,pageX:parseInt(o.pageX),pageY:parseInt(o.pageY)}),n._recycle(),n._renderInputOverlay(t.id,e,!0),e.preventDefault()},n.appearance.allowCheckBoxesSelectionAnimation&&void 0===l&&n._inputOverlay.classList.add("smart-animate"),requestAnimationFrame((()=>{n._inputOverlay&&n._inputOverlay.classList.add("smart-input-overlay-on")}))}}_selectRow(e,t){const l=this,n=l.rowById[e];if(n&&l.selection.enabled&&(!n.header||"row-resize"!==n.header.style.cursor)){if(t&&(!t.shiftKey||!l._selection.focusedCell)){const t=n.getCell(l.columns[0].dataField);l._selection.focusedCell={index:t.row.index,id:e,dataField:t.column.dataField,value:t.value}}l._lastRowsSelectionRange=null,"extended"===l.selection.mode?l._handleExtendedRowSelection(n,t):"one"===l.selection.mode?n.select():n.selected?n.unselect():n.select()}}_getParentCell(e,t){const l=this;let n=l._recyclingRows;for(let o=0;o<l._cellsMerge.length;o++){const i=l._cellsMerge[o];let a=[],s=[];if(a.push(i.row),i.rowSpan>1){const e=n.indexOf(i.row);if(e>=0)for(let t=e;t<e+i.rowSpan;t++)n[t]&&-1===a.indexOf(n[t])&&a.push(n[t])}if(s.push(i.column.dataField),i.colSpan>1){const e=l.viewColumns,t=e.indexOf(l.columnByDataField[i.column.dataField]);for(let l=t;l<t+i.colSpan;l++)e[l]&&-1===s.indexOf(e[l].dataField)&&s.push(e[l].dataField)}if(a.indexOf(e)>=0&&s.indexOf(t)>=0)return{row:i.row,column:i.column,endRow:a[a.length-1],endColumn:l.columnByDataField[s[s.length-1]]}}if(l._cellRowSpan)for(let o=0;o<l._cellRowSpan.length;o++){const o=e.visibleIndex;let i=-1,a=null;for(let e=0;e<l._cellRowSpan.length;e++){const t=l._cellRowSpan[e];if(o>t[0]&&o<t[1]){i=t[0],a=t[2];break}}if(i>=0&&a===t){const e=n[i];if(e)return{row:e,column:l.columnByDataField[t],endRow:e,endColumn:l.columnByDataField[t]}}}return null}_selectCellsRange(e,t,l,n){const o=this,i=o._selection.selectionRect;if(!e||!t)return;if(o._lastRowsSelectionRange&&o._lastRowsSelectionRange.id===e.id&&o._lastRowsSelectionRange.endId===t.id&&o._lastColumnSelectionRange&&o._lastColumnSelectionRange.dataField===l&&o._lastColumnSelectionRange.endDataField===n)return;o.beginUpdate(),o._clearSelection(),o._lastRowsSelectionRange={id:e.id,endId:t.id},o._lastColumnSelectionRange={dataField:l,endDataField:n},(!i||i&&!i.captured)&&o._selection.focusedCell&&o._renderCellSelectionRect(o.rowById[o._selection.focusedCell.id],o.columnByDataField[o._selection.focusedCell.dataField],o.rowById[o._lastRowsSelectionRange.endId],o.columnByDataField[o._lastColumnSelectionRange.endDataField]);let a=o._recyclingRows;const s=o.viewColumns;let r=-1,d=-1,c=a.indexOf(e),u=a.indexOf(t),f=-1;for(let e=0;e<s.length;e++){const t=s[e];t.allowSelect&&(-1===f&&(f=e),t.dataField===l&&(r=e),t.dataField===n&&(d=e))}if(-1===f)return o.endUpdate(!1),void o._recycle();-1===r?r=f:-1===d&&(d=f);let p=Math.min(c,u),m=Math.max(c,u),g=Math.min(r,d),_=Math.max(r,d);const h=function(e){const t=a.indexOf(e.row),l=a.indexOf(e.endRow),n=s.indexOf(e.column),o=s.indexOf(e.endColumn);p=Math.min(p,t),p=Math.min(p,l),m=Math.max(m,t),m=Math.max(m,l),g=Math.min(g,n),g=Math.min(g,o),_=Math.max(_,n),_=Math.max(_,o)},w=o._getParentCell(e,l),y=o._getParentCell(t,n);if(w&&h(w),y&&h(y),m<0||p<0||g<0||_<0)return o.endUpdate(!1),void o._recycle();for(let e=p;e<=m;e++){const t=a[e];if(t.allowSelect)for(let e=0;e<s.length;e++){const l=s[e];l.allowSelect&&e>=g&&e<=_&&(t.getCell(l.dataField).selected=!0)}}o.endUpdate(!1,!1),o._recycle(!0,!0,!1),o._selectionTimer&&clearTimeout(o._selectionTimer),o._selectionTimer=setTimeout((()=>{o.editing.isEditing||o._recycle(!0,!0,!1)}),50)}_selectRowsRange(e,t,l){const n=this;if(n._lastRowsSelectionRange&&n._lastRowsSelectionRange.id===e.id&&n._lastRowsSelectionRange.endId===t.id)return;if(n._dragDrop&&n._dragDrop.dragDetails)return;n.beginUpdate(),n._clearSelection(),n._lastRowsSelectionRange={id:e.id,endId:t.id};let o=n._recyclingRows;const i=o.indexOf(e),a=o.indexOf(t),s=Math.min(i,a),r=Math.max(i,a);if(r<0)return n.endUpdate(!1),void n._recycle();for(let e=s;e<=r;e++){const t=o[e];t&&t.allowSelect&&(t.selected=!1!==l)}n.endUpdate(!1),n._recycle()}_selectColumnsRange(e,t){const l=this;if(l._lastColumnSelectionRange&&l._lastColumnSelectionRange.dataField===e&&l._lastColumnSelectionRange.endDataField===t)return;if(l._dragDrop&&l._dragDrop.dragDetails)return;l.beginUpdate(),l._clearSelection(),l._lastColumnSelectionRange={dataField:e,endDataField:t};const n=l.viewColumns;let o=-1,i=n.length;for(let l=0;l<n.length;l++){const a=n[l];a.allowSelect&&(a.dataField===e&&(o=l),a.dataField===t&&(i=l))}const a=Math.min(o,i),s=Math.max(o,i);for(let e=0;e<n.length;e++){const t=n[e];t.allowSelect&&e>=a&&e<=s&&(t.selected=!0)}l.endUpdate(!1),l._recycle()}_selectColumn(e,t){const l=this,n=l.columnByDataField[e],o=l.viewColumns;if(!n||!l.selection.enabled||!1===n.allowSelect||!l.selection.allowColumnHeaderSelection)return;if(n&&"col-resize"===n.element.style.cursor)return;let i=!1;if(n&&(n.allowSelect||null===n.allowSelect&&!t)&&(i=!0),i&&t)if("extended"===l.selection.mode){if(t.ctrlKey||t.metaKey||t.shiftKey||(l._rangeSelectionStartColumn=n,l._rangeSelectionEndColumn=n),t.ctrlKey||t.metaKey?n.selected=!n.selected:n.selected=!0,t&&t.shiftKey){l._rangeSelectionStartColumn||(l._rangeSelectionStartColumn=n),l._rangeSelectionEndColumn=n,l._selection.columns=[];const e=o.indexOf(l._rangeSelectionStartColumn),t=o.indexOf(l._rangeSelectionEndColumn),i=Math.min(e,t),a=Math.max(e,t);for(let e=i;e<=a;e++){const t=o[e];t&&!1!==t.allowSelect&&(t.selected=!0)}}}else"one"===l.selection.mode||null===n.selected?n.selected=!0:n.selected=!n.selected}selectAllRows(){const e=this;let t=e.rows;e._selectionColumn._selecting=!0,delete e._areAllRowsSelected,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;if(e._areAllRowsSelected!==this.undefined)return e._areAllRowsSelected;const t=e.getVisibleRows(),l=Object.keys(e._selection.rows).length;if(0===l||l<t.length)return!1;const n=e._getSelectedRows(!0,!1);return n.length>0&&n.length===t.length?(e._areAllRowsSelected=!0,!0):(e._areAllRowsSelected=!1,e._areAllRowsSelected)}_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.autoSaveState()),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&&t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o)return;if(o&&o.startsWith("_"))return;let e=!0;if(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._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o)return;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()))}selectCell(e,t){this.select(e,t)}selectRowsByIndex(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._isVirtualMode()){let l=[];for(let t=0;t<e.length;t++)l[e[t]]=!0;return t._selection.indexes=l,void t._recycle()}t.beginUpdate();for(let l in e){const n=e[l],o=t.rows[n];o&&t._setSelection(o.id)}t.endUpdate(!1),t._recycle()}))}selectRowsRange(e,t){const l=this,n=l.rowById[e],o=l.rowById[t];n&&o&&(l._selectRowsRange(n,o),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}selectCellsByQuery(e,t){const l=this,n=e?l.findCells(e):t;requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let e in n){const t=n[e][0],o=n[e][1];l._setSelection(t,o)}l.endUpdate(!1),l._recycle()}))}selectRowsByQuery(e,t,l){const n=this,o=n.find(e,t,l).map((e=>e.$.id));o.length&&n.selectRows(o)}selectRow(e){const t=this;"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._setSelection(e),t._recycle(!1)}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()}))}selectCellsById(e){this.selectCellsByQuery(null,e)}selectCells(e,t){const l=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let n in e)for(let o=0;o<t.length;o++)l._setSelection(e[n],t[o]);l.endUpdate(!1),l._recycle()}))}selectRange(e,t,l,n){const o=this;!function(){const i=new KeyboardEvent("keydown",{shiftKey:!0});requestAnimationFrame((()=>{"extended"!==o.selection.mode&&"many"!==o.selection.mode&&o._clearSelection(),o.beginUpdate(),o._setSelection(e,t),o._setSelection(l,n,i),o.ensureVisible(e,t),o.endUpdate(!1),o._refreshSummary(!1),o._recycle()}))}(),o.$.fireEvent("change",{started:!1,finished:!0})}unselect(e,t){const l=this;if(l._selection){if(l._selection.rows&&l._selection.rows[e]){delete l._selection.rows[e];const t=l.rowById[e];t&&t.unselect()}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}getSelectedRowsData(){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)t.push({});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(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],i=e.rowById[o],a={id:o};i?a.row=i:e._isVirtualMode&&e.rows[n]?a.row=e.rows[n]:e._isVirtualMode&&(a.row=null),t.push(a)}}if(e._selection.columns&&Object.keys(e._selection.columns).length>0){const t=Object.keys(e._selection.columns);l=[];for(let n=0;n<t.length;n++){const o=t[n];l.push({dataField:o,column:e.columnByDataField[o]})}}if(e._selection.cells)for(let t in e._selection.cells)if(t.startsWith("row")){let l=t.replace("row",""),o=null;for(let i in e._selection.cells[t])o=i.replace("column",""),n||(n=[]),n.push({id:l,dataField:o,column:e.columnByDataField[o],row:e.rowById[l]})}return e._selection.focusedCell&&(e._isVirtualMode(),o={index:e._selection.focusedCell.index,id:e._selection.focusedCell.id,dataField:e._selection.focusedCell.dataField}),{rows:t,columns:l,cells:n,focused:o}}focusAndSelect(e,t){const l=this;if(l.focus(),l.selection.enabled&&l.selection.allowCellSelection)l._focusCell(e,t);else{const t=l.rowById[e];if(!t)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e),l._selection.focusedCell={id:t.id,value:null,index:t.index,dataField:l.columns[0].dataField},l.endUpdate(!1)}}_focusCell(e,t,l){const n=this;if(n.selection.enabled&&n.selection.allowCellSelection){const o=n.rowById[e];if(!o)return;!1!==l&&(n.beginUpdate(),n._selection.rows=[],n._selection.columns=[],n._selection.cells=[],n._selection.indexes=[],n._setSelection(e,t));const i=o.getCell(t);i&&(n._selection.focusedCell={id:i.row.id,value:i.value,dataField:t,index:i.row.index}),!1!==l&&n.endUpdate(!1)}}_clearSelection(e){const t=this;if(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[],e&&(t._selection.focusedCell=null,t._selection.selectionRect)){const e=t._selection.selectionRect;e.parentNode.removeChild(e);const l={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(l.down="touchstart",l.move="touchmove",l.up="touchend"),document.removeEventListener(l.move,e.onMove),document.removeEventListener(l.up,e.onUp),document.removeEventListener(l.down,e.onDown),t._selection.selectionRect=null}t._recycle(),t._refreshCheckBoxColumnSelection()}_getSelectionCellValues(){const e=this;if(e._selection.selectionRect)return e._selection.selectionRect.cellValues;const t=e.viewColumns;if(e._selection.rows.length>0){let l=[];for(let n in e._selection.rows){const o=e.rowById[n];for(let e=0;e<t.length;e++){const i=t[e];i&&(l[n]||(l[n]=[]),i.autoGenerated||(l[n][i.dataField]=o.data[i.dataField]))}}return l}if(Object.keys(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();if(delete l._cutCells,delete l._cutRows,l.clipboard.copyHeadersToClipboard){let e=[];for(let n in t){for(let o in t[n]){const t=l.columnByDataField[o];t&&(e[o]=t.label,e.length++)}break}e.length&&t.splice(0,0,e)}if(l._selection.selectionRect){l._selection.selectionRect.classList.add("marching-ants");const e=l._selection.selectionRect;l._createCopyRect(e.row.id,e.endDragRow.id,e.column.dataField,e.endColumn.dataField)}else l.hasSelectedRows()&&l._createCopyRects();let n="";if(!t)return;let o=Object.keys(t).length,i=0;for(let a in t){let s="",r=Object.keys(t[a]).length,d=0;for(let e in t[a]){let n=t[a][e];""===n&&(n=`"${n}"`),void 0!==n&&"undefined"!==n&&null!==n||(n='""'),n=l._unescapeString(n),s+=n,d++,d<r&&(s+="\t")}if(n+=s,i++,i<o&&(n+="\r\n"),"x"===e&&l.editing.enabled){const e=l.getSelection();e.cells&&(l._cutCells=e.cells),e.rows&&(l._cutRows=e.rows)}}if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(n).then((function(){}),(function(){})),Smart.Utilities.Core.Browser.Firefox&&(l._clipboardText=n);else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),e.remove(),l._clipboardText=n}),25)}}if(t.ctrlKey&&" "===e&&l.editing.addNewRow.visible&&(l._keyboardAdd=!0,l._addNewGridRow(),l._keyboardAddTimer&&clearTimeout(l._keyboardAddTimer),l._keyboardAddTimer=setTimeout((()=>{l._keyboardAdd=!1}),300)),(t.ctrlKey||t.metaKey)&&"v"===e&&l.editing.enabled){const e=window.Smart.Utilities.Core.Browser.Firefox;if(navigator.clipboard&&!navigator.clipboard.readText&&!e)return;const t=e=>{if(!e)return;const t=[];let n=e.trim().split("\r");if(l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(n=e.split("\r")),1===n.length){let t=e.trim().split("\n");l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(t=e.split("\n")),t.length>1&&(n=t)}e.indexOf("<")>=0&&(n=[e.trim()]);for(let e=0;e<n.length;e++){const l=n[e].split("\t");let o={};for(let e=0;e<l.length;e++)o[e]=l[e].trim(),void 0!==o[e]&&"undefined"!==o[e]||(o[e]="");t[e]=o}const o=l._selection.selectionRect;if(o)l._pasteSelectedCells({row:o.row,endRow:o.endDragRow,column:o.column,endColumn:o.endColumn},t);else{let e=null,n=null;for(let t in l._selection.rows){const o=l.rowById[t];e||(e=o),n||(n=o),e.visibleIndex>o.visibleIndex&&(e=o),n.visibleIndex<o.visibleIndex&&(n=o)}if(e&&n&&l._pasteSelectedCells({row:e,endRow:n,column:l.firstColumn(),endColumn:l.lastColumn()},t),0===l._selection.rows.length){const o=l.getSelectedCells();let i=null,a=null;for(let t=0;t<o.length;t++){const s=l.rowById[o[t][0]];if(!s)continue;e||(e=s),n||(n=s);const r=l.columnByDataField[o[t][1]];i||(i=a=r),i&&i.visibleIndex>r.visibleIndex&&(i=r),a&&a.visibleIndex<r.visibleIndex&&(a=r),e.visibleIndex>s.visibleIndex&&(e=s),n.visibleIndex<s.visibleIndex&&(n=s)}if(null===e&&null===n&&null===i&&null===a&&Object.keys(l._selection.columns).length>0){e=l.rows[0],n=l.rows[l.rows.length-1];const t=Object.keys(l._selection.columns)[0];i=l.columnByDataField[t],a=i}l._pasteSelectedCells({row:e,endRow:n,column:i,endColumn:a},t)}}l._cutCells&&l._handleCutCells(),l._cutRows&&l._handleCutRows()};if(!window.isSecureContext||e){if(document.activeElement&&"INPUT"===document.activeElement.nodeName)return!0;const e=document.createElement("textarea");return e.style.position="absolute",e.style.left="-1000px",e.style.top="-1000px",document.body.appendChild(e),e.select(),void setTimeout((()=>{l._clipboardSelection=new Array;let n=e.value;0===n.length&&window.clipboardData&&(e.val(window.clipboardData.getData("Text")),n=e.value);let o=n.split("\n");for(let e=0;e<o.length;e++)if(o[e].split("\t").length>0){var i=o[e].split("\t");if(1===i.length&&e===o.length-1&&""===i[0])continue;i.length>0&&l._clipboardSelection.push(i)}l._clipboardText=l._clipboardSelection.toString(),t(n.trim().replaceAll("\n","\r")),e.remove(),l.focus()}),100)}const n=navigator.clipboard.read?"read":"readText";navigator.clipboard[n]().then((e=>{if(Array.isArray(e)&&e.length){const n=e[0];let o=n.types.indexOf("text/html")>-1?"text/html":"text/plain";try{l._deleteCopyRects(),n.types.length&&n.getType(o).then((e=>{e.text().then((e=>{t(e)}))}))}catch(e){console.log(e),l._deleteCopyRects()}}else"string"==typeof e&&t(e)}))}}}_handleCutRows(){const e=this,t=e._cutRows;t.length>=1?t.map((e=>e.id)).forEach((t=>{requestAnimationFrame((()=>{e.updateRow(t,null,null,!0)}))})):delete e._cutRows}_handleCutCells(){const e=this;e.beginUpdate();const t=e._cutCells;if(t){for(let l=0;l<t.length;l++){const n=t[l],o=e.rowById[n.id];if(o){const t=o.getCell(n.dataField),l=e._pasteDataType({cell:t,value:t.value});let i=null;"int"!==l&&"number"!==l||(i=0),"string"===l&&(i=""),"boolean"!==l&&"bool"!==l||(i=!1),"date"===l&&(i=new Date),t.column.allowNull&&(i=null);const a=t.oldValue;if(e.onCellUpdate)e.onCellUpdate([t],[a],[i],(function(e){e&&(t.value=i)}),e);else if(e.onRowUpdate){const l=Object.assign({},t.row.data),n=Object.assign({},t.row.data);n[t.column.dataField]=i,e.onRowUpdate([t.row.index],[t.row],[l],[n],(function(e){e&&(t.value=i)}),e)}else t.value=i}}e.endUpdate(!1),e._recycle(),delete e._cutCells}}_setRemoveUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){t._undoRedo||(t._undoRedo=[]),t._removeUndoRedoHigherIndexes();const n=t.getRowData(e.id);t._undoRedo.push({action:"remove",data:n,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_setAddUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){let n=!1;for(let l=0;l<t._undoRedo.length;l++){const o=t._undoRedo[l];"add"===o.action&&o.index===e.index&&(n=!0)}if(n)return;t._removeUndoRedoHigherIndexes();const o=t.getRowData(e.id);t._undoRedo.push({action:"add",data:o,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_removeUndoRedoHigherIndexes(){const e=this,t=e._undoRedoIndex;t>=0?e._undoRedo.splice(t+1,e._undoRedo.length-t):-1===t&&(e._undoRedo=[])}_setCellUndoRedo(e,t,l){const n=this;if(!n.isInitialized)return;const o=Smart.Utilities.Core.createGUID().replace(/-/gi,"");n._setCellUndoRedoTimer&&clearTimeout(n._setCellUndoRedoTimer),n._undoRedoAction||(n._pasteUndoRedoValues||(n._pasteUndoRedoValues=[]),void 0===t&&(t=null),n._pasteUndoRedoValues.push({cell:e,index:e.row.index,dataField:e.column.dataField,oldValue:t,newValue:l}),n._setCellUndoRedoTimer=setTimeout((()=>{delete n._setCellUndoRedoTimer,n._removeUndoRedoHigherIndexes(),n._undoRedo||(n._undoRedo=[]),n._pasteUndoRedoValues.length>1?n._undoRedo.push({action:"updateMultiple",items:n._pasteUndoRedoValues,uid:o}):n._undoRedo.push({action:"update",index:e.row.visibleIndex,cell:e,dataField:e.column.dataField,oldValue:t,newValue:l,uid:o}),n._undoRedoIndex=n._undoRedo.length-1,n._pasteUndoRedoValues=[]}),50))}_undoRedoHandler(e){const t=this,l=e.key;if(e.ctrlKey||e.metaKey){if("z"===l)return t.undo(),void e.preventDefault();if("y"===l)return t.redo(),void e.preventDefault()}}_updateMultiple(e,t){const l=this;let n=9999999,o=0,i=999999,a=0,s=l._recyclingRows,r=[],d=[],c=[];l.beginUpdate();for(let u=0;u<e.items.length;u++){const f=e.items[u],p=s[f.index];if(p){const e=p.id,s=f.dataField,u=t?f.oldValue:f.newValue,m=l.columnByDataField[s],g=l.viewColumns.indexOf(m),_=p.getCell(s);_&&(r.push(_),d.push(_.value),c.push(u)),i=Math.min(i,g),a=Math.max(a,g),n=Math.min(n,p.visibleIndex),o=Math.max(o,p.visibleIndex),l.setCellValue(e,s,u)}}l.onCellUpdate&&r.length&&l.onCellUpdate(r,d,c,(function(){}),l),l._focusCell(s[n].id,l.viewColumns[i].dataField),l._selectCellsRange(s[n],s[o],l.viewColumns[i].dataField,l.viewColumns[a].dataField),delete l._undoRedoAction,l.endUpdate(!1)}redo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t+1];if(l)switch(e._undoRedoIndex++,e._undoRedoAction=!0,l.action){case"add":e.addRow(l.data,!0);break;case"remove":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.newValue,a=l.oldValue,s=t.getCell(o);s&&(e.setCellValue(n,o,i),e._focusCell(n,o),e.onCellUpdate&&e.onCellUpdate([s],[a],[i],(function(){e.onCellUpdated&&e.onCellUpdated([s.row.index],[s.row],[s.column],[s.row.data],[a],[i],e),e._onCellUpdated&&e._onCellUpdated(s.row.index,s.row,s.column,s.row.data,a,i)}),e))}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!1)}else delete e._undoRedoAction}getEditChanges(){return this._undoRedo}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;let a=e._cellsUpdatedValues?e._cellsUpdatedValues[n+"_"+o]:void 0;void 0!==a&&delete e._cellsUpdatedValues[n+"_"+o];const s=t.getCell(o);s&&(void 0===a&&(a=s.value),e.setCellValue(n,o,i),e._focusCell(n,o),e.onCellUpdate&&e.onCellUpdate([s],[a],[i],(function(){e.onCellUpdated&&e.onCellUpdated([s.row.index],[s.row],[s.column],[s.row.data],[a],[i],e),e._onCellUpdated&&e._onCellUpdated(s.row.index,s.row,s.column,s.row.data,a,i)}),e))}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("CapsLock"===l)return;if("Escape"===l&&(t.editing.editRow||t.editing.editCell)){t.closeMenu(),t.cancelEdit();let l=t.getSelection().focused;return void(l&&l.dataField&&t._setSelection(l.id,l.dataField,e))}if(!t.editing.editKeyHandling&&(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 t.menu&&t.menu.classList.contains("open")&&"Escape"===l&&t.closeMenu(),void(n.columns&&n.columns.length>0&&e.ctrlKey&&("c"!==l&&"v"!==l&&"x"!==l||t._clipboardHandler(l,e)))}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),e.ctrlKey||e.metaKey){const n=t.$.headerBar;n&&("b"===l&&(n._boldCommand(),e.preventDefault()),"i"===l&&(n._italicCommand(),e.preventDefault()),"u"===l&&(n._underlineCommand(),e.preventDefault()),"y"===l&&(n._strikethroughCommand(),e.preventDefault()))}if(t._clipboardHandler(l,e),((e.ctrlKey||e.metaKey)&&"x"!==l&&"c"!==l&&"v"!==l&&"Control"!==l||t.selection.allowCellSelection&&"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),"f"===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()}"ArrowDown"===e.key||"ArrowUp"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key?(t._setSelection(l,n,e),t.ensureVisible(l,n)):(t.beginUpdate(),t._setSelection(l,n,e),t.ensureVisible(l,n),t.endUpdate(!1,!1),"ArrowDown"===e.key||"ArrowUp"===e.key?t._recycle(!1,!0):t._recycle()),e.shiftKey?t.__selectionStarted&&!t.__selectionStartedFired?(t.$.fireEvent("change",{started:!0,finished:!1}),t.__selectionStartedFired=!0):t.$.fireEvent("change",{started:!1,finished:!1}):(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())};if(t._isVirtualMode()){t._keyboardNavigationTimer&&clearTimeout(t._keyboardNavigationTimer);const e=e=>{for(let l=0;l<t.rows.length;l++){const n=t.rows[l];if(n.index===e)return n.id}return null},i=l,a=JSON.parse(JSON.stringify(t._selection.focusedCell));t._selection.focusedCell.index=i,t._selection.focusedCell.dataField=n;const s=t.rows[0],r=s.height;if(-1===i)return;const d=t._scrollView.hScrollBar,c="virtual"!==t.scrolling?s.top:i*r;let u=0;if(t.paging.enabled||(c+d.offsetHeight+t.__frozenNearHeight>t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight?(t._scrollView.scrollTop=c-t.$.scrollView.offsetHeight-t.__frozenFarHeight+d.offsetHeight,u=50):c<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=c,u=50)),t._onDataUpdated||(t._onDataUpdated=()=>{t._recycle();const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t.paging.enabled&&(t._selection.focusedCell=a),t._onDataUpdated=null}),t.paging.enabled){const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t._selection.focusedCell=a}else t._keyboardNavigationTimer=setTimeout((()=>{const l=e(t._selection.focusedCell.index);t.rowById[l]&&o(l,t._selection.focusedCell.dataField)}),u)}else requestAnimationFrame((()=>{o(l,n)})),e.stopPropagation(),e.preventDefault()};if(t.keys&&t.keys[l]){const n=t.keys[l];switch(n){case"delete":if(o){const l=o.id,n=t.rowById[l];if(n)return t.updateRow(l,null,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l,dataField:null,row:n,column:null,cell:null,data:n?n.data:null,value:null})}break;case"deleteCell":if(o){const l=o.id,n=t.rowById[l],i=o.dataField;if(n){const o=t.columnByDataField[i];return void(o.allowEdit&&(t.setCellValue(l,i,""),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("endEdit",{id:l,dataField:i,row:n,column:o,cell:n?n.getCell(i):null,data:n?n.data:null,value:null})))}}break;case"copy":case"copyPrev":case"copyNext":if(o){const l=o.id,i=t.rowById[l];if(i){if("copy"===n)return t._clipboardHandler("c",e),e.stopPropagation(),void e.preventDefault();if("copyPrev"===n){const l=t.prevRow(o.id);if(l)return t.updateRow(l.id,i.data,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l.id,dataField:null,row:l,column:null,cell:null,data:i?i.data:null,value:null})}else if("copyNext"===n){const l=t.nextRow(o.id);if(l)return t.updateRow(l.id,i.data,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l.id,dataField:null,row:l,column:null,cell:null,data:i?i.data:null,value:null})}}}break;default:if(["Backspace","Tab","Enter","Shift","Control","Alt","Pause","CapsLock","Escape","Space","PageUp","PageDown","End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Insert","Delete","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","NumLock","ScrollLock","Semicolon","Equal","Comma","Minus","Period","Slash","Backquote","BracketLeft","Backslash","BracketRight","Quote"].indexOf(n)>=0)l=n;else{const l=o.id,i=t.rowById[l];if(t[n]&&"function"==typeof t[n])return t[n](t,i,e),e.stopPropagation(),void e.preventDefault();if(window[n]&&"function"==typeof window[n])return window[n](t,i,e),e.stopPropagation(),void e.preventDefault();if("function"==typeof n)return n(t,e),e.stopPropagation(),void e.preventDefault()}}t.$.fireEvent("keyPressed",e)}switch("Enter"!==l||!t.editing.enabled||"cell"!==t.editing.mode||t.editing.isEditing||t._editDownKey||(l="F2"),l){case"Tab":{if("none"===t.selection.tabKeyBehavior)return;const l=e.shiftKey?t.prevColumn(o.dataField):t.nextColumn(o.dataField);if(l&&t.selection.allowCellSelection){const n=t.rowById[o.id].getCell(l.dataField);t._selection.focusedCell={id:n.row.id,value:n.value,dataField:l.dataField,index:n.row.index},t._setSelection(o.id,l.dataField,e),t.ensureVisible(o.id,l.dataField),t.focus(),e.stopPropagation(),e.preventDefault()}else{let l=e.shiftKey?t.prevRow(o.id):t.nextRow(o.id),n=e.shiftKey?t.lastColumn().dataField:t.firstColumn().dataField;if(t.editing.addNewRow.autoCreate&&!e.shiftKey&&o.id===t.lastRow().id&&(t.addUnboundRow(1),l=t.lastRow()),!l)return;e.shiftKey&&(t._selection.focusedCell=null),a(t._isVirtualMode()?l.index:l.id,n)}t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary();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();const e=l[0],o=e[1],a=e[0],s=e[2],r=t.columnByDataField[o];t.$.fireEvent("beginEdit",{id:null,dataField:o,row:a,column:r,cell:null,data:null,value:s});const d=[],c=[],u=[],f=[],p=[];for(let e=0;e<l.length;e++){const n=l[e],o=n[1],i=n[0],a=n[2],s=t.rowById[i],m=s.getCell(o);p.push(s),f.push(t.columnByDataField[r]),u.push(m),c.push(!a),d.push(a),t.setCellValue(i,o,!a)}t.onCellUpdate&&t.onCellUpdate(u,d,c,(function(){}),t),t.$.fireEvent("endEdit",{id:n?n.id:null,dataField:o,row:n,column:r,cell:e,data:n?n.data:null,value:!s}),t.endUpdate(!1)}}i||(t._beginEdit(n,o.dataField),setTimeout((function(){if(t.editing.editCell&&t.editing.editCell.column.dataType.indexOf("bool")>=0){const e=t.editing.editCell.editor.instance,n=e.getValue();" "===l&&e.setValue(!n)}}),50))}else t.selection.enabled&&"many"===t.selection.mode&&(t._isVirtualMode()?a(o.index,o.dataField):a(o.id,o.dataField));break}case"Delete":case"Backspace":{const e=t.rowById[o.id];if(!e||t.editing.editCell)return;if(t.editing.enabled)if(e.getCell(o.dataField).value,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;if("image"===e.column.template){const l=e.value,n=l&&l.indexOf("[{")>=0?JSON.parse(l):[];for(let e=0;e<n.length;e++){if(t.uploadSettings.removeUrl){let l=new FormData,o=new XMLHttpRequest,i=n[e].value;l.append(t.uploadSettings.name,i),o.open("POST",t.uploadSettings.removeUrl),o.send(l)}t.uploadSettings.onUploadRemove&&t.uploadSettings.onUploadRemove(n[e])}}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),e.formula=null;const a=e.value;if(t.dataSource&&t.dataSource.virtualDataSource){const n={};if(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){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([e],[a],[n],(function(o){if(o){const o=t.onRowHistory;t.onRowHistory=null,l(e,n),e.value=n,t.onRowHistory=o}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else n[e.column.dataField]=i;t.editing.batch?t._batchUpdateCell(e.row,e.column,i,e.value):t.updateRow(e.row.id,n)}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){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([e],[a],[n],(function(o){if(o){const o=t.onRowHistory;t.onRowHistory=null,l(e,n),e.value=n,t.onRowHistory=o}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else e.value=i;t._conditionalColors&&t._conditionalColors.update&&setTimeout((()=>{t._conditionalColors.update(),t._recycle(!1)}),100)}}t.endUpdate(!1),t._recycle(),t._refreshDataFilters()}else{const e=t._getSelectedRows();if(e&&e.length&&t._selection.rows&&Object.keys(t._selection.rows).length>0){const e=t.getSelectedRows();if(e.length>=1)return void e.map((e=>e[0])).forEach((e=>{requestAnimationFrame((()=>{t.updateRow(e,null,null,!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._beginEditKey=l,t._beginEdit(e,o.dataField),setTimeout((function(){if(t.editing.editCell)t.editing.editCell.editor.instance.setValue(t._beginEditKey);else if(t.editing.editRow){const e=t.editing.editRow.getCell(o.dataField);if(!e)return;e.editor.instance.setValue(t._beginEditKey)}delete t._beginEditKey}),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"Enter":case"ArrowDown":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]&&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]&&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()),!t.onKeyUp||(t.onKeyUp(e),e.defaultPrevented))}firstRow(){const e=this._recyclingRows;if(this._isVirtualMode())return{id:0};if(e&&e.length>0){if(!e[0].autoGenerated&&e[0].allowSelect)return e[0];for(let t=0;t<e.length;t++)if(!e[t].autoGenerated&&e[t].allowSelect)return e[t]}return null}lastRow(){const e=this,t=e._recyclingRows;if(e._isVirtualMode())return{id:e.dataSource.virtualDataSourceLength-1};if(t&&t.length>0){const e=t[t.length-1];if(!e.autoGenerated&&e.allowSelect)return e;for(let e=t.length-1;e>=0;e--)if(!t[e].autoGenerated&&t[e].allowSelect)return t[e]}return null}nextRow(e){const t=this._recyclingRows,l=this.rowById[e],n=t.indexOf(l);let o=1;if(l&&void 0!==l._rowSpan&&(o=l._rowSpan),n>=0&&t[n+o]&&!t[n+o].autoGenerated){const e=t[n+o];if(e.allowSelect&&!e.disabled)return e;for(let e=n+o;e<t.length;e++){const l=t[e];if(l.allowSelect&&!l.disabled)return l}}return null}_isVirtualMode(){const e=this;return e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling}prevRow(e){const t=this,l=t._recyclingRows,n=t.rowById[e],o=l.indexOf(n);if(t._isVirtualMode())return 0===e?null:{id:n.index-1};if(o>=0&&l[o-1]&&!l[o-1].autoGenerated){const e=l[o-1];if(e.allowSelect&&!e.disabled)return e;for(let e=o-1;e>=0;e--){const t=l[e];if(t.allowSelect&&!t.disabled)return t}}return null}firstColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=0;t<e.length;t++){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}lastColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=e.length-1;t>=0;t--){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}nextColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n<t.length;){const e=t[n+1];if(!e)return null;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}isJSON(e){if("string"!=typeof e)return!1;const t=e.trim();if(!t)return!1;if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{const e=new Function("return "+t)();return e&&"object"==typeof e}catch(e){return!1}return!1}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.hasAttribute("tree")?n===t.getViewRows().length-1&&(t._scrollView.scrollTop=t._scrollView.scrollHeight):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),e.left<=t._frozenColumnsNearWidth+t._scrollView.scrollLeft&&!e.freeze&&t._frozenNearColumns.length>1&&(t._scrollView.scrollLeft=e.left-t._frozenColumnsNearWidth),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)}clearPaste(e,t="text/html",l="keepFormat"){let n;if(e=e.replace(/<!--StartFragment-->|<!--EndFragment-->/gi,""),!t||"plainText"===l){const t=document.createElement("div");t.innerHTML=e,e=t.innerText}const o=e.toLocaleLowerCase();if(n=document.createElement("span"),e=(e=>{let t=document.createElement("div");t.innerHTML=e,["o:p","w:","v:","xml"].forEach((e=>{let l=t.getElementsByTagName(e);for(;l.length>0;)l[0].remove()})),t.querySelectorAll("b").forEach((e=>e.outerHTML=e.outerHTML.replace("<b","<strong").replace("</b>","</strong>"))),t.querySelectorAll("i").forEach((e=>e.outerHTML=e.outerHTML.replace("<i","<em").replace("</i>","</em>"))),t.querySelectorAll("*[style]").forEach((e=>{const t=["color","background-color","font-weight","font-style"],l=e.getAttribute("style");if(l){let n="";l.split(";").forEach((e=>{let[l,o]=e.split(":");l=l&&l.trim(),o=o&&o.trim(),t.includes(l)&&(n+=`${l}: ${o}; `)})),n.trim()?e.setAttribute("style",n.trim()):e.removeAttribute("style")}})),t.innerHTML=t.innerHTML.replace(/\r?\n|\r/g," "),t.innerHTML=t.innerHTML.replace(/(<br\s*\/?>\s*){2,}/g,"<br>"),t.innerHTML=t.innerHTML.replace(/(<p>(\s|&nbsp;)*<\/p>\s*){2,}/g,"<p></p>"),t.innerHTML=t.innerHTML.replace(/(\s|&nbsp;){2,}/g," "),t.innerHTML=t.innerHTML.replace(/>\s+</g,"><"),t.innerHTML=t.innerHTML.replaceAll("·",""),t.innerHTML=t.innerHTML.replaceAll('class="MsoNormal"',""),t.innerHTML=t.innerHTML.replace(/<!--.*?-->/gs,""),["div","span"].forEach((e=>{let l=t.getElementsByTagName(e);Array.from(l).forEach((e=>{let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}))})),t.querySelectorAll("p, div, span").forEach((e=>{e.textContent.trim()||e.querySelector("img")||e.querySelector("a")||e.remove()}));let l=t.innerHTML;return l.replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2013/g,"-").replace(/\u2014/g,"--").replace(/\u2026/g,"...").replace(/\u00A0/g," ").replace(/\uFEFF/g,"").replace(/[\u200B-\u200D]/g,"").replace(/[\u202A-\u202E]/g,""),l})(e),n.innerHTML=e,o.indexOf("<video")>-1||o.indexOf("<iframe")>-1||o.indexOf("smart-editor-image-caption")>-1){const e=n.querySelectorAll("video, iframe"),t=n.querySelector(".smart-editor-image-caption"),l=e.length>0;let o=document.createDocumentFragment();for(let t=0,l=e.length;t<l;t+=1)o.appendChild(e[t]);if(t&&(t.removeAttribute("style"),o.appendChild(t)),l||t){const e=document.createElement("span");n.classList.add("smart-editor-image-container"),l&&n.classList.add("smart-editor-video-container"),n.setAttribute("contenteditable",!1),o.childElementCount&&(n.innerHTML="",n.appendChild(o)),e.appendChild(n),n=e}}return"keepFormat"===l&&(e=>{if(e&&e.nodeType!==Node.TEXT_NODE){const t=e.querySelectorAll("style, [style]");for(let e=0,l=t.length;e<l;e+=1){const l=t[e];"style"===l.nodeName.toLowerCase()?l.remove():t[e].removeAttribute("style")}e.removeAttribute("style")}})(n),n.innerHTML}clearSelection(){const e=this;delete e._rangeSelectionStartRow,delete e._rangeSelectionEndRow,delete e._areAllRowsSelected,e._clearSelection(!0),e.$.fireEvent("change",{started:!1,finished:!0}),e._refreshSummary()}});
6
+ 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;if(t._selectionColumn._selecting=!0,t.beginUpdate(),t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let e=t.paging.pageIndex*t.paging.pageSize,l=(t.paging.pageIndex+1)*t.paging.pageSize;for(let n=e;n<l;n++)delete t._selection.indexes[n]}else t._selection.indexes=[];if(t.paging.enabled&&"all"===t.selection.checkBoxes.selectAllMode){let e=t.getVisibleRows();for(let t=0;t<e.length;t++)e[t].selected=l}else 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++){if(t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let l=t.paging.pageIndex*t.paging.pageSize,n=(t.paging.pageIndex+1)*t.paging.pageSize;if(e<l||e>=n)continue}l&&(t._selection.indexes[e]=e,t._selection.rows[e]=e)}else{let e=!0;t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode&&(e=!1),e&&(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;t.paging.enabled&&"all"===t.selection.checkBoxes.selectAllMode&&(n=t.getVisibleRows());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++){if(t.paging.enabled&&"page"===t.selection.checkBoxes.selectAllMode){let l=t.paging.pageIndex*t.paging.pageSize,n=(t.paging.pageIndex+1)*t.paging.pageSize;if(e<l||e>=n)continue}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;t&&("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(delete n._areAllRowsSelected,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];if(t&&(t.allowSelect||null===t.allowSelect&&!l))if(n.selection.checkBoxes.enabled&&l&&l.originalEvent&&l.originalEvent.target&&l.originalEvent.target.parentNode&&l.originalEvent.target.parentNode.hasAttribute("checkbox")&&(l.ctrlKey=!0),n.selection.allowRowHeaderSelection&&"extended"===n.selection.mode)if(!Object.keys(n._selection.cells).length>0&&n.appearance.showRowHeaderSelectIcon,t.selected){const e=n._selection.focusedCell?JSON.parse(JSON.stringify(n._selection.focusedCell)):null;o(),n._selection.focusedCell=e}else o(),n._selectRow(e,l);else o(),n._selectRow(e,l)};if(n.selection.allowCellSelection&&null!=e&&i&&!i.autoGenerated){const i=n.rowById[e];if(!i)return n.endUpdate(!1),void n._recycle();let a=i.getCell(t);const s=n._getParentCell(i,t);s&&(a=s.row.getCell(s.column.dataField)),a&&a.column.allowSelect&&(o(),!l||l.ctrlKey||l.metaKey||(n._selection.rows=[],n._selection.indexes=[],n._selection.columns=[],"many"!==n.selection.mode&&(n._selection.cells=[])),"extended"===n.selection.mode?l&&(l.ctrlKey||l.metaKey)?a.selected=!a.selected:a.selected=!0:"one"===n.selection.mode?a.selected=!0:a.selected=!a.selected,(l&&!l.shiftKey||!n._selection.focusedCell)&&(n._selection.focusedCell={id:a.row.id,value:a.value,index:a.row.index,dataField:a.column.dataField}),l&&(l.shiftKey||n._selection.focusedCell.id===a.row.id&&n._selection.focusedCell.dataField===a.column.dataField&&"extended"===n.selection.mode)&&(s?n._renderCellSelectionRect(a.row,a.column,s.endRow,s.endColumn):n._renderCellSelectionRect(a.row,a.column,a.row,a.column)))}else n.selection.allowRowHeaderSelection&&null!=e&&void 0===n.columnByDataField[t]||n.selection.checkBoxes.enabled&&null!=e&&"_checkBoxColumn"===t&&void 0===n.columnByDataField[t]?a():null==e||null!=t&&void 0===n.columnByDataField[t]||!n.selection.allowRowSelection?n.selection.allowColumnHeaderSelection&&i&&(o(),n._selectColumn(t,l||new KeyboardEvent("keydown"))):a();n.endUpdate(!1,!1),n._recycle(!0,!0,!1),null==e||i||n._renderInputOverlay(e,l),n.__selectionStarted=new Date}_deleteCopyRects(){const e=this;e._copyRects&&e._copyRects.forEach((e=>{e.remove()})),delete e._copiedRows,e._copyRects=[]}_createCopyRects(){const e=this,t=e._getSelectedRows();let l=[],n=null;e._deleteCopyRects();for(let o=0;o<t.length;o++){const i=t[o];i&&(n?(n&&n.visibleIndex===i.visibleIndex-1||n&&n.visibleIndex===i.visibleIndex+1||(l.length&&e._createCopyRect(l[0],l[l.length-1]),l=[]),l.push(i.id)):l.push(i.id),n=i)}l.length&&e._createCopyRect(l[0],l[l.length-1])}_createCopyRect(e,t,l,n){const o=this,i=document.createElement("div"),a=document.createElement("div"),s=document.createElement("div");s.classList.add("smart-selection-overlay","marching-ants"),s.appendChild(a),a.appendChild(i),i.classList.add("smart-selection-overlay-content"),a.classList.add("smart-selection-overlay-border-content");const r=o.rowById[e],d=o.rowById[t];if(o._deleteCopyRects(),!r||!d)return;let c=r.top;!0!==r.freeze&&"near"!==r.freeze&&(c+=o.__frozenNearHeight);const u=d.top-r.top+d.height;let f=o.columns[0].left,p=o.columns[o.columns.length-1].left+o.columns[o.columns.length-1].computedWidth-f;if(l){let e=o.columnByDataField[l],t=o.columnByDataField[n];e.left>t.left&&(e=o.columnByDataField[n],t=o.columnByDataField[l]),e&&(f=e.left,p=t.left+t.computedWidth-f)}const m=s;return m.style.top=c-o.scrollTop-1+"px",m.style.left=Math.max(0,f-o.scrollLeft)+"px",0===r.visibleIndex&&0===c&&0===o.scrollTop&&(m.style.top="0px"),m.style.height=u+1+"px",m.style.width=p+1+"px",p>300&&m.style.setProperty("--alt-duration",12*Math.ceil(p/180)+"s"),u>60&&m.style.setProperty("--duration",12*Math.ceil(u/180)+"s"),o.$.scrollView.appendChild(s),o._copyRects||(o._copyRects=[]),s.onpointerdown=e=>{o._deleteCopyRects(),o._rowDownHandler(e)},m.row=r,m.lastRow=d,m.dataField=l,m.lastDataField=n,o._copyRects.push(m),s}_refreshCopyRects(){const e=this;e._copyRects&&e._copyRects.forEach((t=>{const l=t.row,n=t.lastRow;let o=l.top;!0!==l.freeze&&"near"!==l.freeze&&(o+=e.__frozenNearHeight);const i=n.top-l.top+n.height;let a=e.columns[0].left,s=e.columns[e.columns.length-1].left+e.columns[e.columns.length-1].computedWidth-a,r=t.dataField,d=t.lastDataField,c=a-e.scrollLeft;const u=e.columns[e.columns.length-1];if(c<e._frozenColumnsNearWidth&&(c=e._frozenColumnsNearWidth,s=u.left+u.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth),s=u.left+u.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth,r){let t=e.columnByDataField[r],l=e.columnByDataField[d];t.left>l.left&&(t=e.columnByDataField[d],l=e.columnByDataField[r]),t&&(a=t.left,s=l.left+l.computedWidth-a,c=a-e.scrollLeft,c<e._frozenColumnsNearWidth&&(c=e._frozenColumnsNearWidth,s=l.left+l.computedWidth-e.scrollLeft-e._frozenColumnsNearWidth))}const f=t;f.style.top=o-e.scrollTop-1+"px",f.style.left=c+"px",0===l.visibleIndex&&0===o&&0===e.scrollTop&&(f.style.top="0px"),f.style.height=i+1+"px",f.style.width=s+1+"px",s<5?f.classList.add("smart-visibility-hidden"):f.classList.remove("smart-visibility-hidden")}))}_renderCellSelectionRect(e,t,l,n,o){const i=this;let a=i._recyclingRows;const s=a.indexOf(e),r=a.indexOf(l);if(!(i.grouping.enabled&&"advanced"===i.grouping.renderMode&&i.dataSource&&i.dataSource.groupBy.length>0)&&(i._mobile&&i._mobileSelect,s>=0&&r>=0)){if(!i._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&&n.classList.add(o),i.selection.allowCellDragSelectionHandle&&e&&l.classList.add("handle"),i.$.scrollView.appendChild(n),n},t=i._selection.selectionRect=e(!0);if(i.selection.allowCellDragSelectionHandle){let e=null,l=null,n=null;t.onMove=function(t){const o=i._selection.selectionRect;let s=t.clientX,r=t.clientY;t.touches&&(s=t.touches[0].clientX,r=t.touches[0].clientY);const d=function(e){const t=(i.enableShadowDOM?i.shadowRoot:i.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:i.columnByDataField[l],row:n}};if(o&&o.capturedDrag){let e=d({clientX:s,clientY:r}),l=d({clientX:s,clientY:r+o.top}).row,n=d({clientX:s+o.left,clientY:r}).column;if(l||(l=a[a.length-1]),n||(n=e.column),l&&n&&e.row&&e.column){o.row=e.row,o.rowId=o.row.id,o.column=e.column,o.endDragRow=o.endRow=l,o.endDragColumn=o.endColumn=n,o.endDragRowId=o.endDragRow.id,i._dragSelectionStartDataField=o.column.dataField,i._dragSelectionStartRow=o.row;const t=o.row.getCell(o.column.dataField);i._selection.focusedCell={index:t.row.index,id:t.row.id,dataField:t.column.dataField,value:t.value}}i._resizeSelectionRect(),t.preventDefault()}else if(o&&o.captured)if(i._dragSelectionStartDataField=i._selection.focusedCell.dataField,i._dragSelectionStartRow=i.rowById[i._selection.focusedCell.id],null===l&&null===n&&(Math.abs(s-e.left)>=30?l=!0:Math.abs(r-e.top)>=20&&(n=!0)),o.lastPoint&&Math.abs(o.lastPoint.top-r)>=30?(l=null,n=!0):o.lastPoint&&Math.abs(o.lastPoint.left-s)>=30&&(n=null,l=!0),l){const t=o.endDragColumn.dataField,l=d({clientX:s,clientY:e.top-5});l.row&&l.column&&(o.endDragRow=o.endRow,o.endDragColumn=l.column,o.endDragColumn.dataField!==t&&(o.lastPoint={left:s,top:r}),i._resizeSelectionRect())}else if(n){const t=o.endDragRow,l=d({clientX:e.left-5,clientY:r});l.row&&l.column&&(o.endDragRow=l.row,o.endDragColumn=o.endColumn,o.endDragRow.id&&o.endDragRow.id!==t.id&&(o.lastPoint={left:s,top:r}),i._resizeSelectionRect())}o&&o.captured&&i.selection.allowDragSelectionAutoScroll&&(i._autoScrollSelectionDragInterval&&clearInterval(i._autoScrollSelectionDragInterval),i.selection.isDragging=!0,i._autoScrollSelectionDragInterval=setInterval((function(){const e=i.$.scrollView.getBoundingClientRect();s<=e.left+20?(i.scrollLeft-=15,i._resizeSelectionRect()):s>=e.left+e.width-20&&(i.scrollLeft+=15,i._resizeSelectionRect()),r<=e.top+20?(i.scrollTop-=15,i._resizeSelectionRect()):r>=e.top+e.height-20&&(i.scrollTop+=15,i._resizeSelectionRect())}),25))},t.onUp=function(){if(!t.captured)return;i._autoScrollSelectionDragInterval&&clearInterval(i._autoScrollSelectionDragInterval),i.editing.editCell||i.editing.editRow||i.focus(),t.capturedDrag=!1,t.captured=!1,l=null,n=null,e=null,t.lastPoint=null;const o=t.cellValues;t.minRow&&t.maxRow&&t.maxRow&&t.maxColumn&&(i._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=o,i._resizeSelectionRect(),i.selection.allowCellDragSelectionAutoFill&&i._pasteSelectedCells({row:t.row,endRow:t.endDragRow,column:t.column,endColumn:t.endColumn},o)),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 o={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(o.down="touchstart",o.move="touchmove",o.up="touchend"),t["on"+o.down]=function(e){const l=t.getBoundingClientRect();let n=e.clientX,o=e.clientY;e.touches&&(n=e.touches[0].clientX,o=e.touches[0].clientY),n>=l.right-5&&o>=l.bottom-5?(t.captured=!0,t.endDragRow=t.endRow,t.endDragColumn=t.endColumn):i.selection.allowCellDragDropSelectionHandle&&o>=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||i._rowDownHandler(e)},document.addEventListener(o.move,t.onMove,{passive:!1}),document.addEventListener(o.up,t.onUp,{passive:!1}),document.addEventListener(o.down,t.onDown,{passive:!1})}}const e=i._selection.selectionRect;e.row=i.rowById[i._selection.focusedCell.id],e.rowId=i._selection.focusedCell.id,e.column=i.columnByDataField[i._selection.focusedCell.dataField],e.endRow=l,e.endRowId=l.id,e.endDragRow=l,e.endColumn=n,e.endDragColumn=n,i._refreshCellSelectionRect()}}_resizeSelectionRect(){const e=this,t=e._selection.selectionRect;if(!t)return;let l=e._recyclingRows,n=t.row,o=t.endDragRow,i=t.column,a=t.endDragColumn;const s=e.viewColumns,r=l.indexOf(n),d=l.indexOf(o),c=l.indexOf(t.endRow),u=s.indexOf(i),f=s.indexOf(a),p=s.indexOf(t.endColumn),m=Math.min(c,Math.min(r,d)),g=Math.max(c,Math.max(r,d)),_=Math.min(p,Math.min(u,f)),h=Math.max(p,Math.max(u,f));c<=Math.min(r,d)?t.minRow=t.endRow:t.minRow=r<=d?n:o,c>=Math.max(r,d)?t.maxRow=t.endRow:t.maxRow=r>=d?n:o,p<=Math.min(u,f)?t.minColumn=t.endColumn:t.minColumn=u<=f?i:a,p>=Math.max(u,f)?t.maxColumn=t.endColumn:t.maxColumn=u>=f?i:a;let w=0,y=0,v=0,S=0;for(let e=m;e<=g;e++){const t=l[e];if(t){e===m&&(w=t.top),e===g&&(y=t.top+t.height-w);for(let e=_;e<=h;e++){const l=s[e].dataField,n=t.getCell(l);e===_&&(v=n.column.left),e===h&&(S=n.column.left+n.column.computedWidth-v)}}}t.style.top=w-e.scrollTop-1+"px",0===m&&0===w&&0===e.scrollTop&&(t.style.top="0px"),e._isVirtualMode()&&(t.style.top=w+parseFloat(e.$.rowContainer.style.top)-1+"px"),e.rightToLeft?t.style.right=v-e.scrollLeft+"px":t.style.left=v-e.scrollLeft+"px",t.style.height=y+1+"px",t.style.width=S+1+"px"}_getPatternValue(e,t,l){let n=[],o=0,i=[],a=[],s=[],r=[];const d={names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],namesAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],namesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]},c={names:["January","February","March","April","May","June","July","August","September","October","November","December",""],namesAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""]},u=function(e){if(void 0!==e&&!(e.toString().indexOf("GMT+")>=0||e.toString().indexOf("GMT-")>=0)){if(!isNaN(parseFloat(e)))return/[A-Za-z]/.test(e.toString())?void 0:parseFloat(e);if(d.names.indexOf(e)>=0)return r=d.names,d.names.indexOf(e);if(d.namesAbbr.indexOf(e)>=0)return r=d.namesAbbr,d.namesAbbr.indexOf(e);if(d.namesShort.indexOf(e)>=0)return r=d.namesShort,d.namesShort.indexOf(e);if(c.names.indexOf(e)>=0)return r=c.names,c.names.indexOf(e);if(c.namesAbbr.indexOf(e)>=0)return r=c.namesAbbr,c.namesAbbr.indexOf(e);if(void 0!==e&&(null===e&&(e=""),/\d+/.test(e.toString()))){s.push(e.toString().replace(/[0-9]/,"#")),s[s.length-1]=s[s.length-1].replace(/[0-9]/g,"");const t=parseFloat(e.toString().replace(/\D/g,""));return isNaN(t)?0:t}}};let f=0;for(let e in l){let t=l[e];n[o]=[],f=0;for(let e in t){let l=u(t[e]);void 0!==l&&(n[o].push(l),f++)}if(0===n[o].length)continue;let a=n[o][0],d=0;for(let e=0;e<n[o].length;e++){let t=u(n[o][e-1]),l=u(n[o][e]);0===e&&(t=l),a+=l,d+=l-t}a/=n[o].length,a-=n[o][0],a+=n[o][n[o].length-1],0!==d&&(d/=n[o].length-1),(r.length>0||s.length>0)&&(d=1,a=n[o][0]),n[o].length<=2&&(a=n[o][n[o].length-1]+d),i.push({step:d,stepStart:a}),o++}for(let e=0;e<f;e++){let t=n[0][e],l=0;for(let o=1;o<n.length;o++){const i=u(n[o-1][e]),a=u(n[o][e]);t+=a,l+=a-i}t/=n.length,t-=n[0][e],t+=n[n.length-1][e],0!==l&&(l/=n.length-1),(r.length>0||s.length>0)&&(l=1,t=n[0][e]),n.length<=2&&(t=n[n.length-1][e]+l),a.push({step:l,stepStart:t})}if(!n[e]){let l=n.length;for(let o=l;o<=e;o++){n[o]=[];for(let e=0;e<=t;e++)a[e]||(a[e]=a[e-1]),a[e]&&(o===l?n[o][e]=a[e].stepStart:(n[o][e]=n[o-1][e]+a[e].step,r.length>1&&n[o][e]>=r.length&&(n[o][e]=0)))}return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}if(!n[e][t]){let l=f;for(let o=l;o<=t;o++)i[e]&&(o===l?n[e].push(i[e].stepStart):(n[e][o]=n[e][o-1]+i[e].step,r.length>1&&n[e][o]>=r.length&&(n[e][o]=0)));return r.length>0?r[n[e][t]]:s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]}return n[e]&&n[e][t]?s.length>0?s[e%s.length].replace("#",n[e][t]):n[e][t]:0}_pasteDataType(e){const t=this.dataSource&&"number"==typeof this.dataSource.dataSource,l=e.cell,n=e.value;let o=l.column.dataType;return o&&!t||(o=isNaN(parseFloat(n))?"string":n instanceof Date?"date":"true"===n||"false"===n?"boolean":"number"),o}_getCellEditorDataSource(e){const t=this;if(e.column.editor){if(e.column.editor.dataSource)return e.column._dataSource=e.column.editor.dataSource,e.column.editor.dataSource;switch(e.column.editor.template){case"list":case"dropDownList":case"comboBox":case"autoComplete":case"multiInput":case"checkInput":case"multiComboInput":case"tags":if(!e.editor.dataSource){const l=t.getVisibleRows(),n=[],o=[];for(let i=0;i<l.length;i++){let a=t.dataSource[l[i].index];if(a){if(e.column.displayField!==e.column.dataField){const t=a[e.column.displayField],l=a[e.column.dataField];-1===o.indexOf(t)&&(n.push({label:t,value:l}),o.push(t));continue}if(a=a[e.column.dataField],!a)continue;-1===n.indexOf(a)&&n.push(a)}}return e.column._dataSource=n,n}if(e.column.editor.collaborator){let l=[];for(let e=0;e<t.users.length;e++)l.push({color:t.users[e].color,label:t.users[e].name,id:t.users[e].id,value:t.users[e].id,name:t.users[e].name,image:t.users[e].image});return e.column._dataSource=l,l}}}return null}_pasteModeCopy(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell;let i=e.value;if(i&&"string"==typeof i&&(i=i.replace(/["]/g,"")),o.column.editor&&(o.column.editor.dataSource||t._getCellEditorDataSource(o))&&i){const e=e=>{let l;const n=t._getCellEditorDataSource(o);for(let t=0;t<n.length;t++){const i=n[t];if("string"!=typeof i&&(i.label===e||i.name===e))return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"!=typeof i&&i.label&&i.label.toLowerCase()===e)return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"!=typeof i&&i.value===e)return l=i.value,o.column.editor.collaborator&&(l=i.id),l;if("string"==typeof i&&i===e)return e;if("object"==typeof i&&i.label===e)return i;if("object"==typeof i&&o.column.editor.relationField&&""+e==""+t)return e}return-1};let l=-1;if(i&&-1!==i.indexOf(",")?(l=[],i.split(",").forEach((t=>{const n=e(t.trim());-1!==n&&l.push(n)})),l=l.join(",")):l=e(i),-1!==l&&(i=l),-1===l)return}if(o.column.editor)switch(o.column.editor.template){case"custom":return}let a=i;const s=e.dataField;if(a&&"string"==typeof a&&a.indexOf("[{")>=0&&"image"!==o.column.template&&"attachment"!==o.column.template)return;if(a&&"string"==typeof a&&a.indexOf("<")>=0&&(""===o.column.template&&"string"===n?a=t.clearPaste(a,"text/html","plainText"):"richText"===o.column.template&&"string"===n&&a&&a.indexOf("data-block")>=0||(a=t.clearPaste(a))),a&&"string"==typeof a&&"richText"===o.column.template&&/^(https?:\/\/)?([\w.-]+\.[a-z]{2,})(\/[^\s]*)?$/i.test(a.trim())){const e=document.createElement("a");e.innerHTML=a,e.href=a,e.target="_blank",e.title="Ctrl + Click to open link",a=e.outerHTML}let r=a,d=!1;if("string"===n){if(r=a,r){if((""+r).indexOf("&#")>=0&&(r=t._fromHTMLEntities(r)),(""+r).indexOf("GMT")>=0&&-1===a.indexOf("[{")){const e=new Smart.Utilities.DateTime(r).toString("d");e&&e.length&&(r=e)}"image"!==o.column.editor.template&&"attachment"!==o.column.editor.template&&"textarea"!==o.column.editor.template&&"richText"!==o.column.editor.template&&(r=t._unescapeString(r),o.column.editor.collaborator||(r=r.replaceAll("\\"," ").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/'/g,"&quot;").replace(/[\r\n]+/g," ").replace(/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/gi,(e=>"&#"+e.codePointAt(0)+";"))))}d=!0}else if("bool"===n||"boolean"===n)1!==a&&"1"!==a&&!0!==a&&"true"!==a&&"TRUE"!==a&&"True"!==a||(r=!0,d=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):(r=a,"string"==typeof a&&(r=o&&o.column.cellsFormat&&"string"==typeof a?Smart.Utilities.DateTime.ParseDate(a,o.column.cellsFormat):new Date(a)),o&&"duration"===o.column.template&&(r=[r,r]),d=!0)}else if("number"===n||"float"===n||"int"===n){const e=t.columnByDataField[s];l?(r=a,d=!0):e&&e.dataType!==n?(r=null,d=!0):null!==a?"int"===n||"integer"===n?(r=parseInt(a),d=!0):(r=parseFloat(a),isNaN(r)&&(r=null),d=!0):(r=null,d=!0)}if(!1!==o.column.allowEdit&&!1!==t.editing.enabled||(d=!1),d)if(t.dataSource&&t.dataSource.virtualDataSource){const e={};e[o.column.dataField]=r,t.editing.batch?t._batchUpdateCell(o.row,o.column,r,o.value):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){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let n=0;n<e.length;n++){const i=e[n];l(i,o[n]),t.formulas&&"string"==typeof o[n]&&o[n].startsWith("=")&&/=.+/.test(o[n])?i.formula=t._fromHTMLEntities(o[n]):i.value=o[n],t.flashCell(i.row.id,i.column.dataField)}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([o],[e],[r],(function(e){if(e){const e=t.onRowHistory;t.onRowHistory=null,l(o,r),t.formulas&&"string"==typeof r&&r.startsWith("=")&&/=.+/.test(r)&&-1===r.indexOf("[{")?o.formula=t._fromHTMLEntities(r):o.value=r,t.flashCell(o.row.id,o.column.dataField),t.onRowHistory=e}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const e=Object.assign({},o.row.data),l=Object.assign({},o.row.data);l[o.column.dataField]=r,o.row.updatedDate=new Date,o.row.updatedBy=t.currentUser,t.onRowUpdate([o.row.index],[o.row],[e],[l],(function(e){e&&(o.value=r)}),t)}else t.formulas&&"string"==typeof r&&r.startsWith("=")&&/=.+/.test(r)&&-1===r.indexOf("[{")?o.formula=t._fromHTMLEntities(r):t.editing.batch?t._batchUpdateCell(o.row,o.column,r,o.value):o.value=r,t.flashCell(o.row.id,o.column.dataField)}}_pasteModeFill(e){const t=this,l=t.dataSource&&"number"==typeof t.dataSource.dataSource,n=t._pasteDataType(e),o=e.cell,i=e.selectedValues,a=e.minRowIndex,s=e.minColumnIndex,r=e.currentRowIndex,d=e.currentColumnIndex,c=e.dataField;let u=e.value;if("string"===n)/\d+/.test(u.toString())?(u=t._getPatternValue(r-a,d-s,i),void 0===u&&i[r-a]&&i[r-a][d-s]&&(u=i[r-a][d-s])):(u=t._getPatternValue(r-a,d-s,i),void 0===u&&(u=i[r-a]?i[r-a][d-s]:e.value),void 0===u&&(u=e.value)),void 0!==u&&(o.value=u);else if("bool"===n||"boolean"===n)1!==u&&"1"!==u&&!0!==u&&"true"!==u&&"TRUE"!==u&&"True"!==u||(o.value=!0);else if("date"===n||"time"===n||"dateTime"===n){const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n&&(o.value=null),i[r-a]&&(u=i[r-a][d-s],void 0!==u&&(o.value=u))}else if("number"===n||"float"===n||"int"===n){u=t._getPatternValue(r-a,d-s,i);const e=t.columnByDataField[c];l?o.value=u:e&&e.dataType!==n?o.value=null:o.value=null!==u?"int"===n||"integer"===n?parseInt(u):parseFloat(u):null}}_pasteSelectedCells(e,t){const l=this;l.beginUpdate();let n=l._recyclingRows,o=e.row,i=e.endRow,a=e.column,s=e.endColumn;l._deleteCopyRects();const r=n.indexOf(o),d=n.indexOf(i),c=n.indexOf(e.endRow),u=l.viewColumns,f=u.indexOf(a),p=u.indexOf(s),m=u.indexOf(e.endColumn),g=Math.min(c,Math.min(r,d));let _=Math.max(c,Math.max(r,d)),h=!1,w=Object.keys(t).length;_-g<w&&(_=g+w-1,h=!0);const y=Math.min(m,Math.min(f,p));let v=Math.max(m,Math.max(f,p));if(t[0]){const e=Object.keys(t[0]).length;v-y<e-1&&(v=v+e-1,h=!0)}let S=0,R=0,C=0,x=0;for(let e in t)0===S&&(R+=Object.keys(t[e]).length),S++;let b=!1;l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(b=!0);for(let e=g;e<=_;e++){const o=n[e];if(o){C=0;for(let n=y;n<=v;n++){if(!u[n])continue;const i=u[n].dataField,a=o.getCell(i);let s=0;b&&(s=x);for(let r in t){if(s===x){let d=0,c=t[r];b&&(c=t[s]);for(let s in c){if(C===d){let r=c[s],d=!0;if(t[o.id]&&t[o.id][i]&&(d=!1),d&&"none"!==l.clipboard.autoFillMode){if(!a)continue;const o={value:r,targetValue:a.value,dataField:s,index:a.row.visibleIndex,targetDataField:i,targetRowIndex:e};if(l.clipboard.onPasteValue){l.clipboard.onPasteValue(o);const e=a.value;a.value=o.value,l._setCellUndoRedo(a,e,o.value)}else if(o.cell=a,o.selectedValues=t,o.minRowIndex=g,o.maxRowIndex=_,o.minColumnIndex=y,o.maxColumnIndex=v,o.currentColumnIndex=n,o.currentRowIndex=e,"copy"===l.clipboard.autoFillMode)if(o.value&&(""+o.value).indexOf("<")>=0){const e=document.createElement("textarea");e.value=o.value,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),o.value=e.value,e.remove(),l.focus(),l._pasteModeCopy(o)}),25)}else l._pasteModeCopy(o);else"fillSeries"===l.clipboard.autoFillMode&&l._pasteModeFill(o)}}d++}}s++}C++,C>=R&&(C=0)}x++,x>=S&&(x=0)}}l.endUpdate(!1),h&&l.viewColumns[v]&&l.viewColumns[y]&&n[_]&&n[g]&&l._selectCellsRange(n[g],n[_],l.viewColumns[y].dataField,l.viewColumns[v].dataField),setTimeout((()=>{l._conditionalColors&&l._conditionalColors.update&&(l._conditionalColors.update(),l._recycle(!1))}),100),l._recycle(!1),l._refreshDataFilters()}_refreshCellSelectionRect(){const e=this,t=e._selection.selectionRect;if(e._copyRects&&e._copyRects.length&&e._refreshCopyRects(),!t||t&&t.captured)return;let l=e._recyclingRows,n=t.row,o=t.endRow,i=t.column,a=t.endColumn;const s=e.viewColumns;if(!a||!i)return;if(e._isVirtualMode()){if(n.id!==t.rowId&&!e.rowById[t.rowId])return t.style.height="0px",void(t.style.width="0px");if(n=e.rowById[t.rowId],o=e.rowById[t.endRowId],!o)return}if(!i.allowSelect||!a.allowSelect){if(i===a)return t.style.width="0px",void(t.style.height="0px");{const e=s.indexOf(i),l=s.indexOf(a);i=null,a=null;for(let t=e;t<l;t++){const e=s[t];e.allowSelect&&!i&&(i=e),a=e}if(!i||!a)return t.style.width="0px",void(t.style.height="0px")}}const r=l.indexOf(n),d=l.indexOf(o),c=s.indexOf(i),u=s.indexOf(a);let f=Math.min(r,d),p=Math.max(r,d),m=Math.min(c,u),g=Math.max(c,u);m=Math.max(0,m),f=Math.max(0,f);const _=function(e){const t=l.indexOf(e.row),n=l.indexOf(e.endRow),o=s.indexOf(e.column),i=s.indexOf(e.endColumn);f=Math.min(f,t),f=Math.min(f,n),f=Math.max(0,f),p=Math.max(p,t),p=Math.max(p,n),m=Math.min(m,o),m=Math.min(m,i),m=Math.max(0,m),g=Math.max(g,o),g=Math.max(g,i)},h=e._getParentCell(n,i.dataField),w=e._getParentCell(n,a.dataField),y=e._getParentCell(o,a.dataField),v=e._getParentCell(o,i.dataField);h&&_(h),w&&_(w),y&&_(y),v&&_(v);let S=0,R=0,C=0,x=0;t.cellValues=[];let b=[],F=[];for(let n=f;n<=p;n++){const o=l[n];if(n===f&&(S=o.top,!0!==o.freeze&&"near"!==o.freeze&&(0===S&&(S+=2),S+=e.__frozenNearHeight),"far"===o.freeze&&(S=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight)),n===p){let t=o.top;"far"===o.freeze&&(t=o.top+e.__scrollHeight+e.scrollTop-e._scrollView.hScrollBar.offsetHeight),R=t+o.height-S,!0!==o.freeze&&"near"!==o.freeze&&(R+=e.__frozenNearHeight)}t.cellValues[o.id]=[];const i=e._isUpdating;e._isUpdating=!0,t.style.zIndex="";for(let l=m;l<=g;l++){const n=s[l].dataField,i=o.getCell(n);let a=i?i.value:"";if(void 0===a&&(a=""),s[l].freeze?b.push(s[l]):F.push(s[l]),"tags"===s[l].template)if(null!=a)if("number"==typeof a)a=null;else{const t=a.trim().split(","),n=[];if(s[l].editor&&s[l].editor.dataSource){const o=s[l].editor.collaborator?e.users:s[l].editor.dataSource;for(let e=0;e<t.length;e++)for(let l=0;l<o.length;l++){const i=o[l],a=i.value;if(t[e]===i.value||t[e]===i.id){n.push(i.label||i.name);break}if(a&&(t[e]===a.toLowerCase()||t[e]===i.id)){n.push(i.label||i.name);break}}}a=n.join(", ")}else a=null;else if("createdBy"===s[l].template||"updatedBy"===s[l].template){for(let t=0;t<e.users.length;t++)if(e.users[t].id===o[s[l].template]){a=e.users[t].label||e.users[t].name;break}}else"createdTime"===s[l].template||"createdDate"===s[l].template?(a=o.createdDate,a&&(a=new Smart.Utilities.DateTime(a).toString("d"))):"updatedTime"!==s[l].template&&"updatedDate"!==s[l].template||(a=o.updatedTime,!a)||(a=new Smart.Utilities.DateTime(a).toString("d"));if(i.formula&&(a=i.formula),t.cellValues[o.id][n]=a,l===m&&(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===g){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}let c=!0;-1!==r&&-1!==d||(c=!1),c&&(i.selected=!0)}e._isUpdating=i}if(S-e.scrollTop<e.layout.rowMinHeight&&e.filtering.enabled&&e.filtering.filterRow.visible){const t=S;S=e.layout.rowMinHeight+e.scrollTop,R-=S-t}if(R<=0)t.classList.add("smart-visibility-hidden");else{if(t.classList.remove("smart-visibility-hidden"),0===b.length&&(t.style.zIndex=5),t.style.top=S-e.scrollTop-1+"px",0===f&&0===S&&0===e.scrollTop&&(t.style.top="0px"),e._isVirtualMode(),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;!F.length&&b.length&&(x+=n),x-=n,t.style.left=n+C-e.scrollLeft+"px"}}t.style.height=R+1+"px",t.style.width=x+1+"px",x<0?t.classList.add("smart-visibility-hidden"):t.classList.remove("smart-visibility-hidden")}}_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:parseInt(o.pageX),pageY:parseInt(o.pageY)}),l&&n.$.fireEvent("cellClick",{cell:l,id:t.id,dataField:l.column.dataField,isRightClick:i,originalEvent:o,pageX:parseInt(o.pageX),pageY:parseInt(o.pageY)}),n._recycle(),n._renderInputOverlay(t.id,e,!0),e.preventDefault()},n.appearance.allowCheckBoxesSelectionAnimation&&void 0===l&&n._inputOverlay.classList.add("smart-animate"),requestAnimationFrame((()=>{n._inputOverlay&&n._inputOverlay.classList.add("smart-input-overlay-on")}))}}_selectRow(e,t){const l=this,n=l.rowById[e];if(n&&l.selection.enabled&&(!n.header||"row-resize"!==n.header.style.cursor)){if(t&&(!t.shiftKey||!l._selection.focusedCell)){const t=n.getCell(l.columns[0].dataField);l._selection.focusedCell={index:t.row.index,id:e,dataField:t.column.dataField,value:t.value}}l._lastRowsSelectionRange=null,"extended"===l.selection.mode?l._handleExtendedRowSelection(n,t):"one"===l.selection.mode?n.select():n.selected?n.unselect():n.select()}}_getParentCell(e,t){const l=this;let n=l._recyclingRows;for(let o=0;o<l._cellsMerge.length;o++){const i=l._cellsMerge[o];let a=[],s=[];if(a.push(i.row),i.rowSpan>1){const e=n.indexOf(i.row);if(e>=0)for(let t=e;t<e+i.rowSpan;t++)n[t]&&-1===a.indexOf(n[t])&&a.push(n[t])}if(s.push(i.column.dataField),i.colSpan>1){const e=l.viewColumns,t=e.indexOf(l.columnByDataField[i.column.dataField]);for(let l=t;l<t+i.colSpan;l++)e[l]&&-1===s.indexOf(e[l].dataField)&&s.push(e[l].dataField)}if(a.indexOf(e)>=0&&s.indexOf(t)>=0)return{row:i.row,column:i.column,endRow:a[a.length-1],endColumn:l.columnByDataField[s[s.length-1]]}}if(l._cellRowSpan)for(let o=0;o<l._cellRowSpan.length;o++){const o=e.visibleIndex;let i=-1,a=null;for(let e=0;e<l._cellRowSpan.length;e++){const t=l._cellRowSpan[e];if(o>t[0]&&o<t[1]){i=t[0],a=t[2];break}}if(i>=0&&a===t){const e=n[i];if(e)return{row:e,column:l.columnByDataField[t],endRow:e,endColumn:l.columnByDataField[t]}}}return null}_selectCellsRange(e,t,l,n){const o=this,i=o._selection.selectionRect;if(!e||!t)return;if(o._lastRowsSelectionRange&&o._lastRowsSelectionRange.id===e.id&&o._lastRowsSelectionRange.endId===t.id&&o._lastColumnSelectionRange&&o._lastColumnSelectionRange.dataField===l&&o._lastColumnSelectionRange.endDataField===n)return;o.beginUpdate(),o._clearSelection(),o._lastRowsSelectionRange={id:e.id,endId:t.id},o._lastColumnSelectionRange={dataField:l,endDataField:n},(!i||i&&!i.captured)&&o._selection.focusedCell&&o._renderCellSelectionRect(o.rowById[o._selection.focusedCell.id],o.columnByDataField[o._selection.focusedCell.dataField],o.rowById[o._lastRowsSelectionRange.endId],o.columnByDataField[o._lastColumnSelectionRange.endDataField]);let a=o._recyclingRows;const s=o.viewColumns;let r=-1,d=-1,c=a.indexOf(e),u=a.indexOf(t),f=-1;for(let e=0;e<s.length;e++){const t=s[e];t.allowSelect&&(-1===f&&(f=e),t.dataField===l&&(r=e),t.dataField===n&&(d=e))}if(-1===f)return o.endUpdate(!1),void o._recycle();-1===r?r=f:-1===d&&(d=f);let p=Math.min(c,u),m=Math.max(c,u),g=Math.min(r,d),_=Math.max(r,d);const h=function(e){const t=a.indexOf(e.row),l=a.indexOf(e.endRow),n=s.indexOf(e.column),o=s.indexOf(e.endColumn);p=Math.min(p,t),p=Math.min(p,l),m=Math.max(m,t),m=Math.max(m,l),g=Math.min(g,n),g=Math.min(g,o),_=Math.max(_,n),_=Math.max(_,o)},w=o._getParentCell(e,l),y=o._getParentCell(t,n);if(w&&h(w),y&&h(y),m<0||p<0||g<0||_<0)return o.endUpdate(!1),void o._recycle();for(let e=p;e<=m;e++){const t=a[e];if(t.allowSelect)for(let e=0;e<s.length;e++){const l=s[e];l.allowSelect&&e>=g&&e<=_&&(t.getCell(l.dataField).selected=!0)}}o.endUpdate(!1,!1),o._recycle(!0,!0,!1),o._selectionTimer&&clearTimeout(o._selectionTimer),o._selectionTimer=setTimeout((()=>{o.editing.isEditing||o._recycle(!0,!0,!1)}),50)}_selectRowsRange(e,t,l){const n=this;if(n._lastRowsSelectionRange&&n._lastRowsSelectionRange.id===e.id&&n._lastRowsSelectionRange.endId===t.id)return;if(n._dragDrop&&n._dragDrop.dragDetails)return;n.beginUpdate(),n._clearSelection(),n._lastRowsSelectionRange={id:e.id,endId:t.id};let o=n._recyclingRows;const i=o.indexOf(e),a=o.indexOf(t),s=Math.min(i,a),r=Math.max(i,a);if(r<0)return n.endUpdate(!1),void n._recycle();for(let e=s;e<=r;e++){const t=o[e];t&&t.allowSelect&&(t.selected=!1!==l)}n.endUpdate(!1),n._recycle()}_selectColumnsRange(e,t){const l=this;if(l._lastColumnSelectionRange&&l._lastColumnSelectionRange.dataField===e&&l._lastColumnSelectionRange.endDataField===t)return;if(l._dragDrop&&l._dragDrop.dragDetails)return;l.beginUpdate(),l._clearSelection(),l._lastColumnSelectionRange={dataField:e,endDataField:t};const n=l.viewColumns;let o=-1,i=n.length;for(let l=0;l<n.length;l++){const a=n[l];a.allowSelect&&(a.dataField===e&&(o=l),a.dataField===t&&(i=l))}const a=Math.min(o,i),s=Math.max(o,i);for(let e=0;e<n.length;e++){const t=n[e];t.allowSelect&&e>=a&&e<=s&&(t.selected=!0)}l.endUpdate(!1),l._recycle()}_selectColumn(e,t){const l=this,n=l.columnByDataField[e],o=l.viewColumns;if(!n||!l.selection.enabled||!1===n.allowSelect||!l.selection.allowColumnHeaderSelection)return;if(n&&"col-resize"===n.element.style.cursor)return;let i=!1;if(n&&(n.allowSelect||null===n.allowSelect&&!t)&&(i=!0),i&&t)if("extended"===l.selection.mode){if(t.ctrlKey||t.metaKey||t.shiftKey||(l._rangeSelectionStartColumn=n,l._rangeSelectionEndColumn=n),t.ctrlKey||t.metaKey?n.selected=!n.selected:n.selected=!0,t&&t.shiftKey){l._rangeSelectionStartColumn||(l._rangeSelectionStartColumn=n),l._rangeSelectionEndColumn=n,l._selection.columns=[];const e=o.indexOf(l._rangeSelectionStartColumn),t=o.indexOf(l._rangeSelectionEndColumn),i=Math.min(e,t),a=Math.max(e,t);for(let e=i;e<=a;e++){const t=o[e];t&&!1!==t.allowSelect&&(t.selected=!0)}}}else"one"===l.selection.mode||null===n.selected?n.selected=!0:n.selected=!n.selected}selectAllRows(){const e=this;let t=e.rows;e._selectionColumn._selecting=!0,delete e._areAllRowsSelected,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;if(e._areAllRowsSelected!==this.undefined)return e._areAllRowsSelected;const t=e.getVisibleRows(),l=Object.keys(e._selection.rows).length;if(0===l||l<t.length)return!1;const n=e._getSelectedRows(!0,!1);return n.length>0&&n.length===t.length?(e._areAllRowsSelected=!0,!0):(e._areAllRowsSelected=!1,e._areAllRowsSelected)}_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.autoSaveState()),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&&t._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o)return;if(o&&o.startsWith("_"))return;let e=!0;if(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._lastRowsSelectionRange&&t._lastRowsSelectionRange.id===t._dragSelectionStartRow.id&&t._lastRowsSelectionRange.endId===i.id&&t._lastColumnSelectionRange&&t._lastColumnSelectionRange.dataField===t._dragSelectionStartDataField&&t._lastColumnSelectionRange.endDataField===o)return;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()))}selectCell(e,t){this.select(e,t)}selectRowsByIndex(e){const t=this;e||(e=[]),requestAnimationFrame((()=>{if("extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._isVirtualMode()){let l=[];for(let t=0;t<e.length;t++)l[e[t]]=!0;return t._selection.indexes=l,void t._recycle()}t.beginUpdate();for(let l in e){const n=e[l],o=t.rows[n];o&&t._setSelection(o.id)}t.endUpdate(!1),t._recycle()}))}selectRowsRange(e,t){const l=this,n=l.rowById[e],o=l.rowById[t];n&&o&&(l._selectRowsRange(n,o),l.$.fireEvent("change",{started:!1,finished:!0}),l._refreshSummary())}selectCellsByQuery(e,t){const l=this,n=e?l.findCells(e):t;requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let e in n){const t=n[e][0],o=n[e][1];l._setSelection(t,o)}l.endUpdate(!1),l._recycle()}))}selectRowsByQuery(e,t,l){const n=this,o=n.find(e,t,l).map((e=>e.$.id));o.length&&n.selectRows(o)}selectRow(e){const t=this;"extended"!==t.selection.mode&&"many"!==t.selection.mode&&t._clearSelection(),t._setSelection(e),t._recycle(!1)}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()}))}selectCellsById(e){this.selectCellsByQuery(null,e)}selectCells(e,t){const l=this;e||(e=[]),requestAnimationFrame((()=>{"extended"!==l.selection.mode&&"many"!==l.selection.mode&&l._clearSelection(),l.beginUpdate();for(let n in e)for(let o=0;o<t.length;o++)l._setSelection(e[n],t[o]);l.endUpdate(!1),l._recycle()}))}selectRange(e,t,l,n){const o=this;!function(){const i=new KeyboardEvent("keydown",{shiftKey:!0});requestAnimationFrame((()=>{"extended"!==o.selection.mode&&"many"!==o.selection.mode&&o._clearSelection(),o.beginUpdate(),o._setSelection(e,t),o._setSelection(l,n,i),o.ensureVisible(e,t),o.endUpdate(!1),o._refreshSummary(!1),o._recycle()}))}(),o.$.fireEvent("change",{started:!1,finished:!0})}unselect(e,t){const l=this;if(l._selection){if(l._selection.rows&&l._selection.rows[e]){delete l._selection.rows[e];const t=l.rowById[e];t&&t.unselect()}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}getSelectedRowsData(){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)t.push({});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(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],i=e.rowById[o],a={id:o};i?a.row=i:e._isVirtualMode&&e.rows[n]?a.row=e.rows[n]:e._isVirtualMode&&(a.row=null),t.push(a)}}if(e._selection.columns&&Object.keys(e._selection.columns).length>0){const t=Object.keys(e._selection.columns);l=[];for(let n=0;n<t.length;n++){const o=t[n];l.push({dataField:o,column:e.columnByDataField[o]})}}if(e._selection.cells)for(let t in e._selection.cells)if(t.startsWith("row")){let l=t.replace("row",""),o=null;for(let i in e._selection.cells[t])o=i.replace("column",""),n||(n=[]),n.push({id:l,dataField:o,column:e.columnByDataField[o],row:e.rowById[l]})}return e._selection.focusedCell&&(e._isVirtualMode(),o={index:e._selection.focusedCell.index,id:e._selection.focusedCell.id,dataField:e._selection.focusedCell.dataField}),{rows:t,columns:l,cells:n,focused:o}}focusAndSelect(e,t){const l=this;if(l.focus(),l.selection.enabled&&l.selection.allowCellSelection)l._focusCell(e,t);else{const t=l.rowById[e];if(!t)return;l.beginUpdate(),l._selection.rows=[],l._selection.columns=[],l._selection.cells=[],l._selection.indexes=[],l._setSelection(e),l._selection.focusedCell={id:t.id,value:null,index:t.index,dataField:l.columns[0].dataField},l.endUpdate(!1)}}_focusCell(e,t,l){const n=this;if(n.selection.enabled&&n.selection.allowCellSelection){const o=n.rowById[e];if(!o)return;!1!==l&&(n.beginUpdate(),n._selection.rows=[],n._selection.columns=[],n._selection.cells=[],n._selection.indexes=[],n._setSelection(e,t));const i=o.getCell(t);i&&(n._selection.focusedCell={id:i.row.id,value:i.value,dataField:t,index:i.row.index}),!1!==l&&n.endUpdate(!1)}}_clearSelection(e){const t=this;if(t._selection.rows=[],t._selection.columns=[],t._selection.cells=[],t._selection.indexes=[],e&&(t._selection.focusedCell=null,t._selection.selectionRect)){const e=t._selection.selectionRect;e.parentNode.removeChild(e);const l={down:"pointerdown",move:"pointermove",up:"pointerup"};Smart.Utilities.Core.isMobile&&(l.down="touchstart",l.move="touchmove",l.up="touchend"),document.removeEventListener(l.move,e.onMove),document.removeEventListener(l.up,e.onUp),document.removeEventListener(l.down,e.onDown),t._selection.selectionRect=null}t._recycle(),t._refreshCheckBoxColumnSelection()}_getSelectionCellValues(){const e=this;if(e._selection.selectionRect)return e._selection.selectionRect.cellValues;const t=e.viewColumns;if(e._selection.rows.length>0){let l=[];for(let n in e._selection.rows){const o=e.rowById[n];for(let e=0;e<t.length;e++){const i=t[e];i&&(l[n]||(l[n]=[]),i.autoGenerated||(l[n][i.dataField]=o.data[i.dataField]))}}return l}if(Object.keys(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();if(delete l._cutCells,delete l._cutRows,l.clipboard.copyHeadersToClipboard){let e=[];for(let n in t){for(let o in t[n]){const t=l.columnByDataField[o];t&&(e[o]=t.label,e.length++)}break}e.length&&t.splice(0,0,e)}if(l._selection.selectionRect){l._selection.selectionRect.classList.add("marching-ants");const e=l._selection.selectionRect;l._createCopyRect(e.row.id,e.endDragRow.id,e.column.dataField,e.endColumn.dataField)}else l.hasSelectedRows()&&l._createCopyRects();let n="";if(!t)return;let o=Object.keys(t).length,i=0;for(let a in t){let s="",r=Object.keys(t[a]).length,d=0;for(let e in t[a]){let n=t[a][e];""===n&&(n=`"${n}"`),void 0!==n&&"undefined"!==n&&null!==n||(n='""'),n=l._unescapeString(n),s+=n,d++,d<r&&(s+="\t")}if(n+=s,i++,i<o&&(n+="\r\n"),"x"===e&&l.editing.enabled){const e=l.getSelection();e.cells&&(l._cutCells=e.cells),e.rows&&(l._cutRows=e.rows)}}if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(n).then((function(){}),(function(){})),Smart.Utilities.Core.Browser.Firefox&&(l._clipboardText=n);else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select(),setTimeout((()=>{document.execCommand("copy"),e.remove(),l._clipboardText=n}),25)}}if(t.ctrlKey&&" "===e&&l.editing.addNewRow.visible&&(l._keyboardAdd=!0,l._addNewGridRow(),l._keyboardAddTimer&&clearTimeout(l._keyboardAddTimer),l._keyboardAddTimer=setTimeout((()=>{l._keyboardAdd=!1}),300)),(t.ctrlKey||t.metaKey)&&"v"===e&&l.editing.enabled){const e=window.Smart.Utilities.Core.Browser.Firefox;if(navigator.clipboard&&!navigator.clipboard.readText&&!e)return;const t=e=>{if(!e)return;const t=[];let n=e.trim().split("\r");if(l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(n=e.split("\r")),1===n.length){let t=e.trim().split("\n");l._selection&&l._selection.columns&&Object.keys(l._selection.columns).length>0&&(t=e.split("\n")),t.length>1&&(n=t)}e.indexOf("<")>=0&&(n=[e.trim()]);for(let e=0;e<n.length;e++){const l=n[e].split("\t");let o={};for(let e=0;e<l.length;e++)o[e]=l[e].trim(),void 0!==o[e]&&"undefined"!==o[e]||(o[e]="");t[e]=o}const o=l._selection.selectionRect;if(o)l._pasteSelectedCells({row:o.row,endRow:o.endDragRow,column:o.column,endColumn:o.endColumn},t);else{let e=null,n=null;for(let t in l._selection.rows){const o=l.rowById[t];e||(e=o),n||(n=o),e.visibleIndex>o.visibleIndex&&(e=o),n.visibleIndex<o.visibleIndex&&(n=o)}if(e&&n&&l._pasteSelectedCells({row:e,endRow:n,column:l.firstColumn(),endColumn:l.lastColumn()},t),0===l._selection.rows.length){const o=l.getSelectedCells();let i=null,a=null;for(let t=0;t<o.length;t++){const s=l.rowById[o[t][0]];if(!s)continue;e||(e=s),n||(n=s);const r=l.columnByDataField[o[t][1]];i||(i=a=r),i&&i.visibleIndex>r.visibleIndex&&(i=r),a&&a.visibleIndex<r.visibleIndex&&(a=r),e.visibleIndex>s.visibleIndex&&(e=s),n.visibleIndex<s.visibleIndex&&(n=s)}if(null===e&&null===n&&null===i&&null===a&&Object.keys(l._selection.columns).length>0){e=l.rows[0],n=l.rows[l.rows.length-1];const t=Object.keys(l._selection.columns)[0];i=l.columnByDataField[t],a=i}l._pasteSelectedCells({row:e,endRow:n,column:i,endColumn:a},t)}}l._cutCells&&l._handleCutCells(),l._cutRows&&l._handleCutRows()};if(!window.isSecureContext||e){if(document.activeElement&&"INPUT"===document.activeElement.nodeName)return!0;const e=document.createElement("textarea");return e.style.position="absolute",e.style.left="-1000px",e.style.top="-1000px",document.body.appendChild(e),e.select(),void setTimeout((()=>{l._clipboardSelection=new Array;let n=e.value;0===n.length&&window.clipboardData&&(e.val(window.clipboardData.getData("Text")),n=e.value);let o=n.split("\n");for(let e=0;e<o.length;e++)if(o[e].split("\t").length>0){var i=o[e].split("\t");if(1===i.length&&e===o.length-1&&""===i[0])continue;i.length>0&&l._clipboardSelection.push(i)}l._clipboardText=l._clipboardSelection.toString(),t(n.trim().replaceAll("\n","\r")),e.remove(),l.focus()}),100)}const n=navigator.clipboard.read?"read":"readText";navigator.clipboard[n]().then((e=>{if(Array.isArray(e)&&e.length){const n=e[0];let o=n.types.indexOf("text/html")>-1?"text/html":"text/plain";try{l._deleteCopyRects(),n.types.length&&n.getType(o).then((e=>{e.text().then((e=>{t(e)}))}))}catch(e){console.log(e),l._deleteCopyRects()}}else"string"==typeof e&&t(e)}))}}}_handleCutRows(){const e=this,t=e._cutRows;t.length>=1?t.map((e=>e.id)).forEach((t=>{requestAnimationFrame((()=>{e.updateRow(t,null,null,!0)}))})):delete e._cutRows}_handleCutCells(){const e=this;e.beginUpdate();const t=e._cutCells;if(t){for(let l=0;l<t.length;l++){const n=t[l],o=e.rowById[n.id];if(o){const t=o.getCell(n.dataField),l=e._pasteDataType({cell:t,value:t.value});let i=null;"int"!==l&&"number"!==l||(i=0),"string"===l&&(i=""),"boolean"!==l&&"bool"!==l||(i=!1),"date"===l&&(i=new Date),t.column.allowNull&&(i=null);const a=t.oldValue;if(e.onCellUpdate)e.onCellUpdate([t],[a],[i],(function(e){e&&(t.value=i)}),e);else if(e.onRowUpdate){const l=Object.assign({},t.row.data),n=Object.assign({},t.row.data);n[t.column.dataField]=i,e.onRowUpdate([t.row.index],[t.row],[l],[n],(function(e){e&&(t.value=i)}),e)}else t.value=i}}e.endUpdate(!1),e._recycle(),delete e._cutCells}}_setRemoveUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){t._undoRedo||(t._undoRedo=[]),t._removeUndoRedoHigherIndexes();const n=t.getRowData(e.id);t._undoRedo.push({action:"remove",data:n,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_setAddUndoRedo(e){const t=this;if(!t.isInitialized)return;const l=Smart.Utilities.Core.createGUID().replace(/-/gi,"");if(!t._undoRedoAction){let n=!1;for(let l=0;l<t._undoRedo.length;l++){const o=t._undoRedo[l];"add"===o.action&&o.index===e.index&&(n=!0)}if(n)return;t._removeUndoRedoHigherIndexes();const o=t.getRowData(e.id);t._undoRedo.push({action:"add",data:o,index:e.visibleIndex,uid:l}),t._undoRedoIndex=t._undoRedo.length-1}}_removeUndoRedoHigherIndexes(){const e=this,t=e._undoRedoIndex;t>=0?e._undoRedo.splice(t+1,e._undoRedo.length-t):-1===t&&(e._undoRedo=[])}_setCellUndoRedo(e,t,l){const n=this;if(!n.isInitialized)return;const o=Smart.Utilities.Core.createGUID().replace(/-/gi,"");n._setCellUndoRedoTimer&&clearTimeout(n._setCellUndoRedoTimer),n._undoRedoAction||(n._pasteUndoRedoValues||(n._pasteUndoRedoValues=[]),void 0===t&&(t=null),n._pasteUndoRedoValues.push({cell:e,index:e.row.index,dataField:e.column.dataField,oldValue:t,newValue:l}),n._setCellUndoRedoTimer=setTimeout((()=>{delete n._setCellUndoRedoTimer,n._removeUndoRedoHigherIndexes(),n._undoRedo||(n._undoRedo=[]),n._pasteUndoRedoValues.length>1?n._undoRedo.push({action:"updateMultiple",items:n._pasteUndoRedoValues,uid:o}):n._undoRedo.push({action:"update",index:e.row.visibleIndex,cell:e,dataField:e.column.dataField,oldValue:t,newValue:l,uid:o}),n._undoRedoIndex=n._undoRedo.length-1,n._pasteUndoRedoValues=[]}),50))}_undoRedoHandler(e){const t=this,l=e.key;if(e.ctrlKey||e.metaKey){if("z"===l)return t.undo(),void e.preventDefault();if("y"===l)return t.redo(),void e.preventDefault()}}_updateMultiple(e,t){const l=this;let n=9999999,o=0,i=999999,a=0,s=l._recyclingRows,r=[],d=[],c=[];l.beginUpdate();for(let u=0;u<e.items.length;u++){const f=e.items[u],p=s[f.index];if(p){const e=p.id,s=f.dataField,u=t?f.oldValue:f.newValue,m=l.columnByDataField[s],g=l.viewColumns.indexOf(m),_=p.getCell(s);_&&(r.push(_),d.push(_.value),c.push(u)),i=Math.min(i,g),a=Math.max(a,g),n=Math.min(n,p.visibleIndex),o=Math.max(o,p.visibleIndex),l.setCellValue(e,s,u)}}l.onCellUpdate&&r.length&&l.onCellUpdate(r,d,c,(function(){}),l),l._focusCell(s[n].id,l.viewColumns[i].dataField),l._selectCellsRange(s[n],s[o],l.viewColumns[i].dataField,l.viewColumns[a].dataField),delete l._undoRedoAction,l.endUpdate(!1)}redo(){const e=this,t=e._undoRedoIndex,l=e._undoRedo[t+1];if(l)switch(e._undoRedoIndex++,e._undoRedoAction=!0,l.action){case"add":e.addRow(l.data,!0);break;case"remove":{const t=e._recyclingRows[l.index];t&&(e.removeRow(t.id),delete e._undoRedoAction);break}case"update":{const t=e.rows[l.index];if(t){const n=t.id,o=l.dataField,i=l.newValue,a=l.oldValue,s=t.getCell(o);s&&(e.setCellValue(n,o,i),e._focusCell(n,o),e.onCellUpdate&&e.onCellUpdate([s],[a],[i],(function(){e.onCellUpdated&&e.onCellUpdated([s.row.index],[s.row],[s.column],[s.row.data],[a],[i],e),e._onCellUpdated&&e._onCellUpdated(s.row.index,s.row,s.column,s.row.data,a,i)}),e))}delete e._undoRedoAction;break}case"updateMultiple":e._updateMultiple(l,!1)}else delete e._undoRedoAction}getEditChanges(){return this._undoRedo}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;let a=e._cellsUpdatedValues?e._cellsUpdatedValues[n+"_"+o]:void 0;void 0!==a&&delete e._cellsUpdatedValues[n+"_"+o];const s=t.getCell(o);s&&(void 0===a&&(a=s.value),e.setCellValue(n,o,i),e._focusCell(n,o),e.onCellUpdate&&e.onCellUpdate([s],[a],[i],(function(){e.onCellUpdated&&e.onCellUpdated([s.row.index],[s.row],[s.column],[s.row.data],[a],[i],e),e._onCellUpdated&&e._onCellUpdated(s.row.index,s.row,s.column,s.row.data,a,i)}),e))}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("CapsLock"===l)return;if("Escape"===l&&(t.editing.editRow||t.editing.editCell)){t.closeMenu(),t.cancelEdit();let l=t.getSelection().focused;return void(l&&l.dataField&&t._setSelection(l.id,l.dataField,e))}if(!t.editing.editKeyHandling&&(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 t.menu&&t.menu.classList.contains("open")&&"Escape"===l&&t.closeMenu(),void(n.columns&&n.columns.length>0&&e.ctrlKey&&("c"!==l&&"v"!==l&&"x"!==l||t._clipboardHandler(l,e)))}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),e.ctrlKey||e.metaKey){const n=t.$.headerBar;n&&("b"===l&&(n._boldCommand(),e.preventDefault()),"i"===l&&(n._italicCommand(),e.preventDefault()),"u"===l&&(n._underlineCommand(),e.preventDefault()),"y"===l&&(n._strikethroughCommand(),e.preventDefault()))}if(t._clipboardHandler(l,e),((e.ctrlKey||e.metaKey)&&"x"!==l&&"c"!==l&&"v"!==l&&"Control"!==l||t.selection.allowCellSelection&&"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),"f"===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()}"ArrowDown"===e.key||"ArrowUp"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key?(t._setSelection(l,n,e),t.ensureVisible(l,n)):(t.beginUpdate(),t._setSelection(l,n,e),t.ensureVisible(l,n),t.endUpdate(!1,!1),"ArrowDown"===e.key||"ArrowUp"===e.key?t._recycle(!1,!0):t._recycle()),e.shiftKey?t.__selectionStarted&&!t.__selectionStartedFired?(t.$.fireEvent("change",{started:!0,finished:!1}),t.__selectionStartedFired=!0):t.$.fireEvent("change",{started:!1,finished:!1}):(t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary())};if(t._isVirtualMode()){t._keyboardNavigationTimer&&clearTimeout(t._keyboardNavigationTimer);const e=e=>{for(let l=0;l<t.rows.length;l++){const n=t.rows[l];if(n.index===e)return n.id}return null},i=l,a=JSON.parse(JSON.stringify(t._selection.focusedCell));t._selection.focusedCell.index=i,t._selection.focusedCell.dataField=n;const s=t.rows[0],r=s.height;if(-1===i)return;const d=t._scrollView.hScrollBar,c="virtual"!==t.scrolling?s.top:i*r;let u=0;if(t.paging.enabled||(c+d.offsetHeight+t.__frozenNearHeight>t._scrollView.scrollTop+t.$.scrollView.offsetHeight-t.__frozenFarHeight?(t._scrollView.scrollTop=c-t.$.scrollView.offsetHeight-t.__frozenFarHeight+d.offsetHeight,u=50):c<=t._scrollView.scrollTop&&(t._scrollView.scrollTop=c,u=50)),t._onDataUpdated||(t._onDataUpdated=()=>{t._recycle();const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t.paging.enabled&&(t._selection.focusedCell=a),t._onDataUpdated=null}),t.paging.enabled){const l=e(t._selection.focusedCell.index);t.rowById[l]?o(l,t._selection.focusedCell.dataField):t._selection.focusedCell=a}else t._keyboardNavigationTimer=setTimeout((()=>{const l=e(t._selection.focusedCell.index);t.rowById[l]&&o(l,t._selection.focusedCell.dataField)}),u)}else requestAnimationFrame((()=>{o(l,n)})),e.stopPropagation(),e.preventDefault()};if(t.keys&&t.keys[l]){const n=t.keys[l];switch(n){case"delete":if(o){const l=o.id,n=t.rowById[l];if(n)return t.updateRow(l,null,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l,dataField:null,row:n,column:null,cell:null,data:n?n.data:null,value:null})}break;case"deleteCell":if(o){const l=o.id,n=t.rowById[l],i=o.dataField;if(n){const o=t.columnByDataField[i];return void(o.allowEdit&&(t.setCellValue(l,i,""),e.stopPropagation(),e.preventDefault(),t.$.fireEvent("endEdit",{id:l,dataField:i,row:n,column:o,cell:n?n.getCell(i):null,data:n?n.data:null,value:null})))}}break;case"copy":case"copyPrev":case"copyNext":if(o){const l=o.id,i=t.rowById[l];if(i){if("copy"===n)return t._clipboardHandler("c",e),e.stopPropagation(),void e.preventDefault();if("copyPrev"===n){const l=t.prevRow(o.id);if(l)return t.updateRow(l.id,i.data,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l.id,dataField:null,row:l,column:null,cell:null,data:i?i.data:null,value:null})}else if("copyNext"===n){const l=t.nextRow(o.id);if(l)return t.updateRow(l.id,i.data,null,!0),e.stopPropagation(),e.preventDefault(),void t.$.fireEvent("endEdit",{id:l.id,dataField:null,row:l,column:null,cell:null,data:i?i.data:null,value:null})}}}break;default:if(["Backspace","Tab","Enter","Shift","Control","Alt","Pause","CapsLock","Escape","Space","PageUp","PageDown","End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Insert","Delete","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","NumLock","ScrollLock","Semicolon","Equal","Comma","Minus","Period","Slash","Backquote","BracketLeft","Backslash","BracketRight","Quote"].indexOf(n)>=0)l=n;else{const l=o.id,i=t.rowById[l];if(t[n]&&"function"==typeof t[n])return t[n](t,i,e),e.stopPropagation(),void e.preventDefault();if(window[n]&&"function"==typeof window[n])return window[n](t,i,e),e.stopPropagation(),void e.preventDefault();if("function"==typeof n)return n(t,e),e.stopPropagation(),void e.preventDefault()}}t.$.fireEvent("keyPressed",e)}switch("Enter"!==l||!t.editing.enabled||"cell"!==t.editing.mode||t.editing.isEditing||t._editDownKey||(l="F2"),l){case"Tab":{if("none"===t.selection.tabKeyBehavior)return;const l=e.shiftKey?t.prevColumn(o.dataField):t.nextColumn(o.dataField);if(l&&t.selection.allowCellSelection){const n=t.rowById[o.id].getCell(l.dataField);t._selection.focusedCell={id:n.row.id,value:n.value,dataField:l.dataField,index:n.row.index},t._setSelection(o.id,l.dataField,e),t.ensureVisible(o.id,l.dataField),t.focus(),e.stopPropagation(),e.preventDefault()}else{let l=e.shiftKey?t.prevRow(o.id):t.nextRow(o.id),n=e.shiftKey?t.lastColumn().dataField:t.firstColumn().dataField;if(t.editing.addNewRow.autoCreate&&!e.shiftKey&&o.id===t.lastRow().id&&(t.addUnboundRow(1),l=t.lastRow()),!l)return;e.shiftKey&&(t._selection.focusedCell=null),a(t._isVirtualMode()?l.index:l.id,n)}t.$.fireEvent("change",{started:!1,finished:!0}),t._refreshSummary();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();const e=l[0],o=e[1],a=e[0],s=e[2],r=t.columnByDataField[o];t.$.fireEvent("beginEdit",{id:null,dataField:o,row:a,column:r,cell:null,data:null,value:s});const d=[],c=[],u=[],f=[],p=[];for(let e=0;e<l.length;e++){const n=l[e],o=n[1],i=n[0],a=n[2],s=t.rowById[i],m=s.getCell(o);p.push(s),f.push(t.columnByDataField[r]),u.push(m),c.push(!a),d.push(a),t.setCellValue(i,o,!a)}t.onCellUpdate&&t.onCellUpdate(u,d,c,(function(){}),t),t.$.fireEvent("endEdit",{id:n?n.id:null,dataField:o,row:n,column:r,cell:e,data:n?n.data:null,value:!s}),t.endUpdate(!1)}}i||(t._beginEdit(n,o.dataField),setTimeout((function(){if(t.editing.editCell&&t.editing.editCell.column.dataType.indexOf("bool")>=0){const e=t.editing.editCell.editor.instance,n=e.getValue();" "===l&&e.setValue(!n)}}),50))}else t.selection.enabled&&"many"===t.selection.mode&&(t._isVirtualMode()?a(o.index,o.dataField):a(o.id,o.dataField));break}case"Delete":case"Backspace":{const e=t.rowById[o.id];if(!e||t.editing.editCell)return;if(t.editing.enabled)if(e.getCell(o.dataField).value,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;if("image"===e.column.template){const l=e.value,n=l&&l.indexOf("[{")>=0?JSON.parse(l):[];for(let e=0;e<n.length;e++){if(t.uploadSettings.removeUrl){let l=new FormData,o=new XMLHttpRequest,i=n[e].value;l.append(t.uploadSettings.name,i),o.open("POST",t.uploadSettings.removeUrl),o.send(l)}t.uploadSettings.onUploadRemove&&t.uploadSettings.onUploadRemove(n[e])}}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),e.formula=null;const a=e.value;if(t.dataSource&&t.dataSource.virtualDataSource){const n={};if(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){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([e],[a],[n],(function(o){if(o){const o=t.onRowHistory;t.onRowHistory=null,l(e,n),e.value=n,t.onRowHistory=o}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else n[e.column.dataField]=i;t.editing.batch?t._batchUpdateCell(e.row,e.column,i,e.value):t.updateRow(e.row.id,n)}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){const n=t.onRowHistory;t.onRowHistory=null,t.beginUpdate();for(let t=0;t<e.length;t++){const n=e[t];l(n,o[t]),n.value=o[t]}t.endUpdate(!1),t.onRowHistory=n}}),t)}else t.onCellUpdate([e],[a],[n],(function(o){if(o){const o=t.onRowHistory;t.onRowHistory=null,l(e,n),e.value=n,t.onRowHistory=o}}),t);delete t._pasteTempValues}),100)}else if(t.onRowUpdate){const l=Object.assign({},e.row.data),n=Object.assign({},e.row.data);n[e.column.dataField]=i,t.onRowUpdate(e.row.index,e.row,l,n,(function(t){t&&(e.value=i)}),t)}else e.value=i;t._conditionalColors&&t._conditionalColors.update&&setTimeout((()=>{t._conditionalColors.update(),t._recycle(!1)}),100)}}t.endUpdate(!1),t._recycle(),t._refreshDataFilters()}else{const e=t._getSelectedRows();if(e&&e.length&&t._selection.rows&&Object.keys(t._selection.rows).length>0){const e=t.getSelectedRows();if(e.length>=1)return void e.map((e=>e[0])).forEach((e=>{requestAnimationFrame((()=>{t.updateRow(e,null,null,!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._beginEditKey=l,t._beginEdit(e,o.dataField),setTimeout((function(){if(t.editing.editCell)t.editing.editCell.editor.instance.setValue(t._beginEditKey);else if(t.editing.editRow){const e=t.editing.editRow.getCell(o.dataField);if(!e)return;e.editor.instance.setValue(t._beginEditKey)}delete t._beginEditKey}),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"Enter":case"ArrowDown":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]&&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]&&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()),!t.onKeyUp||(t.onKeyUp(e),e.defaultPrevented))}firstRow(){const e=this._recyclingRows;if(this._isVirtualMode())return{id:0};if(e&&e.length>0){if(!e[0].autoGenerated&&e[0].allowSelect)return e[0];for(let t=0;t<e.length;t++)if(!e[t].autoGenerated&&e[t].allowSelect)return e[t]}return null}lastRow(){const e=this,t=e._recyclingRows;if(e._isVirtualMode())return{id:e.dataSource.virtualDataSourceLength-1};if(t&&t.length>0){const e=t[t.length-1];if(!e.autoGenerated&&e.allowSelect)return e;for(let e=t.length-1;e>=0;e--)if(!t[e].autoGenerated&&t[e].allowSelect)return t[e]}return null}nextRow(e){const t=this._recyclingRows,l=this.rowById[e],n=t.indexOf(l);let o=1;if(l&&void 0!==l._rowSpan&&(o=l._rowSpan),n>=0&&t[n+o]&&!t[n+o].autoGenerated){const e=t[n+o];if(e.allowSelect&&!e.disabled)return e;for(let e=n+o;e<t.length;e++){const l=t[e];if(l.allowSelect&&!l.disabled)return l}}return null}_isVirtualMode(){const e=this;return e.dataSource&&e.dataSource.virtualDataSource&&!e.dataSource.virtualDataSourceOnExpand&&e.dataSource.length>e.virtualModeCachedRowsCount&&"infinite"!==e.scrolling}prevRow(e){const t=this,l=t._recyclingRows,n=t.rowById[e],o=l.indexOf(n);if(t._isVirtualMode())return 0===e?null:{id:n.index-1};if(o>=0&&l[o-1]&&!l[o-1].autoGenerated){const e=l[o-1];if(e.allowSelect&&!e.disabled)return e;for(let e=o-1;e>=0;e--){const t=l[e];if(t.allowSelect&&!t.disabled)return t}}return null}firstColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=0;t<e.length;t++){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}lastColumn(){const e=this.viewColumns;if(e&&e.length>0)for(let t=e.length-1;t>=0;t--){const l=e[t];if(l.allowSelect&&!l.autoGenerated)return l}return null}nextColumn(e){const t=this.viewColumns,l=this.columnByDataField[e];let n=t.indexOf(l);for(;n<t.length;){const e=t[n+1];if(!e)return null;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}isJSON(e){if("string"!=typeof e)return!1;const t=e.trim();if(!t)return!1;if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{const e=new Function("return "+t)();return e&&"object"==typeof e}catch(e){return!1}return!1}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.hasAttribute("tree")?n===t.getViewRows().length-1&&(t._scrollView.scrollTop=t._scrollView.scrollHeight):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),e.left<=t._frozenColumnsNearWidth+t._scrollView.scrollLeft&&!e.freeze&&t._frozenNearColumns.length>1&&(t._scrollView.scrollLeft=e.left-t._frozenColumnsNearWidth),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)}clearPaste(e,t="text/html",l="keepFormat"){let n;if(e=e.replace(/<!--StartFragment-->|<!--EndFragment-->/gi,""),!t||"plainText"===l){const t=document.createElement("div");t.innerHTML=e,e=t.innerText}const o=e.toLocaleLowerCase();if(n=document.createElement("span"),e=(e=>{let t=document.createElement("div");t.innerHTML=e,["o:p","w:","v:","xml"].forEach((e=>{let l=t.getElementsByTagName(e);for(;l.length>0;)l[0].remove()})),t.querySelectorAll("b").forEach((e=>e.outerHTML=e.outerHTML.replace("<b","<strong").replace("</b>","</strong>"))),t.querySelectorAll("i").forEach((e=>e.outerHTML=e.outerHTML.replace("<i","<em").replace("</i>","</em>"))),t.querySelectorAll("*[style]").forEach((e=>{const t=["color","background-color","font-weight","font-style"],l=e.getAttribute("style");if(l){let n="";l.split(";").forEach((e=>{let[l,o]=e.split(":");l=l&&l.trim(),o=o&&o.trim(),t.includes(l)&&(n+=`${l}: ${o}; `)})),n.trim()?e.setAttribute("style",n.trim()):e.removeAttribute("style")}})),t.innerHTML=t.innerHTML.replace(/\r?\n|\r/g," "),t.innerHTML=t.innerHTML.replace(/(<br\s*\/?>\s*){2,}/g,"<br>"),t.innerHTML=t.innerHTML.replace(/(<p>(\s|&nbsp;)*<\/p>\s*){2,}/g,"<p></p>"),t.innerHTML=t.innerHTML.replace(/(\s|&nbsp;){2,}/g," "),t.innerHTML=t.innerHTML.replace(/>\s+</g,"><"),t.innerHTML=t.innerHTML.replaceAll("·",""),t.innerHTML=t.innerHTML.replaceAll('class="MsoNormal"',""),t.innerHTML=t.innerHTML.replace(/<!--.*?-->/gs,""),["div","span"].forEach((e=>{let l=t.getElementsByTagName(e);Array.from(l).forEach((e=>{let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}))})),t.querySelectorAll("p, div, span").forEach((e=>{e.textContent.trim()||e.querySelector("img")||e.querySelector("a")||e.remove()}));let l=t.innerHTML;return l.replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2013/g,"-").replace(/\u2014/g,"--").replace(/\u2026/g,"...").replace(/\u00A0/g," ").replace(/\uFEFF/g,"").replace(/[\u200B-\u200D]/g,"").replace(/[\u202A-\u202E]/g,""),l})(e),n.innerHTML=e,o.indexOf("<video")>-1||o.indexOf("<iframe")>-1||o.indexOf("smart-editor-image-caption")>-1){const e=n.querySelectorAll("video, iframe"),t=n.querySelector(".smart-editor-image-caption"),l=e.length>0;let o=document.createDocumentFragment();for(let t=0,l=e.length;t<l;t+=1)o.appendChild(e[t]);if(t&&(t.removeAttribute("style"),o.appendChild(t)),l||t){const e=document.createElement("span");n.classList.add("smart-editor-image-container"),l&&n.classList.add("smart-editor-video-container"),n.setAttribute("contenteditable",!1),o.childElementCount&&(n.innerHTML="",n.appendChild(o)),e.appendChild(n),n=e}}return"keepFormat"===l&&(e=>{if(e&&e.nodeType!==Node.TEXT_NODE){const t=e.querySelectorAll("style, [style]");for(let e=0,l=t.length;e<l;e+=1){const l=t[e];"style"===l.nodeName.toLowerCase()?l.remove():t[e].removeAttribute("style")}e.removeAttribute("style")}})(n),n.innerHTML}clearSelection(){const e=this;delete e._rangeSelectionStartRow,delete e._rangeSelectionEndRow,delete e._areAllRowsSelected,e._clearSelection(!0),e.$.fireEvent("change",{started:!1,finished:!0}),e._refreshSummary()}});
@@ -1,5 +1,5 @@
1
1
 
2
- /* Smart UI v25.0.0 (2025-11-26)
2
+ /* Smart UI v25.0.1 (2025-11-26)
3
3
  Copyright (c) 2011-2024 jQWidgets.
4
4
  License: https://htmlelements.com/license/ */ //
5
5