@sankhyalabs/ezui 1.1.117 → 1.1.118

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.
@@ -26,10 +26,7 @@ class ApplicationUtils {
26
26
  toast = document.createElement("ez-toast");
27
27
  window.document.body.appendChild(toast);
28
28
  }
29
- toast.canClose = options.canClose;
30
- toast.message = message;
31
- toast.fadeTime = 4000;
32
- toast.show();
29
+ toast.show(message, 4000, false, options.canClose);
33
30
  }
34
31
  }
35
32
  ApplicationUtils.defaultMessageOptions = {
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-88286449.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const ApplicationUtils = require('./ApplicationUtils-c8f07135.js');
7
+ const ApplicationUtils = require('./ApplicationUtils-93721afc.js');
8
8
 
9
9
  const buildTextArea = ({ name, label, readOnly }) => {
10
10
  return (index.h("div", { class: "col col--sd-12 padding-horizontal--small", key: name },
@@ -4,11 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-88286449.js');
6
6
 
7
- 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--oppened{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}}";
7
+ 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}}";
8
8
 
9
9
  let EzToast = class {
10
10
  constructor(hostRef) {
11
11
  index.registerInstance(this, hostRef);
12
+ this._nextMessages = [];
13
+ this._currentMessageInfo = { message: "", fadeTime: undefined, useIcon: undefined };
14
+ this._toastOpenedClass = "toast__container--opened";
15
+ this._lastTimeOut = undefined;
12
16
  this._lang = "pt"; // Controla qual idioma será usado para definir a regras de hifenização.
13
17
  /**
14
18
  * Controla o tempo de exibição do componente em milissegundos.
@@ -26,18 +30,57 @@ let EzToast = class {
26
30
  /**
27
31
  * Exibe o componente na tela.
28
32
  */
29
- async show() {
30
- this.container.classList.add("toast__container--oppened");
33
+ async show(message, fadeTime, useIcon, canClose) {
34
+ return new Promise(resolve => {
35
+ var _a;
36
+ if ((_a = this.container) === null || _a === void 0 ? void 0 : _a.classList.contains(this._toastOpenedClass)) {
37
+ this._nextMessages.push({ message, fadeTime, useIcon, canClose, callBack: resolve });
38
+ }
39
+ else {
40
+ this._currentMessageInfo.message = message || this.message;
41
+ this._currentMessageInfo.fadeTime = fadeTime || this.fadeTime;
42
+ this._currentMessageInfo.useIcon = useIcon || this.useIcon;
43
+ this._currentMessageInfo.callBack = resolve;
44
+ if (canClose) {
45
+ this._currentMessageInfo.canClose = this.canClose;
46
+ }
47
+ index.forceUpdate(this);
48
+ this.displayToast();
49
+ this._lastTimeOut = setTimeout(() => {
50
+ this.hideToast();
51
+ }, this._currentMessageInfo.fadeTime + 400);
52
+ }
53
+ });
54
+ }
55
+ hideToast() {
56
+ this.makeToastInvisible();
57
+ if (this._nextMessages.length > 0) {
58
+ if (this._currentMessageInfo.callBack) {
59
+ this._currentMessageInfo.callBack(true);
60
+ }
61
+ setTimeout(() => {
62
+ let newMessageInfo = this._nextMessages.shift();
63
+ this.show(newMessageInfo.message, newMessageInfo.fadeTime, newMessageInfo.useIcon);
64
+ });
65
+ }
66
+ if (this._currentMessageInfo.callBack) {
67
+ this._currentMessageInfo.callBack(true);
68
+ }
69
+ }
70
+ makeToastInvisible() {
71
+ this.container.classList.remove(this._toastOpenedClass);
72
+ this.container.style.animation = `none`;
73
+ if (this._lastTimeOut)
74
+ clearTimeout(this._lastTimeOut);
75
+ }
76
+ displayToast() {
77
+ this.container.classList.add(this._toastOpenedClass);
31
78
  this.container.style.animation = `fadein 0.5s, fadeout 0.5s ${this.fadeTime / 1000}s`;
32
- setTimeout(() => {
33
- this.container.classList.remove("toast__container--oppened");
34
- this.container.style.animation = `none`;
35
- }, this.fadeTime + 400);
36
79
  }
37
80
  render() {
38
- return (index.h("div", { ref: (el) => this.container = el, class: "toast__container" }, this.useIcon &&
39
- index.h("slot", { name: "icon" }), index.h("div", { lang: this._lang, class: this.useIcon ? "message__container message__conteiner--icon" : "message__container", title: this.message, innerHTML: this.message }), this.canClose &&
40
- index.h("button", { class: "btn-close", onClick: () => { this.container.classList.remove("toast__container--oppened"); this.container.style.animation = `none`; } })));
81
+ return (index.h(index.Host, null, index.h("div", { ref: (el) => this.container = el, class: "toast__container" }, this._currentMessageInfo.useIcon &&
82
+ index.h("slot", { name: "icon" }), index.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 &&
83
+ index.h("button", { class: "btn-close", onClick: () => { this.hideToast(); } }))));
41
84
  }
42
85
  };
43
86
  EzToast.style = ezToastCss;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-88286449.js');
6
- const ApplicationUtils = require('./ApplicationUtils-c8f07135.js');
6
+ const ApplicationUtils = require('./ApplicationUtils-93721afc.js');
7
7
 
8
8
  class RemoteFile {
9
9
  constructor(file) {
@@ -73,7 +73,7 @@
73
73
  mask-image: var(--ez-toast__btn__close__image);
74
74
  }
75
75
 
76
- .toast__container--oppened {
76
+ .toast__container--opened {
77
77
  animation: fadein 0.5s, fadeout 0.5s 3s;
78
78
  visibility: visible;
79
79
  }
@@ -1,6 +1,10 @@
1
- import { Component, h, Prop, Method } from '@stencil/core';
1
+ import { Component, h, Method, Prop, Host, forceUpdate } from '@stencil/core';
2
2
  export class EzToast {
3
3
  constructor() {
4
+ this._nextMessages = [];
5
+ this._currentMessageInfo = { message: "", fadeTime: undefined, useIcon: undefined };
6
+ this._toastOpenedClass = "toast__container--opened";
7
+ this._lastTimeOut = undefined;
4
8
  this._lang = "pt"; // Controla qual idioma será usado para definir a regras de hifenização.
5
9
  /**
6
10
  * Controla o tempo de exibição do componente em milissegundos.
@@ -18,21 +22,61 @@ export class EzToast {
18
22
  /**
19
23
  * Exibe o componente na tela.
20
24
  */
21
- async show() {
22
- this.container.classList.add("toast__container--oppened");
25
+ async show(message, fadeTime, useIcon, canClose) {
26
+ return new Promise(resolve => {
27
+ var _a;
28
+ if ((_a = this.container) === null || _a === void 0 ? void 0 : _a.classList.contains(this._toastOpenedClass)) {
29
+ this._nextMessages.push({ message, fadeTime, useIcon, canClose, callBack: resolve });
30
+ }
31
+ else {
32
+ this._currentMessageInfo.message = message || this.message;
33
+ this._currentMessageInfo.fadeTime = fadeTime || this.fadeTime;
34
+ this._currentMessageInfo.useIcon = useIcon || this.useIcon;
35
+ this._currentMessageInfo.callBack = resolve;
36
+ if (canClose) {
37
+ this._currentMessageInfo.canClose = this.canClose;
38
+ }
39
+ forceUpdate(this);
40
+ this.displayToast();
41
+ this._lastTimeOut = setTimeout(() => {
42
+ this.hideToast();
43
+ }, this._currentMessageInfo.fadeTime + 400);
44
+ }
45
+ });
46
+ }
47
+ hideToast() {
48
+ this.makeToastInvisible();
49
+ if (this._nextMessages.length > 0) {
50
+ if (this._currentMessageInfo.callBack) {
51
+ this._currentMessageInfo.callBack(true);
52
+ }
53
+ setTimeout(() => {
54
+ let newMessageInfo = this._nextMessages.shift();
55
+ this.show(newMessageInfo.message, newMessageInfo.fadeTime, newMessageInfo.useIcon);
56
+ });
57
+ }
58
+ if (this._currentMessageInfo.callBack) {
59
+ this._currentMessageInfo.callBack(true);
60
+ }
61
+ }
62
+ makeToastInvisible() {
63
+ this.container.classList.remove(this._toastOpenedClass);
64
+ this.container.style.animation = `none`;
65
+ if (this._lastTimeOut)
66
+ clearTimeout(this._lastTimeOut);
67
+ }
68
+ displayToast() {
69
+ this.container.classList.add(this._toastOpenedClass);
23
70
  this.container.style.animation = `fadein 0.5s, fadeout 0.5s ${this.fadeTime / 1000}s`;
24
- setTimeout(() => {
25
- this.container.classList.remove("toast__container--oppened");
26
- this.container.style.animation = `none`;
27
- }, this.fadeTime + 400);
28
71
  }
29
72
  render() {
30
- return (h("div", { ref: (el) => this.container = el, class: "toast__container" },
31
- this.useIcon &&
32
- h("slot", { name: "icon" }),
33
- h("div", { lang: this._lang, class: this.useIcon ? "message__container message__conteiner--icon" : "message__container", title: this.message, innerHTML: this.message }),
34
- this.canClose &&
35
- h("button", { class: "btn-close", onClick: () => { this.container.classList.remove("toast__container--oppened"); this.container.style.animation = `none`; } })));
73
+ return (h(Host, null,
74
+ h("div", { ref: (el) => this.container = el, class: "toast__container" },
75
+ this._currentMessageInfo.useIcon &&
76
+ h("slot", { name: "icon" }),
77
+ h("div", { lang: this._lang, class: this._currentMessageInfo.useIcon ? "message__container message__conteiner--icon" : "message__container", title: this._currentMessageInfo.message, innerHTML: this._currentMessageInfo.message }),
78
+ this._currentMessageInfo.canClose &&
79
+ h("button", { class: "btn-close", onClick: () => { this.hideToast(); } }))));
36
80
  }
37
81
  static get is() { return "ez-toast"; }
38
82
  static get encapsulation() { return "shadow"; }
@@ -118,14 +162,26 @@ export class EzToast {
118
162
  static get methods() { return {
119
163
  "show": {
120
164
  "complexType": {
121
- "signature": "() => Promise<void>",
122
- "parameters": [],
165
+ "signature": "(message: string, fadeTime: number, useIcon: boolean, canClose?: boolean) => Promise<unknown>",
166
+ "parameters": [{
167
+ "tags": [],
168
+ "text": ""
169
+ }, {
170
+ "tags": [],
171
+ "text": ""
172
+ }, {
173
+ "tags": [],
174
+ "text": ""
175
+ }, {
176
+ "tags": [],
177
+ "text": ""
178
+ }],
123
179
  "references": {
124
180
  "Promise": {
125
181
  "location": "global"
126
182
  }
127
183
  },
128
- "return": "Promise<void>"
184
+ "return": "Promise<unknown>"
129
185
  },
130
186
  "docs": {
131
187
  "text": "Exibe o componente na tela.",
@@ -24,10 +24,7 @@ export default class ApplicationUtils {
24
24
  toast = document.createElement("ez-toast");
25
25
  window.document.body.appendChild(toast);
26
26
  }
27
- toast.canClose = options.canClose;
28
- toast.message = message;
29
- toast.fadeTime = 4000;
30
- toast.show();
27
+ toast.show(message, 4000, false, options.canClose);
31
28
  }
32
29
  }
33
30
  ApplicationUtils.defaultMessageOptions = {
@@ -1817,10 +1817,7 @@ class ApplicationUtils {
1817
1817
  toast = document.createElement("ez-toast");
1818
1818
  window.document.body.appendChild(toast);
1819
1819
  }
1820
- toast.canClose = options.canClose;
1821
- toast.message = message;
1822
- toast.fadeTime = 4000;
1823
- toast.show();
1820
+ toast.show(message, 4000, false, options.canClose);
1824
1821
  }
1825
1822
  }
1826
1823
  ApplicationUtils.defaultMessageOptions = {
@@ -114155,13 +114152,17 @@ let EzTimeInput$1 = class extends HTMLElement$1 {
114155
114152
  static get style() { return ezTimeInputCss; }
114156
114153
  };
114157
114154
 
114158
- 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--oppened{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}}";
114155
+ 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}}";
114159
114156
 
114160
114157
  let EzToast$1 = class extends HTMLElement$1 {
114161
114158
  constructor() {
114162
114159
  super();
114163
114160
  this.__registerHost();
114164
114161
  this.__attachShadow();
114162
+ this._nextMessages = [];
114163
+ this._currentMessageInfo = { message: "", fadeTime: undefined, useIcon: undefined };
114164
+ this._toastOpenedClass = "toast__container--opened";
114165
+ this._lastTimeOut = undefined;
114165
114166
  this._lang = "pt"; // Controla qual idioma será usado para definir a regras de hifenização.
114166
114167
  /**
114167
114168
  * Controla o tempo de exibição do componente em milissegundos.
@@ -114179,18 +114180,57 @@ let EzToast$1 = class extends HTMLElement$1 {
114179
114180
  /**
114180
114181
  * Exibe o componente na tela.
114181
114182
  */
114182
- async show() {
114183
- this.container.classList.add("toast__container--oppened");
114183
+ async show(message, fadeTime, useIcon, canClose) {
114184
+ return new Promise(resolve => {
114185
+ var _a;
114186
+ if ((_a = this.container) === null || _a === void 0 ? void 0 : _a.classList.contains(this._toastOpenedClass)) {
114187
+ this._nextMessages.push({ message, fadeTime, useIcon, canClose, callBack: resolve });
114188
+ }
114189
+ else {
114190
+ this._currentMessageInfo.message = message || this.message;
114191
+ this._currentMessageInfo.fadeTime = fadeTime || this.fadeTime;
114192
+ this._currentMessageInfo.useIcon = useIcon || this.useIcon;
114193
+ this._currentMessageInfo.callBack = resolve;
114194
+ if (canClose) {
114195
+ this._currentMessageInfo.canClose = this.canClose;
114196
+ }
114197
+ forceUpdate(this);
114198
+ this.displayToast();
114199
+ this._lastTimeOut = setTimeout(() => {
114200
+ this.hideToast();
114201
+ }, this._currentMessageInfo.fadeTime + 400);
114202
+ }
114203
+ });
114204
+ }
114205
+ hideToast() {
114206
+ this.makeToastInvisible();
114207
+ if (this._nextMessages.length > 0) {
114208
+ if (this._currentMessageInfo.callBack) {
114209
+ this._currentMessageInfo.callBack(true);
114210
+ }
114211
+ setTimeout(() => {
114212
+ let newMessageInfo = this._nextMessages.shift();
114213
+ this.show(newMessageInfo.message, newMessageInfo.fadeTime, newMessageInfo.useIcon);
114214
+ });
114215
+ }
114216
+ if (this._currentMessageInfo.callBack) {
114217
+ this._currentMessageInfo.callBack(true);
114218
+ }
114219
+ }
114220
+ makeToastInvisible() {
114221
+ this.container.classList.remove(this._toastOpenedClass);
114222
+ this.container.style.animation = `none`;
114223
+ if (this._lastTimeOut)
114224
+ clearTimeout(this._lastTimeOut);
114225
+ }
114226
+ displayToast() {
114227
+ this.container.classList.add(this._toastOpenedClass);
114184
114228
  this.container.style.animation = `fadein 0.5s, fadeout 0.5s ${this.fadeTime / 1000}s`;
114185
- setTimeout(() => {
114186
- this.container.classList.remove("toast__container--oppened");
114187
- this.container.style.animation = `none`;
114188
- }, this.fadeTime + 400);
114189
114229
  }
114190
114230
  render() {
114191
- return (h("div", { ref: (el) => this.container = el, class: "toast__container" }, this.useIcon &&
114192
- h("slot", { name: "icon" }), h("div", { lang: this._lang, class: this.useIcon ? "message__container message__conteiner--icon" : "message__container", title: this.message, innerHTML: this.message }), this.canClose &&
114193
- h("button", { class: "btn-close", onClick: () => { this.container.classList.remove("toast__container--oppened"); this.container.style.animation = `none`; } })));
114231
+ return (h(Host, null, h("div", { ref: (el) => this.container = el, class: "toast__container" }, this._currentMessageInfo.useIcon &&
114232
+ 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 &&
114233
+ h("button", { class: "btn-close", onClick: () => { this.hideToast(); } }))));
114194
114234
  }
114195
114235
  static get style() { return ezToastCss; }
114196
114236
  };
@@ -24,10 +24,7 @@ class ApplicationUtils {
24
24
  toast = document.createElement("ez-toast");
25
25
  window.document.body.appendChild(toast);
26
26
  }
27
- toast.canClose = options.canClose;
28
- toast.message = message;
29
- toast.fadeTime = 4000;
30
- toast.show();
27
+ toast.show(message, 4000, false, options.canClose);
31
28
  }
32
29
  }
33
30
  ApplicationUtils.defaultMessageOptions = {
@@ -1,6 +1,6 @@
1
1
  import { h, r as registerInstance, f as forceUpdate, H as Host, g as getElement } from './index-6b8bfbeb.js';
2
2
  import { UserInterface, ApplicationContext, Action, DataUnitAction, DataUnit } from '@sankhyalabs/core';
3
- import { A as ApplicationUtils } from './ApplicationUtils-36e38de9.js';
3
+ import { A as ApplicationUtils } from './ApplicationUtils-3ca0e68d.js';
4
4
 
5
5
  const buildTextArea = ({ name, label, readOnly }) => {
6
6
  return (h("div", { class: "col col--sd-12 padding-horizontal--small", key: name },
@@ -1,10 +1,14 @@
1
- import { r as registerInstance, h } from './index-6b8bfbeb.js';
1
+ import { r as registerInstance, f as forceUpdate, h, H as Host } from './index-6b8bfbeb.js';
2
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--oppened{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}}";
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
4
 
5
5
  let EzToast = class {
6
6
  constructor(hostRef) {
7
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;
8
12
  this._lang = "pt"; // Controla qual idioma será usado para definir a regras de hifenização.
9
13
  /**
10
14
  * Controla o tempo de exibição do componente em milissegundos.
@@ -22,18 +26,57 @@ let EzToast = class {
22
26
  /**
23
27
  * Exibe o componente na tela.
24
28
  */
25
- async show() {
26
- this.container.classList.add("toast__container--oppened");
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);
27
74
  this.container.style.animation = `fadein 0.5s, fadeout 0.5s ${this.fadeTime / 1000}s`;
28
- setTimeout(() => {
29
- this.container.classList.remove("toast__container--oppened");
30
- this.container.style.animation = `none`;
31
- }, this.fadeTime + 400);
32
75
  }
33
76
  render() {
34
- return (h("div", { ref: (el) => this.container = el, class: "toast__container" }, this.useIcon &&
35
- h("slot", { name: "icon" }), h("div", { lang: this._lang, class: this.useIcon ? "message__container message__conteiner--icon" : "message__container", title: this.message, innerHTML: this.message }), this.canClose &&
36
- h("button", { class: "btn-close", onClick: () => { this.container.classList.remove("toast__container--oppened"); this.container.style.animation = `none`; } })));
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(); } }))));
37
80
  }
38
81
  };
39
82
  EzToast.style = ezToastCss;
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, f as forceUpdate, h, g as getElement } from './index-6b8bfbeb.js';
2
- import { A as ApplicationUtils } from './ApplicationUtils-36e38de9.js';
2
+ import { A as ApplicationUtils } from './ApplicationUtils-3ca0e68d.js';
3
3
 
4
4
  class RemoteFile {
5
5
  constructor(file) {
@@ -1 +1 @@
1
- import{p as e,b as s}from"./p-89a57641.js";(()=>{const s=import.meta.url,o={};return""!==s&&(o.resourcesUrl=new URL(".",s).href),e(o)})().then((e=>s([["p-3cd17150",[[6,"ez-grid",{multipleSelection:[4,"multiple-selection"],pageSize:[2,"page-size"],serverUrl:[1,"server-url"],dataUnit:[16],_navigationHasPrevious:[32],_navigationHasNext:[32],_navigationFirstRow:[32],_navigationLastRow:[32],_navigationTotalRows:[32],_popUpVisible:[32],setColumnsDef:[64],addColumnMenuItem:[64],setColumnsState:[64],setData:[64],getSelection:[64],getColumnsState:[64],getColumns:[64]}]]],["p-24ff7d92",[[1,"ez-dialog",{confirm:[1028],critical:[1028],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],handleButtonClick:[64],show:[64]}]]],["p-01169201",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],loading:[516],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-b8678ee6",[[1,"ez-action-chip",{label:[513],enabled:[516]}]]],["p-95fc543c",[[0,"ez-application"]]],["p-542d3d29",[[1,"ez-label-chip",{label:[513],enabled:[516],removable:[516],value:[1540],setFocus:[64],setBlur:[64]}]]],["p-080045a0",[[1,"ez-popover",{autoClose:[516,"auto-close"],top:[1537],left:[1537],bottom:[1537],right:[1537],boxWidth:[513,"box-width"],opened:[1540],updatePosition:[64],show:[64],hide:[64]}]]],["p-502d7e0d",[[1,"ez-popup",{size:[1],opened:[1540],useHeader:[1540,"use-header"],ezTitle:[1,"ez-title"]}]]],["p-7247379d",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-363fc3af",[[2,"grid-config",{selectedTab:[1025,"selected-tab"],columns:[1040]}]]],["p-f78c7ec9",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-6f39077b",[[1,"ez-text-input",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],mask:[1],canShowError:[516,"can-show-error"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-8c447785",[[1,"ez-date-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-055f1b6a",[[1,"ez-date-time-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-83d5f1ca",[[1,"ez-search",{value:[1537],label:[1537],enabled:[1540],errorMessage:[1537,"error-message"],optionLoader:[16],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],suppressEmptyOption:[4,"suppress-empty-option"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-43feac7d",[[1,"ez-time-input",{label:[513],viewValue:[1537,"view-value"],value:[1026],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-8f2d46f8",[[1,"ez-number-input",{label:[1],value:[1538],enabled:[4],errorMessage:[1537,"error-message"],precision:[2],prettyPrecision:[2,"pretty-precision"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-a5f1f9c4",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],showHide:[64]}]]],["p-73d3f767",[[0,"test-du"]]],["p-31b0e21a",[[1,"select-box",{selectedOption:[1,"selected-option"]}]]],["p-c6f2aa6c",[[1,"ez-list",{dataSource:[1040],useGroups:[1540,"use-groups"],ezDraggable:[1028,"ez-draggable"],ezSelectable:[1028,"ez-selectable"],itemSlotBuilder:[1040],_listItems:[32],_listGroupItems:[32],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-2f14fe3d",[[1,"ez-text-area",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],rows:[1538],canShowError:[516,"can-show-error"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-f26f6d67",[[1,"ez-upload",{label:[1],enabled:[4],maxFileSize:[2,"max-file-size"],maxFiles:[2,"max-files"],requestHeaders:[8,"request-headers"],urlUpload:[1,"url-upload"],urlDelete:[1,"url-delete"],value:[1040],addFiles:[64],setFocus:[64],setBlur:[64]}]]],["p-c13353f1",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]}]]],["p-804c118a",[[1,"ez-calendar",{value:[1040],floating:[516],time:[516],showSeconds:[516,"show-seconds"],show:[64],fitVertical:[64],hide:[64]}]]],["p-f3f9c7e6",[[1,"ez-check",{label:[513],value:[1540],enabled:[516],mode:[513],getMode:[64],setFocus:[64]}]]],["p-97f77023",[[1,"ez-tabselector",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1]}]]],["p-d3d3e2ac",[[1,"ez-combo-box",{value:[1537],label:[513],enabled:[516],options:[1040],errorMessage:[1537,"error-message"],searchMode:[4,"search-mode"],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],optionLoader:[16],suppressEmptyOption:[4,"suppress-empty-option"],canShowError:[516,"can-show-error"],mode:[513],_preSelection:[32],_visibleOptions:[32],setFocus:[64],setBlur:[64]}]]],["p-59a8448a",[[1,"ez-icon",{size:[513],href:[513],iconName:[513,"icon-name"]}]]],["p-3602ab8c",[[0,"ez-form",{dataUnit:[1040],config:[16],submit:[64],cancel:[64],validate:[64]}]]]],e)));
1
+ import{p as e,b as s}from"./p-89a57641.js";(()=>{const s=import.meta.url,o={};return""!==s&&(o.resourcesUrl=new URL(".",s).href),e(o)})().then((e=>s([["p-3cd17150",[[6,"ez-grid",{multipleSelection:[4,"multiple-selection"],pageSize:[2,"page-size"],serverUrl:[1,"server-url"],dataUnit:[16],_navigationHasPrevious:[32],_navigationHasNext:[32],_navigationFirstRow:[32],_navigationLastRow:[32],_navigationTotalRows:[32],_popUpVisible:[32],setColumnsDef:[64],addColumnMenuItem:[64],setColumnsState:[64],setData:[64],getSelection:[64],getColumnsState:[64],getColumns:[64]}]]],["p-24ff7d92",[[1,"ez-dialog",{confirm:[1028],critical:[1028],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],handleButtonClick:[64],show:[64]}]]],["p-01169201",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],loading:[516],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-b8678ee6",[[1,"ez-action-chip",{label:[513],enabled:[516]}]]],["p-95fc543c",[[0,"ez-application"]]],["p-542d3d29",[[1,"ez-label-chip",{label:[513],enabled:[516],removable:[516],value:[1540],setFocus:[64],setBlur:[64]}]]],["p-080045a0",[[1,"ez-popover",{autoClose:[516,"auto-close"],top:[1537],left:[1537],bottom:[1537],right:[1537],boxWidth:[513,"box-width"],opened:[1540],updatePosition:[64],show:[64],hide:[64]}]]],["p-502d7e0d",[[1,"ez-popup",{size:[1],opened:[1540],useHeader:[1540,"use-header"],ezTitle:[1,"ez-title"]}]]],["p-25e050f5",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-363fc3af",[[2,"grid-config",{selectedTab:[1025,"selected-tab"],columns:[1040]}]]],["p-f78c7ec9",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-6f39077b",[[1,"ez-text-input",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],mask:[1],canShowError:[516,"can-show-error"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-8c447785",[[1,"ez-date-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-055f1b6a",[[1,"ez-date-time-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-83d5f1ca",[[1,"ez-search",{value:[1537],label:[1537],enabled:[1540],errorMessage:[1537,"error-message"],optionLoader:[16],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],suppressEmptyOption:[4,"suppress-empty-option"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-43feac7d",[[1,"ez-time-input",{label:[513],viewValue:[1537,"view-value"],value:[1026],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-8f2d46f8",[[1,"ez-number-input",{label:[1],value:[1538],enabled:[4],errorMessage:[1537,"error-message"],precision:[2],prettyPrecision:[2,"pretty-precision"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-a5f1f9c4",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],showHide:[64]}]]],["p-73d3f767",[[0,"test-du"]]],["p-31b0e21a",[[1,"select-box",{selectedOption:[1,"selected-option"]}]]],["p-c6f2aa6c",[[1,"ez-list",{dataSource:[1040],useGroups:[1540,"use-groups"],ezDraggable:[1028,"ez-draggable"],ezSelectable:[1028,"ez-selectable"],itemSlotBuilder:[1040],_listItems:[32],_listGroupItems:[32],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-2f14fe3d",[[1,"ez-text-area",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],rows:[1538],canShowError:[516,"can-show-error"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-126d33e2",[[1,"ez-upload",{label:[1],enabled:[4],maxFileSize:[2,"max-file-size"],maxFiles:[2,"max-files"],requestHeaders:[8,"request-headers"],urlUpload:[1,"url-upload"],urlDelete:[1,"url-delete"],value:[1040],addFiles:[64],setFocus:[64],setBlur:[64]}]]],["p-c13353f1",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]}]]],["p-804c118a",[[1,"ez-calendar",{value:[1040],floating:[516],time:[516],showSeconds:[516,"show-seconds"],show:[64],fitVertical:[64],hide:[64]}]]],["p-f3f9c7e6",[[1,"ez-check",{label:[513],value:[1540],enabled:[516],mode:[513],getMode:[64],setFocus:[64]}]]],["p-97f77023",[[1,"ez-tabselector",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1]}]]],["p-d3d3e2ac",[[1,"ez-combo-box",{value:[1537],label:[513],enabled:[516],options:[1040],errorMessage:[1537,"error-message"],searchMode:[4,"search-mode"],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],optionLoader:[16],suppressEmptyOption:[4,"suppress-empty-option"],canShowError:[516,"can-show-error"],mode:[513],_preSelection:[32],_visibleOptions:[32],setFocus:[64],setBlur:[64]}]]],["p-59a8448a",[[1,"ez-icon",{size:[513],href:[513],iconName:[513,"icon-name"]}]]],["p-1339fde7",[[0,"ez-form",{dataUnit:[1040],config:[16],submit:[64],cancel:[64],validate:[64]}]]]],e)));
@@ -1 +1 @@
1
- import{r as i,c as t,f as e,h as o,g as a}from"./p-89a57641.js";import{A as s}from"./p-62daf508.js";class d{constructor(i){this.file=i,this.size=i.size,this.name=i.name}abortUpload(){this._uploadingXhr&&(this._aborted=!0,this._uploadingXhr.abort(),this._uploadingXhr=void 0)}isUploading(){return void 0!==this._uploadingXhr}async upload(i,t,e){return new Promise(((o,a)=>{const s=new XMLHttpRequest;this._uploadingXhr=s,this._aborted=!1,this.progress=0,s.upload.onprogress=i=>{const t=i.loaded,o=i.total;this.progress=~~(t/o*100),e(this,t,o)},s.onreadystatechange=()=>{if(4==s.readyState){this._uploadingXhr=void 0;const i=s.status;this._aborted||(0===i?a("Servidor indisponível"):i>=500?a("Erro inesperado no servidor"):i>=400&&a("Operação não permitida"));const t=s.response;t&&o(JSON.parse(t))}},s.ontimeout=()=>{a("Tempo limite de transferência atingido.")};const d=new FormData;d.append("ARQUIVO",this.file,this.file.name),s.open("POST",i,!0),t&&t.forEach(((i,t)=>s.setRequestHeader(t,i))),s.send(d)}))}async delete(i,t,e){return new Promise(((o,a)=>{const s=new XMLHttpRequest;s.onreadystatechange=()=>{4==s.readyState&&(0===s.status?a("Servidor indisponível"):s.status>=500?a("Erro inesperado no servidor"):s.status>=400&&a("Operação não permitida"),o(!0))},s.ontimeout=()=>{a("Tempo limite de remoção atingido.")},s.open("DELETE",t,!0),e&&e.forEach(((i,t)=>s.setRequestHeader(t,i))),s.send(JSON.stringify(i))}))}}let r=class{constructor(e){i(this,e),this.ezChange=t(this,"ezChange",7),this._filePointers=new Map,this.enabled=!0}changeValue(i){i!==this._updatingValue&&(this._filePointers.forEach((i=>{this.isRemoteFile(i)&&i.abortUpload()})),this._filePointers=new Map,this.updateFilePointers()),this._updatingValue=void 0}updateFilePointers(){this.value&&this.value.forEach((i=>this._filePointers.set(i.name,i)))}normalizeRequestHeaders(){if(this._requestHeaders=new Map,"string"==typeof this.requestHeaders)try{this.requestHeaders=JSON.parse(this.requestHeaders)}catch(i){this.requestHeaders=void 0}for(var i in this.requestHeaders)this._requestHeaders.set(i,this.requestHeaders[i])}async addFiles(i){if(this.maxFiles>0){let t=this._filePointers.size;if(i.forEach((i=>{this._filePointers.has(i.name)||t++})),t>this.maxFiles)return void this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`)}Array.prototype.forEach.call(i,this.addFile.bind(this))}async setFocus(){this._fileInput.focus()}async setBlur(){this._fileInput.blur()}async addFile(i){const t=this._filePointers.get(i.name);t?s.confirm("Substituir arquivo",`Já existe um arquivo chamado "${i.name}". Deseja substituí-lo?`).then((e=>{e&&(this.isRemoteFile(t)&&t.abortUpload(),this.doAddFile(i))})):this.doAddFile(i)}async doAddFile(i){if(this.validateFile(i)){const t=new d(i);this._filePointers.set(i.name,t),t.upload(this.urlUpload,this._requestHeaders,(i=>this.updateFeedback(i))).then((i=>i.forEach((i=>this.finishUpload(i))))).catch((i=>this.showError(i))),e(this)}}finishUpload(i){this._filePointers.set(i.name,i),this.updateValue()}updateValue(){this._updatingValue=[],this._filePointers.forEach((i=>{this.isRemoteFile(i)||this._updatingValue.push(i)})),this.value=this._updatingValue,this.ezChange.emit(this.value)}buildProgressId(i){return`PROGRESS_${i.name.replace(/[^a-z0-9_]/gi,"_")}_${i.file.lastModified}`}updateFeedback(i){window.requestAnimationFrame((()=>{if(this._host){const t=this._host.shadowRoot.querySelector("#"+this.buildProgressId(i));t&&(t.value=i.progress)}}))}validateFile(i){return!this._filePointers.has(i.name)&&this.maxFiles>0&&this._filePointers.size>=this.maxFiles?(this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`),!1):0===i.size?(this.showError(`Erro de permissão: O arquivo "${i.name}" não pode ser enviado.`),!1):this.urlUpload?!(this.maxFileSize>=0&&i.size>this.maxFileSize&&(this.showError("O tamanho máximo dos arquivos é de "+this.formatBytes(this.maxFileSize)),1)):(this.showError("Endereço de upload não informado"),!1)}showError(i){s.alert("Enviando arquivo",i)}formatBytes(i,t=1){if(0===i)return"0 Bytes";const e=t<0?0:t,o=Math.floor(Math.log(i)/Math.log(1024));return parseFloat((i/Math.pow(1024,o)).toFixed(e))+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][o]}onFileInputChange(i){this.addFiles(Array.from(i.target.files)),this._fileInput.value=""}isRemoteFile(i){return"file"in i}removeFromList(i){this._filePointers.delete(i),this.updateValue()}removeFile(i){const t=this._filePointers.get(i);if(this.isRemoteFile(t))t.abortUpload(),this.removeFromList(i);else if(this.urlDelete){const e=new d(null);this._filePointers.set(t.name,e),e.delete(t,this.urlDelete,null).then((()=>this.removeFromList(i))).catch((i=>this.showError(i)))}else this.removeFromList(i)}openFilesDialog(){this.enabled&&this._fileInput.click()}componentDidLoad(){this.enabled&&this._dropZone&&window.FileList&&window.File&&(this._dropZone.addEventListener("dragover",(i=>{i.stopPropagation(),i.preventDefault(),i.dataTransfer.dropEffect="copy",this._dropZone.style.background="#c2dbff"})),this._dropZone.addEventListener("drop",(i=>{i.stopPropagation(),i.preventDefault(),this.addFiles(Array.from(i.dataTransfer.files)),this._dropZone.style.background=""})),this._dropZone.addEventListener("dragleave",(()=>{this._dropZone.style.background=""})))}componentWillRender(){this.value&&this._filePointers.size<this.value.length&&this.updateFilePointers()}render(){return o("div",{ref:i=>this._dropZone=i,class:this.evalDisabledClass("iu","background--disabled")},o("div",{class:"iu__container",onClick:()=>this.openFilesDialog()},o("div",{class:"iu_header"},this.label?o("label",{class:this.evalDisabledClass("iu__label","text--disabled"),title:this.label},this.label):null,o("div",{class:this.evalDisabledClass("iu__icon-label","mouse-pointer--disabled")},o("button",{class:"iu__file-icon",disabled:!this.enabled}),o("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()),o("input",{ref:i=>this._fileInput=i,onChange:i=>this.onFileInputChange(i),type:"file",multiple:!0,class:"appearanceNone"}))}buildFooter(){if(0===this._filePointers.size)return null;const i=[];return this._filePointers.forEach((t=>i.push(this.buildFileItem(t)))),o("div",{class:"iu__footer"},i)}buildFileItem(i){const t=i.name,e=Number(i.progress),a=i.downloadURL,s=`${t} (${this.formatBytes(i.size)})`;return o("div",{class:"iu__item",key:t,onClick:i=>i.stopPropagation()},o("div",{class:"iu__item-label modificador"},o("div",{title:s,class:"col--stretch align--middle file__name text text--primary text--small text--ellipsis align--middle"},a?o("a",{href:a,download:!0},s):s)),isNaN(e)?null:o("div",{class:"col col--sd-4 col--stretch align--middle"},o("progress",{id:this.buildProgressId(i),value:e,max:"100"})),this.enabled?o("div",{class:"col col--stretch align--middle"},o("button",{class:"btn-cancel ",onClick:()=>this.removeFile(t)})):null)}evalDisabledClass(i,t){return this.enabled?i:`${i} ${t}`}get _host(){return a(this)}static get watchers(){return{value:["changeValue"],requestHeaders:["normalizeRequestHeaders"]}}};r.style=':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;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%}}';export{r as ez_upload}
1
+ import{r as i,c as t,f as e,h as o,g as a}from"./p-89a57641.js";import{A as s}from"./p-3c71a597.js";class d{constructor(i){this.file=i,this.size=i.size,this.name=i.name}abortUpload(){this._uploadingXhr&&(this._aborted=!0,this._uploadingXhr.abort(),this._uploadingXhr=void 0)}isUploading(){return void 0!==this._uploadingXhr}async upload(i,t,e){return new Promise(((o,a)=>{const s=new XMLHttpRequest;this._uploadingXhr=s,this._aborted=!1,this.progress=0,s.upload.onprogress=i=>{const t=i.loaded,o=i.total;this.progress=~~(t/o*100),e(this,t,o)},s.onreadystatechange=()=>{if(4==s.readyState){this._uploadingXhr=void 0;const i=s.status;this._aborted||(0===i?a("Servidor indisponível"):i>=500?a("Erro inesperado no servidor"):i>=400&&a("Operação não permitida"));const t=s.response;t&&o(JSON.parse(t))}},s.ontimeout=()=>{a("Tempo limite de transferência atingido.")};const d=new FormData;d.append("ARQUIVO",this.file,this.file.name),s.open("POST",i,!0),t&&t.forEach(((i,t)=>s.setRequestHeader(t,i))),s.send(d)}))}async delete(i,t,e){return new Promise(((o,a)=>{const s=new XMLHttpRequest;s.onreadystatechange=()=>{4==s.readyState&&(0===s.status?a("Servidor indisponível"):s.status>=500?a("Erro inesperado no servidor"):s.status>=400&&a("Operação não permitida"),o(!0))},s.ontimeout=()=>{a("Tempo limite de remoção atingido.")},s.open("DELETE",t,!0),e&&e.forEach(((i,t)=>s.setRequestHeader(t,i))),s.send(JSON.stringify(i))}))}}let r=class{constructor(e){i(this,e),this.ezChange=t(this,"ezChange",7),this._filePointers=new Map,this.enabled=!0}changeValue(i){i!==this._updatingValue&&(this._filePointers.forEach((i=>{this.isRemoteFile(i)&&i.abortUpload()})),this._filePointers=new Map,this.updateFilePointers()),this._updatingValue=void 0}updateFilePointers(){this.value&&this.value.forEach((i=>this._filePointers.set(i.name,i)))}normalizeRequestHeaders(){if(this._requestHeaders=new Map,"string"==typeof this.requestHeaders)try{this.requestHeaders=JSON.parse(this.requestHeaders)}catch(i){this.requestHeaders=void 0}for(var i in this.requestHeaders)this._requestHeaders.set(i,this.requestHeaders[i])}async addFiles(i){if(this.maxFiles>0){let t=this._filePointers.size;if(i.forEach((i=>{this._filePointers.has(i.name)||t++})),t>this.maxFiles)return void this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`)}Array.prototype.forEach.call(i,this.addFile.bind(this))}async setFocus(){this._fileInput.focus()}async setBlur(){this._fileInput.blur()}async addFile(i){const t=this._filePointers.get(i.name);t?s.confirm("Substituir arquivo",`Já existe um arquivo chamado "${i.name}". Deseja substituí-lo?`).then((e=>{e&&(this.isRemoteFile(t)&&t.abortUpload(),this.doAddFile(i))})):this.doAddFile(i)}async doAddFile(i){if(this.validateFile(i)){const t=new d(i);this._filePointers.set(i.name,t),t.upload(this.urlUpload,this._requestHeaders,(i=>this.updateFeedback(i))).then((i=>i.forEach((i=>this.finishUpload(i))))).catch((i=>this.showError(i))),e(this)}}finishUpload(i){this._filePointers.set(i.name,i),this.updateValue()}updateValue(){this._updatingValue=[],this._filePointers.forEach((i=>{this.isRemoteFile(i)||this._updatingValue.push(i)})),this.value=this._updatingValue,this.ezChange.emit(this.value)}buildProgressId(i){return`PROGRESS_${i.name.replace(/[^a-z0-9_]/gi,"_")}_${i.file.lastModified}`}updateFeedback(i){window.requestAnimationFrame((()=>{if(this._host){const t=this._host.shadowRoot.querySelector("#"+this.buildProgressId(i));t&&(t.value=i.progress)}}))}validateFile(i){return!this._filePointers.has(i.name)&&this.maxFiles>0&&this._filePointers.size>=this.maxFiles?(this.showError(`A quantidade máxima de arquivos é ${this.maxFiles}.`),!1):0===i.size?(this.showError(`Erro de permissão: O arquivo "${i.name}" não pode ser enviado.`),!1):this.urlUpload?!(this.maxFileSize>=0&&i.size>this.maxFileSize&&(this.showError("O tamanho máximo dos arquivos é de "+this.formatBytes(this.maxFileSize)),1)):(this.showError("Endereço de upload não informado"),!1)}showError(i){s.alert("Enviando arquivo",i)}formatBytes(i,t=1){if(0===i)return"0 Bytes";const e=t<0?0:t,o=Math.floor(Math.log(i)/Math.log(1024));return parseFloat((i/Math.pow(1024,o)).toFixed(e))+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][o]}onFileInputChange(i){this.addFiles(Array.from(i.target.files)),this._fileInput.value=""}isRemoteFile(i){return"file"in i}removeFromList(i){this._filePointers.delete(i),this.updateValue()}removeFile(i){const t=this._filePointers.get(i);if(this.isRemoteFile(t))t.abortUpload(),this.removeFromList(i);else if(this.urlDelete){const e=new d(null);this._filePointers.set(t.name,e),e.delete(t,this.urlDelete,null).then((()=>this.removeFromList(i))).catch((i=>this.showError(i)))}else this.removeFromList(i)}openFilesDialog(){this.enabled&&this._fileInput.click()}componentDidLoad(){this.enabled&&this._dropZone&&window.FileList&&window.File&&(this._dropZone.addEventListener("dragover",(i=>{i.stopPropagation(),i.preventDefault(),i.dataTransfer.dropEffect="copy",this._dropZone.style.background="#c2dbff"})),this._dropZone.addEventListener("drop",(i=>{i.stopPropagation(),i.preventDefault(),this.addFiles(Array.from(i.dataTransfer.files)),this._dropZone.style.background=""})),this._dropZone.addEventListener("dragleave",(()=>{this._dropZone.style.background=""})))}componentWillRender(){this.value&&this._filePointers.size<this.value.length&&this.updateFilePointers()}render(){return o("div",{ref:i=>this._dropZone=i,class:this.evalDisabledClass("iu","background--disabled")},o("div",{class:"iu__container",onClick:()=>this.openFilesDialog()},o("div",{class:"iu_header"},this.label?o("label",{class:this.evalDisabledClass("iu__label","text--disabled"),title:this.label},this.label):null,o("div",{class:this.evalDisabledClass("iu__icon-label","mouse-pointer--disabled")},o("button",{class:"iu__file-icon",disabled:!this.enabled}),o("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()),o("input",{ref:i=>this._fileInput=i,onChange:i=>this.onFileInputChange(i),type:"file",multiple:!0,class:"appearanceNone"}))}buildFooter(){if(0===this._filePointers.size)return null;const i=[];return this._filePointers.forEach((t=>i.push(this.buildFileItem(t)))),o("div",{class:"iu__footer"},i)}buildFileItem(i){const t=i.name,e=Number(i.progress),a=i.downloadURL,s=`${t} (${this.formatBytes(i.size)})`;return o("div",{class:"iu__item",key:t,onClick:i=>i.stopPropagation()},o("div",{class:"iu__item-label modificador"},o("div",{title:s,class:"col--stretch align--middle file__name text text--primary text--small text--ellipsis align--middle"},a?o("a",{href:a,download:!0},s):s)),isNaN(e)?null:o("div",{class:"col col--sd-4 col--stretch align--middle"},o("progress",{id:this.buildProgressId(i),value:e,max:"100"})),this.enabled?o("div",{class:"col col--stretch align--middle"},o("button",{class:"btn-cancel ",onClick:()=>this.removeFile(t)})):null)}evalDisabledClass(i,t){return this.enabled?i:`${i} ${t}`}get _host(){return a(this)}static get watchers(){return{value:["changeValue"],requestHeaders:["normalizeRequestHeaders"]}}};r.style=':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;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%}}';export{r as ez_upload}
@@ -1 +1 @@
1
- import{h as e,r as t,f as n,H as r,g as i}from"./p-89a57641.js";import{UserInterface as o,ApplicationContext as a,Action as l,DataUnitAction as s,DataUnit as c}from"@sankhyalabs/core";import{A as d}from"./p-62daf508.js";const u=({name:t,label:n})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-text-input",{label:n,"data-field-name":t,key:t}));function h(t,n,r,i=!1){return e("div",{class:"col col--sd-12 col--tb-3 align--middle padding-horizontal--small padding-bottom--large"},e("ez-check",{enabled:!r,label:n,mode:i?"switch":"regular","data-field-name":t,key:t}))}function f(t,n,r,i,o){return e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-number-input",{enabled:!r,label:n,precision:i,prettyPrecision:o,"data-field-name":t,key:t}))}const b=new Map;b.set(o.LONGTEXT,(({name:t,label:n,readOnly:r})=>e("div",{class:"col col--sd-12 padding-horizontal--small",key:t},e("ez-text-area",{enabled:!r,label:n,"data-field-name":t})))),b.set(o.CHECKBOX,(e=>h(e.name,e.label,e.readOnly,!1))),b.set(o.SWITCH,(e=>h(e.name,e.label,e.readOnly,!0))),b.set(o.OPTIONSELECTOR,(({name:t,label:n,readOnly:r,required:i},o)=>{const a=null==o?void 0:o.options;let l;if("string"==typeof a){const e=JSON.parse(a);l=Object.keys(e).map((t=>({value:t,label:e[t]})))}else l=a;return e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-combo-box",{enabled:!r,suppressEmptyOption:i,label:n,"data-field-name":t,key:t,options:l}))})),b.set(o.SEARCH,(({name:t,label:n,readOnly:r,required:i})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-search",{enabled:!r,suppressEmptyOption:i,label:n,"data-field-name":t,key:t})))),b.set(o.FILE,(({name:t,label:n,readOnly:r})=>e("div",{class:"col col--sd-12 padding-horizontal--small"},e("ez-upload",{enabled:!r,label:n,urlUpload:"",requestHeaders:"",maxFiles:10,"data-field-name":t,key:t})))),b.set(o.DATE,(({name:t,label:n,readOnly:r})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-date-input",{enabled:!r,label:n,"data-field-name":t,key:t})))),b.set(o.TIME,(({name:t,label:n})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-time-input",{label:n,"data-field-name":t,key:t})))),b.set(o.DATETIME,(({name:t,label:n})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-date-time-input",{label:n,"data-field-name":t,key:t})))),b.set(o.DECIMALNUMBER,(({name:e,label:t,readOnly:n},r)=>{const i=Number((null==r?void 0:r.precision)||2);return f(e,t,n,i,Number((null==r?void 0:r.prettyPrecision)||i))})),b.set(o.INTEGERNUMBER,(({name:e,label:t,readOnly:n})=>f(e,t,n,0,0)));const p=e=>{const t=e.descriptor,n=Object.assign({},e.config);let r,i;return t&&(n.label||(n.label=t.label),n.name||(n.name=t.name),void 0===n.required&&(n.required=t.required),void 0===n.readOnly&&(n.readOnly=t.readOnly),i=t.properties,r=b.get(t.userInterface)),n.required&&(n.label=`* ${n.label} (obrigatório)`),r||(r=u),r(n,i)},m=({source:t})=>"items"in t?e("ez-collapsible-box",{label:t.label},t.items.map((e=>p(e)))):p(t),v=({store:t,source:n})=>e("div",{class:"box__container"},e("div",{class:"row padding-vertical--small"},n.items.map((n=>e(m,{store:t,source:n})))));class y{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[]}getSheet(e){return this._sheets.get(e)}getAllSheets(){return this._sheets}addSheet(e){this._sheets.set(e.name,e),this._requiredFields=this._requiredFields.concat(e.requiredFields),this._cleanOnCopyFields=this._cleanOnCopyFields.concat(e.cleanOnCopyFields)}getRequiredFields(){return this._requiredFields}getCleanOnCopyFields(){return this._cleanOnCopyFields}}function w(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var g="function"==typeof Symbol&&Symbol.observable||"@@observable",O=function(){return Math.random().toString(36).substring(7).split("").join(".")},E={INIT:"@@redux/INIT"+O(),REPLACE:"@@redux/REPLACE"+O(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+O()}};function z(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function A(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(w(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(w(1));return n(A)(e,t)}if("function"!=typeof e)throw new Error(w(2));var i=e,o=t,a=[],l=a,s=!1;function c(){l===a&&(l=a.slice())}function d(){if(s)throw new Error(w(3));return o}function u(e){if("function"!=typeof e)throw new Error(w(4));if(s)throw new Error(w(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(w(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),a=null}}}function h(e){if(!z(e))throw new Error(w(7));if(void 0===e.type)throw new Error(w(8));if(s)throw new Error(w(9));try{s=!0,o=i(o,e)}finally{s=!1}for(var t=a=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(w(10));i=e,h({type:E.REPLACE})}function b(){var e,t=u;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(w(11));function n(){e.next&&e.next(d())}return n(),{unsubscribe:t(n)}}})[g]=function(){return this},e}return h({type:E.INIT}),(r={dispatch:h,subscribe:u,getState:d,replaceReducer:f})[g]=b,r}const _={};function C(e=_,t){switch(t.type){case N.METADATA_LOADED:return Object.assign(Object.assign({},e),{formMetadata:t.payload});case N.CHANGE_TAB:return Object.assign(Object.assign({},e),{currentSheet:t.payload});default:return e}}function j(e){return e.formMetadata}var N;!function(e){e.METADATA_LOADED="FORM/METADATA_LOADED",e.CHANGE_TAB="FORM/CHANGE_TAB"}(N||(N={}));class x{constructor(e){this._fields=new Map,this._dataUnit=e,this._dataUnit.subscribe((()=>{var e;null===(e=this._fields)||void 0===e||e.forEach((e=>{this.updateValue(e.fieldName,e.field)}))}))}bind(e){e.forEach((e=>{const t=e.dataset.fieldName;this.updateBind(t,e),this.updateValue(t,e)}))}updateValue(e,t){t.value=this._dataUnit.getFieldValue(e)}updateBind(e,t){const n=this._fields.get(e);n&&n.destroy(),this._fields.set(e,R.create(e,t,((e,t)=>this.setFieldValue(e,t)))),this.bindSearchOptionsLoader(e,t)}setFieldValue(e,t){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.setFieldValue(e,t)}bindSearchOptionsLoader(e,t){if("EZ-SEARCH"===t.nodeName&&void 0===t.optionLoader){const n=a.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");n&&(t.optionLoader=t=>n(t,e,this._dataUnit))}}}class R{destroy(){this.field.removeEventListener(this.eventName,this.eventListener)}static create(e,t,n){const r=new R;return r.fieldName=e,r.field=t,r.eventListener=t=>{n(e,t.detail)},r.eventName="ezChange",r.field.addEventListener(r.eventName,r.eventListener),r}}let k=class{constructor(e){t(this,e)}submit(){return Promise.resolve()}cancel(){return Promise.resolve()}validate(){return new Promise(((e,t)=>{const n=j(this._store.getState()),r=this._staticFields.filter((e=>e.dataset.required)).map((e=>e.dataset.fieldName)).concat(n.getRequiredFields()),i=this.dataUnit.records;for(let e=0;e<i.length;e++)if(!this.validateRequired(r,i[e])){t();break}e()}))}configChanged(){this.processMetadata()}validateRequired(e,t){const n=[];e.forEach((e=>{const r=t[e],i=this._element.querySelector(`[data-field-name=${e}]`);null==r||""===r?(n.push(e),i.errorMessage="Essa informação é obrigatória"):i.errorMessage=""}));const r=0===n.length;return r||d.info("Há pelo menos um campo obrigatório não preenchido."),r}getDynamicContent(){var t;const n=j(this._store.getState());if(!n)return null;const r=(i=null===(t=this._store)||void 0===t?void 0:t.getState()).currentSheet?i.formMetadata.getSheet(i.currentSheet):Array.from(i.formMetadata.getAllSheets().values())[0];var i;if(!r)return null;const o=Array.from(n.getAllSheets().values()),a=[];return o.length>1&&a.push(e("ez-tabselector",{onEzChange:e=>this._store.dispatch(function(e){return{type:N.CHANGE_TAB,payload:e.tabKey}}(e.detail)),selectedTab:r.name},o.map((t=>e("ez-tab",{tabKey:t.name,label:t.label}))))),a.push(e(v,{store:this._store,source:r})),a}processMetadata(){if(!this.isStatic()){const e=this.config&&this.config.length>0?((e,t)=>{const n=new Map,r=[],i=[];e.forEach((e=>{var o;if(!1!==e.visible){const a=function(e,t){return("string"==typeof e?Array.from(t.keys()).find((t=>t.label===e)):e)||{label:e,visible:!0}}(e.tab||"Geral",n),l=t.getField(e.name);if(l&&a.visible){n.has(a)||n.set(a,new Map);const t=n.get(a);(void 0===e.required?l.required:e.required)&&r.push(e.name),(void 0===e.cleanOnCopy?null===(o=l.properties)||void 0===o?void 0:o.cleanOnCopy:e.cleanOnCopy)&&i.push(e.name);const s={config:e,descriptor:l},c=e.group;if(c){const e=`group::${c}`;t.has(e)?t.get(e).items.push(s):t.set(e,{label:c,items:[s]})}else t.set(e.name,s)}}}));const o=new y;return Array.from(n.entries()).sort(((e,t)=>(e[0].order||1e4)-(t[0].order||1e4))).forEach((([e,t])=>{o.addSheet({label:e.label,name:e.label,items:Array.from(t.values()),requiredFields:r,cleanOnCopyFields:i})})),o})(this.config,this.dataUnit):(()=>{var e;const t=this.dataUnit.metadata,n=new y;if(t){const r=null===(e=t.fields)||void 0===e?void 0:e.filter((e=>!1!==e.visible));n.addSheet({label:t.label,name:t.name,items:r.map((e=>({descriptor:e}))),requiredFields:r.filter((e=>e.required)).map((e=>e.name)),cleanOnCopyFields:r.filter((e=>{var t;return null===(t=e.properties)||void 0===t?void 0:t.cleanOnCopy})).map((e=>e.name))})}return n})();this._store.dispatch({type:N.METADATA_LOADED,payload:e})}}isStatic(){var e;return(null===(e=this._staticFields)||void 0===e?void 0:e.length)>0}interceptAction(e){if(e.type===l.RECORDS_COPIED){const t=j(this._store.getState()).getCleanOnCopyFields();if(t)return new s(l.RECORDS_COPIED,e.payload.map((e=>{const n=Object.assign({},e);return t.forEach((e=>delete n[e])),n})))}return e}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new c("ez-form")),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe((e=>{e.type===l.METADATA_LOADED&&this.processMetadata()})),this._dataBinder=new x(this.dataUnit),this._store=A(C),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata()}componentDidRender(){this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")))}render(){return e(r,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return i(this)}static get watchers(){return{config:["configChanged"]}}};k.style="ez-form{display:flex;flex-direction:column;width:100%}";export{k as ez_form}
1
+ import{h as e,r as t,f as n,H as r,g as i}from"./p-89a57641.js";import{UserInterface as o,ApplicationContext as a,Action as l,DataUnitAction as s,DataUnit as c}from"@sankhyalabs/core";import{A as d}from"./p-3c71a597.js";const u=({name:t,label:n})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-text-input",{label:n,"data-field-name":t,key:t}));function h(t,n,r,i=!1){return e("div",{class:"col col--sd-12 col--tb-3 align--middle padding-horizontal--small padding-bottom--large"},e("ez-check",{enabled:!r,label:n,mode:i?"switch":"regular","data-field-name":t,key:t}))}function f(t,n,r,i,o){return e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-number-input",{enabled:!r,label:n,precision:i,prettyPrecision:o,"data-field-name":t,key:t}))}const b=new Map;b.set(o.LONGTEXT,(({name:t,label:n,readOnly:r})=>e("div",{class:"col col--sd-12 padding-horizontal--small",key:t},e("ez-text-area",{enabled:!r,label:n,"data-field-name":t})))),b.set(o.CHECKBOX,(e=>h(e.name,e.label,e.readOnly,!1))),b.set(o.SWITCH,(e=>h(e.name,e.label,e.readOnly,!0))),b.set(o.OPTIONSELECTOR,(({name:t,label:n,readOnly:r,required:i},o)=>{const a=null==o?void 0:o.options;let l;if("string"==typeof a){const e=JSON.parse(a);l=Object.keys(e).map((t=>({value:t,label:e[t]})))}else l=a;return e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-combo-box",{enabled:!r,suppressEmptyOption:i,label:n,"data-field-name":t,key:t,options:l}))})),b.set(o.SEARCH,(({name:t,label:n,readOnly:r,required:i})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-search",{enabled:!r,suppressEmptyOption:i,label:n,"data-field-name":t,key:t})))),b.set(o.FILE,(({name:t,label:n,readOnly:r})=>e("div",{class:"col col--sd-12 padding-horizontal--small"},e("ez-upload",{enabled:!r,label:n,urlUpload:"",requestHeaders:"",maxFiles:10,"data-field-name":t,key:t})))),b.set(o.DATE,(({name:t,label:n,readOnly:r})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-date-input",{enabled:!r,label:n,"data-field-name":t,key:t})))),b.set(o.TIME,(({name:t,label:n})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-time-input",{label:n,"data-field-name":t,key:t})))),b.set(o.DATETIME,(({name:t,label:n})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-date-time-input",{label:n,"data-field-name":t,key:t})))),b.set(o.DECIMALNUMBER,(({name:e,label:t,readOnly:n},r)=>{const i=Number((null==r?void 0:r.precision)||2);return f(e,t,n,i,Number((null==r?void 0:r.prettyPrecision)||i))})),b.set(o.INTEGERNUMBER,(({name:e,label:t,readOnly:n})=>f(e,t,n,0,0)));const p=e=>{const t=e.descriptor,n=Object.assign({},e.config);let r,i;return t&&(n.label||(n.label=t.label),n.name||(n.name=t.name),void 0===n.required&&(n.required=t.required),void 0===n.readOnly&&(n.readOnly=t.readOnly),i=t.properties,r=b.get(t.userInterface)),n.required&&(n.label=`* ${n.label} (obrigatório)`),r||(r=u),r(n,i)},m=({source:t})=>"items"in t?e("ez-collapsible-box",{label:t.label},t.items.map((e=>p(e)))):p(t),v=({store:t,source:n})=>e("div",{class:"box__container"},e("div",{class:"row padding-vertical--small"},n.items.map((n=>e(m,{store:t,source:n})))));class y{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[]}getSheet(e){return this._sheets.get(e)}getAllSheets(){return this._sheets}addSheet(e){this._sheets.set(e.name,e),this._requiredFields=this._requiredFields.concat(e.requiredFields),this._cleanOnCopyFields=this._cleanOnCopyFields.concat(e.cleanOnCopyFields)}getRequiredFields(){return this._requiredFields}getCleanOnCopyFields(){return this._cleanOnCopyFields}}function w(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var g="function"==typeof Symbol&&Symbol.observable||"@@observable",O=function(){return Math.random().toString(36).substring(7).split("").join(".")},E={INIT:"@@redux/INIT"+O(),REPLACE:"@@redux/REPLACE"+O(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+O()}};function z(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function A(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(w(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(w(1));return n(A)(e,t)}if("function"!=typeof e)throw new Error(w(2));var i=e,o=t,a=[],l=a,s=!1;function c(){l===a&&(l=a.slice())}function d(){if(s)throw new Error(w(3));return o}function u(e){if("function"!=typeof e)throw new Error(w(4));if(s)throw new Error(w(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(w(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),a=null}}}function h(e){if(!z(e))throw new Error(w(7));if(void 0===e.type)throw new Error(w(8));if(s)throw new Error(w(9));try{s=!0,o=i(o,e)}finally{s=!1}for(var t=a=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(w(10));i=e,h({type:E.REPLACE})}function b(){var e,t=u;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(w(11));function n(){e.next&&e.next(d())}return n(),{unsubscribe:t(n)}}})[g]=function(){return this},e}return h({type:E.INIT}),(r={dispatch:h,subscribe:u,getState:d,replaceReducer:f})[g]=b,r}const _={};function C(e=_,t){switch(t.type){case N.METADATA_LOADED:return Object.assign(Object.assign({},e),{formMetadata:t.payload});case N.CHANGE_TAB:return Object.assign(Object.assign({},e),{currentSheet:t.payload});default:return e}}function j(e){return e.formMetadata}var N;!function(e){e.METADATA_LOADED="FORM/METADATA_LOADED",e.CHANGE_TAB="FORM/CHANGE_TAB"}(N||(N={}));class x{constructor(e){this._fields=new Map,this._dataUnit=e,this._dataUnit.subscribe((()=>{var e;null===(e=this._fields)||void 0===e||e.forEach((e=>{this.updateValue(e.fieldName,e.field)}))}))}bind(e){e.forEach((e=>{const t=e.dataset.fieldName;this.updateBind(t,e),this.updateValue(t,e)}))}updateValue(e,t){t.value=this._dataUnit.getFieldValue(e)}updateBind(e,t){const n=this._fields.get(e);n&&n.destroy(),this._fields.set(e,R.create(e,t,((e,t)=>this.setFieldValue(e,t)))),this.bindSearchOptionsLoader(e,t)}setFieldValue(e,t){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.setFieldValue(e,t)}bindSearchOptionsLoader(e,t){if("EZ-SEARCH"===t.nodeName&&void 0===t.optionLoader){const n=a.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");n&&(t.optionLoader=t=>n(t,e,this._dataUnit))}}}class R{destroy(){this.field.removeEventListener(this.eventName,this.eventListener)}static create(e,t,n){const r=new R;return r.fieldName=e,r.field=t,r.eventListener=t=>{n(e,t.detail)},r.eventName="ezChange",r.field.addEventListener(r.eventName,r.eventListener),r}}let k=class{constructor(e){t(this,e)}submit(){return Promise.resolve()}cancel(){return Promise.resolve()}validate(){return new Promise(((e,t)=>{const n=j(this._store.getState()),r=this._staticFields.filter((e=>e.dataset.required)).map((e=>e.dataset.fieldName)).concat(n.getRequiredFields()),i=this.dataUnit.records;for(let e=0;e<i.length;e++)if(!this.validateRequired(r,i[e])){t();break}e()}))}configChanged(){this.processMetadata()}validateRequired(e,t){const n=[];e.forEach((e=>{const r=t[e],i=this._element.querySelector(`[data-field-name=${e}]`);null==r||""===r?(n.push(e),i.errorMessage="Essa informação é obrigatória"):i.errorMessage=""}));const r=0===n.length;return r||d.info("Há pelo menos um campo obrigatório não preenchido."),r}getDynamicContent(){var t;const n=j(this._store.getState());if(!n)return null;const r=(i=null===(t=this._store)||void 0===t?void 0:t.getState()).currentSheet?i.formMetadata.getSheet(i.currentSheet):Array.from(i.formMetadata.getAllSheets().values())[0];var i;if(!r)return null;const o=Array.from(n.getAllSheets().values()),a=[];return o.length>1&&a.push(e("ez-tabselector",{onEzChange:e=>this._store.dispatch(function(e){return{type:N.CHANGE_TAB,payload:e.tabKey}}(e.detail)),selectedTab:r.name},o.map((t=>e("ez-tab",{tabKey:t.name,label:t.label}))))),a.push(e(v,{store:this._store,source:r})),a}processMetadata(){if(!this.isStatic()){const e=this.config&&this.config.length>0?((e,t)=>{const n=new Map,r=[],i=[];e.forEach((e=>{var o;if(!1!==e.visible){const a=function(e,t){return("string"==typeof e?Array.from(t.keys()).find((t=>t.label===e)):e)||{label:e,visible:!0}}(e.tab||"Geral",n),l=t.getField(e.name);if(l&&a.visible){n.has(a)||n.set(a,new Map);const t=n.get(a);(void 0===e.required?l.required:e.required)&&r.push(e.name),(void 0===e.cleanOnCopy?null===(o=l.properties)||void 0===o?void 0:o.cleanOnCopy:e.cleanOnCopy)&&i.push(e.name);const s={config:e,descriptor:l},c=e.group;if(c){const e=`group::${c}`;t.has(e)?t.get(e).items.push(s):t.set(e,{label:c,items:[s]})}else t.set(e.name,s)}}}));const o=new y;return Array.from(n.entries()).sort(((e,t)=>(e[0].order||1e4)-(t[0].order||1e4))).forEach((([e,t])=>{o.addSheet({label:e.label,name:e.label,items:Array.from(t.values()),requiredFields:r,cleanOnCopyFields:i})})),o})(this.config,this.dataUnit):(()=>{var e;const t=this.dataUnit.metadata,n=new y;if(t){const r=null===(e=t.fields)||void 0===e?void 0:e.filter((e=>!1!==e.visible));n.addSheet({label:t.label,name:t.name,items:r.map((e=>({descriptor:e}))),requiredFields:r.filter((e=>e.required)).map((e=>e.name)),cleanOnCopyFields:r.filter((e=>{var t;return null===(t=e.properties)||void 0===t?void 0:t.cleanOnCopy})).map((e=>e.name))})}return n})();this._store.dispatch({type:N.METADATA_LOADED,payload:e})}}isStatic(){var e;return(null===(e=this._staticFields)||void 0===e?void 0:e.length)>0}interceptAction(e){if(e.type===l.RECORDS_COPIED){const t=j(this._store.getState()).getCleanOnCopyFields();if(t)return new s(l.RECORDS_COPIED,e.payload.map((e=>{const n=Object.assign({},e);return t.forEach((e=>delete n[e])),n})))}return e}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new c("ez-form")),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe((e=>{e.type===l.METADATA_LOADED&&this.processMetadata()})),this._dataBinder=new x(this.dataUnit),this._store=A(C),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata()}componentDidRender(){this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")))}render(){return e(r,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return i(this)}static get watchers(){return{config:["configChanged"]}}};k.style="ez-form{display:flex;flex-direction:column;width:100%}";export{k as ez_form}
@@ -0,0 +1 @@
1
+ import{r as t,f as i,h as e,H as s}from"./p-89a57641.js";let o=class{constructor(i){t(this,i),this._nextMessages=[],this._currentMessageInfo={message:"",fadeTime:void 0,useIcon:void 0},this._toastOpenedClass="toast__container--opened",this._lastTimeOut=void 0,this._lang="pt",this.fadeTime=5e3,this.useIcon=!1,this.canClose=!0}async show(t,e,s,o){return new Promise((a=>{var n;(null===(n=this.container)||void 0===n?void 0:n.classList.contains(this._toastOpenedClass))?this._nextMessages.push({message:t,fadeTime:e,useIcon:s,canClose:o,callBack:a}):(this._currentMessageInfo.message=t||this.message,this._currentMessageInfo.fadeTime=e||this.fadeTime,this._currentMessageInfo.useIcon=s||this.useIcon,this._currentMessageInfo.callBack=a,o&&(this._currentMessageInfo.canClose=this.canClose),i(this),this.displayToast(),this._lastTimeOut=setTimeout((()=>{this.hideToast()}),this._currentMessageInfo.fadeTime+400))}))}hideToast(){this.makeToastInvisible(),this._nextMessages.length>0&&(this._currentMessageInfo.callBack&&this._currentMessageInfo.callBack(!0),setTimeout((()=>{let t=this._nextMessages.shift();this.show(t.message,t.fadeTime,t.useIcon)}))),this._currentMessageInfo.callBack&&this._currentMessageInfo.callBack(!0)}makeToastInvisible(){this.container.classList.remove(this._toastOpenedClass),this.container.style.animation="none",this._lastTimeOut&&clearTimeout(this._lastTimeOut)}displayToast(){this.container.classList.add(this._toastOpenedClass),this.container.style.animation=`fadein 0.5s, fadeout 0.5s ${this.fadeTime/1e3}s`}render(){return e(s,null,e("div",{ref:t=>this.container=t,class:"toast__container"},this._currentMessageInfo.useIcon&&e("slot",{name:"icon"}),e("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&&e("button",{class:"btn-close",onClick:()=>{this.hideToast()}})))}};o.style=':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}}';export{o as ez_toast}
@@ -1 +1 @@
1
- class t{static async showDialog(t,n,e=null,a,o=!1){return new Promise((s=>{let c=document.querySelector("ez-dialog");c||(c=document.createElement("ez-dialog"),window.document.body.appendChild(c)),c.show(t,n,o,a,e).then((t=>s(t)))}))}static async alert(n,e,a=null){return t.showDialog(n,e,a,!1,!1)}static async error(n,e,a=null){return t.showDialog(n,e,a,!1,!0)}static async confirm(n,e,a=null,o=!1){return t.showDialog(n,e,a,!0,o)}static async info(n,e=t.defaultMessageOptions){let a=document.querySelector("ez-toast");a||(a=document.createElement("ez-toast"),window.document.body.appendChild(a)),a.canClose=e.canClose,a.message=n,a.fadeTime=4e3,a.show()}}t.defaultMessageOptions={canClose:!0};export{t as A}
1
+ class t{static async showDialog(t,n,e=null,a,o=!1){return new Promise((s=>{let c=document.querySelector("ez-dialog");c||(c=document.createElement("ez-dialog"),window.document.body.appendChild(c)),c.show(t,n,o,a,e).then((t=>s(t)))}))}static async alert(n,e,a=null){return t.showDialog(n,e,a,!1,!1)}static async error(n,e,a=null){return t.showDialog(n,e,a,!1,!0)}static async confirm(n,e,a=null,o=!1){return t.showDialog(n,e,a,!0,o)}static async info(n,e=t.defaultMessageOptions){let a=document.querySelector("ez-toast");a||(a=document.createElement("ez-toast"),window.document.body.appendChild(a)),a.show(n,4e3,!1,e.canClose)}}t.defaultMessageOptions={canClose:!0};export{t as A}
@@ -1,5 +1,16 @@
1
+ export interface ToastInfo {
2
+ message: string;
3
+ fadeTime: number;
4
+ useIcon: boolean;
5
+ canClose?: boolean;
6
+ callBack?: Function;
7
+ }
1
8
  export declare class EzToast {
2
9
  private container;
10
+ private _nextMessages;
11
+ private _currentMessageInfo;
12
+ private _toastOpenedClass;
13
+ private _lastTimeOut;
3
14
  private _lang;
4
15
  /**
5
16
  * Mensagem exibida no componente.
@@ -20,6 +31,9 @@ export declare class EzToast {
20
31
  /**
21
32
  * Exibe o componente na tela.
22
33
  */
23
- show(): Promise<void>;
34
+ show(message: string, fadeTime: number, useIcon: boolean, canClose?: boolean): Promise<unknown>;
35
+ private hideToast;
36
+ private makeToastInvisible;
37
+ private displayToast;
24
38
  render(): any;
25
39
  }
@@ -776,7 +776,7 @@ export namespace Components {
776
776
  /**
777
777
  * Exibe o componente na tela.
778
778
  */
779
- "show": () => Promise<void>;
779
+ "show": (message: string, fadeTime: number, useIcon: boolean, canClose?: boolean) => Promise<unknown>;
780
780
  /**
781
781
  * Adiciona ícone de check no componente.
782
782
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/ezui",
3
- "version": "1.1.117",
3
+ "version": "1.1.118",
4
4
  "description": "Biblioteca de componentes Sankhya.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/custom-elements/index.js",
@@ -1 +0,0 @@
1
- import{r as t,h as e}from"./p-89a57641.js";let o=class{constructor(e){t(this,e),this._lang="pt",this.fadeTime=5e3,this.useIcon=!1,this.canClose=!0}async show(){this.container.classList.add("toast__container--oppened"),this.container.style.animation=`fadein 0.5s, fadeout 0.5s ${this.fadeTime/1e3}s`,setTimeout((()=>{this.container.classList.remove("toast__container--oppened"),this.container.style.animation="none"}),this.fadeTime+400)}render(){return e("div",{ref:t=>this.container=t,class:"toast__container"},this.useIcon&&e("slot",{name:"icon"}),e("div",{lang:this._lang,class:this.useIcon?"message__container message__conteiner--icon":"message__container",title:this.message,innerHTML:this.message}),this.canClose&&e("button",{class:"btn-close",onClick:()=>{this.container.classList.remove("toast__container--oppened"),this.container.style.animation="none"}}))}};o.style=':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--oppened{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}}';export{o as ez_toast}