@sankhyalabs/ezui 1.1.159 → 1.1.160

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/cjs/ez-combo-box.cjs.entry.js +62 -27
  2. package/dist/cjs/ez-date-input.cjs.entry.js +71 -25
  3. package/dist/cjs/ez-date-time-input.cjs.entry.js +94 -31
  4. package/dist/cjs/ez-filter-input.cjs.entry.js +10 -4
  5. package/dist/cjs/ez-form.cjs.entry.js +54 -9
  6. package/dist/cjs/ez-grid.cjs.entry.js +9 -6
  7. package/dist/cjs/ez-number-input.cjs.entry.js +69 -25
  8. package/dist/cjs/ez-search.cjs.entry.js +20 -5
  9. package/dist/cjs/ez-text-area.cjs.entry.js +8 -2
  10. package/dist/cjs/ez-text-input.cjs.entry.js +30 -21
  11. package/dist/cjs/ez-time-input.cjs.entry.js +75 -40
  12. package/dist/cjs/ezui.cjs.js +1 -1
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/collection/components/ez-combo-box/ez-combo-box.js +81 -28
  15. package/dist/collection/components/ez-date-input/ez-date-input.js +87 -25
  16. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +108 -31
  17. package/dist/collection/components/ez-filter-input/ez-filter-input.js +26 -4
  18. package/dist/collection/components/ez-form/DataBinder.js +12 -3
  19. package/dist/collection/components/ez-form/ez-form.js +43 -6
  20. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
  21. package/dist/collection/components/ez-grid/ez-grid.js +14 -7
  22. package/dist/collection/components/ez-number-input/ez-number-input.js +83 -25
  23. package/dist/collection/components/ez-search/ez-search.js +38 -5
  24. package/dist/collection/components/ez-text-area/ez-text-area.css +1 -1
  25. package/dist/collection/components/ez-text-area/ez-text-area.js +23 -1
  26. package/dist/collection/components/ez-text-input/ez-text-input.css +1 -1
  27. package/dist/collection/components/ez-text-input/ez-text-input.js +45 -38
  28. package/dist/collection/components/ez-time-input/ez-time-input.js +95 -59
  29. package/dist/custom-elements/index.js +504 -197
  30. package/dist/esm/ez-combo-box.entry.js +62 -27
  31. package/dist/esm/ez-date-input.entry.js +71 -25
  32. package/dist/esm/ez-date-time-input.entry.js +94 -31
  33. package/dist/esm/ez-filter-input.entry.js +10 -4
  34. package/dist/esm/ez-form.entry.js +54 -9
  35. package/dist/esm/ez-grid.entry.js +9 -6
  36. package/dist/esm/ez-number-input.entry.js +69 -25
  37. package/dist/esm/ez-search.entry.js +20 -5
  38. package/dist/esm/ez-text-area.entry.js +8 -2
  39. package/dist/esm/ez-text-input.entry.js +30 -21
  40. package/dist/esm/ez-time-input.entry.js +76 -41
  41. package/dist/esm/ezui.js +1 -1
  42. package/dist/esm/loader.js +1 -1
  43. package/dist/ezui/ezui.esm.js +1 -1
  44. package/dist/ezui/p-003d53b1.entry.js +1 -0
  45. package/dist/ezui/p-267fa515.entry.js +1 -0
  46. package/dist/ezui/p-2acf7d59.entry.js +1 -0
  47. package/dist/ezui/p-403de0a4.entry.js +1 -0
  48. package/dist/ezui/p-4c3d136c.entry.js +1 -0
  49. package/dist/ezui/p-53bbba8e.entry.js +1 -0
  50. package/dist/ezui/p-6668c3b0.entry.js +1 -0
  51. package/dist/ezui/p-7fd6deec.entry.js +1 -0
  52. package/dist/ezui/p-ad6cc559.entry.js +1 -0
  53. package/dist/ezui/{p-be87ac5e.entry.js → p-ae2fea4c.entry.js} +1 -1
  54. package/dist/ezui/p-ff7b4b13.entry.js +1 -0
  55. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +13 -7
  56. package/dist/types/components/ez-date-input/ez-date-input.d.ts +10 -3
  57. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +15 -7
  58. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +5 -1
  59. package/dist/types/components/ez-form/DataBinder.d.ts +1 -1
  60. package/dist/types/components/ez-form/ez-form.d.ts +1 -0
  61. package/dist/types/components/ez-grid/ez-grid.d.ts +4 -1
  62. package/dist/types/components/ez-number-input/ez-number-input.d.ts +14 -5
  63. package/dist/types/components/ez-search/ez-search.d.ts +6 -1
  64. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
  65. package/dist/types/components/ez-text-input/ez-text-input.d.ts +7 -6
  66. package/dist/types/components/ez-time-input/ez-time-input.d.ts +17 -13
  67. package/dist/types/components.d.ts +43 -20
  68. package/package.json +1 -1
  69. package/dist/ezui/p-1859a3d8.entry.js +0 -1
  70. package/dist/ezui/p-49fdfa4b.entry.js +0 -1
  71. package/dist/ezui/p-4fdceb7d.entry.js +0 -1
  72. package/dist/ezui/p-6d4b1628.entry.js +0 -1
  73. package/dist/ezui/p-8f4fac31.entry.js +0 -1
  74. package/dist/ezui/p-91377c65.entry.js +0 -1
  75. package/dist/ezui/p-b524dfca.entry.js +0 -1
  76. package/dist/ezui/p-bc8aa27f.entry.js +0 -1
  77. package/dist/ezui/p-ec21ecce.entry.js +0 -1
  78. package/dist/ezui/p-fc9b9487.entry.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as s,c as t,h as e,g as h}from"./p-139ed2f6.js";import{C as i}from"./p-933a7475.js";let r=class{constructor(e){s(this,e),this.ezChange=t(this,"ezChange",7),this.showPopup=t(this,"showPopup",7),this.enabled=!0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.mode="regular"}observeErrorMessage(){this._comboElement&&(this._comboElement.errorMessage=this.errorMessage)}observeValue(){this._comboElement&&(this._comboElement.value=this.value)}async setFocus(){this._comboElement.setFocus()}async setBlur(){this._comboElement.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}onComboChange(s){s.stopPropagation(),this.value=s.detail,this.ezChange.emit(s.detail),this.errorMessage!==this._comboElement.errorMessage&&(this.errorMessage=this._comboElement.errorMessage)}componentDidLoad(){i.applyVarsTextInput(this._elem,this._comboElement)}render(){return e("ez-combo-box",{ref:s=>this._comboElement=s,value:this.value,label:this.label,enabled:this.enabled,errorMessage:this.errorMessage,optionLoader:this.optionLoader,searchMode:!0,onEzChange:s=>this.onComboChange(s),showSelectedValue:this.showSelectedValue,showOptionValue:this.showOptionValue,suppressEmptyOption:this.suppressEmptyOption,mode:this.mode})}get _elem(){return h(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"]}}};r.style=":host{width:100%}";export{r as ez_search}
@@ -1,7 +1,6 @@
1
1
  import { EventEmitter } from "../../stencil-public-runtime";
2
2
  export declare class EzComboBox {
3
- private el;
4
- private _inputElement;
3
+ private _textInput;
5
4
  private _optionsList;
6
5
  private _listContainer;
7
6
  private _listWrapper;
@@ -14,6 +13,7 @@ export declare class EzComboBox {
14
13
  private _maxWidthValue;
15
14
  private _tabPressed;
16
15
  private _textEmptyList;
16
+ private el;
17
17
  private _preSelection;
18
18
  private _visibleOptions;
19
19
  private _startLoading;
@@ -59,10 +59,6 @@ export declare class EzComboBox {
59
59
  * Função responsável por carregar as opções dinamicamente
60
60
  */
61
61
  optionLoader: Function;
62
- /**
63
- * Evento que é disparado ao alterar o valor do componente
64
- */
65
- ezChange: EventEmitter<Option>;
66
62
  /**
67
63
  * Remove a opção vazia da lista de opções
68
64
  */
@@ -75,7 +71,12 @@ export declare class EzComboBox {
75
71
  * Define o modo do tamanho do campo; opções: slim e regular.
76
72
  */
77
73
  mode: string;
78
- private observeValue;
74
+ /**
75
+ * Evento que é disparado ao alterar o valor do componente
76
+ */
77
+ ezChange: EventEmitter<Option>;
78
+ observeErrorMessage(): void;
79
+ observeValue(newValue: Option | string, oldValue: Option | string): void;
79
80
  /**
80
81
  * Realiza o foco no componente de seleção
81
82
  */
@@ -84,6 +85,10 @@ export declare class EzComboBox {
84
85
  * Remove o foco no componente de seleção
85
86
  */
86
87
  setBlur(): Promise<void>;
88
+ /**
89
+ * Retorna informando se o campo está inválido (true | false)
90
+ */
91
+ isInvalid(): Promise<boolean>;
87
92
  private getText;
88
93
  private getSelectedOption;
89
94
  private updateVisibleOptions;
@@ -102,6 +107,7 @@ export declare class EzComboBox {
102
107
  private selectOption;
103
108
  private loadOptions;
104
109
  private cancelPreselection;
110
+ private setInputValue;
105
111
  private clearSearch;
106
112
  private controlListWithOnlyOne;
107
113
  private controlEmptySearch;
@@ -3,6 +3,7 @@ import { WaitingChange } from '@sankhyalabs/core';
3
3
  export declare class EzDateInput {
4
4
  private _calendar;
5
5
  private _textInput;
6
+ private _focused;
6
7
  private _elem;
7
8
  /**
8
9
  * Evento disparado ao mudar o estado do componente(onEzChange).
@@ -48,12 +49,18 @@ export declare class EzDateInput {
48
49
  * Remove o foco no componente de data
49
50
  */
50
51
  setBlur(): Promise<void>;
51
- changeValue(newValue: Date): void;
52
+ /**
53
+ * Retorna informando se o campo está inválido (true | false)
54
+ */
55
+ isInvalid(): Promise<boolean>;
56
+ private changeValue;
52
57
  private showCalendar;
53
58
  private hideCalendar;
54
- private parseDate;
59
+ private handleBlur;
55
60
  private getTextValue;
56
- private startChange;
61
+ private handleInput;
62
+ private validateValue;
63
+ private setInputValue;
57
64
  componentDidLoad(): void;
58
65
  render(): any;
59
66
  }
@@ -3,6 +3,7 @@ import { WaitingChange } from '@sankhyalabs/core';
3
3
  export declare class EzDateTimeInput {
4
4
  private _calendar;
5
5
  private _textInput;
6
+ private _focused;
6
7
  private _elem;
7
8
  /**
8
9
  * Evento disparado ao mudar o estado do componente(onEzChange).
@@ -43,7 +44,7 @@ export declare class EzDateTimeInput {
43
44
  mode: string;
44
45
  observeLabel(): void;
45
46
  observeErrorMessage(): void;
46
- observeValue(): void;
47
+ observeValue(newValue: Date, oldValue: Date): void;
47
48
  /**
48
49
  * Realiza o foco no componente de datetime
49
50
  */
@@ -52,14 +53,21 @@ export declare class EzDateTimeInput {
52
53
  * Remove o foco no componente de datetime
53
54
  */
54
55
  setBlur(): Promise<void>;
55
- onChangeKeyDown(ev: any): void;
56
- onFocused(): void;
57
- onClicked(): void;
58
- changeValue(newValue: Date): void;
56
+ /**
57
+ * Retorna informando se o campo está inválido (true | false)
58
+ */
59
+ isInvalid(): Promise<boolean>;
60
+ private handleKeyDown;
61
+ private handleFocus;
62
+ private handleClick;
63
+ private changeValue;
59
64
  private showCalendar;
60
- private parseDate;
65
+ private getParsedDateTime;
66
+ private handleBlur;
61
67
  private getTextValue;
62
- private startChange;
68
+ private validateValue;
69
+ private handleInput;
70
+ private setInputValue;
63
71
  componentDidLoad(): void;
64
72
  render(): any;
65
73
  }
@@ -37,7 +37,7 @@ export declare class EzFilterInput {
37
37
  mode: string;
38
38
  observeLabel(): void;
39
39
  observeErrorMessage(): void;
40
- observeValue(): void;
40
+ observeValue(newValue: string, oldValue: string): void;
41
41
  /**
42
42
  * Realiza o foco no componente de input
43
43
  */
@@ -46,6 +46,10 @@ export declare class EzFilterInput {
46
46
  * Remove o foco no componente de input
47
47
  */
48
48
  setBlur(): Promise<void>;
49
+ /**
50
+ * Retorna informando se o campo está inválido (true | false)
51
+ */
52
+ isInvalid(): Promise<boolean>;
49
53
  changeValue(evt: CustomEvent<string>): void;
50
54
  componentDidLoad(): void;
51
55
  render(): any;
@@ -5,7 +5,7 @@ export default class DataBinder {
5
5
  constructor(dataUnit: DataUnit);
6
6
  bind(fields: Array<HTMLElement>): void;
7
7
  onDisconnectedCallback(): void;
8
- updateValue(fieldName: string, field: HTMLElement): void;
8
+ updateValue(fieldName: string, field: HTMLElement, actionCanceled?: boolean): void;
9
9
  private updateBind;
10
10
  private changeStarted;
11
11
  private cancelWaitingChange;
@@ -15,6 +15,7 @@ export declare class EzForm implements DUActionInterceptor {
15
15
  cancel(): Promise<void>;
16
16
  validate(): Promise<void>;
17
17
  observeConfig(): void;
18
+ private validateError;
18
19
  private validateRequired;
19
20
  private getDynamicContent;
20
21
  private processMetadata;
@@ -130,6 +130,10 @@ export declare class EzGrid implements PageableComponent {
130
130
  * Método para verificar se existem registros anteriores.
131
131
  */
132
132
  hasPreviousRecord(): Promise<boolean>;
133
+ /**
134
+ * Método para abrir a configuração da grid.
135
+ */
136
+ openGridConfig(): Promise<void>;
133
137
  componentWillLoad(): void;
134
138
  onColumnStateChange(type: string, state: Array<EzGridColumn>, info: any): void;
135
139
  private createConfigFromState;
@@ -138,6 +142,5 @@ export declare class EzGrid implements PageableComponent {
138
142
  getPaginationControl(): Array<HTMLElement>;
139
143
  observeConfig(config: EzGridConfig): void;
140
144
  closeGridConfig(): void;
141
- openGridConfig(): void;
142
145
  render(): any;
143
146
  }
@@ -1,8 +1,9 @@
1
1
  import { WaitingChange } from "@sankhyalabs/core";
2
2
  import { EventEmitter } from "../../stencil-public-runtime";
3
3
  export declare class EzNumberInput {
4
- private _elem;
5
4
  private _textInput;
5
+ private _focused;
6
+ private _elem;
6
7
  /**
7
8
  * Evento disparado quando o estado do componente é alterado (onEzChange).
8
9
  */
@@ -58,13 +59,21 @@ export declare class EzNumberInput {
58
59
  * Remove o foco no componente de input
59
60
  */
60
61
  setBlur(): Promise<void>;
62
+ /**
63
+ * Retorna informando se o campo está inválido (true | false)
64
+ */
65
+ isInvalid(): Promise<boolean>;
61
66
  observeLabel(): void;
62
67
  observeErrorMessage(): void;
63
- observeValue(): void;
64
- changeValue(newValue: number): boolean;
65
- private parseNumber;
68
+ observeValue(newValue: number, oldValue: number): void;
69
+ private validateValue;
66
70
  private getTextValue;
67
- private startChange;
71
+ private changeValue;
72
+ private setError;
73
+ private handleBlur;
74
+ private handleInput;
75
+ private getParsedNumber;
76
+ private setInputValue;
68
77
  componentDidLoad(): void;
69
78
  render(): any;
70
79
  }
@@ -47,6 +47,7 @@ export declare class EzSearch {
47
47
  * Define o modo do tamanho do campo; opções: slim e regular.
48
48
  */
49
49
  mode: string;
50
+ observeErrorMessage(): void;
50
51
  observeValue(): void;
51
52
  /**
52
53
  * Realiza o foco no componente de pesquisa
@@ -56,7 +57,11 @@ export declare class EzSearch {
56
57
  * Remove o foco no componente de pesquisa
57
58
  */
58
59
  setBlur(): Promise<void>;
59
- onComboChange(evt: any): void;
60
+ /**
61
+ * Retorna informando se o campo está inválido (true | false)
62
+ */
63
+ isInvalid(): Promise<boolean>;
64
+ onComboChange(event: any): void;
60
65
  componentDidLoad(): void;
61
66
  render(): any;
62
67
  }
@@ -54,6 +54,10 @@ export declare class EzTextArea {
54
54
  * Remove o foco no componente de input
55
55
  */
56
56
  setBlur(): Promise<void>;
57
+ /**
58
+ * Retorna informando se o campo está inválido (true | false)
59
+ */
60
+ isInvalid(): Promise<boolean>;
57
61
  private canChangeValue;
58
62
  private adjustFloatingLabel;
59
63
  private isFocused;
@@ -48,15 +48,12 @@ export declare class EzTextInput {
48
48
  * Define o modo do tamanho do campo; opções: slim e regular.
49
49
  */
50
50
  mode: string;
51
- /**
52
- * Define se o controle de change do value será controlado por um componente pai.
53
- */
54
- slaveMode: boolean;
55
51
  observeErrorMessage(): void;
56
52
  observeMask(): void;
57
53
  observeValue(newValue: string, oldValue: string): void;
58
- adjustFloatingLabel(): void;
59
- isFocused(): boolean;
54
+ private adjustFloatingLabel;
55
+ private isFocused;
56
+ private isSlaveMode;
60
57
  private adjustColorContentSlot;
61
58
  /**
62
59
  * Faz o foco no componente de input
@@ -66,6 +63,10 @@ export declare class EzTextInput {
66
63
  * Remove o foco no componente de input
67
64
  */
68
65
  setBlur(): Promise<void>;
66
+ /**
67
+ * Retorna informando se o campo está inválido (true | false)
68
+ */
69
+ isInvalid(): Promise<boolean>;
69
70
  handleFocusout(): void;
70
71
  isValidValue(value: string): boolean;
71
72
  controlChangeValue(): void;
@@ -1,18 +1,14 @@
1
1
  import { EventEmitter } from "../../stencil-public-runtime";
2
2
  import { WaitingChange } from "@sankhyalabs/core";
3
3
  export declare class EzTimeInput {
4
- private _elem;
5
- private _inputElem;
4
+ private _textInput;
6
5
  private _maskFormatter;
7
- private _oldViewValue;
6
+ private _viewValue;
7
+ private _elem;
8
8
  /**
9
9
  * Título do campo
10
10
  */
11
11
  label: string;
12
- /**
13
- * Valor digitado pelo usuário. Este valor é o que fica visível no campo.
14
- */
15
- viewValue: string;
16
12
  /**
17
13
  * Valor que será transmitido para o back-end.
18
14
  */
@@ -22,11 +18,11 @@ export declare class EzTimeInput {
22
18
  */
23
19
  enabled: boolean;
24
20
  /**
25
- * Quando há um problema de validação, serve como orientação ao usuário
21
+ * Quando há um problema de validação, serve como orientação ao usuário.
26
22
  */
27
23
  errorMessage: string;
28
24
  /**
29
- * Define se o componente irá ou não considerar os segundos
25
+ * Define se o componente irá ou não considerar os segundos.
30
26
  */
31
27
  showSeconds: boolean;
32
28
  /**
@@ -46,9 +42,14 @@ export declare class EzTimeInput {
46
42
  * completar a alteração, esse evento é disparado.
47
43
  */
48
44
  ezCancelWaitingChange: EventEmitter<void>;
45
+ observeErrorMessage(): void;
49
46
  observeShowSeconds(): void;
50
- observeValue(): void;
47
+ observeValue(newValue: number, oldValue: number): void;
51
48
  private prepareMask;
49
+ private validateValue;
50
+ private setError;
51
+ getViewValue(): string;
52
+ prepareValue(value: string): void;
52
53
  /**
53
54
  * Faz o foco no componente de input
54
55
  */
@@ -57,9 +58,12 @@ export declare class EzTimeInput {
57
58
  * Remove o foco no componente de input
58
59
  */
59
60
  setBlur(): Promise<void>;
60
- handleFocusout(): void;
61
- prepareValue(value: string): void;
62
- handleChange(): void;
61
+ /**
62
+ * Retorna informando se o campo está inválido (true | false)
63
+ */
64
+ isInvalid(): Promise<boolean>;
65
+ handleBlur(): void;
66
+ handleInput(): void;
63
67
  componentDidLoad(): void;
64
68
  componentWillLoad(): void;
65
69
  render(): any;
@@ -179,6 +179,10 @@ export namespace Components {
179
179
  * Quando há um problema de validação, serve como orientação ao usuário
180
180
  */
181
181
  "errorMessage": string;
182
+ /**
183
+ * Retorna informando se o campo está inválido (true | false)
184
+ */
185
+ "isInvalid": () => Promise<boolean>;
182
186
  /**
183
187
  * Título do campo
184
188
  */
@@ -237,6 +241,10 @@ export namespace Components {
237
241
  * Quando há um problema de validação, serve como orientação ao usuário
238
242
  */
239
243
  "errorMessage": string;
244
+ /**
245
+ * Retorna informando se o campo está inválido (true | false)
246
+ */
247
+ "isInvalid": () => Promise<boolean>;
240
248
  /**
241
249
  * Título do campo
242
250
  */
@@ -267,6 +275,10 @@ export namespace Components {
267
275
  * Quando há um problema de validação, serve como orientação ao usuário
268
276
  */
269
277
  "errorMessage": string;
278
+ /**
279
+ * Retorna informando se o campo está inválido (true | false)
280
+ */
281
+ "isInvalid": () => Promise<boolean>;
270
282
  /**
271
283
  * Título do campo
272
284
  */
@@ -335,6 +347,10 @@ export namespace Components {
335
347
  * Quando há um problema de validação, serve como orientação ao usuário
336
348
  */
337
349
  "errorMessage": string;
350
+ /**
351
+ * Retorna informando se o campo está inválido (true | false)
352
+ */
353
+ "isInvalid": () => Promise<boolean>;
338
354
  /**
339
355
  * Título do campo
340
356
  */
@@ -429,6 +445,9 @@ export namespace Components {
429
445
  * Método para navegar para o proxímo registro da grid.
430
446
  */
431
447
  "nextRecord": () => Promise<void>;
448
+ /**
449
+ * Método para abrir a configuração da grid.
450
+ */
432
451
  "openGridConfig": () => Promise<void>;
433
452
  /**
434
453
  * Determina o número de linhas de cada página. Caso informado o valor -1 não haverá paginação.
@@ -558,6 +577,10 @@ export namespace Components {
558
577
  * Quando há um problema de validação, serve como orientação ao usuário
559
578
  */
560
579
  "errorMessage": string;
580
+ /**
581
+ * Retorna informando se o campo está inválido (true | false)
582
+ */
583
+ "isInvalid": () => Promise<boolean>;
561
584
  /**
562
585
  * Título do campo
563
586
  */
@@ -660,6 +683,10 @@ export namespace Components {
660
683
  * Quando há um problema de validação, serve como orientação ao usuário
661
684
  */
662
685
  "errorMessage": string;
686
+ /**
687
+ * Retorna informando se o campo está inválido (true | false)
688
+ */
689
+ "isInvalid": () => Promise<boolean>;
663
690
  /**
664
691
  * Título do campo
665
692
  */
@@ -724,6 +751,10 @@ export namespace Components {
724
751
  * Quando há um problema de validação, serve como orientação ao usuário
725
752
  */
726
753
  "errorMessage": string;
754
+ /**
755
+ * Retorna informando se o campo está inválido (true | false)
756
+ */
757
+ "isInvalid": () => Promise<boolean>;
727
758
  /**
728
759
  * Título do campo
729
760
  */
@@ -766,6 +797,10 @@ export namespace Components {
766
797
  * Quando há um problema de validação, serve como orientação ao usuário
767
798
  */
768
799
  "errorMessage": string;
800
+ /**
801
+ * Retorna informando se o campo está inválido (true | false)
802
+ */
803
+ "isInvalid": () => Promise<boolean>;
769
804
  /**
770
805
  * Título do campo
771
806
  */
@@ -794,10 +829,6 @@ export namespace Components {
794
829
  * Faz o foco no componente de input
795
830
  */
796
831
  "setFocus": () => Promise<void>;
797
- /**
798
- * Define se o controle de change do value será controlado por um componente pai.
799
- */
800
- "slaveMode": boolean;
801
832
  /**
802
833
  * Valor digitado pelo usuário. Este valor é o que fica visível no campo.
803
834
  */
@@ -809,9 +840,13 @@ export namespace Components {
809
840
  */
810
841
  "enabled": boolean;
811
842
  /**
812
- * Quando há um problema de validação, serve como orientação ao usuário
843
+ * Quando há um problema de validação, serve como orientação ao usuário.
813
844
  */
814
845
  "errorMessage": string;
846
+ /**
847
+ * Retorna informando se o campo está inválido (true | false)
848
+ */
849
+ "isInvalid": () => Promise<boolean>;
815
850
  /**
816
851
  * Título do campo
817
852
  */
@@ -829,17 +864,13 @@ export namespace Components {
829
864
  */
830
865
  "setFocus": () => Promise<void>;
831
866
  /**
832
- * Define se o componente irá ou não considerar os segundos
867
+ * Define se o componente irá ou não considerar os segundos.
833
868
  */
834
869
  "showSeconds": boolean;
835
870
  /**
836
871
  * Valor que será transmitido para o back-end.
837
872
  */
838
873
  "value": number;
839
- /**
840
- * Valor digitado pelo usuário. Este valor é o que fica visível no campo.
841
- */
842
- "viewValue": string;
843
874
  }
844
875
  interface EzToast {
845
876
  /**
@@ -1853,10 +1884,6 @@ declare namespace LocalJSX {
1853
1884
  * Restringe o que o usuário pode digitar. Cada caractere digitado será testado e deve estar contido nessa string ou será descartado.
1854
1885
  */
1855
1886
  "restrict"?: string;
1856
- /**
1857
- * Define se o controle de change do value será controlado por um componente pai.
1858
- */
1859
- "slaveMode"?: boolean;
1860
1887
  /**
1861
1888
  * Valor digitado pelo usuário. Este valor é o que fica visível no campo.
1862
1889
  */
@@ -1868,7 +1895,7 @@ declare namespace LocalJSX {
1868
1895
  */
1869
1896
  "enabled"?: boolean;
1870
1897
  /**
1871
- * Quando há um problema de validação, serve como orientação ao usuário
1898
+ * Quando há um problema de validação, serve como orientação ao usuário.
1872
1899
  */
1873
1900
  "errorMessage"?: string;
1874
1901
  /**
@@ -1892,17 +1919,13 @@ declare namespace LocalJSX {
1892
1919
  */
1893
1920
  "onEzStartChange"?: (event: CustomEvent<WaitingChange>) => void;
1894
1921
  /**
1895
- * Define se o componente irá ou não considerar os segundos
1922
+ * Define se o componente irá ou não considerar os segundos.
1896
1923
  */
1897
1924
  "showSeconds"?: boolean;
1898
1925
  /**
1899
1926
  * Valor que será transmitido para o back-end.
1900
1927
  */
1901
1928
  "value"?: number;
1902
- /**
1903
- * Valor digitado pelo usuário. Este valor é o que fica visível no campo.
1904
- */
1905
- "viewValue"?: string;
1906
1929
  }
1907
1930
  interface EzToast {
1908
1931
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/ezui",
3
- "version": "1.1.159",
3
+ "version": "1.1.160",
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,c as i,h as e,H as o,g as r}from"./p-139ed2f6.js";import{MaskFormatter as n}from"@sankhyalabs/core";let a=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.enabled=!0,this.canShowError=!0,this.mode="regular",this.slaveMode=!1}observeErrorMessage(){var t,i;this._inputElem&&("string"==typeof this.errorMessage&&""!==this.errorMessage?(this._inputElem.classList.add("hasError"),null===(t=this._messageBoxElem)||void 0===t||t.classList.add("hasError")):(this._inputElem.classList.remove("hasError"),null===(i=this._messageBoxElem)||void 0===i||i.classList.remove("hasError")))}observeMask(){this.mask&&(null==this._maskFormatter?this._maskFormatter=new n(this.mask):this._maskFormatter.mask=this.mask)}observeValue(t,i){if(this._inputElem&&t!=i){if(this._inputElem.value=this.value||"",this.handleChange(),this.adjustFloatingLabel(),this.slaveMode)return;this.errorMessage="",this.ezChange.emit(this.value)}}adjustFloatingLabel(){if(this.label&&this._labelElem){this._inputElem&&!this._inputElem.classList.contains("input--with--label")&&this._inputElem.classList.add("input--with--label");const t=this.value&&this.value.toString().length>0,i=this._labelElem.classList.contains("input__label--floated");t||this.isFocused()?i||this._labelElem.classList.add("input__label--floated"):i&&this._labelElem.classList.remove("input__label--floated")}}isFocused(){return null!==this._hostElement.shadowRoot.activeElement}adjustColorContentSlot(t=""){this._contentLeftSlot&&(this._contentLeftSlot.style.color=t)}async setFocus(){this._inputElem.focus()}async setBlur(){this._inputElem.blur()}handleFocusout(){const t=this._inputElem.value;if(t&&this._maskFormatter)try{this._inputElem.value=this._maskFormatter.format(t)}catch(t){this.errorMessage=t.message}this.controlChangeValue(),this.adjustFloatingLabel(),this.adjustColorContentSlot()}isValidValue(t){return!this.restrict||Array.from(t).reduce(((t,i)=>t&&this.restrict.indexOf(i)>-1),!0)}controlChangeValue(){(this.value||"")!==this._inputElem.value&&(this.value=this._inputElem.value)}handleChange(){if(!this._inputElem)return;const t=this._inputElem.value;this.isValidValue(t)?this._lastValidValue=t:this._inputElem.value=null==this._lastValidValue?"":this._lastValidValue,this.controlChangeValue()}handleSlotChange(t){const i=t.target,e=i.assignedElements()[0];e&&(e.style.position="absolute",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.overflow="hidden",e.style.top="0px",e.style.width="var(--ez-text-input__icon--width)",e.style.height="slim"!=this.mode?"var(--ez-text-input--height)":"var(--ez-text-input--height--slim)","leftIcon"==i.name?(e.style.left="0px",e.style.borderRadius="var(--ez-text-input--border-radius) 0 0 var(--ez-text-input--border-radius)",this._inputElem.classList.add("icon--left"),this._labelElem&&this._labelElem.classList.add("input__label--left"),this._contentLeftSlot=e):"rightIcon"==i.name&&(e.style.right="0px",e.style.borderRadius="0 var(--ez-text-input--border-radius) var(--ez-text-input--border-radius) 0",this._inputElem.classList.add("icon--right"),this._labelElem&&this._labelElem.classList.add("input__label--right"))),this.observeErrorMessage()}doFocus(){this.label&&this._labelElem&&!this._labelElem.classList.contains("input__label--floated")&&this._labelElem.classList.add("input__label--floated"),this.adjustColorContentSlot("var(--ez-text-input__input--focus--border-color)")}componentDidLoad(){this.observeErrorMessage(),this.observeMask(),this.adjustFloatingLabel()}componentWillLoad(){if(this.observeMask(),this.value){if(this._maskFormatter)try{this.value=this._maskFormatter.format(this.value)}catch(t){this.errorMessage=t.message}this.isValidValue(this.value)||(this._lastValidValue="",this.value="")}}render(){return e(o,null,e("slot",{name:"leftIcon",onSlotchange:t=>{this.handleSlotChange(t)}}),this.label&&"slim"!=this.mode?e("label",{ref:t=>this._labelElem=t,class:this.enabled?"input__label":"input__label input__label--disabled",onClick:()=>this._inputElem.focus(),title:this.label},this.label):null,e("input",{onFocus:()=>this.doFocus(),ref:t=>this._inputElem=t,type:"text",class:"slim"==this.mode?"input--slim":"",placeholder:"slim"==this.mode&&this.label?this.label:"",value:this.value,disabled:!this.enabled,onInput:()=>{this.handleChange()},onFocusout:()=>{this.handleFocusout()}}),e("slot",{name:"rightIcon",onSlotchange:t=>{this.handleSlotChange(t)}}),this.canShowError&&"slim"!=this.mode&&e("span",{class:"message-box",ref:t=>this._messageBoxElem=t,title:this.errorMessage},this.errorMessage))}get _hostElement(){return r(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],mask:["observeMask"],value:["observeValue"]}}};a.style=":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--height--slim:32px;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #2B3A54);--ez-text-input__input--background-color:var(--background--medium, #e0e0e0);--ez-text-input__input--border:var(--border--medium, 2px solid);--ez-text-input__input--border-color:var(--ez-text-input__input--background-color);--ez-text-input__input--focus--border-color:var(--color--primary, #008561);--ez-text-input__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-text-input__input--disabled--color:var(--text--disable, #AFB6C0);--ez-text-input__input--error--border-color:#CC2936;--ez-text-input__message_box--font-size:var(--text--small, 12px);--ez-text-input__message_box--info--color:var(--color--success, #22085d);--ez-text-input__message_box--error--color:var(--color--error, #FF0000);--ez-text-input__label--floating--top:6px;--ez-text-input__label--padding-top:12px;--ez-text-input__label--padding-left:14px;--ez-text-input__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--ez-text-input--width)}input{width:100%;box-sizing:border-box;padding:var(--space--medium, 6px);font-weight:var(--text-weight--large, 600);height:var(--ez-text-input--height);border-radius:var(--ez-text-input--border-radius);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);border:var(--ez-text-input__input--border);border-color:var(--ez-text-input__input--border-color);background-color:var(--ez-text-input__input--background-color);color:var(--ez-text-input--color)}input:disabled{background-color:var(--ez-text-input__input--disabled--background-color);color:var(--ez-text-input__input--disabled--color)}input:focus{outline:none;border-color:var(--ez-text-input__input--focus--border-color)}input.icon--left{padding-left:var(--ez-text-input__icon--width)}input.icon--right{padding-right:var(--ez-text-input__icon--width)}input.hasError{color:var(--ez-text-input--color);border-color:var(--ez-text-input__input--error--border-color)}input:disabled.hasError{color:var(--ez-text-input__input--disabled--color)}input.text--right{text-align:right}input:read-only{cursor:default}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input__message_box--font-size);color:var(--ez-text-input__message_box--info--color)}.hasError{color:var(--ez-text-input__message_box--error--color)}.input__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--ez-text-input__label--padding-right));left:var(--ez-text-input--space--medium);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color);top:var(--ez-text-input__label--padding-top);left:var(--ez-text-input__label--padding-left);padding-right:var(--ez-text-input__label--padding-right)}.input__label--floated{font-family:var(--ez-text-input--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--ez-text-input__label--floating--top)}.input__label--disabled{color:var(--ez-text-input__input--disabled--color)}.input__label--left{text-align:left;left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--right{right:var(--ez-text-input__icon--width);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--left.input__label--right{left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width) * 2)}.input--with--label{padding-bottom:0}.input--slim{padding-top:var(--space--small, 3px);padding-bottom:var(--space--small, 3px);height:var(--ez-text-input--height--slim)}.input--slim::-webkit-input-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:-moz-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim::-moz-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:-ms-input-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim::placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:disabled::-webkit-input-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled:-moz-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled::-moz-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled:-ms-input-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled::placeholder{color:var(--ez-text-input__input--disabled--color)}";export{a as ez_text_input}
@@ -1 +0,0 @@
1
- import{r as t,c as e,h as i,H as a,g as s}from"./p-139ed2f6.js";import{DateUtils as r}from"@sankhyalabs/core";import{C as o}from"./p-933a7475.js";let n=class{constructor(i){t(this,i),this.ezChange=e(this,"ezChange",7),this.ezStartChange=e(this,"ezStartChange",7),this.ezCancelWaitingChange=e(this,"ezCancelWaitingChange",7),this.enabled=!0,this.mode="regular"}observeLabel(){this._textInput.label=this.label}observeErrorMessage(){this._textInput&&(this._textInput.errorMessage=this.errorMessage)}observeValue(t,e){t!=e&&this._textInput&&(this.errorMessage="",this._textInput.value=this.getTextValue(this.value))}async setFocus(){this._textInput.setFocus()}async setBlur(){this._textInput.setBlur()}changeValue(t){var e;t=t instanceof Date?r.clearTime(t):void 0,this.value=this.value instanceof Date?r.clearTime(this.value):void 0,this._textInput.errorMessage="",(null==t?void 0:t.toString())!==(null===(e=this.value)||void 0===e?void 0:e.toString())&&(this.value=t,this.ezChange.emit(this.value))}showCalendar(){this.parseDate(),this._calendar.value=this.value,this._calendar.fitVertical(this._textInput.errorMessage||"slim"==this.mode?0:-19,this._elem.clientHeight)}hideCalendar(){this.changeValue(this._calendar.value),this._calendar.hide()}parseDate(){const t=this._textInput.value,e=r.strToDate(t);e||!t?this.changeValue(this.value===e?this.value:e):(this.ezCancelWaitingChange.emit(),this._textInput.errorMessage="O valor digitado não é uma data válida")}getTextValue(t){return t?new Intl.DateTimeFormat("pt-BR").format(t):void 0}startChange(){this.ezStartChange.emit({waitmessage:"",blocking:!1})}componentDidLoad(){o.applyVarsTextInput(this._elem,this._textInput)}render(){return i(a,null,i("ez-text-input",{ref:t=>this._textInput=t,onBlur:()=>this.parseDate(),onKeyDown:t=>{"H"!==t.key&&"h"!==t.key||this.changeValue(new Date)},label:this.label,value:this.getTextValue(this.value),onInput:()=>this.startChange(),restrict:"0123456789/",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,slaveMode:!0},i("button",{disabled:!this.enabled,tabindex:-1,class:"btn-open-cal",onClick:()=>this.showCalendar(),slot:"leftIcon"})),i("ez-calendar",{onEzChange:t=>{this.hideCalendar(),t.stopPropagation()},floating:!0,ref:t=>this._calendar=t}))}get _elem(){return s(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};n.style=':host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>\')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:unset}.btn-open-cal::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}';export{n as ez_date_input}
@@ -1 +0,0 @@
1
- import{r as s,c as t,h as i,H as e,g as h}from"./p-139ed2f6.js";import{MaskFormatter as r,TimeFormatter as a,NumberUtils as o}from"@sankhyalabs/core";import{C as n}from"./p-933a7475.js";let l=class{constructor(i){s(this,i),this.ezChange=t(this,"ezChange",7),this.ezStartChange=t(this,"ezStartChange",7),this.ezCancelWaitingChange=t(this,"ezCancelWaitingChange",7),this.enabled=!0,this.showSeconds=!1,this.mode="regular"}observeShowSeconds(){this.prepareMask(this.showSeconds?"##:##:##":"##:##")}observeValue(){isNaN(this.value)&&(this.value=void 0)}prepareMask(s){null==this._maskFormatter?this._maskFormatter=new r(s):this._maskFormatter.mask=s}async setFocus(){this._inputElem.setFocus()}async setBlur(){this._inputElem.setBlur()}handleFocusout(){if(this.errorMessage="",this.prepareValue(this.viewValue),this.viewValue&&!a.validateTime(this.viewValue,this.showSeconds))this._oldViewValue=this.viewValue,this.ezCancelWaitingChange.emit(),this.errorMessage="Favor inserir um horário válido.";else{if(this.viewValue===this._oldViewValue)return void this.ezCancelWaitingChange.emit();this._oldViewValue=this.viewValue,"00:00"===this.viewValue&&null==this.value&&(this.value=0),this.ezChange.emit(this.value)}}prepareValue(s){try{this.viewValue=a.prepareValue(s,this.showSeconds)}catch(s){this.errorMessage=s.message}}handleChange(){this.ezStartChange.emit({waitmessage:"",blocking:!1}),this.viewValue=this._inputElem.value,this.value=o.stringToNumber(this.viewValue.replace(/\D/g,""))}componentDidLoad(){this.observeValue(),n.applyVarsTextInput(this._elem,this._inputElem)}componentWillLoad(){this.observeShowSeconds(),this.value?this.prepareValue(this.value.toString()):this.viewValue&&this.prepareValue(this.viewValue)}render(){return i(e,null,i("ez-text-input",{ref:s=>this._inputElem=s,value:this.viewValue,enabled:this.enabled,label:this.label,restrict:"0123456789:",onInput:()=>{this.handleChange()},onFocusout:()=>{this.handleFocusout()},errorMessage:this.errorMessage,mode:this.mode,slaveMode:!0},i("ez-icon",{slot:"leftIcon",iconName:"timer-outline"})))}static get assetsDirs(){return["../assets"]}get _elem(){return h(this)}static get watchers(){return{showSeconds:["observeShowSeconds"],value:["observeValue"]}}};l.style=":host{display:flex;flex-wrap:wrap;position:relative;width:100%}";export{l as ez_time_input}
@@ -1 +0,0 @@
1
- import{r as s,c as t,h as e,g as h}from"./p-139ed2f6.js";import{C as i}from"./p-933a7475.js";let o=class{constructor(e){s(this,e),this.ezChange=t(this,"ezChange",7),this.showPopup=t(this,"showPopup",7),this.enabled=!0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.mode="regular"}observeValue(){this._comboElement&&(this._comboElement.value=this.value)}async setFocus(){this._comboElement.setFocus()}async setBlur(){this._comboElement.setBlur()}onComboChange(s){s.stopPropagation(),this.value=s.detail,this.ezChange.emit(s.detail)}componentDidLoad(){i.applyVarsTextInput(this._elem,this._comboElement)}render(){return e("ez-combo-box",{ref:s=>this._comboElement=s,value:this.value,label:this.label,enabled:this.enabled,errorMessage:this.errorMessage,optionLoader:this.optionLoader,searchMode:!0,onEzChange:s=>this.onComboChange(s),showSelectedValue:this.showSelectedValue,showOptionValue:this.showOptionValue,suppressEmptyOption:this.suppressEmptyOption,mode:this.mode})}get _elem(){return h(this)}static get watchers(){return{value:["observeValue"]}}};o.style=":host{width:100%}";export{o as ez_search}
@@ -1 +0,0 @@
1
- import{h as e,r as t,c as i,f as n,H as s,g as r}from"./p-139ed2f6.js";import{UserInterface as o,Action as a,WaitingChangeException as l,ApplicationContext as c,DataUnitAction as d,DataUnit as h}from"@sankhyalabs/core";import{A as u}from"./p-0cd386db.js";const f=({name:t,label:i})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-text-input",{label:i,"data-field-name":t,key:t}));function b(t,i,n,s=!1){return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-align--middle ez-padding-horizontal--small ez-padding-bottom--large"},e("ez-check",{enabled:!n,label:i,mode:s?"switch":"regular","data-field-name":t,key:t}))}function p(t,i,n,s,r){return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-number-input",{enabled:!n,label:i,precision:s,prettyPrecision:r,"data-field-name":t,key:t}))}const m=new Map;m.set(o.LONGTEXT,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-padding-horizontal--small",key:t},e("ez-text-area",{enabled:!n,label:i,"data-field-name":t})))),m.set(o.CHECKBOX,(e=>b(e.name,e.label,e.readOnly,!1))),m.set(o.SWITCH,(e=>b(e.name,e.label,e.readOnly,!0))),m.set(o.OPTIONSELECTOR,(({name:t,label:i,readOnly:n,required:s},r)=>{const o=null==r?void 0:r.options;let a;if("string"==typeof o){const e=JSON.parse(o);a=Object.keys(e).map((t=>({value:t,label:e[t]})))}else a=o;return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-combo-box",{enabled:!n,suppressEmptyOption:s,label:i,"data-field-name":t,key:t,options:a}))})),m.set(o.SEARCH,(({name:t,label:i,readOnly:n,required:s})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-search",{enabled:!n,suppressEmptyOption:s,label:i,"data-field-name":t,key:t})))),m.set(o.FILE,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-padding-horizontal--small"},e("ez-upload",{enabled:!n,label:i,"data-field-name":t,key:t})))),m.set(o.DATE,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-input",{enabled:!n,label:i,"data-field-name":t,key:t})))),m.set(o.TIME,(({name:t,label:i})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-time-input",{label:i,"data-field-name":t,key:t})))),m.set(o.DATETIME,(({name:t,label:i})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-time-input",{label:i,"data-field-name":t,key:t})))),m.set(o.DECIMALNUMBER,(({name:e,label:t,readOnly:i},n)=>{const s=Number((null==n?void 0:n.precision)||2);return p(e,t,i,s,Number((null==n?void 0:n.prettyPrecision)||s))})),m.set(o.INTEGERNUMBER,(({name:e,label:t,readOnly:i})=>p(e,t,i,0,0)));const v=e=>{const t=e.descriptor,i=Object.assign({},e.config);let n,s;return t&&(i.label||(i.label=t.label),i.name||(i.name=t.name),void 0===i.required&&(i.required=t.required),void 0===i.readOnly&&(i.readOnly=t.readOnly),s=t.properties,n=m.get(t.userInterface)),i.required&&(i.label=`* ${i.label} (obrigatório)`),n||(n=f),n(i,s)},z=({source:t})=>"items"in t?e("ez-collapsible-box",{label:t.label,"header-size":"large"},t.items.map((e=>v(e)))):v(t),y=({store:t,source:i})=>e("div",{class:"dynamic-content ez-box__container"},e("div",{class:"ez-row ez-padding-vertical--small"},i.items.map((i=>e(z,{store:t,source:i})))));class g{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}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),this._defaultValues=e.defaultValues}getRequiredFields(){return this._requiredFields}getCleanOnCopyFields(){return this._cleanOnCopyFields}getDefaultValues(){return this._defaultValues}}function _(e,t){return"__main"==e[0].label?-1:(e[0].order||1e4)-(t[0].order||1e4)}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 O="function"==typeof Symbol&&Symbol.observable||"@@observable",E=function(){return Math.random().toString(36).substring(7).split("").join(".")},A={INIT:"@@redux/INIT"+E(),REPLACE:"@@redux/REPLACE"+E(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+E()}};function C(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 x(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(w(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(w(1));return i(x)(e,t)}if("function"!=typeof e)throw new Error(w(2));var s=e,r=t,o=[],a=o,l=!1;function c(){a===o&&(a=o.slice())}function d(){if(l)throw new Error(w(3));return r}function h(e){if("function"!=typeof e)throw new Error(w(4));if(l)throw new Error(w(5));var t=!0;return c(),a.push(e),function(){if(t){if(l)throw new Error(w(6));t=!1,c();var i=a.indexOf(e);a.splice(i,1),o=null}}}function u(e){if(!C(e))throw new Error(w(7));if(void 0===e.type)throw new Error(w(8));if(l)throw new Error(w(9));try{l=!0,r=s(r,e)}finally{l=!1}for(var t=o=a,i=0;i<t.length;i++)(0,t[i])();return e}function f(e){if("function"!=typeof e)throw new Error(w(10));s=e,u({type:A.REPLACE})}function b(){var e,t=h;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(w(11));function i(){e.next&&e.next(d())}return i(),{unsubscribe:t(i)}}})[O]=function(){return this},e}return u({type:A.INIT}),(n={dispatch:u,subscribe:h,getState:d,replaceReducer:f})[O]=b,n}const R={};function j(e=R,t){switch(t.type){case k.METADATA_LOADED:return Object.assign(Object.assign({},e),{formMetadata:t.payload});case k.CHANGE_TAB:return Object.assign(Object.assign({},e),{currentSheet:t.payload});default:return e}}function N(e){return e.formMetadata}var k;!function(e){e.METADATA_LOADED="FORM/METADATA_LOADED",e.CHANGE_TAB="FORM/CHANGE_TAB"}(k||(k={}));class D{constructor(e){this.onDataUnitEvent=e=>{var t;switch(e.type){case a.DATA_LOADED:case a.DATA_SAVED:case a.RECORDS_REMOVED:case a.RECORDS_ADDED:case a.RECORDS_COPIED:case a.DATA_CHANGED:case a.EDITION_CANCELED:case a.CHANGE_UNDONE:case a.CHANGE_REDONE:case a.SELECTION_CHANGED:case a.NEXT_SELECTED:case a.PREVIOUS_SELECTED:null===(t=this._fields)||void 0===t||t.forEach((e=>{this.updateValue(e.fieldName,e.field)}))}},this._fields=new Map,this._dataUnit=e,this._dataUnit.subscribe(this.onDataUnitEvent)}bind(e){e.forEach((e=>{this.updateBind(e.dataset.fieldName,e)}))}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent)}updateValue(e,t){t.value=this._dataUnit.getFieldValue(e)}updateBind(e,t){const i=this._fields.get(e);i&&i.destroy(),t.value=this._dataUnit.getFieldValue(e),this._fields.set(e,P.create(e,t,((e,t)=>this.changeStarted(e,t)),(e=>this.cancelWaitingChange(e)),((e,t)=>this.setFieldValue(e,t)))),this.bindSearchOptionsLoader(e,t),this.applyEzUploadContext(e,t)}changeStarted(e,t){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),!t.blocking&&null==t.promise){const i=this._fields.get(e);i&&(t.promise=new Promise(((e,t)=>{i.waitingChangePromiseResolve=e,i.waitingChangePromiseReject=t})))}this._dataUnit.startChange(e,t)}cancelWaitingChange(e){if(this._dataUnit.waitingForChange(e)){this._dataUnit.cancelWaitingChange(e);const t=this._fields.get(e);t&&t.rejectWaitingChange(new l("Change canceled",e))}}setFieldValue(e,t){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.setFieldValue(e,t),this._dataUnit.waitingForChange(e)){const t=this._fields.get(e);t&&t.acceptWaitingChange()}}bindSearchOptionsLoader(e,t){if("EZ-SEARCH"===t.nodeName&&null==t.optionLoader){const i=c.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");i&&(t.optionLoader=t=>i(t,e,this._dataUnit))}}applyEzUploadContext(e,t){var i,n;if("EZ-UPLOAD"===t.nodeName){t.urlUpload=c.getContextValue("__EZUI__UPLOAD__ADD__URL__"),t.urlDelete=c.getContextValue("__EZUI__UPLOAD__DEL__URL__");const s=this._dataUnit.getField(e),r=null===(i=s.properties)||void 0===i?void 0:i.DESTINATION;r&&(t.requestHeaders={XTRAINF:`{"destination": "${r}"}`}),t.maxFiles=(null===(n=s.properties)||void 0===n?void 0:n.MAX_FILES)||0}}}class P{constructor(){this.startChangeEventName="ezStartChange",this.cancelWaitingChangeEventName="ezCancelWaitingChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.cancelWaitingChangeEventName,this.cancelWaitingChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}acceptWaitingChange(){this.waitingChangePromiseResolve&&(this.waitingChangePromiseResolve(),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}rejectWaitingChange(e){this.waitingChangePromiseReject&&(this.waitingChangePromiseReject(e),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}static create(e,t,i,n,s){const r=new P;return r.field=t,r.fieldName=e,r.startChangeListener=t=>{i(e,t.detail)},r.field.addEventListener(r.startChangeEventName,r.startChangeListener),r.cancelWaitingChangeListener=()=>{n(e)},r.field.addEventListener(r.cancelWaitingChangeEventName,r.cancelWaitingChangeListener),r.changeListener=t=>{s(e,t.detail)},r.field.addEventListener(r.changeEventName,r.changeListener),r}}let S=class{constructor(e){t(this,e),this.ezReady=i(this,"ezReady",7),this.onDataUnitAction=e=>{e.type===a.METADATA_LOADED&&this.processMetadata()}}submit(){return Promise.resolve()}cancel(){return Promise.resolve()}validate(){return new Promise(((e,t)=>{const i=N(this._store.getState()),n=this._staticFields.filter((e=>e.dataset.required)).map((e=>e.dataset.fieldName)).concat(i.getRequiredFields()),s=this.dataUnit.getModifiedRecords();for(let e=0;e<s.length;e++)if(!this.validateRequired(n,s[e])){t();break}e()}))}observeConfig(){this.processMetadata()}validateRequired(e,t){const i=[];e.forEach((e=>{const n=t[e],s=this._element.querySelector(`[data-field-name=${e}]`);s&&(null==n||""===n?(i.push(e),s.errorMessage="Essa informação é obrigatória"):s.errorMessage="")}));const n=0===i.length;return n||u.info("Há pelo menos um campo obrigatório não preenchido."),n}getDynamicContent(){var t;const i=N(this._store.getState());if(!i)return null;const n=(s=null===(t=this._store)||void 0===t?void 0:t.getState()).currentSheet?s.formMetadata.getSheet(s.currentSheet):Array.from(s.formMetadata.getAllSheets().values())[0];var s;if(!n)return null;const r=Array.from(i.getAllSheets().values()),o=[];return r.length>1&&o.push(e("ez-tabselector",{onEzChange:e=>this._store.dispatch(function(e){return{type:k.CHANGE_TAB,payload:e.tabKey}}(e.detail)),selectedTab:n.name},r.map((t=>e("ez-tab",{tabKey:t.name,label:t.label}))))),o.push(e(y,{store:this._store,source:n})),o}processMetadata(){if(!this.isStatic()&&this.dataUnit){const e=this.config&&this.config.length>0?((e,t)=>{const i=new Map,n=[],s=[],r={};e.forEach((e=>{var o,a,l;if(!1!==e.visible){const c=function(e,t){return("string"==typeof e?Array.from(t.keys()).find((t=>t.label===e)):e)||{label:e,visible:!0}}(e.tab||"__main",i),d=t.getField(e.name);if(d&&c.visible){i.has(c)||i.set(c,new Map);const t=i.get(c);(void 0===e.required?d.required:e.required)&&n.push(e.name),(void 0===e.cleanOnCopy?(null===(o=d.properties)||void 0===o?void 0:o.cleanOnCopy)||(null===(a=d.properties)||void 0===a?void 0:a.autoNum):e.cleanOnCopy)&&s.push(e.name),(void 0===e.defaultValue?null===(l=d.properties)||void 0===l?void 0:l.defaultValue:e.defaultValue)&&(r[e.name]=e.defaultValue);const h={config:e,descriptor:d},u=e.group;if(u){const e=`group::${u}`;t.has(e)?t.get(e).items.push(h):t.set(e,{label:u,items:[h]})}else t.set(e.name,h)}}}));const o=new g;return Array.from(i.entries()).sort(_).forEach((([e,t])=>{o.addSheet({label:"__main"===e.label?"Principal":e.label,name:e.label,items:Array.from(t.values()),requiredFields:n,cleanOnCopyFields:s,defaultValues:r})})),o})(this.config,this.dataUnit):(()=>{var e;const t=this.dataUnit.metadata,i=new g;if(t){const n=null===(e=t.fields)||void 0===e?void 0:e.filter((e=>!1!==e.visible));let s={};n.filter((e=>e.defaultValue)).map((e=>s[e.name]=e.defaultValue)),i.addSheet({label:t.label,name:t.name,items:n.map((e=>({descriptor:e}))),requiredFields:n.filter((e=>e.required)).map((e=>e.name)),cleanOnCopyFields:n.filter((e=>{var t,i;return(null===(t=e.properties)||void 0===t?void 0:t.cleanOnCopy)||(null===(i=e.properties)||void 0===i?void 0:i.autoNum)})).map((e=>e.name)),defaultValues:s})}return i})();this._store.dispatch({type:k.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===a.RECORDS_COPIED){const t=N(this._store.getState()).getCleanOnCopyFields();if(t)return new d(a.RECORDS_COPIED,e.payload.map((e=>{const i=Object.assign({},e);return t.forEach((e=>delete i[e])),i})))}if(e.type===a.RECORDS_ADDED){const t=N(this._store.getState()).getDefaultValues();if(t)return new d(a.RECORDS_ADDED,e.payload.map((e=>{const i=Object.assign({},e);for(const e in t)i[e]=this.dataUnit.valueFromString(e,t[e]);return i})))}return e}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new h("ez-form")),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new D(this.dataUnit),this._store=x(j),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]"))),this.ezReady.emit()}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.removeInterceptor(this),this._dataBinder.onDisconnectedCallback()}render(){return e(s,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return r(this)}static get watchers(){return{config:["observeConfig"]}}};S.style="ez-form{display:flex;flex-direction:column;width:100%}.dynamic-content ez-collapsible-box{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{S as ez_form}
@@ -1 +0,0 @@
1
- import{r as s,c as t,h as e,g as i}from"./p-139ed2f6.js";import{NumberUtils as h}from"@sankhyalabs/core";import{C as r}from"./p-933a7475.js";let a=class{constructor(e){s(this,e),this.ezChange=t(this,"ezChange",7),this.ezStartChange=t(this,"ezStartChange",7),this.ezCancelWaitingChange=t(this,"ezCancelWaitingChange",7),this.enabled=!0,this.mode="regular"}async setFocus(){this._textInput.setFocus()}async setBlur(){this._textInput.setBlur()}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){this._textInput&&(this._textInput.errorMessage=this.errorMessage)}observeValue(){this._textInput&&(this._textInput.value=this.getTextValue(this.value)||"")}changeValue(s){return this.errorMessage="",s!==this.value?(this.value=s,this.ezChange.emit(this.value),!0):(this.observeValue(),!1)}parseNumber(){const s=this._textInput.value?h.stringToNumber(this._textInput.value):void 0;if(void 0!==s&&isNaN(s))this.ezCancelWaitingChange.emit(),this.errorMessage="O valor digitado não é um número válido";else try{this.changeValue(s)||this.ezCancelWaitingChange.emit()}catch(s){return this.ezCancelWaitingChange.emit(),void(this.errorMessage=s.message)}}getTextValue(s){if(s)return this.precision>0?h.format(s.toString(),Number(this.precision),Number(this.prettyPrecision)):s.toString()}startChange(){this.ezStartChange.emit({waitmessage:"",blocking:!1})}componentDidLoad(){r.applyVarsTextInput(this._elem,this._textInput)}render(){return e("ez-text-input",{ref:s=>this._textInput=s,onBlur:()=>this.parseNumber(),label:this.label,onInput:()=>this.startChange(),value:this.getTextValue(this.value),restrict:this.precision>0?"0123456789-,.":"0123456789-",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,slaveMode:!0})}get _elem(){return i(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};a.style=":host{display:block;width:100%}";export{a as ez_number_input}