@sankhyalabs/ezui 1.1.135 → 1.1.138
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-collapsible-box.cjs.entry.js +1 -1
- 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 +36 -5
- package/dist/cjs/ez-grid.cjs.entry.js +4 -4
- 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 +22 -15
- package/dist/cjs/ez-time-input.cjs.entry.js +36 -30
- package/dist/cjs/ez-upload.cjs.entry.js +5 -5
- 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 +1 -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-collapsible-box/ez-collapsible-box.css +14 -2
- 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/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-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 +40 -15
- package/dist/collection/components/ez-time-input/ez-time-input.js +52 -31
- package/dist/collection/components/ez-upload/ez-upload.css +1 -0
- 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 +6 -0
- package/dist/custom-elements/index.js +293 -142
- package/dist/esm/ez-calendar.entry.js +2 -2
- package/dist/esm/ez-check.entry.js +3 -3
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- 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 +36 -5
- package/dist/esm/ez-grid.entry.js +4 -4
- 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 +22 -15
- package/dist/esm/ez-time-input.entry.js +37 -31
- package/dist/esm/ez-upload.entry.js +5 -5
- 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-30e3793f.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-659df655.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-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-cabe3671.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-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 +29 -0
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -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-67d30ea7.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-dcf5f013.entry.js +0 -1
- package/dist/ezui/p-e472517c.entry.js +0 -1
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
--ez-collapsible-box--font-weight: var(--text-weight--large, 600);
|
|
8
8
|
/*@doc Define a cor da fonte do header.*/
|
|
9
9
|
--ez-collapsible-box--color: var(--title--primary);
|
|
10
|
+
/*@doc Define a cor do texto e do ícone quando o componente está focado.*/
|
|
11
|
+
--ez-collapsible-box--focus--color: var(--color--primary-600);
|
|
10
12
|
/*@doc Define a cor do chevron.*/
|
|
11
13
|
--ez-collapsible-box__icon--color: var(--ez-collapsible-box--color);
|
|
12
14
|
/*@doc Define o espaçamento superior ao header.*/
|
|
@@ -27,6 +29,10 @@
|
|
|
27
29
|
width: 100%;
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
ez-icon {
|
|
33
|
+
--ez-icon--color: inherit;
|
|
34
|
+
}
|
|
35
|
+
|
|
30
36
|
.collapsible-box {
|
|
31
37
|
/*private*/
|
|
32
38
|
display: flex;
|
|
@@ -61,9 +67,17 @@
|
|
|
61
67
|
text-align: left;
|
|
62
68
|
|
|
63
69
|
/*public*/
|
|
70
|
+
color: var(--ez-collapsible-box--color);
|
|
71
|
+
--ez-icon--color: var(--ez-collapsible-box__icon--color);
|
|
64
72
|
margin-bottom: var(--space--medium, 12px);
|
|
65
73
|
}
|
|
66
74
|
|
|
75
|
+
.collapsible-box__title:focus {
|
|
76
|
+
/*public*/
|
|
77
|
+
color: var(--ez-collapsible-box--focus--color);
|
|
78
|
+
--ez-icon--color: var(--ez-collapsible-box--focus--color);
|
|
79
|
+
}
|
|
80
|
+
|
|
67
81
|
.collapsible-box__label {
|
|
68
82
|
/*private*/
|
|
69
83
|
white-space: nowrap;
|
|
@@ -77,7 +91,6 @@
|
|
|
77
91
|
font-family: var(--ez-collapsible-box--font-family);
|
|
78
92
|
font-size: var(--ez-collapsible-box--font-size);
|
|
79
93
|
font-weight: var(--ez-collapsible-box--font-weight);
|
|
80
|
-
color: var(--ez-collapsible-box--color);
|
|
81
94
|
}
|
|
82
95
|
|
|
83
96
|
.collapsible-box__icon {
|
|
@@ -86,7 +99,6 @@
|
|
|
86
99
|
|
|
87
100
|
/*public*/
|
|
88
101
|
transition: transform var(--transition);
|
|
89
|
-
--ez-icon--color: var(--ez-collapsible-box__icon--color, --ez-collapsible-box--color);
|
|
90
102
|
}
|
|
91
103
|
|
|
92
104
|
.collapsible-box__icon--collapsed {
|
|
@@ -32,7 +32,7 @@ export class EzComboBox {
|
|
|
32
32
|
*/
|
|
33
33
|
this.mode = "regular";
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
observeValue() {
|
|
36
36
|
if (this._inputElement) {
|
|
37
37
|
this._inputElement.value = this.getText();
|
|
38
38
|
}
|
|
@@ -150,7 +150,7 @@ export class EzComboBox {
|
|
|
150
150
|
this.ezChange.emit(adjustedOpt);
|
|
151
151
|
}
|
|
152
152
|
else {
|
|
153
|
-
this.
|
|
153
|
+
this.observeValue();
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
updateSource(source) {
|
|
@@ -182,7 +182,7 @@ export class EzComboBox {
|
|
|
182
182
|
this.selectOption(undefined);
|
|
183
183
|
}
|
|
184
184
|
else {
|
|
185
|
-
this.
|
|
185
|
+
this.observeValue();
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
//---------------------------------------------
|
|
@@ -273,7 +273,7 @@ export class EzComboBox {
|
|
|
273
273
|
}
|
|
274
274
|
render() {
|
|
275
275
|
return (h(Host, null,
|
|
276
|
-
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(),
|
|
276
|
+
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 },
|
|
277
277
|
h("button", { class: "btn", slot: this.searchMode ? "leftIcon" : "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() },
|
|
278
278
|
h("ez-icon", { slot: "icon", "icon-name": this.searchMode ? "search" : "chevron-down" }))),
|
|
279
279
|
h("section", { class: "list-container", ref: elem => this._listContainer = elem },
|
|
@@ -589,7 +589,7 @@ export class EzComboBox {
|
|
|
589
589
|
static get elementRef() { return "el"; }
|
|
590
590
|
static get watchers() { return [{
|
|
591
591
|
"propName": "value",
|
|
592
|
-
"methodName": "
|
|
592
|
+
"methodName": "observeValue"
|
|
593
593
|
}]; }
|
|
594
594
|
}
|
|
595
595
|
;
|
|
@@ -12,13 +12,13 @@ export class EzDateInput {
|
|
|
12
12
|
*/
|
|
13
13
|
this.mode = "regular";
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
observeLabel() {
|
|
16
16
|
this._textInput.label = this.label;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
observeErrorMessage() {
|
|
19
19
|
this._textInput.errorMessage = this.errorMessage;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
observeValue() {
|
|
22
22
|
if (this._textInput) {
|
|
23
23
|
this._textInput.value = this.getTextValue(this.value);
|
|
24
24
|
}
|
|
@@ -37,8 +37,8 @@ export class EzDateInput {
|
|
|
37
37
|
}
|
|
38
38
|
changeValue(newValue) {
|
|
39
39
|
var _a;
|
|
40
|
-
newValue = newValue instanceof Date ? DateUtils.clearTime(newValue) :
|
|
41
|
-
this.value = this.value instanceof Date ? DateUtils.clearTime(this.value) :
|
|
40
|
+
newValue = newValue instanceof Date ? DateUtils.clearTime(newValue) : undefined;
|
|
41
|
+
this.value = this.value instanceof Date ? DateUtils.clearTime(this.value) : undefined;
|
|
42
42
|
this._textInput.errorMessage = "";
|
|
43
43
|
if ((newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString())) {
|
|
44
44
|
this.value = newValue;
|
|
@@ -74,7 +74,7 @@ export class EzDateInput {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
getTextValue(d) {
|
|
77
|
-
return d ? new Intl.DateTimeFormat("pt-BR").format(d) :
|
|
77
|
+
return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
|
|
78
78
|
}
|
|
79
79
|
componentDidLoad() {
|
|
80
80
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
@@ -82,7 +82,7 @@ export class EzDateInput {
|
|
|
82
82
|
render() {
|
|
83
83
|
return (h(Host, null,
|
|
84
84
|
h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { if (event.key === "H" || event.key === "h")
|
|
85
|
-
this.changeValue(new Date()); }, label: this.label,
|
|
85
|
+
this.changeValue(new Date()); }, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true },
|
|
86
86
|
h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })),
|
|
87
87
|
h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
|
|
88
88
|
}
|
|
@@ -242,12 +242,12 @@ export class EzDateInput {
|
|
|
242
242
|
static get elementRef() { return "_elem"; }
|
|
243
243
|
static get watchers() { return [{
|
|
244
244
|
"propName": "label",
|
|
245
|
-
"methodName": "
|
|
245
|
+
"methodName": "observeLabel"
|
|
246
246
|
}, {
|
|
247
247
|
"propName": "errorMessage",
|
|
248
|
-
"methodName": "
|
|
248
|
+
"methodName": "observeErrorMessage"
|
|
249
249
|
}, {
|
|
250
250
|
"propName": "value",
|
|
251
|
-
"methodName": "
|
|
251
|
+
"methodName": "observeValue"
|
|
252
252
|
}]; }
|
|
253
253
|
}
|
|
@@ -16,13 +16,13 @@ export class EzDateTimeInput {
|
|
|
16
16
|
*/
|
|
17
17
|
this.mode = "regular";
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
observeLabel() {
|
|
20
20
|
this._textInput.label = this.label;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
observeErrorMessage() {
|
|
23
23
|
this._textInput.errorMessage = this.errorMessage;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
observeValue() {
|
|
26
26
|
if (this._textInput) {
|
|
27
27
|
this._textInput.value = this.getTextValue(this.value);
|
|
28
28
|
}
|
|
@@ -120,14 +120,14 @@ export class EzDateTimeInput {
|
|
|
120
120
|
year: 'numeric', month: 'numeric', day: 'numeric',
|
|
121
121
|
hour: 'numeric', minute: 'numeric', second: 'numeric'
|
|
122
122
|
};
|
|
123
|
-
return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) :
|
|
123
|
+
return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
|
|
124
124
|
}
|
|
125
125
|
componentDidLoad() {
|
|
126
126
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
127
127
|
}
|
|
128
128
|
render() {
|
|
129
129
|
return (h(Host, null,
|
|
130
|
-
h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { this.onChangeKeyDown(event); }, label: this.label,
|
|
130
|
+
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 },
|
|
131
131
|
h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })),
|
|
132
132
|
h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
|
|
133
133
|
}
|
|
@@ -305,12 +305,12 @@ export class EzDateTimeInput {
|
|
|
305
305
|
static get elementRef() { return "_elem"; }
|
|
306
306
|
static get watchers() { return [{
|
|
307
307
|
"propName": "label",
|
|
308
|
-
"methodName": "
|
|
308
|
+
"methodName": "observeLabel"
|
|
309
309
|
}, {
|
|
310
310
|
"propName": "errorMessage",
|
|
311
|
-
"methodName": "
|
|
311
|
+
"methodName": "observeErrorMessage"
|
|
312
312
|
}, {
|
|
313
313
|
"propName": "value",
|
|
314
|
-
"methodName": "
|
|
314
|
+
"methodName": "observeValue"
|
|
315
315
|
}]; }
|
|
316
316
|
}
|
|
@@ -11,17 +11,17 @@ export class EzFilterInput {
|
|
|
11
11
|
*/
|
|
12
12
|
this.mode = "regular";
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
observeLabel() {
|
|
15
15
|
if (this._textInput) {
|
|
16
16
|
this._textInput.label = this.label;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
observeErrorMessage() {
|
|
20
20
|
if (this._textInput) {
|
|
21
21
|
this._textInput.errorMessage = this.errorMessage;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
observeValue() {
|
|
25
25
|
if (this._textInput) {
|
|
26
26
|
this._textInput.value = this.value;
|
|
27
27
|
}
|
|
@@ -237,12 +237,12 @@ export class EzFilterInput {
|
|
|
237
237
|
static get elementRef() { return "_elem"; }
|
|
238
238
|
static get watchers() { return [{
|
|
239
239
|
"propName": "label",
|
|
240
|
-
"methodName": "
|
|
240
|
+
"methodName": "observeLabel"
|
|
241
241
|
}, {
|
|
242
242
|
"propName": "errorMessage",
|
|
243
|
-
"methodName": "
|
|
243
|
+
"methodName": "observeErrorMessage"
|
|
244
244
|
}, {
|
|
245
245
|
"propName": "value",
|
|
246
|
-
"methodName": "
|
|
246
|
+
"methodName": "observeValue"
|
|
247
247
|
}]; }
|
|
248
248
|
}
|
|
@@ -37,7 +37,7 @@ export class EzForm {
|
|
|
37
37
|
accept();
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
observeConfig() {
|
|
41
41
|
this.processMetadata();
|
|
42
42
|
}
|
|
43
43
|
validateRequired(requiredFields, record) {
|
|
@@ -99,6 +99,21 @@ export class EzForm {
|
|
|
99
99
|
}));
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
if (action.type === Action.RECORDS_ADDED) {
|
|
103
|
+
debugger;
|
|
104
|
+
const metadata = selectFormMetadata(this._store.getState());
|
|
105
|
+
const defaultValues = metadata.getDefaultValues();
|
|
106
|
+
if (defaultValues) {
|
|
107
|
+
const records = action.payload;
|
|
108
|
+
return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
|
|
109
|
+
const newRecord = Object.assign({}, record);
|
|
110
|
+
for (const field in defaultValues) {
|
|
111
|
+
newRecord[field] = this.dataUnit.valueFromString(field, defaultValues[field]);
|
|
112
|
+
}
|
|
113
|
+
return newRecord;
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
102
117
|
return action;
|
|
103
118
|
}
|
|
104
119
|
componentWillLoad() {
|
|
@@ -252,6 +267,6 @@ export class EzForm {
|
|
|
252
267
|
static get elementRef() { return "_element"; }
|
|
253
268
|
static get watchers() { return [{
|
|
254
269
|
"propName": "config",
|
|
255
|
-
"methodName": "
|
|
270
|
+
"methodName": "observeConfig"
|
|
256
271
|
}]; }
|
|
257
272
|
}
|
|
@@ -3,6 +3,7 @@ export class FormMetadata {
|
|
|
3
3
|
this._sheets = new Map();
|
|
4
4
|
this._requiredFields = [];
|
|
5
5
|
this._cleanOnCopyFields = [];
|
|
6
|
+
this._defaultValues = {};
|
|
6
7
|
}
|
|
7
8
|
getSheet(name) {
|
|
8
9
|
return this._sheets.get(name);
|
|
@@ -14,6 +15,7 @@ export class FormMetadata {
|
|
|
14
15
|
this._sheets.set(sheet.name, sheet);
|
|
15
16
|
this._requiredFields = this._requiredFields.concat(sheet.requiredFields);
|
|
16
17
|
this._cleanOnCopyFields = this._cleanOnCopyFields.concat(sheet.cleanOnCopyFields);
|
|
18
|
+
this._defaultValues = sheet.defaultValues;
|
|
17
19
|
}
|
|
18
20
|
getRequiredFields() {
|
|
19
21
|
return this._requiredFields;
|
|
@@ -21,6 +23,9 @@ export class FormMetadata {
|
|
|
21
23
|
getCleanOnCopyFields() {
|
|
22
24
|
return this._cleanOnCopyFields;
|
|
23
25
|
}
|
|
26
|
+
getDefaultValues() {
|
|
27
|
+
return this._defaultValues;
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
export const buildFromDataUnit = (dataUnit) => {
|
|
26
31
|
var _a;
|
|
@@ -28,6 +33,10 @@ export const buildFromDataUnit = (dataUnit) => {
|
|
|
28
33
|
const metadata = new FormMetadata();
|
|
29
34
|
if (unitMD) {
|
|
30
35
|
const visibleFields = (_a = unitMD.fields) === null || _a === void 0 ? void 0 : _a.filter(descriptor => descriptor.visible !== false);
|
|
36
|
+
let defaultValues = {};
|
|
37
|
+
visibleFields
|
|
38
|
+
.filter(descriptor => descriptor.defaultValue)
|
|
39
|
+
.map((descriptor) => defaultValues[descriptor.name] = descriptor.defaultValue);
|
|
31
40
|
metadata.addSheet({
|
|
32
41
|
label: unitMD.label,
|
|
33
42
|
name: unitMD.name,
|
|
@@ -37,7 +46,8 @@ export const buildFromDataUnit = (dataUnit) => {
|
|
|
37
46
|
.map(descriptor => descriptor.name),
|
|
38
47
|
cleanOnCopyFields: visibleFields
|
|
39
48
|
.filter(descriptor => { var _a; return (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy; })
|
|
40
|
-
.map(descriptor => descriptor.name)
|
|
49
|
+
.map(descriptor => descriptor.name),
|
|
50
|
+
defaultValues
|
|
41
51
|
});
|
|
42
52
|
}
|
|
43
53
|
return metadata;
|
|
@@ -53,8 +63,9 @@ export const buildFromConfig = (fields, dataUnit) => {
|
|
|
53
63
|
const sheets = new Map();
|
|
54
64
|
const requiredFields = [];
|
|
55
65
|
const cleanOnCopyFields = [];
|
|
66
|
+
const defaultValues = {};
|
|
56
67
|
fields.forEach(config => {
|
|
57
|
-
var _a;
|
|
68
|
+
var _a, _b;
|
|
58
69
|
if (config.visible !== false) {
|
|
59
70
|
const tabConfig = getTabConfig(config.tab || "Geral", sheets);
|
|
60
71
|
const descriptor = dataUnit.getField(config.name);
|
|
@@ -71,6 +82,10 @@ export const buildFromConfig = (fields, dataUnit) => {
|
|
|
71
82
|
if (clearOnCopy) {
|
|
72
83
|
cleanOnCopyFields.push(config.name);
|
|
73
84
|
}
|
|
85
|
+
const defaultValue = config.defaultValue === undefined ? (_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.defaultValue : config.defaultValue;
|
|
86
|
+
if (defaultValue) {
|
|
87
|
+
defaultValues[config.name] = config.defaultValue;
|
|
88
|
+
}
|
|
74
89
|
const fieldMD = { config, descriptor };
|
|
75
90
|
const group = config.group;
|
|
76
91
|
if (group) {
|
|
@@ -97,7 +112,8 @@ export const buildFromConfig = (fields, dataUnit) => {
|
|
|
97
112
|
name: key.label,
|
|
98
113
|
items: Array.from(value.values()),
|
|
99
114
|
requiredFields,
|
|
100
|
-
cleanOnCopyFields
|
|
115
|
+
cleanOnCopyFields,
|
|
116
|
+
defaultValues
|
|
101
117
|
});
|
|
102
118
|
});
|
|
103
119
|
return metadata;
|
|
@@ -226,7 +226,7 @@ export class EzGrid {
|
|
|
226
226
|
this._gridController.setColumnsDef(this._dataUnitBridge.buildColumnDefs(), true);
|
|
227
227
|
}
|
|
228
228
|
if (this.config) {
|
|
229
|
-
this.
|
|
229
|
+
this.observeConfig(this.config);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
disconnectedCallback() {
|
|
@@ -246,7 +246,7 @@ export class EzGrid {
|
|
|
246
246
|
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" })
|
|
247
247
|
];
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
observeConfig(config) {
|
|
250
250
|
this._gridController.setColumnsState(config.columns);
|
|
251
251
|
this.closeGridConfig();
|
|
252
252
|
}
|
|
@@ -267,7 +267,7 @@ export class EzGrid {
|
|
|
267
267
|
h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }),
|
|
268
268
|
h("div", { class: "grid__footer" }),
|
|
269
269
|
h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() },
|
|
270
|
-
h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.
|
|
270
|
+
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() }))));
|
|
271
271
|
}
|
|
272
272
|
static get is() { return "ez-grid"; }
|
|
273
273
|
static get encapsulation() { return "scoped"; }
|
|
@@ -833,6 +833,6 @@ export class EzGrid {
|
|
|
833
833
|
}; }
|
|
834
834
|
static get watchers() { return [{
|
|
835
835
|
"propName": "config",
|
|
836
|
-
"methodName": "
|
|
836
|
+
"methodName": "observeConfig"
|
|
837
837
|
}]; }
|
|
838
838
|
}
|
|
@@ -19,7 +19,7 @@ export class EzModal {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
observeOpened() {
|
|
23
23
|
if (this.opened) {
|
|
24
24
|
document.addEventListener("keydown", this.handleKeyboardEvent);
|
|
25
25
|
}
|
|
@@ -32,7 +32,7 @@ export class EzModal {
|
|
|
32
32
|
this.ezCloseModal.emit(this.opened);
|
|
33
33
|
}
|
|
34
34
|
componentDidLoad() {
|
|
35
|
-
this.
|
|
35
|
+
this.observeOpened();
|
|
36
36
|
}
|
|
37
37
|
componentDidRender() {
|
|
38
38
|
if (this.opened) {
|
|
@@ -186,6 +186,6 @@ export class EzModal {
|
|
|
186
186
|
}]; }
|
|
187
187
|
static get watchers() { return [{
|
|
188
188
|
"propName": "opened",
|
|
189
|
-
"methodName": "
|
|
189
|
+
"methodName": "observeOpened"
|
|
190
190
|
}]; }
|
|
191
191
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NumberUtils } from "@sankhyalabs/core";
|
|
2
|
-
import { Component, h, Event, Prop,
|
|
2
|
+
import { Component, h, Event, Prop, Element, Method, Watch } from "@stencil/core";
|
|
3
3
|
import CSSVarsUtils from "../../utils/CSSVarsUtils";
|
|
4
4
|
export class EzNumberInput {
|
|
5
5
|
constructor() {
|
|
@@ -12,17 +12,6 @@ export class EzNumberInput {
|
|
|
12
12
|
*/
|
|
13
13
|
this.mode = "regular";
|
|
14
14
|
}
|
|
15
|
-
setLabel() {
|
|
16
|
-
this._textInput.label = this.label;
|
|
17
|
-
}
|
|
18
|
-
setErrorMessage() {
|
|
19
|
-
this._textInput.errorMessage = this.errorMessage;
|
|
20
|
-
}
|
|
21
|
-
applyValueToInput() {
|
|
22
|
-
if (this._textInput) {
|
|
23
|
-
this._textInput.value = this.getTextValue(this.value);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
15
|
/**
|
|
27
16
|
* Realiza o foco no componente de input
|
|
28
17
|
*/
|
|
@@ -35,16 +24,34 @@ export class EzNumberInput {
|
|
|
35
24
|
async setBlur() {
|
|
36
25
|
this._textInput.setBlur();
|
|
37
26
|
}
|
|
27
|
+
observeLabel() {
|
|
28
|
+
if (this._textInput) {
|
|
29
|
+
this._textInput.label = this.label;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
observeErrorMessage() {
|
|
33
|
+
if (this._textInput) {
|
|
34
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
observeValue() {
|
|
38
|
+
if (this._textInput) {
|
|
39
|
+
this._textInput.value = this.getTextValue(this.value) || '';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
38
42
|
changeValue(newValue) {
|
|
39
43
|
this.errorMessage = "";
|
|
40
44
|
if (newValue !== this.value) {
|
|
41
45
|
this.value = newValue;
|
|
42
46
|
this.ezChange.emit(this.value);
|
|
43
47
|
}
|
|
48
|
+
else {
|
|
49
|
+
this.observeValue();
|
|
50
|
+
}
|
|
44
51
|
}
|
|
45
52
|
parseNumber() {
|
|
46
|
-
const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) :
|
|
47
|
-
if (parsedNumber
|
|
53
|
+
const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) : undefined;
|
|
54
|
+
if (parsedNumber !== undefined && isNaN(parsedNumber)) {
|
|
48
55
|
this.errorMessage = "O valor digitado não é um número válido";
|
|
49
56
|
}
|
|
50
57
|
else {
|
|
@@ -61,13 +68,13 @@ export class EzNumberInput {
|
|
|
61
68
|
if (value) {
|
|
62
69
|
return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
|
|
63
70
|
}
|
|
64
|
-
return
|
|
71
|
+
return undefined;
|
|
65
72
|
}
|
|
66
73
|
componentDidLoad() {
|
|
67
74
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
68
75
|
}
|
|
69
76
|
render() {
|
|
70
|
-
return (h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label,
|
|
77
|
+
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 }));
|
|
71
78
|
}
|
|
72
79
|
static get is() { return "ez-number-input"; }
|
|
73
80
|
static get encapsulation() { return "shadow"; }
|
|
@@ -253,12 +260,12 @@ export class EzNumberInput {
|
|
|
253
260
|
static get elementRef() { return "_elem"; }
|
|
254
261
|
static get watchers() { return [{
|
|
255
262
|
"propName": "label",
|
|
256
|
-
"methodName": "
|
|
263
|
+
"methodName": "observeLabel"
|
|
257
264
|
}, {
|
|
258
265
|
"propName": "errorMessage",
|
|
259
|
-
"methodName": "
|
|
266
|
+
"methodName": "observeErrorMessage"
|
|
260
267
|
}, {
|
|
261
268
|
"propName": "value",
|
|
262
|
-
"methodName": "
|
|
269
|
+
"methodName": "observeValue"
|
|
263
270
|
}]; }
|
|
264
271
|
}
|
|
@@ -65,7 +65,7 @@ export class EzPopover {
|
|
|
65
65
|
this.ezVisibilityChange.emit(false);
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
observeOpened(newValue, oldValue) {
|
|
69
69
|
if (newValue != oldValue) {
|
|
70
70
|
this.ezVisibilityChange.emit(newValue);
|
|
71
71
|
}
|
|
@@ -372,6 +372,6 @@ export class EzPopover {
|
|
|
372
372
|
static get elementRef() { return "_host"; }
|
|
373
373
|
static get watchers() { return [{
|
|
374
374
|
"propName": "opened",
|
|
375
|
-
"methodName": "
|
|
375
|
+
"methodName": "observeOpened"
|
|
376
376
|
}]; }
|
|
377
377
|
}
|
|
@@ -23,7 +23,7 @@ export class EzSearch {
|
|
|
23
23
|
*/
|
|
24
24
|
this.mode = "regular";
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
observeValue() {
|
|
27
27
|
if (this._comboElement) {
|
|
28
28
|
this._comboElement.value = this.value;
|
|
29
29
|
}
|
|
@@ -300,6 +300,6 @@ export class EzSearch {
|
|
|
300
300
|
static get elementRef() { return "_elem"; }
|
|
301
301
|
static get watchers() { return [{
|
|
302
302
|
"propName": "value",
|
|
303
|
-
"methodName": "
|
|
303
|
+
"methodName": "observeValue"
|
|
304
304
|
}]; }
|
|
305
305
|
}
|
|
@@ -18,7 +18,7 @@ export class EzTextArea {
|
|
|
18
18
|
*/
|
|
19
19
|
this.mode = "regular";
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
observeErrorMessage() {
|
|
22
22
|
var _a, _b;
|
|
23
23
|
const hasError = typeof this.errorMessage === 'string' && this.errorMessage !== '';
|
|
24
24
|
if (hasError) {
|
|
@@ -30,13 +30,13 @@ export class EzTextArea {
|
|
|
30
30
|
(_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove('hasError');
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
this._inputElem.value = this.value
|
|
33
|
+
observeValue() {
|
|
34
|
+
this._inputElem.value = this.value == undefined ? "" : this.value;
|
|
35
35
|
this.handleChange();
|
|
36
36
|
this.adjustFloatingLabel();
|
|
37
37
|
this.ezChange.emit(this.value);
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
observeMode() {
|
|
40
40
|
if (this._initialRows == undefined) {
|
|
41
41
|
this._initialRows = this.rows > 0 ? this.rows : undefined;
|
|
42
42
|
}
|
|
@@ -45,7 +45,7 @@ export class EzTextArea {
|
|
|
45
45
|
this.rows = rows;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
observeRows() {
|
|
49
49
|
const rows = this.rows > 0 ? this.rows : this.mode != "slim" ? 4 : 2;
|
|
50
50
|
if (rows !== this.rows) {
|
|
51
51
|
this.rows = rows;
|
|
@@ -111,9 +111,9 @@ export class EzTextArea {
|
|
|
111
111
|
// Lifecycle web component
|
|
112
112
|
//---------------------------------------------
|
|
113
113
|
componentDidLoad() {
|
|
114
|
-
this.
|
|
114
|
+
this.observeErrorMessage();
|
|
115
115
|
this.adjustFloatingLabel();
|
|
116
|
-
this.
|
|
116
|
+
this.observeMode();
|
|
117
117
|
}
|
|
118
118
|
render() {
|
|
119
119
|
return (h(Host, null,
|
|
@@ -328,15 +328,15 @@ export class EzTextArea {
|
|
|
328
328
|
static get elementRef() { return "_hostElement"; }
|
|
329
329
|
static get watchers() { return [{
|
|
330
330
|
"propName": "errorMessage",
|
|
331
|
-
"methodName": "
|
|
331
|
+
"methodName": "observeErrorMessage"
|
|
332
332
|
}, {
|
|
333
333
|
"propName": "value",
|
|
334
|
-
"methodName": "
|
|
334
|
+
"methodName": "observeValue"
|
|
335
335
|
}, {
|
|
336
336
|
"propName": "mode",
|
|
337
|
-
"methodName": "
|
|
337
|
+
"methodName": "observeMode"
|
|
338
338
|
}, {
|
|
339
339
|
"propName": "rows",
|
|
340
|
-
"methodName": "
|
|
340
|
+
"methodName": "observeRows"
|
|
341
341
|
}]; }
|
|
342
342
|
}
|