@sankhyalabs/ezui 1.2.0-beta.6 → 1.2.0-beta.8

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 (165) hide show
  1. package/dist/cjs/{ApplicationUtils-483c0a9e.js → ApplicationUtils-2ac1b73e.js} +2 -1
  2. package/dist/cjs/ApplicationUtils-475b50d9.js +63 -0
  3. package/dist/cjs/{CSSVarsUtils-09b431cc.js → CSSVarsUtils-af809e73.js} +17 -0
  4. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  5. package/dist/cjs/css-shim-3bfdba4f.js +6 -0
  6. package/dist/cjs/dom-8ac1ad03.js +75 -0
  7. package/dist/cjs/ez-actions-button.cjs.entry.js +8 -7
  8. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-button.cjs.entry.js +2 -2
  10. package/dist/cjs/ez-calendar.cjs.entry.js +4 -4
  11. package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-chip.cjs.entry.js +2 -2
  14. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-combo-box.cjs.entry.js +8 -7
  16. package/dist/cjs/ez-date-input.cjs.entry.js +7 -7
  17. package/dist/cjs/ez-date-time-input.cjs.entry.js +5 -5
  18. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-filter-input.cjs.entry.js +2 -2
  20. package/dist/cjs/ez-form.cjs.entry.js +460 -49
  21. package/dist/cjs/ez-grid-config.cjs.entry.js +5 -5
  22. package/dist/cjs/ez-grid.cjs.entry.js +1153 -989
  23. package/dist/cjs/ez-icon.cjs.entry.js +3 -3
  24. package/dist/cjs/ez-list.cjs.entry.js +3 -1
  25. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  26. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  27. package/dist/cjs/ez-number-input.cjs.entry.js +5 -5
  28. package/dist/cjs/ez-popover.cjs.entry.js +5 -5
  29. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  30. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  31. package/dist/cjs/ez-scroller.cjs.entry.js +2 -2
  32. package/dist/cjs/ez-search.cjs.entry.js +2 -2
  33. package/dist/cjs/ez-select-box.cjs.entry.js +1 -1
  34. package/dist/cjs/ez-tabselector.cjs.entry.js +2 -1
  35. package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
  36. package/dist/cjs/ez-text-input.cjs.entry.js +3 -3
  37. package/dist/cjs/ez-time-input.cjs.entry.js +8 -8
  38. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  39. package/dist/cjs/ez-upload.cjs.entry.js +2 -2
  40. package/dist/cjs/ez-view-stack.cjs.entry.js +2 -1
  41. package/dist/cjs/ezui.cjs.js +112 -4
  42. package/dist/cjs/index-2ec1da82.js +2307 -0
  43. package/dist/cjs/index-55178184.js +6 -0
  44. package/dist/cjs/index-d9c5cb88.js +3068 -0
  45. package/dist/cjs/loader.cjs.js +18 -2
  46. package/dist/cjs/shadow-css-41d9783d.js +390 -0
  47. package/dist/collection/collection-manifest.json +2 -2
  48. package/dist/collection/components/ez-button/ez-button.css +1 -0
  49. package/dist/collection/components/ez-chip/ez-chip.css +2 -1
  50. package/dist/collection/components/ez-scroller/ez-scroller.css +1 -0
  51. package/dist/collection/utils/ApplicationUtils.js +2 -1
  52. package/dist/collection/utils/CSSVarsUtils.js +17 -0
  53. package/dist/custom-elements/index.js +3864 -970
  54. package/dist/esm/ApplicationUtils-30a69eb0.js +61 -0
  55. package/dist/esm/{ApplicationUtils-5f87ae60.js → ApplicationUtils-a4a76132.js} +2 -1
  56. package/dist/esm/{CSSVarsUtils-499b75c2.js → CSSVarsUtils-00f67f32.js} +17 -0
  57. package/dist/esm/app-globals-0f993ce5.js +3 -0
  58. package/dist/esm/css-shim-20dbffa5.js +4 -0
  59. package/dist/esm/dom-c5ed0ba5.js +73 -0
  60. package/dist/esm/ez-actions-button.entry.js +5 -4
  61. package/dist/esm/ez-application.entry.js +1 -1
  62. package/dist/esm/ez-button.entry.js +2 -2
  63. package/dist/esm/ez-calendar.entry.js +2 -2
  64. package/dist/esm/ez-card-item.entry.js +1 -1
  65. package/dist/esm/ez-check.entry.js +1 -1
  66. package/dist/esm/ez-chip.entry.js +2 -2
  67. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  68. package/dist/esm/ez-combo-box.entry.js +5 -4
  69. package/dist/esm/ez-date-input.entry.js +3 -3
  70. package/dist/esm/ez-date-time-input.entry.js +3 -3
  71. package/dist/esm/ez-dialog.entry.js +1 -1
  72. package/dist/esm/ez-filter-input.entry.js +2 -2
  73. package/dist/esm/ez-form.entry.js +426 -15
  74. package/dist/esm/ez-grid-config.entry.js +3 -3
  75. package/dist/esm/ez-grid.entry.js +1119 -955
  76. package/dist/esm/ez-icon.entry.js +2 -2
  77. package/dist/esm/ez-list.entry.js +3 -1
  78. package/dist/esm/ez-loading-bar.entry.js +1 -1
  79. package/dist/esm/ez-modal.entry.js +1 -1
  80. package/dist/esm/ez-number-input.entry.js +3 -3
  81. package/dist/esm/ez-popover.entry.js +2 -2
  82. package/dist/esm/ez-popup.entry.js +1 -1
  83. package/dist/esm/ez-radio-button.entry.js +1 -1
  84. package/dist/esm/ez-scroller.entry.js +2 -2
  85. package/dist/esm/ez-search.entry.js +2 -2
  86. package/dist/esm/ez-select-box.entry.js +1 -1
  87. package/dist/esm/ez-tabselector.entry.js +2 -1
  88. package/dist/esm/ez-text-area.entry.js +1 -1
  89. package/dist/esm/ez-text-input.entry.js +2 -2
  90. package/dist/esm/ez-time-input.entry.js +3 -3
  91. package/dist/esm/ez-toast.entry.js +1 -1
  92. package/dist/esm/ez-upload.entry.js +2 -2
  93. package/dist/esm/ez-view-stack.entry.js +2 -1
  94. package/dist/esm/ezui.js +112 -4
  95. package/dist/esm/index-1e9d524f.js +3031 -0
  96. package/dist/esm/index-b96183c8.js +2295 -0
  97. package/dist/esm/index-f32470b5.js +3 -0
  98. package/dist/esm/loader.js +18 -2
  99. package/dist/esm/shadow-css-8c625855.js +388 -0
  100. package/dist/ezui/ApplicationUtils-30a69eb0.js +61 -0
  101. package/dist/ezui/CSSVarsUtils-00f67f32.js +70 -0
  102. package/dist/ezui/DialogType-72afa679.js +8 -0
  103. package/dist/ezui/app-globals-0f993ce5.js +3 -0
  104. package/dist/ezui/css-shim-20dbffa5.js +4 -0
  105. package/dist/ezui/dom-c5ed0ba5.js +73 -0
  106. package/dist/ezui/ez-actions-button.entry.js +98 -0
  107. package/dist/ezui/ez-application.entry.js +22 -0
  108. package/dist/ezui/ez-button.entry.js +73 -0
  109. package/dist/ezui/ez-calendar.entry.js +219 -0
  110. package/dist/ezui/ez-card-item.entry.js +40 -0
  111. package/dist/ezui/ez-check.entry.js +72 -0
  112. package/dist/ezui/ez-chip.entry.js +97 -0
  113. package/dist/ezui/ez-collapsible-box.entry.js +57 -0
  114. package/dist/ezui/ez-combo-box.entry.js +439 -0
  115. package/dist/ezui/ez-date-input.entry.js +159 -0
  116. package/dist/ezui/ez-date-time-input.entry.js +214 -0
  117. package/dist/ezui/ez-dialog.entry.js +108 -0
  118. package/dist/ezui/ez-filter-input.entry.js +75 -0
  119. package/dist/ezui/ez-form.entry.js +1395 -0
  120. package/dist/ezui/ez-grid-config.entry.js +433 -0
  121. package/dist/ezui/ez-grid.entry.js +115419 -0
  122. package/dist/ezui/ez-icon.entry.js +37 -0
  123. package/dist/ezui/ez-list.entry.js +516 -0
  124. package/dist/ezui/ez-loading-bar.entry.js +24 -0
  125. package/dist/ezui/ez-modal.entry.js +67 -0
  126. package/dist/ezui/ez-number-input.entry.js +148 -0
  127. package/dist/ezui/ez-popover.entry.js +141 -0
  128. package/dist/ezui/ez-popup.entry.js +49 -0
  129. package/dist/ezui/ez-radio-button.entry.js +45 -0
  130. package/dist/ezui/ez-scroller.entry.js +101 -0
  131. package/dist/ezui/ez-search.entry.js +83 -0
  132. package/dist/ezui/ez-select-box.entry.js +18 -0
  133. package/dist/ezui/ez-tabselector.entry.js +195 -0
  134. package/dist/ezui/ez-text-area.entry.js +158 -0
  135. package/dist/ezui/ez-text-input.entry.js +235 -0
  136. package/dist/ezui/ez-time-input.entry.js +164 -0
  137. package/dist/ezui/ez-toast.entry.js +84 -0
  138. package/dist/ezui/ez-upload.entry.js +379 -0
  139. package/dist/ezui/ez-view-stack.entry.js +74 -0
  140. package/dist/ezui/ezui.esm.js +125 -1
  141. package/dist/ezui/index-1e9d524f.js +3031 -0
  142. package/dist/ezui/index-b96183c8.js +2295 -0
  143. package/dist/ezui/index-f32470b5.js +3 -0
  144. package/dist/ezui/index.esm.js +1 -0
  145. package/dist/ezui/{p-3ffdde40.entry.js → p-2f02347d.entry.js} +1 -1
  146. package/dist/ezui/{p-768053d0.entry.js → p-43bb6a59.entry.js} +1 -1
  147. package/dist/ezui/p-4a5e37a7.js +1 -0
  148. package/dist/ezui/{p-72ab066f.entry.js → p-4eb273f8.entry.js} +1 -1
  149. package/dist/ezui/{p-a3ff4f0e.entry.js → p-544f0c63.entry.js} +1 -1
  150. package/dist/ezui/{p-03742d3e.entry.js → p-56688470.entry.js} +1 -1
  151. package/dist/ezui/{p-b901ba02.entry.js → p-5a1927a2.entry.js} +1 -1
  152. package/dist/ezui/{p-cf283c4a.entry.js → p-62110996.entry.js} +1 -1
  153. package/dist/ezui/{p-15d18ece.entry.js → p-744eb735.entry.js} +1 -1
  154. package/dist/ezui/{p-5c721278.entry.js → p-867aac16.entry.js} +1 -1
  155. package/dist/ezui/{p-3ae441ec.entry.js → p-9d5be6a7.entry.js} +1 -1
  156. package/dist/ezui/p-adbe4188.js +1 -0
  157. package/dist/ezui/{p-6cfe20a0.entry.js → p-af43be42.entry.js} +1 -1
  158. package/dist/ezui/{p-7fe1ac9a.entry.js → p-b7467ad6.entry.js} +1 -1
  159. package/dist/ezui/{p-b3e978aa.entry.js → p-c019e137.entry.js} +1 -1
  160. package/dist/ezui/{p-47e06040.entry.js → p-c9d2060e.entry.js} +1 -1
  161. package/dist/ezui/shadow-css-8c625855.js +388 -0
  162. package/dist/types/utils/CSSVarsUtils.d.ts +1 -0
  163. package/package.json +1 -1
  164. package/dist/ezui/p-3263a002.js +0 -1
  165. package/dist/ezui/p-898b9906.js +0 -1
@@ -0,0 +1,164 @@
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 };
@@ -0,0 +1,84 @@
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 };
@@ -0,0 +1,379 @@
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 };