@sankhyalabs/ezui 1.1.75 → 1.1.76
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-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-button_16.cjs.entry.js +127 -119
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +21 -2
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/{index-4d2896bb.js → index-9431aeeb.js} +2 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/ez-button/ez-button.css +62 -43
- package/dist/collection/components/ez-button/ez-button.js +9 -2
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +34 -34
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +12 -12
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +2 -2
- package/dist/collection/components/ez-date-input/ez-date-input.css +17 -3
- package/dist/collection/components/ez-date-input/ez-date-input.js +2 -2
- package/dist/collection/components/ez-form/ez-form.js +37 -35
- package/dist/collection/components/ez-form/store/Form.actions.js +16 -16
- package/dist/collection/components/ez-form/store/Form.reducer.js +17 -17
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +8 -8
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +12 -12
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +1 -1
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +21 -21
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +7 -7
- package/dist/collection/components/ez-numeric-input/ez-numeric-input.css +4 -4
- package/dist/collection/components/ez-text-input/ez-text-input.css +60 -60
- package/dist/collection/components/ez-text-input/ez-text-input.js +16 -16
- package/dist/collection/components/ez-time-input/ez-time-input.js +3 -2
- package/dist/collection/utils/AssetsUtils.js +19 -0
- package/dist/custom-elements/index.js +149 -122
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-button_16.entry.js +127 -119
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +21 -2
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +2 -2
- package/dist/esm/{index-33153059.js → index-fd3c8023.js} +2 -1
- package/dist/esm/loader.js +2 -2
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-67410dfa.entry.js → p-11ae4ae7.entry.js} +1 -1
- package/dist/ezui/{p-50464bdf.entry.js → p-47fa3d6c.entry.js} +1 -1
- package/dist/ezui/{p-0d476efb.entry.js → p-66954a04.entry.js} +1 -1
- package/dist/ezui/{p-47406a6e.entry.js → p-823ff0a0.entry.js} +1 -1
- package/dist/ezui/{p-7f3bc6d9.entry.js → p-8ab6168f.entry.js} +1 -1
- package/dist/ezui/{p-15743b09.entry.js → p-9c1fb51c.entry.js} +1 -1
- package/dist/ezui/{p-061d21ba.entry.js → p-9d85125b.entry.js} +1 -1
- package/dist/ezui/{p-34d288d0.entry.js → p-a0b6eee2.entry.js} +1 -1
- package/dist/ezui/p-a7b546b2.entry.js +1 -0
- package/dist/ezui/p-c833c94f.entry.js +1 -0
- package/dist/ezui/{p-8818da66.entry.js → p-d443f020.entry.js} +1 -1
- package/dist/ezui/{p-4df6f855.js → p-e0ab3746.js} +1 -1
- package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +3 -3
- package/dist/types/components/ez-form/ez-form.d.ts +9 -9
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +1 -1
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +1 -1
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +1 -1
- package/dist/types/components.d.ts +18 -18
- package/dist/types/utils/AssetsUtils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/ezui/p-46d07e59.entry.js +0 -1
- package/dist/ezui/p-7be54779.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, h, Host, Prop, Event, Watch, Method } from
|
|
1
|
+
import { Component, h, Host, Prop, Event, Watch, Method } from "@stencil/core";
|
|
2
2
|
export class EzCollapsibleBox {
|
|
3
3
|
constructor() {
|
|
4
4
|
/**
|
|
@@ -8,11 +8,11 @@ export class EzCollapsibleBox {
|
|
|
8
8
|
/**
|
|
9
9
|
* Define o tamanho do texto e do ícone do componente.
|
|
10
10
|
*/
|
|
11
|
-
this.
|
|
11
|
+
this.headerSize = "small";
|
|
12
12
|
/**
|
|
13
13
|
* Define o local onde o ícone será renderizado.
|
|
14
14
|
*/
|
|
15
|
-
this.
|
|
15
|
+
this.iconPlacement = "left";
|
|
16
16
|
}
|
|
17
17
|
observeValue() {
|
|
18
18
|
this.ezChange.emit();
|
|
@@ -25,14 +25,14 @@ export class EzCollapsibleBox {
|
|
|
25
25
|
}
|
|
26
26
|
render() {
|
|
27
27
|
return (h(Host, null,
|
|
28
|
-
this.
|
|
28
|
+
this.iconPlacement == "right" ?
|
|
29
29
|
h("div", { class: "collapsible-box__title" },
|
|
30
|
-
h("label", { class: (this.
|
|
31
|
-
h("button", { class: this.value ? "collapsible-box__btn collapsible-box__btn--collapsed " + "collapsible-box__btn--" + this.
|
|
30
|
+
h("label", { class: (this.iconPlacement == "right" ? "collapsible-box__label--icon-right " : "collapsible-box__label ") + (this.headerSize ? "font--" + this.headerSize : ""), onClick: () => this.showHide(), title: this.label }, this.label),
|
|
31
|
+
h("button", { class: this.value ? "collapsible-box__btn collapsible-box__btn--collapsed " + "collapsible-box__btn--" + this.headerSize : "collapsible-box__btn " + "collapsible-box__btn--" + this.headerSize, onClick: () => this.showHide() }))
|
|
32
32
|
:
|
|
33
33
|
h("div", { class: "collapsible-box__title" },
|
|
34
|
-
h("button", { class: this.value ? "collapsible-box__btn collapsible-box__btn--collapsed " + "collapsible-box__btn--" + this.
|
|
35
|
-
h("label", { class: (this.
|
|
34
|
+
h("button", { class: this.value ? "collapsible-box__btn collapsible-box__btn--collapsed " + "collapsible-box__btn--" + this.headerSize : "collapsible-box__btn " + "collapsible-box__btn--" + this.headerSize, onClick: () => this.showHide() }),
|
|
35
|
+
h("label", { class: (this.iconPlacement == "right" ? "collapsible-box__label--icon-right " : "collapsible-box__label ") + (this.headerSize ? "font--" + this.headerSize : ""), onClick: () => this.showHide(), title: this.label }, this.label)),
|
|
36
36
|
!this.value ? h("slot", null) : null));
|
|
37
37
|
}
|
|
38
38
|
static get is() { return "ez-collapsible-box"; }
|
|
@@ -79,7 +79,7 @@ export class EzCollapsibleBox {
|
|
|
79
79
|
"attribute": "label",
|
|
80
80
|
"reflect": true
|
|
81
81
|
},
|
|
82
|
-
"
|
|
82
|
+
"headerSize": {
|
|
83
83
|
"type": "string",
|
|
84
84
|
"mutable": false,
|
|
85
85
|
"complexType": {
|
|
@@ -93,11 +93,11 @@ export class EzCollapsibleBox {
|
|
|
93
93
|
"tags": [],
|
|
94
94
|
"text": "Define o tamanho do texto e do \u00EDcone do componente."
|
|
95
95
|
},
|
|
96
|
-
"attribute": "
|
|
96
|
+
"attribute": "header-size",
|
|
97
97
|
"reflect": true,
|
|
98
98
|
"defaultValue": "\"small\""
|
|
99
99
|
},
|
|
100
|
-
"
|
|
100
|
+
"iconPlacement": {
|
|
101
101
|
"type": "string",
|
|
102
102
|
"mutable": false,
|
|
103
103
|
"complexType": {
|
|
@@ -111,7 +111,7 @@ export class EzCollapsibleBox {
|
|
|
111
111
|
"tags": [],
|
|
112
112
|
"text": "Define o local onde o \u00EDcone ser\u00E1 renderizado."
|
|
113
113
|
},
|
|
114
|
-
"attribute": "
|
|
114
|
+
"attribute": "icon-placement",
|
|
115
115
|
"reflect": true,
|
|
116
116
|
"defaultValue": "\"left\""
|
|
117
117
|
}
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
ez-text-input {
|
|
77
|
-
--
|
|
78
|
-
--
|
|
77
|
+
--ez-text-input__input--background-color: var(--combo-box__input--background-color, #FFFFFF);
|
|
78
|
+
--ez-text-input__input--border-color: var(--combo-box__input--border-color, #DCE0E8);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
.list-container {
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
|
+
/*@doc Define a cor de fundo do input.*/
|
|
5
|
+
--ez-date-input__input--background-color: var(--background--medium, #e0e0e0);
|
|
6
|
+
/*@doc Define a cor da borda do input.*/
|
|
7
|
+
--ez-date-input__input--border-color: var(--ez-date-input__input--background-color);
|
|
4
8
|
/*@doc Contém a imagem do calendário.*/
|
|
5
|
-
--
|
|
9
|
+
--ez-date-input__calendar-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.text-input {
|
|
13
|
+
--ez-text-input__input--background-color: inherit;
|
|
14
|
+
--ez-text-input__input--border-color: inherit;
|
|
6
15
|
}
|
|
7
16
|
|
|
8
17
|
.btn-open-cal {
|
|
@@ -22,8 +31,8 @@
|
|
|
22
31
|
background-color: var(--text--primary, #008561);
|
|
23
32
|
width: 15px;
|
|
24
33
|
height: 16px;
|
|
25
|
-
-webkit-mask-image: var(--
|
|
26
|
-
mask-image: var(--
|
|
34
|
+
-webkit-mask-image: var(--ez-date-input__calendar-image);
|
|
35
|
+
mask-image: var(--ez-date-input__calendar-image);
|
|
27
36
|
}
|
|
28
37
|
|
|
29
38
|
.btn-open-cal:disabled:after {
|
|
@@ -32,4 +41,9 @@
|
|
|
32
41
|
|
|
33
42
|
.btn-open-cal:enabled:hover::after {
|
|
34
43
|
background-color: var(--color--primary, #4e4e4e);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
ez-text-input {
|
|
47
|
+
--text-input__input--background-color: var(--ez-date-input__input--background-color, #FFFFFF);
|
|
48
|
+
--text-input__input--border-color: var(--ez-date-input__input--border-color, #DCE0E8);
|
|
35
49
|
}
|
|
@@ -56,14 +56,14 @@ export class EzDateInput {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
getTextValue(d) {
|
|
59
|
-
return d ? new Intl.DateTimeFormat(
|
|
59
|
+
return d ? new Intl.DateTimeFormat("pt-BR").format(d) : null;
|
|
60
60
|
}
|
|
61
61
|
componentDidLoad() {
|
|
62
62
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
63
63
|
}
|
|
64
64
|
render() {
|
|
65
65
|
return (h(Host, null,
|
|
66
|
-
h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { if (event.key ===
|
|
66
|
+
h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { if (event.key === "H" || event.key === "h")
|
|
67
67
|
this.changeValue(new Date()); }, label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage },
|
|
68
68
|
h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })),
|
|
69
69
|
h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Component, h, Element, forceUpdate, Prop, Method, Watch } from
|
|
2
|
-
import { createStore, applyMiddleware, combineReducers } from
|
|
3
|
-
import thunk from
|
|
4
|
-
import { formLoad, invalidField, showHideNavigationButtons } from
|
|
5
|
-
import undoable from
|
|
6
|
-
import formReducer, { formNonHistoricReducer } from
|
|
7
|
-
import { FormSheet } from
|
|
8
|
-
import DataUnit from
|
|
1
|
+
import { Component, h, Element, forceUpdate, Prop, Method, Watch } from "@stencil/core";
|
|
2
|
+
import { createStore, applyMiddleware, combineReducers } from "redux";
|
|
3
|
+
import thunk from "redux-thunk";
|
|
4
|
+
import { formLoad, invalidField, showHideNavigationButtons } from "./store/Form.actions";
|
|
5
|
+
import undoable from "redux-undo";
|
|
6
|
+
import formReducer, { formNonHistoricReducer } from "./store/Form.reducer";
|
|
7
|
+
import { FormSheet } from "./subcomponents/structure/FormSheet";
|
|
8
|
+
import DataUnit from "./subcomponents/DataUnit";
|
|
9
9
|
export class EzForm {
|
|
10
10
|
constructor() {
|
|
11
11
|
this.enabled = true;
|
|
@@ -19,8 +19,9 @@ export class EzForm {
|
|
|
19
19
|
this._preparedMetadata = undefined;
|
|
20
20
|
}
|
|
21
21
|
async validate() {
|
|
22
|
+
const duSourcesNames = Array.from(this._duSources.keys());
|
|
22
23
|
for (let i = 0; i < this._duSources.size; i++) {
|
|
23
|
-
const duName =
|
|
24
|
+
const duName = duSourcesNames[i];
|
|
24
25
|
let du = this._dataUnits.get(duName);
|
|
25
26
|
if (du === undefined) {
|
|
26
27
|
const source = this._duSources.get(duName);
|
|
@@ -34,8 +35,9 @@ export class EzForm {
|
|
|
34
35
|
}
|
|
35
36
|
async getChanges() {
|
|
36
37
|
let allChanges = [];
|
|
38
|
+
const dataUnits = Array.from(this._dataUnits.values());
|
|
37
39
|
for (let i = 0; i < this._dataUnits.size; i++) {
|
|
38
|
-
const du =
|
|
40
|
+
const du = dataUnits[i];
|
|
39
41
|
//Só devemos buscar as alterações de DU raiz, pois os sub DUs serão enviados junto.
|
|
40
42
|
if (!du.parentDU) {
|
|
41
43
|
const duChanges = du.getChangesToSave();
|
|
@@ -53,15 +55,15 @@ export class EzForm {
|
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
validateRecords(dataUnit, records, triggedBy) {
|
|
56
|
-
const result = { isValid: true, message:
|
|
57
|
-
if (this.
|
|
58
|
+
const result = { isValid: true, message: "" };
|
|
59
|
+
if (this.ignoreSaveValidation && triggedBy === "SAVE") {
|
|
58
60
|
return result;
|
|
59
61
|
}
|
|
60
62
|
const validateField = (field) => {
|
|
61
63
|
if (field.readOnly) {
|
|
62
64
|
return false;
|
|
63
65
|
}
|
|
64
|
-
if (field.userInterface ===
|
|
66
|
+
if (field.userInterface === "SWITCH" || field.userInterface === "CHECKBOX") {
|
|
65
67
|
return false;
|
|
66
68
|
}
|
|
67
69
|
return true;
|
|
@@ -72,7 +74,7 @@ export class EzForm {
|
|
|
72
74
|
const recordIndex = record["record__index"];
|
|
73
75
|
const fieldName = field.name;
|
|
74
76
|
const fieldValue = record[fieldName];
|
|
75
|
-
if (fieldValue === null || fieldValue === undefined || fieldValue ===
|
|
77
|
+
if (fieldValue === null || fieldValue === undefined || fieldValue === "") {
|
|
76
78
|
const tabPosition = this._tabPositionByField.get(dataUnit.name + field.name);
|
|
77
79
|
this._store.dispatch(invalidField(tabPosition.tabName, tabPosition.index, dataUnit.name, recordIndex, record.record__id, field.name, "Essa informação é obrigatória"));
|
|
78
80
|
result.isValid = false;
|
|
@@ -99,7 +101,7 @@ export class EzForm {
|
|
|
99
101
|
return result;
|
|
100
102
|
}
|
|
101
103
|
loadMDFromExecutor(callBack) {
|
|
102
|
-
const loadMetadataFunction = this.parseExecutor(this.
|
|
104
|
+
const loadMetadataFunction = this.parseExecutor(this.metadataExecutor);
|
|
103
105
|
if (loadMetadataFunction) {
|
|
104
106
|
const result = loadMetadataFunction();
|
|
105
107
|
if (result) {
|
|
@@ -179,7 +181,7 @@ export class EzForm {
|
|
|
179
181
|
});
|
|
180
182
|
this._store = createStore(rootReducer, applyMiddleware(thunk));
|
|
181
183
|
this._store.subscribe(() => { forceUpdate(this); });
|
|
182
|
-
if (this.
|
|
184
|
+
if (this.slaveMode) {
|
|
183
185
|
this._store.dispatch(showHideNavigationButtons("saveVisible", false));
|
|
184
186
|
this._store.dispatch(showHideNavigationButtons("cancelVisible", false));
|
|
185
187
|
this._store.dispatch(showHideNavigationButtons("reloadVisible", false));
|
|
@@ -202,12 +204,12 @@ export class EzForm {
|
|
|
202
204
|
this._duToLoad = [];
|
|
203
205
|
}
|
|
204
206
|
loadSearch(argument, context) {
|
|
205
|
-
const fieldSearchExecutor = this.parseExecutor(this.
|
|
207
|
+
const fieldSearchExecutor = this.parseExecutor(this.fieldSearchExecutor);
|
|
206
208
|
if (fieldSearchExecutor) {
|
|
207
209
|
return fieldSearchExecutor(argument, context);
|
|
208
210
|
}
|
|
209
211
|
else {
|
|
210
|
-
return [{ value: 0, label:
|
|
212
|
+
return [{ value: 0, label: "Sem resultados" }];
|
|
211
213
|
}
|
|
212
214
|
}
|
|
213
215
|
buildDataUnit(dataUnit, parentDataUnit) {
|
|
@@ -234,9 +236,9 @@ export class EzForm {
|
|
|
234
236
|
}
|
|
235
237
|
decorateDU(dataUnit) {
|
|
236
238
|
dataUnit.store = this._store;
|
|
237
|
-
dataUnit.loadExecutor = this.parseExecutor(this.
|
|
238
|
-
dataUnit.saveExecutor = this.parseExecutor(this.
|
|
239
|
-
dataUnit.removeExecutor = this.parseExecutor(this.
|
|
239
|
+
dataUnit.loadExecutor = this.parseExecutor(this.loadExecutor);
|
|
240
|
+
dataUnit.saveExecutor = this.parseExecutor(this.saveExecutor);
|
|
241
|
+
dataUnit.removeExecutor = this.parseExecutor(this.removeExecutor);
|
|
240
242
|
dataUnit.recordsValidator = this;
|
|
241
243
|
}
|
|
242
244
|
render() {
|
|
@@ -256,7 +258,7 @@ export class EzForm {
|
|
|
256
258
|
}; }
|
|
257
259
|
static get assetsDirs() { return ["assets"]; }
|
|
258
260
|
static get properties() { return {
|
|
259
|
-
"
|
|
261
|
+
"metadataExecutor": {
|
|
260
262
|
"type": "string",
|
|
261
263
|
"mutable": false,
|
|
262
264
|
"complexType": {
|
|
@@ -274,10 +276,10 @@ export class EzForm {
|
|
|
274
276
|
"tags": [],
|
|
275
277
|
"text": ""
|
|
276
278
|
},
|
|
277
|
-
"attribute": "
|
|
279
|
+
"attribute": "metadata-executor",
|
|
278
280
|
"reflect": false
|
|
279
281
|
},
|
|
280
|
-
"
|
|
282
|
+
"loadExecutor": {
|
|
281
283
|
"type": "string",
|
|
282
284
|
"mutable": false,
|
|
283
285
|
"complexType": {
|
|
@@ -295,10 +297,10 @@ export class EzForm {
|
|
|
295
297
|
"tags": [],
|
|
296
298
|
"text": ""
|
|
297
299
|
},
|
|
298
|
-
"attribute": "
|
|
300
|
+
"attribute": "load-executor",
|
|
299
301
|
"reflect": false
|
|
300
302
|
},
|
|
301
|
-
"
|
|
303
|
+
"saveExecutor": {
|
|
302
304
|
"type": "string",
|
|
303
305
|
"mutable": false,
|
|
304
306
|
"complexType": {
|
|
@@ -316,10 +318,10 @@ export class EzForm {
|
|
|
316
318
|
"tags": [],
|
|
317
319
|
"text": ""
|
|
318
320
|
},
|
|
319
|
-
"attribute": "
|
|
321
|
+
"attribute": "save-executor",
|
|
320
322
|
"reflect": false
|
|
321
323
|
},
|
|
322
|
-
"
|
|
324
|
+
"removeExecutor": {
|
|
323
325
|
"type": "string",
|
|
324
326
|
"mutable": false,
|
|
325
327
|
"complexType": {
|
|
@@ -337,10 +339,10 @@ export class EzForm {
|
|
|
337
339
|
"tags": [],
|
|
338
340
|
"text": ""
|
|
339
341
|
},
|
|
340
|
-
"attribute": "
|
|
342
|
+
"attribute": "remove-executor",
|
|
341
343
|
"reflect": false
|
|
342
344
|
},
|
|
343
|
-
"
|
|
345
|
+
"fieldSearchExecutor": {
|
|
344
346
|
"type": "string",
|
|
345
347
|
"mutable": false,
|
|
346
348
|
"complexType": {
|
|
@@ -358,10 +360,10 @@ export class EzForm {
|
|
|
358
360
|
"tags": [],
|
|
359
361
|
"text": ""
|
|
360
362
|
},
|
|
361
|
-
"attribute": "
|
|
363
|
+
"attribute": "field-search-executor",
|
|
362
364
|
"reflect": false
|
|
363
365
|
},
|
|
364
|
-
"
|
|
366
|
+
"ignoreSaveValidation": {
|
|
365
367
|
"type": "boolean",
|
|
366
368
|
"mutable": false,
|
|
367
369
|
"complexType": {
|
|
@@ -375,7 +377,7 @@ export class EzForm {
|
|
|
375
377
|
"tags": [],
|
|
376
378
|
"text": ""
|
|
377
379
|
},
|
|
378
|
-
"attribute": "
|
|
380
|
+
"attribute": "ignore-save-validation",
|
|
379
381
|
"reflect": false
|
|
380
382
|
},
|
|
381
383
|
"metadata": {
|
|
@@ -401,7 +403,7 @@ export class EzForm {
|
|
|
401
403
|
"text": ""
|
|
402
404
|
}
|
|
403
405
|
},
|
|
404
|
-
"
|
|
406
|
+
"slaveMode": {
|
|
405
407
|
"type": "boolean",
|
|
406
408
|
"mutable": false,
|
|
407
409
|
"complexType": {
|
|
@@ -415,7 +417,7 @@ export class EzForm {
|
|
|
415
417
|
"tags": [],
|
|
416
418
|
"text": ""
|
|
417
419
|
},
|
|
418
|
-
"attribute": "
|
|
420
|
+
"attribute": "slave-mode",
|
|
419
421
|
"reflect": false
|
|
420
422
|
},
|
|
421
423
|
"enabled": {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export function changeFieldValue(dataUnit, recordId, fieldName, value) {
|
|
2
2
|
return {
|
|
3
|
-
type:
|
|
3
|
+
type: "FORM/CHANGEFIELD",
|
|
4
4
|
payload: { dataUnit, recordId, fieldName, value }
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
7
|
export function changeTab(formId, index) {
|
|
8
8
|
return {
|
|
9
|
-
type:
|
|
9
|
+
type: "FORM/CHANGETAB",
|
|
10
10
|
payload: { formId, index }
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
export function clearEdition(dataUnit, recordsLimit) {
|
|
14
14
|
return {
|
|
15
|
-
type:
|
|
15
|
+
type: "FORM/CLEAREDITION",
|
|
16
16
|
payload: {
|
|
17
17
|
dataUnit,
|
|
18
18
|
recordsLimit
|
|
@@ -21,13 +21,13 @@ export function clearEdition(dataUnit, recordsLimit) {
|
|
|
21
21
|
}
|
|
22
22
|
export function collapseExpandGroup(collapseId, collapsed) {
|
|
23
23
|
return {
|
|
24
|
-
type:
|
|
24
|
+
type: "FORM/COLLAPSEGROUP",
|
|
25
25
|
payload: { collapseId, collapsed }
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
export function previousRecord(dataUnit) {
|
|
29
29
|
return {
|
|
30
|
-
type:
|
|
30
|
+
type: "FORM/NAVIGATE",
|
|
31
31
|
payload: {
|
|
32
32
|
dataUnit,
|
|
33
33
|
limit: 0,
|
|
@@ -37,7 +37,7 @@ export function previousRecord(dataUnit) {
|
|
|
37
37
|
}
|
|
38
38
|
export function nextRecord(dataUnit, limit) {
|
|
39
39
|
return {
|
|
40
|
-
type:
|
|
40
|
+
type: "FORM/NAVIGATE",
|
|
41
41
|
payload: {
|
|
42
42
|
dataUnit,
|
|
43
43
|
limit,
|
|
@@ -47,7 +47,7 @@ export function nextRecord(dataUnit, limit) {
|
|
|
47
47
|
}
|
|
48
48
|
export function insertRecord(dataUnit, insertionIndex) {
|
|
49
49
|
return {
|
|
50
|
-
type:
|
|
50
|
+
type: "FORM/INSERT",
|
|
51
51
|
payload: {
|
|
52
52
|
dataUnit,
|
|
53
53
|
insertionIndex
|
|
@@ -56,12 +56,12 @@ export function insertRecord(dataUnit, insertionIndex) {
|
|
|
56
56
|
}
|
|
57
57
|
export function formLoad() {
|
|
58
58
|
return {
|
|
59
|
-
type:
|
|
59
|
+
type: "FORM/LOAD"
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
export function dataLoading(dataUnit) {
|
|
63
63
|
return {
|
|
64
|
-
type:
|
|
64
|
+
type: "FORM/DATALOADING",
|
|
65
65
|
payload: {
|
|
66
66
|
dataUnit
|
|
67
67
|
}
|
|
@@ -69,7 +69,7 @@ export function dataLoading(dataUnit) {
|
|
|
69
69
|
}
|
|
70
70
|
export function savingChanges(dataUnit) {
|
|
71
71
|
return {
|
|
72
|
-
type:
|
|
72
|
+
type: "FORM/SAVINGCHANGES",
|
|
73
73
|
payload: {
|
|
74
74
|
dataUnit
|
|
75
75
|
}
|
|
@@ -77,7 +77,7 @@ export function savingChanges(dataUnit) {
|
|
|
77
77
|
}
|
|
78
78
|
export function dataLoaded(dataUnit) {
|
|
79
79
|
return {
|
|
80
|
-
type:
|
|
80
|
+
type: "FORM/DATALOADED",
|
|
81
81
|
payload: {
|
|
82
82
|
dataUnit
|
|
83
83
|
}
|
|
@@ -85,7 +85,7 @@ export function dataLoaded(dataUnit) {
|
|
|
85
85
|
}
|
|
86
86
|
export function changesSaved(dataUnit) {
|
|
87
87
|
return {
|
|
88
|
-
type:
|
|
88
|
+
type: "FORM/CHANGESSAVED",
|
|
89
89
|
payload: {
|
|
90
90
|
dataUnit
|
|
91
91
|
}
|
|
@@ -93,7 +93,7 @@ export function changesSaved(dataUnit) {
|
|
|
93
93
|
}
|
|
94
94
|
export function removingRecord(dataUnit) {
|
|
95
95
|
return {
|
|
96
|
-
type:
|
|
96
|
+
type: "FORM/REMOVINGRECORD",
|
|
97
97
|
payload: {
|
|
98
98
|
dataUnit
|
|
99
99
|
}
|
|
@@ -101,7 +101,7 @@ export function removingRecord(dataUnit) {
|
|
|
101
101
|
}
|
|
102
102
|
export function recordRemoved(dataUnit) {
|
|
103
103
|
return {
|
|
104
|
-
type:
|
|
104
|
+
type: "FORM/RECORDREMOVED",
|
|
105
105
|
payload: {
|
|
106
106
|
dataUnit
|
|
107
107
|
}
|
|
@@ -109,7 +109,7 @@ export function recordRemoved(dataUnit) {
|
|
|
109
109
|
}
|
|
110
110
|
export function invalidField(tabController, tabIndex, dataUnit, recordIndex, recordId, fieldName, errorMessage) {
|
|
111
111
|
return {
|
|
112
|
-
type:
|
|
112
|
+
type: "FORM/INVALIDFIELD",
|
|
113
113
|
payload: {
|
|
114
114
|
tabController,
|
|
115
115
|
tabIndex,
|
|
@@ -123,7 +123,7 @@ export function invalidField(tabController, tabIndex, dataUnit, recordIndex, rec
|
|
|
123
123
|
}
|
|
124
124
|
export function showHideNavigationButtons(buttonName, status) {
|
|
125
125
|
return {
|
|
126
|
-
type:
|
|
126
|
+
type: "FORM/SHOWHIDENAVBTN",
|
|
127
127
|
payload: {
|
|
128
128
|
buttonName,
|
|
129
129
|
status
|
|
@@ -20,19 +20,19 @@ const inicialNonHistState = {
|
|
|
20
20
|
};
|
|
21
21
|
export default function formReducer(state = inicialHistState, action) {
|
|
22
22
|
switch (action.type) {
|
|
23
|
-
case
|
|
23
|
+
case "FORM/COLLAPSEGROUP":
|
|
24
24
|
return collapseGroup(state, action.payload);
|
|
25
|
-
case
|
|
25
|
+
case "FORM/CHANGETAB":
|
|
26
26
|
return changeTab(state, action.payload.formId, action.payload.index);
|
|
27
|
-
case
|
|
27
|
+
case "FORM/NAVIGATE":
|
|
28
28
|
return navigate(state, action.payload);
|
|
29
|
-
case
|
|
29
|
+
case "FORM/INSERT":
|
|
30
30
|
return insertRecord(state, action.payload);
|
|
31
|
-
case
|
|
31
|
+
case "FORM/CHANGEFIELD":
|
|
32
32
|
return changeFieldValue(state, action.payload);
|
|
33
|
-
case
|
|
33
|
+
case "FORM/CLEAREDITION":
|
|
34
34
|
return clearEdition(state, action.payload);
|
|
35
|
-
case
|
|
35
|
+
case "FORM/INVALIDFIELD":
|
|
36
36
|
return navigateToInvalid(state, action.payload);
|
|
37
37
|
default:
|
|
38
38
|
return state;
|
|
@@ -40,25 +40,25 @@ export default function formReducer(state = inicialHistState, action) {
|
|
|
40
40
|
}
|
|
41
41
|
export function formNonHistoricReducer(state = inicialNonHistState, action) {
|
|
42
42
|
switch (action.type) {
|
|
43
|
-
case
|
|
43
|
+
case "FORM/DATALOADING":
|
|
44
44
|
return dataLoading(state, action.payload);
|
|
45
|
-
case
|
|
45
|
+
case "FORM/DATALOADED":
|
|
46
46
|
return dataLoaded(state, action.payload);
|
|
47
|
-
case
|
|
47
|
+
case "FORM/SAVINGCHANGES":
|
|
48
48
|
return savingChanges(state, action.payload);
|
|
49
|
-
case
|
|
49
|
+
case "FORM/CHANGESSAVED":
|
|
50
50
|
return changesSaved(state, action.payload);
|
|
51
|
-
case
|
|
51
|
+
case "FORM/REMOVINGRECORD":
|
|
52
52
|
return removingRecord(state, action.payload);
|
|
53
|
-
case
|
|
53
|
+
case "FORM/RECORDREMOVED":
|
|
54
54
|
return recordRemoved(state, action.payload);
|
|
55
|
-
case
|
|
55
|
+
case "FORM/INVALIDFIELD":
|
|
56
56
|
return invalidField(state, action.payload);
|
|
57
|
-
case
|
|
57
|
+
case "FORM/CLEAREDITION":
|
|
58
58
|
return clearAllInvalidFields(state, action.payload);
|
|
59
|
-
case
|
|
59
|
+
case "FORM/CHANGEFIELD":
|
|
60
60
|
return clearInvalidField(state, action.payload);
|
|
61
|
-
case
|
|
61
|
+
case "FORM/SHOWHIDENAVBTN":
|
|
62
62
|
return showHideNavBtn(state, action.payload);
|
|
63
63
|
default:
|
|
64
64
|
return state;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { changeFieldValue, changesSaved, clearEdition, dataLoaded, dataLoading, insertRecord, nextRecord, previousRecord, recordRemoved, removingRecord, savingChanges } from
|
|
2
|
-
import { selectRecordChanges, selectCurrentRecordIndex, selectLoadingData, selectNewRecordIndex, selectDataUnitChanges, selectErrorMessage } from
|
|
3
|
-
import Application from
|
|
1
|
+
import { changeFieldValue, changesSaved, clearEdition, dataLoaded, dataLoading, insertRecord, nextRecord, previousRecord, recordRemoved, removingRecord, savingChanges } from "../store/Form.actions";
|
|
2
|
+
import { selectRecordChanges, selectCurrentRecordIndex, selectLoadingData, selectNewRecordIndex, selectDataUnitChanges, selectErrorMessage } from "../store/Form.selectors";
|
|
3
|
+
import Application from "../../../utils/Application";
|
|
4
4
|
export default class DataUnit {
|
|
5
|
-
constructor(name, unitLabel, cardinality =
|
|
5
|
+
constructor(name, unitLabel, cardinality = "1", parentDU = null) {
|
|
6
6
|
this.name = name;
|
|
7
7
|
this.unitLabel = unitLabel;
|
|
8
8
|
this.cardinality = cardinality;
|
|
@@ -85,13 +85,13 @@ export default class DataUnit {
|
|
|
85
85
|
}, 100);
|
|
86
86
|
}
|
|
87
87
|
cancel() {
|
|
88
|
-
this.records = this.records.filter(r => !r.record__id.startsWith(
|
|
88
|
+
this.records = this.records.filter(r => !r.record__id.startsWith("NEW_"));
|
|
89
89
|
this._store.dispatch(clearEdition(this.name, this.records.length - 1));
|
|
90
90
|
}
|
|
91
91
|
insert() {
|
|
92
92
|
const insertionIndex = this.records.length;
|
|
93
93
|
const newRecordIndex = selectNewRecordIndex(this._store.getState(), this.name);
|
|
94
|
-
const newRecord = { record__id:
|
|
94
|
+
const newRecord = { record__id: "NEW_" + (newRecordIndex + 1) };
|
|
95
95
|
this.bindToParent(newRecord);
|
|
96
96
|
this.records.push(newRecord);
|
|
97
97
|
this._store.dispatch(insertRecord(this.name, insertionIndex));
|
|
@@ -204,7 +204,7 @@ export default class DataUnit {
|
|
|
204
204
|
}
|
|
205
205
|
else {
|
|
206
206
|
if (result.__data__unit === this.name) {
|
|
207
|
-
if (this.cardinality ===
|
|
207
|
+
if (this.cardinality === "1") {
|
|
208
208
|
this.records = [this.buildRecordFromSaveResult(this.records[0], result)];
|
|
209
209
|
}
|
|
210
210
|
else {
|
|
@@ -218,7 +218,7 @@ export default class DataUnit {
|
|
|
218
218
|
this._store.dispatch(changesSaved(this.name));
|
|
219
219
|
}
|
|
220
220
|
buildRecordFromSaveResult(baseRecord, saveResult) {
|
|
221
|
-
const newRecord = baseRecord ? Object.assign({}, baseRecord) : { record__id:
|
|
221
|
+
const newRecord = baseRecord ? Object.assign({}, baseRecord) : { record__id: "" };
|
|
222
222
|
Object.keys(saveResult).forEach(attrib => {
|
|
223
223
|
if (!attrib.startsWith("__")) {
|
|
224
224
|
newRecord[attrib] = saveResult[attrib];
|