smart-webcomponents-react 11.0.55 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/index.d.ts +34 -0
  2. package/kanban/kanban.d.ts +16 -0
  3. package/kanban/kanban.esm.js +50 -1
  4. package/kanban/kanban.umd.js +50 -1
  5. package/package.json +1 -1
  6. package/source/modules/smart.accordion.js +1 -1
  7. package/source/modules/smart.array.js +1 -1
  8. package/source/modules/smart.breadcrumb.js +1 -1
  9. package/source/modules/smart.button.js +1 -1
  10. package/source/modules/smart.buttongroup.js +1 -1
  11. package/source/modules/smart.calendar.js +3 -3
  12. package/source/modules/smart.card.js +1 -1
  13. package/source/modules/smart.cardview.js +6 -6
  14. package/source/modules/smart.carousel.js +1 -1
  15. package/source/modules/smart.chart.js +3 -3
  16. package/source/modules/smart.checkbox.js +1 -1
  17. package/source/modules/smart.checkinput.js +2 -2
  18. package/source/modules/smart.chip.js +1 -1
  19. package/source/modules/smart.colorinput.js +2 -2
  20. package/source/modules/smart.colorpanel.js +1 -1
  21. package/source/modules/smart.colorpicker.js +1 -1
  22. package/source/modules/smart.combobox.js +1 -1
  23. package/source/modules/smart.common.js +4 -4
  24. package/source/modules/smart.countryinput.js +2 -2
  25. package/source/modules/smart.dateinput.js +3 -3
  26. package/source/modules/smart.daterangeinput.js +3 -3
  27. package/source/modules/smart.datetimepicker.js +3 -3
  28. package/source/modules/smart.dockinglayout.js +1 -1
  29. package/source/modules/smart.dropdownbutton.js +1 -1
  30. package/source/modules/smart.dropdownlist.js +1 -1
  31. package/source/modules/smart.editor.js +3 -3
  32. package/source/modules/smart.element.js +1 -1
  33. package/source/modules/smart.fileupload.js +1 -1
  34. package/source/modules/smart.form.js +2 -2
  35. package/source/modules/smart.formulaparser.js +1 -1
  36. package/source/modules/smart.ganttchart.js +7 -7
  37. package/source/modules/smart.gauge.js +2 -2
  38. package/source/modules/smart.grid.js +18 -18
  39. package/source/modules/smart.gridpanel.js +6 -6
  40. package/source/modules/smart.input.js +2 -2
  41. package/source/modules/smart.kanban.js +9 -9
  42. package/source/modules/smart.layout.js +1 -1
  43. package/source/modules/smart.led.js +1 -1
  44. package/source/modules/smart.listbox.js +1 -1
  45. package/source/modules/smart.listmenu.js +1 -1
  46. package/source/modules/smart.map.js +1 -1
  47. package/source/modules/smart.maskedtextbox.js +2 -2
  48. package/source/modules/smart.menu.js +1 -1
  49. package/source/modules/smart.multicomboinput.js +3 -3
  50. package/source/modules/smart.multiinput.js +2 -2
  51. package/source/modules/smart.multilinetextbox.js +1 -1
  52. package/source/modules/smart.multisplitbutton.js +1 -1
  53. package/source/modules/smart.numberinput.js +2 -2
  54. package/source/modules/smart.numerictextbox.js +1 -1
  55. package/source/modules/smart.pager.js +2 -2
  56. package/source/modules/smart.passwordinput.js +2 -2
  57. package/source/modules/smart.passwordtextbox.js +2 -2
  58. package/source/modules/smart.path.js +1 -1
  59. package/source/modules/smart.phoneinput.js +2 -2
  60. package/source/modules/smart.pivottable.js +6 -6
  61. package/source/modules/smart.progressbar.js +1 -1
  62. package/source/modules/smart.querybuilder.js +4 -4
  63. package/source/modules/smart.radiobutton.js +1 -1
  64. package/source/modules/smart.rating.js +1 -1
  65. package/source/modules/smart.router.js +2 -2
  66. package/source/modules/smart.scheduler.js +6 -6
  67. package/source/modules/smart.scrollbar.js +1 -1
  68. package/source/modules/smart.slider.js +2 -2
  69. package/source/modules/smart.sortable.js +1 -1
  70. package/source/modules/smart.splitter.js +1 -1
  71. package/source/modules/smart.switchbutton.js +1 -1
  72. package/source/modules/smart.table.js +6 -6
  73. package/source/modules/smart.tabs.js +1 -1
  74. package/source/modules/smart.tank.js +2 -2
  75. package/source/modules/smart.textarea.js +2 -2
  76. package/source/modules/smart.textbox.js +1 -1
  77. package/source/modules/smart.timeinput.js +2 -2
  78. package/source/modules/smart.timepicker.js +1 -1
  79. package/source/modules/smart.toast.js +1 -1
  80. package/source/modules/smart.tooltip.js +1 -1
  81. package/source/modules/smart.tree.js +1 -1
  82. package/source/modules/smart.validator.js +1 -1
  83. package/source/modules/smart.window.js +1 -1
  84. package/source/smart.accordion.js +1 -1
  85. package/source/smart.ajax.js +1 -1
  86. package/source/smart.array.js +1 -1
  87. package/source/smart.bootstrap.js +1 -1
  88. package/source/smart.breadcrumb.js +1 -1
  89. package/source/smart.button.js +1 -1
  90. package/source/smart.buttongroup.js +1 -1
  91. package/source/smart.calendar.js +1 -1
  92. package/source/smart.card.js +1 -1
  93. package/source/smart.cardview.js +1 -1
  94. package/source/smart.carousel.js +1 -1
  95. package/source/smart.chart.annotations.js +1 -1
  96. package/source/smart.chart.api.js +1 -1
  97. package/source/smart.chart.core.js +1 -1
  98. package/source/smart.chart.js +1 -1
  99. package/source/smart.chart.rangeselector.js +1 -1
  100. package/source/smart.chart.waterfall.js +1 -1
  101. package/source/smart.checkbox.js +1 -1
  102. package/source/smart.checkinput.js +1 -1
  103. package/source/smart.chip.js +1 -1
  104. package/source/smart.colorinput.js +1 -1
  105. package/source/smart.colorpanel.js +1 -1
  106. package/source/smart.colorpicker.js +1 -1
  107. package/source/smart.combobox.js +1 -1
  108. package/source/smart.complex.js +1 -1
  109. package/source/smart.core.js +1 -1
  110. package/source/smart.countryinput.js +1 -1
  111. package/source/smart.data.js +2 -2
  112. package/source/smart.date.js +2 -2
  113. package/source/smart.dateformatpanel.js +1 -1
  114. package/source/smart.dateinput.js +1 -1
  115. package/source/smart.daterangeinput.js +1 -1
  116. package/source/smart.datetimepicker.js +2 -2
  117. package/source/smart.dockinglayout.js +1 -1
  118. package/source/smart.draw.js +1 -1
  119. package/source/smart.dropdownbutton.js +1 -1
  120. package/source/smart.dropdownlist.js +1 -1
  121. package/source/smart.editor.js +1 -1
  122. package/source/smart.element.js +1 -1
  123. package/source/smart.elements.js +18 -18
  124. package/source/smart.export.js +2 -2
  125. package/source/smart.fileupload.js +1 -1
  126. package/source/smart.filter.js +1 -1
  127. package/source/smart.filterbuilder.js +1 -1
  128. package/source/smart.filterpanel.js +1 -1
  129. package/source/smart.form.js +1 -1
  130. package/source/smart.format.js +1 -1
  131. package/source/smart.formulaparser.js +1 -1
  132. package/source/smart.ganttchart.js +1 -1
  133. package/source/smart.gauge.js +1 -1
  134. package/source/smart.grid.cell.js +2 -2
  135. package/source/smart.grid.chart.js +1 -1
  136. package/source/smart.grid.column.js +2 -2
  137. package/source/smart.grid.core.js +2 -2
  138. package/source/smart.grid.dialog.js +2 -2
  139. package/source/smart.grid.edit.js +2 -2
  140. package/source/smart.grid.export.js +1 -1
  141. package/source/smart.grid.filter.js +1 -1
  142. package/source/smart.grid.group.js +1 -1
  143. package/source/smart.grid.js +1 -1
  144. package/source/smart.grid.menu.js +1 -1
  145. package/source/smart.grid.pager.js +1 -1
  146. package/source/smart.grid.reorder.js +1 -1
  147. package/source/smart.grid.resize.js +2 -2
  148. package/source/smart.grid.row.js +2 -2
  149. package/source/smart.grid.select.js +2 -2
  150. package/source/smart.grid.sort.js +1 -1
  151. package/source/smart.grid.toolbar.js +2 -2
  152. package/source/smart.grid.tree.js +1 -1
  153. package/source/smart.grid.view.js +2 -2
  154. package/source/smart.gridpanel.js +2 -2
  155. package/source/smart.input.js +2 -2
  156. package/source/smart.kanban.js +2 -2
  157. package/source/smart.layout.js +1 -1
  158. package/source/smart.led.js +1 -1
  159. package/source/smart.listbox.js +1 -1
  160. package/source/smart.listmenu.js +1 -1
  161. package/source/smart.map.js +1 -1
  162. package/source/smart.maskedtextbox.js +1 -1
  163. package/source/smart.math.js +1 -1
  164. package/source/smart.menu.js +1 -1
  165. package/source/smart.multicomboinput.js +2 -2
  166. package/source/smart.multiinput.js +1 -1
  167. package/source/smart.multilinetextbox.js +1 -1
  168. package/source/smart.multisplitbutton.js +1 -1
  169. package/source/smart.numberformatpanel.js +1 -1
  170. package/source/smart.numberinput.js +1 -1
  171. package/source/smart.numeric.js +1 -1
  172. package/source/smart.numerictextbox.js +1 -1
  173. package/source/smart.pager.js +1 -1
  174. package/source/smart.passwordinput.js +1 -1
  175. package/source/smart.passwordtextbox.js +1 -1
  176. package/source/smart.path.js +1 -1
  177. package/source/smart.phoneinput.js +1 -1
  178. package/source/smart.pivottable.js +1 -1
  179. package/source/smart.powerbutton.js +1 -1
  180. package/source/smart.progressbar.js +1 -1
  181. package/source/smart.radiobutton.js +1 -1
  182. package/source/smart.rating.js +1 -1
  183. package/source/smart.router.js +1 -1
  184. package/source/smart.scheduler.js +1 -1
  185. package/source/smart.scrollbar.js +1 -1
  186. package/source/smart.slider.js +1 -1
  187. package/source/smart.sortable.js +1 -1
  188. package/source/smart.splitter.js +1 -1
  189. package/source/smart.switchbutton.js +1 -1
  190. package/source/smart.table.js +1 -1
  191. package/source/smart.tabs.js +1 -1
  192. package/source/smart.tank.js +1 -1
  193. package/source/smart.textarea.js +1 -1
  194. package/source/smart.textbox.js +1 -1
  195. package/source/smart.tickintervalhandler.js +1 -1
  196. package/source/smart.timeinput.js +1 -1
  197. package/source/smart.timepicker.js +1 -1
  198. package/source/smart.toast.js +1 -1
  199. package/source/smart.tooltip.js +1 -1
  200. package/source/smart.tree.js +1 -1
  201. package/source/smart.validationpanel.js +1 -1
  202. package/source/smart.validator.js +1 -1
  203. package/source/smart.window.js +1 -1
  204. package/source/styles/components/smart.array.css +1 -1
  205. package/source/styles/components/smart.calendar.css +1 -1
  206. package/source/styles/components/smart.cardview.css +1 -1
  207. package/source/styles/components/smart.checkinput.css +1 -1
  208. package/source/styles/components/smart.colorinput.css +1 -1
  209. package/source/styles/components/smart.columnpanel.css +1 -1
  210. package/source/styles/components/smart.countryinput.css +1 -1
  211. package/source/styles/components/smart.dateinput.css +1 -1
  212. package/source/styles/components/smart.daterangeinput.css +1 -1
  213. package/source/styles/components/smart.datetimeformatpanel.css +1 -1
  214. package/source/styles/components/smart.editor.css +1 -1
  215. package/source/styles/components/smart.filterbuilder.css +1 -1
  216. package/source/styles/components/smart.filterpanel.css +1 -1
  217. package/source/styles/components/smart.ganttchart.css +1 -1
  218. package/source/styles/components/smart.grid.css +2 -2
  219. package/source/styles/components/smart.gridpanel.css +1 -1
  220. package/source/styles/components/smart.input.css +1 -1
  221. package/source/styles/components/smart.kanban.css +2 -2
  222. package/source/styles/components/smart.maskedtextbox.css +1 -1
  223. package/source/styles/components/smart.multicolumnfilterpanel.css +1 -1
  224. package/source/styles/components/smart.multicomboinput.css +1 -1
  225. package/source/styles/components/smart.multiinput.css +1 -1
  226. package/source/styles/components/smart.multilinetextbox.css +1 -1
  227. package/source/styles/components/smart.numberformatpanel.css +1 -1
  228. package/source/styles/components/smart.numberinput.css +1 -1
  229. package/source/styles/components/smart.pager.css +1 -1
  230. package/source/styles/components/smart.passwordinput.css +1 -1
  231. package/source/styles/components/smart.passwordtextbox.css +1 -1
  232. package/source/styles/components/smart.phoneinput.css +1 -1
  233. package/source/styles/components/smart.pivottable.css +1 -1
  234. package/source/styles/components/smart.querybuilder.css +1 -1
  235. package/source/styles/components/smart.scheduler.css +1 -1
  236. package/source/styles/components/smart.sortpanel.css +1 -1
  237. package/source/styles/components/smart.table.css +1 -1
  238. package/source/styles/components/smart.textarea.css +1 -1
  239. package/source/styles/components/smart.textbox.css +1 -1
  240. package/source/styles/components/smart.timeinput.css +1 -1
  241. package/source/styles/components/smart.validationpanel.css +1 -1
  242. package/source/styles/components/smart.window.css +1 -1
  243. package/source/styles/default/scss/smart.grid.scss +97 -36
  244. package/source/styles/default/scss/smart.kanban.scss +22 -0
  245. package/source/styles/default/scss/textbox/_multi-combo-input.scss +42 -1
  246. package/source/styles/default/smart.grid.css +77 -26
  247. package/source/styles/default/smart.kanban.css +18 -0
  248. package/source/styles/default/smart.textbox.css +28 -1
  249. package/source/styles/smart.default.css +3 -3
  250. package/source/typescript/smart.elements.d.ts +34 -0
  251. package/source/typescript/smart.kanban.d.ts +34 -0
@@ -1,6 +1,6 @@
1
1
 
2
- /* Smart UI v11.0.54 (2022-01-09)
2
+ /* Smart UI v12.0.0 (2022-01-16)
3
3
  Copyright (c) 2011-2021 jQWidgets.
4
4
  License: https://htmlelements.com/license/ */ //
5
5
 
6
- Smart.Utilities.Assign("Grid.Dialog",class{_openImagePreviewDialog(e){const t=this;e=e.cloneNode(),t._dialogImagePreview||(t._dialogImagePreview=t._createDialog({modal:!0,screenModal:!0,left:"screenMiddle",top:"screenCenter",width:"80%",height:"80%"})),t._dialogImagePreview.content.innerHTML="",t._dialogImagePreview.content.appendChild(e),t._dialogImagePreview.btnClose.onclick=e=>{t._dialogImagePreview.close(),e.preventDefault(),e.stopPropagation()},e.style.marginLeft="auto",e.style.marginRight="auto",e.style.maxWidth="",e.onload=()=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const l=150+Math.min(850,e.width),a=150+Math.min(650,e.height);t._dialogImagePreview.style.width=l+"px",t._dialogImagePreview.style.height=a+"px",t._dialogImagePreview.style.left="calc(50% - "+Math.min(850,t._dialogImagePreview.offsetWidth/2)+"px)",t._dialogImagePreview.style.top="calc(50% - "+Math.min(650,t._dialogImagePreview.offsetHeight/2)+"px)";const i=getComputedStyle(t._dialogImagePreview),o=parseInt(i.top),n=parseInt(i.left);(window.offsetWidth<l||window.offsetHeight<a||o<0||n<0)&&(t._dialogImagePreview.style.left="0px",t._dialogImagePreview.style.top="0px",t._dialogImagePreview.style.width="100%",t._dialogImagePreview.style.height="100%"),e.style.maxWidth="100%"},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){"Escape"===e.key&&t._dialogImagePreview.close()},t._dialogImagePreview.btnClose.tabIndex=0,t._dialogImagePreview.onOpen=()=>{setTimeout((()=>{t._dialogImagePreview.btnClose.focus()}),100)},t._dialogImagePreview.footer.remove(),t._dialogImagePreview.header.parentNode.style.backgroundColor="var(--smart-background)",t._dialogImagePreview.open()}_openImageDialog(e,t){const l=this,a=l._dialogImage||l._createDialog(),i='<span class="smart-grid-icon smart-icon-image show"></span>'+l.localize("dialogImageHeader");if(a.cell||(a.cell=e),a.header.innerHTML=i,a.column=e.column,a.command=t,a.classList.add("smart-grid-image-dialog"),!l._dialogImage){a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),a.onOpen=function(){a.fileUpload.value="",a.input.value="";let e=a.cell.editor.instance.getValue();if("[]"!==e)if(e&&"string"==typeof e&&e.indexOf("http")>=0)a.input.value=JSON.parse(e)[0].value,a.tabs[1].click(),o("input");else{a.tabs[0].click();const t=(e,t)=>{let l=e.split(","),a=l[0].match(/:(.*?);/)[1],i=atob(l[1]),o=i.length,n=new Uint8Array(o);for(;o--;)n[o]=i.charCodeAt(o);return new File([n],t,{type:a})},l=new DataTransfer;"string"==typeof e&&e.indexOf("base64")>=0&&(e=JSON.parse(e)),Array.isArray(e)&&(e.forEach((e=>{l.items.add(t(e.value,e.label))})),a.fileUpload.files=l.files,o())}else a.tabs[0].click()},a.onClose=function(){},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){if(a.tabs[1].classList.contains("active"))a.input.value?e.editor.instance.setValue([{label:a.input.value,value:a.input.value}]):e.editor.instance.setValue([]),l._endCellEdit(a.cell);else{const t=(e,t)=>{var l=new FileReader;l.readAsDataURL(e),l.onload=function(){t(l.result)},l.onerror=function(){t("error")}},i=[];if(a.fileUpload.files.length)for(let o=0;o<a.fileUpload.files.length;o++){const n=a.fileUpload.files[o];t(n,(t=>{"error"===t&&console.log("Image load error"),i.push({value:t,label:n.name}),i.length===a.fileUpload.files.length&&(e.editor.instance.setValue(i),l._endCellEdit(a.cell))}))}else e.editor.instance.setValue([]),l._endCellEdit(a.cell)}a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},l._dialogImage=a,a.content.innerHTML=`\n <div>\n <div>\n <div class="tabs">\n <div class="active tab">\n <span class="smart-grid-icon smart-icon-plus show"></span><label>${l.localize("dialogImageDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${l.localize("dialogImageLink")}</label>\n </div>\n </div>\n </div>\n <div class="smart-grid-drop-zone">\n <div>\n <div class="title"><span class="smart-grid-icon smart-icon-plus show"></span><label>${l.localize("dialogImageUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${l.localize("dialogImageDrop")}</label></div>\n </div> \n <input accept=".jpg, .jpeg, .png" type="file" multiple="multiple" style="display: none;">\n </div>\n <div class="smart-hidden url-zone">\n <div class="url-title">\n ${l.localize("dialogImageURL")}\n </div>\n <div class="upload">\n <smart-input placeholder="https://example.com/image.png" class="underlined"></smart-input>\n <br/>\n <smart-button disabled class="success">${l.localize("dialogImageURLUpload")}</smart-button>\n </div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,a.input=a.querySelector("smart-input"),a.dropZone=a.querySelector(".smart-grid-drop-zone"),a.upload=a.querySelector(".title"),a.fileUpload=a.querySelector("input"),a.preview=a.querySelector(".preview"),a.tabs=a.querySelectorAll(".tab"),a.urlZone=a.querySelector(".url-zone"),a.uploadButton=a.querySelector("smart-button");const t=["image/apng","image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon"],i=e=>t.includes(e.type);a.dropZone.ondrop=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;for(let l=0;l<e.dataTransfer.items.length;l++)if("file"===e.dataTransfer.items[l].kind){const a=e.dataTransfer.items[l].getAsFile();i(a)&&t++}if(t===e.dataTransfer.files.length){const t=new DataTransfer,l=[...e.dataTransfer.files];[...a.fileUpload.files].forEach((e=>{t.items.add(e)})),l.forEach((e=>{t.items.add(e)})),a.fileUpload.files=t.files,o()}}else a.fileUpload.files=e.dataTransfer.files,o()},a.dropZone.ondragover=e=>{e.preventDefault()},a.tabs[0].onclick=()=>{a.tabs[0].classList.add("active"),a.tabs[1].classList.remove("active"),a.dropZone.classList.remove("smart-hidden"),a.urlZone.classList.add("smart-hidden"),a.updatePreview()},a.tabs[1].onclick=()=>{a.tabs[0].classList.remove("active"),a.tabs[1].classList.add("active"),a.dropZone.classList.add("smart-hidden"),a.urlZone.classList.remove("smart-hidden"),a.updatePreview("input")},a.uploadButton.onclick=()=>{a.updatePreview("input")};const o=e=>{const t=a.preview,n=a.fileUpload;function d(e){return e<1024?e+"bytes":e>=1024&&e<1048576?(e/1024).toFixed(1)+"KB":e>=1048576?(e/1048576).toFixed(1)+"MB":void 0}for(;t.firstChild;)t.removeChild(t.firstChild);const r=()=>{const e=document.createElement("div");return e.classList.add("item"),e.onpointerdown=t=>{const i=e.getBoundingClientRect();if(a.input.value="",t.clientY>=i.bottom-12){if(t.clientX>i.left+i.width/2-13&&t.clientX<i.left+i.width/2+13){e.remove();const t=a.preview.querySelectorAll(".item"),l=new DataTransfer;t.forEach((e=>{l.items.add(e.file)})),n.files=l.files,a.clearButton&&0===t.length&&a.clearButton.classList.remove("show")}}else l._openImagePreviewDialog(e.querySelector("img"))},e},s=()=>{const e=document.createElement("div");e.classList.add("list");const i=document.createElement("div");i.classList.add("smart-grid-icon","show","smart-icon-delete"),i.title=l.localize("clear"),t.appendChild(i),i.onclick=()=>{n.value="",a.input.value="",o()},a.clearButton=i,t.appendChild(e)};if("input"===e){const e=a.input.value;if(e){const t=r();if(s(),e.endsWith("png")||e.endsWith("jpeg")||e.endsWith("jpg")){const l=document.createElement("img");l.src=e,t.appendChild(l)}a.preview.lastChild.appendChild(t)}else{const e=document.createElement("p");e.textContent=l.localize("dialogImageFileUpload"),t.appendChild(e)}}else{const e=n.files;if(0===e.length){const e=document.createElement("p");e.textContent=l.localize("dialogImageFileUpload"),t.appendChild(e)}else{s();const o=new DataTransfer;for(const n of e){const e=r(),s=document.createElement("div");if(i(n)){s.textContent=`${n.name}, ${d(n.size)}.`,s.textContent.length>20&&(s.textContent=`${n.name.substring(0,5)}...${n.name.substring(n.name.length-4)}, ${d(n.size)}.`);const a=document.createElement("img");if(a.src=URL.createObjectURL(n),n.size>2097152){const e=document.createElement("p");e.textContent=l.localize("dialogImageSize",{value:n.name}),t.appendChild(e);continue}o.items.add(n),e.file=n,e.title=s.textContent,e.appendChild(a),e.appendChild(s)}a.preview.querySelector(".list").appendChild(e)}n.files=o.files}}};a.updatePreview=o,a.fileUpload.onchange=()=>{if(0===a.fileUpload.files.length&&a._tempFiles)a.fileUpload.files=a._tempFiles;else if(a._tempFiles){const e=new DataTransfer,t=[...a.fileUpload.files];[...a._tempFiles].forEach((t=>{e.items.add(t)})),t.forEach((t=>{e.items.add(t)})),a.fileUpload.files=e.files}o()},a.input.onchange=a.input.onblur=a.input.onkeyup=()=>{a.uploadButton.disabled=!a.input.value||!a.input.value.startsWith("https://")},a.upload.onclick=()=>{a._tempFiles=[];const e=new DataTransfer;[...a.fileUpload.files].forEach((t=>{e.items.add(t)})),a._tempFiles=e.files,a.fileUpload.click()}}a.open(),setTimeout((function(){a.btnConfirm.focus()}),100)}_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}_createDialog(e){const t=this;let l=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(l.modal=e.modal),void 0!==e.screenModal&&(l.screenModal=e.screenModal),l.setAttribute("animation","none"),l.classList.add("smart-window","smart-grid-dialog"),l.style.width="auto"===e.width?e.width:e.width+"px",l.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(l.style.width=e.width),e.height&&"string"==typeof e.height&&(l.style.height=e.height),l.style.left="",l.style.top="",l.innerHTML='<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div id="headerSection" class="smart-header-section">\n <div class="smart-header"></div>\n <div class="smart-buttons-container">\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-prev-button" aria-label="Previous Record" smart-id="prevButton"></button>\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-next-button" aria-label="Next Record" smart-id="nextButton"></button>\n <button class ="smart-button smart-element smart-close-button" aria-label="Close" smart-id="closeButton"></button>\n </div>\n </div>\n <div class="smart-content"><div class="smart-content-container"></div></div>\n <div class ="smart-footer">\n <div class ="smart-stack-layout right spacing">\n <smart-button class ="smart-confirm-button item primary">Ok</smart-button>\n <smart-button class ="smart-cancel-button item">Cancel</smart-button>\n </div>\n </div>\n </div>\n </div>\n ',l.querySelector&&l.querySelector(".smart-content")&&(l.content=l.querySelector(".smart-content").firstChild),l.footer=l.querySelector(".smart-footer"),l.header=l.querySelector(".smart-header"),l.btnConfirm=l.querySelector(".smart-confirm-button"),l.btnCancel=l.querySelector(".smart-cancel-button"),l.btnClose=l.querySelector(".smart-close-button"),l.btnNext=l.querySelector(".smart-next-button"),l.btnPrev=l.querySelector(".smart-prev-button");const a=document.createElement("div");return a.classList.add("smart-grid-dialog-overlay"),a.onclick=function(){},l.overlay=a,l.remove=function(){l.parentNode&&l.parentNode.removeChild(l)},l.close=function(){l.classList.remove("open"),l.addEventListener("transitionend",l.remove),l.addEventListener("transitioncancel",l.remove),l.modal&&l.overlay.parentNode&&l.overlay.parentNode.removeChild(l.overlay),l.onClose&&l.onClose()},l.open=function(a,i){l.removeEventListener("transitionend",l.remove),l.removeEventListener("transitioncancel",l.remove),document.body.appendChild(l),void 0===a&&(a=e.left),void 0===i&&(i=e.top),requestAnimationFrame((function(){l.classList.add("open");const e=function(e,a){const i=t.offset(t);switch("center"===e&&"horizontal"===a&&(e="middle"),e){case"top":return i.top;case"bottom":return Math.max(i.top,i.top+t.offsetHeight-l.offsetHeight);case"center":return Math.max(i.top,i.top+t.offsetHeight/2-l.offsetHeight/2);case"left":return i.left;case"middle":return i.left+t.offsetWidth/2-l.offsetWidth/2;case"right":return i.left+t.offsetWidth-l.offsetWidth}return"horizontal"===a?parseInt(e)+i.left:"vertical"===a?parseInt(e)+i.top:"number"==typeof e?e:parseInt(e)};l.style.left=e(a,"horizontal")+"px",l.style.top=e(i,"vertical")+"px","screenMiddle"===a&&(l.style.left="calc(50% - "+l.offsetWidth/2+"px)"),"screenCenter"===i&&(l.style.top="calc(50% - "+l.offsetHeight/2+"px)")})),l.modal&&(l.screenModal?document.body.appendChild(l.overlay):t.appendChild(l.overlay)),l.onOpen&&l.onOpen()},l}_openAddRowDialog(e,t){const l=this;if(!l.editing.addDialog.enabled)return!1;const a=l._dialogAddRow||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogAddHeader"):l.editing.dialog.header,o=a.content;a.header.innerHTML=i,e.grid=l,void 0===e.index&&(e.index=l.rows.length,l._rowsAdded&&(e.index+=l._rowsAdded.length));const n=e.cells;let d=null,r=0;if(l._cellEditors||(l._cellEditors=[]),!l._dialogAddRow){a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogAddButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogAddButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0},a.onClose=function(){l.editing.dialog.visible=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e={};for(let t=0;t<n.length;t++){const a=n[t],i=l._getEditorValue(a),o=l._getEditorId(a),d=l._cellEditors[o];d&&(i&&i.error?(e[a.column.dataField]=i.value,d.detach()):(e[a.column.dataField]=i,d.detach()))}const i=l._rowsAdded?l._rowsAdded.length:0,o=new Smart.Grid.Row({index:l.rows.length+i,id:Smart.Utilities.Core.createGUID(),grid:l,data:e});a.close(),t(o,0===a.index)},a.onkeydown=function(e){const t=e.key;"Enter"===t?a.btnConfirm.onclick():"Escape"===t&&a.close()},o.classList.add("smart-grid-layout");for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(!t.allowEdit)continue;r%2==0&&(d=document.createElement("div"),d.classList.add("row"),o.appendChild(d));const a=document.createElement("div");a.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const n=document.createElement("label");n.innerHTML=l.columns[e].label;const s=document.createElement("div");s.classList.add("smart-grid-dialog-editor"),s.setAttribute("editor",t.dataField),s.setAttribute("template",t.editor.template),a.appendChild(i),d.appendChild(a),i.appendChild(n),i.appendChild(s),r++}}a.open(),a.index=e.index;let s=0;for(let e=0;e<n.length;e++){const t=n[e],i=t.column,o=i.dataField,d=a.querySelector("[editor="+o+"]");if(!d)continue;d.innerHTML="";let r="";void 0!==t.value&&(r=t.value),"int64"!==i.dataType&&"number"!==i.dataType&&"int"!==i.dataType&&"float"!==i.dataType||(r=0),"date"===i.dataType&&(r=new Date),"bool"!==i.dataType&&"boolean"!==i.dataType||(r=!1);let c=null;switch(t.editor.template){default:case"custom":c=l._getCustomCellEditor(t);break;case"image":c=l._getImageCellEditor(t);break;case"checkBox":c=l._getCheckBoxCellEditor(t);break;case"autoComplete":c=l._getAutoCompleteCellEditor(t);break;case"dropDownList":c=l._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=l._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=l._getMaskCellEditor(t);break;case"checkInput":c=l._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=l._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=l._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=l._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=l._getDateInputCellEditor(t);break;case"dateRangeInput":c=l._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=l._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=l._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?l._getNumberInputCellEditor(t):l._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(r),0===s&&setTimeout((()=>{c.focus()}),100),!t.editor.isInitialized&&(t.editor.isInitialized=!0,t.editor.onInit)){const e=t.editor.onInit(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)l[t]=e[t]}));else if(e){const l=e,a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in l)a[e]=l[e]}}if(t.editor.onRender){const e=t.editor.onRender(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)l[t]=e[t]}));else if(e){const l=e,a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in l)a[e]=l[e]}}d.appendChild(c.element),c.element.onfocus=()=>{d.setAttribute("focus","")},c.element.onblur=()=>{d.removeAttribute("focus")},s++}l._dialogAddRow=a}_openEditDialog(e,t){const l=this;if(!l.editing.dialog.enabled)return!1;const a=l._dialogEdit||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogEditHeader",{value:l.editing.editRow?e.row.visibleIndex+1:e.column.label}):l.editing.dialog.header,o=a.content;a.header.innerHTML=i,a.row=l.editing.editRow,l.editing.recordNavigation&&a.classList.add("disable-animation");let n=null,d=0;if(void 0!==l._settingsDialogRowId){a.btnPrev.classList.remove("smart-hidden"),a.btnNext.classList.remove("smart-hidden");const e=e=>{const t=l.editing.editRow,i=l._recyclingRows.indexOf(t),o=e?l._recyclingRows[i+1]:l._recyclingRows[i-1];if(o){a.classList.add("disable-animation"),l.editing.recordNavigation=!0;const e=a.querySelector("[focus]");if(e){const t=e.closest(".row"),a=t.closest(".smart-grid-edit-dialog-editors-container");let i=-1;if(a&&(i=[...a.children].indexOf(t)),l.cancelEdit(),l._openRowSettingsDialog(o.id),l._dialogEdit&&i>=0){const e=l._dialogEdit.querySelectorAll(".row")[i];if(e){const t=e.querySelector(".smart-grid-dialog-editor");t.setAttribute("focus",""),t.querySelector(".smart-grid-cell-editor").focus()}}}else l.cancelEdit(),l._openRowSettingsDialog(o.id)}};a.btnNext.onmousedown=t=>{e(!0),t.preventDefault(),t.stopPropagation()},a.btnPrev.onmousedown=t=>{e(!1),t.preventDefault(),t.stopPropagation()}}if(!l._dialogEdit)if(a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0,l._settingsDialogRowId&&a.editorsContent&&a.editorsContent.offsetHeight&&(a.editorsContent.style.maxHeight=a.editorsContent.offsetHeight+40+"px")},a.onClose=function(){l.editing.dialog.visible=!1,a.row&&(a.row.showDetail=!1)},a.btnCancel.onclick=function(){l.cancelEdit()},a.btnClose.onclick=function(){l.cancelEdit()},a.btnConfirm.onclick=function(){if(void 0!==l._settingsDialogRowId){if(l.rowById[l._settingsDialogRowId]){const e=l.editing.editRow;if(!e)return!1;const t=e.cells;let i={};e.element.removeAttribute("error");for(let e=0;e<t.length;e++){const a=t[e],o=l._getEditorValue(a);i[a.column.dataField]=o}const o=l.validateRow(e.id,i);if(Object.keys(o).length>0){let e=!0;for(let i=0;i<t.length;i++){const n=t[i],d=o[n.column.dataField],r=a.querySelector(`[label-for="${n.column.dataField}"]`);if(r&&(r.innerHTML=""),d)for(let t in d){const a=d[t];let i="";if(!a)continue;let o=a[t];"minLength"!==t&&"maxLength"!==t||(o=a[t.toLowerCase()]),i=a.message?a.message:"required"===t?l.localize("requiredValue",{value:n.column.label}):"min"===t?l.localize("invalidMinValue",{value:n.column.label,min:o.min}):"max"===t?l.localize("invalidMaxValue",{value:n.column.label,max:o.max}):"minLength"===t?l.localize("invalidMinLengthValue",{value:n.column.label,min:o.requiredLength}):"maxLength"===t?l.localize("invalidMaxLengthValue",{value:n.column.label,max:o.requiredLength}):l.localize("invalidValue"),e=!1,r&&(r.innerHTML=i)}}if(!e)return}a._userData._changed=!0,e._userData=a._userData}if(a.columnVisibility){let e=!1;const t=l.columns.canNotify;l.columns.canNotify=!1;for(let t in a.columnVisibility){const i=l.columnByDataField[t];i.visible!==a.columnVisibility[t]&&(i.visible=a.columnVisibility[t],e=!0)}if(l.columns.canNotify=t,e)return l.endEdit(),void l.refresh(!1)}}l.endEdit()},a.onkeydown=function(e){const t=e.key,a=l.editing.commandKeys;for(let e in a){const i=a[e];if(t===i.key){l._applyCommand(i.command);break}}},l.editing.editRow)if(void 0!==l._settingsDialogRowId)l._applySettingsDialogLayout(a,o,l.editing.editRow);else{o.classList.add("smart-grid-layout");for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(!t.allowEdit)continue;d%2==0&&(n=document.createElement("div"),n.classList.add("row"),o.appendChild(n));const a=document.createElement("div");a.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const r=l._settingsDialogRowId?document.createElement("div"):document.createElement("label");r.innerHTML=l.columns[e].label;const s=document.createElement("div");s.classList.add("smart-grid-dialog-editor"),s.setAttribute("editor",t.dataField),s.setAttribute("template",t.editor.template),a.appendChild(i),n.appendChild(a),i.appendChild(r),i.appendChild(s),d++}}else{const t=e.column,l=document.createElement("div");l.classList.add("smart-grid-dialog-editor"),l.setAttribute("editor",""),l.setAttribute("template",t.editor.template),o.appendChild(l)}if(a.open(),l.editing.editRow){const l=a.querySelector("[editor="+e.column.dataField+"]");l.innerHTML="",l.appendChild(t.element),t.element.onfocus=()=>{l.setAttribute("focus","")},t.element.onblur=()=>{l.removeAttribute("focus")}}else{const l=e.column,i=a.querySelector("[editor]");i.innerHTML="",i.setAttribute("template",l.editor.template),i.appendChild(t.element),t.element.onfocus=()=>{i.setAttribute("focus","")},t.element.onblur=()=>{i.removeAttribute("focus")}}l._dialogEdit=a}_refreshCurrentUser(){const e=this,t=e.users;let l=e.currentUser,a=!0,i=!0,o=e.editing.enabled,n=!0;t&&null!==l&&(l=t.find((e=>e.id===l)),l&&(a=!1!==l.allowAdd,i=!1!==l.allowComment,o=o&&!1!==l.allowEdit,n=!1!==l.allowRemove)),e._currentUser={allowAdd:a,allowComment:i,allowEdit:o,allowRemove:n,info:l}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-grid-color-input")},e}_applySettingsDialogLayout(e,t,l){const a=this;e.classList.add("smart-grid-dialog-expand-row");const i=[];e.columnVisibility=i;const o=document.createElement("div"),n=document.createElement("div"),d=document.createElement("div");d.appendChild(o),d.appendChild(n),t.appendChild(d),d.classList.add("smart-grid-edit-dialog-layout"),o.classList.add("smart-grid-edit-dialog-editors-container"),n.classList.add("smart-grid-edit-dialog-activity-container"),a.columns.length>=8&&o.classList.add("many"),e.editorsContent=o,e.activityContent=n;const r=document.createElement("div"),s=document.createElement("div");n.appendChild(r),n.appendChild(s),r.innerHTML=`\n <div class="row"><div class="column"><div class="header smart-grid-edit-dialog-column-info">${a.localize("format").replace(":","")}\n <span title="${a.localize("resetFormat")}" class="reset-format smart-grid-icon smart-icon-reload show"></span>\n </div>\n </div>\n <div class="format-layout">\n <div title="${a.localize("background")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-color-background show"></span><div class="background"></div>\n </div>\n <div title="${a.localize("color")}" class="format smart-grid-edit-dialog-column-info">\n <span style="border-bottom: 2px solid #46CA78;" color="#46CA78" class="format smart-grid-icon smart-icon-font show"></span><div class="color"></div>\n </div>\n <div class="format-layout button-group">\n <span title="${a.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${a.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${a.localize("underline")}" class="formatbtn underline smart-grid-icon smart-icon-underline show"></span>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${a.localize("fontFamily").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-font show"></span><div class="font-family"></div>\n </div>\n <div title="${a.localize("fontSize").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-fontsize show"></span><div class="font-size"></div>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${a.localize("status").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span color="#F1C58B" class="smart-grid-icon smart-icon-star show"></span><div class="status"></div>\n </div>\n </div>\n <div class="column"><div class="comments-header smart-grid-edit-dialog-column-info">${a.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments">${a.localize("noComments")}</span></div>\n <div class="footer">\n <smart-text-area hint="${a.localize("comment")}" placeholder="${a.localize("comment")}" class="success underlined"></smart-text-area>\n <smart-button class="success">${a.localize("send")}</smart-button>\n </div>\n </div>\n `;const c=e._userData=JSON.parse(JSON.stringify(l._userData)),m=a._getColorInput();r.querySelector(".background").appendChild(m),m.onchange=()=>{c.background=m.value},c.background&&(m.value=c.background);const u=a._getColorInput();r.querySelector(".color").appendChild(u),u.onchange=()=>{c.color=u.value},c.color&&(u.value=c.color);const p=a._getColorInput();r.querySelector(".status").appendChild(p),p.onchange=()=>{c.status=p.value},c.status&&(p.value=c.status);const g=document.createElement("smart-input");g.style.width="auto",g.classList.add("underlined"),g.dropDownButtonPosition="right",g.readonly=!0,g.dropDownHeight="auto",g.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],g.onchange=()=>{c.fontFamily=g.value},c.fontFamily?g.value=c.fontFamily:g.selectedIndex=0,r.querySelector(".font-family").appendChild(g);const b=document.createElement("smart-input");b.style.width="auto",b.classList.add("underlined"),b.dropDownButtonPosition="right",b.readonly=!0,b.dropDownHeight="auto",b.dataSource=["-","8px","10px","12px","14px","18px","24px","36px"],b.onchange=()=>{c.fontSize=b.value},c.fontSize?b.value=c.fontSize:b.selectedIndex=0,r.querySelector(".font-size").appendChild(b);const f=r.querySelector(".button-group");f.onclick=e=>{const t=e.target.closest(".formatbtn");let l;t.classList.contains("checked")?(t.classList.remove("checked"),l=!1):(t.classList.add("checked"),l=!0),t.classList.contains("bold")?c.fontWeight=l?"bold":null:t.classList.contains("italic")?c.fontStyle=l?"italic":null:t.classList.contains("underline")&&(c.textDecoration=l?"underline":null)},c.fontWeight?f.children[0].classList.add("checked"):f.children[0].classList.remove("checked"),c.fontStyle?f.children[1].classList.add("checked"):f.children[1].classList.remove("checked"),c.textDecoration?f.children[2].classList.add("checked"):f.children[2].classList.remove("checked"),r.querySelector(".reset-format").onclick=()=>{for(let e=0;e<f.children.length;e++)f.children[e].classList.remove("checked");g.selectedIndex=0,b.selectedIndex=0,u.value="",m.value="",p.value="",c.fontWeight=null,c.fontStyle=null,c.textDecoration=null,c.fontSize=null,c.fontFamily=null};const h=r.querySelector(".comments-header"),v=r.querySelector(".comments-layout smart-text-area"),y=r.querySelector(".comments-layout smart-button"),C=r.querySelector(".comments-layout .footer"),w=r.querySelector(".comments-layout .comments");y.disabled=!0,w.innerHTML=`<span class="no-comments">${a.localize("noComments")}</span>`;const x=()=>{const e=w.querySelector(".no-comments");0===c.comments.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},A=e=>{e.querySelector(".remove-button").onclick=e=>{const t=e.target,l=c.comments.indexOf(t.comment);l>-1&&(c.comments.splice(l,1),t.element.remove(),h.innerHTML=`${a.localize("comments").replace(":","")} (${c.comments.length})`)}};for(let e=0;e<c.comments.length;e++){const t=c.comments[e],l=a._createComment(t);A(l),w.appendChild(l)}h.innerHTML=`${a.localize("comments").replace(":","")} (${c.comments.length})`,x(),v.onfocus=()=>{C.classList.add("focus")},v.onblur=()=>{C.classList.remove("focus")},v.onkeyup=()=>{y.disabled=""===v.value},y.onclick=()=>{if(""===v.value)return;a._refreshCurrentUser();const e={text:v.value,userId:a._currentUser.info?a._currentUser.info.id:-1,time:new Date},t=a._createComment(e);A(t),c.comments.push(e),v.value="",y.disabled=!0,x(),w.appendChild(t),h.innerHTML=`${a.localize("comments").replace(":","")} (${c.comments.length})`};for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;const l=document.createElement("div");l.classList.add("row"),o.appendChild(l);const n=document.createElement("div"),d=a._settingsDialogRowId?document.createElement("div"):document.createElement("label"),r=t.validationRules&&t.validationRules.length>0?"*":"";d.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${a.columns[e].icon} show"></span><label>`+a.columns[e].label+r+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const s=document.createElement("div");s.classList.add("smart-grid-dialog-editor"),s.setAttribute("editor",t.dataField),s.setAttribute("template",t.editor.template);const c=d.querySelector("[toggle]");c.column=t,i[t.dataField]=t.visible,c.title=a.localize("columnMenuItemHide"),c.onclick=()=>{i[c.column.dataField]=!c.column.visible,c.classList.contains("smart-icon-visibility-on")?(c.classList.remove("smart-icon-visibility-on"),c.classList.add("smart-icon-visibility-off"),c.title=a.localize("columnMenuItemShow")):(c.classList.add("smart-icon-visibility-on"),c.classList.remove("smart-icon-visibility-off"),c.title=a.localize("columnMenuItemHide"))},t.visible||(c.classList.remove("smart-icon-visibility-on"),c.title=a.localize("columnMenuItemShow")),t.visible?c.classList.add("smart-icon-visibility-on"):c.classList.add("smart-icon-visibility-off"),n.appendChild(d),n.appendChild(s);const m=document.createElement("label");m.classList.add("smart-field-editor-error-label"),m.setAttribute("label-for",t.dataField),n.appendChild(m),l.appendChild(n)}}_createComment(e){const t=this,l=t.users.find((t=>t.id===e.userId)),a=document.createElement("div"),i=l?l.name||l.id:t.localize("guestUser"),o=l?l.name:t.localize("guestUser"),n=l.image?l.image:"";if(a.className="comment",a.setAttribute("role","listitem"),a.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${i}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${o}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser.info&&l.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n</div>\n<div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,n){const e=a.querySelector(".user-icon");e.style.backgroundImage=`url('${n}')`,e.classList.add("image")}a.comment=e;const d=a.querySelector(".remove-button");return d.comment=e,d.element=a,e.userId!==t._currentUser.info.id&&d.classList.add("smart-visibility-hidden"),a}_openSummaryRowDialog(e){const t=this,l=t._summaryRowDialog||t._createDialog(),a="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(l.header.innerHTML=a,!l.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",l.content.innerHTML="",l.listBox=e}const i=l.listBox;l.summaryValueElement&&l.summaryValueElement.classList.remove("summary-chooser");const o=e.element.querySelector(".summary-value");o.classList.add("summary-chooser"),l.summaryValueElement=o;let n=[];l.dataField=e.column.dataField,n="string"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:"boolean"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"}]:"date"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:[{label:t.localize("countSummary"),value:"count"},{label:t.localize("minSummary"),value:"min"},{label:t.localize("maxSummary"),value:"max"},{label:t.localize("sumSummary"),value:"sum"},{label:t.localize("avgSummary"),value:"avg"}],i.dataSource=n,i.style.position="absolute",i.style.visibility="hidden",i.style.height="auto",document.body.appendChild(i);const d=e.column;d.summary&&d.summary.forEach((e=>{i.select(e)}));const r=i.offsetHeight;l.column=d,l.content.appendChild(i),l.classList.add("smart-grid-dialog-summary"),l.header.parentElement.classList.add("smart-hidden"),l.footer.classList.add("smart-hidden"),i.style.visibility="",i.style.position="",i.style.width="100%",t._summaryRowDialog||(l.btnConfirm.innerHTML=t.localize("apply"),l.btnCancel.innerHTML=t.localize("cancel"),l.style.width=l.style.minWidth="120px",l.onOpen=function(){t.editing.dialog.visible=!0},l.onClose=function(){t.editing.dialog.visible=!1,l.summaryValueElement&&l.summaryValueElement.classList.remove("summary-chooser")},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){l.column.summary=i.selectedValues,l.close(),t._calculateSummary(),t._recycle(!1)},l.confirm=function(){l.btnConfirm.click()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},t._summaryRowDialog=l);const s=e.element,c=t.offset(s),m=t.offset(t);let u=s.offsetWidth+c.left-m.left-120;u<0&&(u=c.left-m.left),l.open(u,c.top-m.top-r-0),setTimeout((function(){l.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const l=this;if(!l.editing.deleteDialog.enabled)return!1;const a=l._dialogDelete||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):l.editing.dialog.header;a.header.innerHTML=i,a.content.innerHTML=l.localize("dialogDeleteContent"),a.row=e,l._dialogDelete||(a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogDeleteButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogDeleteButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0},a.onClose=function(){l.editing.dialog.visible=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){t(a.row),a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},l._dialogDelete=a),a.open(),setTimeout((function(){a.btnConfirm.focus()}),100)}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),l=new Date(t,6,30);return[{bind:"kanban",name:"kanban",type:"radio",label:e.localize("kanbanNoneDescription"),filter:"kanban",options:[{value:"blank",checked:!0,label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]},{bind:"kanbanNotes",name:"kanbanNodes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",info:e.localize("dialogAddColumnNameInfo")},{bind:"description",type:"input",label:e.localize("dialogAddColumnDescription"),filter:"any",info:e.localize("dialogAddColumnDescriptionInfo")},{bind:"type",name:"typeslist",type:"dropDownList",filter:"any",label:e.localize("dialogAddColumnType"),icon:"smart-icon-font",options:[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"image",prefix:'<span class="smart-grid-icon visible smart-icon-image"></span>',label:e.localize("dialogAddColumnTypeImage")},{value:"number",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeNumber")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")},{value:"boolean",prefix:'<span class="smart-grid-icon visible smart-icon-check-squared"></span>',label:e.localize("dialogAddColumnTypeCheckBox")},{value:"date",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDate")},{value:"createdTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeCreatedTime")},{value:"modifiedTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeLastModifiedTime")},{value:"createdBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCreatedBy")},{value:"modifiedBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeLastModifiedBy")},{value:"collaborator",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCollaborator")},{value:"slider",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeSlider")},{value:"autoNumber",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeAutoNumber")},{value:"url",prefix:'<span class="smart-grid-icon visible smart-icon-link"></span>',label:e.localize("dialogAddColumnTypeURL")},{value:"email",prefix:'<span class="smart-grid-icon visible smart-icon-mail"></span>',label:e.localize("dialogAddColumnTypeEmail")},{value:"phone",prefix:'<span class="smart-grid-icon visible smart-icon-phone"></span>',label:e.localize("dialogAddColumnTypePhone")},{value:"password",prefix:'<span class="smart-grid-icon visible smart-icon-lock"></span>',label:e.localize("dialogAddColumnTypePassword")}],info:e.localize("dialogAddColumnTypeInfo")},{bind:"dateFormat",name:"dateformat",type:"dropDownList",label:e.localize("dialogAddColumnDateFormat"),options:[{value:"M/d/yyyy",label:e.localize("dialogAddColumnDateFormatShort")+" ("+new Smart.Utilities.DateTime(l).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(l).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(l).toString("ISO8601")+")"},{value:"d/M/yyyy",label:e.localize("dialogAddColumnDateFormatEU")+" (30/7/"+t+")"},{value:"yyyy-MM-dd",label:e.localize("dialogAddColumnDateFormatAS")+" ("+t+"-30-07)"},{value:"MMMM, dd, yyyy",label:e.localize("dialogAddColumnDateFormatFull")+" (July, 30, "+t+")"}],filter:"date",info:e.localize("dialogAddColumnDateFormatInfo")},{bind:"timeFormat",name:"timeformat",type:"dropDownList",label:e.localize("dialogAddColumnTimeFormat"),filter:"time",width:"50%",options:[{value:"hh:mm",label:"12 "+e.localize("dialogAddColumnTimeFormatHour")},{value:"HH:mm",label:"24 "+e.localize("dialogAddColumnTimeFormatHour")}],info:e.localize("dialogAddColumnTimeFormatInfo")},{bind:"allowTimeFormat",type:"boolean",label:e.localize("dialogAddColumnAllowTimeFormat"),filter:"date",value:!1,info:""},{bind:"allowCustomDateSeparator",type:"boolean",label:e.localize("dialogAddColumnCustomDateSeparator"),filter:"date",value:!1,info:""},{bind:"dateFormatSeparator",name:"dateFormatSeparator",type:"radio",label:"",filter:"date",columns:3,options:[{value:"/",label:e.localize("dialogAddColumnDateFormatSlash")+" (/)"},{value:"-",label:e.localize("dialogAddColumnDateFormatHyphen")+" (-)"},{value:".",label:e.localize("dialogAddColumnDateFormatDot")+" (.)"}]},{bind:"numberFormat",name:"numberFormat",type:"dropDownList",label:e.localize("dialogAddColumnNumberFormat"),filter:"number",options:[{value:{style:"decimal",maximumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatInteger")+" 1,000"},{value:{style:"decimal",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatNumber")+" 1,000.12"},{value:{style:"percent",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatPercent")+" 10.12%"},{value:{style:"percent",maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatPercentRounded")+" 10%"},{value:{style:"decimal",notation:"scientific"},label:e.localize("dialogAddColumnNumberFormatScientific")+" 1.01E+03"},{value:{style:"decimal",notation:"engineering"},label:e.localize("dialogAddColumnNumberFormatEngineering")+" 34.284 x 10^9"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,currencySign:"accounting"},label:e.localize("dialogAddColumnNumberFormatAccounting")+" $(1,000.12)"},{value:{style:"unit",unit:"kilogram"},label:e.localize("dialogAddColumnNumberFormatUnit")+" 10.12 kg"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency},label:e.localize("dialogAddColumnNumberFormatCurrency")+" $1,000.12"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatCurrencyRounded")+" $1,000"}],required:!1,info:e.localize("dialogAddColumnNumberFormatInfo")},{bind:"unit",name:"unit",type:"dropDownList",filter:"number",required:!1,options:[{value:"acre",label:e.localize("dialogAddColumnNumberFormatUnitAcre")},{value:"percent",label:e.localize("dialogAddColumnNumberFormatUnitPercent")},{value:"degree",label:e.localize("dialogAddColumnNumberFormatUnitDegree")},{value:"megabyte",label:e.localize("dialogAddColumnNumberFormatUnitMegaByte")},{value:"centimeter",label:e.localize("dialogAddColumnNumberFormatUnitCentimeter")},{value:"meter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")},{value:"kilometer",label:e.localize("dialogAddColumnNumberFormatUnitKilometer")},{value:"mile",label:e.localize("dialogAddColumnNumberFormatUnitMile")},{value:"celsius",label:e.localize("dialogAddColumnNumberFormatUnitCelsius")},{value:"fahrenheit",label:e.localize("dialogAddColumnNumberFormatUnitFahrenheit")},{value:"kilogram",label:e.localize("dialogAddColumnNumberFormatUnitKilogram")},{value:"pound",label:e.localize("dialogAddColumnNumberFormatUnitPound")},{value:"liter",label:e.localize("dialogAddColumnNumberFormatUnitLiter")},{value:"gallon",label:e.localize("dialogAddColumnNumberFormatUnitGallon")},{value:"second",label:e.localize("dialogAddColumnNumberFormatUnitSecond")},{value:"minute",label:e.localize("dialogAddColumnNumberFormatUnitMinute")},{value:"hour",label:e.localize("dialogAddColumnNumberFormatUnitHour")},{value:"day",label:e.localize("dialogAddColumnNumberFormatUnitDay")},{value:"week",label:e.localize("dialogAddColumnNumberFormatUnitWeek")},{value:"month",label:e.localize("dialogAddColumnNumberFormatUnitMonth")},{value:"year",label:e.localize("dialogAddColumnNumberFormatUnitYear")}],label:e.localize("dialogAddColumnNumberFormatUnit"),info:e.localize("dialogAddColumnNumberFormatUnitInfo")},{bind:"minLength",name:"minlength",width:"50%",type:"number",filter:"text",required:!1,label:e.localize("dialogAddColumnMinLength"),info:e.localize("dialogAddColumnMinLengthInfo")},{bind:"maxLength",name:"maxlength",width:"50%",filter:"text",type:"number",required:!1,label:e.localize("dialogAddColumnMaxLength"),info:e.localize("dialogAddColumnMaxLengthInfo")},{bind:"minValue",name:"minvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMinValue"),info:e.localize("dialogAddColumnMinValueInfo")},{bind:"maxValue",name:"maxvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMaxValue"),info:e.localize("dialogAddColumnMaxValueInfo")},{bind:"minDateTime",name:"mindatetime",type:"datetime",filter:"date",width:"50%",label:e.localize("dialogAddColumnMinDate"),info:e.localize("dialogAddColumnMinDateInfo")},{bind:"maxDateTime",name:"maxdatetime",type:"datetime",width:"50%",filter:"date",label:e.localize("dialogAddColumnMaxDate"),info:e.localize("dialogAddColumnMaxDateInfo")},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"allowCheckItems",type:"boolean",filter:"hidden",value:!1,label:e.localize("dialogAddColumnCheckItems"),info:""},{bind:"allowMultipleCollaborators",type:"boolean",filter:"collaborator",value:!1,label:e.localize("dialogAddColumnMultipleCollaborators"),info:e.localize("dialogAddColumnMultipleCollaboratorsInfo")},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""},{bind:"users",name:"users",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"collaborator",info:""},{name:"align",bind:"cellsAlign",type:"dropDownList",label:e.localize("dialogAddColumnAlign"),required:!1,options:[{value:"left",label:e.localize("dialogAddColumnAlignLeft")},{value:"right",label:e.localize("dialogAddColumnAlignRight")},{value:"center",label:e.localize("dialogAddColumnAlignCenter")}],filter:"any",info:e.localize("dialogAddColumnAlignInfo")},{bind:"allowResize",type:"boolean",filter:"any",width:"50%",label:e.localize("dialogAddColumnResizable"),info:e.localize("dialogAddColumnResizableInfo")},{bind:"required",type:"boolean",width:"50%",filter:"text",label:e.localize("dialogAddColumnRequired"),info:e.localize("dialogAddColumnRequiredInfo")},{bind:"allowSort",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnSortable"),info:e.localize("dialogAddColumnSortableInfo")},{bind:"allowFilter",type:"boolean",align:"left",width:"50%",filter:"any",label:e.localize("dialogAddColumnFilterable"),info:e.localize("dialogAddColumnFilterableInfo")},{bind:"allowEdit",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnEditable"),info:e.localize("dialogAddColumnEditableInfo")}]}_addColumnDialogShowHideEditors(e){const t=this,l=t._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input").getSelectedItem().value,a=t._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor");let i=!!e;for(let o=0;o<a.length;o++){const n=a[o],d=n.getAttribute("filter"),r=n.getAttribute("bind"),s=n.parentNode;if(s.classList.add("smart-hidden"),"cellsAlign"!==r||"boolean"!==l&&"image"!==l&&"email"!==l&&"url"!==l&&"collaborator"!==l&&"createdBy"!==l&&"password"!==l&&"phone"!==l&&"createdTime"!==l&&"modifiedBy"!==l&&"modifiedTime"!==l)if("type"===r&&i)s.classList.add("smart-hidden");else if("allowEdit"!==r||!1!==t.editing.enabled&&"autoNumber"!==l&&"createdBy"!==l&&"modifiedBy"!==l&&"createdTime"!==l&&"modifiedTime"!==l)if("allowResize"!==r||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==r||!1!==t.filtering.enabled)if("allowSort"!==r||!1!==t.sorting.enabled)if("required"!==r||!1!==t.editing.enabled&&("string"===l||"multiText"===l)){if(e&&"kanban"===t.view){switch(r){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":s.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===d&&s.classList.remove("smart-hidden")}if("any"!==d)switch(l){default:case"text":"text"===d&&s.classList.remove("smart-hidden");break;case"slider":case"number":if("number"===d&&s.classList.remove("smart-hidden"),"unit"===r){s.classList.add("smart-hidden");const e=t._dialogAddColumn.querySelector('[field-name="numberFormat"]'),l=t._dialogAddColumn.querySelector('[field-name="unit"]'),a=e.querySelector("smart-input"),i=()=>{const e=a.getSelectedItem();e&&"unit"===e.value.style?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};e.onchange=()=>{i()},i()}break;case"select":case"multiSelect":d.indexOf("list")>=0&&s.classList.remove("smart-hidden");break;case"collaborator":d.indexOf("collaborator")>=0&&s.classList.remove("smart-hidden");break;case"createdBy":case"modifiedBy":case"autoNumber":case"createdTime":case"modifiedTime":case"url":case"email":case"image":case"phone":case"password":case"boolean":break;case"date":{const e=t._dialogAddColumn.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;"date"===d&&s.classList.remove("smart-hidden");const l=e=>{const l=t._dialogAddColumn.querySelector('[field-filter="time"]'),a=t._dialogAddColumn.querySelector('[field-name="dateFormat"]');e?(l.classList.remove("smart-hidden"),a.style.width="50%",a.style.float="left"):(l.classList.add("smart-hidden"),a.style.width="",a.style.float="")},a=e=>{const l=t._dialogAddColumn.querySelector('[field-name="allowTimeFormat"]'),a=l.querySelector(".smart-grid-dialog-editor");e.indexOf("T")>=0?(l.classList.add("smart-hidden"),a.uncheck()):l.classList.remove("smart-hidden")},i=e=>{const l=t._dialogAddColumn.querySelector('[field-name="dateFormatSeparator"]');e?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};if("allowTimeFormat"===r){const e=n.querySelector(".smart-input").value;n.onchange=e=>{l(e)},l(e)}if("dateFormat"===r){const e=n.querySelector(".smart-input").value;n.onchange=e=>{a(e.detail.value)},a(e)}if("dateFormatSeparator"===r){const e=t._dialogAddColumn.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;i(e)}if("allowCustomDateSeparator"===r){e.indexOf("T")>=0&&e.indexOf("-")>0&&n.uncheck();const t=n.querySelector(".smart-input").value;n.onchange=e=>{i(e)},i(t)}a(e);break}}else s.classList.remove("smart-hidden")}else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden");else s.classList.add("smart-hidden")}}_addColumnDialogInitEditors(){const e=this,t=e._dialogAddColumn.editColumn;for(let l in e._addColumnDialogEditors){const a=e._addColumnDialogEditors[l],i=a.querySelector("input"),o=a.querySelector("smart-input");switch(l){case"allowTimeFormat":{const e=a.querySelector(".smart-input");t&&t.editor?"dateInput"===t.editor.template?(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowCustomDateSeparator":{const l=a.querySelector(".smart-input");l.value=!1,l.removeAttribute("checked");let i=0;t&&t.cellsFormat&&(t.cellsFormat.indexOf(".")>=0?(l.value=!0,l.setAttribute("checked",""),i=2):(t.cellsFormat.indexOf("M-d-yyyy")>=0||t.cellsFormat.indexOf("d-M-yyyy")>=0||t.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(l.value=!0,l.setAttribute("checked",""),i=1));const o=e._addColumnDialogEditors.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");o.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),o[i].setAttribute("checked",""),o[i].value=!0;break}case"kanban":{const t=a.querySelectorAll(".smart-grid-dialog-boolean-field");for(let l=0;l<t.length;l++)t[l].onchange=t=>{const l=[...t.parentElement.children].indexOf(t),a=t.parentElement.parentElement.previousElementSibling,i=e._dialogAddColumn.querySelector('[field-name="options"]'),o=e._dialogAddColumn.querySelector('[field-name="allowColorItems"]'),n=()=>{const e=i.querySelector("smart-sortable");e&&e._validate()};switch(l){case 0:a.innerHTML=e.localize("kanbanNoneDescription"),o.classList.add("smart-hidden"),i.classList.add("smart-hidden"),n();break;case 1:a.innerHTML=e.localize("kanbanBasicDescription"),o.classList.remove("smart-hidden"),i.classList.remove("smart-hidden"),n()}};break}case"dateFormat":t&&t.cellsFormat?t.cellsFormat.indexOf("M/d/yyyy")>=0?o.selectedIndex=0:t.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?o.selectedIndex=1:t.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?o.selectedIndex=2:t.cellsFormat.indexOf("d/M/yyyy")>=0?o.selectedIndex=3:t.cellsFormat.indexOf("yyyy-MM-dd")>=0?o.selectedIndex=4:t.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(o.selectedIndex=5):o.selectedIndex=0;break;case"timeFormat":t&&t.cellsFormat&&t.cellsFormat.indexOf("HH")>=0&&-1===t.cellsFormat.indexOf("T")?o.selectedIndex=1:o.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!0;t&&t.editor&&t.editor.singleSelect&&(e=!1);const l=a.querySelector(".smart-input");t?e?(l.value=!0,l.setAttribute("checked","")):(l.value=!1,l.removeAttribute("checked")):(l.value=!0,l.setAttribute("checked",""));break}case"numberFormat":if(t&&"numberInput"===t.editor.template&&t.editor.numberFormat)if("decimal"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=0;else if("decimal"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=1;else if("percent"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=2;else if("percent"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=3;else if("decimal"===t.editor.numberFormat.style&&"scientific"===t.editor.numberFormat.notation)o.selectedIndex=4;else if("decimal"===t.editor.numberFormat.style&&"engineering"===t.editor.numberFormat.notation)o.selectedIndex=5;else if("currency"===t.editor.numberFormat.style&&"accounting"===t.editor.numberFormat.currencySign)o.selectedIndex=6;else if("unit"===t.editor.numberFormat.style){o.selectedIndex=7;const l=t.editor.numberFormat.unit,a=e._addColumnDialogEditors.unit.querySelector("smart-input");a.dataSource.forEach(((e,t)=>{if(e.value===l)return a.selectedIndex=t,!0}))}else"currency"===t.editor.numberFormat.style?o.selectedIndex=8:"currency"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits&&0===t.editor.numberFormat.minimumFractionDigits&&(o.selectedIndex=9);else o.selectedIndex=0;break;case"allowCheckItems":{const e=a.querySelector(".smart-input");t?t.editor&&!t.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===t[l]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!1,e.setAttribute("checked",""));break}case"allowColorItems":{const e=a.querySelector(".smart-input");t?t.editor&&t.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===t[l]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowResize":case"allowSort":case"allowEdit":case"allowFilter":case"required":{const e=a.querySelector(".smart-input");t?t[l]?(e.value=!0,e.setAttribute("checked","")):!1===t[l]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}}if(!t||"options"!==l&&"users"!==l){const t=a.querySelector("smart-sortable");if(t&&t._init)if("users"===l){let l=[];for(let t=0;t<e.users.length;t++)l.push({color:e.users[t].color,label:e.users[t].name,id:e.users[t].id,image:e.users[t].image});t._init(l)}else t._init()}else{const e=a.querySelector("smart-sortable");if(e&&e._init)if(t.editor.singleSelect){const l=t.editor.dataSource.filter((e=>""!==e));e._init(l)}else"mutliComboInput"===t.editor.template&&e._init(JSON.parse(JSON.stringify(t.editor.dataSource)))}if(t&&"type"===l?("number"===t.dataType||"int"===t.dataType?o.selectedIndex=3:"date"===t.dataType?o.selectedIndex=7:"bool"!==t.dataType&&"boolean"!==t.dataType||(o.selectedIndex=6),t.editor&&t.editor.template&&o.dataSource.forEach(((e,l)=>{switch(e.value){case"string":"input"===t.editor.template&&(o.selectedIndex=l);break;case"number":"numberInput"===t.editor.template&&(o.selectedIndex=l);break;case"select":"multiComboInput"===t.editor.template&&t.editor.singleSelect&&"tags"===t.template&&(o.selectedIndex=l);break;case"multiSelect":"multiComboInput"!==t.editor.template||t.editor.singleSelect||"tags"!==t.template||(o.selectedIndex=l);break;case"multiText":"textarea"===t.editor.template&&(o.selectedIndex=l);break;case"date":"dateInput"!==t.editor.template&&"dateTimePicker"!==t.editor.template||(o.selectedIndex=l);break;case"checkBox":"checkBox"===t.editor.template&&(o.selectedIndex=l);break;case"slider":"slider"===t.editor.template&&(o.selectedIndex=l);break;case"image":"image"===t.editor.template&&(o.selectedIndex=l);break;case"modifiedTime":"modifiedTime"===t.template&&(o.selectedIndex=l);break;case"createdTime":"createdTime"===t.template&&(o.selectedIndex=l);break;case"createdBy":"createdBy"===t.template&&(o.selectedIndex=l);break;case"modifiedBy":"modifiedBy"===t.template&&(o.selectedIndex=l);break;case"collaborator":"collaborator"===t.template&&t.editor&&t.editor.collaborator&&(o.selectedIndex=l);break;case"autoNumber":"autoNumber"===t.template&&(o.selectedIndex=l);break;case"phone":"phone"===t.template&&(o.selectedIndex=l);break;case"password":"password"===t.template&&(o.selectedIndex=l);break;case"url":"url"===t.template&&(o.selectedIndex=l);break;case"email":"email"===t.template&&(o.selectedIndex=l)}}))):"type"===l&&(o.selectedIndex=0),"cellsAlign"===l&&t&&("center"===t.cellsAlign||"middle"===t.cellsAlign?o.selectedIndex=2:"right"===t.cellsAlign&&(o.selectedIndex=1)),!i)continue;"dataField"!==l&&"type"!==l&&"timeFormat"!==l&&"dateFormat"!==l&&"numberFormat"!==l&&"unit"!==l&&"cellsAlign"!==l&&o&&(o.selectedIndex=0),"name"===l&&(o.value=t?t.label:""),"description"===l&&(o.value=t?t.description:"");const n=(e,l)=>{t&&t.validationRules.forEach((t=>"minDate"===t.type&&"minDateTime"===e||"maxDate"===t.type&&"maxDateTime"===e||"min"===t.type&&"minValue"===e||"max"===t.type&&"maxValue"===e||t.type===e?(l.value=t.value,!0):void 0))};if("minValue"===l?(i.value=0,n(l,i)):"maxValue"===l?(i.value=100,n(l,i)):"minLength"===l?(i.value=0,n(l,i)):"maxLength"===l&&(i.value=500,n(l,i)),"minDateTime"===l){const e=a.querySelector("smart-date-input");e.value=new Date(1900,0,1),n(l,e)}else if("maxDateTime"===l){const e=a.querySelector("smart-date-input");e.value=new Date(2100,0,1),n(l,e)}}}_createColumnBooleanEditor(e,t,l,a,i){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const o=document.createElement("div");return o.classList.add("smart-input"),o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-check-box-cell-editor"),o.setAttribute("checked",""),o.value=!0,t.width&&(l.style.width=t.width,l.style.float="left"),!1===t.value&&(o.value=!1,o.removeAttribute("checked")),e.appendChild(o),e.getValue=function(){return o.value},e.check=function(){o.setAttribute("checked",""),o.value=!0,e.onchange&&e.onchange(o.value)},e.uncheck=function(){o.removeAttribute("checked"),o.value=!1,e.onchange&&e.onchange(o.value)},e.toggle=function(){!0!==o.value&&!1!==o.value&&null!==o.value&&(o.value=!1),null===o.value?o.value=!1:o.value=!o.value,!1===o.value?o.removeAttribute("checked"):o.setAttribute("checked",o.value?"":"indeterminate"),e.onchange&&e.onchange(o.value)},e.onclick=i.onclick=()=>{e.toggle()},a.appendChild(l),l.classList.add("smart-grid-dialog-boolean-field"),l.appendChild(e),l.appendChild(i),e}_getColumnTemplateByType(e){switch(e){case"boolean":case"bool":return"checkBox";case"image":return"image";case"createdBy":case"modifiedBy":case"collaborator":case"select":case"multiSelect":return"tags";case"url":return"url";case"email":return"email";case"autoNumber":return"autoNumber";case"password":return"password";case"createdTime":return"createdTime";case"modifiedTime":return"modifiedTime";default:return""}}_confirmAddColumnDialog(){const e=this,t=e._dialogAddColumn,l=e._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),a=[];let i,o,n={};for(let t=0;t<l.length;t++){const a=l[t],i=a.querySelector(".smart-input"),o=a.getAttribute("bind"),d=a.parentElement;if("kanban"!==o)if("minLength"!==o&&"maxLength"!==o&&"minValue"!==o&&"maxValue"!==o&&"minDateTime"!==o&&"maxDateTime"!==o)if("options"!==o&&"users"!==o){if("allowEdit"===o&&d.classList.contains("smart-hidden"))i.value=!1;else if("required"===o&&d.classList.contains("smart-hidden"))i.value=!1;else if("dateFormatSeparator"===o){const e=a.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:n.dateFormatSeparatorType="/";break;case 1:n.dateFormatSeparatorType="-";break;case 2:n.dateFormatSeparatorType="."}break}}i&&(i.getSelectedItem?n[o]=i.getSelectedItem().value:n[o]=i.value)}else{const t=[],l=a.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),i=a.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<l.length;e++){const a=l[e],o={label:a.value,value:parseInt(a.getAttribute("data-id")),color:i[e].value};o.color=i[e].value,t.push(o)}if("users"===o&&"collaborator"===n.type){e.users||(e.users=[]);for(let l=0;l<t.length;l++){const a=t[l],i=e.users.find((e=>e.id===a.value));i&&(i.name=a.label,i.color=a.color)}}n[o]=t}else n[o]=i.getValue();else{const e=a.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:n.kanban="blank";break;case 1:n.kanban="basic"}break}}}t.data=n;let d={},r={},s="";if(i=n.minDateTime,o=n.maxDateTime,"date"===n.type){d={template:"dateInput",min:i,max:o};let e=!1;"-"!==n.dateFormat&&(s=n.dateFormat,n.allowCustomDateSeparator&&(s.indexOf("/")>=0?s=s.replaceAll("/",n.dateFormatSeparatorType):s.indexOf("-")>=0?s=s.replaceAll("-",n.dateFormatSeparatorType):s.indexOf(".")>=0&&(s=s.replaceAll(".",n.dateFormatSeparatorType))),n.dateFormat.indexOf("T")>=0&&(d.template="dateTimePicker",d.dropDownDisplayMode="auto",d.formatString=s),e=!0),d.autoOpen=!0,n.allowTimeFormat&&"-"!==n.timeFormat&&(e&&(s+=" "),s+=n.timeFormat,d.template="dateTimePicker",d.dropDownDisplayMode="auto",d.formatString=s),a.push({type:"minDate",value:i}),a.push({type:"maxDate",value:o})}else if("number"===n.type||"slider"===n.type)i=parseInt(n.minValue),o=parseInt(n.maxValue),"unit"===n.numberFormat.style&&(n.numberFormat.unit=n.unit),d={template:"number"===n.type?"numberInput":"slider",min:i,max:o,numberFormat:n.numberFormat},r={Intl:{NumberFormat:n.numberFormat}},s="d",a.push({type:"min",value:i}),a.push({type:"max",value:o});else if("boolean"===n.type)d={template:"checkBox"};else if("image"===n.type)d={template:"image"};else if("select"===n.type||"multiSelect"===n.type){let e=n.options;"select"===n.type&&(e=[""].concat(n.options)),d={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:n.allowColorItems,autoOpen:!0,pills:!n.allowCheckItems,singleSelect:"select"===n.type,dataSource:e}}else if("collaborator"===n.type){let t=n.users;n.allowMultipleCollaborators||(t=[""].concat(n.users));for(let l=0;l<e.users.length;l++)t.forEach((t=>{t.value===e.users[l].id&&(t.image=e.users[l].image,t.id=e.users[l].id)}));d={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:n.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!n.allowCheckItems,singleSelect:!n.allowMultipleCollaborators,dataSource:t}}else"multiText"===n.type?(i=n.minLength,o=n.maxLength,d={template:"textarea",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o})):"password"===n.type?(i=n.minLength,o=n.maxLength,d={template:"password",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o})):"phone"===n.type?d={template:"phone",required:n.required}:(i=n.minLength,o=n.maxLength,d={template:"input",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o}));let c="string";switch(n.type){case"boolean":case"bool":c="boolean";break;case"createdTime":case"modifiedTime":case"date":c="date";break;case"autoNumber":case"slider":case"number":c="number"}if(e._dialogAddColumn.editColumn){const t=e._dialogAddColumn.editColumn;t.canNotify=!1,t.label=n.name,t.description=n.description,t.showDescriptionButton=!0,t.allowResize=n.allowResize,t.allowSort=n.allowSort,t.allowFilter=n.allowFilter,t.allowEdit=n.allowEdit,t.align=t.cellsAlign=n.cellsAlign,t.cellsFormat=s,t.dataType=c;const l=t._editorId?t._editorId:"",i=d.template+"_"+t.dataField+l;e._cellEditors[i]&&delete e._cellEditors[i];let o=!0;"list"!==t.template&&"dropDownList"!==t.template||(o=!1),"autoNumber"!==t.template&&"createdBy"!==t.template&&"modifiedBy"!==t.template&&"createdTime"!==t.template&&"modifiedTime"!==t.template||(o=!1),o&&(t.editor=d,t.template=e._getColumnTemplateByType(n.type)),t.formatSettings=r,t._isDirty=!0,n.required&&a.push({type:"required"}),t.validationRules=a,t._state&&["label","description","showDescriptionButton","dataType","editor","formatSettings","template","summary","validationRules","allowResize","allowSort","allowFilter","allowEdit","align","cellsAlign","cellsFormat"].forEach((e=>{t._state[e]=t[e]})),t.canNotify=!0,e.$.fireEvent("closeColumnDialog",{dataField:t.dataField}),e.onColumnUpdated&&e.onColumnUpdated(e.columns.indexOf(t),t),e._onColumnUpdated&&e._onColumnUpdated(t,n),e._recycle(!0),t.refresh(),t._isDirty=!1}else{let t=[];"number"===c&&(t=["sum"]);const l=new Smart.Grid.Column({label:n.name,description:n.description,dataField:n.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:n.allowResize,allowSort:n.allowSort,allowFilter:n.allowFilter,allowEdit:n.allowEdit,showDescriptionButton:!0,dataType:c,editor:d,summary:t,template:e._getColumnTemplateByType(n.type),formatSettings:r,cellsAlign:n.cellsAlign,align:n.cellsAlign,cellsFormat:s,grid:e});e.columns.push(l),e._refreshHeaderBar(),e.$.fireEvent("closeColumnDialog",{dataField:l.dataField})}}_openAddColumnDialog(e,t,l){const a=this,i=a._dialogAddColumn||a._createDialog(a.editing.addColumnDialog),o=e?a.localize("dialogEditColumn",{value:e.label}):a.localize("dialogAddColumn"),n=i.querySelector(".smart-footer").querySelector(".smart-stack-layout");i.classList.add("smart-grid-dialog-add-column"),i.type=e?"customize":"add",i.editColumn=e||null,n.classList.remove("right"),n.classList.add("center"),a._cellEditors||(a._cellEditors=[]);const d=a._getAddColumnDialogTemplate();if(i.header.innerHTML=o,i.header.parentElement.classList.add("smart-hidden"),i.callback=l,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===a.view&&(i.header.innerHTML=a.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"))),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),"kanban"===a.view?i.btnCancel.classList.add("smart-hidden"):i.btnCancel.classList.remove("smart-hidden"),a.cancelEdit(),!a._dialogAddColumn){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){a._addColumnDialogInitEditors(),a._addColumnDialogShowHideEditors(i.editColumn),a.$.fireEvent("openColumnDialog",{dataField:i.editColumn?i.editColumn.dataField:null});const e=a.offset(i);if(e.top+i.offsetHeight>window.innerHeight){const t=e.top+i.offsetHeight-window.innerHeight;i.style.maxHeight=Math.max(250,i.offsetHeight-t)+"px",i.style.minHeight="250px"}else i.style.maxHeight="",i.style.minHeight=""},i.onClose=function(){i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){a._confirmAddColumnDialog(),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&"kanban"!==a.view&&(i.result=!1,i.close())},a._dialogAddColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e),a._addColumnDialogEditors=[];for(let t=0;t<d.length;t++){const l=d[t],o=document.createElement("div"),n=document.createElement("label");n.innerHTML=l.label;const r=document.createElement("div");if(r.classList.add("smart-grid-dialog-editor","add-column"),r.innerHTML="",r.setAttribute("filter",l.filter),r.setAttribute("bind",l.bind),o.setAttribute("field-name",l.bind),o.setAttribute("field-filter",l.filter),a._addColumnDialogEditors[l.bind]=r,"type"===l.bind&&r.addEventListener("change",(()=>{a._addColumnDialogShowHideEditors(i.editColumn);const e=a._dialogAddColumn.querySelector('[bind="type"]'),t=e.querySelector("smart-input").getSelectedItem().value;let l="smart-icon-font";switch(t){case"multiText":l="smart-icon-fontsize";break;case"image":l="smart-icon-image";break;case"number":l="smart-icon-number";break;case"select":l="smart-icon-sort-down";break;case"multiSelect":l="smart-icon-list-unordered";break;case"boolean":l="smart-icon-check-squared";break;case"date":l="smart-icon-calendar";break;case"createdTime":case"modifiedTime":l="smart-icon-clock";break;case"createdBy":case"modifiedBy":case"collaborator":l="smart-icon-user";break;case"slider":l="smart-icon-number";break;case"autoNumber":l="smart-icon-list-ordered";break;case"url":l="smart-icon-link";break;case"email":l="smart-icon-mail";break;case"password":l="smart-icon-lock";break;case"phone":l="smart-icon-phone"}if(a._addColumnDialogEditors.type.icon=l,e.firstElementChild.className="smart-grid-icon show smart-description-button "+l,"select"===t||"multiSelect"===t){const e=a._addColumnDialogEditors.options.querySelector("smart-sortable");e&&e._validate&&e._validate()}else i.btnConfirm.disabled=!1})),"boolean"===l.type)a._createColumnBooleanEditor(r,l,o,e,n);else{if("label"===l.type){e.appendChild(o),o.classList.add("smart-grid-dialog-field"),o.appendChild(n);const t=document.createElement("div");t.style.height="10px",o.appendChild(t);continue}{let s=document.createElement("smart-input");if(s.classList.add("underlined","edit-column-input"),s.style.width="100%",s.style.height="30px",l.width&&(o.style.width=l.width,o.style.float="left"),"items"===l.type){const e=document.createElement("smart-button");e.classList.add("primary"),e.innerHTML='<div style="align-items: center; white-space: nowrap; display: flex;"><span class="smart-grid-icon show smart-icon-plus"></span><span>'+a.localize("commandBarAddRow")+"</span></div>";const t=document.createElement("div");t.classList.add("smart-grid-add-column-dialog-color-panel");const o=document.createElement("smart-sortable");o.disableMode="manual",o.dragMode="handle",o.handleVisibility="visible",o.handlePosition="left";const n=()=>{i.btnConfirm.disabled=!1,0!==t.offsetHeight&&t.querySelectorAll(".edit-column-input").forEach((e=>{""===e.value&&(i.btnConfirm.disabled=!0)}))},d=(e,t,i)=>{const d=document.createElement("div"),r=a._getColorInput(),s=document.createElement("div"),c=document.createElement("smart-input"),m=a._addColumnDialogEditors.allowColorItems;if(void 0!==i)c.setAttribute("data-id",i);else{const e=o.querySelectorAll(".smart-sortable-item");c.setAttribute("data-id",e)}return r.disabled=!m.querySelector(".smart-input").value,s.className="smart-grid-icon smart-icon-close show",s.setAttribute("role","button"),s.setAttribute("aria-label","button"),c.classList.add("underlined","edit-column-input"),c.style.width="100%",c.style.height="30px",c.required=!0,e&&(c.value=e),t&&(r.value=t),c.onkeyup=c.onchange=()=>{n()},d.appendChild(r),d.appendChild(c),"users"!==l.bind&&d.appendChild(s),s.onclick=()=>{d.remove(),o.$.container.appendChild(l),o.updateItems(),n()},d.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),d};o._init=e=>{o.clearContent(),e&&(e.forEach(((e,t)=>{const l=void 0!==e.id?e.id:t,a=d(e.label,e.color,l);o.$.container.appendChild(a)})),o.updateItems())},o._validate=n,a._addColumnDialogEditors.allowColorItems.onchange=e=>{let t=a._addColumnDialogEditors.allowColorItems.parentElement.nextElementSibling,l=null;for(;t;){if("options"===t.getAttribute("field-name")){l=t;break}t=t.nextElementSibling}l&&l.querySelectorAll("smart-color-input").forEach((t=>{t.disabled=!e}))},t.appendChild(o),"users"!==l.bind&&(t.appendChild(e),e.onclick=()=>{const e=d();o.$.container.appendChild(e),o.updateItems(),e.querySelector(".edit-column-input").focus(),i.btnConfirm.disabled=!0}),s=t,r.style.height="auto"}else if("number"===l.type)s=document.createElement("smart-number-input"),s.classList.add("underlined"),s.style.width="100%",s.style.height="30px","minValue"===l.bind?(s.value=0,s.min=-9999999,s.max=9999999):"maxValue"===l.bind?(s.value=1e6,s.min=-9999999,s.max=9999999):"minLength"===l.bind?s.value=0:"maxLength"===l.bind&&(s.value=500);else if("datetime"===l.type)s=document.createElement("smart-date-input"),s.classList.add("underlined"),s.style.width="100%",s.style.height="30px","minDateTime"===l.bind?s.value=new Date(1900,0,1):"maxDateTime"===l.bind&&(s.value=new Date(2100,0,1));else if("radio"===l.type){const e=(e,t,l)=>{const a=document.createElement("div"),i=document.createElement("label"),o=document.createElement("div");return i.innerHTML=e,o.classList.add("smart-input"),o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-check-box-cell-editor"),t&&o.setAttribute("checked",""),o.value=void 0!==t&&t,r.appendChild(o),a.onclick=function(){if(o.value=!0,!1===o.value?o.removeAttribute("checked"):o.setAttribute("checked",o.value?"":"indeterminate"),a.onchange&&a.onchange(a),o.value){const e=o.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),o.value=!0,o.setAttribute("checked",o.value?"":"indeterminate"),e.value=l}},a.appendChild(o),a.appendChild(i),a.classList.add("smart-grid-dialog-boolean-field"),a.setAttribute("template","checkBox"),a.setAttribute("editor",""),a},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),r.classList.add("radio-group");for(let a=0;a<l.options.length;a++){const i=l.options[a],o=e(i.label,i.checked);if(l.columns){const e=100/l.columns;o.style.width=e+"%",o.style.float="left"}t.appendChild(o),i.checked&&(r.value=i.value)}const a=document.createElement("div");a.style.clear="both",t.appendChild(a),s=t}if(l.options){s.readonly=!0;let e=l.options;"type"===l.bind&&(void 0!==a.currentUser&&null!==a.currentUser||(e=e.filter((e=>"modifiedBy"!==e.value&&"createdBy"!==e.value))),(void 0===a.users||null===a.users||a.users&&0===a.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),s.dataSource=e,s.dropDownButtonPosition="right","dataField"!==l.bind&&(s.selectedIndex=0),l.options.length<15?s.dropDownHeight="auto":s.dropDownHeight=300}if(l.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",l.icon,"show","smart-description-button"),r.appendChild(e),s.style.width="calc(100% - 25px)"}if(r.appendChild(s),l.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=l.info,r.appendChild(e),s.style.width="calc(100% - 25px)"}if(e.appendChild(o),o.classList.add("smart-grid-dialog-field"),o.appendChild(n),o.appendChild(r),l.width&&!d[t+1].width){const t=document.createElement("div");t.style.clear="both",e.appendChild(t)}}}}}const r=()=>{const t=parseInt(i.style.width),l=a.offset(a);if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=a.offsetWidth+"px",void(i.style.height=a.offsetHeight+"px");{const e=a.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const o=e.element;if(o){const e=a.offset(o),n=e.left-l.left,d=l.left,r=Math.max(d,n);if(r+t+o.offsetWidth>l.left+a.offsetWidth){const a=r-t+o.offsetWidth;a<0?i.open("center",e.top+o.offsetHeight-l.top):i.open(Math.max(d,a),e.top+o.offsetHeight-l.top)}else i.open(r,e.top+o.offsetHeight-l.top)}else i.classList.add("center"),i.open("center","center")}else if(a._addNewColumn){let e=a._addNewColumn.element,o=a.offset(e),n=o.left-l.left-t+e.offsetWidth,d=l.left,r=Math.max(d,n);a.editing.addNewColumn._addButton&&a.editing.addNewColumn._addButton.classList.contains("show")&&(e=a.editing.addNewColumn._addButton,o=a.offset(a.editing.addNewColumn._addButton),n=o.left-l.left-t+e.offsetWidth,d=l.left,r=Math.max(d,n)),i.open(r,o.top+e.offsetHeight-l.top)}else i.open("center","center"),i.classList.add("center")};r(),i.refresh=()=>{r()},setTimeout((function(){i.btnConfirm.focus()}),100)}});
6
+ Smart.Utilities.Assign("Grid.Dialog",class{_openImagePreviewDialog(e){const t=this;e=e.cloneNode(),t._dialogImagePreview||(t._dialogImagePreview=t._createDialog({modal:!0,screenModal:!0,left:"screenMiddle",top:"screenCenter",width:"80%",height:"80%"})),t._dialogImagePreview.content.innerHTML="",t._dialogImagePreview.content.appendChild(e),t._dialogImagePreview.btnClose.onclick=e=>{t._dialogImagePreview.close(),e.preventDefault(),e.stopPropagation()},e.style.marginLeft="auto",e.style.marginRight="auto",e.style.maxWidth="",e.onload=()=>{e.width=e.naturalWidth,e.height=e.naturalHeight;const l=150+Math.min(850,e.width),a=150+Math.min(650,e.height);t._dialogImagePreview.style.width=l+"px",t._dialogImagePreview.style.height=a+"px",t._dialogImagePreview.style.left="calc(50% - "+Math.min(850,t._dialogImagePreview.offsetWidth/2)+"px)",t._dialogImagePreview.style.top="calc(50% - "+Math.min(650,t._dialogImagePreview.offsetHeight/2)+"px)";const i=getComputedStyle(t._dialogImagePreview),o=parseInt(i.top),n=parseInt(i.left);(window.offsetWidth<l||window.offsetHeight<a||o<0||n<0)&&(t._dialogImagePreview.style.left="0px",t._dialogImagePreview.style.top="0px",t._dialogImagePreview.style.width="100%",t._dialogImagePreview.style.height="100%"),e.style.maxWidth="100%"},t._dialogImagePreview.content.onpointerdown=t._dialogImagePreview.content.onpointerup=e=>{e.preventDefault(),e.stopPropagation()},t._dialogImagePreview.onkeydown=function(e){"Escape"===e.key&&t._dialogImagePreview.close()},t._dialogImagePreview.btnClose.tabIndex=0,t._dialogImagePreview.onOpen=()=>{setTimeout((()=>{t._dialogImagePreview.btnClose.focus()}),100)},t._dialogImagePreview.footer.remove(),t._dialogImagePreview.header.parentNode.style.backgroundColor="var(--smart-background)",t._dialogImagePreview.open()}_openImageDialog(e,t){const l=this,a=l._dialogImage||l._createDialog(),i='<span class="smart-grid-icon smart-icon-image show"></span>'+l.localize("dialogImageHeader");if(a.cell||(a.cell=e),a.header.innerHTML=i,a.column=e.column,a.command=t,a.classList.add("smart-grid-image-dialog"),!l._dialogImage){a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),a.onOpen=function(){a.fileUpload.value="",a.input.value="";let e=a.cell.editor.instance.getValue();if("[]"!==e)if(e&&"string"==typeof e&&e.indexOf("http")>=0)a.input.value=JSON.parse(e)[0].value,a.tabs[1].click(),o("input");else{a.tabs[0].click();const t=(e,t)=>{let l=e.split(","),a=l[0].match(/:(.*?);/)[1],i=atob(l[1]),o=i.length,n=new Uint8Array(o);for(;o--;)n[o]=i.charCodeAt(o);return new File([n],t,{type:a})},l=new DataTransfer;"string"==typeof e&&e.indexOf("base64")>=0&&(e=JSON.parse(e)),Array.isArray(e)&&(e.forEach((e=>{l.items.add(t(e.value,e.label))})),a.fileUpload.files=l.files,o())}else a.tabs[0].click()},a.onClose=function(){},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){if(a.tabs[1].classList.contains("active"))a.input.value?e.editor.instance.setValue([{label:a.input.value,value:a.input.value}]):e.editor.instance.setValue([]),l._endCellEdit(a.cell);else{const t=(e,t)=>{var l=new FileReader;l.readAsDataURL(e),l.onload=function(){t(l.result)},l.onerror=function(){t("error")}},i=[];if(a.fileUpload.files.length)for(let o=0;o<a.fileUpload.files.length;o++){const n=a.fileUpload.files[o];t(n,(t=>{"error"===t&&console.log("Image load error"),i.push({value:t,label:n.name}),i.length===a.fileUpload.files.length&&(e.editor.instance.setValue(i),l._endCellEdit(a.cell))}))}else e.editor.instance.setValue([]),l._endCellEdit(a.cell)}a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},l._dialogImage=a,a.content.innerHTML=`\n <div>\n <div>\n <div class="tabs">\n <div class="active tab">\n <span class="smart-grid-icon smart-icon-plus show"></span><label>${l.localize("dialogImageDevice")}</label>\n </div>\n <div class="tab">\n <span class="smart-grid-icon smart-icon-link show"></span><label>${l.localize("dialogImageLink")}</label>\n </div>\n </div>\n </div>\n <div class="smart-grid-drop-zone">\n <div>\n <div class="title"><span class="smart-grid-icon smart-icon-plus show"></span><label>${l.localize("dialogImageUpload")}</label></div>\n <div class="subtitle"><span class="smart-grid-icon smart-icon-docs show"></span><label>${l.localize("dialogImageDrop")}</label></div>\n </div> \n <input accept=".jpg, .jpeg, .png" type="file" multiple="multiple" style="display: none;">\n </div>\n <div class="smart-hidden url-zone">\n <div class="url-title">\n ${l.localize("dialogImageURL")}\n </div>\n <div class="upload">\n <smart-input placeholder="https://example.com/image.png" class="underlined"></smart-input>\n <br/>\n <smart-button disabled class="success">${l.localize("dialogImageURLUpload")}</smart-button>\n </div>\n </div>\n <div class="preview">\n </div>\n <br/>\n </div>`,a.input=a.querySelector("smart-input"),a.dropZone=a.querySelector(".smart-grid-drop-zone"),a.upload=a.querySelector(".title"),a.fileUpload=a.querySelector("input"),a.preview=a.querySelector(".preview"),a.tabs=a.querySelectorAll(".tab"),a.urlZone=a.querySelector(".url-zone"),a.uploadButton=a.querySelector("smart-button");const t=["image/apng","image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon"],i=e=>t.includes(e.type);a.dropZone.ondrop=e=>{if(e.preventDefault(),e.dataTransfer.items){let t=0;for(let l=0;l<e.dataTransfer.items.length;l++)if("file"===e.dataTransfer.items[l].kind){const a=e.dataTransfer.items[l].getAsFile();i(a)&&t++}if(t===e.dataTransfer.files.length){const t=new DataTransfer,l=[...e.dataTransfer.files];[...a.fileUpload.files].forEach((e=>{t.items.add(e)})),l.forEach((e=>{t.items.add(e)})),a.fileUpload.files=t.files,o()}}else a.fileUpload.files=e.dataTransfer.files,o()},a.dropZone.ondragover=e=>{e.preventDefault()},a.tabs[0].onclick=()=>{a.tabs[0].classList.add("active"),a.tabs[1].classList.remove("active"),a.dropZone.classList.remove("smart-hidden"),a.urlZone.classList.add("smart-hidden"),a.updatePreview()},a.tabs[1].onclick=()=>{a.tabs[0].classList.remove("active"),a.tabs[1].classList.add("active"),a.dropZone.classList.add("smart-hidden"),a.urlZone.classList.remove("smart-hidden"),a.updatePreview("input")},a.uploadButton.onclick=()=>{a.updatePreview("input")};const o=e=>{const t=a.preview,n=a.fileUpload;function d(e){return e<1024?e+"bytes":e>=1024&&e<1048576?(e/1024).toFixed(1)+"KB":e>=1048576?(e/1048576).toFixed(1)+"MB":void 0}for(;t.firstChild;)t.removeChild(t.firstChild);const s=()=>{const e=document.createElement("div");return e.classList.add("item"),e.onpointerdown=t=>{const i=e.getBoundingClientRect();if(a.input.value="",t.clientY>=i.bottom-12){if(t.clientX>i.left+i.width/2-13&&t.clientX<i.left+i.width/2+13){e.remove();const t=a.preview.querySelectorAll(".item"),l=new DataTransfer;t.forEach((e=>{l.items.add(e.file)})),n.files=l.files,a.clearButton&&0===t.length&&a.clearButton.classList.remove("show")}}else l._openImagePreviewDialog(e.querySelector("img"))},e},r=()=>{const e=document.createElement("div");e.classList.add("list");const i=document.createElement("div");i.classList.add("smart-grid-icon","show","smart-icon-delete"),i.title=l.localize("clear"),t.appendChild(i),i.onclick=()=>{n.value="",a.input.value="",o()},a.clearButton=i,t.appendChild(e)};if("input"===e){const e=a.input.value;if(e){const t=s();if(r(),e.endsWith("png")||e.endsWith("jpeg")||e.endsWith("jpg")){const l=document.createElement("img");l.src=e,t.appendChild(l)}a.preview.lastChild.appendChild(t)}else{const e=document.createElement("p");e.textContent=l.localize("dialogImageFileUpload"),t.appendChild(e)}}else{const e=n.files;if(0===e.length){const e=document.createElement("p");e.textContent=l.localize("dialogImageFileUpload"),t.appendChild(e)}else{r();const o=new DataTransfer;for(const n of e){const e=s(),r=document.createElement("div");if(i(n)){r.textContent=`${n.name}, ${d(n.size)}.`,r.textContent.length>20&&(r.textContent=`${n.name.substring(0,5)}...${n.name.substring(n.name.length-4)}, ${d(n.size)}.`);const a=document.createElement("img");if(a.src=URL.createObjectURL(n),n.size>2097152){const e=document.createElement("p");e.textContent=l.localize("dialogImageSize",{value:n.name}),t.appendChild(e);continue}o.items.add(n),e.file=n,e.title=r.textContent,e.appendChild(a),e.appendChild(r)}a.preview.querySelector(".list").appendChild(e)}n.files=o.files}}};a.updatePreview=o,a.fileUpload.onchange=()=>{if(0===a.fileUpload.files.length&&a._tempFiles)a.fileUpload.files=a._tempFiles;else if(a._tempFiles){const e=new DataTransfer,t=[...a.fileUpload.files];[...a._tempFiles].forEach((t=>{e.items.add(t)})),t.forEach((t=>{e.items.add(t)})),a.fileUpload.files=e.files}o()},a.input.onchange=a.input.onblur=a.input.onkeyup=()=>{a.uploadButton.disabled=!a.input.value||!a.input.value.startsWith("https://")},a.upload.onclick=()=>{a._tempFiles=[];const e=new DataTransfer;[...a.fileUpload.files].forEach((t=>{e.items.add(t)})),a._tempFiles=e.files,a.fileUpload.click()}}a.open(),setTimeout((function(){a.btnConfirm.focus()}),100)}_createOverlay(){const e=document.createElement("div");return e.onpointerdown=function(){return!1},e.onmousedown=function(){return!1},e.onclick=function(){},e.classList.add("smart-grid-dialog-overlay"),e}_createDialog(e){const t=this;let l=document.createElement("div");e||(e=t.editing.dialog),void 0!==e.modal&&(l.modal=e.modal),void 0!==e.screenModal&&(l.screenModal=e.screenModal),l.setAttribute("animation","none"),l.classList.add("smart-window","smart-grid-dialog"),l.style.width="auto"===e.width?e.width:e.width+"px",l.style.height="auto"===e.height?e.height:e.height+"px",e.width&&"string"==typeof e.width&&(l.style.width=e.width),e.height&&"string"==typeof e.height&&(l.style.height=e.height),l.style.left="",l.style.top="",l.innerHTML='<div class="smart-container">\n <div class ="smart-content-container" smart-id="container">\n <div id="headerSection" class="smart-header-section">\n <div class="smart-header"></div>\n <div class="smart-buttons-container">\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-prev-button" aria-label="Previous Record" smart-id="prevButton"></button>\n <button tabindex=-1 class ="smart-hidden smart-button smart-element smart-next-button" aria-label="Next Record" smart-id="nextButton"></button>\n <button class ="smart-button smart-element smart-close-button" aria-label="Close" smart-id="closeButton"></button>\n </div>\n </div>\n <div class="smart-content"><div class="smart-content-container"></div></div>\n <div class ="smart-footer">\n <div class ="smart-stack-layout right spacing">\n <smart-button class ="smart-confirm-button item primary">Ok</smart-button>\n <smart-button class ="smart-cancel-button item">Cancel</smart-button>\n </div>\n </div>\n </div>\n </div>\n ',l.querySelector&&l.querySelector(".smart-content")&&(l.content=l.querySelector(".smart-content").firstChild),l.footer=l.querySelector(".smart-footer"),l.header=l.querySelector(".smart-header"),l.btnConfirm=l.querySelector(".smart-confirm-button"),l.btnCancel=l.querySelector(".smart-cancel-button"),l.btnClose=l.querySelector(".smart-close-button"),l.btnNext=l.querySelector(".smart-next-button"),l.btnPrev=l.querySelector(".smart-prev-button");const a=document.createElement("div");return a.classList.add("smart-grid-dialog-overlay"),a.onclick=function(){},l.overlay=a,l.remove=function(){l.parentNode&&l.parentNode.removeChild(l)},l.close=function(){l.classList.remove("open"),l.addEventListener("transitionend",l.remove),l.addEventListener("transitioncancel",l.remove),l.modal&&l.overlay.parentNode&&l.overlay.parentNode.removeChild(l.overlay),l.onClose&&l.onClose()},l.open=function(a,i){l.removeEventListener("transitionend",l.remove),l.removeEventListener("transitioncancel",l.remove),document.body.appendChild(l),void 0===a&&(a=e.left),void 0===i&&(i=e.top),requestAnimationFrame((function(){l.classList.add("open");const e=function(e,a){const i=t.offset(t);switch("center"===e&&"horizontal"===a&&(e="middle"),e){case"top":return i.top;case"bottom":return Math.max(i.top,i.top+t.offsetHeight-l.offsetHeight);case"center":return Math.max(i.top,i.top+t.offsetHeight/2-l.offsetHeight/2);case"left":return i.left;case"middle":return i.left+t.offsetWidth/2-l.offsetWidth/2;case"right":return i.left+t.offsetWidth-l.offsetWidth}return"horizontal"===a?parseInt(e)+i.left:"vertical"===a?parseInt(e)+i.top:"number"==typeof e?e:parseInt(e)};l.style.left=e(a,"horizontal")+"px",l.style.top=e(i,"vertical")+"px","screenMiddle"===a&&(l.style.left="calc(50% - "+l.offsetWidth/2+"px)"),"screenCenter"===i&&(l.style.top="calc(50% - "+l.offsetHeight/2+"px)")})),l.modal&&(l.screenModal?document.body.appendChild(l.overlay):t.appendChild(l.overlay)),l.onOpen&&l.onOpen()},l}_openAddRowDialog(e,t){const l=this;if(!l.editing.addDialog.enabled)return!1;const a=l._dialogAddRow||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogAddHeader"):l.editing.dialog.header,o=a.content;a.header.innerHTML=i,e.grid=l,void 0===e.index&&(e.index=l.rows.length,l._rowsAdded&&(e.index+=l._rowsAdded.length));const n=e.cells;let d=null,s=0;if(l._cellEditors||(l._cellEditors=[]),!l._dialogAddRow){a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogAddButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogAddButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0},a.onClose=function(){l.editing.dialog.visible=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){const e={};for(let t=0;t<n.length;t++){const a=n[t],i=l._getEditorValue(a),o=l._getEditorId(a),d=l._cellEditors[o];d&&(i&&i.error?(e[a.column.dataField]=i.value,d.detach()):(e[a.column.dataField]=i,d.detach()))}const i=l._rowsAdded?l._rowsAdded.length:0,o=new Smart.Grid.Row({index:l.rows.length+i,id:Smart.Utilities.Core.createGUID(),grid:l,data:e});a.close(),t(o,0===a.index)},a.onkeydown=function(e){const t=e.key;"Enter"===t?a.btnConfirm.onclick():"Escape"===t&&a.close()},o.classList.add("smart-grid-layout");for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(!t.allowEdit)continue;s%2==0&&(d=document.createElement("div"),d.classList.add("row"),o.appendChild(d));const a=document.createElement("div");a.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const n=document.createElement("label");n.innerHTML=l.columns[e].label;const r=document.createElement("div");r.classList.add("smart-grid-dialog-editor"),r.setAttribute("editor",t.dataField),r.setAttribute("template",t.editor.template),a.appendChild(i),d.appendChild(a),i.appendChild(n),i.appendChild(r),s++}}a.open(),a.index=e.index;let r=0;for(let e=0;e<n.length;e++){const t=n[e],i=t.column,o=i.dataField,d=a.querySelector("[editor="+o+"]");if(!d)continue;d.innerHTML="";let s="";void 0!==t.value&&(s=t.value),"int64"!==i.dataType&&"number"!==i.dataType&&"int"!==i.dataType&&"float"!==i.dataType||(s=0),"date"===i.dataType&&(s=new Date),"bool"!==i.dataType&&"boolean"!==i.dataType||(s=!1);let c=null;switch(t.editor.template){default:case"custom":c=l._getCustomCellEditor(t);break;case"image":c=l._getImageCellEditor(t);break;case"checkBox":c=l._getCheckBoxCellEditor(t);break;case"autoComplete":c=l._getAutoCompleteCellEditor(t);break;case"dropDownList":c=l._getAutoCompleteCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"comboBox":c=l._getAutoCompleteCellEditor(t),c.readonly=!1,c.dropDownButtonPosition="right";break;case"maskedTextBox":c=l._getMaskCellEditor(t);break;case"checkInput":c=l._getCheckInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiInput":c=l._getMultiInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"multiComboInput":c=l._getMultiComboInputCellEditor(t),c.readonly=!0,c.dropDownButtonPosition="right";break;case"time":case"timeInput":c=l._getTimeInputCellEditor(t);break;case"date":case"dateInput":c=l._getDateInputCellEditor(t);break;case"dateRangeInput":c=l._getDateRangeInputCellEditor(t);break;case"dateTimePicker":c=l._getDateTimePickerCellEditor(t);break;case"textArea":case"textarea":c=l._getTextAreaCellEditor(t);break;case"numberInput":case"text":case"input":c="numberInput"===t.editor.template?l._getNumberInputCellEditor(t):l._getInputCellEditor(t)}if(c.attach(),t.editor.instance=c,c.setValue(s),0===r&&setTimeout((()=>{c.focus()}),100),!t.editor.isInitialized&&(t.editor.isInitialized=!0,t.editor.onInit)){const e=t.editor.onInit(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)l[t]=e[t]}));else if(e){const l=e,a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in l)a[e]=l[e]}}if(t.editor.onRender){const e=t.editor.onRender(t.row.index,t.column.dataField,t.editor.instance.element,t.row.data);if(e&&e instanceof Promise)e.then((e=>{const l="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let t in e)l[t]=e[t]}));else if(e){const l=e,a="custom"===t.editor.template?t.editor.instance.element.firstElementChild:t.editor.instance.element;for(let e in l)a[e]=l[e]}}d.appendChild(c.element),c.element.onfocus=()=>{d.setAttribute("focus","")},c.element.onblur=()=>{d.removeAttribute("focus")},r++}l._dialogAddRow=a}_openEditDialog(e,t){const l=this;if(!l.editing.dialog.enabled)return!1;const a=l._dialogEdit||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogEditHeader",{value:l.editing.editRow?e.row.visibleIndex+1:e.column.label}):l.editing.dialog.header,o=a.content;a.header.innerHTML=i,a.row=l.editing.editRow,l.editing.recordNavigation&&a.classList.add("disable-animation");let n=null,d=0;if(void 0!==l._settingsDialogRowId){a.btnPrev.classList.remove("smart-hidden"),a.btnNext.classList.remove("smart-hidden");const e=e=>{const t=l.editing.editRow,i=l._recyclingRows.indexOf(t),o=e?l._recyclingRows[i+1]:l._recyclingRows[i-1];if(o){a.classList.add("disable-animation"),l.editing.recordNavigation=!0;const e=a.querySelector("[focus]");if(e){const t=e.closest(".row"),a=t.closest(".smart-grid-edit-dialog-editors-container");let i=-1;if(a&&(i=[...a.children].indexOf(t)),l.cancelEdit(),l._openRowSettingsDialog(o.id),l._dialogEdit&&i>=0){const e=l._dialogEdit.querySelectorAll(".row")[i];if(e){const t=e.querySelector(".smart-grid-dialog-editor");t.setAttribute("focus",""),t.querySelector(".smart-grid-cell-editor").focus()}}}else l.cancelEdit(),l._openRowSettingsDialog(o.id)}};a.btnNext.onmousedown=t=>{e(!0),t.preventDefault(),t.stopPropagation()},a.btnPrev.onmousedown=t=>{e(!1),t.preventDefault(),t.stopPropagation()}}if(!l._dialogEdit)if(a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogEditButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogEditButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0,l._settingsDialogRowId&&a.editorsContent&&a.editorsContent.offsetHeight&&(a.editorsContent.style.maxHeight=a.editorsContent.offsetHeight+40+"px")},a.onClose=function(){l.editing.dialog.visible=!1,a.row&&(a.row.showDetail=!1)},a.btnCancel.onclick=function(){l.cancelEdit()},a.btnClose.onclick=function(){l.cancelEdit()},a.btnConfirm.onclick=function(){if(void 0!==l._settingsDialogRowId){if(l.rowById[l._settingsDialogRowId]){const e=l.editing.editRow;if(!e)return!1;const t=e.cells;let i={};e.element.removeAttribute("error");for(let e=0;e<t.length;e++){const a=t[e],o=l._getEditorValue(a);i[a.column.dataField]=o}const o=l.validateRow(e.id,i);if(Object.keys(o).length>0){let e=!0;for(let i=0;i<t.length;i++){const n=t[i],d=o[n.column.dataField],s=a.querySelector(`[label-for="${n.column.dataField}"]`);if(s&&(s.innerHTML=""),d)for(let t in d){const a=d[t];let i="";if(!a)continue;let o=a[t];"minLength"!==t&&"maxLength"!==t||(o=a[t.toLowerCase()]),i=a.message?a.message:"required"===t?l.localize("requiredValue",{value:n.column.label}):"min"===t?l.localize("invalidMinValue",{value:n.column.label,min:o.min}):"max"===t?l.localize("invalidMaxValue",{value:n.column.label,max:o.max}):"minLength"===t?l.localize("invalidMinLengthValue",{value:n.column.label,min:o.requiredLength}):"maxLength"===t?l.localize("invalidMaxLengthValue",{value:n.column.label,max:o.requiredLength}):l.localize("invalidValue"),e=!1,s&&(s.innerHTML=i)}}if(!e)return}a._userData._changed=!0,e._userData=a._userData}if(a.columnVisibility){let e=!1;const t=l.columns.canNotify;l.columns.canNotify=!1;for(let t in a.columnVisibility){const i=l.columnByDataField[t];i.visible!==a.columnVisibility[t]&&(i.visible=a.columnVisibility[t],e=!0)}if(l.columns.canNotify=t,e)return l.endEdit(),void l.refresh(!1)}}l.endEdit()},a.onkeydown=function(e){const t=e.key,a=l.editing.commandKeys;for(let e in a){const i=a[e];if(t===i.key){l._applyCommand(i.command);break}}},l.editing.editRow)if(void 0!==l._settingsDialogRowId)l._applySettingsDialogLayout(a,o,l.editing.editRow);else{o.classList.add("smart-grid-layout");for(let e=0;e<l.columns.length;e++){const t=l.columns[e];if(!t.allowEdit)continue;d%2==0&&(n=document.createElement("div"),n.classList.add("row"),o.appendChild(n));const a=document.createElement("div");a.classList.add("col-sm-6");const i=document.createElement("div");i.classList.add("column");const s=l._settingsDialogRowId?document.createElement("div"):document.createElement("label");s.innerHTML=l.columns[e].label;const r=document.createElement("div");r.classList.add("smart-grid-dialog-editor"),r.setAttribute("editor",t.dataField),r.setAttribute("template",t.editor.template),a.appendChild(i),n.appendChild(a),i.appendChild(s),i.appendChild(r),d++}}else{const t=e.column,l=document.createElement("div");l.classList.add("smart-grid-dialog-editor"),l.setAttribute("editor",""),l.setAttribute("template",t.editor.template),o.appendChild(l)}if(a.open(),l.editing.editRow){const l=a.querySelector("[editor="+e.column.dataField+"]");l.innerHTML="",l.appendChild(t.element),t.element.onfocus=()=>{l.setAttribute("focus","")},t.element.onblur=()=>{l.removeAttribute("focus")}}else{const l=e.column,i=a.querySelector("[editor]");i.innerHTML="",i.setAttribute("template",l.editor.template),i.appendChild(t.element),t.element.onfocus=()=>{i.setAttribute("focus","")},t.element.onblur=()=>{i.removeAttribute("focus")}}l._dialogEdit=a}_refreshCurrentUser(){const e=this,t=e.users;let l=e.currentUser,a=!0,i=!0,o=e.editing.enabled,n=!0;t&&null!==l&&(l=t.find((e=>e.id===l)),l&&(a=!1!==l.allowAdd,i=!1!==l.allowComment,o=o&&!1!==l.allowEdit,n=!1!==l.allowRemove)),e._currentUser={allowAdd:a,allowComment:i,allowEdit:o,allowRemove:n,info:l}}_getColorInput(){const e=document.createElement("smart-color-input");return e.dataSource=["#D50000","#E67C73","#F4511E","#F6BF26","#33B679","#0B8043","#039BE5","#3F51B5","#7986CB","#8E24AA","#616161","#FFFFFF","#000000",""],e.valueDisplayMode="colorBox",e.classList.add("underlined","smart-grid-color-input"),e.style.width="auto",e.readonly=!0,e.onRender=()=>{const t=e.$.scrollView;t&&t.classList.add("smart-grid-color-input")},e}_applySettingsDialogLayout(e,t,l){const a=this;e.classList.add("smart-grid-dialog-expand-row");const i=[];e.columnVisibility=i;const o=document.createElement("div"),n=document.createElement("div"),d=document.createElement("div");d.appendChild(o),d.appendChild(n),t.appendChild(d),d.classList.add("smart-grid-edit-dialog-layout"),o.classList.add("smart-grid-edit-dialog-editors-container"),n.classList.add("smart-grid-edit-dialog-activity-container"),a.columns.length>=8&&o.classList.add("many"),e.editorsContent=o,e.activityContent=n;const s=document.createElement("div"),r=document.createElement("div");n.appendChild(s),n.appendChild(r),s.innerHTML=`\n <div class="tabs">\n <div view="details" class="active tab"><div class="tab-label">${a.localize("detailsTab")}</div></div>\n <div view="comments" class="tab"><div class="tab-label">${a.localize("commentsTab")}</div></div>\n <div view="history" class="tab smart-hidden"><div class="tab-label">${a.localize("historyTab")}</div></div>\n </div>\n <div class="details-tab">\n <div class="row"><div class="column"><div class="header smart-grid-edit-dialog-column-info">${a.localize("format").replace(":","")}\n <span title="${a.localize("resetFormat")}" class="reset-format smart-grid-icon smart-icon-reload show"></span>\n </div>\n </div>\n <div class="format-layout">\n <div title="${a.localize("background")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-color-background show"></span><div class="background"></div>\n </div>\n <div title="${a.localize("color")}" class="format smart-grid-edit-dialog-column-info">\n <span style="border-bottom: 2px solid #46CA78;" color="#46CA78" class="format smart-grid-icon smart-icon-font show"></span><div class="color"></div>\n </div>\n <div class="format-layout button-group">\n <span title="${a.localize("bold")}" class="formatbtn bold smart-grid-icon smart-icon-bold show"></span>\n <span title="${a.localize("italic")}" class="formatbtn italic smart-grid-icon smart-icon-italic show"></span>\n <span title="${a.localize("underline")}" class="formatbtn underline smart-grid-icon smart-icon-underline show"></span>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${a.localize("fontFamily").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-font show"></span><div class="font-family"></div>\n </div>\n <div title="${a.localize("fontSize").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span class="smart-grid-icon smart-icon-fontsize show"></span><div class="font-size"></div>\n </div>\n </div>\n <div class="format-layout font-group">\n <div title="${a.localize("status").replace(":","")}" class="format smart-grid-edit-dialog-column-info">\n <span color="#F1C58B" class="smart-grid-icon smart-icon-star show"></span><div class="status"></div>\n </div>\n </div>\n </div>\n </div>\n <div class="comments-tab smart-hidden">\n <div class="column"><div class="comments-header smart-grid-edit-dialog-column-info">${a.localize("comments").replace(":","")}</div></div>\n <div class="comments-layout">\n <div class="comments"><span class="no-comments">${a.localize("noComments")}</span></div>\n <div class="footer">\n <smart-text-area hint="${a.localize("comment")}" placeholder="${a.localize("comment")}" class="success underlined"></smart-text-area>\n <smart-button class="success">${a.localize("send")}</smart-button>\n </div>\n </div>\n </div>\n <div class="history-tab smart-hidden">\n <div class="history-layout">\n </div>\n </div>\n `;const c=s.querySelectorAll(".tab");a.storeHistory&&c[c.length-1].classList.remove("smart-hidden"),s.querySelector(".tabs").onpointerdown=e=>{const t=e.target.closest(".tab");if(t){const e=t.getAttribute("view"),l=s.querySelector(".details-tab"),i=s.querySelector(".comments-tab"),o=s.querySelector(".history-tab");l.classList.add("smart-hidden"),i.classList.add("smart-hidden"),o.classList.add("smart-hidden");for(let e=0;e<c.length;e++)c[e].classList.remove("active");switch(t.classList.add("active"),e){case"details":l.classList.remove("smart-hidden");break;case"comments":i.classList.remove("smart-hidden");break;case"history":o.classList.remove("smart-hidden"),a._refreshHistory()}}};const m=e._userData=JSON.parse(JSON.stringify(l._userData)),u=a._getColorInput();s.querySelector(".background").appendChild(u),u.onchange=()=>{m.background=u.value},m.background&&(u.value=m.background);const p=a._getColorInput();s.querySelector(".color").appendChild(p),p.onchange=()=>{m.color=p.value},m.color&&(p.value=m.color);const g=a._getColorInput();s.querySelector(".status").appendChild(g),g.onchange=()=>{m.status=g.value},m.status&&(g.value=m.status);const b=document.createElement("smart-input");b.style.width="auto",b.classList.add("underlined"),b.dropDownButtonPosition="right",b.readonly=!0,b.dropDownHeight="auto",b.dataSource=["-","Segoe UI","Arial","Georgia","Impact","Tahoma","Times New Roman","Verdana"],b.onchange=()=>{m.fontFamily=b.value},m.fontFamily?b.value=m.fontFamily:b.selectedIndex=0,s.querySelector(".font-family").appendChild(b);const f=document.createElement("smart-input");f.style.width="auto",f.classList.add("underlined"),f.dropDownButtonPosition="right",f.readonly=!0,f.dropDownHeight="auto",f.dataSource=["-","8px","10px","12px","14px","18px","24px","36px"],f.onchange=()=>{m.fontSize=f.value},m.fontSize?f.value=m.fontSize:f.selectedIndex=0,s.querySelector(".font-size").appendChild(f);const h=s.querySelector(".button-group");h.onclick=e=>{const t=e.target.closest(".formatbtn");let l;t.classList.contains("checked")?(t.classList.remove("checked"),l=!1):(t.classList.add("checked"),l=!0),t.classList.contains("bold")?m.fontWeight=l?"bold":null:t.classList.contains("italic")?m.fontStyle=l?"italic":null:t.classList.contains("underline")&&(m.textDecoration=l?"underline":null)},m.fontWeight?h.children[0].classList.add("checked"):h.children[0].classList.remove("checked"),m.fontStyle?h.children[1].classList.add("checked"):h.children[1].classList.remove("checked"),m.textDecoration?h.children[2].classList.add("checked"):h.children[2].classList.remove("checked"),s.querySelector(".reset-format").onclick=()=>{for(let e=0;e<h.children.length;e++)h.children[e].classList.remove("checked");b.selectedIndex=0,f.selectedIndex=0,p.value="",u.value="",g.value="",m.fontWeight=null,m.fontStyle=null,m.textDecoration=null,m.fontSize=null,m.fontFamily=null};const v=s.querySelector(".comments-header"),y=s.querySelector(".comments-layout smart-text-area"),C=s.querySelector(".comments-layout smart-button"),w=s.querySelector(".comments-layout .footer"),x=s.querySelector(".comments-layout .comments");C.disabled=!0,x.innerHTML=`<span class="no-comments">${a.localize("noComments")}</span>`;const k=()=>{const e=x.querySelector(".no-comments");0===m.comments.length?e.classList.remove("smart-hidden"):e.classList.add("smart-hidden")},A=e=>{e.querySelector(".remove-button").onclick=e=>{const t=e.target,l=m.comments.indexOf(t.comment);l>-1&&(m.comments.splice(l,1),t.element.remove(),v.innerHTML=`${a.localize("comments").replace(":","")} (${m.comments.length})`)}};for(let e=0;e<m.comments.length;e++){const t=m.comments[e],l=a._createComment(t);A(l),x.appendChild(l)}v.innerHTML=`${a.localize("comments").replace(":","")} (${m.comments.length})`,k(),y.onfocus=()=>{w.classList.add("focus")},y.onblur=()=>{w.classList.remove("focus")},y.onkeyup=()=>{C.disabled=""===y.value},C.onclick=()=>{if(""===y.value)return;a._refreshCurrentUser();const e={text:y.value,userId:a._currentUser.info?a._currentUser.info.id:-1,time:new Date},t=a._createComment(e);A(t),m.comments.push(e),y.value="",C.disabled=!0,k(),x.appendChild(t),v.innerHTML=`${a.localize("comments").replace(":","")} (${m.comments.length})`};for(let e=0;e<a.columns.length;e++){const t=a.columns[e];if(!t.allowEdit)continue;const l=document.createElement("div");l.classList.add("row"),o.appendChild(l);const n=document.createElement("div"),d=a._settingsDialogRowId?document.createElement("div"):document.createElement("label"),s=t.validationRules&&t.validationRules.length>0?"*":"";d.innerHTML=`<div class="smart-grid-edit-dialog-column-info"><span class="smart-grid-icon ${a.columns[e].icon} show"></span><label>`+a.columns[e].label+s+'</label><span toggle class="smart-grid-icon smart-icon-visibility-on show"</div>';const r=document.createElement("div");r.classList.add("smart-grid-dialog-editor"),r.setAttribute("editor",t.dataField),r.setAttribute("template",t.editor.template);const c=d.querySelector("[toggle]");c.column=t,i[t.dataField]=t.visible,c.title=a.localize("columnMenuItemHide"),c.onclick=()=>{i[c.column.dataField]=!c.column.visible,c.classList.contains("smart-icon-visibility-on")?(c.classList.remove("smart-icon-visibility-on"),c.classList.add("smart-icon-visibility-off"),c.title=a.localize("columnMenuItemShow")):(c.classList.add("smart-icon-visibility-on"),c.classList.remove("smart-icon-visibility-off"),c.title=a.localize("columnMenuItemHide"))},t.visible||(c.classList.remove("smart-icon-visibility-on"),c.title=a.localize("columnMenuItemShow")),t.visible?c.classList.add("smart-icon-visibility-on"):c.classList.add("smart-icon-visibility-off"),n.appendChild(d),n.appendChild(r);const m=document.createElement("label");m.classList.add("smart-field-editor-error-label"),m.setAttribute("label-for",t.dataField),n.appendChild(m),l.appendChild(n)}}_refreshHistory(){const e=this,t=e._dialogEdit;if(!t)return;const l=t.querySelector(".history-layout");if(!e.storeHistory)return void l.classList.add("smart-hidden");l.classList.remove("smart-hidden");const a=t.row.history;let i="\n ";for(let t=a.length-1;t>=0;t--){const l=a[t];let o="";if(e._kanban)o=e._kanban._getHistoryItemLabel(l);else if("created"===l.action)o=e.localize("rowCreated",{value:l.action});else{const t=e.columnByDataField[l.action];o=e.localize("propertyUpdated",{value:t?t.label:l.action})}if(i+='<div class="history-row">',void 0!==l.user){const t=(t=>{const l=t?t.image:null;return{image:l?`background-image: url('${l}');`:"",label:t?t.name||t.id:e.localize("guestUser"),cssClass:l?"image":""}})(e.users.find((e=>e.id===l.user)));i+=`<div class="history-user"><div class="user-icon smart-user ${t.cssClass}" style="${t.image}"></div><div class="user-name">${t.label}</div><div class="time">${new Smart.Utilities.DateTime(l.date).toString("dd/MM/yyyy hh:mm")}</div></div>`}else i+="<div></div>";if(i+='<div class="history-action">',i+=`<div>${o}</div>`,"created"!==l.action){let t=l.details.oldValue,a=l.details.value;if("user"===l.action){const l=e.users.find((e=>e.id===t||e.id===parseFloat(t))),i=e.users.find((e=>e.id===a||e.id===parseFloat(a)));l?t=l.name:(t="",t||(t=e.localize("unassigned"))),i?a=i.name:(a="",a||(a=e.localize("unassigned")))}if("subtasks"===l.action){const t=l.details.value.filter((e=>e.completed));e._kanban?i+=`<span class="detail smart-truncate">${e._kanban.localize("taskSubtasksCompleted",{value:t.length+"/"+l.details.value.length})}</span>`:i+=`<span class="detail smart-truncate">${e.localize("nullRange",{value:t.length})}</span>`}else i+=t?`<span class="detail smart-truncate">${e.localize("range",{oldValue:t,newValue:a})}</span>`:`<span class="detail smart-truncate">${e.localize("nullRange",{oldValue:t,newValue:a})}</span>`}else i+=`<div>${l.details.value}</div>`;i+="</div>\n </div>"}i+="",l.innerHTML=i}_createComment(e){const t=this,l=t.users.find((t=>t.id===e.userId)),a=document.createElement("div"),i=l?l.name||l.id:t.localize("guestUser"),o=l?l.name:t.localize("guestUser"),n=l.image?l.image:"";if(a.className="comment",a.setAttribute("role","listitem"),a.innerHTML=`<div class="comment-indent" role="presentation">\n<div class="user-icon smart-icon" role="img" aria-label="Icon of user ${i}"></div>\n</div>\n<div class="comment-main" role="presentation">\n<div class="comment-header" role="presentation">\n <div class="user-name" aria-label="User name">${o}</div>\n <div class="time" aria-label="Comment time">${e.time?new Smart.Utilities.DateTime(e.time).toString(t.formatStringTime):""}</div>\n <div class="remove-button${t._currentUser.info&&l.id===t._currentUser.info.id&&t._currentUser.allowComment?" enabled":""}" role="button" aria-haspopup="menu" aria-label="Comment settings"></div>\n</div>\n<div class="comment-body" aria-label="Comment text">${e.text||""}</div >\n</div>`,n){const e=a.querySelector(".user-icon");e.style.backgroundImage=`url('${n}')`,e.classList.add("image")}a.comment=e;const d=a.querySelector(".remove-button");return d.comment=e,d.element=a,e.userId!==t._currentUser.info.id&&d.classList.add("smart-visibility-hidden"),a}_openSummaryRowDialog(e){const t=this,l=t._summaryRowDialog||t._createDialog(),a="{{message}}"===t.editing.dialog.header?t.localize("summary"):t.editing.dialog.header;if(l.header.innerHTML=a,!l.listBox){const e=document.createElement("smart-list-box");e.selectionMode="checkBox",e.style.borderColor="transparent",l.content.innerHTML="",l.listBox=e}const i=l.listBox;l.summaryValueElement&&l.summaryValueElement.classList.remove("summary-chooser");const o=e.element.querySelector(".summary-value");if(!o)return;o.classList.add("summary-chooser"),l.summaryValueElement=o;let n=[];l.dataField=e.column.dataField,n="string"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:"boolean"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"}]:"date"===e.column.dataType?[{label:t.localize("countSummary"),value:"count"},{label:t.localize("blankSummary"),value:"blank"},{label:t.localize("filledSummary"),value:"filled"},{label:t.localize("uniqueSummary"),value:"unique"}]:[{label:t.localize("countSummary"),value:"count"},{label:t.localize("minSummary"),value:"min"},{label:t.localize("maxSummary"),value:"max"},{label:t.localize("sumSummary"),value:"sum"},{label:t.localize("avgSummary"),value:"avg"}],i.dataSource=n,i.style.position="absolute",i.style.visibility="hidden",i.style.height="auto",document.body.appendChild(i);const d=e.column;d.summary&&d.summary.forEach((e=>{i.select(e)}));const s=i.offsetHeight;l.column=d,l.content.appendChild(i),l.classList.add("smart-grid-dialog-summary"),l.header.parentElement.classList.add("smart-hidden"),l.footer.classList.add("smart-hidden"),i.style.visibility="",i.style.position="",i.style.width="100%",t._summaryRowDialog||(l.btnConfirm.innerHTML=t.localize("apply"),l.btnCancel.innerHTML=t.localize("cancel"),l.style.width=l.style.minWidth="120px",l.onOpen=function(){t.editing.dialog.visible=!0},l.onClose=function(){t.editing.dialog.visible=!1,l.summaryValueElement&&l.summaryValueElement.classList.remove("summary-chooser")},l.btnCancel.onclick=function(){l.close()},l.btnClose.onclick=function(){l.close()},l.btnConfirm.onclick=function(){l.column.summary=i.selectedValues,l.close(),t._calculateSummary(),t._recycle(!1)},l.confirm=function(){l.btnConfirm.click()},l.onkeydown=function(e){"Escape"===e.key&&l.close()},t._summaryRowDialog=l);const r=e.element,c=t.offset(r),m=t.offset(t);let u=r.offsetWidth+c.left-m.left-120;u<0&&(u=c.left-m.left),l.open(u,c.top-m.top-s-0),setTimeout((function(){l.btnConfirm.focus()}),100)}_openDeleteRowDialog(e,t){const l=this;if(!l.editing.deleteDialog.enabled)return!1;const a=l._dialogDelete||l._createDialog(),i="{{message}}"===l.editing.dialog.header?l.localize("dialogDeleteHeader",{value:e.visibleIndex+1}):l.editing.dialog.header;a.header.innerHTML=i,a.content.innerHTML=l.localize("dialogDeleteContent"),a.row=e,l._dialogDelete||(a.modal=!0,a.btnConfirm.innerHTML=l.localize("dialogDeleteButtonConfirm"),a.btnCancel.innerHTML=l.localize("dialogDeleteButtonCancel"),a.onOpen=function(){l.editing.dialog.visible=!0},a.onClose=function(){l.editing.dialog.visible=!1},a.btnCancel.onclick=function(){a.close()},a.btnClose.onclick=function(){a.close()},a.btnConfirm.onclick=function(){t(a.row),a.close()},a.onkeydown=function(e){"Escape"===e.key&&a.close()},l._dialogDelete=a),a.open(),setTimeout((function(){a.btnConfirm.focus()}),100)}_getAddColumnDialogTemplate(){const e=this,t=(new Date).getFullYear().toString(),l=new Date(t,6,30);return[{bind:"kanban",name:"kanban",type:"radio",label:e.localize("kanbanNoneDescription"),filter:"kanban",options:[{value:"blank",checked:!0,label:e.localize("kanbanNone")},{value:"basic",label:e.localize("kanbanBasic")}]},{bind:"kanbanNotes",name:"kanbanNodes",type:"label",label:e.localize("dialogAddColumnStatusNotes"),filter:"kanban"},{bind:"name",type:"input",label:e.localize("dialogAddColumnName"),filter:"any",info:e.localize("dialogAddColumnNameInfo")},{bind:"description",type:"input",label:e.localize("dialogAddColumnDescription"),filter:"any",info:e.localize("dialogAddColumnDescriptionInfo")},{bind:"type",name:"typeslist",type:"dropDownList",filter:"any",label:e.localize("dialogAddColumnType"),icon:"smart-icon-font",options:[{value:"string",prefix:'<span class="smart-grid-icon visible smart-icon-font"></span>',label:e.localize("dialogAddColumnTypeText")},{value:"multiText",prefix:'<span class="smart-grid-icon visible smart-icon-fontsize"></span>',label:e.localize("dialogAddColumnTypeMultilineText")},{value:"image",prefix:'<span class="smart-grid-icon visible smart-icon-image"></span>',label:e.localize("dialogAddColumnTypeImage")},{value:"number",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeNumber")},{value:"select",prefix:'<span class="smart-grid-icon visible smart-icon-sort-down"></span>',label:e.localize("dialogAddColumnTypeSelect")},{value:"multiSelect",prefix:'<span class="smart-grid-icon visible smart-icon-list-unordered"></span>',label:e.localize("dialogAddColumnTypeMultipleSelect")},{value:"boolean",prefix:'<span class="smart-grid-icon visible smart-icon-check-squared"></span>',label:e.localize("dialogAddColumnTypeCheckBox")},{value:"date",prefix:'<span class="smart-grid-icon visible smart-icon-calendar"></span>',label:e.localize("dialogAddColumnTypeDate")},{value:"createdTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeCreatedTime")},{value:"updatedTime",prefix:'<span class="smart-grid-icon visible smart-icon-clock"></span>',label:e.localize("dialogAddColumnTypeLastupdatedTime")},{value:"createdBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCreatedBy")},{value:"updatedBy",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeLastupdatedBy")},{value:"collaborator",prefix:'<span class="smart-grid-icon visible smart-icon-user"></span>',label:e.localize("dialogAddColumnTypeCollaborator")},{value:"slider",prefix:'<span class="smart-grid-icon visible smart-icon-number"></span>',label:e.localize("dialogAddColumnTypeSlider")},{value:"autoNumber",prefix:'<span class="smart-grid-icon visible smart-icon-list-ordered"></span>',label:e.localize("dialogAddColumnTypeAutoNumber")},{value:"url",prefix:'<span class="smart-grid-icon visible smart-icon-link"></span>',label:e.localize("dialogAddColumnTypeURL")},{value:"email",prefix:'<span class="smart-grid-icon visible smart-icon-mail"></span>',label:e.localize("dialogAddColumnTypeEmail")},{value:"phone",prefix:'<span class="smart-grid-icon visible smart-icon-phone"></span>',label:e.localize("dialogAddColumnTypePhone")},{value:"password",prefix:'<span class="smart-grid-icon visible smart-icon-lock"></span>',label:e.localize("dialogAddColumnTypePassword")}],info:e.localize("dialogAddColumnTypeInfo")},{bind:"dateFormat",name:"dateformat",type:"dropDownList",label:e.localize("dialogAddColumnDateFormat"),options:[{value:"M/d/yyyy",label:e.localize("dialogAddColumnDateFormatShort")+" ("+new Smart.Utilities.DateTime(l).toString("d")+")"},{value:"dddd, MMMM dd, yyyy",label:e.localize("dialogAddColumnDateFormatLong")+" ("+new Smart.Utilities.DateTime(l).toString("D")+")"},{value:"yyyy-MM-ddTHH:mm:ss.sssZ",label:e.localize("dialogAddColumnDateFormatISO")+" ("+new Smart.Utilities.DateTime(l).toString("ISO8601")+")"},{value:"d/M/yyyy",label:e.localize("dialogAddColumnDateFormatEU")+" (30/7/"+t+")"},{value:"yyyy-MM-dd",label:e.localize("dialogAddColumnDateFormatAS")+" ("+t+"-30-07)"},{value:"MMMM, dd, yyyy",label:e.localize("dialogAddColumnDateFormatFull")+" (July, 30, "+t+")"}],filter:"date",info:e.localize("dialogAddColumnDateFormatInfo")},{bind:"timeFormat",name:"timeformat",type:"dropDownList",label:e.localize("dialogAddColumnTimeFormat"),filter:"time",width:"50%",options:[{value:"hh:mm",label:"12 "+e.localize("dialogAddColumnTimeFormatHour")},{value:"HH:mm",label:"24 "+e.localize("dialogAddColumnTimeFormatHour")}],info:e.localize("dialogAddColumnTimeFormatInfo")},{bind:"allowTimeFormat",type:"boolean",label:e.localize("dialogAddColumnAllowTimeFormat"),filter:"date",value:!1,info:""},{bind:"allowCustomDateSeparator",type:"boolean",label:e.localize("dialogAddColumnCustomDateSeparator"),filter:"date",value:!1,info:""},{bind:"dateFormatSeparator",name:"dateFormatSeparator",type:"radio",label:"",filter:"date",columns:3,options:[{value:"/",label:e.localize("dialogAddColumnDateFormatSlash")+" (/)"},{value:"-",label:e.localize("dialogAddColumnDateFormatHyphen")+" (-)"},{value:".",label:e.localize("dialogAddColumnDateFormatDot")+" (.)"}]},{bind:"numberFormat",name:"numberFormat",type:"dropDownList",label:e.localize("dialogAddColumnNumberFormat"),filter:"number",options:[{value:{style:"decimal",maximumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatInteger")+" 1,000"},{value:{style:"decimal",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatNumber")+" 1,000.12"},{value:{style:"percent",minimumFractionDigits:2},label:e.localize("dialogAddColumnNumberFormatPercent")+" 10.12%"},{value:{style:"percent",maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatPercentRounded")+" 10%"},{value:{style:"decimal",notation:"scientific"},label:e.localize("dialogAddColumnNumberFormatScientific")+" 1.01E+03"},{value:{style:"decimal",notation:"engineering"},label:e.localize("dialogAddColumnNumberFormatEngineering")+" 34.284 x 10^9"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,currencySign:"accounting"},label:e.localize("dialogAddColumnNumberFormatAccounting")+" $(1,000.12)"},{value:{style:"unit",unit:"kilogram"},label:e.localize("dialogAddColumnNumberFormatUnit")+" 10.12 kg"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency},label:e.localize("dialogAddColumnNumberFormatCurrency")+" $1,000.12"},{value:{style:"currency",currency:e.messages[e.locale].calendar.currency,maximumFractionDigits:0,minimumFractionDigits:0},label:e.localize("dialogAddColumnNumberFormatCurrencyRounded")+" $1,000"}],required:!1,info:e.localize("dialogAddColumnNumberFormatInfo")},{bind:"unit",name:"unit",type:"dropDownList",filter:"number",required:!1,options:[{value:"acre",label:e.localize("dialogAddColumnNumberFormatUnitAcre")},{value:"percent",label:e.localize("dialogAddColumnNumberFormatUnitPercent")},{value:"degree",label:e.localize("dialogAddColumnNumberFormatUnitDegree")},{value:"megabyte",label:e.localize("dialogAddColumnNumberFormatUnitMegaByte")},{value:"centimeter",label:e.localize("dialogAddColumnNumberFormatUnitCentimeter")},{value:"meter",label:e.localize("dialogAddColumnNumberFormatUnitMeter")},{value:"kilometer",label:e.localize("dialogAddColumnNumberFormatUnitKilometer")},{value:"mile",label:e.localize("dialogAddColumnNumberFormatUnitMile")},{value:"celsius",label:e.localize("dialogAddColumnNumberFormatUnitCelsius")},{value:"fahrenheit",label:e.localize("dialogAddColumnNumberFormatUnitFahrenheit")},{value:"kilogram",label:e.localize("dialogAddColumnNumberFormatUnitKilogram")},{value:"pound",label:e.localize("dialogAddColumnNumberFormatUnitPound")},{value:"liter",label:e.localize("dialogAddColumnNumberFormatUnitLiter")},{value:"gallon",label:e.localize("dialogAddColumnNumberFormatUnitGallon")},{value:"second",label:e.localize("dialogAddColumnNumberFormatUnitSecond")},{value:"minute",label:e.localize("dialogAddColumnNumberFormatUnitMinute")},{value:"hour",label:e.localize("dialogAddColumnNumberFormatUnitHour")},{value:"day",label:e.localize("dialogAddColumnNumberFormatUnitDay")},{value:"week",label:e.localize("dialogAddColumnNumberFormatUnitWeek")},{value:"month",label:e.localize("dialogAddColumnNumberFormatUnitMonth")},{value:"year",label:e.localize("dialogAddColumnNumberFormatUnitYear")}],label:e.localize("dialogAddColumnNumberFormatUnit"),info:e.localize("dialogAddColumnNumberFormatUnitInfo")},{bind:"minLength",name:"minlength",width:"50%",type:"number",filter:"text",required:!1,label:e.localize("dialogAddColumnMinLength"),info:e.localize("dialogAddColumnMinLengthInfo")},{bind:"maxLength",name:"maxlength",width:"50%",filter:"text",type:"number",required:!1,label:e.localize("dialogAddColumnMaxLength"),info:e.localize("dialogAddColumnMaxLengthInfo")},{bind:"minValue",name:"minvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMinValue"),info:e.localize("dialogAddColumnMinValueInfo")},{bind:"maxValue",name:"maxvalue",width:"50%",filter:"number",type:"number",required:!1,label:e.localize("dialogAddColumnMaxValue"),info:e.localize("dialogAddColumnMaxValueInfo")},{bind:"minDateTime",name:"mindatetime",type:"datetime",filter:"date",width:"50%",label:e.localize("dialogAddColumnMinDate"),info:e.localize("dialogAddColumnMinDateInfo")},{bind:"maxDateTime",name:"maxdatetime",type:"datetime",width:"50%",filter:"date",label:e.localize("dialogAddColumnMaxDate"),info:e.localize("dialogAddColumnMaxDateInfo")},{bind:"allowColorItems",type:"boolean",label:e.localize("dialogAddColumnColorItems"),filter:"list, collaborator",value:!0,info:""},{bind:"allowCheckItems",type:"boolean",filter:"hidden",value:!1,label:e.localize("dialogAddColumnCheckItems"),info:""},{bind:"allowMultipleCollaborators",type:"boolean",filter:"collaborator",value:!1,label:e.localize("dialogAddColumnMultipleCollaborators"),info:e.localize("dialogAddColumnMultipleCollaboratorsInfo")},{bind:"options",name:"listitems",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"list",info:""},{bind:"users",name:"users",type:"items",label:e.localize("dialogAddColumnListItems"),filter:"collaborator",info:""},{name:"align",bind:"cellsAlign",type:"dropDownList",label:e.localize("dialogAddColumnAlign"),required:!1,options:[{value:"left",label:e.localize("dialogAddColumnAlignLeft")},{value:"right",label:e.localize("dialogAddColumnAlignRight")},{value:"center",label:e.localize("dialogAddColumnAlignCenter")}],filter:"any",info:e.localize("dialogAddColumnAlignInfo")},{bind:"allowResize",type:"boolean",filter:"any",width:"50%",label:e.localize("dialogAddColumnResizable"),info:e.localize("dialogAddColumnResizableInfo")},{bind:"required",type:"boolean",width:"50%",filter:"text",label:e.localize("dialogAddColumnRequired"),info:e.localize("dialogAddColumnRequiredInfo")},{bind:"allowSort",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnSortable"),info:e.localize("dialogAddColumnSortableInfo")},{bind:"allowFilter",type:"boolean",align:"left",width:"50%",filter:"any",label:e.localize("dialogAddColumnFilterable"),info:e.localize("dialogAddColumnFilterableInfo")},{bind:"allowEdit",type:"boolean",width:"50%",filter:"any",label:e.localize("dialogAddColumnEditable"),info:e.localize("dialogAddColumnEditableInfo")}]}_addColumnDialogShowHideEditors(e){const t=this,l=t._dialogAddColumn.querySelector('[bind="type"]').querySelector("smart-input").getSelectedItem().value,a=t._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor");let i=!!e;for(let o=0;o<a.length;o++){const n=a[o],d=n.getAttribute("filter"),s=n.getAttribute("bind"),r=n.parentNode;if(r.classList.add("smart-hidden"),"cellsAlign"!==s||"boolean"!==l&&"image"!==l&&"email"!==l&&"url"!==l&&"collaborator"!==l&&"createdBy"!==l&&"password"!==l&&"phone"!==l&&"createdTime"!==l&&"updatedBy"!==l&&"updatedTime"!==l)if("type"===s&&i)r.classList.add("smart-hidden");else if("allowEdit"!==s||!1!==t.editing.enabled&&"autoNumber"!==l&&"createdBy"!==l&&"updatedBy"!==l&&"createdTime"!==l&&"updatedTime"!==l)if("allowResize"!==s||"none"!==t.behavior.columnResizeMode)if("allowFilter"!==s||!1!==t.filtering.enabled)if("allowSort"!==s||!1!==t.sorting.enabled)if("required"!==s||!1!==t.editing.enabled&&("string"===l||"multiText"===l))if(e&&e.disabledDialogOptions&&e.disabledDialogOptions.length>0&&e.disabledDialogOptions.indexOf(s)>=0)r.classList.add("smart-hidden");else{if(e&&"kanban"===t.view){switch(s){case"options":case"allowColorItems":case"allowSort":case"allowFilter":case"align":case"cellsAlign":case"allowResize":case"allowEdit":r.classList.add("smart-hidden");continue}"kanban"===t.view&&"kanban"===d&&r.classList.remove("smart-hidden")}if("any"!==d)switch(l){default:case"text":"text"===d&&r.classList.remove("smart-hidden"),e&&"any"===e.dataType&&r.classList.add("smart-hidden");break;case"slider":case"number":if("number"===d&&r.classList.remove("smart-hidden"),"unit"===s){r.classList.add("smart-hidden");const e=t._dialogAddColumn.querySelector('[field-name="numberFormat"]'),l=t._dialogAddColumn.querySelector('[field-name="unit"]'),a=e.querySelector("smart-input"),i=()=>{const e=a.getSelectedItem();e&&"unit"===e.value.style?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};e.onchange=()=>{i()},i()}break;case"select":case"multiSelect":d.indexOf("list")>=0&&r.classList.remove("smart-hidden");break;case"collaborator":d.indexOf("collaborator")>=0&&r.classList.remove("smart-hidden");break;case"createdBy":case"updatedBy":case"autoNumber":case"createdTime":case"updatedTime":case"url":case"email":case"image":case"phone":case"password":case"boolean":break;case"date":{const e=t._dialogAddColumn.querySelector('[field-name="dateFormat"]').querySelector(".smart-input").value;"date"===d&&r.classList.remove("smart-hidden");const l=e=>{const l=t._dialogAddColumn.querySelector('[field-filter="time"]'),a=t._dialogAddColumn.querySelector('[field-name="dateFormat"]');e?(l.classList.remove("smart-hidden"),a.style.width="50%",a.style.float="left"):(l.classList.add("smart-hidden"),a.style.width="",a.style.float="")},a=e=>{const l=t._dialogAddColumn.querySelector('[field-name="allowTimeFormat"]'),a=l.querySelector(".smart-grid-dialog-editor");e.indexOf("T")>=0?(l.classList.add("smart-hidden"),a.uncheck()):l.classList.remove("smart-hidden")},i=e=>{const l=t._dialogAddColumn.querySelector('[field-name="dateFormatSeparator"]');e?l.classList.remove("smart-hidden"):l.classList.add("smart-hidden")};if("allowTimeFormat"===s){const e=n.querySelector(".smart-input").value;n.onchange=e=>{l(e)},l(e)}if("dateFormat"===s){const e=n.querySelector(".smart-input").value;n.onchange=e=>{a(e.detail.value)},a(e)}if("dateFormatSeparator"===s){const e=t._dialogAddColumn.querySelector('[field-name="allowCustomDateSeparator"]').querySelector(".smart-input").value;i(e)}if("allowCustomDateSeparator"===s){e.indexOf("T")>=0&&e.indexOf("-")>0&&n.uncheck();const t=n.querySelector(".smart-input").value;n.onchange=e=>{i(e)},i(t)}a(e);break}}else r.classList.remove("smart-hidden")}else r.classList.add("smart-hidden");else r.classList.add("smart-hidden");else r.classList.add("smart-hidden");else r.classList.add("smart-hidden");else r.classList.add("smart-hidden");else r.classList.add("smart-hidden")}}_addColumnDialogInitEditors(){const e=this,t=e._dialogAddColumn.editColumn;for(let l in e._addColumnDialogEditors){const a=e._addColumnDialogEditors[l],i=a.querySelector("input"),o=a.querySelector("smart-input");switch(l){case"allowTimeFormat":{const e=a.querySelector(".smart-input");t&&t.editor?"dateInput"===t.editor.template?(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked","")):(e.value=!1,e.removeAttribute("checked"));break}case"allowCustomDateSeparator":{const l=a.querySelector(".smart-input");l.value=!1,l.removeAttribute("checked");let i=0;t&&t.cellsFormat&&(t.cellsFormat.indexOf(".")>=0?(l.value=!0,l.setAttribute("checked",""),i=2):(t.cellsFormat.indexOf("M-d-yyyy")>=0||t.cellsFormat.indexOf("d-M-yyyy")>=0||t.cellsFormat.indexOf("yyyy/MM/dd")>=0)&&(l.value=!0,l.setAttribute("checked",""),i=1));const o=e._addColumnDialogEditors.dateFormatSeparator.querySelectorAll(".smart-grid-dialog-boolean-field");o.forEach((e=>{e.value=!1,e.removeAttribute("checked")})),o[i].setAttribute("checked",""),o[i].value=!0;break}case"kanban":{const t=a.querySelectorAll(".smart-grid-dialog-boolean-field");for(let l=0;l<t.length;l++)t[l].onchange=t=>{const l=[...t.parentElement.children].indexOf(t),a=t.parentElement.parentElement.previousElementSibling,i=e._dialogAddColumn.querySelector('[field-name="options"]'),o=e._dialogAddColumn.querySelector('[field-name="allowColorItems"]'),n=e._addColumnDialogEditors.name,d=()=>{const e=i.querySelector("smart-sortable");e&&e._validate()};switch(l){case 0:a.innerHTML=e.localize("kanbanNoneDescription"),o.classList.add("smart-hidden"),i.classList.add("smart-hidden"),n.querySelector("input").value=e.localize("uncategorized"),d();break;case 1:a.innerHTML=e.localize("kanbanBasicDescription"),o.classList.remove("smart-hidden"),i.classList.remove("smart-hidden"),n.querySelector("input").value=e.localize("status"),d()}};break}case"dateFormat":t&&t.cellsFormat?t.cellsFormat.indexOf("M/d/yyyy")>=0?o.selectedIndex=0:t.cellsFormat.indexOf("dddd, MMMM dd, yyyy")>=0?o.selectedIndex=1:t.cellsFormat.indexOf("yyyy-MM-ddTHH:mm:ss.sssZ")>=0?o.selectedIndex=2:t.cellsFormat.indexOf("d/M/yyyy")>=0?o.selectedIndex=3:t.cellsFormat.indexOf("yyyy-MM-dd")>=0?o.selectedIndex=4:t.cellsFormat.indexOf("MMMM, dd, yyyy")>=0&&(o.selectedIndex=5):o.selectedIndex=0;break;case"timeFormat":t&&t.cellsFormat&&t.cellsFormat.indexOf("HH")>=0&&-1===t.cellsFormat.indexOf("T")?o.selectedIndex=1:o.selectedIndex=0;break;case"allowMultipleCollaborators":{let e=!0;t&&t.editor&&t.editor.singleSelect&&(e=!1);const l=a.querySelector(".smart-input");t?e?(l.value=!0,l.setAttribute("checked","")):(l.value=!1,l.removeAttribute("checked")):(l.value=!0,l.setAttribute("checked",""));break}case"numberFormat":if(t&&"numberInput"===t.editor.template&&t.editor.numberFormat)if("decimal"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=0;else if("decimal"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=1;else if("percent"===t.editor.numberFormat.style&&2===t.editor.numberFormat.minimumFractionDigits)o.selectedIndex=2;else if("percent"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits)o.selectedIndex=3;else if("decimal"===t.editor.numberFormat.style&&"scientific"===t.editor.numberFormat.notation)o.selectedIndex=4;else if("decimal"===t.editor.numberFormat.style&&"engineering"===t.editor.numberFormat.notation)o.selectedIndex=5;else if("currency"===t.editor.numberFormat.style&&"accounting"===t.editor.numberFormat.currencySign)o.selectedIndex=6;else if("unit"===t.editor.numberFormat.style){o.selectedIndex=7;const l=t.editor.numberFormat.unit,a=e._addColumnDialogEditors.unit.querySelector("smart-input");a.dataSource.forEach(((e,t)=>{if(e.value===l)return a.selectedIndex=t,!0}))}else"currency"===t.editor.numberFormat.style?o.selectedIndex=8:"currency"===t.editor.numberFormat.style&&0===t.editor.numberFormat.maximumFractionDigits&&0===t.editor.numberFormat.minimumFractionDigits&&(o.selectedIndex=9);else o.selectedIndex=0;break;case"allowCheckItems":{const e=a.querySelector(".smart-input");t?t.editor&&!t.editor.pills?(e.value=!0,e.setAttribute("checked","")):!1===t[l]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!1,e.setAttribute("checked",""));break}case"allowColorItems":{const e=a.querySelector(".smart-input");t?t.editor&&t.editor.colorItems?(e.value=!0,e.setAttribute("checked","")):!1===t[l]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}case"allowResize":case"allowSort":case"allowEdit":case"allowFilter":case"required":{const e=a.querySelector(".smart-input");t?t[l]?(e.value=!0,e.setAttribute("checked","")):!1===t[l]&&(e.value=!1,e.removeAttribute("checked")):(e.value=!0,e.setAttribute("checked",""));break}}if(!t||"options"!==l&&"users"!==l){const t=a.querySelector("smart-sortable");if(t&&t._init)if("users"===l){let l=[];for(let t=0;t<e.users.length;t++)l.push({color:e.users[t].color,label:e.users[t].name,id:e.users[t].id,image:e.users[t].image});t._init(l)}else t._init()}else{const e=a.querySelector("smart-sortable");if(e&&e._init)if(t.editor.singleSelect){const l=t.editor.dataSource.filter((e=>""!==e));e._init(l)}else"mutliComboInput"===t.editor.template&&e._init(JSON.parse(JSON.stringify(t.editor.dataSource)))}if(t&&"type"===l?("number"===t.dataType||"int"===t.dataType?o.selectedIndex=3:"date"===t.dataType?o.selectedIndex=7:"bool"!==t.dataType&&"boolean"!==t.dataType||(o.selectedIndex=6),t.editor&&t.editor.template&&o.dataSource.forEach(((e,l)=>{switch(e.value){case"string":"input"===t.editor.template&&(o.selectedIndex=l);break;case"number":"numberInput"===t.editor.template&&(o.selectedIndex=l);break;case"select":"multiComboInput"===t.editor.template&&t.editor.singleSelect&&"tags"===t.template&&(o.selectedIndex=l);break;case"multiSelect":"multiComboInput"!==t.editor.template||t.editor.singleSelect||"tags"!==t.template||(o.selectedIndex=l);break;case"multiText":"textarea"===t.editor.template&&(o.selectedIndex=l);break;case"date":"dateInput"!==t.editor.template&&"dateTimePicker"!==t.editor.template||(o.selectedIndex=l);break;case"checkBox":"checkBox"===t.editor.template&&(o.selectedIndex=l);break;case"slider":"slider"===t.editor.template&&(o.selectedIndex=l);break;case"image":"image"===t.editor.template&&(o.selectedIndex=l);break;case"updatedTime":"updatedTime"===t.template&&(o.selectedIndex=l);break;case"createdTime":"createdTime"===t.template&&(o.selectedIndex=l);break;case"createdBy":"createdBy"===t.template&&(o.selectedIndex=l);break;case"updatedBy":"updatedBy"===t.template&&(o.selectedIndex=l);break;case"collaborator":"collaborator"===t.template&&t.editor&&t.editor.collaborator&&(o.selectedIndex=l);break;case"autoNumber":"autoNumber"===t.template&&(o.selectedIndex=l);break;case"phone":"phone"===t.template&&(o.selectedIndex=l);break;case"password":"password"===t.template&&(o.selectedIndex=l);break;case"url":"url"===t.template&&(o.selectedIndex=l);break;case"email":"email"===t.template&&(o.selectedIndex=l)}}))):"type"===l&&(o.selectedIndex=0),"cellsAlign"===l&&t&&("center"===t.cellsAlign||"middle"===t.cellsAlign?o.selectedIndex=2:"right"===t.cellsAlign&&(o.selectedIndex=1)),!i)continue;"dataField"!==l&&"type"!==l&&"timeFormat"!==l&&"dateFormat"!==l&&"numberFormat"!==l&&"unit"!==l&&"cellsAlign"!==l&&o&&(o.selectedIndex=0),"name"===l&&(o.value=t?t.label:""),"description"===l&&(o.value=t?t.description:"");const n=(e,l)=>{t&&t.validationRules.forEach((t=>"minDate"===t.type&&"minDateTime"===e||"maxDate"===t.type&&"maxDateTime"===e||"min"===t.type&&"minValue"===e||"max"===t.type&&"maxValue"===e||t.type===e?(l.value=t.value,!0):void 0))};if("minValue"===l?(i.value=0,n(l,i)):"maxValue"===l?(i.value=100,n(l,i)):"minLength"===l?(i.value=0,n(l,i)):"maxLength"===l&&(i.value=500,n(l,i)),"minDateTime"===l){const e=a.querySelector("smart-date-input");e.value=new Date(1900,0,1),n(l,e)}else if("maxDateTime"===l){const e=a.querySelector("smart-date-input");e.value=new Date(2100,0,1),n(l,e)}}}_createColumnBooleanEditor(e,t,l,a,i){e.setAttribute("template","checkBox"),e.setAttribute("editor","");const o=document.createElement("div");return o.classList.add("smart-input"),o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-check-box-cell-editor"),o.setAttribute("checked",""),o.value=!0,t.width&&(l.style.width=t.width,l.style.float="left"),!1===t.value&&(o.value=!1,o.removeAttribute("checked")),e.appendChild(o),e.getValue=function(){return o.value},e.check=function(){o.setAttribute("checked",""),o.value=!0,e.onchange&&e.onchange(o.value)},e.uncheck=function(){o.removeAttribute("checked"),o.value=!1,e.onchange&&e.onchange(o.value)},e.toggle=function(){!0!==o.value&&!1!==o.value&&null!==o.value&&(o.value=!1),null===o.value?o.value=!1:o.value=!o.value,!1===o.value?o.removeAttribute("checked"):o.setAttribute("checked",o.value?"":"indeterminate"),e.onchange&&e.onchange(o.value)},e.onclick=i.onclick=()=>{e.toggle()},a.appendChild(l),l.classList.add("smart-grid-dialog-boolean-field"),l.appendChild(e),l.appendChild(i),e}_getColumnTemplateByType(e){switch(e){case"boolean":case"bool":return"checkBox";case"image":return"image";case"createdBy":case"updatedBy":case"collaborator":case"select":case"multiSelect":return"tags";case"url":return"url";case"email":return"email";case"autoNumber":return"autoNumber";case"password":return"password";case"createdTime":return"createdTime";case"updatedTime":return"updatedTime";default:return""}}_confirmAddColumnDialog(){const e=this,t=e._dialogAddColumn,l=e._dialogAddColumn.querySelectorAll(".smart-grid-dialog-editor"),a=[];let i,o,n={};for(let t=0;t<l.length;t++){const a=l[t],i=a.querySelector(".smart-input"),o=a.getAttribute("bind"),d=a.parentElement;if("kanban"!==o)if("minLength"!==o&&"maxLength"!==o&&"minValue"!==o&&"maxValue"!==o&&"minDateTime"!==o&&"maxDateTime"!==o)if("options"!==o&&"users"!==o){if("allowEdit"===o&&d.classList.contains("smart-hidden"))i.value=!1;else if("required"===o&&d.classList.contains("smart-hidden"))i.value=!1;else if("dateFormatSeparator"===o){const e=a.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:n.dateFormatSeparatorType="/";break;case 1:n.dateFormatSeparatorType="-";break;case 2:n.dateFormatSeparatorType="."}break}}i&&(i.getSelectedItem?n[o]=i.getSelectedItem().value:n[o]=i.value)}else{const t=[],l=a.querySelectorAll(".smart-grid-add-column-dialog-color-item .edit-column-input"),i=a.querySelectorAll(".smart-grid-add-column-dialog-color-item smart-color-input");for(let e=0;e<l.length;e++){const a=l[e],o={label:a.value,value:parseInt(a.getAttribute("data-id")),color:i[e].value};o.color=i[e].value,t.push(o)}if("users"===o&&"collaborator"===n.type){e.users||(e.users=[]);for(let l=0;l<t.length;l++){const a=t[l],i=e.users.find((e=>e.id===a.value));i&&(i.name=a.label,i.color=a.color)}}n[o]=t}else n[o]=i.getValue();else{const e=a.querySelectorAll(".smart-grid-dialog-boolean-field");for(let t=0;t<e.length;t++)if(e[t].querySelector("[checked]")){switch(t){case 0:n.kanban="blank";break;case 1:n.kanban="basic"}break}}}t.data=n;let d={},s={},r="";if(i=n.minDateTime,o=n.maxDateTime,"date"===n.type){d={template:"dateInput",min:i,max:o};let e=!1;"-"!==n.dateFormat&&(r=n.dateFormat,n.allowCustomDateSeparator&&(r.indexOf("/")>=0?r=r.replaceAll("/",n.dateFormatSeparatorType):r.indexOf("-")>=0?r=r.replaceAll("-",n.dateFormatSeparatorType):r.indexOf(".")>=0&&(r=r.replaceAll(".",n.dateFormatSeparatorType))),n.dateFormat.indexOf("T")>=0&&(d.template="dateTimePicker",d.dropDownDisplayMode="auto",d.formatString=r),e=!0),d.autoOpen=!0,n.allowTimeFormat&&"-"!==n.timeFormat&&(e&&(r+=" "),r+=n.timeFormat,d.template="dateTimePicker",d.dropDownDisplayMode="auto",d.formatString=r),a.push({type:"minDate",value:i}),a.push({type:"maxDate",value:o})}else if("number"===n.type||"slider"===n.type)i=parseInt(n.minValue),o=parseInt(n.maxValue),"unit"===n.numberFormat.style&&(n.numberFormat.unit=n.unit),d={template:"number"===n.type?"numberInput":"slider",min:i,max:o,numberFormat:n.numberFormat},s={Intl:{NumberFormat:n.numberFormat}},r="d",a.push({type:"min",value:i}),a.push({type:"max",value:o});else if("boolean"===n.type)d={template:"checkBox"};else if("image"===n.type)d={template:"image"};else if("select"===n.type||"multiSelect"===n.type){let e=n.options;"select"===n.type&&(e=[""].concat(n.options)),d={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:n.allowColorItems,autoOpen:!0,pills:!n.allowCheckItems,singleSelect:"select"===n.type,dataSource:e}}else if("collaborator"===n.type){let t=n.users;n.allowMultipleCollaborators||(t=[""].concat(n.users));for(let l=0;l<e.users.length;l++)t.forEach((t=>{t.value===e.users[l].id&&(t.image=e.users[l].image,t.id=e.users[l].id)}));d={template:"multiComboInput",readonly:!0,collaborator:!0,colorItems:n.allowColorItems,dropDownButtonPosition:"right",autoOpen:!0,pills:!n.allowCheckItems,singleSelect:!n.allowMultipleCollaborators,dataSource:t}}else"multiText"===n.type?(i=n.minLength,o=n.maxLength,d={template:"textarea",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o})):"password"===n.type?(i=n.minLength,o=n.maxLength,d={template:"password",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o})):"phone"===n.type?d={template:"phone",required:n.required}:(i=n.minLength,o=n.maxLength,d={template:"input",min:i,max:o,required:n.required},a.push({type:"minLength",value:i}),a.push({type:"maxLength",value:o}));let c="string";switch(n.type){case"boolean":case"bool":c="boolean";break;case"createdTime":case"updatedTime":case"date":c="date";break;case"autoNumber":case"slider":case"number":c="number"}if(e._dialogAddColumn.editColumn){const t=e._dialogAddColumn.editColumn;t.canNotify=!1,t.label=n.name,t.description=n.description,t.showDescriptionButton=!0,t.allowResize=n.allowResize,t.allowSort=n.allowSort,t.allowFilter=n.allowFilter,t.allowEdit=n.allowEdit,t.align=t.cellsAlign=n.cellsAlign,t.cellsFormat=r;const l=t._editorId?t._editorId:"",i=d.template+"_"+t.dataField+l;e._cellEditors[i]&&delete e._cellEditors[i];let o=!0;"list"!==t.template&&"dropDownList"!==t.template||(o=!1),"autoNumber"!==t.template&&"createdBy"!==t.template&&"updatedBy"!==t.template&&"createdTime"!==t.template&&"updatedTime"!==t.template||(o=!1),t.editor&&t.editor.template.indexOf("custom")>=0&&(o=!1),o&&(t.editor=d,t.template=e._getColumnTemplateByType(n.type)),t.formatSettings=s,t._isDirty=!0,n.required&&a.push({type:"required"}),t.validationRules=a,t._state&&["label","description","showDescriptionButton","dataType","editor","formatSettings","template","summary","validationRules","allowResize","allowSort","allowFilter","allowEdit","align","cellsAlign","cellsFormat"].forEach((e=>{t._state[e]=t[e]})),t.canNotify=!0,e.$.fireEvent("closeColumnDialog",{dataField:t.dataField}),e.onColumnUpdated&&e.onColumnUpdated(e.columns.indexOf(t),t),e._onColumnUpdated&&e._onColumnUpdated(t,n),e._recycle(!0),t.refresh(),t._isDirty=!1}else{let t=[];"number"===c&&(t=["sum"]);const l=new Smart.Grid.Column({label:n.name,description:n.description,dataField:n.dataField||"dataField"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),allowResize:n.allowResize,allowSort:n.allowSort,allowFilter:n.allowFilter,allowEdit:n.allowEdit,showDescriptionButton:!0,dataType:c,editor:d,summary:t,template:e._getColumnTemplateByType(n.type),formatSettings:s,cellsAlign:n.cellsAlign,align:n.cellsAlign,cellsFormat:r,grid:e});e.columns.push(l),e._refreshHeaderBar(),e.$.fireEvent("closeColumnDialog",{dataField:l.dataField})}}_openAddColumnDialog(e,t,l){const a=this,i=a._dialogAddColumn||a._createDialog(a.editing.addColumnDialog),o=e?a.localize("dialogEditColumn",{value:e.label}):a.localize("dialogAddColumn"),n=i.querySelector(".smart-footer").querySelector(".smart-stack-layout");i.classList.add("smart-grid-dialog-add-column"),i.type=e?"customize":"add",i.editColumn=e||null,e&&e.element.setAttribute("focus",""),n.classList.remove("right"),n.classList.add("center"),a._cellEditors||(a._cellEditors=[]);const d=a._getAddColumnDialogTemplate();if(i.header.innerHTML=o,i.header.parentElement.classList.add("smart-hidden"),i.callback=l,!0===t&&(i.header.parentElement.classList.remove("smart-hidden"),"kanban"===a.view&&(i.header.innerHTML=a.localize("dialogAddColumnStatus"),i.header.parentElement.querySelector(".smart-close-button").classList.add("smart-hidden"))),i.stackLabel&&i.stackLabel.classList.add("smart-hidden"),"kanban"===a.view?i.btnCancel.classList.add("smart-hidden"):i.btnCancel.classList.remove("smart-hidden"),a.cancelEdit(),!a._dialogAddColumn){i.modal=!0,i.btnConfirm.innerHTML=a.localize("dialogEditButtonConfirm"),i.btnCancel.innerHTML=a.localize("dialogEditButtonCancel"),i.onOpen=function(){a._addColumnDialogInitEditors(),a._addColumnDialogShowHideEditors(i.editColumn),a.$.fireEvent("openColumnDialog",{dataField:i.editColumn?i.editColumn.dataField:null});const e=a.offset(i);if(e.top+i.offsetHeight>window.innerHeight){const t=e.top+i.offsetHeight-window.innerHeight;i.style.maxHeight=Math.max(250,i.offsetHeight-t)+"px",i.style.minHeight="250px"}else i.style.maxHeight="",i.style.minHeight=""},i.onClose=function(){i.editColumn&&i.editColumn.element.removeAttribute("focus"),i.callback&&i.callback(i.result)},i.btnCancel.onclick=function(){i.result=!1,i.close()},i.btnClose.onclick=function(){i.result=!1,i.close()},i.btnConfirm.onclick=function(){a._confirmAddColumnDialog(),i.result=!0,i.close()},i.onkeydown=function(e){"Escape"===e.key&&"kanban"!==a.view&&(i.result=!1,i.close())},a._dialogAddColumn=i;const e=document.createElement("div");e.classList.add("smart-content-layout-container"),i.content.appendChild(e),a._addColumnDialogEditors=[];for(let t=0;t<d.length;t++){const l=d[t],o=document.createElement("div"),n=document.createElement("label");n.innerHTML=l.label;const s=document.createElement("div");if(s.classList.add("smart-grid-dialog-editor","add-column"),s.innerHTML="",s.setAttribute("filter",l.filter),s.setAttribute("bind",l.bind),o.setAttribute("field-name",l.bind),o.setAttribute("field-filter",l.filter),a._addColumnDialogEditors[l.bind]=s,"type"===l.bind&&s.addEventListener("change",(()=>{a._addColumnDialogShowHideEditors(i.editColumn);const e=a._dialogAddColumn.querySelector('[bind="type"]'),t=e.querySelector("smart-input").getSelectedItem().value;let l="smart-icon-font";switch(t){case"multiText":l="smart-icon-fontsize";break;case"image":l="smart-icon-image";break;case"number":l="smart-icon-number";break;case"select":l="smart-icon-sort-down";break;case"multiSelect":l="smart-icon-list-unordered";break;case"boolean":l="smart-icon-check-squared";break;case"date":l="smart-icon-calendar";break;case"createdTime":case"updatedTime":l="smart-icon-clock";break;case"createdBy":case"updatedBy":case"collaborator":l="smart-icon-user";break;case"slider":l="smart-icon-number";break;case"autoNumber":l="smart-icon-list-ordered";break;case"url":l="smart-icon-link";break;case"email":l="smart-icon-mail";break;case"password":l="smart-icon-lock";break;case"phone":l="smart-icon-phone"}if(a._addColumnDialogEditors.type.icon=l,e.firstElementChild.className="smart-grid-icon show smart-description-button "+l,"select"===t||"multiSelect"===t){const e=a._addColumnDialogEditors.options.querySelector("smart-sortable");e&&e._validate&&e._validate()}else i.btnConfirm.disabled=!1})),"boolean"===l.type)a._createColumnBooleanEditor(s,l,o,e,n);else{if("label"===l.type){e.appendChild(o),o.classList.add("smart-grid-dialog-field"),o.appendChild(n);const t=document.createElement("div");t.style.height="10px",o.appendChild(t);continue}{let r=document.createElement("smart-input");if(r.classList.add("underlined","edit-column-input"),r.style.width="100%",r.style.height="30px",l.width&&(o.style.width=l.width,o.style.float="left"),"items"===l.type){const e=document.createElement("smart-button");e.classList.add("primary"),e.innerHTML='<div style="align-items: center; white-space: nowrap; display: flex;"><span class="smart-grid-icon show smart-icon-plus"></span><span>'+a.localize("commandBarAddRow")+"</span></div>";const t=document.createElement("div");t.classList.add("smart-grid-add-column-dialog-color-panel");const o=document.createElement("smart-sortable");o.disableMode="manual",o.dragMode="handle",o.handleVisibility="visible",o.handlePosition="left";const n=()=>{i.btnConfirm.disabled=!1,0!==t.offsetHeight&&t.querySelectorAll(".edit-column-input").forEach((e=>{""===e.value&&(i.btnConfirm.disabled=!0)}))},d=(e,t,i)=>{const d=document.createElement("div"),s=a._getColorInput(),r=document.createElement("div"),c=document.createElement("smart-input"),m=a._addColumnDialogEditors.allowColorItems;if(void 0!==i)c.setAttribute("data-id",i);else{const e=o.querySelectorAll(".smart-sortable-item");c.setAttribute("data-id",e)}return s.disabled=!m.querySelector(".smart-input").value,r.className="smart-grid-icon smart-icon-close show",r.setAttribute("role","button"),r.setAttribute("aria-label","button"),c.classList.add("underlined","edit-column-input"),c.style.width="100%",c.style.height="30px",c.required=!0,e&&(c.value=e),t&&(s.value=t),c.onkeyup=c.onchange=()=>{n()},d.appendChild(s),d.appendChild(c),"users"!==l.bind&&d.appendChild(r),r.onclick=()=>{d.remove(),o.$.container.appendChild(l),o.updateItems(),n()},d.classList.add("smart-sortable-item","smart-grid-add-column-dialog-color-item"),d};o._init=e=>{o.clearContent(),e&&(e.forEach(((e,t)=>{const l=void 0!==e.id?e.id:t,a=d(e.label,e.color,l);o.$.container.appendChild(a)})),o.updateItems())},o._validate=n,a._addColumnDialogEditors.allowColorItems.onchange=e=>{let t=a._addColumnDialogEditors.allowColorItems.parentElement.nextElementSibling,l=null;for(;t;){if("options"===t.getAttribute("field-name")){l=t;break}t=t.nextElementSibling}l&&l.querySelectorAll("smart-color-input").forEach((t=>{t.disabled=!e}))},t.appendChild(o),"users"!==l.bind&&(t.appendChild(e),e.onclick=()=>{const e=d();o.$.container.appendChild(e),o.updateItems(),e.querySelector(".edit-column-input").focus(),i.btnConfirm.disabled=!0}),r=t,s.style.height="auto"}else if("number"===l.type)r=document.createElement("smart-number-input"),r.classList.add("underlined"),r.style.width="100%",r.style.height="30px","minValue"===l.bind?(r.value=0,r.min=-9999999,r.max=9999999):"maxValue"===l.bind?(r.value=1e6,r.min=-9999999,r.max=9999999):"minLength"===l.bind?r.value=0:"maxLength"===l.bind&&(r.value=500);else if("datetime"===l.type)r=document.createElement("smart-date-input"),r.classList.add("underlined"),r.style.width="100%",r.style.height="30px","minDateTime"===l.bind?r.value=new Date(1900,0,1):"maxDateTime"===l.bind&&(r.value=new Date(2100,0,1));else if("radio"===l.type){const e=(e,t,l)=>{const a=document.createElement("div"),i=document.createElement("label"),o=document.createElement("div");return i.innerHTML=e,o.classList.add("smart-input"),o.classList.add("smart-grid-cell-editor"),o.classList.add("smart-grid-check-box-cell-editor"),t&&o.setAttribute("checked",""),o.value=void 0!==t&&t,s.appendChild(o),a.onclick=function(){if(o.value=!0,!1===o.value?o.removeAttribute("checked"):o.setAttribute("checked",o.value?"":"indeterminate"),a.onchange&&a.onchange(a),o.value){const e=o.parentElement.parentElement.parentElement;e.querySelectorAll(".smart-grid-cell-editor").forEach((e=>{e.value=!1,e.removeAttribute("checked")})),o.value=!0,o.setAttribute("checked",o.value?"":"indeterminate"),e.value=l}},a.appendChild(o),a.appendChild(i),a.classList.add("smart-grid-dialog-boolean-field"),a.setAttribute("template","checkBox"),a.setAttribute("editor",""),a},t=document.createElement("div");t.classList.add("smart-grid-dialog-radio-field"),s.classList.add("radio-group");for(let a=0;a<l.options.length;a++){const i=l.options[a],o=e(i.label,i.checked);if(l.columns){const e=100/l.columns;o.style.width=e+"%",o.style.float="left"}t.appendChild(o),i.checked&&(s.value=i.value)}const a=document.createElement("div");a.style.clear="both",t.appendChild(a),r=t}if(l.options){r.readonly=!0;let e=l.options;"type"===l.bind&&(void 0!==a.currentUser&&null!==a.currentUser||(e=e.filter((e=>"updatedBy"!==e.value&&"createdBy"!==e.value))),(void 0===a.users||null===a.users||a.users&&0===a.users.length)&&(e=e.filter((e=>"collaborator"!==e.value)))),r.dataSource=e,r.dropDownButtonPosition="right","dataField"!==l.bind&&(r.selectedIndex=0),l.options.length<15?r.dropDownHeight="auto":r.dropDownHeight=300}if(l.icon){const e=document.createElement("span");e.classList.add("smart-grid-icon",l.icon,"show","smart-description-button"),s.appendChild(e),r.style.width="calc(100% - 25px)"}if(s.appendChild(r),l.info){const e=document.createElement("span");e.classList.add("smart-grid-icon","smart-icon-attention-circled","show","smart-description-button"),e.title=l.info,s.appendChild(e),r.style.width="calc(100% - 25px)"}if(e.appendChild(o),o.classList.add("smart-grid-dialog-field"),o.appendChild(n),o.appendChild(s),l.width&&!d[t+1].width){const t=document.createElement("div");t.style.clear="both",e.appendChild(t)}}}}}const s=()=>{const t=parseInt(i.style.width),l=a.offset(a);if(window.screen.availWidth<400)return i.open("left","top"),i.style.width=a.offsetWidth+"px",void(i.style.height=a.offsetHeight+"px");{const e=a.editing.addColumnDialog;i.style.width="auto"===e.width?e.width:e.width+"px",i.style.height="auto"===e.height?e.height:e.height+"px"}if(e){const o=e.element;if(o){const e=a.offset(o),n=e.left-l.left,d=l.left,s=Math.max(d,n);if(s+t+o.offsetWidth>l.left+a.offsetWidth){const a=s-t+o.offsetWidth;a<0?i.open("center",e.top+o.offsetHeight-l.top):i.open(Math.max(d,a),e.top+o.offsetHeight-l.top)}else i.open(s,e.top+o.offsetHeight-l.top)}else i.classList.add("center"),i.open("center","center")}else if(a._addNewColumn){let e=a._addNewColumn.element,o=a.offset(e),n=o.left-l.left-t+e.offsetWidth,d=l.left,s=Math.max(d,n);a.editing.addNewColumn._addButton&&a.editing.addNewColumn._addButton.classList.contains("show")&&(e=a.editing.addNewColumn._addButton,o=a.offset(a.editing.addNewColumn._addButton),n=o.left-l.left-t+e.offsetWidth,d=l.left,s=Math.max(d,n)),i.open(s,o.top+e.offsetHeight-l.top)}else i.open("center","center"),i.classList.add("center")};s(),i.refresh=()=>{s()},setTimeout((function(){i.btnConfirm.focus()}),100)}});