@sankhyalabs/ezui 1.1.76 → 1.1.77
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/ApplicationUtils-d1c1db56.js +35 -0
- package/dist/cjs/AssetsUtils-dd585fba.js +24 -0
- package/dist/cjs/DataUnit-fdd7c70e.js +474 -0
- package/dist/cjs/DateUtils-716769e0.js +46 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +28 -0
- package/dist/cjs/ez-button_11.cjs.entry.js +111771 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +212 -0
- package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +630 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +250 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +144 -0
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +1838 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +61 -190
- package/dist/cjs/ez-popover.cjs.entry.js +3 -3
- package/dist/cjs/ez-popup.cjs.entry.js +2 -2
- package/dist/cjs/ez-time-input.cjs.entry.js +9 -27
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +3 -3
- package/dist/cjs/form-metadata.cjs.entry.js +129 -0
- package/dist/cjs/index-262d703b.js +7442 -0
- package/dist/cjs/{index-9431aeeb.js → index-4e4bae01.js} +1 -5
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +8 -3
- package/dist/collection/components/ez-application/ez-application.css +3 -0
- package/dist/collection/components/ez-application/ez-application.js +37 -0
- package/dist/collection/components/ez-button/ez-button.css +16 -1
- package/dist/collection/components/ez-button/ez-button.js +27 -2
- package/dist/collection/components/ez-calendar/ez-calendar.css +70 -3
- package/dist/collection/components/ez-calendar/ez-calendar.js +168 -24
- package/dist/collection/components/ez-check/ez-check.css +78 -78
- package/dist/collection/components/ez-check/ez-check.js +3 -3
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +67 -51
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +1 -0
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +49 -0
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +254 -0
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +4 -4
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +1 -1
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +2 -2
- package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +21 -0
- package/dist/collection/components/ez-grid/controller/EzGridController.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +203 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +41 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/i18n/pt-BR.js +75 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/mock/Server.js +69 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/template/HeaderColumnTemplate.js +12 -0
- package/dist/collection/components/ez-grid/ez-grid.css +15 -0
- package/dist/collection/components/ez-grid/ez-grid.js +414 -0
- package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +105 -0
- package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +354 -0
- package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +7 -0
- package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.js +66 -0
- package/dist/collection/components/ez-icon/ez-icon.css +1 -1
- package/dist/collection/components/ez-list/ez-list.css +227 -44
- package/dist/collection/components/ez-list/ez-list.js +529 -149
- package/dist/collection/components/ez-modal/ez-modal.css +4 -4
- package/dist/collection/components/ez-modal/ez-modal.js +1 -1
- package/dist/collection/components/ez-number-input/ez-number-input.css +7 -162
- package/dist/collection/components/ez-number-input/ez-number-input.js +90 -281
- package/dist/collection/components/ez-popover/ez-popover.css +10 -6
- package/dist/collection/components/ez-popup/ez-popup.css +25 -27
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +0 -1
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +3 -3
- package/dist/collection/components/ez-text-area/ez-text-area.js +1 -0
- package/dist/collection/components/ez-text-input/ez-text-input.js +1 -0
- package/dist/collection/components/ez-upload/ez-upload.js +3 -3
- package/dist/collection/components/test-du/test-du.css +3 -0
- package/dist/collection/components/test-du/test-du.js +45 -0
- package/dist/collection/servidor.js +94 -94
- package/dist/collection/utils/{Application.js → ApplicationUtils.js} +4 -4
- package/dist/custom-elements/index.d.ts +36 -6
- package/dist/custom-elements/index.js +120975 -3013
- package/dist/esm/ApplicationUtils-01280a9d.js +33 -0
- package/dist/esm/AssetsUtils-3803e935.js +22 -0
- package/dist/esm/DataUnit-1cd45202.js +464 -0
- package/dist/esm/DateUtils-0a1bbd7a.js +44 -0
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +24 -0
- package/dist/esm/ez-button_11.entry.js +111757 -0
- package/dist/esm/ez-calendar.entry.js +208 -0
- package/dist/esm/ez-collapsible-box_6.entry.js +621 -0
- package/dist/esm/ez-combo-box.entry.js +246 -0
- package/dist/esm/ez-date-time-input.entry.js +140 -0
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +1834 -0
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +61 -190
- package/dist/esm/ez-popover.entry.js +3 -3
- package/dist/esm/ez-popup.entry.js +2 -2
- package/dist/esm/ez-time-input.entry.js +3 -21
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/form-metadata.entry.js +125 -0
- package/dist/esm/{index-fd3c8023.js → index-1dacecd3.js} +1 -5
- package/dist/esm/index-cfd5e193.js +7433 -0
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-1ea8187e.entry.js +369 -0
- package/dist/ezui/p-37a611ea.js +1 -0
- package/dist/ezui/p-45689464.entry.js +1 -0
- package/dist/ezui/{p-a0b6eee2.entry.js → p-516d0e0f.entry.js} +1 -1
- package/dist/ezui/p-57291f97.entry.js +1 -0
- package/dist/ezui/{p-66954a04.entry.js → p-5a86e18a.entry.js} +1 -1
- package/dist/ezui/{p-823ff0a0.entry.js → p-5da66d3e.entry.js} +1 -1
- package/dist/ezui/p-69416bec.entry.js +1 -0
- package/dist/ezui/p-7107d7ef.js +1 -0
- package/dist/ezui/p-7ef97c5f.entry.js +1 -0
- package/dist/ezui/p-88f45a83.entry.js +1 -0
- package/dist/ezui/p-8c51a6aa.entry.js +1 -0
- package/dist/ezui/{p-e0ab3746.js → p-8f4851a6.js} +1 -1
- package/dist/ezui/p-9dfd537e.js +1 -0
- package/dist/ezui/{p-d443f020.entry.js → p-a18a2d7b.entry.js} +1 -1
- package/dist/ezui/p-a223eed8.entry.js +1 -0
- package/dist/ezui/p-b36308e7.js +1 -0
- package/dist/ezui/p-c0af195b.entry.js +1 -0
- package/dist/ezui/p-c6d469fc.entry.js +1 -0
- package/dist/ezui/p-c89629eb.js +1 -0
- package/dist/ezui/p-e7ee2836.entry.js +1 -0
- package/dist/ezui/p-f7b835cf.entry.js +1 -0
- package/dist/types/components/ez-application/ez-application.d.ts +12 -0
- package/dist/types/components/ez-button/ez-button.d.ts +5 -0
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +21 -0
- package/dist/types/components/ez-check/ez-check.d.ts +1 -1
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +42 -0
- package/dist/types/components/ez-grid/controller/DataUnitBridge.d.ts +8 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +195 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +34 -0
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/i18n/pt-BR.d.ts +2 -0
- package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +8 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +78 -0
- package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +30 -0
- package/dist/types/components/ez-grid/subcomponents/select-box/select-box.d.ts +9 -0
- package/dist/types/components/ez-list/ez-list.d.ts +70 -17
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +33 -50
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +1 -1
- package/dist/types/components/test-du/test-du.d.ts +6 -0
- package/dist/types/components.d.ts +283 -117
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/dist/types/utils/{Application.d.ts → ApplicationUtils.d.ts} +1 -1
- package/package.json +10 -8
- package/react/components.d.ts +6 -1
- package/react/components.js +6 -1
- package/react/components.js.map +1 -1
- package/dist/cjs/RequestMetadata-2cd01e8a.js +0 -531
- package/dist/cjs/ez-button_16.cjs.entry.js +0 -4079
- package/dist/cjs/ez-list.cjs.entry.js +0 -174
- package/dist/cjs/ez-modal.cjs.entry.js +0 -65
- package/dist/collection/components/ez-numeric-input/ez-numeric-input.css +0 -13
- package/dist/collection/components/ez-numeric-input/ez-numeric-input.js +0 -185
- package/dist/esm/RequestMetadata-c265c9d5.js +0 -527
- package/dist/esm/ez-button_16.entry.js +0 -4060
- package/dist/esm/ez-list.entry.js +0 -170
- package/dist/esm/ez-modal.entry.js +0 -61
- package/dist/ezui/p-11ae4ae7.entry.js +0 -1
- package/dist/ezui/p-47fa3d6c.entry.js +0 -1
- package/dist/ezui/p-8ab6168f.entry.js +0 -1
- package/dist/ezui/p-9c1fb51c.entry.js +0 -1
- package/dist/ezui/p-9d85125b.entry.js +0 -1
- package/dist/ezui/p-9dfccb16.js +0 -1
- package/dist/ezui/p-a7b546b2.entry.js +0 -1
- package/dist/ezui/p-c833c94f.entry.js +0 -1
- package/dist/types/components/ez-numeric-input/ez-numeric-input.d.ts +0 -45
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class ApplicationUtils {
|
|
2
|
+
static async showDialog(title, message, icon = null, confirm, critical = false) {
|
|
3
|
+
return new Promise(resolve => {
|
|
4
|
+
let dialog = document.querySelector("ez-dialog");
|
|
5
|
+
if (!dialog) {
|
|
6
|
+
dialog = document.createElement("ez-dialog");
|
|
7
|
+
window.document.body.appendChild(dialog);
|
|
8
|
+
}
|
|
9
|
+
dialog.show(title, message, critical, confirm, icon).then(ok => resolve(ok));
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
static async alert(title, message, icon = null) {
|
|
13
|
+
return ApplicationUtils.showDialog(title, message, icon, false, false);
|
|
14
|
+
}
|
|
15
|
+
static async error(title, message, icon = null) {
|
|
16
|
+
return ApplicationUtils.showDialog(title, message, icon, false, true);
|
|
17
|
+
}
|
|
18
|
+
static async confirm(title, message, icon = null, critical = false) {
|
|
19
|
+
return ApplicationUtils.showDialog(title, message, icon, true, critical);
|
|
20
|
+
}
|
|
21
|
+
static async info(message) {
|
|
22
|
+
let toast = document.querySelector("ez-toast");
|
|
23
|
+
if (!toast) {
|
|
24
|
+
toast = document.createElement("ez-toast");
|
|
25
|
+
window.document.body.appendChild(toast);
|
|
26
|
+
}
|
|
27
|
+
toast.message = message;
|
|
28
|
+
toast.fadeTime = 4000;
|
|
29
|
+
toast.show();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { ApplicationUtils as A };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { a as getAssetPath, s as setAssetPath } from './index-1dacecd3.js';
|
|
2
|
+
|
|
3
|
+
const getSpritePath = (sprite) => `${getContextAssetsPath("../assets/actions-sprite.svg")}#${sprite}`;
|
|
4
|
+
let ctxLoaded = false;
|
|
5
|
+
function getContextAssetsPath(resource) {
|
|
6
|
+
if (!ctxLoaded) {
|
|
7
|
+
const scriptElem = document.querySelector("script[data-ezui-assets-url]");
|
|
8
|
+
if (scriptElem) {
|
|
9
|
+
let assetsPath = scriptElem.dataset.ezuiAssetsUrl;
|
|
10
|
+
if (assetsPath) {
|
|
11
|
+
if (assetsPath.startsWith('/')) {
|
|
12
|
+
assetsPath = window.location.origin + assetsPath;
|
|
13
|
+
}
|
|
14
|
+
setAssetPath(assetsPath);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
ctxLoaded = true;
|
|
18
|
+
}
|
|
19
|
+
return getAssetPath(resource);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { getSpritePath as g };
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import { A as ApplicationUtils } from './ApplicationUtils-01280a9d.js';
|
|
2
|
+
|
|
3
|
+
function changeFieldValue(dataUnit, recordId, fieldName, value) {
|
|
4
|
+
return {
|
|
5
|
+
type: "FORM/CHANGEFIELD",
|
|
6
|
+
payload: { dataUnit, recordId, fieldName, value }
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function changeTab(formId, index) {
|
|
10
|
+
return {
|
|
11
|
+
type: "FORM/CHANGETAB",
|
|
12
|
+
payload: { formId, index }
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function clearEdition(dataUnit, recordsLimit) {
|
|
16
|
+
return {
|
|
17
|
+
type: "FORM/CLEAREDITION",
|
|
18
|
+
payload: {
|
|
19
|
+
dataUnit,
|
|
20
|
+
recordsLimit
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function collapseExpandGroup(collapseId, collapsed) {
|
|
25
|
+
return {
|
|
26
|
+
type: "FORM/COLLAPSEGROUP",
|
|
27
|
+
payload: { collapseId, collapsed }
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function previousRecord(dataUnit) {
|
|
31
|
+
return {
|
|
32
|
+
type: "FORM/NAVIGATE",
|
|
33
|
+
payload: {
|
|
34
|
+
dataUnit,
|
|
35
|
+
limit: 0,
|
|
36
|
+
backward: true
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function nextRecord(dataUnit, limit) {
|
|
41
|
+
return {
|
|
42
|
+
type: "FORM/NAVIGATE",
|
|
43
|
+
payload: {
|
|
44
|
+
dataUnit,
|
|
45
|
+
limit,
|
|
46
|
+
backward: false
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function insertRecord(dataUnit, insertionIndex) {
|
|
51
|
+
return {
|
|
52
|
+
type: "FORM/INSERT",
|
|
53
|
+
payload: {
|
|
54
|
+
dataUnit,
|
|
55
|
+
insertionIndex
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function formLoad() {
|
|
60
|
+
return {
|
|
61
|
+
type: "FORM/LOAD"
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function dataLoading(dataUnit) {
|
|
65
|
+
return {
|
|
66
|
+
type: "FORM/DATALOADING",
|
|
67
|
+
payload: {
|
|
68
|
+
dataUnit
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function savingChanges(dataUnit) {
|
|
73
|
+
return {
|
|
74
|
+
type: "FORM/SAVINGCHANGES",
|
|
75
|
+
payload: {
|
|
76
|
+
dataUnit
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function dataLoaded(dataUnit) {
|
|
81
|
+
return {
|
|
82
|
+
type: "FORM/DATALOADED",
|
|
83
|
+
payload: {
|
|
84
|
+
dataUnit
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function changesSaved(dataUnit) {
|
|
89
|
+
return {
|
|
90
|
+
type: "FORM/CHANGESSAVED",
|
|
91
|
+
payload: {
|
|
92
|
+
dataUnit
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function removingRecord(dataUnit) {
|
|
97
|
+
return {
|
|
98
|
+
type: "FORM/REMOVINGRECORD",
|
|
99
|
+
payload: {
|
|
100
|
+
dataUnit
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function recordRemoved(dataUnit) {
|
|
105
|
+
return {
|
|
106
|
+
type: "FORM/RECORDREMOVED",
|
|
107
|
+
payload: {
|
|
108
|
+
dataUnit
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function invalidField(tabController, tabIndex, dataUnit, recordIndex, recordId, fieldName, errorMessage) {
|
|
113
|
+
return {
|
|
114
|
+
type: "FORM/INVALIDFIELD",
|
|
115
|
+
payload: {
|
|
116
|
+
tabController,
|
|
117
|
+
tabIndex,
|
|
118
|
+
dataUnit,
|
|
119
|
+
recordId,
|
|
120
|
+
recordIndex,
|
|
121
|
+
fieldName,
|
|
122
|
+
errorMessage
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function showHideNavigationButtons(buttonName, status) {
|
|
127
|
+
return {
|
|
128
|
+
type: "FORM/SHOWHIDENAVBTN",
|
|
129
|
+
payload: {
|
|
130
|
+
buttonName,
|
|
131
|
+
status
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
//histórico
|
|
137
|
+
const selectCurrentTab = (state, formName) => {
|
|
138
|
+
const data = state.hist.present.currentTabIndex;
|
|
139
|
+
return data[formName] || 0;
|
|
140
|
+
};
|
|
141
|
+
const selectIsCollapsedFieldSet = (state, fieldSetName) => {
|
|
142
|
+
const data = state.hist.present.collapsedGroups;
|
|
143
|
+
return data[fieldSetName];
|
|
144
|
+
};
|
|
145
|
+
const selectRecordChanges = (state, dataUnit, recordId) => {
|
|
146
|
+
const data = selectDataUnitChanges(state, dataUnit);
|
|
147
|
+
return data ? data[recordId] : undefined;
|
|
148
|
+
};
|
|
149
|
+
const selectDataUnitChanges = (state, dataUnit) => {
|
|
150
|
+
const data = state.hist.present.changes;
|
|
151
|
+
return data[dataUnit];
|
|
152
|
+
};
|
|
153
|
+
const selectCurrentRecordIndex = (state, dataUnit) => {
|
|
154
|
+
const data = state.hist.present.currentRecordIndex;
|
|
155
|
+
return data[dataUnit] || 0;
|
|
156
|
+
};
|
|
157
|
+
const selectNewRecordIndex = (state, dataUnit) => {
|
|
158
|
+
const data = state.hist.present.newRecordIndex;
|
|
159
|
+
return data[dataUnit] || 0;
|
|
160
|
+
};
|
|
161
|
+
//não histórico
|
|
162
|
+
const selectLoadingData = (state, dataUnit) => {
|
|
163
|
+
const data = state.nonhist.dataLoading;
|
|
164
|
+
return data[dataUnit];
|
|
165
|
+
};
|
|
166
|
+
const selectErrorMessage = (state, dataUnit, recordId, fieldName) => {
|
|
167
|
+
const data = state.nonhist.invalidFields;
|
|
168
|
+
const dataUnitMessages = data[dataUnit] || {};
|
|
169
|
+
const recordMessages = dataUnitMessages[recordId] || {};
|
|
170
|
+
return recordMessages[fieldName] || "";
|
|
171
|
+
};
|
|
172
|
+
const selectVisibleButtons = state => state.nonhist.visibleButtons;
|
|
173
|
+
|
|
174
|
+
class DataUnit {
|
|
175
|
+
constructor(name, unitLabel, cardinality = "1", parentDU = null) {
|
|
176
|
+
this.name = name;
|
|
177
|
+
this.unitLabel = unitLabel;
|
|
178
|
+
this.cardinality = cardinality;
|
|
179
|
+
this._children = [];
|
|
180
|
+
this._fields = new Map();
|
|
181
|
+
this._requiredFields = [];
|
|
182
|
+
if (parentDU != null) {
|
|
183
|
+
parentDU._children.push(this);
|
|
184
|
+
this.parentDU = parentDU;
|
|
185
|
+
this.parentDUName = parentDU.name;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
set store(store) {
|
|
189
|
+
this._store = store;
|
|
190
|
+
}
|
|
191
|
+
set fields(value) {
|
|
192
|
+
if (value) {
|
|
193
|
+
value.forEach(f => this.addFieldMetadata(f));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
addFieldMetadata(field) {
|
|
197
|
+
this._fields.set(field.name, field);
|
|
198
|
+
if (field.required) {
|
|
199
|
+
this._requiredFields.push(field);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
getFieldMetadata(name) {
|
|
203
|
+
if (this._fields) {
|
|
204
|
+
return this._fields.get(name);
|
|
205
|
+
}
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
get requiredFields() {
|
|
209
|
+
return this._requiredFields;
|
|
210
|
+
}
|
|
211
|
+
isLoading() {
|
|
212
|
+
return selectLoadingData(this._store.getState(), this.name);
|
|
213
|
+
}
|
|
214
|
+
hasChanges() {
|
|
215
|
+
const state = this._store.getState();
|
|
216
|
+
return selectDataUnitChanges(state, this.name) !== undefined || selectNewRecordIndex(state, this.name) > 0;
|
|
217
|
+
}
|
|
218
|
+
hasNext() {
|
|
219
|
+
return selectCurrentRecordIndex(this._store.getState(), this.name) < (this.records.length - 1);
|
|
220
|
+
}
|
|
221
|
+
hasPrevious() {
|
|
222
|
+
return selectCurrentRecordIndex(this._store.getState(), this.name) > 0;
|
|
223
|
+
}
|
|
224
|
+
hasCurrentRecord() {
|
|
225
|
+
return this.getCurrentRecord() != undefined;
|
|
226
|
+
}
|
|
227
|
+
previous() {
|
|
228
|
+
this._store.dispatch(previousRecord(this.name));
|
|
229
|
+
}
|
|
230
|
+
next() {
|
|
231
|
+
this._store.dispatch(nextRecord(this.name, this.records.length));
|
|
232
|
+
}
|
|
233
|
+
getValue(fieldName) {
|
|
234
|
+
const currentRecord = this.getCurrentRecord();
|
|
235
|
+
if (!currentRecord) {
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
238
|
+
const changes = this.getRecordChanges(currentRecord);
|
|
239
|
+
return changes && changes[fieldName] !== undefined ? changes[fieldName] : currentRecord[fieldName] || null;
|
|
240
|
+
}
|
|
241
|
+
getErrorMessage(fieldName) {
|
|
242
|
+
const currentRecord = this.getCurrentRecord();
|
|
243
|
+
return selectErrorMessage(this._store.getState(), this.name, currentRecord === null || currentRecord === void 0 ? void 0 : currentRecord.record__id, fieldName);
|
|
244
|
+
}
|
|
245
|
+
changeValue(fieldName, newValue) {
|
|
246
|
+
if (this.records.length == 0) {
|
|
247
|
+
this.insert();
|
|
248
|
+
}
|
|
249
|
+
if (this._changeDeboucing) {
|
|
250
|
+
window.clearTimeout(this._changeDeboucing);
|
|
251
|
+
}
|
|
252
|
+
this._changeDeboucing = window.setTimeout(() => {
|
|
253
|
+
const currentRecord = this.getCurrentRecord();
|
|
254
|
+
this._store.dispatch(changeFieldValue(this.name, currentRecord.record__id, fieldName, newValue));
|
|
255
|
+
}, 100);
|
|
256
|
+
}
|
|
257
|
+
cancel() {
|
|
258
|
+
this.records = this.records.filter(r => !r.record__id.startsWith("NEW_"));
|
|
259
|
+
this._store.dispatch(clearEdition(this.name, this.records.length - 1));
|
|
260
|
+
}
|
|
261
|
+
insert() {
|
|
262
|
+
const insertionIndex = this.records.length;
|
|
263
|
+
const newRecordIndex = selectNewRecordIndex(this._store.getState(), this.name);
|
|
264
|
+
const newRecord = { record__id: "NEW_" + (newRecordIndex + 1) };
|
|
265
|
+
this.bindToParent(newRecord);
|
|
266
|
+
this.records.push(newRecord);
|
|
267
|
+
this._store.dispatch(insertRecord(this.name, insertionIndex));
|
|
268
|
+
}
|
|
269
|
+
buildChange(r) {
|
|
270
|
+
const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
|
|
271
|
+
let recordChanges;
|
|
272
|
+
if (duChanges) {
|
|
273
|
+
recordChanges = duChanges[r.record__id];
|
|
274
|
+
}
|
|
275
|
+
let subChanges = [];
|
|
276
|
+
this._children.forEach(duChild => {
|
|
277
|
+
subChanges = subChanges.concat(duChild.getSubChanges(r.record__id));
|
|
278
|
+
});
|
|
279
|
+
if (recordChanges || subChanges.length > 0) {
|
|
280
|
+
const change = {
|
|
281
|
+
"__data__unit": this.name,
|
|
282
|
+
"__record__id": r.record__id,
|
|
283
|
+
"__sub__changes": subChanges
|
|
284
|
+
};
|
|
285
|
+
if (recordChanges) {
|
|
286
|
+
Object.keys(recordChanges).forEach(fieldName => { });
|
|
287
|
+
}
|
|
288
|
+
return change;
|
|
289
|
+
}
|
|
290
|
+
return undefined;
|
|
291
|
+
}
|
|
292
|
+
getSubChanges(id) {
|
|
293
|
+
const result = [];
|
|
294
|
+
if (this._records) {
|
|
295
|
+
this._records.filter(r => r.parent__record__id === id).forEach(r => {
|
|
296
|
+
const c = this.buildChange(r);
|
|
297
|
+
if (c) {
|
|
298
|
+
result.push(c);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
return result;
|
|
303
|
+
}
|
|
304
|
+
getChangesToSave() {
|
|
305
|
+
let result = [];
|
|
306
|
+
if (this._records) {
|
|
307
|
+
this._records.forEach(r => {
|
|
308
|
+
const change = this.buildChange(r);
|
|
309
|
+
if (change) {
|
|
310
|
+
result.push(change);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
save() {
|
|
317
|
+
if (!this.validateRecords("SAVE")) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
this._store.dispatch(savingChanges(this.name));
|
|
321
|
+
let saveResult;
|
|
322
|
+
if (this.saveExecutor) {
|
|
323
|
+
saveResult = this.saveExecutor(this.getChangesToSave());
|
|
324
|
+
}
|
|
325
|
+
if (saveResult instanceof Promise) {
|
|
326
|
+
saveResult
|
|
327
|
+
.then(r => this.processSaveResult(r))
|
|
328
|
+
.catch(e => {
|
|
329
|
+
this._store.dispatch(dataLoaded(this.name));
|
|
330
|
+
ApplicationUtils.error("Falha ao tentar salvar", e);
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
this.processSaveResult(saveResult);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
load() {
|
|
338
|
+
this._store.dispatch(dataLoading(this.name));
|
|
339
|
+
let result;
|
|
340
|
+
if (this.loadExecutor) {
|
|
341
|
+
result = this.loadExecutor({ dataUnit: this.name });
|
|
342
|
+
}
|
|
343
|
+
if (result instanceof Promise) {
|
|
344
|
+
result.then(r => this.processLoadResult(r));
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
this.processLoadResult(result);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
remove() {
|
|
351
|
+
const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
|
|
352
|
+
this._store.dispatch(removingRecord(this.name));
|
|
353
|
+
let removeResult;
|
|
354
|
+
if (this.removeExecutor) {
|
|
355
|
+
const record = this.getCurrentRecord();
|
|
356
|
+
removeResult = this.removeExecutor({ dataUnit: this.name, recordId: record.record__id, record });
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
removeResult = true;
|
|
360
|
+
}
|
|
361
|
+
if (removeResult) {
|
|
362
|
+
if (removeResult instanceof Promise) {
|
|
363
|
+
removeResult.then(r => this.processRemoveResult(r, currentIndex));
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
this.processRemoveResult(removeResult, currentIndex);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
processSaveResult(result) {
|
|
371
|
+
if (result) {
|
|
372
|
+
if (result instanceof Array) {
|
|
373
|
+
result.forEach(item => this.processSaveResult(item));
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
if (result.__data__unit === this.name) {
|
|
377
|
+
if (this.cardinality === "1") {
|
|
378
|
+
this.records = [this.buildRecordFromSaveResult(this.records[0], result)];
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
//FIXME: Isso está errado! tem que limpar todas as edições
|
|
384
|
+
this._store.dispatch(clearEdition(this.name, this.records.length - 1));
|
|
385
|
+
this._store.dispatch(changesSaved(this.name));
|
|
386
|
+
}
|
|
387
|
+
buildRecordFromSaveResult(baseRecord, saveResult) {
|
|
388
|
+
const newRecord = baseRecord ? Object.assign({}, baseRecord) : { record__id: "" };
|
|
389
|
+
Object.keys(saveResult).forEach(attrib => {
|
|
390
|
+
if (!attrib.startsWith("__")) {
|
|
391
|
+
newRecord[attrib] = saveResult[attrib];
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
return newRecord;
|
|
395
|
+
}
|
|
396
|
+
processLoadResult(records) {
|
|
397
|
+
this.records = records;
|
|
398
|
+
this._store.dispatch(clearEdition(this.name, this.records.length - 1));
|
|
399
|
+
this._store.dispatch(dataLoaded(this.name));
|
|
400
|
+
}
|
|
401
|
+
processRemoveResult(removed, recordIndex) {
|
|
402
|
+
if (removed) {
|
|
403
|
+
this.records.splice(recordIndex, 1);
|
|
404
|
+
this._store.dispatch(clearEdition(this.name, this.records.length - 1));
|
|
405
|
+
}
|
|
406
|
+
this._store.dispatch(recordRemoved(this.name));
|
|
407
|
+
}
|
|
408
|
+
set records(records) {
|
|
409
|
+
this._records = records;
|
|
410
|
+
if (this.parentDU) {
|
|
411
|
+
this._records.forEach(r => this.bindToParent(r));
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
bindToParent(r) {
|
|
415
|
+
if (this.parentDU) {
|
|
416
|
+
const parentRecord = this.parentDU.getCurrentRecord();
|
|
417
|
+
if (parentRecord) {
|
|
418
|
+
r.parent__record__id = parentRecord.record__id;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
get records() {
|
|
423
|
+
if (!this._records) {
|
|
424
|
+
this._records = [];
|
|
425
|
+
}
|
|
426
|
+
return this._records;
|
|
427
|
+
}
|
|
428
|
+
getCurrentRecord() {
|
|
429
|
+
const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
|
|
430
|
+
return this.records[currentIndex];
|
|
431
|
+
}
|
|
432
|
+
getRecordChanges(currentRecord = undefined) {
|
|
433
|
+
if (currentRecord === undefined) {
|
|
434
|
+
currentRecord = this.getCurrentRecord();
|
|
435
|
+
}
|
|
436
|
+
return currentRecord ? selectRecordChanges(this._store.getState(), this.name, currentRecord.record__id) : undefined;
|
|
437
|
+
}
|
|
438
|
+
validateRecords(triggedBy = "UNKNOWN") {
|
|
439
|
+
if (!this.recordsValidator) {
|
|
440
|
+
return true;
|
|
441
|
+
}
|
|
442
|
+
const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
|
|
443
|
+
const recordsToValidate = [];
|
|
444
|
+
this.records.forEach((record, i) => {
|
|
445
|
+
const changes = duChanges ? duChanges[record.record__id] : undefined;
|
|
446
|
+
if (changes) {
|
|
447
|
+
recordsToValidate.push(Object.assign(Object.assign(Object.assign({}, record), changes), { record__index: i, record__changedfields: Object.keys(changes) }));
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
const result = this.recordsValidator.validateRecords(this, recordsToValidate, triggedBy);
|
|
451
|
+
if (result.message) {
|
|
452
|
+
ApplicationUtils.info(result.message);
|
|
453
|
+
}
|
|
454
|
+
return result.isValid;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
var DependencyType;
|
|
458
|
+
(function (DependencyType) {
|
|
459
|
+
DependencyType["SEARCHING"] = "SEARCHING";
|
|
460
|
+
DependencyType["REQUIREMENT"] = "REQUIREMENT";
|
|
461
|
+
DependencyType["VISIBILITY"] = "REQUIREMENT";
|
|
462
|
+
})(DependencyType || (DependencyType = {}));
|
|
463
|
+
|
|
464
|
+
export { DependencyType as D, selectCurrentTab as a, selectVisibleButtons as b, collapseExpandGroup as c, changeTab as d, showHideNavigationButtons as e, formLoad as f, DataUnit as g, invalidField as i, selectIsCollapsedFieldSet as s };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
class DateUtils {
|
|
2
|
+
static clearTime(date, adjustDayLightSavingTime = true) {
|
|
3
|
+
const newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
|
|
4
|
+
return adjustDayLightSavingTime ? DateUtils.adjustDLST(newDate) : newDate;
|
|
5
|
+
}
|
|
6
|
+
static strToDate(strValue, adjustDayLightSavingTime = true, monthYearMode = false) {
|
|
7
|
+
/** monthYearMode é um booleano para usar o formato MM/YYYY.
|
|
8
|
+
* Quando ativado, é retornado o primeiro dia do mês apenas para construir a data.
|
|
9
|
+
* Não há necessidade de verificar o horário de verão quando utilizado esse modo. */
|
|
10
|
+
let parts;
|
|
11
|
+
if (monthYearMode) {
|
|
12
|
+
parts = /^(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(strValue);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
parts = /^(3[01]|[1-2]\d|0[1-9]|[1-9])[^\d]?(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(strValue);
|
|
16
|
+
}
|
|
17
|
+
if (!parts) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
var day = monthYearMode ? 1 : Number(parts[1]);
|
|
21
|
+
var month = Number(parts[(monthYearMode ? 1 : 2)]);
|
|
22
|
+
var year = Number(parts[(monthYearMode ? 2 : 3)]);
|
|
23
|
+
var hour = Number(parts[(monthYearMode ? 3 : 4)] || 0);
|
|
24
|
+
var min = Number(parts[(monthYearMode ? 4 : 5)] || 0);
|
|
25
|
+
var sec = Number(parts[(monthYearMode ? 5 : 6)] || 0);
|
|
26
|
+
if (year < 100) {
|
|
27
|
+
year += year < 30 ? 2000 : 1900;
|
|
28
|
+
}
|
|
29
|
+
let date = new Date(year, month - 1, day, hour, min, sec, 0);
|
|
30
|
+
if (adjustDayLightSavingTime === true && !monthYearMode && hour == 0) {
|
|
31
|
+
date = DateUtils.adjustDLST(date);
|
|
32
|
+
}
|
|
33
|
+
return date;
|
|
34
|
+
}
|
|
35
|
+
static adjustDLST(date) {
|
|
36
|
+
//Work around para corrigir o Bug do horário de verão.
|
|
37
|
+
if (date.getHours() == 23) {
|
|
38
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1, 1, 0, 0, 0);
|
|
39
|
+
}
|
|
40
|
+
return date;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { DateUtils as D };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-1dacecd3.js';
|
|
2
2
|
|
|
3
3
|
const ezActionChipCss = ":host{--ez-action-chip--height:36px;--ez-action-chip--border-radius:var(--border--radius-large, 24px);--ez-action-chip__border:1px solid;--ez-action-chip__border-color-strokes:var(--color--strokes, #DCE0E8);--ez-action-chip--font-size:var(--text--medium, 14px);--ez-action-chip--font-family:var(--font-pattern, Arial);--ez-action-chip--font-weight:var(--text-weight--large, 500);--ez-action-chip__label--title--primary:var(--title--primary, #919191);--ez-action-chip__label-color--disable-secondary:var(--color--disable-secondary, #F2F5F8);--ez-action-chip__label__default--background-color--hover:var(--color--primary-200, #f2faf8);--ez-action-chip__label__default--border-color--hover:var(--color--primary-600, #007a5a)}.label__container{width:fit-content;display:flex;flex-wrap:wrap;position:relative;background-color:#FFFFFF;align-items:center;align-self:center;cursor:pointer;color:var(--ez-action-chip__label--title--primary);fill:var(--ez-action-chip__label--title--primary);border:var(--ez-action-chip__border);border-radius:var(--ez-action-chip--border-radius);border-color:var(--ez-action-chip__border-color-strokes);padding-right:var(--space--medium, 12px);padding-left:var(--space--medium, 12px)}.label__container:hover{border-color:var(--ez-action-chip__label__default--border-color--hover);background-color:var(--ez-action-chip__label__default--background-color--hover)}label{display:flex;align-items:center;font-weight:var(--text-weight--large, 600);cursor:pointer;height:var(--ez-action-chip--height);font-family:var(--ez-action-chip--font-family);font-size:var(--ez-action-chip--font-size)}";
|
|
4
4
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-1dacecd3.js';
|
|
2
|
+
import { d as Application } from './index-cfd5e193.js';
|
|
3
|
+
|
|
4
|
+
const ezApplicationCss = "";
|
|
5
|
+
|
|
6
|
+
let EzApplication = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.applicationLoaded = createEvent(this, "applicationLoaded", 7);
|
|
10
|
+
}
|
|
11
|
+
componentWillLoad() {
|
|
12
|
+
//Initizalize application
|
|
13
|
+
this.application = Application.get();
|
|
14
|
+
}
|
|
15
|
+
componentDidLoad() {
|
|
16
|
+
this.applicationLoaded.emit(true);
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return (h("div", null));
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
EzApplication.style = ezApplicationCss;
|
|
23
|
+
|
|
24
|
+
export { EzApplication as ez_application };
|