@sankhyalabs/ezui 1.1.100 → 1.1.103
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.
- package/dist/cjs/{UnitMetadata-63c56042.js → UnitMetadata-4b90ead3.js} +43 -8
- package/dist/cjs/ez-button_3.cjs.entry.js +16 -4
- package/dist/cjs/ez-calendar_16.cjs.entry.js +97 -15
- package/dist/cjs/ez-grid.cjs.entry.js +14 -1
- package/dist/cjs/ez-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-button/ez-button.js +51 -5
- package/dist/collection/components/ez-calendar/ez-calendar.js +11 -7
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +3 -3
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +47 -1
- package/dist/collection/components/ez-date-input/ez-date-input.js +59 -7
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +57 -6
- package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +7 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +6 -0
- package/dist/collection/components/ez-number-input/ez-number-input.js +47 -1
- package/dist/collection/components/ez-search/ez-search.js +47 -1
- package/dist/collection/components/ez-upload/ez-upload.css +5 -0
- package/dist/collection/components/ez-upload/ez-upload.js +45 -1
- package/dist/collection/components/test-du/test-du.js +7 -0
- package/dist/custom-elements/index.js +168 -26
- package/dist/esm/{UnitMetadata-109880b0.js → UnitMetadata-8951d803.js} +43 -8
- package/dist/esm/ez-button_3.entry.js +16 -4
- package/dist/esm/ez-calendar_16.entry.js +97 -15
- package/dist/esm/ez-grid.entry.js +14 -1
- package/dist/esm/ez-modal_2.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-afb820c1.entry.js → p-18c00d88.entry.js} +1 -1
- package/dist/ezui/p-2259c926.entry.js +1 -0
- package/dist/ezui/p-6b257393.entry.js +1 -0
- package/dist/ezui/{p-a30309ce.entry.js → p-7294c815.entry.js} +1 -1
- package/dist/ezui/p-c6760545.js +1 -0
- package/dist/ezui/{p-18de871c.entry.js → p-da0f5393.entry.js} +2 -2
- package/dist/types/components/ez-button/ez-button.d.ts +9 -0
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +1 -1
- package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +1 -1
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +8 -0
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +9 -1
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +9 -1
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +1 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +8 -0
- package/dist/types/components/ez-search/ez-search.d.ts +8 -0
- package/dist/types/components/ez-upload/ez-upload.d.ts +8 -0
- package/dist/types/components.d.ts +60 -4
- package/package.json +1 -1
- package/dist/ezui/p-3ea01b00.entry.js +0 -1
- package/dist/ezui/p-9fab5606.js +0 -1
- package/dist/ezui/p-d7c80eac.entry.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare class EzButton {
|
|
2
|
+
private _button;
|
|
2
3
|
/**
|
|
3
4
|
* Texto indicativo da ação do botão.
|
|
4
5
|
*/
|
|
@@ -23,6 +24,14 @@ export declare class EzButton {
|
|
|
23
24
|
* É possível escolher entre [small,medium,large] (somente para os modos "icon" e "link")
|
|
24
25
|
*/
|
|
25
26
|
size: string;
|
|
27
|
+
/**
|
|
28
|
+
* Realiza o foco no botão
|
|
29
|
+
*/
|
|
30
|
+
setFocus(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Remove o foco no botão
|
|
33
|
+
*/
|
|
34
|
+
setBlur(): Promise<void>;
|
|
26
35
|
getIconSize(): string;
|
|
27
36
|
handleSlotChange(ev: Event): void;
|
|
28
37
|
render(): any;
|
|
@@ -37,7 +37,7 @@ export declare class EzCalendar {
|
|
|
37
37
|
/**
|
|
38
38
|
* Quando o usuário escolhe uma data, esse evento é emitido.
|
|
39
39
|
*/
|
|
40
|
-
ezChange: EventEmitter<
|
|
40
|
+
ezChange: EventEmitter<Date>;
|
|
41
41
|
/**
|
|
42
42
|
* Usado no modo floating. Faz com que o componente seja exibido.
|
|
43
43
|
* É possível determinar ajustes de posicionamento através dos parâmetros
|
|
@@ -19,7 +19,7 @@ export declare class EzCollapsibleBox {
|
|
|
19
19
|
/**
|
|
20
20
|
* Evento disparado ao mudar o estado do componente (onEzChange).
|
|
21
21
|
*/
|
|
22
|
-
ezChange: EventEmitter<
|
|
22
|
+
ezChange: EventEmitter<boolean>;
|
|
23
23
|
observeValue(): void;
|
|
24
24
|
/**
|
|
25
25
|
* Esconde ou revela o conteúdo do componente
|
|
@@ -56,6 +56,14 @@ export declare class EzComboBox {
|
|
|
56
56
|
*/
|
|
57
57
|
canShowError: boolean;
|
|
58
58
|
private internalUpdate;
|
|
59
|
+
/**
|
|
60
|
+
* Realiza o foco no componente de seleção
|
|
61
|
+
*/
|
|
62
|
+
setFocus(): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Remove o foco no componente de seleção
|
|
65
|
+
*/
|
|
66
|
+
setBlur(): Promise<void>;
|
|
59
67
|
private getText;
|
|
60
68
|
private getSelectedOption;
|
|
61
69
|
private updateVisibleOptions;
|
|
@@ -6,7 +6,7 @@ export declare class EzDateInput {
|
|
|
6
6
|
/**
|
|
7
7
|
* Evento disparado ao mudar o estado do componente(onEzChange).
|
|
8
8
|
*/
|
|
9
|
-
ezChange: EventEmitter<
|
|
9
|
+
ezChange: EventEmitter<Date>;
|
|
10
10
|
/**
|
|
11
11
|
* Título do campo
|
|
12
12
|
*/
|
|
@@ -26,6 +26,14 @@ export declare class EzDateInput {
|
|
|
26
26
|
setLabel(): void;
|
|
27
27
|
setErrorMessage(): void;
|
|
28
28
|
applyValueToInput(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Realiza o foco no componente de data
|
|
31
|
+
*/
|
|
32
|
+
setFocus(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Remove o foco no componente de data
|
|
35
|
+
*/
|
|
36
|
+
setBlur(): Promise<void>;
|
|
29
37
|
changeValue(newValue: Date): void;
|
|
30
38
|
private showCalendar;
|
|
31
39
|
private hideCalendar;
|
|
@@ -6,7 +6,7 @@ export declare class EzDateTimeInput {
|
|
|
6
6
|
/**
|
|
7
7
|
* Evento disparado ao mudar o estado do componente(onEzChange).
|
|
8
8
|
*/
|
|
9
|
-
ezChange: EventEmitter<
|
|
9
|
+
ezChange: EventEmitter<Date>;
|
|
10
10
|
/**
|
|
11
11
|
* Título do campo
|
|
12
12
|
*/
|
|
@@ -30,6 +30,14 @@ export declare class EzDateTimeInput {
|
|
|
30
30
|
setLabel(): void;
|
|
31
31
|
setErrorMessage(): void;
|
|
32
32
|
applyValueToInput(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Realiza o foco no componente de datetime
|
|
35
|
+
*/
|
|
36
|
+
setFocus(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Remove o foco no componente de datetime
|
|
39
|
+
*/
|
|
40
|
+
setBlur(): Promise<void>;
|
|
33
41
|
onChangeKeyDown(ev: any): void;
|
|
34
42
|
onFocused(): void;
|
|
35
43
|
onClicked(): void;
|
|
@@ -57,6 +57,10 @@ export default interface EzGridController {
|
|
|
57
57
|
* as linhas da grade (os dados propriamente ditos).
|
|
58
58
|
*/
|
|
59
59
|
setData(data: Array<any>): void;
|
|
60
|
+
/**
|
|
61
|
+
* Método responsável por atualizar as linhas da grade
|
|
62
|
+
*/
|
|
63
|
+
refresh(): void;
|
|
60
64
|
/**
|
|
61
65
|
* Quando no modo paginado, aciona o carregamento da próxima página
|
|
62
66
|
*/
|
|
@@ -21,6 +21,7 @@ export default class AgGridController implements EzGridController, SortingProvid
|
|
|
21
21
|
private setOptionsPagination;
|
|
22
22
|
private setOptionsSupress;
|
|
23
23
|
setData(data: Array<any>): void;
|
|
24
|
+
refresh(): void;
|
|
24
25
|
setColumnsDef(cols: Array<EzGridColumn>, showCheckSelection: boolean): void;
|
|
25
26
|
getColumnsDef(): Array<EzGridColumn>;
|
|
26
27
|
setColumnsState(state: Array<EzGridColumn>): void;
|
|
@@ -39,6 +39,14 @@ export declare class EzNumberInput {
|
|
|
39
39
|
setLabel(): void;
|
|
40
40
|
setErrorMessage(): void;
|
|
41
41
|
applyValueToInput(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Realiza o foco no componente de input
|
|
44
|
+
*/
|
|
45
|
+
setFocus(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Remove o foco no componente de input
|
|
48
|
+
*/
|
|
49
|
+
setBlur(): Promise<void>;
|
|
42
50
|
changeValue(newValue: number): void;
|
|
43
51
|
private parseNumber;
|
|
44
52
|
private getTextValue;
|
|
@@ -40,6 +40,14 @@ export declare class EzSearch {
|
|
|
40
40
|
*/
|
|
41
41
|
showOptionValue: boolean;
|
|
42
42
|
updateValue(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Realiza o foco no componente de pesquisa
|
|
45
|
+
*/
|
|
46
|
+
setFocus(): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Remove o foco no componente de pesquisa
|
|
49
|
+
*/
|
|
50
|
+
setBlur(): Promise<void>;
|
|
43
51
|
onComboChange(evt: any): void;
|
|
44
52
|
componentDidLoad(): void;
|
|
45
53
|
render(): any;
|
|
@@ -57,6 +57,14 @@ export declare class EzUpload {
|
|
|
57
57
|
* Método responsável por adicionar um ou mais arquivos ao componente.
|
|
58
58
|
*/
|
|
59
59
|
addFiles(files: Array<File>): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Realiza o foco no componente de upload
|
|
62
|
+
*/
|
|
63
|
+
setFocus(): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Remove o foco no componente de upload
|
|
66
|
+
*/
|
|
67
|
+
setBlur(): Promise<void>;
|
|
60
68
|
addFile(file: File): Promise<void>;
|
|
61
69
|
doAddFile(file: File): Promise<void>;
|
|
62
70
|
finishUpload(ezFile: EzFile): void;
|
|
@@ -48,6 +48,14 @@ export namespace Components {
|
|
|
48
48
|
* Define o modo de uso do botão; opções: icon, link e regular
|
|
49
49
|
*/
|
|
50
50
|
"mode": string;
|
|
51
|
+
/**
|
|
52
|
+
* Remove o foco no botão
|
|
53
|
+
*/
|
|
54
|
+
"setBlur": () => Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Realiza o foco no botão
|
|
57
|
+
*/
|
|
58
|
+
"setFocus": () => Promise<void>;
|
|
51
59
|
/**
|
|
52
60
|
* É possível escolher entre [small,medium,large] (somente para os modos "icon" e "link")
|
|
53
61
|
*/
|
|
@@ -157,6 +165,14 @@ export namespace Components {
|
|
|
157
165
|
*/
|
|
158
166
|
"options": Array<Option>;
|
|
159
167
|
"searchMode": boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Remove o foco no componente de seleção
|
|
170
|
+
*/
|
|
171
|
+
"setBlur": () => Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Realiza o foco no componente de seleção
|
|
174
|
+
*/
|
|
175
|
+
"setFocus": () => Promise<void>;
|
|
160
176
|
/**
|
|
161
177
|
* Ajusta a opção de mostrar o "value" para cada opção. Por padrão não mostra
|
|
162
178
|
*/
|
|
@@ -187,6 +203,14 @@ export namespace Components {
|
|
|
187
203
|
* Título do campo
|
|
188
204
|
*/
|
|
189
205
|
"label": string;
|
|
206
|
+
/**
|
|
207
|
+
* Remove o foco no componente de data
|
|
208
|
+
*/
|
|
209
|
+
"setBlur": () => Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Realiza o foco no componente de data
|
|
212
|
+
*/
|
|
213
|
+
"setFocus": () => Promise<void>;
|
|
190
214
|
/**
|
|
191
215
|
* A data informada pelo usuário
|
|
192
216
|
*/
|
|
@@ -205,6 +229,14 @@ export namespace Components {
|
|
|
205
229
|
* Título do campo
|
|
206
230
|
*/
|
|
207
231
|
"label": string;
|
|
232
|
+
/**
|
|
233
|
+
* Remove o foco no componente de datetime
|
|
234
|
+
*/
|
|
235
|
+
"setBlur": () => Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Realiza o foco no componente de datetime
|
|
238
|
+
*/
|
|
239
|
+
"setFocus": () => Promise<void>;
|
|
208
240
|
/**
|
|
209
241
|
* Exibe ou não os segundos no input
|
|
210
242
|
*/
|
|
@@ -415,6 +447,14 @@ export namespace Components {
|
|
|
415
447
|
* Esse atributo determina qual é o número mínimo de casas depois da vírgula. Exemplo: Digamos que a precision seja igual a 4, assim qualquer número será representado com 4 casas decimais mesmo que iguais a zero: 1,0100. Se prettiprecision igual a 2, como não há necessidade de mais de duas casas decimais o valor exibido será 1,01. Por outro lado, até a quarta casa não haverá arredondamento (1,1234 = 1,1234) mas a partir da quinta casa sim (1,12345 = 1,1235).
|
|
416
448
|
*/
|
|
417
449
|
"prettyPrecision": number;
|
|
450
|
+
/**
|
|
451
|
+
* Remove o foco no componente de input
|
|
452
|
+
*/
|
|
453
|
+
"setBlur": () => Promise<void>;
|
|
454
|
+
/**
|
|
455
|
+
* Realiza o foco no componente de input
|
|
456
|
+
*/
|
|
457
|
+
"setFocus": () => Promise<void>;
|
|
418
458
|
/**
|
|
419
459
|
* O valor informado pelo usuário
|
|
420
460
|
*/
|
|
@@ -497,6 +537,14 @@ export namespace Components {
|
|
|
497
537
|
* Função responsável por carregar as opções dinamicamente
|
|
498
538
|
*/
|
|
499
539
|
"optionLoader": Function;
|
|
540
|
+
/**
|
|
541
|
+
* Remove o foco no componente de pesquisa
|
|
542
|
+
*/
|
|
543
|
+
"setBlur": () => Promise<void>;
|
|
544
|
+
/**
|
|
545
|
+
* Realiza o foco no componente de pesquisa
|
|
546
|
+
*/
|
|
547
|
+
"setFocus": () => Promise<void>;
|
|
500
548
|
/**
|
|
501
549
|
* Ajusta a opção de mostrar o "value" para cada opção.
|
|
502
550
|
*/
|
|
@@ -677,6 +725,14 @@ export namespace Components {
|
|
|
677
725
|
* Headers para a requisição Http
|
|
678
726
|
*/
|
|
679
727
|
"requestHeaders": any;
|
|
728
|
+
/**
|
|
729
|
+
* Remove o foco no componente de upload
|
|
730
|
+
*/
|
|
731
|
+
"setBlur": () => Promise<void>;
|
|
732
|
+
/**
|
|
733
|
+
* Realiza o foco no componente de upload
|
|
734
|
+
*/
|
|
735
|
+
"setFocus": () => Promise<void>;
|
|
680
736
|
/**
|
|
681
737
|
* Define a URL de deleção
|
|
682
738
|
*/
|
|
@@ -962,7 +1018,7 @@ declare namespace LocalJSX {
|
|
|
962
1018
|
/**
|
|
963
1019
|
* Quando o usuário escolhe uma data, esse evento é emitido.
|
|
964
1020
|
*/
|
|
965
|
-
"onEzChange"?: (event: CustomEvent<
|
|
1021
|
+
"onEzChange"?: (event: CustomEvent<Date>) => void;
|
|
966
1022
|
/**
|
|
967
1023
|
* Exibe ou não os segundos no calendario
|
|
968
1024
|
*/
|
|
@@ -1014,7 +1070,7 @@ declare namespace LocalJSX {
|
|
|
1014
1070
|
/**
|
|
1015
1071
|
* Evento disparado ao mudar o estado do componente (onEzChange).
|
|
1016
1072
|
*/
|
|
1017
|
-
"onEzChange"?: (event: CustomEvent<
|
|
1073
|
+
"onEzChange"?: (event: CustomEvent<boolean>) => void;
|
|
1018
1074
|
/**
|
|
1019
1075
|
* Valor externalizado que garante a exibição ou não do componente
|
|
1020
1076
|
*/
|
|
@@ -1083,7 +1139,7 @@ declare namespace LocalJSX {
|
|
|
1083
1139
|
/**
|
|
1084
1140
|
* Evento disparado ao mudar o estado do componente(onEzChange).
|
|
1085
1141
|
*/
|
|
1086
|
-
"onEzChange"?: (event: CustomEvent<
|
|
1142
|
+
"onEzChange"?: (event: CustomEvent<Date>) => void;
|
|
1087
1143
|
/**
|
|
1088
1144
|
* A data informada pelo usuário
|
|
1089
1145
|
*/
|
|
@@ -1105,7 +1161,7 @@ declare namespace LocalJSX {
|
|
|
1105
1161
|
/**
|
|
1106
1162
|
* Evento disparado ao mudar o estado do componente(onEzChange).
|
|
1107
1163
|
*/
|
|
1108
|
-
"onEzChange"?: (event: CustomEvent<
|
|
1164
|
+
"onEzChange"?: (event: CustomEvent<Date>) => void;
|
|
1109
1165
|
/**
|
|
1110
1166
|
* Exibe ou não os segundos no input
|
|
1111
1167
|
*/
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as e,c as i,H as r}from"./p-89a57641.js";let o=class{constructor(e){t(this,e),this.enabled=!0,this.mode="regular",this.size="medium"}getIconSize(){return this.size}handleSlotChange(t){const e=t.target,i=e.assignedElements()[0];"link"==this.mode?(i.style.display="inline","leftIcon"==e.name?i.style.paddingRight="var(--ez-button__inline__icon--padding)":"rightIcon"==e.name&&(i.style.paddingLeft="var(--ez-button__inline__icon--padding)")):i.style.setProperty("--ez-icon--color","var(--ez-icon--color)")}render(){return"icon"==this.mode?e("button",{class:"icon "+this.size,type:"button",disabled:!this.enabled},e("ez-icon",{class:"icon",href:this.image,iconName:this.iconName,size:this.getIconSize(),onClick:t=>{this.enabled||t.stopPropagation()}})):"label-icon"==this.mode?e("div",{class:"label-icon"},e("button",{class:"icon",type:"button",disabled:!this.enabled},e("ez-icon",{class:"icon",href:this.image,iconName:this.iconName,size:"large",onClick:t=>{this.enabled||t.stopPropagation()}})),e("label",{title:this.label},this.label)):"link"==this.mode?e("a",{class:this.size},e("slot",{name:"leftIcon",onSlotchange:t=>{this.handleSlotChange(t)}}),this.label,e("slot",{name:"rightIcon",onSlotchange:t=>{this.handleSlotChange(t)}})):e("button",{type:"button",disabled:!this.enabled},e("slot",{name:"leftIcon",onSlotchange:t=>{this.handleSlotChange(t)}}),this.label,e("slot",{name:"rightIcon",onSlotchange:t=>{this.handleSlotChange(t)}}))}};o.style=":host{--ez-button--min-width:100px;--ez-button--height:42px;--ez-button__icon--width:18px;--ez-button__inline__icon--padding:12px;--ez-button--padding-top:var(--space--medium, 12px);--ez-button--padding-bottom:var(--space--medium, 12px);--ez-button--padding-right:var(--space--large, 24px);--ez-button--padding-left:var(--space--large, 24px);--ez-button--color:var(--text--primary, #FFF);--ez-button--font-size:var(--text--medium, 14px);--ez-button--font-family:var(--font-pattern, Arial);--ez-button--font-weight:var(--text-weight--large);--ez-button--background-color:var(--background--medium, #c0c0c0);--ez-button--border-radius:var(--border--radius-large, 12px);--ez-button--border:none;--ez-button--hover--background-color:var(--background--strong, var(--ez-button--background-color));--ez-button--disabled-color:var(--text--disable);--ez-button--disabled--background-color:var(--color--disable-secondary);--ez-button--focus--border:var(--ez-button--border);--ez-button--focus--box-shadow:none;--ez-button--link-color:var(--color--primary, '#008561');--ez-button--link--hover-color:var(--color--primary-700, '#1C1D22');--ez-button--link--small--font-size:var(--text--small, 12px);--ez-button--link--medium--font-size:var(--text--medium, 14px);--ez-button--link--large--font-size:var(--text--large, 16px)}ez-icon{--ez-icon--color:inherit}button{display:flex;align-items:center;justify-content:center;margin:0;cursor:pointer;transition:background-color 0.2s linear;min-width:var(--ez-button--min-width);height:var(--ez-button--height);font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);padding:var(--ez-button--padding-top) var(--ez-button--padding-right) var(--ez-button--padding-bottom) var(--ez-button--padding-left);border-radius:var(--ez-button--border-radius);background-color:var(--ez-button--background-color);color:var(--ez-button--color);fill:var(--ez-button--color);border:var(--ez-button--border)}button:hover{background-color:var(--ez-button--hover--background-color)}button:focus{outline:none;border:var(--ez-button--focus--border);box-shadow:var(--ez-button--focus--box-shadow)}button:disabled{background-color:var(--ez-button--disabled--background-color);color:var(--ez-button--disabled-color);fill:var(--ez-button--disabled-color);border:none;cursor:no-drop}button.icon{padding:0px}button.small{width:32px;min-width:32px;height:32px}button.medium{width:42px;min-width:42px;height:42px}button.large{width:52px;min-width:52px;height:52px}.label-icon{display:flex;flex-direction:column;align-items:center;color:var(--ez-button--color)}.label-icon label{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight)}a{font-family:var(--ez-button--font-family);font-weight:var(--ez-button--font-weight);color:var(--ez-button--link-color);cursor:pointer;display:flex;align-items:center;justify-content:center;}a:hover{color:var(--ez-button--link--hover-color)}a.small{font-size:var(--ez-button--link--small--font-size);line-height:var(--ez-button--link--small--font-size)}a.medium{font-size:var(--ez-button--link--medium--font-size);line-height:var(--ez-button--link--medium--font-size)}a.large{font-size:var(--ez-button--link--large--font-size);line-height:var(--ez-button--link--large--font-size)}";let a=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this._listItems=[],this._listGroupItems=[],this._listItemsHistory=[],this.dataSource=[],this.useGroups=!1,this.ezDraggable=!1,this.ezSelectable=!1}createList(){if(this.useGroups){let t=[...this.dataSource];t.forEach((t=>{this.sortGroup(t)})),this._listGroupItems=t}else this._listItems=this._listItemsHistory.length>0?this._listItemsHistory:[...this.dataSource]}sortGroup(t){t.sort&&(t.items.sort((function(t,e){return t.label<e.label?-1:t.label>e.label?1:0})),"DSC"===t.sort&&t.items.reverse())}async setSelection(t,e){if(t&&this.ezSelectable){if(this.useGroups){let e=[...this._listGroupItems];e.forEach((e=>{e.items.forEach((e=>{e.selected=e.label==t.label}))})),this._listGroupItems=e}else{let e=[...this._listItems];e.forEach((e=>{e.selected=e.label===t.label})),this._listItems=e}if(e){let e=this.useGroups?this._groupContainer.querySelector("li#item_"+this.getItemId(t.label)):this._itemContainer.querySelector("li#item_"+this.getItemId(t.label));e&&e.scrollIntoView()}}else this.removeSelection()}removeSelection(){if(this.useGroups){let t=[...this._listGroupItems];t.forEach((t=>{t.items.forEach((t=>{t.selected=!1}))})),this._listGroupItems=t}else{let t=[...this._listItems];t.forEach((t=>{t.selected=!1})),this._listItems=t}}async getSelection(){let t;return this.useGroups?this._listGroupItems.every((e=>{let i=e.items.find((t=>1==t.selected));return!i||(t=i,!1)})):t=this._listItems.find((t=>1==t.selected)),t}async getList(){return this.useGroups?this._listGroupItems:this._listItems}componentWillLoad(){this._listItemsHistory=[]}componentWillRender(){this.createList()}onDrop(t,e){if(this.removeOverClass(),this.setSelection(void 0),this._dragStartItem)if(this.useGroups){let t=[...this._listGroupItems],i=this._listGroupItems.find((t=>e.groupName==t.group));if(t.find((t=>t.group==this._dragStartItem.groupName)).items.splice(this._dragStartItem.index,1),i.sort)t.find((t=>t.group==e.groupName)).items.push(this._dragStartItem.item),t.find((t=>t.group==e.groupName)).items.sort((function(t,e){return t.label<e.label?-1:t.label>e.label?1:0})),"DSC"===i.sort&&t.find((t=>t.group==e.groupName)).items.reverse();else{let i=e.index>this._dragStartItem.index?e.index-1:e.index;t.find((t=>t.group==e.groupName)).items.splice(i,0,this._dragStartItem.item)}this._listGroupItems=t,this.ezChange.emit(this._listGroupItems)}else{let t=[...this._listItems];t.splice(this._dragStartItem.index,1),t.splice(e.index,0,this._dragStartItem.item),this._listItems=t,this._listItemsHistory=t,this.ezChange.emit(this._listItems)}t.stopPropagation()}onDropLastIndex(t,e){if(this.removeOverClass(),this.setSelection(void 0),this._dragStartItem)if(this.useGroups){let t=[...this._listGroupItems],i=this._listGroupItems.find((t=>e.group==t.group));t.find((t=>t.group==this._dragStartItem.groupName)).items.splice(this._dragStartItem.index,1),t.find((t=>t.group==e.group)).items.push(this._dragStartItem.item),i.sort&&(t.find((t=>t.group==e.group)).items.sort((function(t,e){return t.label<e.label?-1:t.label>e.label?1:0})),"DSC"===i.sort&&t.find((t=>t.group==e.group)).items.reverse()),this._listGroupItems=t,this.ezChange.emit(this._listGroupItems)}else{let t=[...this._listItems];t.splice(this._dragStartItem.index,1),t.push(this._dragStartItem.item),this._listItems=t,this._listItemsHistory=t,this.ezChange.emit(this._listItems)}t.stopPropagation()}onDropGroup(t){var e;let i=[...this._listGroupItems];this.setSelection(void 0);let r=i.find((e=>e.group===t.group));if(r){if((null===(e=r.items)||void 0===e?void 0:e.length)>0){let t;r.items.forEach(((e,i)=>{e.label===this._dragStartItem.item.label&&(t={item:e,index:i})})),t?(r.items.splice(t.index,1),r.items.unshift(t.item),this.sortGroup(r)):(r.items.unshift(this._dragStartItem.item),this.sortGroup(r),i.find((t=>t.group===this._dragStartItem.groupName)).items.splice(this._dragStartItem.index,1))}else i.find((t=>t.group===this._dragStartItem.groupName)).items.splice(this._dragStartItem.index,1),r.items=[this._dragStartItem.item];this._listGroupItems=i}}onDragEnd(){if(this._dragStartItem=void 0,this.useGroups&&this.hideOverlays(),this._draggingElement){try{this._element.shadowRoot.removeChild(this._draggingElement)}catch(t){}this._draggingElement=void 0}}addOverClass(t){(null==t?void 0:t.__proto__)==HTMLDivElement.prototype&&t.classList.contains("draggable")?t.classList.add("over"):(null==t?void 0:t.parentElement)&&!t.parentElement.classList.contains("draggable-list")&&this.addOverClass(t.parentElement)}addOverGroupClass(t,e){if(t.target){let t=this._groupContainer.querySelector("div#"+this.getDivGroupId(e.group)).getElementsByClassName("group-overlay")[0];e.items.length>0?t.setAttribute("style","display:grid"):(t.classList.add("presetedHeight"),t.setAttribute("style","display:grid"),t.scrollIntoView(!1))}}removeOverClass(){var t,e;let i,r;this.useGroups?(i=null===(t=this._groupContainer)||void 0===t?void 0:t.getElementsByClassName("over"),r=this._groupContainer.getElementsByClassName("last-droppable-space")):(i=null===(e=this._itemContainer)||void 0===e?void 0:e.getElementsByClassName("over"),r=this._itemContainer.getElementsByClassName("last-droppable-space")),i&&Array.from(i).forEach((function(t){t.classList.remove("over")})),r&&Array.from(r).forEach((function(t){t.classList.remove("over")}))}removeOverGroupClass(t,e){if(t.target){let t=this._groupContainer.querySelector("div#"+this.getDivGroupId(e.group)).getElementsByClassName("group-overlay")[0];t&&(t.classList.remove("presetedHeight"),t.setAttribute("style","display:none"))}}onDragStart(t,e,i){this._changeDeboucingTimeout&&window.clearTimeout(this._changeDeboucingTimeout),this.useGroups?(this._dragStartItem={groupName:e.group,item:t,index:i},this._changeDeboucingTimeout=window.setTimeout((()=>{this.showOverlays(e)}),10)):this._dragStartItem={item:t.item,index:t.index}}selectFirstItem(){this.useGroups&&this.setSelection(this._listGroupItems[0].items[0]),this.setSelection(this._listItems[0])}nextOption(t){let e;if(this.useGroups)this._listGroupItems.every(((i,r,o)=>{let a,s=i.items.findIndex((e=>e.label==t.label));return null!=s&&-1!=s&&(s===i.items.length-1?r+1<=o.length-1&&(a={label:o[r+1].items[0].label}):a={label:i.items[s+1].label}),null==a||(e=a,!1)}));else{let i=this._listItems.findIndex((e=>e.label===t.label));i>=0&&i<this._listItems.length&&(e=this._listItems[i+1])}this.setSelection(e,!0)}previousOption(t){let e;if(this.useGroups)this._listGroupItems.every(((i,r,o)=>{let a,s=i.items.findIndex((e=>e.label==t.label));return null!=s&&-1!=s&&(0===s?r-1>=0&&(a={label:o[r-1].items[o[r-1].items.length-1].label}):a={label:i.items[s-1].label}),null==a||(e=a,!1)}));else{let i=this._listItems.findIndex((e=>e.label===t.label));i>0&&i<this._listItems.length&&(e=this._listItems[i-1])}this.setSelection(e,!0)}keyDownHandler(t){t.preventDefault(),this.getSelection().then((e=>{if(e)switch(t.key){case"ArrowDown":this.nextOption(e);break;case"ArrowUp":this.previousOption(e)}else this.selectFirstItem()})),t.stopPropagation()}getItemId(t){if(t)return t.replace(/[^a-z0-9_]/gi,"_")}getDivGroupId(t){if(t)return"group-"+t.replace(/[^a-z0-9_]/gi,"_")}getGroupOverlayId(t){if(t)return"group-overlay-"+t.replace(/[^a-z0-9_]/gi,"_")}onDragOverGroup(t,e){this._dragStartItem&&this._dragStartItem.groupName!==e.group&&e.sort&&(t.preventDefault(),this.addOverGroupClass(t,e))}onDragOverItem(t){this._dragStartItem&&(t.preventDefault(),this.addOverClass(t.target),t.stopPropagation())}onDragOverLastIndex(t){t.preventDefault(),this._dragStartItem&&(t.target.classList.add("over"),t.stopPropagation())}showOverlays(t){let e=this._groupContainer.getElementsByClassName("group-overlay");Array.from(e).forEach((e=>{let i=this.getGroupOverlayId(t.group);i&&e.getAttribute("id")&&i!=e.getAttribute("id")&&(e.classList.add("presetedHeight"),e.setAttribute("style","display:grid"))}))}hideOverlays(){var t;let e=null===(t=this._groupContainer)||void 0===t?void 0:t.getElementsByClassName("group-overlay");Array.from(e).forEach((t=>{t.classList.remove("presetedHeight"),t.setAttribute("style","display:none")}))}render(){return e(r,{ref:t=>this._element=t},this.useGroups?e("div",{class:"group-container",ref:t=>this._groupContainer=t,tabIndex:0,onKeyDown:t=>{this.keyDownHandler(t)}},this._listGroupItems.map((t=>e("div",{id:this.getDivGroupId(t.group),class:"group",key:t.group+t.items.length,onDrop:()=>this.onDropGroup(t)},e("label",{draggable:!1,class:"group-name"},t.group),e("section",{class:"section-container",onDragOver:t=>t.preventDefault()},e("div",{class:"group-items-container"},e("div",{class:"draggable-list"},t.items.map(((i,r)=>e("li",{id:"item_"+this.getItemId(i.label),class:this.ezSelectable?"selectable-container":"",key:"item_"+this.getItemId(i.label)},e("div",{class:"draggable"+(1==i.selected?" selected-item ":"")+(1==this.ezSelectable?" selectable ":""),onClick:()=>{this.setSelection(i)},onDragLeave:()=>{t.sort||this.removeOverClass()},onDragEnd:()=>this.onDragEnd(),onDragStart:()=>this.onDragStart(i,t,r),onDragOver:e=>{t.sort||this.onDragOverItem(e)},onDrop:e=>this.onDrop(e,{groupName:t.group,item:i,index:r}),draggable:this.ezDraggable},e("div",{class:"item-content"},this.ezDraggable?e("span",{class:"draggable-icon"}):void 0,e("p",{title:i.label,class:"person-name text--ellipsis"},i.label)),this.itemSlotBuilder?e("div",{class:"slot-item"},this.itemSlotBuilder(i,t)):void 0))))),e("div",{class:"last-droppable-space",onDragLeave:()=>this.removeOverClass(),onDragOver:t=>{this.onDragOverLastIndex(t)},onDragEnd:()=>this.onDragEnd(),onDrop:e=>this.onDropLastIndex(e,t)})),t.sort?e("div",{id:this.getGroupOverlayId(t.group),class:"group-overlay"},"Mover para ",t.group):void 0))))):e("div",{class:"items-container",ref:t=>this._itemContainer=t,tabIndex:0,onKeyDown:t=>{this.keyDownHandler(t)}},e("div",{class:"draggable-list"},this._listItems.map(((t,i)=>e("li",{id:"item_"+this.getItemId(t.label),class:this.ezSelectable?"selectable-container":"",key:"item_"+this.getItemId(t.label)},e("div",{class:"draggable"+(1==t.selected?" selected-item ":"")+(1==this.ezSelectable?" selectable ":""),onDragStart:()=>this.onDragStart({item:t,index:i}),onClick:()=>{this.setSelection(t)},onDragLeave:()=>this.removeOverClass(),onDragOver:t=>this.onDragOverItem(t),onDragEnd:()=>this.onDragEnd(),onDrop:e=>this.onDrop(e,{item:t,index:i}),draggable:this.ezDraggable},e("div",{class:"item-content"},this.ezDraggable?e("span",{class:"draggable-icon"}):void 0,e("p",{title:t.label,class:"person-name text--ellipsis"},t.label)),this.itemSlotBuilder?e("div",null,this.itemSlotBuilder(t)):void 0)))),e("div",{class:"last-droppable-space",onDragLeave:()=>this.removeOverClass(),onDragOver:t=>{this.onDragOverLastIndex(t)},onDragEnd:()=>this.onDragEnd(),onDrop:t=>this.onDropLastIndex(t)}))))}};a.style=':host{--ez-list__host--z-index:var(--visible, 1);--ez-list__host--border-radius:var(--border--radius-medium, 12px);--ez-list__host--padding:var(--space--medium, 12px);--ez-list__icon__padding:var(--space--small, 6px);--ez-list__icon--color:#AFB6C0;--ez-list__item__margin:0 var(--space--small, 6px);--ez-list__item--color:var(--title--primary, #2b3a54);--ez-list__item--border-bottom:var(--border--small, 1px solid);--ez-list__item--border-color:var(--title--primary, #2b3a54);--ez-list__item--font-family:var(--font-pattern, "Sora");--ez-list__item--font-size:var(--text--medium, 14px);--ez-list__selectable--padding-right:var(--space--small, 6px);--ez-list__selectable--padding-left:var(--space--small, 6px);--ez-list__selected-item__border-radius:var(--border--radius-small, 6px);--ez-list__selected-item__background:var(--color--primary-300, #E2F4EF);--ez-list__group--font-family:var(--font-pattern, "Sora");--ez-list__group--font-size:var(--text--medium, 14px);--ez-list__group--font-weight:var(--text-weight--large, 600);--ez-list__group--padding-bottom:var(--space-small, 6px);--ez-list__group__overlay--font-family:var(--font-pattern, "Sora");--ez-list__group__overlay--font-size:var(--text--medium, 14px);--ez-list__group-container__scrollbar--border-radius:var(--border--radius-large, 24px);--ez-list__group-container__scrollbar--width:var(--space--medium, 12px);--ez-list__group-container__scrollbar--background-color:var(--text--primary, #626e82);--ez-list__over--border--color:var(--color--primary, #008561);--ez-list__draggable__list--padding-bottom:var(--space--small, 6px);--ez-list__last-droppable-space--height:var(--space--small, 6px);--ez-list__draggable__scrollbar--border-radius:var(--border--radius-large, 24px);--ez-list__draggable__scrollbar--width:var(--space--medium, 12px);--ez-list__draggable__scrollbar--background-color:var(--text--primary, #626e82);--ez-list__draggable__icon--image:url(\'data:image/svg+xml;utf8,<svg width="18" height="18" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><path d="m 6.75,2.25 h 1.5 v 1.5 h -1.5 z m 3,0 h 1.5 v 1.5 h -1.5 z m -3,3 h 1.5 v 1.5 h -1.5 z m 3,0 h 1.5 v 1.5 h -1.5 z m -3,3 h 1.5 v 1.5 h -1.5 z m 3,0 h 1.5 v 1.5 h -1.5 z m -3,3 h 1.5 v 1.5 h -1.5 z m 3,0 h 1.5 v 1.5 h -1.5 z m -3,3 h 1.5 v 1.5 h -1.5 z m 3,0 h 1.5 v 1.5 h -1.5 z"/></svg>\');max-height:100%;width:100%;background-color:#fff;display:flex;z-index:var(--ez-list__host--z-index)}p{margin:0}.draggable{display:flex;align-items:center;border-top:1px dashed #fff;justify-content:space-between;background-color:#fff;font-family:var(--ez-list__item--font-family);font-size:var(--ez-list__item--font-size);flex:1}.dragging{background:#FFFFFF;border:1px solid #008561;box-sizing:border-box;box-shadow:0px 0px 16px rgba(0, 38, 111, 0.122);border-radius:6px}.selectable{cursor:pointer;padding-right:var(--ez-list__selectable--padding-right);padding-left:var(--ez-list__selectable--padding-left)}.selectable-container{margin:0px !important}.item-content{display:flex;justify-content:center;align-items:center}.draggable-list{color:var(--text-color);padding:0;margin:0;width:100%;max-height:100%}.draggable-list li{background-color:#fff;display:flex;margin:var(--ez-list__item__margin);font-family:var(--ez-list__item--font-family);font-size:var(--ez-list__item--font-size);color:var(--ez-list__item--color);height:32px}.over{border-top:1px dashed var(--ez-list__over--border--color)}.last-droppable-space{height:var(--ez-list__last-droppable-space--height)}.draggable-selected{background-color:var(--background--strong) !important}.draggable-selected div:hover{background-color:var(--background--strong) !important}.draggable-list::-webkit-scrollbar-track{background-color:#f0f2f5}.draggable-list::-webkit-scrollbar-thumb{background-color:var(--ez-list__draggable__scrollbar--background-color);border-radius:var(--ez-list__draggable__scrollbar--border-radius)}.draggable-list::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-list__draggable__scrollbar--width);max-width:var(--ez-list__draggable__scrollbar--width);min-width:var(--ez-list__draggable__scrollbar--width)}.draggable-icon{align-items:flex-start;display:flex;outline:none;border:none;background-color:unset}.draggable-icon::after{content:\'\';display:flex;background-color:var(--ez-list__icon--color);width:18px;height:18px;-webkit-mask-image:var(--ez-list__draggable__icon--image);mask-image:var(--ez-list__draggable__icon--image)}*{box-sizing:border-box}.checkbox{width:fit-content}.text--ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.group-container{display:flex;flex-direction:column;max-height:100%;overflow-y:auto;outline:none;width:100%}.group-name{font-family:var(--ez-list__group--font-family);font-size:var(--ez-list__group--font-size);font-weight:var(--ez-list__group--font-weight);padding-bottom:var(--ez-list__group--padding-bottom);-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none}.group{display:flex;flex-direction:column}.group-container::-webkit-scrollbar-track{background-color:#f0f2f5}.group-container::-webkit-scrollbar-thumb{background-color:var(--ez-list__group-container__scrollbar--background-color);border-radius:var(--ez-list__group-container__scrollbar--border-radius)}.group-container::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-list__group-container__scrollbar--width);max-width:var(--ez-list__group-container__scrollbar--width);min-width:var(--ez-list__group-container__scrollbar--width)}.section-container{display:flex;position:relative;height:100%}.items-container{width:100%;max-height:100%;overflow-y:auto;outline:none}.group-items-container{width:100%;max-height:100%;height:100%;outline:none}.items-container::-webkit-scrollbar-track{background-color:#f0f2f5}.items-container::-webkit-scrollbar-thumb{background-color:var(--ez-list__draggable__scrollbar--background-color);border-radius:var(--ez-list__draggable__scrollbar--border-radius)}.items-container::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-list__draggable__scrollbar--width);max-width:var(--ez-list__draggable__scrollbar--width);min-width:var(--ez-list__draggable__scrollbar--width)}.group-overlay{font-family:var(--ez-list__group__overlay--font-family);font-size:var(--ez-list__group__overlay--font-size);background:rgba(226, 244, 239, 0.8);border:1px solid #008561;border-radius:8px;position:absolute;display:none;place-items:center;top:0;bottom:0;left:0;right:0;z-index:2;margin:0;cursor:pointer}.presetedHeight{min-height:100px}.overlay-text{position:absolute;top:50%;left:50%;font-size:50px;color:white;transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%)}.selected-item{background:var(--ez-list__selected-item__background);border-radius:var(--ez-list__selected-item__border-radius)}.slot-item{align-items:flex-end}.overGroup{background:rgba(226, 244, 239, 0.8);border:1px solid #008561;box-sizing:border-box;border-radius:8px;padding-top:6px}';let s=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.selectedOption={value:"na",label:"N/A"}}render(){return e("ez-combo-box",{class:"grid-config-combo inverted",label:"",value:this.selectedOption,enabled:!0,canShowError:!1,suppressEmptyOption:!0},e("option",{value:"na"},"N/A"),e("option",{value:"asc"},"A-Z"),e("option",{value:"desc"},"Z-A"))}static get assetsDirs(){return["../assets"]}};s.style="ez-combo-box{width:100px}.grid-config-combo{--ez-text-input--height:28px;--ez-text-input__input--background-color:#fff;--ez-text-input__input--border-color:#dce0e8}";export{o as ez_button,a as ez_list,s as select_box}
|
package/dist/ezui/p-9fab5606.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const t=/^([+-])?(\d+).?(\d*)[eE]([-+]?\d+)$/;class e{}e.stringToNumber=e=>{if(""===e||null==e)return NaN;if(e){var s="-"===(e=e.toString()).charAt(0);if(""===(e=t.test(e)?e.replace(/^-/g,""):e.replace(/[^\d.,]/g,"")))return Number(NaN);var r=e.indexOf(","),i=e.indexOf(".");i>r?e=e.replace(",",""):i<r&&(e=e.replace(/\./g,"@").replace(",",".").replace(/@/g,"")),s&&(e="-"+e)}return Number(e)},e.format=(t,s,r=NaN)=>{if(""===t||void 0===t||"NaN"===t)return NaN.toString();let i=e.stringToNumber(t);if(NaN===i)return NaN.toString();if(s<0||Math.abs(Math.round(1*s)/1)!==s)return e.changeFormat(i.toString());let n,c=0;c=NaN===r||Math.abs(Math.round(1*r)/1)!==r?s:r,n=(Math.round(i*Math.pow(10,s))/Math.pow(10,s)).toLocaleString("pt-br",{minimumFractionDigits:s});const a=s-c;if(a>0)for(let t=0;t<a;t++)"0"==n.substring(n.length-1)&&s>0&&(n=n.substring(0,n.length-1));return"."!=n.substring(n.length-1)&&","!=n.substring(n.length-1)||(n=n.substring(0,n.length-1)),n},e.keepOnlyDecimalSeparator=(t,e="pt-BR")=>(e=e.toUpperCase(),t.replace("EN-US"===e?/\,/g:/\./g,"")),e.changeFormat=t=>t.replace(/\./g,"_").replace(/\,/g,".").replace(/\_/g,",");class s{constructor(t){this._mask="",this._maskChars=new Array,this.placeholder=" ",this.mask=t}set mask(t){this._mask=t,this.updateInternalMask()}get mask(){return this._mask}format(t){let e="";const s=[0];let r=0;const i=this._maskChars.length;for(;r<i;)e=this._maskChars[r].append(e,t,s),r++;return e}updateInternalMask(){if(this._maskChars.length=0,null!=this.mask){let t=0;const e=this.mask.length;for(;t<e;){let r=this.mask.charAt(t);switch(r){case s.DIGIT_KEY:this._maskChars.push(new s.DigitMaskCharacter(this,r));break;case s.LITERAL_KEY:++t<e&&(r=this.mask.charAt(t),this._maskChars.push(new s.LiteralCharacter(this,r)));break;case s.UPPERCASE_KEY:this._maskChars.push(new s.UpperCaseCharacter(this,r));break;case s.LOWERCASE_KEY:this._maskChars.push(new s.LowerCaseCharacter(this,r));break;case s.ALPHA_NUMERIC_KEY:this._maskChars.push(new s.AlphaNumericCharacter(this,r));break;case s.CHARACTER_KEY:this._maskChars.push(new s.CharCharacter(this,r));break;case s.ANYTHING_KEY:this._maskChars.push(new s.MaskCharacter(this,r));break;default:this._maskChars.push(new s.LiteralCharacter(this,r))}t++}}}}s.DIGIT_KEY="#",s.LITERAL_KEY="'",s.UPPERCASE_KEY="U",s.LOWERCASE_KEY="L",s.ALPHA_NUMERIC_KEY="A",s.CHARACTER_KEY="?",s.ANYTHING_KEY="*",s.MaskCharacter=class{constructor(t,e){this.maskFormatter=t,this.type=e}isLiteral(){return!1}isValidCharacter(t){return this.isLiteral()?this.getChar(t)==t:(t=this.getChar(t),!0)}getChar(t){return t}append(t,e,s){const r=s[0]<e.length?e.charAt(s[0]):"";if(this.isLiteral()){const e=this.getChar(r);t+=e,e===r&&(s[0]=s[0]+1)}else if(s[0]>=e.length)t+=this.maskFormatter.placeholder,s[0]=s[0]+1;else{if(!this.isValidCharacter(r))throw new Error(`Valor inválido: "${r}". Na posição ${s[0]+1} espera-se ${this.getFormatMessage()}.`);t+=this.getChar(r),s[0]=s[0]+1}return t}getFormatMessage(){let t;switch(this.type){case s.UPPERCASE_KEY:case s.LOWERCASE_KEY:case s.CHARACTER_KEY:t="uma letra";break;case s.DIGIT_KEY:t="um número";break;case s.ALPHA_NUMERIC_KEY:t="uma letra ou um número";break;default:t=""}return t}},s.LiteralCharacter=class extends s.MaskCharacter{constructor(t,e){super(t,e),this._fixedChar=e}isLiteral(){return!0}getChar(t){return this._fixedChar}},s.DigitMaskCharacter=class extends s.MaskCharacter{isValidCharacter(t){return this.isDigit(t)&&super.isValidCharacter(t)}isDigit(t){return t>="0"&&t<="9"}},s.UpperCaseCharacter=class extends s.MaskCharacter{isValidCharacter(t){return/[a-z]/i.test(t)&&super.isValidCharacter(t)}getChar(t){return t.toUpperCase()}},s.LowerCaseCharacter=class extends s.MaskCharacter{isValidCharacter(t){return/[a-z]/i.test(t)&&super.isValidCharacter(t)}getChar(t){return t.toLocaleLowerCase()}},s.AlphaNumericCharacter=class extends s.MaskCharacter{isValidCharacter(t){return/[a-z0-9]/i.test(t)&&super.isValidCharacter(t)}},s.CharCharacter=class extends s.MaskCharacter{isValidCharacter(t){return/[a-z]/i.test(t)&&super.isValidCharacter(t)}};class r{static prepareValue(t,e){if(t&&t.length>0&&"NaN"!=t){let s=t.replace(/:/g,"");if(e){if(this._maskFormatter.mask="##:##:##",s.length<6)for(;s.length<6;)s="0".concat(s)}else if(this._maskFormatter.mask="##:##",s.length<4)for(;s.length<4;)s="0".concat(s);if(this._maskFormatter)try{return this._maskFormatter.format(s)}catch(t){throw new Error(t.message)}}return""}static validateTime(t,e){let s=!0;if(t){let r=t.replace(/:/g,"");e?(["1","2","0"].includes(r[0])||(s=!1),["0","1","2","3","4","5"].includes(r[2])||(s=!1),["0","1","2","3","4","5"].includes(r[4])||(s=!1),"2"!=r[0]||["0","1","2","3"].includes(r[1])||(s=!1)):(["1","2","0"].includes(r[0])||(s=!1),["0","1","2","3","4","5"].includes(r[2])||(s=!1),"2"!=r[0]||["0","1","2","3"].includes(r[1])||(s=!1))}else s=!1;return s}}var i,n;r._maskFormatter=new s("##:##"),function(t){t[t.GET=0]="GET",t[t.PUT=1]="PUT",t[t.POST=2]="POST",t[t.DELETE=3]="DELETE"}(i||(i={})),function(t){t.NUMBER="NUMBER",t.DATE="DATE",t.TEXT="TEXT",t.BOOLEAN="BOOLEAN",t.OBJECT="OBJECT"}(n||(n={}));const c=(t,e)=>{if(null==e)return e;switch(t){case n.NUMBER:return""===e||isNaN(e)?null:Number(e);case n.OBJECT:return"string"==typeof e?JSON.parse(e):e;case n.BOOLEAN:return Boolean(e);case n.DATE:return new Date(e.toString());default:return e}};class a{constructor(t,e){this._type=t,this._payload=e}get type(){return this._type}get payload(){return this._payload}}var h;!function(t){t.LOADING_METADATA="loadingMetadata",t.METADATA_LOADED="metadataLoaded",t.LOADING_DATA="loadingData",t.DATA_LOADED="dataLoaded",t.SAVING_DATA="savingData",t.DATA_SAVED="dataSaved",t.RECORDS_REMOVED="recordsRemoved",t.RECORDS_ADDED="recordsAdded",t.RECORDS_COPIED="recordsCopied",t.DATA_CHANGED="dataChanged",t.EDITION_CANCELED="editionCanceled",t.CHANGE_UNDONE="changeUndone",t.CHANGE_REDONE="changeRedone",t.SELECTION_CHANGED="selectionChanged",t.NEXT_SELECTED="nextSelected",t.PREVIOUS_SELECTED="previousSelected",t.STATE_CHANGED="stateChanged"}(h||(h={}));class o{constructor(t){this._past=[],this._future=[],this._present={},this._nonHist={},this._histClean=!1,this._reducers=t}process(t){const e=this._present;let s=!1;this._histClean=!1,this._reducers.forEach((e=>{const r=e.sliceName,i=this.isHistoric(r),n=this.getSlice(r,i),c=e.reduce(this,n,t);c!==n&&(this.updateSlice(r,c,i),s||(s=i))})),s&&!this._histClean&&(this._past.push(e),this._future=[],document.dispatchEvent(new CustomEvent("undoableAction",{detail:this})))}select(t,e){const s=this.isHistoric(t);return e(this.getSlice(t,s))}isHistoric(t){return t.startsWith("hist::")}updateSlice(t,e,s){s?(this._present=Object.assign(Object.assign({},this._present),{[t]:e}),void 0===e&&delete this._present[t]):(this._nonHist=Object.assign(Object.assign({},this._nonHist),{[t]:e}),void 0===e&&delete this._nonHist[t])}getSlice(t,e){return e?this._present[t]:this._nonHist[t]}canUndo(){return this._past.length>0}canRedo(){return this._future.length>0}undo(){this.canUndo()&&(this._future.push(this._present),this._present=this._past.pop())}redo(){this.canRedo()&&(this._past.push(this._present),this._present=this._future.pop())}clearUndo(){this._histClean=!0,this._past=[],this._future=[]}persist(){}}const u=new class{constructor(){this.sliceName=""}reduce(t,e,s){switch(s.type){case h.DATA_SAVED:case h.EDITION_CANCELED:t.clearUndo();break;case h.CHANGE_UNDONE:t.undo();break;case h.CHANGE_REDONE:t.redo()}}},d=new class{constructor(){this.sliceName="unitMetadata"}reduce(t,e,s){return s.type===h.METADATA_LOADED?s.payload:e}},l=t=>t.select(d.sliceName,(t=>t)),f=new class{constructor(){this.sliceName="hist::removedRecords"}reduce(t,e,s){switch(s.type){case h.RECORDS_REMOVED:return(e||[]).concat(s.payload);case h.EDITION_CANCELED:case h.DATA_SAVED:return}return e}},E=t=>t.select(f.sliceName,(t=>t)),g=new class{constructor(){this.sliceName="records"}reduce(t,e,s){switch(s.type){case h.DATA_LOADED:return s.payload;case h.DATA_SAVED:const e=new Map,r=w(t);if(r){const s=E(t)||[];r.forEach((t=>{s.includes(t.__record__id__)||e.set(t.__record__id__,t)}))}return s.payload.records.forEach((t=>{const s=t.__old__id__||t.__record__id__,r=Object.assign({},t);delete r.__old__id__,e.set(s,r)})),Array.from(e.values())}return e}},w=t=>t.select(g.sliceName,(t=>t)),v=new class{constructor(){this.sliceName="hist::addedRecords"}reduce(t,e,s){switch(s.type){case h.RECORDS_ADDED:case h.RECORDS_COPIED:return(e||[]).concat(s.payload);case h.DATA_SAVED:case h.EDITION_CANCELED:return}return e}},N=t=>t.select(v.sliceName,(t=>t)),p=(t,e)=>{let s=(N(t)||[]).length;return e.map((t=>Object.assign(Object.assign({},t),{__record__id__:"NEW_"+s++})))},b=new class{constructor(){this.sliceName="hist::changes"}reduce(t,e,s){switch(s.type){case h.DATA_CHANGED:const r=s.payload.records||R(t);if(r){const t=new Map(e);return r.forEach((e=>{const r=Object.assign(Object.assign({},t.get(e)),s.payload);delete r.records,t.set(e,r)})),t}return e;case h.DATA_SAVED:case h.EDITION_CANCELED:return}return e}},T=t=>t.select(b.sliceName,(t=>t)),m=new class{constructor(){this.sliceName="currentRecords"}reduce(t,e,s){let r=w(t);const i=N(t);if(!r&&!i)return;i&&(r=(r||[]).concat(i));const n=E(t);n&&(r=r.filter((t=>!n.includes(t.__record__id__))));const c=T(t);return new Map(r.map((t=>{const e=t.__record__id__;return[e,Object.assign(Object.assign({},t),null==c?void 0:c.get(e))]})))}},M=t=>t.select(m.sliceName,(t=>t)),S=new class{constructor(){this.sliceName="hist::selection"}reduce(t,e,s){switch(s.type){case h.RECORDS_ADDED:case h.RECORDS_COPIED:return s.payload.map((t=>t.__record__id__));case h.DATA_SAVED:return function(t,e){const s=R(t);if(s){const t=[];return s.forEach((s=>{const r=e.find((t=>t.__old__id__===s));t.push(r?r.__record__id__:s)})),t}return s}(t,s.payload.records);case h.RECORDS_REMOVED:const r=s.payload;return e&&r?e.filter((t=>!r.includes(t))):e;case h.NEXT_SELECTED:case h.PREVIOUS_SELECTED:const i=M(t);if(i&&i.size>0){let t;if(t=e&&0!==e.length?A(e[0],i)+(s.type===h.PREVIOUS_SELECTED?-1:1):s.type===h.PREVIOUS_SELECTED?0:Math.min(1,i.size),t<i.size&&t>=0)return[Array.from(i.values())[t].__record__id__]}return;case h.SELECTION_CHANGED:const{type:n,selection:c}=s.payload;if(c&&"index"===n){const e=M(t);if(e){const t=Array.from(e.values()),s=[];return c.forEach((r=>{r>0&&r<e.size&&s.push(t[r].__record__id__)})),s}}return c}return e}},R=t=>{let e=t.select(S.sliceName,(t=>t));const s=Array.from((M(t)||new Map).keys());return e&&(e=e.filter((t=>s.includes(t)))),(!e||0===e.length)&&s&&s.length>0?[s[0]]:e};function A(t,e){return Array.from(e.keys()).indexOf(t)}var C,O,D,y,I=function(t,e,s,r){return new(s||(s=Promise))((function(i,n){function c(t){try{h(r.next(t))}catch(t){n(t)}}function a(t){try{h(r.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(c,a)}h((r=r.apply(t,e||[])).next())}))};class k{constructor(t){this._name=t,this._stateManager=new o([u,d,g,f,v,S,b,m]),this._observers=[],this._filterProviders=[],this._sortingProvider=void 0,this._interceptors=[]}get name(){return this._name}validateAndTypeValue(t,e){const s=this.getField(t);return s?c(s.dataType,e):e}getFilters(){let t;return this._filterProviders.forEach((e=>{const s=e.getFilter(this.name);s&&(t=(t||[]).concat(s))})),t}getSort(){return this._sortingProvider?this._sortingProvider.getSort(this._name):void 0}loadMetadata(){return I(this,void 0,void 0,(function*(){return this.dispatchAction(h.LOADING_METADATA),new Promise(((t,e)=>{this.metadataLoader&&this.metadataLoader(this).then((e=>{this.metadata=e,t(this.metadata)})).catch((t=>e(t)))}))}))}loadData(){return I(this,void 0,void 0,(function*(){return this.dispatchAction(h.LOADING_DATA),new Promise(((t,e)=>{if(this.dataLoader){const s=this.getSort(),r=this.getFilters();this.dataLoader(this,s,r).then((e=>{this.records=e,t(this.records)})).catch((t=>e(t)))}}))}))}saveData(){return I(this,void 0,void 0,(function*(){const t=((t,e)=>{const s=[],r=T(e),i=w(e);null==i||i.forEach((e=>{if(r){const i=r.get(e.__record__id__);i&&s.push(new U(t,e,i,C.UPDATE))}}));const n=N(e);n&&n.forEach((e=>{s.push(new U(t,e,null==r?void 0:r.get(e.__record__id__),C.INSERT))}));const c=E(e),a={};return null==i||i.forEach((t=>a[t.__record__id__]=t)),c&&c.forEach((e=>{s.push(new U(t,a[e],void 0,C.DELETE))})),s})(this._name,this._stateManager);return t.length>0?(this.dispatchAction(h.SAVING_DATA),new Promise(((e,s)=>{this.saveLoader&&this.saveLoader(this,t).then((e=>this.dispatchAction(h.DATA_SAVED,{changes:t,records:e}))).catch((t=>s(t)))}))):Promise.resolve()}))}valueFromString(t,e){const s=this.getField(t);return s?c(s.dataType,e):e}addInterceptor(t){this._interceptors.push(t)}addFilterProvider(t){this._filterProviders.push(t)}set sortingProvider(t){this._sortingProvider=t}set metadata(t){this.dispatchAction(h.METADATA_LOADED,t)}get metadata(){return l(this._stateManager)}set records(t){this.dispatchAction(h.DATA_LOADED,t)}get records(){const t=M(this._stateManager);return t?Array.from(t.values()):[]}getField(t){return((t,e)=>{const s=l(this._stateManager);return s?s.fields.find((t=>t.name===e)):void 0})(0,t)}addRecord(){this.dispatchAction(h.RECORDS_ADDED,p(this._stateManager,[{}]))}copySelected(){const t=this.getSelectedRecords();t&&this.dispatchAction(h.RECORDS_COPIED,p(this._stateManager,t))}removeSelectedRecords(){const t=R(this._stateManager);t&&this.dispatchAction(h.RECORDS_REMOVED,t)}getFieldValue(t){return((t,e)=>{const s=R(t);if(s&&s.length>0){const r=M(t);if(r){const t=r.get(s[0]);return t?t[e]:void 0}}})(this._stateManager,t)}setFieldValue(t,e,s){const r=this.validateAndTypeValue(t,e);this.getFieldValue(t)!==r&&this.dispatchAction(h.DATA_CHANGED,{[t]:r,records:s})}getSelection(){return R(this._stateManager)}setSelection(t){this.dispatchAction(h.SELECTION_CHANGED,{type:"id",selection:t})}setSelectionByIndex(t){this.dispatchAction(h.SELECTION_CHANGED,{type:"index",selection:t})}getSelectedRecords(){const t=this.getSelection();if(t){const e=this.records;return null==e?void 0:e.filter((e=>t.includes(e.__record__id__)))}}nextRecord(){this.dispatchAction(h.NEXT_SELECTED)}previousRecord(){this.dispatchAction(h.PREVIOUS_SELECTED)}cancelEdition(){this.dispatchAction(h.EDITION_CANCELED)}isDirty(){return void 0!==N(t=this._stateManager)||void 0!==E(t)||void 0!==T(t);var t}hasNext(){return(t=>{const e=M(t);if(e){const s=t.select(S.sliceName,(t=>t));return s&&0!==s.length?e.size>A(s[0],e)+1:e.size>0}return!1})(this._stateManager)}hasPrevious(){return(t=>{const e=M(t);if(e){const s=t.select(S.sliceName,(t=>t));return!(!s||0===s.length)&&A(s[0],e)>0}return!1})(this._stateManager)}canUndo(){return this._stateManager.canUndo()}canRedo(){return this._stateManager.canRedo()}undo(){this.dispatchAction(h.CHANGE_UNDONE)}redo(){this.dispatchAction(h.CHANGE_REDONE)}toString(){return this.name}dispatchAction(t,e){var s;let r=new a(t,e);null===(s=this._interceptors)||void 0===s||s.forEach((t=>{r&&(r=t.interceptAction(r))})),r&&(this._stateManager.process(r),this._observers.forEach((t=>t(r))))}subscribe(t){this._observers.push(t)}unsubscribe(t){this._observers=this._observers.filter((e=>e!==t))}}!function(t){t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"}(C||(C={}));class U{constructor(t,e,s,r){this.dataUnit=t,this.record=e,this.updatingFields=s,this._operation=r}get operation(){return this._operation.toString()}isInsert(){return this._operation===C.INSERT}isDelete(){return this._operation===C.DELETE}isUpdate(){return this._operation===C.UPDATE}}!function(t){t.ASC="ASC",t.DESC="DESC"}(O||(O={})),function(t){t.SEARCHING="SEARCHING",t.REQUIREMENT="REQUIREMENT",t.VISIBILITY="REQUIREMENT"}(D||(D={})),function(t){t.FILE="FILE",t.IMAGE="IMAGE",t.DATE="DATE",t.DATETIME="DATETIME",t.TIME="TIME",t.ELAPSEDTIME="ELAPSEDTIME",t.CHECKBOX="CHECKBOX",t.SWITCH="SWITCH",t.OPTIONSELECTOR="OPTIONSELECTOR",t.DECIMALNUMBER="DECIMALNUMBER",t.INTEGERNUMBER="INTEGERNUMBER",t.SEARCH="SEARCH",t.SHORTTEXT="SHORTTEXT",t.PASSWORD="PASSWORD",t.MASKEDTEXT="MASKEDTEXT",t.LONGTEXT="LONGTEXT",t.HTML="HTML"}(y||(y={}));export{h as A,a as D,s as M,e as N,O as S,r as T,y as U,k as a,n as b}
|