@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.
- package/dist/cjs/ez-calendar.cjs.entry.js +2 -2
- package/dist/cjs/ez-check.cjs.entry.js +3 -3
- package/dist/cjs/ez-combo-box.cjs.entry.js +5 -5
- package/dist/cjs/ez-date-input.cjs.entry.js +10 -10
- package/dist/cjs/ez-date-time-input.cjs.entry.js +8 -8
- package/dist/cjs/ez-filter-input.cjs.entry.js +6 -6
- package/dist/cjs/ez-form.cjs.entry.js +39 -19
- package/dist/cjs/ez-grid.cjs.entry.js +4 -4
- package/dist/cjs/ez-loading-bar.cjs.entry.js +28 -0
- package/dist/cjs/ez-modal.cjs.entry.js +3 -3
- package/dist/cjs/ez-number-input.cjs.entry.js +25 -18
- package/dist/cjs/ez-popover.cjs.entry.js +2 -2
- package/dist/cjs/ez-search.cjs.entry.js +2 -2
- package/dist/cjs/ez-text-area.cjs.entry.js +11 -11
- package/dist/cjs/ez-text-input.cjs.entry.js +23 -16
- package/dist/cjs/ez-time-input.cjs.entry.js +36 -30
- package/dist/cjs/ez-upload.cjs.entry.js +4 -4
- package/dist/cjs/ez-view-stack.cjs.entry.js +71 -0
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/test-du.cjs.entry.js +43 -10
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/ez-calendar/ez-calendar.js +2 -2
- package/dist/collection/components/ez-check/ez-check.js +3 -3
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +5 -5
- package/dist/collection/components/ez-date-input/ez-date-input.js +10 -10
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +8 -8
- package/dist/collection/components/ez-filter-input/ez-filter-input.js +6 -6
- package/dist/collection/components/ez-form/DataBinder.js +3 -14
- package/dist/collection/components/ez-form/ez-form.js +17 -2
- package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +19 -3
- package/dist/collection/components/ez-grid/ez-grid.js +4 -4
- package/dist/collection/components/ez-loading-bar/ez-loading-bar.css +85 -0
- package/dist/collection/components/ez-loading-bar/ez-loading-bar.js +63 -0
- package/dist/collection/components/ez-modal/ez-modal.js +3 -3
- package/dist/collection/components/ez-number-input/ez-number-input.js +26 -19
- package/dist/collection/components/ez-popover/ez-popover.js +2 -2
- package/dist/collection/components/ez-search/ez-search.js +2 -2
- package/dist/collection/components/ez-text-area/ez-text-area.js +11 -11
- package/dist/collection/components/ez-text-input/ez-text-input.js +41 -16
- package/dist/collection/components/ez-time-input/ez-time-input.js +52 -31
- package/dist/collection/components/ez-upload/ez-upload.js +4 -4
- package/dist/collection/components/ez-view-stack/ez-view-stack.css +9 -0
- package/dist/collection/components/ez-view-stack/ez-view-stack.js +87 -0
- package/dist/collection/components/test-du/test-du.js +44 -10
- package/dist/custom-elements/index.d.ts +12 -0
- package/dist/custom-elements/index.js +320 -155
- package/dist/esm/ez-calendar.entry.js +2 -2
- package/dist/esm/ez-check.entry.js +3 -3
- package/dist/esm/ez-combo-box.entry.js +5 -5
- package/dist/esm/ez-date-input.entry.js +10 -10
- package/dist/esm/ez-date-time-input.entry.js +8 -8
- package/dist/esm/ez-filter-input.entry.js +6 -6
- package/dist/esm/ez-form.entry.js +39 -19
- package/dist/esm/ez-grid.entry.js +4 -4
- package/dist/esm/ez-loading-bar.entry.js +24 -0
- package/dist/esm/ez-modal.entry.js +3 -3
- package/dist/esm/ez-number-input.entry.js +25 -18
- package/dist/esm/ez-popover.entry.js +2 -2
- package/dist/esm/ez-search.entry.js +2 -2
- package/dist/esm/ez-text-area.entry.js +11 -11
- package/dist/esm/ez-text-input.entry.js +23 -16
- package/dist/esm/ez-time-input.entry.js +37 -31
- package/dist/esm/ez-upload.entry.js +4 -4
- package/dist/esm/ez-view-stack.entry.js +67 -0
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/test-du.entry.js +43 -10
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-248361f5.entry.js +1 -0
- package/dist/ezui/p-347b145b.entry.js +1 -0
- package/dist/ezui/p-4c3cd534.entry.js +1 -0
- package/dist/ezui/p-517d7759.entry.js +1 -0
- package/dist/ezui/{p-5f2add6f.entry.js → p-51cdfa9e.entry.js} +1 -1
- package/dist/ezui/p-6287fc90.entry.js +1 -0
- package/dist/ezui/p-6d4b1628.entry.js +1 -0
- package/dist/ezui/p-8be1a4d6.entry.js +1 -0
- package/dist/ezui/p-9b82c2fe.entry.js +1 -0
- package/dist/ezui/p-b65e22a1.entry.js +1 -0
- package/dist/ezui/p-b8d64970.entry.js +1 -0
- package/dist/ezui/{p-c6c91589.entry.js → p-c246e251.entry.js} +1 -1
- package/dist/ezui/p-c2de757f.entry.js +1 -0
- package/dist/ezui/p-c620258b.entry.js +1 -0
- package/dist/ezui/p-cb73bee7.entry.js +1 -0
- package/dist/ezui/p-db0981c1.entry.js +1 -0
- package/dist/ezui/p-dd6f4872.entry.js +1 -0
- package/dist/ezui/p-ec8419f1.entry.js +1 -0
- package/dist/ezui/p-fc9b9487.entry.js +1 -0
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +1 -1
- package/dist/types/components/ez-check/ez-check.d.ts +1 -1
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -1
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +3 -3
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +3 -3
- package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +3 -3
- package/dist/types/components/ez-form/ez-form.d.ts +1 -1
- package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +3 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +1 -1
- package/dist/types/components/ez-loading-bar/ez-loading-bar.d.ts +6 -0
- package/dist/types/components/ez-modal/ez-modal.d.ts +1 -1
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -3
- package/dist/types/components/ez-popover/ez-popover.d.ts +1 -1
- package/dist/types/components/ez-search/ez-search.d.ts +1 -1
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -4
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +8 -4
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +9 -3
- package/dist/types/components/ez-upload/ez-upload.d.ts +2 -2
- package/dist/types/components/ez-view-stack/ez-view-stack.d.ts +16 -0
- package/dist/types/components/test-du/test-du.d.ts +1 -0
- package/dist/types/components.d.ts +44 -0
- package/package.json +1 -1
- package/react/components.d.ts +2 -0
- package/react/components.js +2 -0
- package/react/components.js.map +1 -1
- package/dist/ezui/p-097d5dc6.entry.js +0 -1
- package/dist/ezui/p-0fd2624d.entry.js +0 -1
- package/dist/ezui/p-1587cbbc.entry.js +0 -1
- package/dist/ezui/p-18d67107.entry.js +0 -1
- package/dist/ezui/p-49f70be3.entry.js +0 -1
- package/dist/ezui/p-50038ae3.entry.js +0 -1
- package/dist/ezui/p-53110643.entry.js +0 -1
- package/dist/ezui/p-685a35b3.entry.js +0 -1
- package/dist/ezui/p-699c31d1.entry.js +0 -1
- package/dist/ezui/p-6c22c9f9.entry.js +0 -1
- package/dist/ezui/p-a1304302.entry.js +0 -1
- package/dist/ezui/p-b2cc27e5.entry.js +0 -1
- package/dist/ezui/p-b71d454d.entry.js +0 -1
- package/dist/ezui/p-cbb62e2c.entry.js +0 -1
- package/dist/ezui/p-dcf5f013.entry.js +0 -1
|
@@ -68,7 +68,7 @@ let EzCalendar = class {
|
|
|
68
68
|
this._floatingID = undefined;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
observeValue() {
|
|
72
72
|
if (this.value) {
|
|
73
73
|
this._currentPosition.setTime(this.value.getTime());
|
|
74
74
|
this._currentPosition.setDate(1);
|
|
@@ -211,7 +211,7 @@ let EzCalendar = class {
|
|
|
211
211
|
})))))));
|
|
212
212
|
}
|
|
213
213
|
static get watchers() { return {
|
|
214
|
-
"value": ["
|
|
214
|
+
"value": ["observeValue"]
|
|
215
215
|
}; }
|
|
216
216
|
};
|
|
217
217
|
EzCalendar.style = ezCalendarCss;
|
|
@@ -18,7 +18,7 @@ let EzCheck = class {
|
|
|
18
18
|
*/
|
|
19
19
|
this.mode = "regular";
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
observeMode() {
|
|
22
22
|
if (this.mode === "switch") {
|
|
23
23
|
this._inputElem.classList.remove("regularMode");
|
|
24
24
|
this._inputElem.classList.add("switchMode");
|
|
@@ -44,7 +44,7 @@ let EzCheck = class {
|
|
|
44
44
|
this._inputElem.focus();
|
|
45
45
|
}
|
|
46
46
|
componentDidLoad() {
|
|
47
|
-
this.
|
|
47
|
+
this.observeMode();
|
|
48
48
|
}
|
|
49
49
|
changeValue() {
|
|
50
50
|
if (!this.enabled) {
|
|
@@ -64,7 +64,7 @@ let EzCheck = class {
|
|
|
64
64
|
return (h(Host, null, h("input", { type: "checkbox", class: "regularMode", checked: this.value === true, onChange: () => { this.changeValue(); }, disabled: !this.enabled, ref: (el) => this._inputElem = el }), this.label ? h("label", { class: this.getLabelClasses(), onClick: () => { this.changeValue(); }, title: this.label }, this.label) : undefined));
|
|
65
65
|
}
|
|
66
66
|
static get watchers() { return {
|
|
67
|
-
"mode": ["
|
|
67
|
+
"mode": ["observeMode"]
|
|
68
68
|
}; }
|
|
69
69
|
};
|
|
70
70
|
EzCheck.style = ezCheckCss;
|
|
@@ -37,7 +37,7 @@ let EzComboBox = class {
|
|
|
37
37
|
*/
|
|
38
38
|
this.mode = "regular";
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
observeValue() {
|
|
41
41
|
if (this._inputElement) {
|
|
42
42
|
this._inputElement.value = this.getText();
|
|
43
43
|
}
|
|
@@ -153,7 +153,7 @@ let EzComboBox = class {
|
|
|
153
153
|
this.ezChange.emit(adjustedOpt);
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
|
-
this.
|
|
156
|
+
this.observeValue();
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
updateSource(source) {
|
|
@@ -185,7 +185,7 @@ let EzComboBox = class {
|
|
|
185
185
|
this.selectOption(undefined);
|
|
186
186
|
}
|
|
187
187
|
else {
|
|
188
|
-
this.
|
|
188
|
+
this.observeValue();
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
//---------------------------------------------
|
|
@@ -275,11 +275,11 @@ let EzComboBox = class {
|
|
|
275
275
|
this.cancelPreselection();
|
|
276
276
|
}
|
|
277
277
|
render() {
|
|
278
|
-
return (h(Host, null, 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(),
|
|
278
|
+
return (h(Host, null, 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 }, h("button", { class: "btn", slot: this.searchMode ? "leftIcon" : "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, h("ez-icon", { slot: "icon", "icon-name": this.searchMode ? "search" : "chevron-down" }))), h("section", { class: "list-container", ref: elem => this._listContainer = elem }, h("div", { class: "options-list", ref: elem => this._optionsList = elem }, this._visibleOptions.map((opt, index) => this.buildItem(opt, index))))));
|
|
279
279
|
}
|
|
280
280
|
get el() { return getElement(this); }
|
|
281
281
|
static get watchers() { return {
|
|
282
|
-
"value": ["
|
|
282
|
+
"value": ["observeValue"]
|
|
283
283
|
}; }
|
|
284
284
|
};
|
|
285
285
|
EzComboBox.style = ezComboBoxCss;
|
|
@@ -17,13 +17,13 @@ let EzDateInput = class {
|
|
|
17
17
|
*/
|
|
18
18
|
this.mode = "regular";
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
observeLabel() {
|
|
21
21
|
this._textInput.label = this.label;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
observeErrorMessage() {
|
|
24
24
|
this._textInput.errorMessage = this.errorMessage;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
observeValue() {
|
|
27
27
|
if (this._textInput) {
|
|
28
28
|
this._textInput.value = this.getTextValue(this.value);
|
|
29
29
|
}
|
|
@@ -42,8 +42,8 @@ let EzDateInput = class {
|
|
|
42
42
|
}
|
|
43
43
|
changeValue(newValue) {
|
|
44
44
|
var _a;
|
|
45
|
-
newValue = newValue instanceof Date ? DateUtils.clearTime(newValue) :
|
|
46
|
-
this.value = this.value instanceof Date ? DateUtils.clearTime(this.value) :
|
|
45
|
+
newValue = newValue instanceof Date ? DateUtils.clearTime(newValue) : undefined;
|
|
46
|
+
this.value = this.value instanceof Date ? DateUtils.clearTime(this.value) : undefined;
|
|
47
47
|
this._textInput.errorMessage = "";
|
|
48
48
|
if ((newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString())) {
|
|
49
49
|
this.value = newValue;
|
|
@@ -79,7 +79,7 @@ let EzDateInput = class {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
getTextValue(d) {
|
|
82
|
-
return d ? new Intl.DateTimeFormat("pt-BR").format(d) :
|
|
82
|
+
return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
|
|
83
83
|
}
|
|
84
84
|
componentDidLoad() {
|
|
85
85
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
@@ -88,13 +88,13 @@ let EzDateInput = class {
|
|
|
88
88
|
return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => {
|
|
89
89
|
if (event.key === "H" || event.key === "h")
|
|
90
90
|
this.changeValue(new Date());
|
|
91
|
-
}, label: this.label,
|
|
91
|
+
}, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
|
|
92
92
|
}
|
|
93
93
|
get _elem() { return getElement(this); }
|
|
94
94
|
static get watchers() { return {
|
|
95
|
-
"label": ["
|
|
96
|
-
"errorMessage": ["
|
|
97
|
-
"value": ["
|
|
95
|
+
"label": ["observeLabel"],
|
|
96
|
+
"errorMessage": ["observeErrorMessage"],
|
|
97
|
+
"value": ["observeValue"]
|
|
98
98
|
}; }
|
|
99
99
|
};
|
|
100
100
|
EzDateInput.style = ezDateInputCss;
|
|
@@ -21,13 +21,13 @@ let EzDateTimeInput = class {
|
|
|
21
21
|
*/
|
|
22
22
|
this.mode = "regular";
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
observeLabel() {
|
|
25
25
|
this._textInput.label = this.label;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
observeErrorMessage() {
|
|
28
28
|
this._textInput.errorMessage = this.errorMessage;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
observeValue() {
|
|
31
31
|
if (this._textInput) {
|
|
32
32
|
this._textInput.value = this.getTextValue(this.value);
|
|
33
33
|
}
|
|
@@ -125,19 +125,19 @@ let EzDateTimeInput = class {
|
|
|
125
125
|
year: 'numeric', month: 'numeric', day: 'numeric',
|
|
126
126
|
hour: 'numeric', minute: 'numeric', second: 'numeric'
|
|
127
127
|
};
|
|
128
|
-
return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) :
|
|
128
|
+
return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
|
|
129
129
|
}
|
|
130
130
|
componentDidLoad() {
|
|
131
131
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
132
132
|
}
|
|
133
133
|
render() {
|
|
134
|
-
return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { this.onChangeKeyDown(event); }, label: this.label,
|
|
134
|
+
return (h(Host, null, 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 }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
|
|
135
135
|
}
|
|
136
136
|
get _elem() { return getElement(this); }
|
|
137
137
|
static get watchers() { return {
|
|
138
|
-
"label": ["
|
|
139
|
-
"errorMessage": ["
|
|
140
|
-
"value": ["
|
|
138
|
+
"label": ["observeLabel"],
|
|
139
|
+
"errorMessage": ["observeErrorMessage"],
|
|
140
|
+
"value": ["observeValue"]
|
|
141
141
|
}; }
|
|
142
142
|
};
|
|
143
143
|
EzDateTimeInput.style = ezDateTimeInputCss;
|
|
@@ -16,17 +16,17 @@ let EzFilterInput = class {
|
|
|
16
16
|
*/
|
|
17
17
|
this.mode = "regular";
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
observeLabel() {
|
|
20
20
|
if (this._textInput) {
|
|
21
21
|
this._textInput.label = this.label;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
observeErrorMessage() {
|
|
25
25
|
if (this._textInput) {
|
|
26
26
|
this._textInput.errorMessage = this.errorMessage;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
observeValue() {
|
|
30
30
|
if (this._textInput) {
|
|
31
31
|
this._textInput.value = this.value;
|
|
32
32
|
}
|
|
@@ -59,9 +59,9 @@ let EzFilterInput = class {
|
|
|
59
59
|
}
|
|
60
60
|
get _elem() { return getElement(this); }
|
|
61
61
|
static get watchers() { return {
|
|
62
|
-
"label": ["
|
|
63
|
-
"errorMessage": ["
|
|
64
|
-
"value": ["
|
|
62
|
+
"label": ["observeLabel"],
|
|
63
|
+
"errorMessage": ["observeErrorMessage"],
|
|
64
|
+
"value": ["observeValue"]
|
|
65
65
|
}; }
|
|
66
66
|
};
|
|
67
67
|
EzFilterInput.style = ezFilterInputCss;
|
|
@@ -135,6 +135,7 @@ class FormMetadata {
|
|
|
135
135
|
this._sheets = new Map();
|
|
136
136
|
this._requiredFields = [];
|
|
137
137
|
this._cleanOnCopyFields = [];
|
|
138
|
+
this._defaultValues = {};
|
|
138
139
|
}
|
|
139
140
|
getSheet(name) {
|
|
140
141
|
return this._sheets.get(name);
|
|
@@ -146,6 +147,7 @@ class FormMetadata {
|
|
|
146
147
|
this._sheets.set(sheet.name, sheet);
|
|
147
148
|
this._requiredFields = this._requiredFields.concat(sheet.requiredFields);
|
|
148
149
|
this._cleanOnCopyFields = this._cleanOnCopyFields.concat(sheet.cleanOnCopyFields);
|
|
150
|
+
this._defaultValues = sheet.defaultValues;
|
|
149
151
|
}
|
|
150
152
|
getRequiredFields() {
|
|
151
153
|
return this._requiredFields;
|
|
@@ -153,6 +155,9 @@ class FormMetadata {
|
|
|
153
155
|
getCleanOnCopyFields() {
|
|
154
156
|
return this._cleanOnCopyFields;
|
|
155
157
|
}
|
|
158
|
+
getDefaultValues() {
|
|
159
|
+
return this._defaultValues;
|
|
160
|
+
}
|
|
156
161
|
}
|
|
157
162
|
const buildFromDataUnit = (dataUnit) => {
|
|
158
163
|
var _a;
|
|
@@ -160,6 +165,10 @@ const buildFromDataUnit = (dataUnit) => {
|
|
|
160
165
|
const metadata = new FormMetadata();
|
|
161
166
|
if (unitMD) {
|
|
162
167
|
const visibleFields = (_a = unitMD.fields) === null || _a === void 0 ? void 0 : _a.filter(descriptor => descriptor.visible !== false);
|
|
168
|
+
let defaultValues = {};
|
|
169
|
+
visibleFields
|
|
170
|
+
.filter(descriptor => descriptor.defaultValue)
|
|
171
|
+
.map((descriptor) => defaultValues[descriptor.name] = descriptor.defaultValue);
|
|
163
172
|
metadata.addSheet({
|
|
164
173
|
label: unitMD.label,
|
|
165
174
|
name: unitMD.name,
|
|
@@ -169,7 +178,8 @@ const buildFromDataUnit = (dataUnit) => {
|
|
|
169
178
|
.map(descriptor => descriptor.name),
|
|
170
179
|
cleanOnCopyFields: visibleFields
|
|
171
180
|
.filter(descriptor => { var _a; return (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy; })
|
|
172
|
-
.map(descriptor => descriptor.name)
|
|
181
|
+
.map(descriptor => descriptor.name),
|
|
182
|
+
defaultValues
|
|
173
183
|
});
|
|
174
184
|
}
|
|
175
185
|
return metadata;
|
|
@@ -185,8 +195,9 @@ const buildFromConfig = (fields, dataUnit) => {
|
|
|
185
195
|
const sheets = new Map();
|
|
186
196
|
const requiredFields = [];
|
|
187
197
|
const cleanOnCopyFields = [];
|
|
198
|
+
const defaultValues = {};
|
|
188
199
|
fields.forEach(config => {
|
|
189
|
-
var _a;
|
|
200
|
+
var _a, _b;
|
|
190
201
|
if (config.visible !== false) {
|
|
191
202
|
const tabConfig = getTabConfig(config.tab || "Geral", sheets);
|
|
192
203
|
const descriptor = dataUnit.getField(config.name);
|
|
@@ -203,6 +214,10 @@ const buildFromConfig = (fields, dataUnit) => {
|
|
|
203
214
|
if (clearOnCopy) {
|
|
204
215
|
cleanOnCopyFields.push(config.name);
|
|
205
216
|
}
|
|
217
|
+
const defaultValue = config.defaultValue === undefined ? (_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.defaultValue : config.defaultValue;
|
|
218
|
+
if (defaultValue) {
|
|
219
|
+
defaultValues[config.name] = config.defaultValue;
|
|
220
|
+
}
|
|
206
221
|
const fieldMD = { config, descriptor };
|
|
207
222
|
const group = config.group;
|
|
208
223
|
if (group) {
|
|
@@ -229,7 +244,8 @@ const buildFromConfig = (fields, dataUnit) => {
|
|
|
229
244
|
name: key.label,
|
|
230
245
|
items: Array.from(value.values()),
|
|
231
246
|
requiredFields,
|
|
232
|
-
cleanOnCopyFields
|
|
247
|
+
cleanOnCopyFields,
|
|
248
|
+
defaultValues
|
|
233
249
|
});
|
|
234
250
|
});
|
|
235
251
|
return metadata;
|
|
@@ -637,12 +653,7 @@ class DataBinder {
|
|
|
637
653
|
const oldValue = field["value"];
|
|
638
654
|
const newValue = this._dataUnit.getFieldValue(fieldName);
|
|
639
655
|
if (oldValue != newValue) {
|
|
640
|
-
|
|
641
|
-
field.removeAttribute("value");
|
|
642
|
-
}
|
|
643
|
-
else {
|
|
644
|
-
field["value"] = newValue;
|
|
645
|
-
}
|
|
656
|
+
field["value"] = newValue;
|
|
646
657
|
}
|
|
647
658
|
}
|
|
648
659
|
updateBind(fieldName, field) {
|
|
@@ -650,13 +661,7 @@ class DataBinder {
|
|
|
650
661
|
if (oldBind) {
|
|
651
662
|
oldBind.destroy();
|
|
652
663
|
}
|
|
653
|
-
|
|
654
|
-
if (value === undefined) {
|
|
655
|
-
field.removeAttribute("value");
|
|
656
|
-
}
|
|
657
|
-
else {
|
|
658
|
-
field["value"] = value;
|
|
659
|
-
}
|
|
664
|
+
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
660
665
|
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
661
666
|
this.bindSearchOptionsLoader(fieldName, field);
|
|
662
667
|
this.applyEzUploadContext(fieldName, field);
|
|
@@ -674,7 +679,7 @@ class DataBinder {
|
|
|
674
679
|
this._dataUnit.setFieldValue(fieldName, newValue);
|
|
675
680
|
}
|
|
676
681
|
bindSearchOptionsLoader(fieldName, field) {
|
|
677
|
-
if (field.nodeName === "EZ-SEARCH" && field["optionLoader"]
|
|
682
|
+
if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
|
|
678
683
|
const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
|
|
679
684
|
if (loader) {
|
|
680
685
|
field["optionLoader"] = (arg) => {
|
|
@@ -753,7 +758,7 @@ let EzForm = class {
|
|
|
753
758
|
accept();
|
|
754
759
|
});
|
|
755
760
|
}
|
|
756
|
-
|
|
761
|
+
observeConfig() {
|
|
757
762
|
this.processMetadata();
|
|
758
763
|
}
|
|
759
764
|
validateRequired(requiredFields, record) {
|
|
@@ -815,6 +820,21 @@ let EzForm = class {
|
|
|
815
820
|
}));
|
|
816
821
|
}
|
|
817
822
|
}
|
|
823
|
+
if (action.type === Action.RECORDS_ADDED) {
|
|
824
|
+
debugger;
|
|
825
|
+
const metadata = selectFormMetadata(this._store.getState());
|
|
826
|
+
const defaultValues = metadata.getDefaultValues();
|
|
827
|
+
if (defaultValues) {
|
|
828
|
+
const records = action.payload;
|
|
829
|
+
return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
|
|
830
|
+
const newRecord = Object.assign({}, record);
|
|
831
|
+
for (const field in defaultValues) {
|
|
832
|
+
newRecord[field] = this.dataUnit.valueFromString(field, defaultValues[field]);
|
|
833
|
+
}
|
|
834
|
+
return newRecord;
|
|
835
|
+
}));
|
|
836
|
+
}
|
|
837
|
+
}
|
|
818
838
|
return action;
|
|
819
839
|
}
|
|
820
840
|
componentWillLoad() {
|
|
@@ -843,7 +863,7 @@ let EzForm = class {
|
|
|
843
863
|
}
|
|
844
864
|
get _element() { return getElement(this); }
|
|
845
865
|
static get watchers() { return {
|
|
846
|
-
"config": ["
|
|
866
|
+
"config": ["observeConfig"]
|
|
847
867
|
}; }
|
|
848
868
|
};
|
|
849
869
|
EzForm.style = ezFormCss;
|
|
@@ -110810,7 +110810,7 @@ let EzGrid = class {
|
|
|
110810
110810
|
this._gridController.setColumnsDef(this._dataUnitBridge.buildColumnDefs(), true);
|
|
110811
110811
|
}
|
|
110812
110812
|
if (this.config) {
|
|
110813
|
-
this.
|
|
110813
|
+
this.observeConfig(this.config);
|
|
110814
110814
|
}
|
|
110815
110815
|
}
|
|
110816
110816
|
disconnectedCallback() {
|
|
@@ -110828,7 +110828,7 @@ let EzGrid = class {
|
|
|
110828
110828
|
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" })
|
|
110829
110829
|
];
|
|
110830
110830
|
}
|
|
110831
|
-
|
|
110831
|
+
observeConfig(config) {
|
|
110832
110832
|
this._gridController.setColumnsState(config.columns);
|
|
110833
110833
|
this.closeGridConfig();
|
|
110834
110834
|
}
|
|
@@ -110841,11 +110841,11 @@ let EzGrid = class {
|
|
|
110841
110841
|
this._popUpGridConfig = true;
|
|
110842
110842
|
}
|
|
110843
110843
|
render() {
|
|
110844
|
-
return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container" }, this.getPaginationControl())), h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), h("div", { class: "grid__footer" }), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.
|
|
110844
|
+
return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container" }, this.getPaginationControl())), h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), h("div", { class: "grid__footer" }), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, 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() }))));
|
|
110845
110845
|
}
|
|
110846
110846
|
static get assetsDirs() { return ["../assets"]; }
|
|
110847
110847
|
static get watchers() { return {
|
|
110848
|
-
"config": ["
|
|
110848
|
+
"config": ["observeConfig"]
|
|
110849
110849
|
}; }
|
|
110850
110850
|
};
|
|
110851
110851
|
EzGrid.style = ezGridCss;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-b21f0a10.js';
|
|
2
|
+
|
|
3
|
+
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%}}";
|
|
4
|
+
|
|
5
|
+
let EzLoadingBar = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this._showLoading = true;
|
|
9
|
+
}
|
|
10
|
+
hide() {
|
|
11
|
+
this._showLoading = false;
|
|
12
|
+
return Promise.resolve();
|
|
13
|
+
}
|
|
14
|
+
show() {
|
|
15
|
+
this._showLoading = true;
|
|
16
|
+
return Promise.resolve();
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return (h(Host, null, this._showLoading && h("div", { class: "loading-bar" }, h("div", { class: "loading-bar__container" }))));
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
EzLoadingBar.style = ezLoadingBarCss;
|
|
23
|
+
|
|
24
|
+
export { EzLoadingBar as ez_loading_bar };
|
|
@@ -25,7 +25,7 @@ let EzModal = class {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
observeOpened() {
|
|
29
29
|
if (this.opened) {
|
|
30
30
|
document.addEventListener("keydown", this.handleKeyboardEvent);
|
|
31
31
|
}
|
|
@@ -38,7 +38,7 @@ let EzModal = class {
|
|
|
38
38
|
this.ezCloseModal.emit(this.opened);
|
|
39
39
|
}
|
|
40
40
|
componentDidLoad() {
|
|
41
|
-
this.
|
|
41
|
+
this.observeOpened();
|
|
42
42
|
}
|
|
43
43
|
componentDidRender() {
|
|
44
44
|
if (this.opened) {
|
|
@@ -59,7 +59,7 @@ let EzModal = class {
|
|
|
59
59
|
undefined));
|
|
60
60
|
}
|
|
61
61
|
static get watchers() { return {
|
|
62
|
-
"opened": ["
|
|
62
|
+
"opened": ["observeOpened"]
|
|
63
63
|
}; }
|
|
64
64
|
};
|
|
65
65
|
EzModal.style = ezModalCss;
|
|
@@ -17,17 +17,6 @@ let EzNumberInput = class {
|
|
|
17
17
|
*/
|
|
18
18
|
this.mode = "regular";
|
|
19
19
|
}
|
|
20
|
-
setLabel() {
|
|
21
|
-
this._textInput.label = this.label;
|
|
22
|
-
}
|
|
23
|
-
setErrorMessage() {
|
|
24
|
-
this._textInput.errorMessage = this.errorMessage;
|
|
25
|
-
}
|
|
26
|
-
applyValueToInput() {
|
|
27
|
-
if (this._textInput) {
|
|
28
|
-
this._textInput.value = this.getTextValue(this.value);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
20
|
/**
|
|
32
21
|
* Realiza o foco no componente de input
|
|
33
22
|
*/
|
|
@@ -40,16 +29,34 @@ let EzNumberInput = class {
|
|
|
40
29
|
async setBlur() {
|
|
41
30
|
this._textInput.setBlur();
|
|
42
31
|
}
|
|
32
|
+
observeLabel() {
|
|
33
|
+
if (this._textInput) {
|
|
34
|
+
this._textInput.label = this.label;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
observeErrorMessage() {
|
|
38
|
+
if (this._textInput) {
|
|
39
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
observeValue() {
|
|
43
|
+
if (this._textInput) {
|
|
44
|
+
this._textInput.value = this.getTextValue(this.value) || '';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
43
47
|
changeValue(newValue) {
|
|
44
48
|
this.errorMessage = "";
|
|
45
49
|
if (newValue !== this.value) {
|
|
46
50
|
this.value = newValue;
|
|
47
51
|
this.ezChange.emit(this.value);
|
|
48
52
|
}
|
|
53
|
+
else {
|
|
54
|
+
this.observeValue();
|
|
55
|
+
}
|
|
49
56
|
}
|
|
50
57
|
parseNumber() {
|
|
51
|
-
const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) :
|
|
52
|
-
if (parsedNumber
|
|
58
|
+
const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) : undefined;
|
|
59
|
+
if (parsedNumber !== undefined && isNaN(parsedNumber)) {
|
|
53
60
|
this.errorMessage = "O valor digitado não é um número válido";
|
|
54
61
|
}
|
|
55
62
|
else {
|
|
@@ -66,19 +73,19 @@ let EzNumberInput = class {
|
|
|
66
73
|
if (value) {
|
|
67
74
|
return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
|
|
68
75
|
}
|
|
69
|
-
return
|
|
76
|
+
return undefined;
|
|
70
77
|
}
|
|
71
78
|
componentDidLoad() {
|
|
72
79
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
73
80
|
}
|
|
74
81
|
render() {
|
|
75
|
-
return (h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label,
|
|
82
|
+
return (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 }));
|
|
76
83
|
}
|
|
77
84
|
get _elem() { return getElement(this); }
|
|
78
85
|
static get watchers() { return {
|
|
79
|
-
"label": ["
|
|
80
|
-
"errorMessage": ["
|
|
81
|
-
"value": ["
|
|
86
|
+
"label": ["observeLabel"],
|
|
87
|
+
"errorMessage": ["observeErrorMessage"],
|
|
88
|
+
"value": ["observeValue"]
|
|
82
89
|
}; }
|
|
83
90
|
};
|
|
84
91
|
EzNumberInput.style = ezNumberInputCss;
|
|
@@ -70,7 +70,7 @@ let EzPopover = class {
|
|
|
70
70
|
this.ezVisibilityChange.emit(false);
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
observeOpened(newValue, oldValue) {
|
|
74
74
|
if (newValue != oldValue) {
|
|
75
75
|
this.ezVisibilityChange.emit(newValue);
|
|
76
76
|
}
|
|
@@ -127,7 +127,7 @@ let EzPopover = class {
|
|
|
127
127
|
}
|
|
128
128
|
get _host() { return getElement(this); }
|
|
129
129
|
static get watchers() { return {
|
|
130
|
-
"opened": ["
|
|
130
|
+
"opened": ["observeOpened"]
|
|
131
131
|
}; }
|
|
132
132
|
};
|
|
133
133
|
EzPopover.style = ezPopoverCss;
|
|
@@ -29,7 +29,7 @@ let EzSearch = class {
|
|
|
29
29
|
*/
|
|
30
30
|
this.mode = "regular";
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
observeValue() {
|
|
33
33
|
if (this._comboElement) {
|
|
34
34
|
this._comboElement.value = this.value;
|
|
35
35
|
}
|
|
@@ -60,7 +60,7 @@ let EzSearch = class {
|
|
|
60
60
|
;
|
|
61
61
|
get _elem() { return getElement(this); }
|
|
62
62
|
static get watchers() { return {
|
|
63
|
-
"value": ["
|
|
63
|
+
"value": ["observeValue"]
|
|
64
64
|
}; }
|
|
65
65
|
};
|
|
66
66
|
EzSearch.style = ezSearchCss;
|
|
@@ -23,7 +23,7 @@ let EzTextArea = class {
|
|
|
23
23
|
*/
|
|
24
24
|
this.mode = "regular";
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
observeErrorMessage() {
|
|
27
27
|
var _a, _b;
|
|
28
28
|
const hasError = typeof this.errorMessage === 'string' && this.errorMessage !== '';
|
|
29
29
|
if (hasError) {
|
|
@@ -35,13 +35,13 @@ let EzTextArea = class {
|
|
|
35
35
|
(_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove('hasError');
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
this._inputElem.value = this.value
|
|
38
|
+
observeValue() {
|
|
39
|
+
this._inputElem.value = this.value == undefined ? "" : this.value;
|
|
40
40
|
this.handleChange();
|
|
41
41
|
this.adjustFloatingLabel();
|
|
42
42
|
this.ezChange.emit(this.value);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
observeMode() {
|
|
45
45
|
if (this._initialRows == undefined) {
|
|
46
46
|
this._initialRows = this.rows > 0 ? this.rows : undefined;
|
|
47
47
|
}
|
|
@@ -50,7 +50,7 @@ let EzTextArea = class {
|
|
|
50
50
|
this.rows = rows;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
observeRows() {
|
|
54
54
|
const rows = this.rows > 0 ? this.rows : this.mode != "slim" ? 4 : 2;
|
|
55
55
|
if (rows !== this.rows) {
|
|
56
56
|
this.rows = rows;
|
|
@@ -116,9 +116,9 @@ let EzTextArea = class {
|
|
|
116
116
|
// Lifecycle web component
|
|
117
117
|
//---------------------------------------------
|
|
118
118
|
componentDidLoad() {
|
|
119
|
-
this.
|
|
119
|
+
this.observeErrorMessage();
|
|
120
120
|
this.adjustFloatingLabel();
|
|
121
|
-
this.
|
|
121
|
+
this.observeMode();
|
|
122
122
|
}
|
|
123
123
|
render() {
|
|
124
124
|
return (h(Host, null, h("div", { class: "textarea", ref: (el) => this._container = el }, this.label && this.mode != "slim" ?
|
|
@@ -128,10 +128,10 @@ let EzTextArea = class {
|
|
|
128
128
|
}
|
|
129
129
|
get _hostElement() { return getElement(this); }
|
|
130
130
|
static get watchers() { return {
|
|
131
|
-
"errorMessage": ["
|
|
132
|
-
"value": ["
|
|
133
|
-
"mode": ["
|
|
134
|
-
"rows": ["
|
|
131
|
+
"errorMessage": ["observeErrorMessage"],
|
|
132
|
+
"value": ["observeValue"],
|
|
133
|
+
"mode": ["observeMode"],
|
|
134
|
+
"rows": ["observeRows"]
|
|
135
135
|
}; }
|
|
136
136
|
};
|
|
137
137
|
EzTextArea.style = ezTextAreaCss;
|