@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
|
@@ -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
|
}
|
|
@@ -39,12 +39,7 @@ export default class DataBinder {
|
|
|
39
39
|
const oldValue = field["value"];
|
|
40
40
|
const newValue = this._dataUnit.getFieldValue(fieldName);
|
|
41
41
|
if (oldValue != newValue) {
|
|
42
|
-
|
|
43
|
-
field.removeAttribute("value");
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
field["value"] = newValue;
|
|
47
|
-
}
|
|
42
|
+
field["value"] = newValue;
|
|
48
43
|
}
|
|
49
44
|
}
|
|
50
45
|
updateBind(fieldName, field) {
|
|
@@ -52,13 +47,7 @@ export default class DataBinder {
|
|
|
52
47
|
if (oldBind) {
|
|
53
48
|
oldBind.destroy();
|
|
54
49
|
}
|
|
55
|
-
|
|
56
|
-
if (value === undefined) {
|
|
57
|
-
field.removeAttribute("value");
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
field["value"] = value;
|
|
61
|
-
}
|
|
50
|
+
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
62
51
|
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
63
52
|
this.bindSearchOptionsLoader(fieldName, field);
|
|
64
53
|
this.applyEzUploadContext(fieldName, field);
|
|
@@ -76,7 +65,7 @@ export default class DataBinder {
|
|
|
76
65
|
this._dataUnit.setFieldValue(fieldName, newValue);
|
|
77
66
|
}
|
|
78
67
|
bindSearchOptionsLoader(fieldName, field) {
|
|
79
|
-
if (field.nodeName === "EZ-SEARCH" && field["optionLoader"]
|
|
68
|
+
if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
|
|
80
69
|
const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
|
|
81
70
|
if (loader) {
|
|
82
71
|
field["optionLoader"] = (arg) => {
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0px;
|
|
4
|
+
width: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.loading-bar {
|
|
8
|
+
width:100%;
|
|
9
|
+
margin:0 auto;
|
|
10
|
+
position: absolute;
|
|
11
|
+
background-color: var(--color--primary-300, #e2f4ef);
|
|
12
|
+
height: 5px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.loading-bar:before {
|
|
16
|
+
content:'';
|
|
17
|
+
position:absolute;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.loading-bar__container {
|
|
21
|
+
position:absolute;
|
|
22
|
+
top:0;
|
|
23
|
+
right:100%;
|
|
24
|
+
bottom:0;
|
|
25
|
+
left:0;
|
|
26
|
+
background-color: var(--color--primary, #008561);
|
|
27
|
+
width:0;
|
|
28
|
+
animation: loading 2s linear infinite;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@keyframes loading {
|
|
32
|
+
0% {
|
|
33
|
+
left:0%;
|
|
34
|
+
right:100%;
|
|
35
|
+
width:0%;
|
|
36
|
+
}
|
|
37
|
+
25% {
|
|
38
|
+
left:0%;
|
|
39
|
+
right:75%;
|
|
40
|
+
width:25%;
|
|
41
|
+
}
|
|
42
|
+
50% {
|
|
43
|
+
left:0%;
|
|
44
|
+
right:50%;
|
|
45
|
+
width:90%;
|
|
46
|
+
}
|
|
47
|
+
70% {
|
|
48
|
+
right:0%;
|
|
49
|
+
left:75%;
|
|
50
|
+
width:25%;
|
|
51
|
+
}
|
|
52
|
+
100% {
|
|
53
|
+
left:100%;
|
|
54
|
+
right:0%;
|
|
55
|
+
width:0%;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@-webkit-keyframes loading {
|
|
60
|
+
0% {
|
|
61
|
+
left:0%;
|
|
62
|
+
right:100%;
|
|
63
|
+
width:0%;
|
|
64
|
+
}
|
|
65
|
+
25% {
|
|
66
|
+
left:0%;
|
|
67
|
+
right:75%;
|
|
68
|
+
width:25%;
|
|
69
|
+
}
|
|
70
|
+
50% {
|
|
71
|
+
left:0%;
|
|
72
|
+
right:50%;
|
|
73
|
+
width:90%;
|
|
74
|
+
}
|
|
75
|
+
70% {
|
|
76
|
+
right:0%;
|
|
77
|
+
left:75%;
|
|
78
|
+
width:25%;
|
|
79
|
+
}
|
|
80
|
+
100% {
|
|
81
|
+
left:100%;
|
|
82
|
+
right:0%;
|
|
83
|
+
width:0%;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Component, h, Host, State, Method } from '@stencil/core';
|
|
2
|
+
export class EzLoadingBar {
|
|
3
|
+
constructor() {
|
|
4
|
+
this._showLoading = true;
|
|
5
|
+
}
|
|
6
|
+
hide() {
|
|
7
|
+
this._showLoading = false;
|
|
8
|
+
return Promise.resolve();
|
|
9
|
+
}
|
|
10
|
+
show() {
|
|
11
|
+
this._showLoading = true;
|
|
12
|
+
return Promise.resolve();
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
return (h(Host, null, this._showLoading && h("div", { class: "loading-bar" },
|
|
16
|
+
h("div", { class: "loading-bar__container" }))));
|
|
17
|
+
}
|
|
18
|
+
static get is() { return "ez-loading-bar"; }
|
|
19
|
+
static get encapsulation() { return "shadow"; }
|
|
20
|
+
static get originalStyleUrls() { return {
|
|
21
|
+
"$": ["ez-loading-bar.css"]
|
|
22
|
+
}; }
|
|
23
|
+
static get styleUrls() { return {
|
|
24
|
+
"$": ["ez-loading-bar.css"]
|
|
25
|
+
}; }
|
|
26
|
+
static get states() { return {
|
|
27
|
+
"_showLoading": {}
|
|
28
|
+
}; }
|
|
29
|
+
static get methods() { return {
|
|
30
|
+
"hide": {
|
|
31
|
+
"complexType": {
|
|
32
|
+
"signature": "() => Promise<void>",
|
|
33
|
+
"parameters": [],
|
|
34
|
+
"references": {
|
|
35
|
+
"Promise": {
|
|
36
|
+
"location": "global"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"return": "Promise<void>"
|
|
40
|
+
},
|
|
41
|
+
"docs": {
|
|
42
|
+
"text": "",
|
|
43
|
+
"tags": []
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"show": {
|
|
47
|
+
"complexType": {
|
|
48
|
+
"signature": "() => Promise<void>",
|
|
49
|
+
"parameters": [],
|
|
50
|
+
"references": {
|
|
51
|
+
"Promise": {
|
|
52
|
+
"location": "global"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"return": "Promise<void>"
|
|
56
|
+
},
|
|
57
|
+
"docs": {
|
|
58
|
+
"text": "",
|
|
59
|
+
"tags": []
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}; }
|
|
63
|
+
}
|
|
@@ -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
|
}
|