@sankhyalabs/ezui 1.1.78 → 1.1.79

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.
Files changed (150) hide show
  1. package/dist/cjs/{AssetsUtils-dd585fba.js → AssetsUtils-02db4f46.js} +1 -1
  2. package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-button_3.cjs.entry.js +520 -0
  5. package/dist/cjs/ez-calendar_13.cjs.entry.js +2417 -0
  6. package/dist/cjs/ez-date-time-input.cjs.entry.js +2 -2
  7. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  8. package/dist/cjs/{ez-button_11.cjs.entry.js → ez-grid.cjs.entry.js} +14 -1410
  9. package/dist/cjs/ez-icon.cjs.entry.js +30 -0
  10. package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-modal_2.cjs.entry.js +370 -0
  12. package/dist/cjs/ez-popover.cjs.entry.js +2 -2
  13. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-time-input.cjs.entry.js +3 -3
  15. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  16. package/dist/cjs/ezui.cjs.js +2 -2
  17. package/dist/cjs/{index-4e4bae01.js → index-2003dec4.js} +0 -10
  18. package/dist/cjs/{index-40ebb2be.js → index-a2266984.js} +18 -23
  19. package/dist/cjs/loader.cjs.js +2 -2
  20. package/dist/collection/collection-manifest.json +0 -2
  21. package/dist/collection/components/ez-form/DataBinder.js +44 -0
  22. package/dist/collection/components/ez-form/ez-form.css +1 -15
  23. package/dist/collection/components/ez-form/ez-form.js +109 -428
  24. package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +45 -0
  25. package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +11 -0
  26. package/dist/collection/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.js +14 -0
  27. package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +5 -0
  28. package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +5 -0
  29. package/dist/collection/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.js +13 -0
  30. package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +5 -0
  31. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextArea.tpl.js +5 -0
  32. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextInput.tpl.js +5 -0
  33. package/dist/collection/components/ez-form/store/form.slice.js +38 -0
  34. package/dist/collection/components/ez-form/structure/FormItem.js +11 -0
  35. package/dist/collection/components/ez-form/structure/FormSheet.js +5 -0
  36. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +86 -0
  37. package/dist/collection/components/test-du/test-du.js +65 -23
  38. package/dist/custom-elements/index.d.ts +0 -12
  39. package/dist/custom-elements/index.js +380 -2065
  40. package/dist/esm/{AssetsUtils-3803e935.js → AssetsUtils-76ca41e1.js} +1 -1
  41. package/dist/esm/ez-action-chip.entry.js +1 -1
  42. package/dist/esm/ez-application.entry.js +1 -1
  43. package/dist/esm/ez-button_3.entry.js +514 -0
  44. package/dist/esm/ez-calendar_13.entry.js +2401 -0
  45. package/dist/esm/ez-date-time-input.entry.js +2 -2
  46. package/dist/esm/ez-dialog.entry.js +1 -1
  47. package/dist/esm/{ez-button_11.entry.js → ez-grid.entry.js} +4 -1390
  48. package/dist/esm/ez-icon.entry.js +26 -0
  49. package/dist/esm/ez-label-chip.entry.js +1 -1
  50. package/dist/esm/ez-modal_2.entry.js +365 -0
  51. package/dist/esm/ez-popover.entry.js +2 -2
  52. package/dist/esm/ez-popup.entry.js +1 -1
  53. package/dist/esm/ez-time-input.entry.js +3 -3
  54. package/dist/esm/ez-toast.entry.js +1 -1
  55. package/dist/esm/ezui.js +2 -2
  56. package/dist/esm/{index-1dacecd3.js → index-077c7fcf.js} +0 -10
  57. package/dist/esm/{index-ca8700cb.js → index-afe19542.js} +17 -21
  58. package/dist/esm/loader.js +2 -2
  59. package/dist/ezui/ezui.esm.js +1 -1
  60. package/dist/ezui/p-00b837e2.js +1 -0
  61. package/dist/ezui/{p-516d0e0f.entry.js → p-0a2056d9.entry.js} +1 -1
  62. package/dist/ezui/{p-a15093e3.entry.js → p-0d8368fc.entry.js} +1 -1
  63. package/dist/ezui/p-1e36e3ff.entry.js +1 -0
  64. package/dist/ezui/p-446ec85b.js +1 -0
  65. package/dist/ezui/{p-74f978db.entry.js → p-5509ee41.entry.js} +46 -46
  66. package/dist/ezui/{p-a18a2d7b.entry.js → p-57ea4b84.entry.js} +1 -1
  67. package/dist/ezui/{p-5a86e18a.entry.js → p-6d157776.entry.js} +1 -1
  68. package/dist/ezui/{p-f3c5f27e.entry.js → p-7a1f2e0e.entry.js} +1 -1
  69. package/dist/ezui/p-7de3c95d.js +1 -0
  70. package/dist/ezui/{p-8d6cdd3e.entry.js → p-857ead8e.entry.js} +1 -1
  71. package/dist/ezui/{p-c6d469fc.entry.js → p-920bb8c9.entry.js} +1 -1
  72. package/dist/ezui/p-9be02ecf.entry.js +1 -0
  73. package/dist/ezui/p-a4a39579.entry.js +1 -0
  74. package/dist/ezui/p-d5699f29.entry.js +1 -0
  75. package/dist/ezui/p-d64a3939.entry.js +1 -0
  76. package/dist/ezui/{p-5da66d3e.entry.js → p-da31cd21.entry.js} +1 -1
  77. package/dist/types/components/ez-form/DataBinder.d.ts +10 -0
  78. package/dist/types/components/ez-form/ez-form.d.ts +24 -32
  79. package/dist/types/components/ez-form/fieldbuilder/FieldBuilder.d.ts +2 -0
  80. package/dist/types/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.d.ts +3 -0
  81. package/dist/types/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.d.ts +4 -0
  82. package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +4 -0
  83. package/dist/types/components/ez-form/fieldbuilder/tpl/FileInput.tpl.d.ts +4 -0
  84. package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +8 -0
  85. package/dist/types/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.d.ts +4 -0
  86. package/dist/types/components/ez-form/fieldbuilder/tpl/TextArea.tpl.d.ts +4 -0
  87. package/dist/types/components/ez-form/fieldbuilder/tpl/TextInput.tpl.d.ts +4 -0
  88. package/dist/types/components/ez-form/store/form.slice.d.ts +24 -0
  89. package/dist/types/components/ez-form/structure/FormItem.d.ts +9 -0
  90. package/dist/types/components/ez-form/structure/FormSheet.d.ts +9 -0
  91. package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +27 -0
  92. package/dist/types/components/test-du/test-du.d.ts +8 -2
  93. package/dist/types/components.d.ts +9 -63
  94. package/package.json +1 -1
  95. package/react/components.d.ts +0 -2
  96. package/react/components.js +0 -2
  97. package/react/components.js.map +1 -1
  98. package/dist/cjs/ApplicationUtils-d1c1db56.js +0 -35
  99. package/dist/cjs/DataUnit-fdd7c70e.js +0 -474
  100. package/dist/cjs/ez-calendar.cjs.entry.js +0 -217
  101. package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +0 -634
  102. package/dist/cjs/ez-combo-box.cjs.entry.js +0 -254
  103. package/dist/cjs/ez-form.cjs.entry.js +0 -1838
  104. package/dist/cjs/ez-number-input.cjs.entry.js +0 -74
  105. package/dist/cjs/form-metadata.cjs.entry.js +0 -129
  106. package/dist/collection/components/ez-form/assets/trash-can-outline.svg +0 -3
  107. package/dist/collection/components/ez-form/store/Form.actions.js +0 -132
  108. package/dist/collection/components/ez-form/store/Form.reducer.js +0 -194
  109. package/dist/collection/components/ez-form/store/Form.selectors.js +0 -44
  110. package/dist/collection/components/ez-form/subcomponents/DataUnit.js +0 -301
  111. package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +0 -8
  112. package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +0 -24
  113. package/dist/collection/components/ez-form/subcomponents/form-metadata.js +0 -227
  114. package/dist/collection/components/ez-form/subcomponents/place-holder.js +0 -14
  115. package/dist/collection/components/ez-form/subcomponents/structure/Field.js +0 -95
  116. package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +0 -27
  117. package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +0 -41
  118. package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +0 -37
  119. package/dist/esm/ApplicationUtils-01280a9d.js +0 -33
  120. package/dist/esm/DataUnit-1cd45202.js +0 -464
  121. package/dist/esm/ez-calendar.entry.js +0 -213
  122. package/dist/esm/ez-collapsible-box_6.entry.js +0 -625
  123. package/dist/esm/ez-combo-box.entry.js +0 -250
  124. package/dist/esm/ez-form.entry.js +0 -1834
  125. package/dist/esm/ez-number-input.entry.js +0 -70
  126. package/dist/esm/form-metadata.entry.js +0 -125
  127. package/dist/ezui/assets/trash-can-outline.svg +0 -3
  128. package/dist/ezui/p-14bee38e.entry.js +0 -1
  129. package/dist/ezui/p-37a611ea.js +0 -1
  130. package/dist/ezui/p-3a09c678.entry.js +0 -1
  131. package/dist/ezui/p-43c15c94.entry.js +0 -1
  132. package/dist/ezui/p-7107d7ef.js +0 -1
  133. package/dist/ezui/p-72ff3c95.entry.js +0 -1
  134. package/dist/ezui/p-88f45a83.entry.js +0 -1
  135. package/dist/ezui/p-8f4851a6.js +0 -1
  136. package/dist/ezui/p-9dfd537e.js +0 -1
  137. package/dist/ezui/p-a0331955.entry.js +0 -1
  138. package/dist/ezui/p-a19f2af3.entry.js +0 -1
  139. package/dist/ezui/p-da929c01.js +0 -1
  140. package/dist/types/components/ez-form/store/Form.actions.d.ts +0 -111
  141. package/dist/types/components/ez-form/store/Form.reducer.d.ts +0 -20
  142. package/dist/types/components/ez-form/store/Form.selectors.d.ts +0 -14
  143. package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +0 -91
  144. package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +0 -24
  145. package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +0 -16
  146. package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +0 -3
  147. package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +0 -11
  148. package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +0 -13
  149. package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +0 -14
  150. package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +0 -19
@@ -1,474 +0,0 @@
1
- 'use strict';
2
-
3
- const ApplicationUtils = require('./ApplicationUtils-d1c1db56.js');
4
-
5
- function changeFieldValue(dataUnit, recordId, fieldName, value) {
6
- return {
7
- type: "FORM/CHANGEFIELD",
8
- payload: { dataUnit, recordId, fieldName, value }
9
- };
10
- }
11
- function changeTab(formId, index) {
12
- return {
13
- type: "FORM/CHANGETAB",
14
- payload: { formId, index }
15
- };
16
- }
17
- function clearEdition(dataUnit, recordsLimit) {
18
- return {
19
- type: "FORM/CLEAREDITION",
20
- payload: {
21
- dataUnit,
22
- recordsLimit
23
- }
24
- };
25
- }
26
- function collapseExpandGroup(collapseId, collapsed) {
27
- return {
28
- type: "FORM/COLLAPSEGROUP",
29
- payload: { collapseId, collapsed }
30
- };
31
- }
32
- function previousRecord(dataUnit) {
33
- return {
34
- type: "FORM/NAVIGATE",
35
- payload: {
36
- dataUnit,
37
- limit: 0,
38
- backward: true
39
- }
40
- };
41
- }
42
- function nextRecord(dataUnit, limit) {
43
- return {
44
- type: "FORM/NAVIGATE",
45
- payload: {
46
- dataUnit,
47
- limit,
48
- backward: false
49
- }
50
- };
51
- }
52
- function insertRecord(dataUnit, insertionIndex) {
53
- return {
54
- type: "FORM/INSERT",
55
- payload: {
56
- dataUnit,
57
- insertionIndex
58
- }
59
- };
60
- }
61
- function formLoad() {
62
- return {
63
- type: "FORM/LOAD"
64
- };
65
- }
66
- function dataLoading(dataUnit) {
67
- return {
68
- type: "FORM/DATALOADING",
69
- payload: {
70
- dataUnit
71
- }
72
- };
73
- }
74
- function savingChanges(dataUnit) {
75
- return {
76
- type: "FORM/SAVINGCHANGES",
77
- payload: {
78
- dataUnit
79
- }
80
- };
81
- }
82
- function dataLoaded(dataUnit) {
83
- return {
84
- type: "FORM/DATALOADED",
85
- payload: {
86
- dataUnit
87
- }
88
- };
89
- }
90
- function changesSaved(dataUnit) {
91
- return {
92
- type: "FORM/CHANGESSAVED",
93
- payload: {
94
- dataUnit
95
- }
96
- };
97
- }
98
- function removingRecord(dataUnit) {
99
- return {
100
- type: "FORM/REMOVINGRECORD",
101
- payload: {
102
- dataUnit
103
- }
104
- };
105
- }
106
- function recordRemoved(dataUnit) {
107
- return {
108
- type: "FORM/RECORDREMOVED",
109
- payload: {
110
- dataUnit
111
- }
112
- };
113
- }
114
- function invalidField(tabController, tabIndex, dataUnit, recordIndex, recordId, fieldName, errorMessage) {
115
- return {
116
- type: "FORM/INVALIDFIELD",
117
- payload: {
118
- tabController,
119
- tabIndex,
120
- dataUnit,
121
- recordId,
122
- recordIndex,
123
- fieldName,
124
- errorMessage
125
- }
126
- };
127
- }
128
- function showHideNavigationButtons(buttonName, status) {
129
- return {
130
- type: "FORM/SHOWHIDENAVBTN",
131
- payload: {
132
- buttonName,
133
- status
134
- }
135
- };
136
- }
137
-
138
- //histórico
139
- const selectCurrentTab = (state, formName) => {
140
- const data = state.hist.present.currentTabIndex;
141
- return data[formName] || 0;
142
- };
143
- const selectIsCollapsedFieldSet = (state, fieldSetName) => {
144
- const data = state.hist.present.collapsedGroups;
145
- return data[fieldSetName];
146
- };
147
- const selectRecordChanges = (state, dataUnit, recordId) => {
148
- const data = selectDataUnitChanges(state, dataUnit);
149
- return data ? data[recordId] : undefined;
150
- };
151
- const selectDataUnitChanges = (state, dataUnit) => {
152
- const data = state.hist.present.changes;
153
- return data[dataUnit];
154
- };
155
- const selectCurrentRecordIndex = (state, dataUnit) => {
156
- const data = state.hist.present.currentRecordIndex;
157
- return data[dataUnit] || 0;
158
- };
159
- const selectNewRecordIndex = (state, dataUnit) => {
160
- const data = state.hist.present.newRecordIndex;
161
- return data[dataUnit] || 0;
162
- };
163
- //não histórico
164
- const selectLoadingData = (state, dataUnit) => {
165
- const data = state.nonhist.dataLoading;
166
- return data[dataUnit];
167
- };
168
- const selectErrorMessage = (state, dataUnit, recordId, fieldName) => {
169
- const data = state.nonhist.invalidFields;
170
- const dataUnitMessages = data[dataUnit] || {};
171
- const recordMessages = dataUnitMessages[recordId] || {};
172
- return recordMessages[fieldName] || "";
173
- };
174
- const selectVisibleButtons = state => state.nonhist.visibleButtons;
175
-
176
- class DataUnit {
177
- constructor(name, unitLabel, cardinality = "1", parentDU = null) {
178
- this.name = name;
179
- this.unitLabel = unitLabel;
180
- this.cardinality = cardinality;
181
- this._children = [];
182
- this._fields = new Map();
183
- this._requiredFields = [];
184
- if (parentDU != null) {
185
- parentDU._children.push(this);
186
- this.parentDU = parentDU;
187
- this.parentDUName = parentDU.name;
188
- }
189
- }
190
- set store(store) {
191
- this._store = store;
192
- }
193
- set fields(value) {
194
- if (value) {
195
- value.forEach(f => this.addFieldMetadata(f));
196
- }
197
- }
198
- addFieldMetadata(field) {
199
- this._fields.set(field.name, field);
200
- if (field.required) {
201
- this._requiredFields.push(field);
202
- }
203
- }
204
- getFieldMetadata(name) {
205
- if (this._fields) {
206
- return this._fields.get(name);
207
- }
208
- return undefined;
209
- }
210
- get requiredFields() {
211
- return this._requiredFields;
212
- }
213
- isLoading() {
214
- return selectLoadingData(this._store.getState(), this.name);
215
- }
216
- hasChanges() {
217
- const state = this._store.getState();
218
- return selectDataUnitChanges(state, this.name) !== undefined || selectNewRecordIndex(state, this.name) > 0;
219
- }
220
- hasNext() {
221
- return selectCurrentRecordIndex(this._store.getState(), this.name) < (this.records.length - 1);
222
- }
223
- hasPrevious() {
224
- return selectCurrentRecordIndex(this._store.getState(), this.name) > 0;
225
- }
226
- hasCurrentRecord() {
227
- return this.getCurrentRecord() != undefined;
228
- }
229
- previous() {
230
- this._store.dispatch(previousRecord(this.name));
231
- }
232
- next() {
233
- this._store.dispatch(nextRecord(this.name, this.records.length));
234
- }
235
- getValue(fieldName) {
236
- const currentRecord = this.getCurrentRecord();
237
- if (!currentRecord) {
238
- return undefined;
239
- }
240
- const changes = this.getRecordChanges(currentRecord);
241
- return changes && changes[fieldName] !== undefined ? changes[fieldName] : currentRecord[fieldName] || null;
242
- }
243
- getErrorMessage(fieldName) {
244
- const currentRecord = this.getCurrentRecord();
245
- return selectErrorMessage(this._store.getState(), this.name, currentRecord === null || currentRecord === void 0 ? void 0 : currentRecord.record__id, fieldName);
246
- }
247
- changeValue(fieldName, newValue) {
248
- if (this.records.length == 0) {
249
- this.insert();
250
- }
251
- if (this._changeDeboucing) {
252
- window.clearTimeout(this._changeDeboucing);
253
- }
254
- this._changeDeboucing = window.setTimeout(() => {
255
- const currentRecord = this.getCurrentRecord();
256
- this._store.dispatch(changeFieldValue(this.name, currentRecord.record__id, fieldName, newValue));
257
- }, 100);
258
- }
259
- cancel() {
260
- this.records = this.records.filter(r => !r.record__id.startsWith("NEW_"));
261
- this._store.dispatch(clearEdition(this.name, this.records.length - 1));
262
- }
263
- insert() {
264
- const insertionIndex = this.records.length;
265
- const newRecordIndex = selectNewRecordIndex(this._store.getState(), this.name);
266
- const newRecord = { record__id: "NEW_" + (newRecordIndex + 1) };
267
- this.bindToParent(newRecord);
268
- this.records.push(newRecord);
269
- this._store.dispatch(insertRecord(this.name, insertionIndex));
270
- }
271
- buildChange(r) {
272
- const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
273
- let recordChanges;
274
- if (duChanges) {
275
- recordChanges = duChanges[r.record__id];
276
- }
277
- let subChanges = [];
278
- this._children.forEach(duChild => {
279
- subChanges = subChanges.concat(duChild.getSubChanges(r.record__id));
280
- });
281
- if (recordChanges || subChanges.length > 0) {
282
- const change = {
283
- "__data__unit": this.name,
284
- "__record__id": r.record__id,
285
- "__sub__changes": subChanges
286
- };
287
- if (recordChanges) {
288
- Object.keys(recordChanges).forEach(fieldName => { });
289
- }
290
- return change;
291
- }
292
- return undefined;
293
- }
294
- getSubChanges(id) {
295
- const result = [];
296
- if (this._records) {
297
- this._records.filter(r => r.parent__record__id === id).forEach(r => {
298
- const c = this.buildChange(r);
299
- if (c) {
300
- result.push(c);
301
- }
302
- });
303
- }
304
- return result;
305
- }
306
- getChangesToSave() {
307
- let result = [];
308
- if (this._records) {
309
- this._records.forEach(r => {
310
- const change = this.buildChange(r);
311
- if (change) {
312
- result.push(change);
313
- }
314
- });
315
- }
316
- return result;
317
- }
318
- save() {
319
- if (!this.validateRecords("SAVE")) {
320
- return;
321
- }
322
- this._store.dispatch(savingChanges(this.name));
323
- let saveResult;
324
- if (this.saveExecutor) {
325
- saveResult = this.saveExecutor(this.getChangesToSave());
326
- }
327
- if (saveResult instanceof Promise) {
328
- saveResult
329
- .then(r => this.processSaveResult(r))
330
- .catch(e => {
331
- this._store.dispatch(dataLoaded(this.name));
332
- ApplicationUtils.ApplicationUtils.error("Falha ao tentar salvar", e);
333
- });
334
- }
335
- else {
336
- this.processSaveResult(saveResult);
337
- }
338
- }
339
- load() {
340
- this._store.dispatch(dataLoading(this.name));
341
- let result;
342
- if (this.loadExecutor) {
343
- result = this.loadExecutor({ dataUnit: this.name });
344
- }
345
- if (result instanceof Promise) {
346
- result.then(r => this.processLoadResult(r));
347
- }
348
- else {
349
- this.processLoadResult(result);
350
- }
351
- }
352
- remove() {
353
- const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
354
- this._store.dispatch(removingRecord(this.name));
355
- let removeResult;
356
- if (this.removeExecutor) {
357
- const record = this.getCurrentRecord();
358
- removeResult = this.removeExecutor({ dataUnit: this.name, recordId: record.record__id, record });
359
- }
360
- else {
361
- removeResult = true;
362
- }
363
- if (removeResult) {
364
- if (removeResult instanceof Promise) {
365
- removeResult.then(r => this.processRemoveResult(r, currentIndex));
366
- }
367
- else {
368
- this.processRemoveResult(removeResult, currentIndex);
369
- }
370
- }
371
- }
372
- processSaveResult(result) {
373
- if (result) {
374
- if (result instanceof Array) {
375
- result.forEach(item => this.processSaveResult(item));
376
- }
377
- else {
378
- if (result.__data__unit === this.name) {
379
- if (this.cardinality === "1") {
380
- this.records = [this.buildRecordFromSaveResult(this.records[0], result)];
381
- }
382
- }
383
- }
384
- }
385
- //FIXME: Isso está errado! tem que limpar todas as edições
386
- this._store.dispatch(clearEdition(this.name, this.records.length - 1));
387
- this._store.dispatch(changesSaved(this.name));
388
- }
389
- buildRecordFromSaveResult(baseRecord, saveResult) {
390
- const newRecord = baseRecord ? Object.assign({}, baseRecord) : { record__id: "" };
391
- Object.keys(saveResult).forEach(attrib => {
392
- if (!attrib.startsWith("__")) {
393
- newRecord[attrib] = saveResult[attrib];
394
- }
395
- });
396
- return newRecord;
397
- }
398
- processLoadResult(records) {
399
- this.records = records;
400
- this._store.dispatch(clearEdition(this.name, this.records.length - 1));
401
- this._store.dispatch(dataLoaded(this.name));
402
- }
403
- processRemoveResult(removed, recordIndex) {
404
- if (removed) {
405
- this.records.splice(recordIndex, 1);
406
- this._store.dispatch(clearEdition(this.name, this.records.length - 1));
407
- }
408
- this._store.dispatch(recordRemoved(this.name));
409
- }
410
- set records(records) {
411
- this._records = records;
412
- if (this.parentDU) {
413
- this._records.forEach(r => this.bindToParent(r));
414
- }
415
- }
416
- bindToParent(r) {
417
- if (this.parentDU) {
418
- const parentRecord = this.parentDU.getCurrentRecord();
419
- if (parentRecord) {
420
- r.parent__record__id = parentRecord.record__id;
421
- }
422
- }
423
- }
424
- get records() {
425
- if (!this._records) {
426
- this._records = [];
427
- }
428
- return this._records;
429
- }
430
- getCurrentRecord() {
431
- const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
432
- return this.records[currentIndex];
433
- }
434
- getRecordChanges(currentRecord = undefined) {
435
- if (currentRecord === undefined) {
436
- currentRecord = this.getCurrentRecord();
437
- }
438
- return currentRecord ? selectRecordChanges(this._store.getState(), this.name, currentRecord.record__id) : undefined;
439
- }
440
- validateRecords(triggedBy = "UNKNOWN") {
441
- if (!this.recordsValidator) {
442
- return true;
443
- }
444
- const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
445
- const recordsToValidate = [];
446
- this.records.forEach((record, i) => {
447
- const changes = duChanges ? duChanges[record.record__id] : undefined;
448
- if (changes) {
449
- recordsToValidate.push(Object.assign(Object.assign(Object.assign({}, record), changes), { record__index: i, record__changedfields: Object.keys(changes) }));
450
- }
451
- });
452
- const result = this.recordsValidator.validateRecords(this, recordsToValidate, triggedBy);
453
- if (result.message) {
454
- ApplicationUtils.ApplicationUtils.info(result.message);
455
- }
456
- return result.isValid;
457
- }
458
- }
459
- exports.DependencyType = void 0;
460
- (function (DependencyType) {
461
- DependencyType["SEARCHING"] = "SEARCHING";
462
- DependencyType["REQUIREMENT"] = "REQUIREMENT";
463
- DependencyType["VISIBILITY"] = "REQUIREMENT";
464
- })(exports.DependencyType || (exports.DependencyType = {}));
465
-
466
- exports.DataUnit = DataUnit;
467
- exports.changeTab = changeTab;
468
- exports.collapseExpandGroup = collapseExpandGroup;
469
- exports.formLoad = formLoad;
470
- exports.invalidField = invalidField;
471
- exports.selectCurrentTab = selectCurrentTab;
472
- exports.selectIsCollapsedFieldSet = selectIsCollapsedFieldSet;
473
- exports.selectVisibleButtons = selectVisibleButtons;
474
- exports.showHideNavigationButtons = showHideNavigationButtons;
@@ -1,217 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-4e4bae01.js');
6
- require('./index-40ebb2be.js');
7
- const FloatingManager = require('./FloatingManager-6cfeb947.js');
8
-
9
- const ezCalendarCss = ":host{--ez-calendar--font-family:var(--font-pattern, Arial);--ez-calendar--color:var(--title--primary, #626e82);--ez-calendar--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-calendar__body--background-color:var(--background--xlight, #FFF);--ez-calendar__Time--background-color:var(--background--xlight, #FAFAFA);--ez-calendar__body--padding:var(--space--medium, 12px);--ez-calendar__body--border-radius:var(--border--radius-medium, 12px);--ez-calendar__body--shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-calendar__header-line--stroke:2px;--ez-calendar__header-line--color:var(--color--strokes, #C0C0C0);--ez-calendar__nav-btn--fill:var(--text--primary, #008561);--ez-calendar__nav-btn--hover--fill:var(--color--primary, #350404);--ez-calendar__nav-btn--width:10px;--ez-calendar__nav-btn--height:16px;--ez-calendar__nav-btn--previous-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z\"/></svg>');--ez-calendar__nav-btn--next-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>');--ez-calendar__cell--margin:0px var(--space--small, 12px);--ez-calendar__cell--width:var(--space--large, 24px);--ez-calendar__cell--padding:var(--space--extra-small, 3px) 0px;--ez-calendar__cell--border-radius:var(--border--radius-small, 6px);--ez-calendar__cell--over--background-color:var(--color--strokes, #E2F4EF);--ez-calendar__cell--outset--color:var(--color--strokes, #C0C0C0);--ez-calendar__cell--selected--background-color:var(--color--primary, #008561);--ez-calendar__cell--selected--color:var(--color--inverted, #FFF);--ez-calendar__btn-today--color:var(--color--primary);--ez-calendar__btn-today--hover--background-color:var(--color--strokes, #E2F4EF);--ez-calendar__btn-today--border-radius:var(--border--radius-small, 6px);position:relative;display:flex;user-select:none}.calendar{z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-calendar__body--background-color);padding:var(--ez-calendar__body--padding);border-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__header{display:flex;justify-content:space-between;padding-bottom:var(--space--medium, 12px);margin:var(--space--small, 6px) var(--space--, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color)}.calendar__btn-next,.calendar__btn-previous{outline:none;border:none;background-color:unset;cursor:pointer;padding:0px}.calendar__btn-next::after,.calendar__btn-previous::after{content:'';display:flex;background-color:var(--ez-calendar__nav-btn--fill);width:var(--ez-calendar__nav-btn--width);height:var(--ez-calendar__nav-btn--height)}.calendar__btn-previous::after{-webkit-mask-image:var(--ez-calendar__nav-btn--previous-image);mask-image:var(--ez-calendar__nav-btn--previous-image)}.calendar__btn-next::after{-webkit-mask-image:var(--ez-calendar__nav-btn--next-image);mask-image:var(--ez-calendar__nav-btn--next-image)}.calendar__btn-next:hover::after,.calendar__btn-previous:hover::after{background-color:var(--ez-calendar__nav-btn--hover--fill)}.calendar__lbl-month{font-weight:var(--text-weight--large, 600);font-size:var(--title--medium, 16px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__line{display:flex;padding:0px;margin:0px}.calendar__cell{display:flex;justify-content:center;align-content:center;cursor:pointer;font-size:var(--text--small, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);padding:var(--ez-calendar__cell--padding);margin:var(--ez-calendar__cell--margin);min-width:var(--ez-calendar__cell--width);border-radius:var(--ez-calendar__cell--border-radius)}.calendar__cell:hover{background-color:var(--ez-calendar__cell--over--background-color)}.calendar__cell--secondary{color:var(--ez-calendar__cell--outset--color)}.calendar__cell--unselectable:hover{background-color:unset;border-radius:unset;cursor:unset}.calendar__cell--unselectable{font-weight:var(--text-weight--large, 600);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__cell--selected,.calendar__cell--selected:hover{background-color:var(--ez-calendar__cell--selected--background-color);color:var(--ez-calendar__cell--selected--color)}.calendar__body{padding:var(--space--small, 6px) 0px}.calendar__footer{display:flex;flex-direction:column}.calendar__btn-today{border:none;background-color:unset;cursor:pointer;font-weight:var(--text-weight--large, 600);font-size:var(--title--small);padding:var(--space--extra-small, 6px);font-family:var(--ez-calendar--font-family);text-shadow:var(--ez-calendar--text-shadow);color:var(--ez-calendar__btn-today--color);border-radius:var(--ez-calendar__btn-today--border-radius)}.calendar__btn-today:hover{background-color:var(--ez-calendar__btn-today--hover--background-color)}section{display:flex}.calendarTime{margin-left:-10px;display:flex;flex-direction:column;padding:12px 6px;padding-left:16px;padding-bottom:0px;background-color:var(--ez-calendar__Time--background-color);border-top-right-radius:var(--ez-calendar__body--border-radius);border-bottom-right-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__column{height:180px;padding:0px;margin:0px;overflow:auto}.calendar__column::-webkit-scrollbar{width:0px;max-width:0px;min-width:0px}.calendarTime__header{padding-left:6px;padding-right:6px;display:flex;justify-content:space-between;padding-bottom:var(--space--medium, 12px);margin:var(--space--small, 6px) var(--space--, 12px);font-weight:var(--text-weight--large, 600);font-size:var(--title--medium, 16px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.separatorTime{color:#A2ABB9}.endHidden{-webkit-mask-image:linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%)}";
10
-
11
- let EzCalendar = class {
12
- constructor(hostRef) {
13
- index.registerInstance(this, hostRef);
14
- this.ezChange = index.createEvent(this, "ezChange", 7);
15
- this._firstRender = true;
16
- this._todayLabel = "Hoje";
17
- this._weekDayLabels = ["D", "S", "T", "Q", "Q", "S", "S"];
18
- this._monthLabels = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
19
- this._hoursLabel = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"];
20
- this._minutosLabel = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59"];
21
- /**
22
- * A data selecionada no calendário
23
- */
24
- this.value = new Date();
25
- /**
26
- * No modo floating o calendário só se tornará visível
27
- * quando o método show() for acionado.
28
- */
29
- this.floating = false;
30
- /**
31
- * Exibe ou não as horas e minutos no calendario
32
- */
33
- this.time = false;
34
- /**
35
- * Exibe ou não os segundos no calendario
36
- */
37
- this.showSeconds = false;
38
- }
39
- /**
40
- * Usado no modo floating. Faz com que o componente seja exibido.
41
- * É possível determinar ajustes de posicionamento através dos parâmetros
42
- * top, left, bottom e right. Esses parâmetros devem ser informados como
43
- * strings no formato css.
44
- */
45
- async show(top, left, bottom, right) {
46
- if (this.floating) {
47
- this._floatingID = FloatingManager.FloatingManager.float(this._box, this._container, { autoClose: true, top, left, bottom, right });
48
- window.requestAnimationFrame(() => {
49
- this._box.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
50
- });
51
- }
52
- }
53
- /**
54
- * Método necessário para ajustar o posicionamento do calendar acima ou abaixo do ez-date-input conforme a disponibilidade de espaço.
55
- */
56
- async fitVertical(topOffset, bottomOffset) {
57
- const neededHeight = this._container.getBoundingClientRect().bottom + this._calendarHeight;
58
- const availableBottom = (window.innerHeight || document.documentElement.clientHeight) > neededHeight;
59
- if (availableBottom) {
60
- this.show(topOffset + "px", undefined, "unset");
61
- }
62
- else {
63
- this.show("unset", undefined, bottomOffset + "px");
64
- }
65
- }
66
- /**
67
- * Usado no modo floating. Faz com que o componente seja ocultado.
68
- */
69
- async hide() {
70
- if (this._floatingID !== undefined) {
71
- FloatingManager.FloatingManager.close(this._floatingID);
72
- this._floatingID = undefined;
73
- }
74
- }
75
- valueChanged() {
76
- if (this.value) {
77
- this._currentPosition.setTime(this.value.getTime());
78
- this._currentPosition.setDate(1);
79
- }
80
- }
81
- getMonthLabel() {
82
- return this._monthLabels[this._currentPosition.getMonth()] + " " + this._currentPosition.getFullYear();
83
- }
84
- isSelectedDate(d) {
85
- if (this.value) {
86
- return this.value.getDate() == d.getDate() && this.value.getMonth() == d.getMonth() && this.value.getFullYear() == d.getFullYear();
87
- }
88
- return false;
89
- }
90
- changeMonth(offset) {
91
- this._currentPosition.setMonth(this._currentPosition.getMonth() + offset);
92
- index.forceUpdate(this);
93
- }
94
- selectDate(d) {
95
- let newDate = d;
96
- if (this.value && (this.time || this.showSeconds)) {
97
- newDate.setHours(this.value.getHours());
98
- newDate.setMinutes(this.value.getMinutes());
99
- if (this.showSeconds) {
100
- newDate.setSeconds(this.value.getSeconds());
101
- }
102
- else {
103
- newDate.setSeconds(0);
104
- }
105
- }
106
- this.value = newDate;
107
- this.ezChange.emit();
108
- }
109
- selectHours(hour) {
110
- if (!this.value) {
111
- this.value = new Date();
112
- }
113
- this.value = new Date(this.value.getFullYear(), this.value.getMonth(), this.value.getDate(), hour, this.value.getMinutes(), this.value.getSeconds());
114
- this.ezChange.emit();
115
- }
116
- selectMinutes(minute) {
117
- if (!this.value) {
118
- this.value = new Date();
119
- }
120
- this.value = new Date(this.value.getFullYear(), this.value.getMonth(), this.value.getDate(), this.value.getHours(), minute, this.value.getSeconds());
121
- this.ezChange.emit();
122
- }
123
- selectSeconds(second) {
124
- if (!this.value) {
125
- this.value = new Date();
126
- }
127
- this.value = new Date(this.value.getFullYear(), this.value.getMonth(), this.value.getDate(), this.value.getHours(), this.value.getMinutes(), second);
128
- this.ezChange.emit();
129
- }
130
- updateScroll(element) {
131
- if (element) {
132
- const { scrollHeight, clientHeight, scrollTop } = element;
133
- const remainingScroll = scrollHeight - clientHeight - Math.ceil(scrollTop);
134
- if (remainingScroll > 0) {
135
- element.classList.add("endHidden");
136
- }
137
- else {
138
- element.classList.remove("endHidden");
139
- }
140
- }
141
- }
142
- componentDidRender() {
143
- if (this.floating && this._firstRender) {
144
- this._calendarHeight = this._box.clientHeight;
145
- this._box.remove();
146
- this._firstRender = false;
147
- }
148
- this.updateScroll(this._hoursScroll);
149
- this.updateScroll(this._minutesScroll);
150
- this.updateScroll(this._secondsScroll);
151
- }
152
- componentDidLoad() {
153
- if (this.time || this.showSeconds) {
154
- this._hoursScroll.scrollTop = this._hoursSelect.offsetTop - 64;
155
- this._minutesScroll.scrollTop = this._minutesSelect.offsetTop - 64;
156
- if (this.showSeconds) {
157
- this._secondsScroll.scrollTop = this._secondsSelect.offsetTop - 64;
158
- }
159
- }
160
- }
161
- render() {
162
- if (this._currentPosition == null) {
163
- this._currentPosition = new Date();
164
- if (this.value) {
165
- this._currentPosition.setTime(this.value.getTime());
166
- }
167
- this._currentPosition.setDate(1);
168
- }
169
- const firstDate = new Date();
170
- firstDate.setTime(this._currentPosition.getTime());
171
- firstDate.setDate(1 - firstDate.getDay());
172
- return (index.h("section", { ref: elem => this._container = elem }, index.h("div", { ref: elem => this._box = elem, style: { display: 'flex' } }, index.h("div", { class: "calendar" }, index.h("div", { class: "calendar__header" }, index.h("button", { class: "calendar__btn-previous", onClick: () => this.changeMonth(-1) }), index.h("label", { class: "calendar__lbl-month" }, this.getMonthLabel()), index.h("button", { class: "calendar__btn-next", onClick: () => this.changeMonth(1) })), index.h("div", { class: "calendar__body" }, index.h("div", { class: "calendar__line" }, this._weekDayLabels.map(day => index.h("div", { class: "calendar__cell calendar__cell--unselectable" }, day))), [0, 7, 14, 21, 28, 35].map(offset => index.h("div", { class: "calendar__line" }, [0, 1, 2, 3, 4, 5, 6].map(index$1 => {
173
- const date = new Date();
174
- date.setTime(firstDate.getTime());
175
- date.setDate(date.getDate() + offset + index$1);
176
- let classNames = "calendar__cell";
177
- if (this._currentPosition.getMonth() != date.getMonth()) {
178
- classNames += " calendar__cell--secondary";
179
- }
180
- else if (this.isSelectedDate(date)) {
181
- classNames += " calendar__cell--selected";
182
- }
183
- return index.h("div", { class: classNames, onClick: () => this.selectDate(date) }, date.getDate());
184
- })))), index.h("div", { class: "calendar__footer" }, index.h("button", { class: "calendar__btn-today", onClick: () => this.selectDate(new Date()) }, this._todayLabel))), (this.time || this.showSeconds) &&
185
- index.h("div", { class: "calendarTime" }, index.h("div", { class: "calendarTime__header" }, index.h("div", null, "H"), index.h("div", { class: "separatorTime" }, ":"), index.h("div", null, "M"), this.showSeconds &&
186
- index.h("div", { class: "separatorTime" }, ":"), this.showSeconds &&
187
- index.h("div", null, "S")), index.h("div", { class: "calendar__body ", style: { display: 'flex', paddingLeft: '6px', paddingRight: '6px' } }, index.h("div", { class: "calendar__column", ref: elem => this._hoursScroll = elem, onScroll: () => this.updateScroll(this._hoursScroll) }, this._hoursLabel.map((offset, index$1) => {
188
- if (index$1 === this.value.getHours()) {
189
- return (index.h("div", { style: { display: 'flex' }, ref: elem => this._hoursSelect = elem }, index.h("div", { class: "calendar__cell calendar__cell--selected", onClick: () => this.selectHours(index$1) }, offset), index.h("div", { class: "separatorTime" }, ":")));
190
- }
191
- else {
192
- return (index.h("div", { style: { display: 'flex' } }, index.h("div", { class: "calendar__cell", onClick: () => this.selectHours(index$1) }, offset), index.h("div", { class: "separatorTime" }, ":")));
193
- }
194
- })), index.h("div", { class: "calendar__column", ref: elem => this._minutesScroll = elem, onScroll: () => this.updateScroll(this._minutesScroll) }, this._minutosLabel.map((offset, index$1) => {
195
- if (index$1 === this.value.getMinutes()) {
196
- return (index.h("div", { style: { display: 'flex' }, ref: elem => this._minutesSelect = elem }, index.h("div", { class: "calendar__cell calendar__cell--selected", onClick: () => this.selectMinutes(index$1) }, offset), this.showSeconds && index.h("div", { class: "separatorTime" }, ":")));
197
- }
198
- else {
199
- return (index.h("div", { style: { display: 'flex' } }, index.h("div", { class: "calendar__cell", onClick: () => this.selectMinutes(index$1) }, offset), this.showSeconds && index.h("div", { class: "separatorTime" }, ":")));
200
- }
201
- })), this.showSeconds &&
202
- index.h("div", { class: "calendar__column", ref: elem => this._secondsScroll = elem, onScroll: () => this.updateScroll(this._secondsScroll) }, this._minutosLabel.map((offset, index$1) => {
203
- if (index$1 === this.value.getSeconds()) {
204
- return (index.h("div", { class: "calendar__cell calendar__cell--selected", onClick: () => this.selectSeconds(index$1), ref: elem => this._secondsSelect = elem }, offset));
205
- }
206
- else {
207
- return (index.h("div", { class: "calendar__cell", onClick: () => this.selectSeconds(index$1) }, offset));
208
- }
209
- })))))));
210
- }
211
- static get watchers() { return {
212
- "value": ["valueChanged"]
213
- }; }
214
- };
215
- EzCalendar.style = ezCalendarCss;
216
-
217
- exports.ez_calendar = EzCalendar;