@sankhyalabs/ezui 1.2.0-beta.9 → 2.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 (290) hide show
  1. package/dist/cjs/{ApplicationUtils-2ac1b73e.js → ApplicationUtils-edc62c5c.js} +4 -1
  2. package/dist/cjs/CheckMode-ecb90b87.js +7 -0
  3. package/dist/cjs/{DialogType-a1e288e6.js → DialogType-aa435c52.js} +1 -0
  4. package/dist/cjs/ez-actions-button.cjs.entry.js +68 -17
  5. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-button.cjs.entry.js +13 -11
  7. package/dist/cjs/ez-calendar.cjs.entry.js +5 -5
  8. package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-check.cjs.entry.js +11 -9
  10. package/dist/cjs/ez-chip.cjs.entry.js +17 -7
  11. package/dist/cjs/ez-collapsible-box.cjs.entry.js +85 -7
  12. package/dist/cjs/ez-combo-box.cjs.entry.js +51 -20
  13. package/dist/cjs/ez-date-input.cjs.entry.js +13 -18
  14. package/dist/cjs/ez-date-time-input.cjs.entry.js +12 -17
  15. package/dist/cjs/ez-dialog.cjs.entry.js +43 -8
  16. package/dist/cjs/ez-filter-input.cjs.entry.js +1 -1
  17. package/dist/cjs/ez-form.cjs.entry.js +99 -486
  18. package/dist/cjs/ez-grid-config.cjs.entry.js +8 -9
  19. package/dist/cjs/ez-grid.cjs.entry.js +1067 -1165
  20. package/dist/cjs/ez-icon.cjs.entry.js +3 -3
  21. package/dist/cjs/ez-list.cjs.entry.js +2 -4
  22. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  23. package/dist/cjs/ez-modal-container.cjs.entry.js +58 -0
  24. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  25. package/dist/cjs/ez-number-input.cjs.entry.js +4 -4
  26. package/dist/cjs/ez-popover.cjs.entry.js +6 -6
  27. package/dist/cjs/ez-popup.cjs.entry.js +8 -4
  28. package/dist/cjs/ez-radio-button.cjs.entry.js +3 -3
  29. package/dist/cjs/ez-scroller.cjs.entry.js +2 -2
  30. package/dist/cjs/ez-search.cjs.entry.js +1 -1
  31. package/dist/cjs/ez-select-box.cjs.entry.js +1 -1
  32. package/dist/cjs/ez-tabselector.cjs.entry.js +8 -7
  33. package/dist/cjs/ez-text-area.cjs.entry.js +7 -7
  34. package/dist/cjs/ez-text-edit.cjs.entry.js +103 -0
  35. package/dist/cjs/ez-text-input.cjs.entry.js +14 -4
  36. package/dist/cjs/ez-time-input.cjs.entry.js +7 -7
  37. package/dist/cjs/ez-toast.cjs.entry.js +2 -2
  38. package/dist/cjs/ez-upload.cjs.entry.js +4 -4
  39. package/dist/cjs/ez-view-stack.cjs.entry.js +10 -7
  40. package/dist/cjs/ezui.cjs.js +4 -112
  41. package/dist/cjs/loader.cjs.js +2 -18
  42. package/dist/collection/collection-manifest.json +2 -0
  43. package/dist/collection/components/ez-actions-button/ez-actions-button.css +49 -20
  44. package/dist/collection/components/ez-actions-button/ez-actions-button.js +219 -23
  45. package/dist/collection/components/ez-button/ez-button.css +0 -6
  46. package/dist/collection/components/ez-button/ez-button.js +11 -9
  47. package/dist/collection/components/ez-calendar/ez-calendar.css +17 -20
  48. package/dist/collection/components/ez-check/CheckMode.js +5 -0
  49. package/dist/collection/components/ez-check/ez-check.css +23 -24
  50. package/dist/collection/components/ez-check/ez-check.js +10 -8
  51. package/dist/collection/components/ez-chip/ez-chip.css +4 -2
  52. package/dist/collection/components/ez-chip/ez-chip.js +16 -6
  53. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +16 -0
  54. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +226 -7
  55. package/dist/collection/components/ez-combo-box/ez-combo-box.css +1 -22
  56. package/dist/collection/components/ez-combo-box/ez-combo-box.js +51 -20
  57. package/dist/collection/components/ez-date-input/ez-date-input.js +8 -13
  58. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +8 -13
  59. package/dist/collection/components/ez-dialog/DialogType.js +1 -0
  60. package/dist/collection/components/ez-dialog/ez-dialog.css +19 -25
  61. package/dist/collection/components/ez-dialog/ez-dialog.js +41 -6
  62. package/dist/collection/components/ez-form/DataBinder.js +1 -0
  63. package/dist/collection/components/ez-form/ez-form.js +22 -13
  64. package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +3 -3
  65. package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +2 -1
  66. package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +4 -4
  67. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +25 -15
  68. package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +3 -0
  69. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +45 -12
  70. package/dist/collection/components/ez-grid/controller/ag-grid/components/cellRenderer.js +31 -0
  71. package/dist/collection/components/ez-grid/ez-grid.js +40 -3
  72. package/dist/collection/components/ez-grid/subcomponents/ez-grid-config/ez-grid-config.css +38 -27
  73. package/dist/collection/components/ez-grid/subcomponents/ez-grid-config/ez-grid-config.js +1 -2
  74. package/dist/collection/components/ez-grid/subcomponents/ez-select-box/ez-select-box.js +5 -4
  75. package/dist/collection/components/ez-list/ez-list.css +12 -4
  76. package/dist/collection/components/ez-modal-container/ez-modal-container.css +38 -0
  77. package/dist/collection/components/ez-modal-container/ez-modal-container.js +190 -0
  78. package/dist/collection/components/ez-modal-container/index.js +2 -0
  79. package/dist/collection/components/ez-modal-container/modal-action.js +8 -0
  80. package/dist/collection/components/ez-modal-container/modal-button-status.js +7 -0
  81. package/dist/collection/components/ez-popover/ez-popover.css +1 -1
  82. package/dist/collection/components/ez-popup/ez-popup.css +6 -1
  83. package/dist/collection/components/ez-popup/ez-popup.js +26 -4
  84. package/dist/collection/components/ez-radio-button/ez-radio-button.css +16 -5
  85. package/dist/collection/components/ez-radio-button/ez-radio-button.js +1 -1
  86. package/dist/collection/components/ez-scroller/ez-scroller.css +2 -2
  87. package/dist/collection/components/ez-search/ez-search.js +6 -6
  88. package/dist/collection/components/ez-tabselector/ez-tabselector.css +10 -1
  89. package/dist/collection/components/ez-tabselector/ez-tabselector.js +7 -3
  90. package/dist/collection/components/ez-text-area/ez-text-area.css +6 -3
  91. package/dist/collection/components/ez-text-area/ez-text-area.js +5 -5
  92. package/dist/collection/components/ez-text-edit/ez-text-edit.css +19 -0
  93. package/dist/collection/components/ez-text-edit/ez-text-edit.js +188 -0
  94. package/dist/collection/components/ez-text-input/ez-text-input.css +18 -2
  95. package/dist/collection/components/ez-text-input/ez-text-input.js +28 -0
  96. package/dist/collection/components/ez-toast/ez-toast.css +1 -1
  97. package/dist/collection/components/ez-upload/ez-upload.css +1 -1
  98. package/dist/collection/components/ez-view-stack/ez-view-stack.js +12 -6
  99. package/dist/collection/utils/ApplicationUtils.js +3 -0
  100. package/dist/collection/utils/index.js +1 -0
  101. package/dist/custom-elements/index.d.ts +12 -0
  102. package/dist/custom-elements/index.js +1589 -4002
  103. package/dist/{ezui/ApplicationUtils-30a69eb0.js → esm/ApplicationUtils-205ac4bc.js} +4 -2
  104. package/dist/esm/CheckMode-bdb2ec19.js +7 -0
  105. package/dist/esm/{DialogType-72afa679.js → DialogType-4059dc4d.js} +1 -0
  106. package/dist/esm/ez-actions-button.entry.js +68 -17
  107. package/dist/esm/ez-application.entry.js +1 -1
  108. package/dist/esm/ez-button.entry.js +13 -11
  109. package/dist/esm/ez-calendar.entry.js +3 -3
  110. package/dist/esm/ez-card-item.entry.js +1 -1
  111. package/dist/esm/ez-check.entry.js +11 -9
  112. package/dist/esm/ez-chip.entry.js +17 -7
  113. package/dist/esm/ez-collapsible-box.entry.js +85 -7
  114. package/dist/esm/ez-combo-box.entry.js +48 -17
  115. package/dist/esm/ez-date-input.entry.js +10 -15
  116. package/dist/esm/ez-date-time-input.entry.js +10 -15
  117. package/dist/esm/ez-dialog.entry.js +43 -8
  118. package/dist/esm/ez-filter-input.entry.js +1 -1
  119. package/dist/esm/ez-form.entry.js +65 -452
  120. package/dist/esm/ez-grid-config.entry.js +6 -7
  121. package/dist/esm/ez-grid.entry.js +1033 -1131
  122. package/dist/esm/ez-icon.entry.js +2 -2
  123. package/dist/esm/ez-list.entry.js +2 -4
  124. package/dist/esm/ez-loading-bar.entry.js +1 -1
  125. package/dist/esm/ez-modal-container.entry.js +54 -0
  126. package/dist/esm/ez-modal.entry.js +1 -1
  127. package/dist/esm/ez-number-input.entry.js +2 -2
  128. package/dist/esm/ez-popover.entry.js +3 -3
  129. package/dist/esm/ez-popup.entry.js +8 -4
  130. package/dist/esm/ez-radio-button.entry.js +3 -3
  131. package/dist/esm/ez-scroller.entry.js +2 -2
  132. package/dist/esm/ez-search.entry.js +1 -1
  133. package/dist/esm/ez-select-box.entry.js +1 -1
  134. package/dist/esm/ez-tabselector.entry.js +8 -7
  135. package/dist/esm/ez-text-area.entry.js +7 -7
  136. package/dist/esm/ez-text-edit.entry.js +99 -0
  137. package/dist/esm/ez-text-input.entry.js +13 -3
  138. package/dist/esm/ez-time-input.entry.js +2 -2
  139. package/dist/esm/ez-toast.entry.js +2 -2
  140. package/dist/esm/ez-upload.entry.js +4 -4
  141. package/dist/esm/ez-view-stack.entry.js +10 -7
  142. package/dist/esm/ezui.js +4 -112
  143. package/dist/esm/loader.js +2 -18
  144. package/dist/ezui/ezui.esm.js +1 -125
  145. package/dist/ezui/index.esm.js +0 -1
  146. package/dist/ezui/p-04a41a44.entry.js +1 -0
  147. package/dist/ezui/p-0b44cf1c.js +1 -0
  148. package/dist/ezui/p-0c7203d5.entry.js +1 -0
  149. package/dist/ezui/p-2213da1f.entry.js +1 -0
  150. package/dist/ezui/p-2c6398b3.entry.js +1 -0
  151. package/dist/ezui/p-2ccad880.entry.js +1 -0
  152. package/dist/ezui/p-333d79c4.entry.js +1 -0
  153. package/dist/ezui/p-3987f8d8.entry.js +1 -0
  154. package/dist/ezui/{p-81eb2738.entry.js → p-42c6493e.entry.js} +1 -1
  155. package/dist/ezui/{p-b4ad3b15.entry.js → p-482c3dd8.entry.js} +1 -1
  156. package/dist/ezui/p-5bdb1a41.entry.js +1 -0
  157. package/dist/ezui/{p-b2cf7db2.entry.js → p-63d567cc.entry.js} +1 -1
  158. package/dist/ezui/p-659616e4.entry.js +1 -0
  159. package/dist/ezui/p-6608b9a5.entry.js +1 -0
  160. package/dist/ezui/p-77ec47ac.entry.js +1 -0
  161. package/dist/ezui/p-9b9ebf95.entry.js +1 -0
  162. package/dist/ezui/{p-3a0dd69f.entry.js → p-ae5af8f9.entry.js} +1 -1
  163. package/dist/ezui/p-b853763b.js +1 -0
  164. package/dist/ezui/p-be06251d.entry.js +1 -0
  165. package/dist/ezui/{p-e7d03a0d.entry.js → p-bffae598.entry.js} +1 -1
  166. package/dist/ezui/p-cd4677d4.entry.js +1 -0
  167. package/dist/ezui/p-cfcc23e6.entry.js +1 -0
  168. package/dist/ezui/p-dfcf55e0.entry.js +1 -0
  169. package/dist/ezui/p-e1148f5c.js +1 -0
  170. package/dist/ezui/p-e1f2b5da.entry.js +1 -0
  171. package/dist/ezui/p-e230bfd2.entry.js +1 -0
  172. package/dist/ezui/{p-c0dd9a2e.entry.js → p-e3ee814c.entry.js} +1 -1
  173. package/dist/ezui/p-e697ffd5.entry.js +1 -0
  174. package/dist/ezui/{p-4eb273f8.entry.js → p-efa32bcc.entry.js} +1 -1
  175. package/dist/types/components/ez-actions-button/ez-actions-button.d.ts +42 -9
  176. package/dist/types/components/ez-check/CheckMode.d.ts +4 -0
  177. package/dist/types/components/ez-chip/ez-chip.d.ts +2 -1
  178. package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +46 -1
  179. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +15 -5
  180. package/dist/types/components/ez-date-input/ez-date-input.d.ts +0 -1
  181. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +0 -1
  182. package/dist/types/components/ez-dialog/DialogType.d.ts +1 -0
  183. package/dist/types/components/ez-dialog/ez-dialog.d.ts +3 -0
  184. package/dist/types/components/ez-form/DataBinder.d.ts +2 -2
  185. package/dist/types/components/ez-form/ez-form.d.ts +21 -11
  186. package/dist/types/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.d.ts +3 -3
  187. package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +4 -2
  188. package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +2 -5
  189. package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +3 -3
  190. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +11 -0
  191. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +4 -1
  192. package/dist/types/components/ez-grid/controller/ag-grid/components/cellRenderer.d.ts +9 -0
  193. package/dist/types/components/ez-grid/ez-grid.d.ts +8 -3
  194. package/dist/types/components/ez-grid/subcomponents/ez-select-box/ez-select-box.d.ts +2 -6
  195. package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +47 -0
  196. package/dist/types/components/ez-modal-container/index.d.ts +2 -0
  197. package/dist/types/components/ez-modal-container/modal-action.d.ts +7 -0
  198. package/dist/types/components/ez-modal-container/modal-button-status.d.ts +6 -0
  199. package/dist/types/components/ez-popup/ez-popup.d.ts +4 -0
  200. package/dist/types/components/ez-search/ez-search.d.ts +3 -3
  201. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +2 -0
  202. package/dist/types/components/ez-text-edit/ez-text-edit.d.ts +39 -0
  203. package/dist/types/components/ez-text-input/ez-text-input.d.ts +5 -0
  204. package/dist/types/components/ez-view-stack/ez-view-stack.d.ts +5 -1
  205. package/dist/types/components.d.ts +274 -28
  206. package/dist/types/utils/ApplicationUtils.d.ts +1 -0
  207. package/dist/types/utils/index.d.ts +1 -0
  208. package/package.json +5 -5
  209. package/react/components.d.ts +2 -0
  210. package/react/components.js +2 -0
  211. package/react/components.js.map +1 -1
  212. package/dist/cjs/ApplicationUtils-475b50d9.js +0 -63
  213. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  214. package/dist/cjs/css-shim-3bfdba4f.js +0 -6
  215. package/dist/cjs/dom-8ac1ad03.js +0 -75
  216. package/dist/cjs/index-2ec1da82.js +0 -2307
  217. package/dist/cjs/index-55178184.js +0 -6
  218. package/dist/cjs/index-d9c5cb88.js +0 -3068
  219. package/dist/cjs/shadow-css-41d9783d.js +0 -390
  220. package/dist/esm/ApplicationUtils-30a69eb0.js +0 -61
  221. package/dist/esm/ApplicationUtils-a4a76132.js +0 -60
  222. package/dist/esm/app-globals-0f993ce5.js +0 -3
  223. package/dist/esm/css-shim-20dbffa5.js +0 -4
  224. package/dist/esm/dom-c5ed0ba5.js +0 -73
  225. package/dist/esm/index-1e9d524f.js +0 -3031
  226. package/dist/esm/index-b96183c8.js +0 -2295
  227. package/dist/esm/index-f32470b5.js +0 -3
  228. package/dist/esm/shadow-css-8c625855.js +0 -388
  229. package/dist/ezui/CSSVarsUtils-00f67f32.js +0 -70
  230. package/dist/ezui/DialogType-72afa679.js +0 -8
  231. package/dist/ezui/app-globals-0f993ce5.js +0 -3
  232. package/dist/ezui/css-shim-20dbffa5.js +0 -4
  233. package/dist/ezui/dom-c5ed0ba5.js +0 -73
  234. package/dist/ezui/ez-actions-button.entry.js +0 -98
  235. package/dist/ezui/ez-application.entry.js +0 -22
  236. package/dist/ezui/ez-button.entry.js +0 -73
  237. package/dist/ezui/ez-calendar.entry.js +0 -219
  238. package/dist/ezui/ez-card-item.entry.js +0 -40
  239. package/dist/ezui/ez-check.entry.js +0 -72
  240. package/dist/ezui/ez-chip.entry.js +0 -97
  241. package/dist/ezui/ez-collapsible-box.entry.js +0 -57
  242. package/dist/ezui/ez-combo-box.entry.js +0 -439
  243. package/dist/ezui/ez-date-input.entry.js +0 -159
  244. package/dist/ezui/ez-date-time-input.entry.js +0 -214
  245. package/dist/ezui/ez-dialog.entry.js +0 -108
  246. package/dist/ezui/ez-filter-input.entry.js +0 -75
  247. package/dist/ezui/ez-form.entry.js +0 -1395
  248. package/dist/ezui/ez-grid-config.entry.js +0 -433
  249. package/dist/ezui/ez-grid.entry.js +0 -115422
  250. package/dist/ezui/ez-icon.entry.js +0 -37
  251. package/dist/ezui/ez-list.entry.js +0 -516
  252. package/dist/ezui/ez-loading-bar.entry.js +0 -24
  253. package/dist/ezui/ez-modal.entry.js +0 -67
  254. package/dist/ezui/ez-number-input.entry.js +0 -148
  255. package/dist/ezui/ez-popover.entry.js +0 -141
  256. package/dist/ezui/ez-popup.entry.js +0 -49
  257. package/dist/ezui/ez-radio-button.entry.js +0 -45
  258. package/dist/ezui/ez-scroller.entry.js +0 -101
  259. package/dist/ezui/ez-search.entry.js +0 -83
  260. package/dist/ezui/ez-select-box.entry.js +0 -18
  261. package/dist/ezui/ez-tabselector.entry.js +0 -195
  262. package/dist/ezui/ez-text-area.entry.js +0 -158
  263. package/dist/ezui/ez-text-input.entry.js +0 -235
  264. package/dist/ezui/ez-time-input.entry.js +0 -164
  265. package/dist/ezui/ez-toast.entry.js +0 -84
  266. package/dist/ezui/ez-upload.entry.js +0 -379
  267. package/dist/ezui/ez-view-stack.entry.js +0 -74
  268. package/dist/ezui/index-1e9d524f.js +0 -3031
  269. package/dist/ezui/index-b96183c8.js +0 -2295
  270. package/dist/ezui/index-f32470b5.js +0 -3
  271. package/dist/ezui/p-2f02347d.entry.js +0 -1
  272. package/dist/ezui/p-416bedbe.entry.js +0 -1
  273. package/dist/ezui/p-544f0c63.entry.js +0 -1
  274. package/dist/ezui/p-62110996.entry.js +0 -1
  275. package/dist/ezui/p-719e9ef9.entry.js +0 -1
  276. package/dist/ezui/p-787fbdfe.js +0 -1
  277. package/dist/ezui/p-9d5be6a7.entry.js +0 -1
  278. package/dist/ezui/p-a27dafa4.entry.js +0 -1
  279. package/dist/ezui/p-aba3fa6c.entry.js +0 -1
  280. package/dist/ezui/p-adbe4188.js +0 -1
  281. package/dist/ezui/p-af43be42.entry.js +0 -1
  282. package/dist/ezui/p-b7467ad6.entry.js +0 -1
  283. package/dist/ezui/p-c019e137.entry.js +0 -1
  284. package/dist/ezui/p-c9d2060e.entry.js +0 -1
  285. package/dist/ezui/p-cccd8cde.entry.js +0 -1
  286. package/dist/ezui/p-d0671e14.entry.js +0 -1
  287. package/dist/ezui/p-e0f06d73.entry.js +0 -1
  288. package/dist/ezui/p-e59adce6.entry.js +0 -1
  289. package/dist/ezui/p-ed835b36.entry.js +0 -1
  290. package/dist/ezui/shadow-css-8c625855.js +0 -388
@@ -1,164 +0,0 @@
1
- import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-1e9d524f.js';
2
- import { T as TimeFormatter, M as MaskFormatter, N as NumberUtils } from './index-b96183c8.js';
3
- import { C as CSSVarsUtils } from './CSSVarsUtils-00f67f32.js';
4
-
5
- const ezTimeInputCss = ":host{display:flex;flex-wrap:wrap;position:relative;width:100%}";
6
-
7
- let EzTimeInput = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.ezChange = createEvent(this, "ezChange", 7);
11
- this.ezStartChange = createEvent(this, "ezStartChange", 7);
12
- this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
13
- /**
14
- * Deixa o campo disponível ou não para digitação.
15
- */
16
- this.enabled = true;
17
- /**
18
- * Define se o componente irá ou não considerar os segundos.
19
- */
20
- this.showSeconds = false;
21
- /**
22
- * Define o modo do tamanho do campo; opções: slim e regular.
23
- */
24
- this.mode = "regular";
25
- }
26
- observeErrorMessage() {
27
- var _a;
28
- if (this._textInput) {
29
- this._textInput.errorMessage = this.errorMessage;
30
- if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
31
- this.prepareValue(this._viewValue);
32
- if ((this._textInput.value || '') !== this._viewValue) {
33
- this._textInput.value = this._viewValue;
34
- }
35
- }
36
- }
37
- }
38
- observeShowSeconds() {
39
- if (this.showSeconds) {
40
- this.prepareMask("##:##:##");
41
- }
42
- else {
43
- this.prepareMask("##:##");
44
- }
45
- }
46
- observeValue(newValue, oldValue) {
47
- if (this._textInput && newValue != oldValue) {
48
- let newValueValidated = this.validateValue(newValue);
49
- const oldValueValidated = this.validateValue(oldValue);
50
- if (newValueValidated != oldValueValidated) {
51
- this._viewValue = newValueValidated == undefined ? "" : newValueValidated.toString();
52
- this.prepareValue(this._viewValue);
53
- if (this._viewValue && !TimeFormatter.validateTime(this._viewValue, this.showSeconds)) {
54
- this.setError("Favor inserir um horário válido.");
55
- newValueValidated = undefined;
56
- }
57
- else {
58
- this.setError("");
59
- }
60
- const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
61
- this.ezChange.emit(valueEmitted);
62
- }
63
- }
64
- }
65
- //---------------------------------------------
66
- // Private methods
67
- //---------------------------------------------
68
- prepareMask(mask) {
69
- if (this._maskFormatter == undefined) {
70
- this._maskFormatter = new MaskFormatter(mask);
71
- }
72
- else {
73
- this._maskFormatter.mask = mask;
74
- }
75
- }
76
- validateValue(value) {
77
- return isNaN(value) || value === undefined ? null : value;
78
- }
79
- setError(msg) {
80
- this.errorMessage = msg;
81
- if (this._textInput && (msg === null || msg === void 0 ? void 0 : msg.trim())) {
82
- this.ezCancelWaitingChange.emit();
83
- }
84
- }
85
- //---------------------------------------------
86
- // Public methods
87
- //---------------------------------------------
88
- getViewValue() {
89
- return this._viewValue;
90
- }
91
- prepareValue(value) {
92
- try {
93
- this._viewValue = TimeFormatter.prepareValue(value, this.showSeconds);
94
- if (this._textInput && this._textInput.value !== this._viewValue) {
95
- this._textInput.value = this._viewValue;
96
- }
97
- }
98
- catch (e) {
99
- this.setError(e.message);
100
- }
101
- }
102
- /**
103
- * Faz o foco no componente de input
104
- */
105
- async setFocus() {
106
- this._textInput.setFocus();
107
- }
108
- /**
109
- * Remove o foco no componente de input
110
- */
111
- async setBlur() {
112
- this._textInput.setBlur();
113
- }
114
- /**
115
- * Retorna informando se o campo está inválido (true | false)
116
- */
117
- async isInvalid() {
118
- return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
119
- }
120
- //---------------------------------------------
121
- // Event handlers
122
- //---------------------------------------------
123
- handleBlur() {
124
- if (this._textInput) {
125
- this._viewValue = this._textInput.value;
126
- this.prepareValue(this._viewValue);
127
- this.value = NumberUtils.stringToNumber(this._viewValue.replace(/\D/g, ""));
128
- }
129
- }
130
- handleInput() {
131
- const parsedNumber = NumberUtils.stringToNumber(this._textInput.value.replace(/\D/g, ""));
132
- if (parsedNumber !== this.value) {
133
- this.ezStartChange.emit({ waitmessage: "", blocking: false });
134
- }
135
- }
136
- //---------------------------------------------
137
- // Lifecycle web component
138
- //---------------------------------------------
139
- componentDidLoad() {
140
- CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
141
- }
142
- componentWillLoad() {
143
- this.observeShowSeconds();
144
- if (this.value) {
145
- this.prepareValue(this.value.toString());
146
- }
147
- else if (this._viewValue) {
148
- this.prepareValue(this._viewValue);
149
- }
150
- }
151
- render() {
152
- return (h(Host, null, h("ez-text-input", { ref: (el) => this._textInput = el, "data-slave-mode": "true", value: this._viewValue, enabled: this.enabled, label: this.label, restrict: "0123456789:", onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), errorMessage: this.errorMessage, mode: this.mode }, h("ez-icon", { slot: "leftIcon", iconName: "timer-outline" }))));
153
- }
154
- static get assetsDirs() { return ["../assets"]; }
155
- get _elem() { return getElement(this); }
156
- static get watchers() { return {
157
- "errorMessage": ["observeErrorMessage"],
158
- "showSeconds": ["observeShowSeconds"],
159
- "value": ["observeValue"]
160
- }; }
161
- };
162
- EzTimeInput.style = ezTimeInputCss;
163
-
164
- export { EzTimeInput as ez_time_input };
@@ -1,84 +0,0 @@
1
- import { r as registerInstance, i as forceUpdate, h, f as Host } from './index-1e9d524f.js';
2
-
3
- const ezToastCss = ":host{--ez-toast__btn__close__image:url('data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg%22%3E<path d=\"M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z\"/></svg>');--ez-toast__container-z-index:var(--more-visible, 2);--ez-toast__container--background-color:var(--color--secondary, #383c45);--ez-toast__icon--padding-left:var(--space--small, 6px)}.toast__container{position:fixed;display:flex;bottom:100px;z-index:var(--ez-toast__container-z-index);left:100px;width:280px;box-sizing:border-box;background-color:var(--ez-toast__container--background-color);border-radius:6px;align-items:center;padding:12px;visibility:hidden}.message__container{font-family:\"Sora\", \"Algerian\";text-shadow:0 0 0 #353535, 0 0 1px transparent;color:#FFFFFF;font-size:14px;width:90%;overflow:hidden;hyphens:auto;height:auto;-webkit-box-orient:vertical;-webkit-line-clamp:4;display:-webkit-box;text-overflow:ellipsis}.message__conteiner--icon{padding-left:var(--ez-toast__icon--padding-left);width:80%}.btn-close{margin-top:3px;display:flex;justify-content:flex-end;align-self:flex-start;padding:0;outline:none;width:10%;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:'';display:flex;background-color:#FFFFFF;width:12px;height:12px;-webkit-mask-image:var(--ez-toast__btn__close__image);mask-image:var(--ez-toast__btn__close__image)}.toast__container--opened{animation:fadein 0.5s, fadeout 0.5s 3s;visibility:visible}@-webkit-keyframes fadein{from{left:-100px;opacity:0}to{left:100px;opacity:1}}@keyframes fadein{from{left:-100px;opacity:0}to{left:100px;opacity:1}}@-webkit-keyframes fadeout{from{left:100px;opacity:1}to{bottom:0;opacity:0}}@keyframes fadeout{from{left:100px;opacity:1}to{bottom:0;opacity:0}}";
4
-
5
- let EzToast = class {
6
- constructor(hostRef) {
7
- registerInstance(this, hostRef);
8
- this._nextMessages = [];
9
- this._currentMessageInfo = { message: "", fadeTime: undefined, useIcon: undefined };
10
- this._toastOpenedClass = "toast__container--opened";
11
- this._lastTimeOut = undefined;
12
- this._lang = "pt"; // Controla qual idioma será usado para definir a regras de hifenização.
13
- /**
14
- * Controla o tempo de exibição do componente em milissegundos.
15
- */
16
- this.fadeTime = 5000;
17
- /**
18
- * Adiciona ícone de check no componente.
19
- */
20
- this.useIcon = false;
21
- /**
22
- * Controla o uso do icone de fechar o toast.
23
- */
24
- this.canClose = true;
25
- }
26
- /**
27
- * Exibe o componente na tela.
28
- */
29
- async show(message, fadeTime, useIcon, canClose) {
30
- return new Promise(resolve => {
31
- var _a;
32
- if ((_a = this.container) === null || _a === void 0 ? void 0 : _a.classList.contains(this._toastOpenedClass)) {
33
- this._nextMessages.push({ message, fadeTime, useIcon, canClose, callBack: resolve });
34
- }
35
- else {
36
- this._currentMessageInfo.message = message || this.message;
37
- this._currentMessageInfo.fadeTime = fadeTime || this.fadeTime;
38
- this._currentMessageInfo.useIcon = useIcon || this.useIcon;
39
- this._currentMessageInfo.callBack = resolve;
40
- if (canClose) {
41
- this._currentMessageInfo.canClose = this.canClose;
42
- }
43
- forceUpdate(this);
44
- this.displayToast();
45
- this._lastTimeOut = setTimeout(() => {
46
- this.hideToast();
47
- }, this._currentMessageInfo.fadeTime + 400);
48
- }
49
- });
50
- }
51
- hideToast() {
52
- this.makeToastInvisible();
53
- if (this._nextMessages.length > 0) {
54
- if (this._currentMessageInfo.callBack) {
55
- this._currentMessageInfo.callBack(true);
56
- }
57
- setTimeout(() => {
58
- let newMessageInfo = this._nextMessages.shift();
59
- this.show(newMessageInfo.message, newMessageInfo.fadeTime, newMessageInfo.useIcon);
60
- });
61
- }
62
- if (this._currentMessageInfo.callBack) {
63
- this._currentMessageInfo.callBack(true);
64
- }
65
- }
66
- makeToastInvisible() {
67
- this.container.classList.remove(this._toastOpenedClass);
68
- this.container.style.animation = `none`;
69
- if (this._lastTimeOut)
70
- clearTimeout(this._lastTimeOut);
71
- }
72
- displayToast() {
73
- this.container.classList.add(this._toastOpenedClass);
74
- this.container.style.animation = `fadein 0.5s, fadeout 0.5s ${this.fadeTime / 1000}s`;
75
- }
76
- render() {
77
- return (h(Host, null, h("div", { ref: (el) => this.container = el, class: "toast__container" }, this._currentMessageInfo.useIcon &&
78
- h("slot", { name: "icon" }), h("div", { lang: this._lang, class: this._currentMessageInfo.useIcon ? "message__container message__conteiner--icon" : "message__container", title: this._currentMessageInfo.message, innerHTML: this._currentMessageInfo.message }), this._currentMessageInfo.canClose &&
79
- h("button", { class: "btn-close", onClick: () => { this.hideToast(); } }))));
80
- }
81
- };
82
- EzToast.style = ezToastCss;
83
-
84
- export { EzToast as ez_toast };
@@ -1,379 +0,0 @@
1
- import { r as registerInstance, e as createEvent, i as forceUpdate, h, g as getElement } from './index-1e9d524f.js';
2
- import { A as ApplicationUtils } from './ApplicationUtils-30a69eb0.js';
3
- import './DialogType-72afa679.js';
4
-
5
- class RemoteFile {
6
- constructor(file) {
7
- this.file = file;
8
- this.size = file.size;
9
- this.name = file.name;
10
- }
11
- abortUpload() {
12
- if (this._uploadingXhr) {
13
- this._aborted = true;
14
- this._uploadingXhr.abort();
15
- this._uploadingXhr = undefined;
16
- }
17
- }
18
- isUploading() {
19
- return this._uploadingXhr !== undefined;
20
- }
21
- async upload(server, headers, updateCallBack) {
22
- return new Promise((resolve, reject) => {
23
- const xhr = new XMLHttpRequest();
24
- this._uploadingXhr = xhr;
25
- this._aborted = false;
26
- this.progress = 0;
27
- xhr.upload.onprogress = (e) => {
28
- const loaded = e.loaded;
29
- const total = e.total;
30
- this.progress = ~~((loaded / total) * 100);
31
- updateCallBack(this, loaded, total);
32
- };
33
- xhr.onreadystatechange = () => {
34
- if (xhr.readyState == 4) {
35
- this._uploadingXhr = undefined;
36
- const status = xhr.status;
37
- if (!this._aborted) {
38
- if (status === 0) {
39
- reject("Servidor indisponível");
40
- }
41
- else if (status >= 500) {
42
- reject("Erro inesperado no servidor");
43
- }
44
- else if (status >= 400) {
45
- reject("Operação não permitida");
46
- }
47
- }
48
- const response = xhr.response;
49
- if (response) {
50
- try {
51
- resolve(JSON.parse(response));
52
- }
53
- catch (error) {
54
- reject(`Servidor não retornou um objeto válido: ${response}.\n${error}`);
55
- }
56
- }
57
- }
58
- };
59
- xhr.ontimeout = () => {
60
- reject("Tempo limite de transferência atingido.");
61
- };
62
- const formData = new FormData();
63
- formData.append("ARQUIVO", this.file, this.file.name);
64
- xhr.open("POST", server, true);
65
- if (headers) {
66
- headers.forEach((value, key) => xhr.setRequestHeader(key, value));
67
- }
68
- xhr.send(formData);
69
- });
70
- }
71
- async delete(item, server, headers) {
72
- return new Promise((resolve, reject) => {
73
- const xhr = new XMLHttpRequest();
74
- xhr.onreadystatechange = () => {
75
- if (xhr.readyState == 4) {
76
- if (xhr.status === 0) {
77
- reject("Servidor indisponível");
78
- }
79
- else if (xhr.status >= 500) {
80
- reject("Erro inesperado no servidor");
81
- }
82
- else if (xhr.status >= 400) {
83
- reject("Operação não permitida");
84
- }
85
- resolve(true);
86
- }
87
- };
88
- xhr.ontimeout = () => {
89
- reject("Tempo limite de remoção atingido.");
90
- };
91
- xhr.open("DELETE", server, true);
92
- if (headers) {
93
- headers.forEach((value, key) => xhr.setRequestHeader(key, value));
94
- }
95
- xhr.send(JSON.stringify(item));
96
- });
97
- }
98
- }
99
-
100
- const ezUploadCss = ":host{--ez-upload--height:42px;--ez-upload--width:100%;--ez-upload__icon--width:48px;--ez-upload__container--background-color:var(--background--medium, #d2dce9);--ez-upload__color--primary:var(--color--primary, #008561);--ez-upload--padding--extra-small:var(--space--extra-small, 3px);--ez-upload--padding--small:var(--space--small, 6px);--ez-upload--padding--medium:var(--space--medium, 12px);--ez-upload--padding--large:var(--space--large, 24px);--ez-upload__border--color:var(--color-strokes, #DCE0E8);--ez-upload--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-upload--text--primary:var(--text-primary, #626e82);--ez-upload--font-size:var(--text--medium, 14px);--ez-upload--font-family:var(--font-pattern, Arial);--ez-upload--font-weight:var(--text-weight--large, 500);--ez-upload__btn__cancel-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"8x\" width=\"8px\"><path d=\"M 8,0.8 7.2,0 4,3.2 0.8,0 0,0.8 3.2,4 0,7.2 0.8,8 4,4.8 7.2,8 8,7.2 4.8,4 Z\"/></svg>');--ez-upload__file-icon-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"11x\" width=\"9px\"><path d=\"M 1.2272719,8.4999999 V 2.75 c 0,-1.1045695 1.4652499,-2 3.2727273,-2 1.8074777,0 3.2727281,0.8954305 3.2727281,2 V 8.9999999 C 7.7727273,9.690356 6.8569456,10.25 5.7272719,10.25 4.5975985,10.25 3.6818174,9.690356 3.6818174,8.9999999 V 3.75 c 0,-0.2761425 0.3663125,-0.5 0.8181818,-0.5 0.4518694,0 0.8181818,0.2238575 0.8181818,0.5 V 8.4999999 H 6.5454537 V 3.75 C 6.5454537,3.059644 5.6296725,2.5 4.4999992,2.5 3.3703258,2.5 2.4545446,3.059644 2.4545446,3.75 V 8.9999999 C 2.4545446,10.10457 3.9197945,11 5.7272719,11 7.5347496,11 9,10.10457 9,8.9999999 V 2.75 C 9,1.231217 6.9852809,0 4.4999992,0 2.0147181,5e-7 0,1.231217 0,2.75 v 5.7499999 z\"/></svg>');display:flex;flex-wrap:wrap;position:relative;padding-bottom:16px;font-family:var(--ez-upload--font-family);font-size:var(--ez-upload--font-size);width:var(--ez-upload--width);font-weight:var(--ez-upload--font-weight)}.iu{display:flex;flex-wrap:wrap;background-color:var(--ez-upload__container--background-color);padding:var(--ez-upload--padding--small);width:100%;border-radius:12px;box-sizing:border-box}.iu__container{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;border:2px dashed var(--ez-upload__border--color);border-radius:6px;box-sizing:border-box}.iu__footer{display:flex;flex-wrap:wrap;justify-content:flex-start;width:100%;padding:0 var(--ez-upload--padding--medium) var(--ez-upload--padding--medium) var(--ez-upload--padding--medium);box-sizing:border-box}.iu__item{display:flex;width:100%;justify-content:flex-start;align-items:center;align-self:center;padding-bottom:var(--ez-upload--padding--extra-small);box-sizing:border-box;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.iu__item-label{display:flex;max-width:80%;align-self:stretch;align-items:center}.file__name{font-weight:200}.box__content{width:100%;justify-content:center;align-items:center;height:100%;border:1px dashed var(--ez-upload__border--color);border-radius:6px;box-sizing:border-box}.box__container{display:flex;flex-wrap:wrap;background-color:var(--ez-upload__container--background-color);padding:6px;width:100%;border-radius:12px}a:-webkit-any-link{color:#008561;fill:#008561;cursor:pointer;text-decoration:none}progress[value]{display:flex;width:100%;appearance:none;border:1px solid var(--ez-upload__border--color);height:12px;justify-content:flex-start;align-items:center;border-radius:3px;position:relative}progress[value]::-webkit-progress-bar{display:flex;-webkit-appearance:none;width:100%;background-color:rgb(255, 255, 255);border-radius:2px;padding:2px}progress[value]::-webkit-progress-value{display:flex;width:100%;background-color:var(--ez-upload__color--primary)}.text--center{text-align:center}.align--middle{align-self:center;align-items:center}.text{font-family:\"Sora\", \"Algerian\";text-shadow:0 0 0 #353535, 0 0 1px transparent}.text--primary{color:var(--ez-upload--text--primary);text-shadow:var(--ez-upload--text-shadow)}.text--ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.text--medium{font-size:14px}.text--small{font-size:12px}.btn-cancel{outline:none;border:none;background-color:unset;cursor:pointer}.btn-cancel::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:8px;height:8px;-webkit-mask-image:var(--ez-upload__btn__cancel-image);mask-image:var(--ez-upload__btn__cancel-image)}.iu_header{display:flex;flex-direction:column;width:100%}.iu__label{padding:var(--space--small);box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-upload--font-family);font-size:var(--text--extra-small);font-weight:var(--ez-upload--font-weight);color:var(--ez-upload--text--primary);text-shadow:var(--ez-upload--text-shadow)}.iu__file-icon{outline:none;border:none;background-color:unset;cursor:pointer}.iu__file-icon:disabled{cursor:unset}.iu__file-icon::after{content:'';display:flex;background-color:var(--text--primary, #626e82);width:9px;height:11px;-webkit-mask-image:var(--ez-upload__file-icon-image);mask-image:var(--ez-upload__file-icon-image)}.iu__file-icon:disabled::after{background-color:var(--text--disable, #AFB6C0)}.iu__icon-label{justify-content:center;display:flex;cursor:pointer;padding:var(--ez-upload--padding--large) 0px;box-sizing:border-box}.background--disabled{background-color:var(--color--disable-secondary, #F2F5F8)}.text--disabled{color:var(--text--disable, #AFB6C0)}.mouse-pointer--disabled{cursor:unset}.appearanceNone{width:0px;height:0px}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
101
-
102
- let EzUpload = class {
103
- constructor(hostRef) {
104
- registerInstance(this, hostRef);
105
- this.ezChange = createEvent(this, "ezChange", 7);
106
- this.ezStartChange = createEvent(this, "ezStartChange", 7);
107
- this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
108
- this._filePointers = new Map();
109
- /**
110
- * Deixa o campo disponível ou não para digitação.
111
- */
112
- this.enabled = true;
113
- }
114
- observeValue(newValue, oldValue) {
115
- //Observamos o mundo externo, se um novo valor foi atribuído,
116
- //precisamos cancelar a alteração anterior, isso envolve, percorrer
117
- //a lista de ponteiros e cancelar todos os uploads em andamento.
118
- if (newValue !== this._updatingValue || (newValue == undefined && oldValue != undefined)) {
119
- this._filePointers.forEach(f => {
120
- if (this.isRemoteFile(f)) {
121
- f.abortUpload();
122
- }
123
- });
124
- this._filePointers = new Map();
125
- this.updateFilePointers();
126
- this._updatingValue = undefined;
127
- }
128
- }
129
- updateFilePointers() {
130
- if (this.value) {
131
- this.value.forEach(ezFile => this._filePointers.set(ezFile.name, ezFile));
132
- }
133
- }
134
- observeRequestHeaders() {
135
- this._requestHeaders = new Map();
136
- if (typeof this.requestHeaders == "string") {
137
- try {
138
- this.requestHeaders = JSON.parse(this.requestHeaders);
139
- }
140
- catch (e) {
141
- this.requestHeaders = undefined;
142
- }
143
- }
144
- for (var key in this.requestHeaders) {
145
- this._requestHeaders.set(key, this.requestHeaders[key]);
146
- }
147
- }
148
- /**
149
- * Método responsável por adicionar um ou mais arquivos ao componente.
150
- */
151
- async addFiles(files) {
152
- if (this.maxFiles > 0) {
153
- let countDistinctFiles = this._filePointers.size;
154
- files.forEach(file => {
155
- if (!this._filePointers.has(file.name)) {
156
- countDistinctFiles++;
157
- }
158
- });
159
- if (countDistinctFiles > this.maxFiles) {
160
- this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`);
161
- return;
162
- }
163
- }
164
- Array.prototype.forEach.call(files, this.addFile.bind(this));
165
- }
166
- /**
167
- * Realiza o foco no componente de upload
168
- */
169
- async setFocus() {
170
- this._fileInput.focus();
171
- }
172
- /**
173
- * Remove o foco no componente de upload
174
- */
175
- async setBlur() {
176
- this._fileInput.blur();
177
- }
178
- async addFile(file) {
179
- const oldFile = this._filePointers.get(file.name);
180
- if (oldFile) {
181
- ApplicationUtils.confirm("Substituir arquivo", `Já existe um arquivo chamado "${file.name}". Deseja substituí-lo?`)
182
- .then(ok => {
183
- if (ok) {
184
- if (this.isRemoteFile(oldFile)) {
185
- oldFile.abortUpload();
186
- }
187
- this.doAddFile(file);
188
- }
189
- });
190
- }
191
- else {
192
- this.doAddFile(file);
193
- }
194
- }
195
- async doAddFile(file) {
196
- try {
197
- if (this.validateFile(file)) {
198
- this.ezStartChange.emit({ waitmessage: "Há arquivos sendo enviados. Por favor aguarde a conclusão ou cancele o envio.", blocking: true });
199
- const uploadingFile = new RemoteFile(file);
200
- const oldPointer = this._filePointers.get(file.name);
201
- if (oldPointer && this.isRemoteFile(oldPointer)) {
202
- oldPointer.abortUpload();
203
- }
204
- this._filePointers.set(file.name, uploadingFile);
205
- uploadingFile.upload(this.urlUpload, this._requestHeaders, (file) => this.updateFeedback(file))
206
- .then((files) => files.forEach(ezFile => this.finishUpload(uploadingFile.name, ezFile)))
207
- .catch(msg => {
208
- this.ezCancelWaitingChange.emit();
209
- this.showError(msg);
210
- });
211
- forceUpdate(this);
212
- }
213
- }
214
- catch (error) {
215
- this.ezCancelWaitingChange.emit();
216
- throw error;
217
- }
218
- }
219
- finishUpload(key, ezFile) {
220
- this._filePointers.set(key, ezFile);
221
- this.updateValue();
222
- }
223
- updateValue() {
224
- this._updatingValue = [];
225
- this._filePointers.forEach(f => {
226
- if (!this.isRemoteFile(f)) {
227
- this._updatingValue.push(f);
228
- }
229
- });
230
- if (this._filePointers.size === this._updatingValue.length) {
231
- this.value = this._updatingValue;
232
- this.ezChange.emit(this.value);
233
- }
234
- }
235
- buildProgressId(uploading) {
236
- let sanitizedName = uploading.name.replace(/[^a-z0-9_]/gi, "_");
237
- return `PROGRESS_${sanitizedName}_${uploading.file.lastModified}`;
238
- }
239
- updateFeedback(uf) {
240
- window.requestAnimationFrame(() => {
241
- if (this._host) {
242
- const progress = this._host.shadowRoot.querySelector("#" + this.buildProgressId(uf));
243
- if (progress) {
244
- progress.value = uf.progress;
245
- }
246
- }
247
- });
248
- }
249
- validateFile(file) {
250
- if (!this._filePointers.has(file.name) && this.maxFiles > 0 && this._filePointers.size >= this.maxFiles) {
251
- this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`);
252
- return false;
253
- }
254
- if (file.size === 0) {
255
- this.showError(`Erro de permissão: O arquivo "${file.name}" não pode ser enviado.`);
256
- return false;
257
- }
258
- if (!this.urlUpload) {
259
- this.showError("Endereço de upload não informado");
260
- return false;
261
- }
262
- if (this.maxFileSize >= 0 && file.size > this.maxFileSize) {
263
- this.showError("O tamanho máximo dos arquivos é de " + this.formatBytes(this.maxFileSize));
264
- return false;
265
- }
266
- return true;
267
- }
268
- showError(message) {
269
- ApplicationUtils.alert("Enviando arquivo", message);
270
- }
271
- formatBytes(bytes, decimals = 1) {
272
- if (bytes === 0)
273
- return "0 Bytes";
274
- const k = 1024;
275
- const dm = decimals < 0 ? 0 : decimals;
276
- const sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
277
- const i = Math.floor(Math.log(bytes) / Math.log(k));
278
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
279
- }
280
- onFileInputChange(event) {
281
- const input = event.target;
282
- this.addFiles(Array.from(input.files));
283
- this._fileInput.value = "";
284
- }
285
- isRemoteFile(item) {
286
- return "file" in item;
287
- }
288
- removeFromList(name) {
289
- this._filePointers.delete(name);
290
- this.updateValue();
291
- }
292
- removeFile(name) {
293
- const item = this._filePointers.get(name);
294
- if (this.isRemoteFile(item)) {
295
- item.abortUpload();
296
- this.removeFromList(name);
297
- }
298
- else {
299
- if (this.urlDelete) {
300
- const uploadingFile = new RemoteFile(null);
301
- this._filePointers.set(item.name, uploadingFile);
302
- uploadingFile.delete(item, this.urlDelete, null)
303
- .then(_ok => this.removeFromList(name))
304
- .catch(msg => this.showError(msg));
305
- }
306
- else {
307
- this.removeFromList(name);
308
- }
309
- }
310
- }
311
- openFilesDialog() {
312
- if (this.enabled) {
313
- this._fileInput.click();
314
- }
315
- }
316
- componentDidLoad() {
317
- if (this.enabled && this._dropZone && window.FileList && window.File) {
318
- this._dropZone.addEventListener("dragover", event => {
319
- event.stopPropagation();
320
- event.preventDefault();
321
- event.dataTransfer.dropEffect = "copy";
322
- this._dropZone.style.background = "#c2dbff";
323
- });
324
- this._dropZone.addEventListener("drop", event => {
325
- event.stopPropagation();
326
- event.preventDefault();
327
- this.addFiles(Array.from(event.dataTransfer.files));
328
- this._dropZone.style.background = "";
329
- });
330
- this._dropZone.addEventListener("dragleave", _event => {
331
- this._dropZone.style.background = "";
332
- });
333
- }
334
- }
335
- componentWillRender() {
336
- if (this.value) {
337
- if (this._filePointers.size < this.value.length) {
338
- this.updateFilePointers();
339
- }
340
- }
341
- }
342
- render() {
343
- return (h("div", { ref: (el) => this._dropZone = el, class: this.evalDisabledClass("iu", "background--disabled") }, h("div", { class: "iu__container", onClick: () => this.openFilesDialog() }, h("div", { class: "iu_header" }, this.label ? h("label", { class: this.evalDisabledClass("iu__label", "text--disabled"), title: this.label }, this.label) : null, h("div", { class: this.evalDisabledClass("iu__icon-label", "mouse-pointer--disabled") }, h("button", { class: "iu__file-icon", disabled: !this.enabled }), h("div", { class: this.evalDisabledClass("text text--center text--medium text--primary", "text--disabled") }, this.enabled ? "Arraste e solte ou clique para adicionar arquivos" : "Somente leitura"))), this.buildFooter()), h("input", { ref: (el) => this._fileInput = el, onChange: (ev) => this.onFileInputChange(ev), type: "file", multiple: true, class: "appearanceNone" })));
344
- }
345
- buildFooter() {
346
- if (this._filePointers.size === 0) {
347
- return null;
348
- }
349
- const items = [];
350
- this._filePointers.forEach(item => items.push(this.buildFileItem(item)));
351
- return (h("div", { class: "iu__footer" }, items));
352
- }
353
- buildFileItem(item) {
354
- const fileName = item.name;
355
- const progress = Number(item["progress"]);
356
- const downloadURL = item["downloadURL"];
357
- const label = `${fileName} (${this.formatBytes(item.size)})`;
358
- return (h("div", { class: "iu__item", key: fileName, onClick: evt => evt.stopPropagation() }, h("div", { class: "iu__item-label modificador" }, h("div", { title: label, class: "col--stretch align--middle file__name text text--primary text--small text--ellipsis align--middle" }, downloadURL ? h("a", { href: downloadURL, download: true }, label) : label)), isNaN(progress)
359
- ?
360
- null
361
- :
362
- h("div", { class: "col col--sd-4 col--stretch align--middle" }, h("progress", { id: this.buildProgressId(item), value: progress, max: "100" })), this.enabled
363
- ?
364
- h("div", { class: "col col--stretch align--middle" }, h("button", { class: "btn-cancel ", onClick: () => this.removeFile(fileName) }))
365
- :
366
- null));
367
- }
368
- evalDisabledClass(regularClasses, disabledClass) {
369
- return this.enabled ? regularClasses : `${regularClasses} ${disabledClass}`;
370
- }
371
- get _host() { return getElement(this); }
372
- static get watchers() { return {
373
- "value": ["observeValue"],
374
- "requestHeaders": ["observeRequestHeaders"]
375
- }; }
376
- };
377
- EzUpload.style = ezUploadCss;
378
-
379
- export { EzUpload as ez_upload };