@sankhyalabs/ezui 1.1.136 → 1.1.139

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 (128) hide show
  1. package/dist/cjs/ez-calendar.cjs.entry.js +2 -2
  2. package/dist/cjs/ez-check.cjs.entry.js +3 -3
  3. package/dist/cjs/ez-combo-box.cjs.entry.js +5 -5
  4. package/dist/cjs/ez-date-input.cjs.entry.js +10 -10
  5. package/dist/cjs/ez-date-time-input.cjs.entry.js +8 -8
  6. package/dist/cjs/ez-filter-input.cjs.entry.js +6 -6
  7. package/dist/cjs/ez-form.cjs.entry.js +39 -19
  8. package/dist/cjs/ez-grid.cjs.entry.js +4 -4
  9. package/dist/cjs/ez-loading-bar.cjs.entry.js +28 -0
  10. package/dist/cjs/ez-modal.cjs.entry.js +3 -3
  11. package/dist/cjs/ez-number-input.cjs.entry.js +25 -18
  12. package/dist/cjs/ez-popover.cjs.entry.js +2 -2
  13. package/dist/cjs/ez-search.cjs.entry.js +2 -2
  14. package/dist/cjs/ez-text-area.cjs.entry.js +11 -11
  15. package/dist/cjs/ez-text-input.cjs.entry.js +23 -16
  16. package/dist/cjs/ez-time-input.cjs.entry.js +36 -30
  17. package/dist/cjs/ez-upload.cjs.entry.js +4 -4
  18. package/dist/cjs/ez-view-stack.cjs.entry.js +71 -0
  19. package/dist/cjs/ezui.cjs.js +1 -1
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/cjs/test-du.cjs.entry.js +43 -10
  22. package/dist/collection/collection-manifest.json +2 -0
  23. package/dist/collection/components/ez-calendar/ez-calendar.js +2 -2
  24. package/dist/collection/components/ez-check/ez-check.js +3 -3
  25. package/dist/collection/components/ez-combo-box/ez-combo-box.js +5 -5
  26. package/dist/collection/components/ez-date-input/ez-date-input.js +10 -10
  27. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +8 -8
  28. package/dist/collection/components/ez-filter-input/ez-filter-input.js +6 -6
  29. package/dist/collection/components/ez-form/DataBinder.js +3 -14
  30. package/dist/collection/components/ez-form/ez-form.js +17 -2
  31. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +19 -3
  32. package/dist/collection/components/ez-grid/ez-grid.js +4 -4
  33. package/dist/collection/components/ez-loading-bar/ez-loading-bar.css +85 -0
  34. package/dist/collection/components/ez-loading-bar/ez-loading-bar.js +63 -0
  35. package/dist/collection/components/ez-modal/ez-modal.js +3 -3
  36. package/dist/collection/components/ez-number-input/ez-number-input.js +26 -19
  37. package/dist/collection/components/ez-popover/ez-popover.js +2 -2
  38. package/dist/collection/components/ez-search/ez-search.js +2 -2
  39. package/dist/collection/components/ez-text-area/ez-text-area.js +11 -11
  40. package/dist/collection/components/ez-text-input/ez-text-input.js +41 -16
  41. package/dist/collection/components/ez-time-input/ez-time-input.js +52 -31
  42. package/dist/collection/components/ez-upload/ez-upload.js +4 -4
  43. package/dist/collection/components/ez-view-stack/ez-view-stack.css +9 -0
  44. package/dist/collection/components/ez-view-stack/ez-view-stack.js +87 -0
  45. package/dist/collection/components/test-du/test-du.js +44 -10
  46. package/dist/custom-elements/index.d.ts +12 -0
  47. package/dist/custom-elements/index.js +320 -155
  48. package/dist/esm/ez-calendar.entry.js +2 -2
  49. package/dist/esm/ez-check.entry.js +3 -3
  50. package/dist/esm/ez-combo-box.entry.js +5 -5
  51. package/dist/esm/ez-date-input.entry.js +10 -10
  52. package/dist/esm/ez-date-time-input.entry.js +8 -8
  53. package/dist/esm/ez-filter-input.entry.js +6 -6
  54. package/dist/esm/ez-form.entry.js +39 -19
  55. package/dist/esm/ez-grid.entry.js +4 -4
  56. package/dist/esm/ez-loading-bar.entry.js +24 -0
  57. package/dist/esm/ez-modal.entry.js +3 -3
  58. package/dist/esm/ez-number-input.entry.js +25 -18
  59. package/dist/esm/ez-popover.entry.js +2 -2
  60. package/dist/esm/ez-search.entry.js +2 -2
  61. package/dist/esm/ez-text-area.entry.js +11 -11
  62. package/dist/esm/ez-text-input.entry.js +23 -16
  63. package/dist/esm/ez-time-input.entry.js +37 -31
  64. package/dist/esm/ez-upload.entry.js +4 -4
  65. package/dist/esm/ez-view-stack.entry.js +67 -0
  66. package/dist/esm/ezui.js +1 -1
  67. package/dist/esm/loader.js +1 -1
  68. package/dist/esm/test-du.entry.js +43 -10
  69. package/dist/ezui/ezui.esm.js +1 -1
  70. package/dist/ezui/p-248361f5.entry.js +1 -0
  71. package/dist/ezui/p-347b145b.entry.js +1 -0
  72. package/dist/ezui/p-4c3cd534.entry.js +1 -0
  73. package/dist/ezui/p-517d7759.entry.js +1 -0
  74. package/dist/ezui/{p-5f2add6f.entry.js → p-51cdfa9e.entry.js} +1 -1
  75. package/dist/ezui/p-6287fc90.entry.js +1 -0
  76. package/dist/ezui/p-6d4b1628.entry.js +1 -0
  77. package/dist/ezui/p-8be1a4d6.entry.js +1 -0
  78. package/dist/ezui/p-9b82c2fe.entry.js +1 -0
  79. package/dist/ezui/p-b65e22a1.entry.js +1 -0
  80. package/dist/ezui/p-b8d64970.entry.js +1 -0
  81. package/dist/ezui/{p-c6c91589.entry.js → p-c246e251.entry.js} +1 -1
  82. package/dist/ezui/p-c2de757f.entry.js +1 -0
  83. package/dist/ezui/p-c620258b.entry.js +1 -0
  84. package/dist/ezui/p-cb73bee7.entry.js +1 -0
  85. package/dist/ezui/p-db0981c1.entry.js +1 -0
  86. package/dist/ezui/p-dd6f4872.entry.js +1 -0
  87. package/dist/ezui/p-ec8419f1.entry.js +1 -0
  88. package/dist/ezui/p-fc9b9487.entry.js +1 -0
  89. package/dist/types/components/ez-calendar/ez-calendar.d.ts +1 -1
  90. package/dist/types/components/ez-check/ez-check.d.ts +1 -1
  91. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -1
  92. package/dist/types/components/ez-date-input/ez-date-input.d.ts +3 -3
  93. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +3 -3
  94. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +3 -3
  95. package/dist/types/components/ez-form/ez-form.d.ts +1 -1
  96. package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +3 -0
  97. package/dist/types/components/ez-grid/ez-grid.d.ts +1 -1
  98. package/dist/types/components/ez-loading-bar/ez-loading-bar.d.ts +6 -0
  99. package/dist/types/components/ez-modal/ez-modal.d.ts +1 -1
  100. package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -3
  101. package/dist/types/components/ez-popover/ez-popover.d.ts +1 -1
  102. package/dist/types/components/ez-search/ez-search.d.ts +1 -1
  103. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -4
  104. package/dist/types/components/ez-text-input/ez-text-input.d.ts +8 -4
  105. package/dist/types/components/ez-time-input/ez-time-input.d.ts +9 -3
  106. package/dist/types/components/ez-upload/ez-upload.d.ts +2 -2
  107. package/dist/types/components/ez-view-stack/ez-view-stack.d.ts +16 -0
  108. package/dist/types/components/test-du/test-du.d.ts +1 -0
  109. package/dist/types/components.d.ts +44 -0
  110. package/package.json +1 -1
  111. package/react/components.d.ts +2 -0
  112. package/react/components.js +2 -0
  113. package/react/components.js.map +1 -1
  114. package/dist/ezui/p-097d5dc6.entry.js +0 -1
  115. package/dist/ezui/p-0fd2624d.entry.js +0 -1
  116. package/dist/ezui/p-1587cbbc.entry.js +0 -1
  117. package/dist/ezui/p-18d67107.entry.js +0 -1
  118. package/dist/ezui/p-49f70be3.entry.js +0 -1
  119. package/dist/ezui/p-50038ae3.entry.js +0 -1
  120. package/dist/ezui/p-53110643.entry.js +0 -1
  121. package/dist/ezui/p-685a35b3.entry.js +0 -1
  122. package/dist/ezui/p-699c31d1.entry.js +0 -1
  123. package/dist/ezui/p-6c22c9f9.entry.js +0 -1
  124. package/dist/ezui/p-a1304302.entry.js +0 -1
  125. package/dist/ezui/p-b2cc27e5.entry.js +0 -1
  126. package/dist/ezui/p-b71d454d.entry.js +0 -1
  127. package/dist/ezui/p-cbb62e2c.entry.js +0 -1
  128. package/dist/ezui/p-dcf5f013.entry.js +0 -1
@@ -72,7 +72,7 @@ let EzCalendar = class {
72
72
  this._floatingID = undefined;
73
73
  }
74
74
  }
75
- valueChanged() {
75
+ observeValue() {
76
76
  if (this.value) {
77
77
  this._currentPosition.setTime(this.value.getTime());
78
78
  this._currentPosition.setDate(1);
@@ -215,7 +215,7 @@ let EzCalendar = class {
215
215
  })))))));
216
216
  }
217
217
  static get watchers() { return {
218
- "value": ["valueChanged"]
218
+ "value": ["observeValue"]
219
219
  }; }
220
220
  };
221
221
  EzCalendar.style = ezCalendarCss;
@@ -22,7 +22,7 @@ let EzCheck = class {
22
22
  */
23
23
  this.mode = "regular";
24
24
  }
25
- adjustMode() {
25
+ observeMode() {
26
26
  if (this.mode === "switch") {
27
27
  this._inputElem.classList.remove("regularMode");
28
28
  this._inputElem.classList.add("switchMode");
@@ -48,7 +48,7 @@ let EzCheck = class {
48
48
  this._inputElem.focus();
49
49
  }
50
50
  componentDidLoad() {
51
- this.adjustMode();
51
+ this.observeMode();
52
52
  }
53
53
  changeValue() {
54
54
  if (!this.enabled) {
@@ -68,7 +68,7 @@ let EzCheck = class {
68
68
  return (index.h(index.Host, null, index.h("input", { type: "checkbox", class: "regularMode", checked: this.value === true, onChange: () => { this.changeValue(); }, disabled: !this.enabled, ref: (el) => this._inputElem = el }), this.label ? index.h("label", { class: this.getLabelClasses(), onClick: () => { this.changeValue(); }, title: this.label }, this.label) : undefined));
69
69
  }
70
70
  static get watchers() { return {
71
- "mode": ["adjustMode"]
71
+ "mode": ["observeMode"]
72
72
  }; }
73
73
  };
74
74
  EzCheck.style = ezCheckCss;
@@ -41,7 +41,7 @@ let EzComboBox = class {
41
41
  */
42
42
  this.mode = "regular";
43
43
  }
44
- observerValue() {
44
+ observeValue() {
45
45
  if (this._inputElement) {
46
46
  this._inputElement.value = this.getText();
47
47
  }
@@ -157,7 +157,7 @@ let EzComboBox = class {
157
157
  this.ezChange.emit(adjustedOpt);
158
158
  }
159
159
  else {
160
- this.observerValue();
160
+ this.observeValue();
161
161
  }
162
162
  }
163
163
  updateSource(source) {
@@ -189,7 +189,7 @@ let EzComboBox = class {
189
189
  this.selectOption(undefined);
190
190
  }
191
191
  else {
192
- this.observerValue();
192
+ this.observeValue();
193
193
  }
194
194
  }
195
195
  //---------------------------------------------
@@ -279,11 +279,11 @@ let EzComboBox = class {
279
279
  this.cancelPreselection();
280
280
  }
281
281
  render() {
282
- return (index.h(index.Host, null, index.h("ez-text-input", { class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._inputElement = elem, enabled: this.enabled && !this.suppressSearch, onInput: evt => this.onTextInputChangeHandler(evt), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onEzChange: event => event.stopPropagation(), onKeyDown: event => this.keyDownHandler(event), label: this.label, value: this.getText(), canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, index.h("button", { class: "btn", slot: this.searchMode ? "leftIcon" : "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, index.h("ez-icon", { slot: "icon", "icon-name": this.searchMode ? "search" : "chevron-down" }))), index.h("section", { class: "list-container", ref: elem => this._listContainer = elem }, index.h("div", { class: "options-list", ref: elem => this._optionsList = elem }, this._visibleOptions.map((opt, index) => this.buildItem(opt, index))))));
282
+ return (index.h(index.Host, null, index.h("ez-text-input", { class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._inputElement = elem, enabled: this.enabled && !this.suppressSearch, onInput: evt => this.onTextInputChangeHandler(evt), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onKeyDown: event => this.keyDownHandler(event), label: this.label, value: this.getText(), canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }, index.h("button", { class: "btn", slot: this.searchMode ? "leftIcon" : "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, index.h("ez-icon", { slot: "icon", "icon-name": this.searchMode ? "search" : "chevron-down" }))), index.h("section", { class: "list-container", ref: elem => this._listContainer = elem }, index.h("div", { class: "options-list", ref: elem => this._optionsList = elem }, this._visibleOptions.map((opt, index) => this.buildItem(opt, index))))));
283
283
  }
284
284
  get el() { return index.getElement(this); }
285
285
  static get watchers() { return {
286
- "value": ["observerValue"]
286
+ "value": ["observeValue"]
287
287
  }; }
288
288
  };
289
289
  EzComboBox.style = ezComboBoxCss;
@@ -21,13 +21,13 @@ let EzDateInput = class {
21
21
  */
22
22
  this.mode = "regular";
23
23
  }
24
- setLabel() {
24
+ observeLabel() {
25
25
  this._textInput.label = this.label;
26
26
  }
27
- setErrorMessage() {
27
+ observeErrorMessage() {
28
28
  this._textInput.errorMessage = this.errorMessage;
29
29
  }
30
- applyValueToInput() {
30
+ observeValue() {
31
31
  if (this._textInput) {
32
32
  this._textInput.value = this.getTextValue(this.value);
33
33
  }
@@ -46,8 +46,8 @@ let EzDateInput = class {
46
46
  }
47
47
  changeValue(newValue) {
48
48
  var _a;
49
- newValue = newValue instanceof Date ? core.DateUtils.clearTime(newValue) : null;
50
- this.value = this.value instanceof Date ? core.DateUtils.clearTime(this.value) : null;
49
+ newValue = newValue instanceof Date ? core.DateUtils.clearTime(newValue) : undefined;
50
+ this.value = this.value instanceof Date ? core.DateUtils.clearTime(this.value) : undefined;
51
51
  this._textInput.errorMessage = "";
52
52
  if ((newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString())) {
53
53
  this.value = newValue;
@@ -83,7 +83,7 @@ let EzDateInput = class {
83
83
  }
84
84
  }
85
85
  getTextValue(d) {
86
- return d ? new Intl.DateTimeFormat("pt-BR").format(d) : null;
86
+ return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
87
87
  }
88
88
  componentDidLoad() {
89
89
  CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
@@ -92,13 +92,13 @@ let EzDateInput = class {
92
92
  return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => {
93
93
  if (event.key === "H" || event.key === "h")
94
94
  this.changeValue(new Date());
95
- }, label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
95
+ }, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
96
96
  }
97
97
  get _elem() { return index.getElement(this); }
98
98
  static get watchers() { return {
99
- "label": ["setLabel"],
100
- "errorMessage": ["setErrorMessage"],
101
- "value": ["applyValueToInput"]
99
+ "label": ["observeLabel"],
100
+ "errorMessage": ["observeErrorMessage"],
101
+ "value": ["observeValue"]
102
102
  }; }
103
103
  };
104
104
  EzDateInput.style = ezDateInputCss;
@@ -25,13 +25,13 @@ let EzDateTimeInput = class {
25
25
  */
26
26
  this.mode = "regular";
27
27
  }
28
- setLabel() {
28
+ observeLabel() {
29
29
  this._textInput.label = this.label;
30
30
  }
31
- setErrorMessage() {
31
+ observeErrorMessage() {
32
32
  this._textInput.errorMessage = this.errorMessage;
33
33
  }
34
- applyValueToInput() {
34
+ observeValue() {
35
35
  if (this._textInput) {
36
36
  this._textInput.value = this.getTextValue(this.value);
37
37
  }
@@ -129,19 +129,19 @@ let EzDateTimeInput = class {
129
129
  year: 'numeric', month: 'numeric', day: 'numeric',
130
130
  hour: 'numeric', minute: 'numeric', second: 'numeric'
131
131
  };
132
- return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : null;
132
+ return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
133
133
  }
134
134
  componentDidLoad() {
135
135
  CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
136
136
  }
137
137
  render() {
138
- return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { this.onChangeKeyDown(event); }, label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, onFocus: () => this.onFocused(), onClick: () => this.onClicked() }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
138
+ return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { this.onChangeKeyDown(event); }, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, onFocus: () => this.onFocused(), onClick: () => this.onClicked(), slaveMode: true }, index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), index.h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
139
139
  }
140
140
  get _elem() { return index.getElement(this); }
141
141
  static get watchers() { return {
142
- "label": ["setLabel"],
143
- "errorMessage": ["setErrorMessage"],
144
- "value": ["applyValueToInput"]
142
+ "label": ["observeLabel"],
143
+ "errorMessage": ["observeErrorMessage"],
144
+ "value": ["observeValue"]
145
145
  }; }
146
146
  };
147
147
  EzDateTimeInput.style = ezDateTimeInputCss;
@@ -20,17 +20,17 @@ let EzFilterInput = class {
20
20
  */
21
21
  this.mode = "regular";
22
22
  }
23
- setLabel() {
23
+ observeLabel() {
24
24
  if (this._textInput) {
25
25
  this._textInput.label = this.label;
26
26
  }
27
27
  }
28
- setErrorMessage() {
28
+ observeErrorMessage() {
29
29
  if (this._textInput) {
30
30
  this._textInput.errorMessage = this.errorMessage;
31
31
  }
32
32
  }
33
- applyValueToInput() {
33
+ observeValue() {
34
34
  if (this._textInput) {
35
35
  this._textInput.value = this.value;
36
36
  }
@@ -63,9 +63,9 @@ let EzFilterInput = class {
63
63
  }
64
64
  get _elem() { return index.getElement(this); }
65
65
  static get watchers() { return {
66
- "label": ["setLabel"],
67
- "errorMessage": ["setErrorMessage"],
68
- "value": ["applyValueToInput"]
66
+ "label": ["observeLabel"],
67
+ "errorMessage": ["observeErrorMessage"],
68
+ "value": ["observeValue"]
69
69
  }; }
70
70
  };
71
71
  EzFilterInput.style = ezFilterInputCss;
@@ -139,6 +139,7 @@ class FormMetadata {
139
139
  this._sheets = new Map();
140
140
  this._requiredFields = [];
141
141
  this._cleanOnCopyFields = [];
142
+ this._defaultValues = {};
142
143
  }
143
144
  getSheet(name) {
144
145
  return this._sheets.get(name);
@@ -150,6 +151,7 @@ class FormMetadata {
150
151
  this._sheets.set(sheet.name, sheet);
151
152
  this._requiredFields = this._requiredFields.concat(sheet.requiredFields);
152
153
  this._cleanOnCopyFields = this._cleanOnCopyFields.concat(sheet.cleanOnCopyFields);
154
+ this._defaultValues = sheet.defaultValues;
153
155
  }
154
156
  getRequiredFields() {
155
157
  return this._requiredFields;
@@ -157,6 +159,9 @@ class FormMetadata {
157
159
  getCleanOnCopyFields() {
158
160
  return this._cleanOnCopyFields;
159
161
  }
162
+ getDefaultValues() {
163
+ return this._defaultValues;
164
+ }
160
165
  }
161
166
  const buildFromDataUnit = (dataUnit) => {
162
167
  var _a;
@@ -164,6 +169,10 @@ const buildFromDataUnit = (dataUnit) => {
164
169
  const metadata = new FormMetadata();
165
170
  if (unitMD) {
166
171
  const visibleFields = (_a = unitMD.fields) === null || _a === void 0 ? void 0 : _a.filter(descriptor => descriptor.visible !== false);
172
+ let defaultValues = {};
173
+ visibleFields
174
+ .filter(descriptor => descriptor.defaultValue)
175
+ .map((descriptor) => defaultValues[descriptor.name] = descriptor.defaultValue);
167
176
  metadata.addSheet({
168
177
  label: unitMD.label,
169
178
  name: unitMD.name,
@@ -173,7 +182,8 @@ const buildFromDataUnit = (dataUnit) => {
173
182
  .map(descriptor => descriptor.name),
174
183
  cleanOnCopyFields: visibleFields
175
184
  .filter(descriptor => { var _a; return (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy; })
176
- .map(descriptor => descriptor.name)
185
+ .map(descriptor => descriptor.name),
186
+ defaultValues
177
187
  });
178
188
  }
179
189
  return metadata;
@@ -189,8 +199,9 @@ const buildFromConfig = (fields, dataUnit) => {
189
199
  const sheets = new Map();
190
200
  const requiredFields = [];
191
201
  const cleanOnCopyFields = [];
202
+ const defaultValues = {};
192
203
  fields.forEach(config => {
193
- var _a;
204
+ var _a, _b;
194
205
  if (config.visible !== false) {
195
206
  const tabConfig = getTabConfig(config.tab || "Geral", sheets);
196
207
  const descriptor = dataUnit.getField(config.name);
@@ -207,6 +218,10 @@ const buildFromConfig = (fields, dataUnit) => {
207
218
  if (clearOnCopy) {
208
219
  cleanOnCopyFields.push(config.name);
209
220
  }
221
+ const defaultValue = config.defaultValue === undefined ? (_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.defaultValue : config.defaultValue;
222
+ if (defaultValue) {
223
+ defaultValues[config.name] = config.defaultValue;
224
+ }
210
225
  const fieldMD = { config, descriptor };
211
226
  const group = config.group;
212
227
  if (group) {
@@ -233,7 +248,8 @@ const buildFromConfig = (fields, dataUnit) => {
233
248
  name: key.label,
234
249
  items: Array.from(value.values()),
235
250
  requiredFields,
236
- cleanOnCopyFields
251
+ cleanOnCopyFields,
252
+ defaultValues
237
253
  });
238
254
  });
239
255
  return metadata;
@@ -641,12 +657,7 @@ class DataBinder {
641
657
  const oldValue = field["value"];
642
658
  const newValue = this._dataUnit.getFieldValue(fieldName);
643
659
  if (oldValue != newValue) {
644
- if (newValue === undefined) {
645
- field.removeAttribute("value");
646
- }
647
- else {
648
- field["value"] = newValue;
649
- }
660
+ field["value"] = newValue;
650
661
  }
651
662
  }
652
663
  updateBind(fieldName, field) {
@@ -654,13 +665,7 @@ class DataBinder {
654
665
  if (oldBind) {
655
666
  oldBind.destroy();
656
667
  }
657
- const value = this._dataUnit.getFieldValue(fieldName);
658
- if (value === undefined) {
659
- field.removeAttribute("value");
660
- }
661
- else {
662
- field["value"] = value;
663
- }
668
+ field["value"] = this._dataUnit.getFieldValue(fieldName);
664
669
  this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
665
670
  this.bindSearchOptionsLoader(fieldName, field);
666
671
  this.applyEzUploadContext(fieldName, field);
@@ -678,7 +683,7 @@ class DataBinder {
678
683
  this._dataUnit.setFieldValue(fieldName, newValue);
679
684
  }
680
685
  bindSearchOptionsLoader(fieldName, field) {
681
- if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] === undefined) {
686
+ if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
682
687
  const loader = core.ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
683
688
  if (loader) {
684
689
  field["optionLoader"] = (arg) => {
@@ -757,7 +762,7 @@ let EzForm = class {
757
762
  accept();
758
763
  });
759
764
  }
760
- configChanged() {
765
+ observeConfig() {
761
766
  this.processMetadata();
762
767
  }
763
768
  validateRequired(requiredFields, record) {
@@ -819,6 +824,21 @@ let EzForm = class {
819
824
  }));
820
825
  }
821
826
  }
827
+ if (action.type === core.Action.RECORDS_ADDED) {
828
+ debugger;
829
+ const metadata = selectFormMetadata(this._store.getState());
830
+ const defaultValues = metadata.getDefaultValues();
831
+ if (defaultValues) {
832
+ const records = action.payload;
833
+ return new core.DataUnitAction(core.Action.RECORDS_ADDED, records.map(record => {
834
+ const newRecord = Object.assign({}, record);
835
+ for (const field in defaultValues) {
836
+ newRecord[field] = this.dataUnit.valueFromString(field, defaultValues[field]);
837
+ }
838
+ return newRecord;
839
+ }));
840
+ }
841
+ }
822
842
  return action;
823
843
  }
824
844
  componentWillLoad() {
@@ -847,7 +867,7 @@ let EzForm = class {
847
867
  }
848
868
  get _element() { return index.getElement(this); }
849
869
  static get watchers() { return {
850
- "config": ["configChanged"]
870
+ "config": ["observeConfig"]
851
871
  }; }
852
872
  };
853
873
  EzForm.style = ezFormCss;
@@ -110814,7 +110814,7 @@ let EzGrid = class {
110814
110814
  this._gridController.setColumnsDef(this._dataUnitBridge.buildColumnDefs(), true);
110815
110815
  }
110816
110816
  if (this.config) {
110817
- this.applyConfig(this.config);
110817
+ this.observeConfig(this.config);
110818
110818
  }
110819
110819
  }
110820
110820
  disconnectedCallback() {
@@ -110832,7 +110832,7 @@ let EzGrid = class {
110832
110832
  index.h("ez-button", { size: "small", iconName: "chevron-right", class: "ez-margin-right--medium", mode: "icon", enabled: this._navigationHasNext, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })
110833
110833
  ];
110834
110834
  }
110835
- applyConfig(config) {
110835
+ observeConfig(config) {
110836
110836
  this._gridController.setColumnsState(config.columns);
110837
110837
  this.closeGridConfig();
110838
110838
  }
@@ -110845,11 +110845,11 @@ let EzGrid = class {
110845
110845
  this._popUpGridConfig = true;
110846
110846
  }
110847
110847
  render() {
110848
- return (index.h(index.Host, null, index.h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, index.h("div", { class: "grid-header__container" }, index.h("slot", { name: "leftButtons" })), index.h("div", { class: "grid-header__container" }, this.getPaginationControl())), index.h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), index.h("div", { class: "grid__footer" }), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.applyConfig(evt.detail); this.configChange.emit(evt.detail); }, onConfigCancel: _evt => this.closeGridConfig() }))));
110848
+ return (index.h(index.Host, null, index.h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, index.h("div", { class: "grid-header__container" }, index.h("slot", { name: "leftButtons" })), index.h("div", { class: "grid-header__container" }, this.getPaginationControl())), index.h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), index.h("div", { class: "grid__footer" }), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.observeConfig(evt.detail); this.configChange.emit(evt.detail); }, onConfigCancel: _evt => this.closeGridConfig() }))));
110849
110849
  }
110850
110850
  static get assetsDirs() { return ["../assets"]; }
110851
110851
  static get watchers() { return {
110852
- "config": ["applyConfig"]
110852
+ "config": ["observeConfig"]
110853
110853
  }; }
110854
110854
  };
110855
110855
  EzGrid.style = ezGridCss;
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-c15a9551.js');
6
+
7
+ const ezLoadingBarCss = ":host{position:fixed;top:0px;width:100%}.loading-bar{width:100%;margin:0 auto;position:absolute;background-color:var(--color--primary-300, #e2f4ef);height:5px}.loading-bar:before{content:'';position:absolute}.loading-bar__container{position:absolute;top:0;right:100%;bottom:0;left:0;background-color:var(--color--primary, #008561);width:0;animation:loading 2s linear infinite}@keyframes loading{0%{left:0%;right:100%;width:0%}25%{left:0%;right:75%;width:25%}50%{left:0%;right:50%;width:90%}70%{right:0%;left:75%;width:25%}100%{left:100%;right:0%;width:0%}}@-webkit-keyframes loading{0%{left:0%;right:100%;width:0%}25%{left:0%;right:75%;width:25%}50%{left:0%;right:50%;width:90%}70%{right:0%;left:75%;width:25%}100%{left:100%;right:0%;width:0%}}";
8
+
9
+ let EzLoadingBar = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this._showLoading = true;
13
+ }
14
+ hide() {
15
+ this._showLoading = false;
16
+ return Promise.resolve();
17
+ }
18
+ show() {
19
+ this._showLoading = true;
20
+ return Promise.resolve();
21
+ }
22
+ render() {
23
+ return (index.h(index.Host, null, this._showLoading && index.h("div", { class: "loading-bar" }, index.h("div", { class: "loading-bar__container" }))));
24
+ }
25
+ };
26
+ EzLoadingBar.style = ezLoadingBarCss;
27
+
28
+ exports.ez_loading_bar = EzLoadingBar;
@@ -29,7 +29,7 @@ let EzModal = class {
29
29
  }
30
30
  };
31
31
  }
32
- handleopenedChange() {
32
+ observeOpened() {
33
33
  if (this.opened) {
34
34
  document.addEventListener("keydown", this.handleKeyboardEvent);
35
35
  }
@@ -42,7 +42,7 @@ let EzModal = class {
42
42
  this.ezCloseModal.emit(this.opened);
43
43
  }
44
44
  componentDidLoad() {
45
- this.handleopenedChange();
45
+ this.observeOpened();
46
46
  }
47
47
  componentDidRender() {
48
48
  if (this.opened) {
@@ -63,7 +63,7 @@ let EzModal = class {
63
63
  undefined));
64
64
  }
65
65
  static get watchers() { return {
66
- "opened": ["handleopenedChange"]
66
+ "opened": ["observeOpened"]
67
67
  }; }
68
68
  };
69
69
  EzModal.style = ezModalCss;
@@ -21,17 +21,6 @@ let EzNumberInput = class {
21
21
  */
22
22
  this.mode = "regular";
23
23
  }
24
- setLabel() {
25
- this._textInput.label = this.label;
26
- }
27
- setErrorMessage() {
28
- this._textInput.errorMessage = this.errorMessage;
29
- }
30
- applyValueToInput() {
31
- if (this._textInput) {
32
- this._textInput.value = this.getTextValue(this.value);
33
- }
34
- }
35
24
  /**
36
25
  * Realiza o foco no componente de input
37
26
  */
@@ -44,16 +33,34 @@ let EzNumberInput = class {
44
33
  async setBlur() {
45
34
  this._textInput.setBlur();
46
35
  }
36
+ observeLabel() {
37
+ if (this._textInput) {
38
+ this._textInput.label = this.label;
39
+ }
40
+ }
41
+ observeErrorMessage() {
42
+ if (this._textInput) {
43
+ this._textInput.errorMessage = this.errorMessage;
44
+ }
45
+ }
46
+ observeValue() {
47
+ if (this._textInput) {
48
+ this._textInput.value = this.getTextValue(this.value) || '';
49
+ }
50
+ }
47
51
  changeValue(newValue) {
48
52
  this.errorMessage = "";
49
53
  if (newValue !== this.value) {
50
54
  this.value = newValue;
51
55
  this.ezChange.emit(this.value);
52
56
  }
57
+ else {
58
+ this.observeValue();
59
+ }
53
60
  }
54
61
  parseNumber() {
55
- const parsedNumber = this._textInput.value ? core.NumberUtils.stringToNumber(this._textInput.value) : null;
56
- if (parsedNumber != null && isNaN(parsedNumber)) {
62
+ const parsedNumber = this._textInput.value ? core.NumberUtils.stringToNumber(this._textInput.value) : undefined;
63
+ if (parsedNumber !== undefined && isNaN(parsedNumber)) {
57
64
  this.errorMessage = "O valor digitado não é um número válido";
58
65
  }
59
66
  else {
@@ -70,19 +77,19 @@ let EzNumberInput = class {
70
77
  if (value) {
71
78
  return this.precision > 0 ? core.NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
72
79
  }
73
- return null;
80
+ return undefined;
74
81
  }
75
82
  componentDidLoad() {
76
83
  CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
77
84
  }
78
85
  render() {
79
- return (index.h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode }));
86
+ return (index.h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, value: this.getTextValue(this.value), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }));
80
87
  }
81
88
  get _elem() { return index.getElement(this); }
82
89
  static get watchers() { return {
83
- "label": ["setLabel"],
84
- "errorMessage": ["setErrorMessage"],
85
- "value": ["applyValueToInput"]
90
+ "label": ["observeLabel"],
91
+ "errorMessage": ["observeErrorMessage"],
92
+ "value": ["observeValue"]
86
93
  }; }
87
94
  };
88
95
  EzNumberInput.style = ezNumberInputCss;
@@ -74,7 +74,7 @@ let EzPopover = class {
74
74
  this.ezVisibilityChange.emit(false);
75
75
  };
76
76
  }
77
- dispatchVisibilityChange(newValue, oldValue) {
77
+ observeOpened(newValue, oldValue) {
78
78
  if (newValue != oldValue) {
79
79
  this.ezVisibilityChange.emit(newValue);
80
80
  }
@@ -131,7 +131,7 @@ let EzPopover = class {
131
131
  }
132
132
  get _host() { return index.getElement(this); }
133
133
  static get watchers() { return {
134
- "opened": ["dispatchVisibilityChange"]
134
+ "opened": ["observeOpened"]
135
135
  }; }
136
136
  };
137
137
  EzPopover.style = ezPopoverCss;
@@ -33,7 +33,7 @@ let EzSearch = class {
33
33
  */
34
34
  this.mode = "regular";
35
35
  }
36
- updateValue() {
36
+ observeValue() {
37
37
  if (this._comboElement) {
38
38
  this._comboElement.value = this.value;
39
39
  }
@@ -64,7 +64,7 @@ let EzSearch = class {
64
64
  ;
65
65
  get _elem() { return index.getElement(this); }
66
66
  static get watchers() { return {
67
- "value": ["updateValue"]
67
+ "value": ["observeValue"]
68
68
  }; }
69
69
  };
70
70
  EzSearch.style = ezSearchCss;
@@ -27,7 +27,7 @@ let EzTextArea = class {
27
27
  */
28
28
  this.mode = "regular";
29
29
  }
30
- showError() {
30
+ observeErrorMessage() {
31
31
  var _a, _b;
32
32
  const hasError = typeof this.errorMessage === 'string' && this.errorMessage !== '';
33
33
  if (hasError) {
@@ -39,13 +39,13 @@ let EzTextArea = class {
39
39
  (_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove('hasError');
40
40
  }
41
41
  }
42
- updateInputValue() {
43
- this._inputElem.value = this.value === undefined ? "" : this.value;
42
+ observeValue() {
43
+ this._inputElem.value = this.value == undefined ? "" : this.value;
44
44
  this.handleChange();
45
45
  this.adjustFloatingLabel();
46
46
  this.ezChange.emit(this.value);
47
47
  }
48
- adjustRowsForMode() {
48
+ observeMode() {
49
49
  if (this._initialRows == undefined) {
50
50
  this._initialRows = this.rows > 0 ? this.rows : undefined;
51
51
  }
@@ -54,7 +54,7 @@ let EzTextArea = class {
54
54
  this.rows = rows;
55
55
  }
56
56
  }
57
- adjustRowsValue() {
57
+ observeRows() {
58
58
  const rows = this.rows > 0 ? this.rows : this.mode != "slim" ? 4 : 2;
59
59
  if (rows !== this.rows) {
60
60
  this.rows = rows;
@@ -120,9 +120,9 @@ let EzTextArea = class {
120
120
  // Lifecycle web component
121
121
  //---------------------------------------------
122
122
  componentDidLoad() {
123
- this.showError();
123
+ this.observeErrorMessage();
124
124
  this.adjustFloatingLabel();
125
- this.adjustRowsForMode();
125
+ this.observeMode();
126
126
  }
127
127
  render() {
128
128
  return (index.h(index.Host, null, index.h("div", { class: "textarea", ref: (el) => this._container = el }, this.label && this.mode != "slim" ?
@@ -132,10 +132,10 @@ let EzTextArea = class {
132
132
  }
133
133
  get _hostElement() { return index.getElement(this); }
134
134
  static get watchers() { return {
135
- "errorMessage": ["showError"],
136
- "value": ["updateInputValue"],
137
- "mode": ["adjustRowsForMode"],
138
- "rows": ["adjustRowsValue"]
135
+ "errorMessage": ["observeErrorMessage"],
136
+ "value": ["observeValue"],
137
+ "mode": ["observeMode"],
138
+ "rows": ["observeRows"]
139
139
  }; }
140
140
  };
141
141
  EzTextArea.style = ezTextAreaCss;