@sankhyalabs/ezui 1.1.78 → 1.1.81
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/{AssetsUtils-dd585fba.js → AssetsUtils-02db4f46.js} +1 -1
- package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -1
- package/dist/cjs/ez-button_3.cjs.entry.js +520 -0
- package/dist/cjs/ez-calendar_14.cjs.entry.js +2598 -0
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/{ez-button_11.cjs.entry.js → ez-grid.cjs.entry.js} +14 -1410
- package/dist/cjs/ez-icon.cjs.entry.js +30 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal_2.cjs.entry.js +370 -0
- package/dist/cjs/ez-popover.cjs.entry.js +2 -2
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +3 -3
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/{index-4e4bae01.js → index-2003dec4.js} +0 -10
- package/dist/cjs/{index-40ebb2be.js → index-4fc4a0a4.js} +86 -63
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +0 -2
- package/dist/collection/components/ez-form/DataBinder.js +50 -0
- package/dist/collection/components/ez-form/ez-form.css +1 -15
- package/dist/collection/components/ez-form/ez-form.js +112 -427
- package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +46 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +11 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.js +14 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +9 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.js +13 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/TextArea.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/TextInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/store/form.slice.js +38 -0
- package/dist/collection/components/ez-form/structure/FormItem.js +11 -0
- package/dist/collection/components/ez-form/structure/FormSheet.js +5 -0
- package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +86 -0
- package/dist/collection/components/test-du/test-du.js +65 -23
- package/dist/custom-elements/index.d.ts +0 -12
- package/dist/custom-elements/index.js +462 -2104
- package/dist/esm/{AssetsUtils-3803e935.js → AssetsUtils-76ca41e1.js} +1 -1
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -1
- package/dist/esm/ez-button_3.entry.js +514 -0
- package/dist/esm/ez-calendar_14.entry.js +2581 -0
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/{ez-button_11.entry.js → ez-grid.entry.js} +4 -1390
- package/dist/esm/ez-icon.entry.js +26 -0
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-modal_2.entry.js +365 -0
- package/dist/esm/ez-popover.entry.js +2 -2
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +3 -3
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +2 -2
- package/dist/esm/{index-1dacecd3.js → index-077c7fcf.js} +0 -10
- package/dist/esm/{index-ca8700cb.js → index-e31373d9.js} +85 -61
- package/dist/esm/loader.js +2 -2
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-516d0e0f.entry.js → p-0a2056d9.entry.js} +1 -1
- package/dist/ezui/{p-74f978db.entry.js → p-1c8d64d0.entry.js} +46 -46
- package/dist/ezui/p-1e36e3ff.entry.js +1 -0
- package/dist/ezui/p-446ec85b.js +1 -0
- package/dist/ezui/{p-a18a2d7b.entry.js → p-57ea4b84.entry.js} +1 -1
- package/dist/ezui/{p-5a86e18a.entry.js → p-6d157776.entry.js} +1 -1
- package/dist/ezui/p-7de3c95d.js +1 -0
- package/dist/ezui/p-8b9ef58b.entry.js +1 -0
- package/dist/ezui/{p-c6d469fc.entry.js → p-920bb8c9.entry.js} +1 -1
- package/dist/ezui/p-983bd291.js +1 -0
- package/dist/ezui/p-9dbf569a.entry.js +1 -0
- package/dist/ezui/p-a4a39579.entry.js +1 -0
- package/dist/ezui/{p-8d6cdd3e.entry.js → p-aef3394b.entry.js} +1 -1
- package/dist/ezui/p-d64a3939.entry.js +1 -0
- package/dist/ezui/{p-5da66d3e.entry.js → p-da31cd21.entry.js} +1 -1
- package/dist/ezui/{p-f3c5f27e.entry.js → p-da63000f.entry.js} +1 -1
- package/dist/types/components/ez-form/DataBinder.d.ts +10 -0
- package/dist/types/components/ez-form/ez-form.d.ts +25 -32
- package/dist/types/components/ez-form/fieldbuilder/FieldBuilder.d.ts +2 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.d.ts +3 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +8 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/FileInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +8 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/TextArea.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/TextInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/store/form.slice.d.ts +24 -0
- package/dist/types/components/ez-form/structure/FormItem.d.ts +9 -0
- package/dist/types/components/ez-form/structure/FormSheet.d.ts +9 -0
- package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +27 -0
- package/dist/types/components/test-du/test-du.d.ts +8 -2
- package/dist/types/components.d.ts +9 -63
- package/package.json +2 -2
- package/react/components.d.ts +0 -2
- package/react/components.js +0 -2
- package/react/components.js.map +1 -1
- package/dist/cjs/ApplicationUtils-d1c1db56.js +0 -35
- package/dist/cjs/DataUnit-fdd7c70e.js +0 -474
- package/dist/cjs/DateUtils-716769e0.js +0 -46
- package/dist/cjs/ez-calendar.cjs.entry.js +0 -217
- package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +0 -634
- package/dist/cjs/ez-combo-box.cjs.entry.js +0 -254
- package/dist/cjs/ez-date-time-input.cjs.entry.js +0 -133
- package/dist/cjs/ez-form.cjs.entry.js +0 -1838
- package/dist/cjs/ez-number-input.cjs.entry.js +0 -74
- package/dist/cjs/form-metadata.cjs.entry.js +0 -129
- package/dist/collection/components/ez-form/assets/trash-can-outline.svg +0 -3
- package/dist/collection/components/ez-form/store/Form.actions.js +0 -132
- package/dist/collection/components/ez-form/store/Form.reducer.js +0 -194
- package/dist/collection/components/ez-form/store/Form.selectors.js +0 -44
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +0 -301
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +0 -8
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +0 -24
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +0 -227
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +0 -14
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +0 -95
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +0 -27
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +0 -41
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +0 -37
- package/dist/esm/ApplicationUtils-01280a9d.js +0 -33
- package/dist/esm/DataUnit-1cd45202.js +0 -464
- package/dist/esm/DateUtils-0a1bbd7a.js +0 -44
- package/dist/esm/ez-calendar.entry.js +0 -213
- package/dist/esm/ez-collapsible-box_6.entry.js +0 -625
- package/dist/esm/ez-combo-box.entry.js +0 -250
- package/dist/esm/ez-date-time-input.entry.js +0 -129
- package/dist/esm/ez-form.entry.js +0 -1834
- package/dist/esm/ez-number-input.entry.js +0 -70
- package/dist/esm/form-metadata.entry.js +0 -125
- package/dist/ezui/assets/trash-can-outline.svg +0 -3
- package/dist/ezui/p-14bee38e.entry.js +0 -1
- package/dist/ezui/p-37a611ea.js +0 -1
- package/dist/ezui/p-3a09c678.entry.js +0 -1
- package/dist/ezui/p-43c15c94.entry.js +0 -1
- package/dist/ezui/p-7107d7ef.js +0 -1
- package/dist/ezui/p-72ff3c95.entry.js +0 -1
- package/dist/ezui/p-88f45a83.entry.js +0 -1
- package/dist/ezui/p-8f4851a6.js +0 -1
- package/dist/ezui/p-9dfd537e.js +0 -1
- package/dist/ezui/p-a0331955.entry.js +0 -1
- package/dist/ezui/p-a15093e3.entry.js +0 -1
- package/dist/ezui/p-a19f2af3.entry.js +0 -1
- package/dist/ezui/p-c89629eb.js +0 -1
- package/dist/ezui/p-da929c01.js +0 -1
- package/dist/types/components/ez-form/store/Form.actions.d.ts +0 -111
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +0 -20
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +0 -14
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +0 -91
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +0 -24
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +0 -16
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +0 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +0 -11
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +0 -13
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +0 -14
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +0 -19
|
@@ -1128,11 +1128,7 @@ class AddedRecordsReducerImpl {
|
|
|
1128
1128
|
reduce(_stateManager, currentState, action) {
|
|
1129
1129
|
switch (action.type) {
|
|
1130
1130
|
case Action.RECORDS_ADDED:
|
|
1131
|
-
|
|
1132
|
-
action.payload.forEach((r) => {
|
|
1133
|
-
newState.push(Object.assign({ __record__id__: "NEW_" + (newState.length + 1) }, r));
|
|
1134
|
-
});
|
|
1135
|
-
return newState;
|
|
1131
|
+
return (currentState || []).concat(action.payload);
|
|
1136
1132
|
case Action.DATA_SAVED:
|
|
1137
1133
|
case Action.EDITION_CANCELED:
|
|
1138
1134
|
return undefined;
|
|
@@ -1144,6 +1140,10 @@ const AddedRecordsReducer = new AddedRecordsReducerImpl();
|
|
|
1144
1140
|
const getAddedRecords = (stateManager) => {
|
|
1145
1141
|
return stateManager.select(AddedRecordsReducer.sliceName, (state) => state);
|
|
1146
1142
|
};
|
|
1143
|
+
const prepareAddedRecordId = (stateManager, source) => {
|
|
1144
|
+
let index = (getAddedRecords(stateManager) || []).length;
|
|
1145
|
+
return source.map(item => { return Object.assign(Object.assign({}, item), { __record__id__: "NEW_" + (index++) }); });
|
|
1146
|
+
};
|
|
1147
1147
|
|
|
1148
1148
|
class ChangesReducerImpl {
|
|
1149
1149
|
constructor() {
|
|
@@ -1156,7 +1156,9 @@ class ChangesReducerImpl {
|
|
|
1156
1156
|
if (selection) {
|
|
1157
1157
|
const newState = new Map(currentState);
|
|
1158
1158
|
selection.forEach(recordId => {
|
|
1159
|
-
|
|
1159
|
+
const newChanges = Object.assign(Object.assign({}, newState.get(recordId)), action.payload);
|
|
1160
|
+
delete newChanges.records;
|
|
1161
|
+
newState.set(recordId, newChanges);
|
|
1160
1162
|
});
|
|
1161
1163
|
return newState;
|
|
1162
1164
|
}
|
|
@@ -1185,16 +1187,14 @@ const getChangesToSave = (dataUnit, stateManager) => {
|
|
|
1185
1187
|
const result = [];
|
|
1186
1188
|
const changes = getChanges(stateManager);
|
|
1187
1189
|
const records = getRecords(stateManager);
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
result.push(new Change(dataUnit, r, c, ChangeOperation.UPDATE));
|
|
1194
|
-
}
|
|
1190
|
+
records === null || records === void 0 ? void 0 : records.forEach(r => {
|
|
1191
|
+
if (changes) {
|
|
1192
|
+
const c = changes.get(r.__record__id__);
|
|
1193
|
+
if (c) {
|
|
1194
|
+
result.push(new Change(dataUnit, r, c, ChangeOperation.UPDATE));
|
|
1195
1195
|
}
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1196
|
+
}
|
|
1197
|
+
});
|
|
1198
1198
|
const addedRecords = getAddedRecords(stateManager);
|
|
1199
1199
|
if (addedRecords) {
|
|
1200
1200
|
addedRecords.forEach(r => {
|
|
@@ -1203,7 +1203,7 @@ const getChangesToSave = (dataUnit, stateManager) => {
|
|
|
1203
1203
|
}
|
|
1204
1204
|
const removedRecords = getRemovedRecords(stateManager);
|
|
1205
1205
|
const recordsById = {};
|
|
1206
|
-
records.forEach(r => recordsById[r.__record__id__] = r);
|
|
1206
|
+
records === null || records === void 0 ? void 0 : records.forEach(r => recordsById[r.__record__id__] = r);
|
|
1207
1207
|
if (removedRecords) {
|
|
1208
1208
|
removedRecords.forEach(id => {
|
|
1209
1209
|
result.push(new Change(dataUnit, recordsById[id], undefined, ChangeOperation.DELETE));
|
|
@@ -1259,6 +1259,8 @@ class SelectionReducerImpl {
|
|
|
1259
1259
|
}
|
|
1260
1260
|
reduce(stateManager, currentState, action) {
|
|
1261
1261
|
switch (action.type) {
|
|
1262
|
+
case Action.RECORDS_ADDED:
|
|
1263
|
+
return action.payload.map((r) => r.__record__id__);
|
|
1262
1264
|
case Action.DATA_SAVED:
|
|
1263
1265
|
return updateSavedIds(stateManager, action.payload.records);
|
|
1264
1266
|
case Action.RECORDS_REMOVED:
|
|
@@ -1360,7 +1362,16 @@ function updateSavedIds(stateManager, savedRecords) {
|
|
|
1360
1362
|
return currentSelection;
|
|
1361
1363
|
}
|
|
1362
1364
|
|
|
1363
|
-
|
|
1365
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1366
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1367
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1368
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1369
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1370
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1371
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1372
|
+
});
|
|
1373
|
+
};
|
|
1374
|
+
class DataUnit {
|
|
1364
1375
|
constructor(name) {
|
|
1365
1376
|
this._name = name;
|
|
1366
1377
|
this._stateManager = new StateManager([
|
|
@@ -1401,32 +1412,46 @@ class DataUnit$1 {
|
|
|
1401
1412
|
}
|
|
1402
1413
|
// Loaders
|
|
1403
1414
|
loadMetadata() {
|
|
1404
|
-
this
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1415
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1416
|
+
this.dispatchAction(Action.LOADING_METADATA);
|
|
1417
|
+
return new Promise((resolve, fail) => {
|
|
1418
|
+
if (this.metadataLoader) {
|
|
1419
|
+
this.metadataLoader(this._name).then(metadata => {
|
|
1420
|
+
this.metadata = metadata;
|
|
1421
|
+
resolve(this.metadata);
|
|
1422
|
+
}).catch(error => fail(error));
|
|
1423
|
+
}
|
|
1424
|
+
});
|
|
1425
|
+
});
|
|
1408
1426
|
}
|
|
1409
1427
|
loadData() {
|
|
1410
|
-
this
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
this.records
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1428
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1429
|
+
this.dispatchAction(Action.LOADING_DATA);
|
|
1430
|
+
return new Promise((resolve, fail) => {
|
|
1431
|
+
if (this.dataLoader) {
|
|
1432
|
+
const sort = this.getSort();
|
|
1433
|
+
const filters = this.getFilters();
|
|
1434
|
+
this.dataLoader(this._name, sort, filters).then(records => {
|
|
1435
|
+
this.records = records;
|
|
1436
|
+
resolve(this.records);
|
|
1437
|
+
}).catch(error => fail(error));
|
|
1438
|
+
}
|
|
1439
|
+
});
|
|
1420
1440
|
});
|
|
1421
1441
|
}
|
|
1422
1442
|
saveData() {
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1443
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1444
|
+
const changes = getChangesToSave(this._name, this._stateManager);
|
|
1445
|
+
if (changes.length > 0) {
|
|
1446
|
+
this.dispatchAction(Action.SAVING_DATA);
|
|
1447
|
+
return new Promise((resolve, fail) => {
|
|
1448
|
+
if (this.saveLoader) {
|
|
1449
|
+
this.saveLoader(this._name, changes).then(records => this.dispatchAction(Action.DATA_SAVED, { changes, records })).catch(error => fail(error));
|
|
1450
|
+
}
|
|
1451
|
+
});
|
|
1428
1452
|
}
|
|
1429
|
-
|
|
1453
|
+
return Promise.resolve();
|
|
1454
|
+
});
|
|
1430
1455
|
}
|
|
1431
1456
|
// API
|
|
1432
1457
|
addFilterProvider(provider) {
|
|
@@ -1452,7 +1477,7 @@ class DataUnit$1 {
|
|
|
1452
1477
|
return getField(this._stateManager, fieldName);
|
|
1453
1478
|
}
|
|
1454
1479
|
addRecord() {
|
|
1455
|
-
this.dispatchAction(Action.RECORDS_ADDED, [{}]);
|
|
1480
|
+
this.dispatchAction(Action.RECORDS_ADDED, prepareAddedRecordId(this._stateManager, [{}]));
|
|
1456
1481
|
}
|
|
1457
1482
|
removeSelectedRecords() {
|
|
1458
1483
|
const selection = getSelection(this._stateManager);
|
|
@@ -1525,9 +1550,9 @@ class DataUnit$1 {
|
|
|
1525
1550
|
}
|
|
1526
1551
|
var ChangeOperation;
|
|
1527
1552
|
(function (ChangeOperation) {
|
|
1528
|
-
ChangeOperation[
|
|
1529
|
-
ChangeOperation[
|
|
1530
|
-
ChangeOperation[
|
|
1553
|
+
ChangeOperation["INSERT"] = "INSERT";
|
|
1554
|
+
ChangeOperation["UPDATE"] = "UPDATE";
|
|
1555
|
+
ChangeOperation["DELETE"] = "DELETE";
|
|
1531
1556
|
})(ChangeOperation || (ChangeOperation = {}));
|
|
1532
1557
|
class Change {
|
|
1533
1558
|
constructor(dataUnit, record, updates, operation) {
|
|
@@ -1536,6 +1561,9 @@ class Change {
|
|
|
1536
1561
|
this.updatingFields = updates;
|
|
1537
1562
|
this._operation = operation;
|
|
1538
1563
|
}
|
|
1564
|
+
get operation() {
|
|
1565
|
+
return this._operation.toString();
|
|
1566
|
+
}
|
|
1539
1567
|
isInsert() {
|
|
1540
1568
|
return this._operation === ChangeOperation.INSERT;
|
|
1541
1569
|
}
|
|
@@ -1552,12 +1580,12 @@ var SortMode;
|
|
|
1552
1580
|
SortMode["ASC"] = "ASC";
|
|
1553
1581
|
SortMode["DESC"] = "DESC";
|
|
1554
1582
|
})(SortMode || (SortMode = {}));
|
|
1555
|
-
var DependencyType
|
|
1583
|
+
var DependencyType;
|
|
1556
1584
|
(function (DependencyType) {
|
|
1557
1585
|
DependencyType["SEARCHING"] = "SEARCHING";
|
|
1558
1586
|
DependencyType["REQUIREMENT"] = "REQUIREMENT";
|
|
1559
1587
|
DependencyType["VISIBILITY"] = "REQUIREMENT";
|
|
1560
|
-
})(DependencyType
|
|
1588
|
+
})(DependencyType || (DependencyType = {}));
|
|
1561
1589
|
var UserInterface;
|
|
1562
1590
|
(function (UserInterface) {
|
|
1563
1591
|
UserInterface["FILE"] = "FILE";
|
|
@@ -1591,10 +1619,6 @@ var LoadType;
|
|
|
1591
1619
|
|
|
1592
1620
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1593
1621
|
|
|
1594
|
-
function getDefaultExportFromCjs (x) {
|
|
1595
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
1622
|
function createCommonjsModule(fn, basedir, module) {
|
|
1599
1623
|
return module = {
|
|
1600
1624
|
path: basedir,
|
|
@@ -8609,58 +8633,211 @@ let EzDialog$1 = class extends HTMLElement$1 {
|
|
|
8609
8633
|
static get style() { return ezDialogCss; }
|
|
8610
8634
|
};
|
|
8611
8635
|
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
});
|
|
8620
|
-
|
|
8621
|
-
obj[key] = value;
|
|
8622
|
-
}
|
|
8636
|
+
const buildTextArea = ({ name, label }) => {
|
|
8637
|
+
return (h("div", { class: "col col--sd-12 padding--small", key: name },
|
|
8638
|
+
h("ez-text-area", { label: label, "data-field-name": name })));
|
|
8639
|
+
};
|
|
8640
|
+
|
|
8641
|
+
const buildTextInput = ({ name, label }) => {
|
|
8642
|
+
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
8643
|
+
h("ez-text-input", { label: label, "data-field-name": name, key: name })));
|
|
8644
|
+
};
|
|
8623
8645
|
|
|
8624
|
-
|
|
8646
|
+
const buildSwitch = (fieldConfig) => {
|
|
8647
|
+
return buildField$1(fieldConfig.name, fieldConfig.label, true);
|
|
8648
|
+
};
|
|
8649
|
+
const buildCheckBox = (fieldConfig) => {
|
|
8650
|
+
return buildField$1(fieldConfig.name, fieldConfig.label, false);
|
|
8651
|
+
};
|
|
8652
|
+
function buildField$1(fieldName, fieldLabel, switchMode = false) {
|
|
8653
|
+
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small align--middle padding-bottom--large" },
|
|
8654
|
+
h("ez-check", { label: fieldLabel, mode: switchMode ? "switch" : "regular", "data-field-name": fieldName, key: fieldName })));
|
|
8625
8655
|
}
|
|
8626
8656
|
|
|
8627
|
-
|
|
8628
|
-
|
|
8657
|
+
const buildComboBox = ({ name, label }, properties) => {
|
|
8658
|
+
const prop = properties === null || properties === void 0 ? void 0 : properties.options;
|
|
8659
|
+
let options;
|
|
8660
|
+
if (typeof prop === "string") {
|
|
8661
|
+
const parsed = JSON.parse(prop);
|
|
8662
|
+
options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
|
|
8663
|
+
}
|
|
8664
|
+
else {
|
|
8665
|
+
options = prop;
|
|
8666
|
+
}
|
|
8667
|
+
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
8668
|
+
h("ez-combo-box", { label: label, "data-field-name": name, key: name, options: options })));
|
|
8669
|
+
};
|
|
8629
8670
|
|
|
8630
|
-
|
|
8631
|
-
|
|
8671
|
+
const buildSearch = ({ name, label }) => {
|
|
8672
|
+
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
8673
|
+
h("ez-search", { label: label, optionLoader: (_argument) => { }, "data-field-name": name, key: name })));
|
|
8674
|
+
};
|
|
8632
8675
|
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
}
|
|
8676
|
+
const buildFile = ({ name, label }) => {
|
|
8677
|
+
return (h("div", { class: "col col--sd-12 padding--small" },
|
|
8678
|
+
h("ez-upload", { label: label, urlUpload: "", requestHeaders: "", maxFiles: 10, "data-field-name": name, key: name })));
|
|
8679
|
+
};
|
|
8638
8680
|
|
|
8639
|
-
|
|
8640
|
-
}
|
|
8681
|
+
const buildDate = ({ name, label }) => {
|
|
8682
|
+
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
8683
|
+
h("ez-date-input", { label: label, "data-field-name": name, key: name })));
|
|
8684
|
+
};
|
|
8685
|
+
const buildTimeDate = ({ name, label }) => {
|
|
8686
|
+
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
8687
|
+
h("ez-date-time-input", { label: label, "data-field-name": name, key: name })));
|
|
8688
|
+
};
|
|
8641
8689
|
|
|
8642
|
-
|
|
8690
|
+
const buildDecimal = ({ name, label }, properties) => {
|
|
8691
|
+
const precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
|
|
8692
|
+
const prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
|
|
8693
|
+
return buildNumeric(name, label, precision, prettyPrecision);
|
|
8694
|
+
};
|
|
8695
|
+
const buildInteger = ({ name, label }) => {
|
|
8696
|
+
return buildNumeric(name, label, 0, 0);
|
|
8697
|
+
};
|
|
8698
|
+
function buildNumeric(fieldName, fieldLabel, precision, prettyPrecision) {
|
|
8699
|
+
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
8700
|
+
h("ez-number-input", { label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, key: fieldName })));
|
|
8643
8701
|
}
|
|
8644
8702
|
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8703
|
+
const uiBuilders = new Map();
|
|
8704
|
+
uiBuilders.set(UserInterface.LONGTEXT, buildTextArea);
|
|
8705
|
+
uiBuilders.set(UserInterface.CHECKBOX, buildCheckBox);
|
|
8706
|
+
uiBuilders.set(UserInterface.SWITCH, buildSwitch);
|
|
8707
|
+
uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
|
|
8708
|
+
uiBuilders.set(UserInterface.SEARCH, buildSearch);
|
|
8709
|
+
uiBuilders.set(UserInterface.FILE, buildFile);
|
|
8710
|
+
uiBuilders.set(UserInterface.DATE, buildDate);
|
|
8711
|
+
uiBuilders.set(UserInterface.DATETIME, buildTimeDate);
|
|
8712
|
+
uiBuilders.set(UserInterface.DECIMALNUMBER, buildDecimal);
|
|
8713
|
+
uiBuilders.set(UserInterface.INTEGERNUMBER, buildInteger);
|
|
8714
|
+
const buildField = (field) => {
|
|
8715
|
+
const descriptor = field.descriptor;
|
|
8716
|
+
const config = Object.assign({}, field.config);
|
|
8717
|
+
let builder;
|
|
8718
|
+
let props;
|
|
8719
|
+
if (descriptor) {
|
|
8720
|
+
builder = uiBuilders.get(descriptor.userInterface);
|
|
8721
|
+
if (!config.label) {
|
|
8722
|
+
config.label = descriptor.label;
|
|
8723
|
+
}
|
|
8724
|
+
if (!config.name) {
|
|
8725
|
+
config.name = descriptor.name;
|
|
8726
|
+
}
|
|
8727
|
+
if (config.required === undefined) {
|
|
8728
|
+
config.required = descriptor.required;
|
|
8659
8729
|
}
|
|
8730
|
+
props = descriptor.properties;
|
|
8660
8731
|
}
|
|
8732
|
+
if (config.required) {
|
|
8733
|
+
config.label = `* ${config.label} (obrigatório)`;
|
|
8734
|
+
}
|
|
8735
|
+
if (!builder) {
|
|
8736
|
+
builder = buildTextInput;
|
|
8737
|
+
}
|
|
8738
|
+
return builder(config, props);
|
|
8739
|
+
};
|
|
8661
8740
|
|
|
8662
|
-
|
|
8741
|
+
const FormItem = ({ source }) => {
|
|
8742
|
+
if ("items" in source) {
|
|
8743
|
+
const fieldSet = source;
|
|
8744
|
+
return h("ez-collapsible-box", { label: source.label }, fieldSet.items.map(fi => buildField(fi)));
|
|
8745
|
+
}
|
|
8746
|
+
else {
|
|
8747
|
+
return buildField(source);
|
|
8748
|
+
}
|
|
8749
|
+
};
|
|
8750
|
+
|
|
8751
|
+
const FormSheet = ({ store, source }) => {
|
|
8752
|
+
return (h("div", { class: "box__container" }, source.items.map(item => h(FormItem, { store: store, source: item }))));
|
|
8753
|
+
};
|
|
8754
|
+
|
|
8755
|
+
class FormMetadata {
|
|
8756
|
+
constructor() {
|
|
8757
|
+
this._sheets = new Map();
|
|
8758
|
+
this._requiredFields = [];
|
|
8759
|
+
}
|
|
8760
|
+
getSheet(name) {
|
|
8761
|
+
return this._sheets.get(name);
|
|
8762
|
+
}
|
|
8763
|
+
getAllSheets() {
|
|
8764
|
+
return this._sheets;
|
|
8765
|
+
}
|
|
8766
|
+
addSheet(sheet) {
|
|
8767
|
+
this._sheets.set(sheet.name, sheet);
|
|
8768
|
+
this._requiredFields = this._requiredFields.concat(sheet.requiredFields);
|
|
8769
|
+
}
|
|
8770
|
+
getRequiredFields() {
|
|
8771
|
+
return this._requiredFields;
|
|
8772
|
+
}
|
|
8663
8773
|
}
|
|
8774
|
+
const buildFromDataUnit = (dataUnit) => {
|
|
8775
|
+
var _a;
|
|
8776
|
+
const unitMD = dataUnit.metadata;
|
|
8777
|
+
const metadata = new FormMetadata();
|
|
8778
|
+
if (unitMD) {
|
|
8779
|
+
const visibleFields = (_a = unitMD.fields) === null || _a === void 0 ? void 0 : _a.filter(descriptor => descriptor.visible !== false);
|
|
8780
|
+
metadata.addSheet({
|
|
8781
|
+
label: unitMD.label,
|
|
8782
|
+
name: unitMD.name,
|
|
8783
|
+
items: visibleFields.map(descriptor => { return { descriptor }; }),
|
|
8784
|
+
requiredFields: visibleFields
|
|
8785
|
+
.filter(descriptor => descriptor.required)
|
|
8786
|
+
.map(descriptor => descriptor.name)
|
|
8787
|
+
});
|
|
8788
|
+
}
|
|
8789
|
+
return metadata;
|
|
8790
|
+
};
|
|
8791
|
+
const buildFromConfig = (fields, dataUnit) => {
|
|
8792
|
+
const sheets = new Map();
|
|
8793
|
+
const requiredFields = [];
|
|
8794
|
+
fields.forEach(config => {
|
|
8795
|
+
if (config.visible !== false) {
|
|
8796
|
+
const tab = config.tab || "Geral";
|
|
8797
|
+
const descriptor = dataUnit.getField(config.name);
|
|
8798
|
+
if (!sheets.has(tab)) {
|
|
8799
|
+
sheets.set(tab, new Map());
|
|
8800
|
+
}
|
|
8801
|
+
let isRequired = false;
|
|
8802
|
+
if (config.required === undefined) {
|
|
8803
|
+
if (descriptor) {
|
|
8804
|
+
isRequired = descriptor.required;
|
|
8805
|
+
}
|
|
8806
|
+
}
|
|
8807
|
+
else {
|
|
8808
|
+
isRequired = config.required;
|
|
8809
|
+
}
|
|
8810
|
+
if (isRequired) {
|
|
8811
|
+
requiredFields.push(config.name);
|
|
8812
|
+
}
|
|
8813
|
+
const tabItens = sheets.get(tab);
|
|
8814
|
+
const fieldMD = { config, descriptor };
|
|
8815
|
+
const group = config.group;
|
|
8816
|
+
if (group) {
|
|
8817
|
+
const key = `group::${group}`;
|
|
8818
|
+
if (!tabItens.has(key)) {
|
|
8819
|
+
tabItens.set(key, { label: group, items: [fieldMD] });
|
|
8820
|
+
}
|
|
8821
|
+
else {
|
|
8822
|
+
tabItens.get(key).items.push(fieldMD);
|
|
8823
|
+
}
|
|
8824
|
+
}
|
|
8825
|
+
else {
|
|
8826
|
+
tabItens.set(config.name, fieldMD);
|
|
8827
|
+
}
|
|
8828
|
+
}
|
|
8829
|
+
});
|
|
8830
|
+
const metadata = new FormMetadata();
|
|
8831
|
+
sheets.forEach((value, key) => {
|
|
8832
|
+
metadata.addSheet({
|
|
8833
|
+
label: key,
|
|
8834
|
+
name: key,
|
|
8835
|
+
items: Array.from(value.values()),
|
|
8836
|
+
requiredFields
|
|
8837
|
+
});
|
|
8838
|
+
});
|
|
8839
|
+
return metadata;
|
|
8840
|
+
};
|
|
8664
8841
|
|
|
8665
8842
|
/**
|
|
8666
8843
|
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
|
|
@@ -8985,1145 +9162,94 @@ function createStore(reducer, preloadedState, enhancer) {
|
|
|
8985
9162
|
}, _ref2[$$observable] = observable, _ref2;
|
|
8986
9163
|
}
|
|
8987
9164
|
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
if (typeof reducer(undefined, {
|
|
9000
|
-
type: ActionTypes.PROBE_UNKNOWN_ACTION()
|
|
9001
|
-
}) === 'undefined') {
|
|
9002
|
-
throw new Error(formatProdErrorMessage(13) );
|
|
9003
|
-
}
|
|
9004
|
-
});
|
|
9005
|
-
}
|
|
9006
|
-
/**
|
|
9007
|
-
* Turns an object whose values are different reducer functions, into a single
|
|
9008
|
-
* reducer function. It will call every child reducer, and gather their results
|
|
9009
|
-
* into a single state object, whose keys correspond to the keys of the passed
|
|
9010
|
-
* reducer functions.
|
|
9011
|
-
*
|
|
9012
|
-
* @param {Object} reducers An object whose values correspond to different
|
|
9013
|
-
* reducer functions that need to be combined into one. One handy way to obtain
|
|
9014
|
-
* it is to use ES6 `import * as reducers` syntax. The reducers may never return
|
|
9015
|
-
* undefined for any action. Instead, they should return their initial state
|
|
9016
|
-
* if the state passed to them was undefined, and the current state for any
|
|
9017
|
-
* unrecognized action.
|
|
9018
|
-
*
|
|
9019
|
-
* @returns {Function} A reducer function that invokes every reducer inside the
|
|
9020
|
-
* passed object, and builds a state object with the same shape.
|
|
9021
|
-
*/
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
function combineReducers(reducers) {
|
|
9025
|
-
var reducerKeys = Object.keys(reducers);
|
|
9026
|
-
var finalReducers = {};
|
|
9027
|
-
|
|
9028
|
-
for (var i = 0; i < reducerKeys.length; i++) {
|
|
9029
|
-
var key = reducerKeys[i];
|
|
9030
|
-
|
|
9031
|
-
if (typeof reducers[key] === 'function') {
|
|
9032
|
-
finalReducers[key] = reducers[key];
|
|
9033
|
-
}
|
|
9034
|
-
}
|
|
9035
|
-
|
|
9036
|
-
var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
|
|
9037
|
-
|
|
9038
|
-
var shapeAssertionError;
|
|
9039
|
-
|
|
9040
|
-
try {
|
|
9041
|
-
assertReducerShape(finalReducers);
|
|
9042
|
-
} catch (e) {
|
|
9043
|
-
shapeAssertionError = e;
|
|
9044
|
-
}
|
|
9045
|
-
|
|
9046
|
-
return function combination(state, action) {
|
|
9047
|
-
if (state === void 0) {
|
|
9048
|
-
state = {};
|
|
9049
|
-
}
|
|
9050
|
-
|
|
9051
|
-
if (shapeAssertionError) {
|
|
9052
|
-
throw shapeAssertionError;
|
|
9053
|
-
}
|
|
9054
|
-
|
|
9055
|
-
var hasChanged = false;
|
|
9056
|
-
var nextState = {};
|
|
9057
|
-
|
|
9058
|
-
for (var _i = 0; _i < finalReducerKeys.length; _i++) {
|
|
9059
|
-
var _key = finalReducerKeys[_i];
|
|
9060
|
-
var reducer = finalReducers[_key];
|
|
9061
|
-
var previousStateForKey = state[_key];
|
|
9062
|
-
var nextStateForKey = reducer(previousStateForKey, action);
|
|
9063
|
-
|
|
9064
|
-
if (typeof nextStateForKey === 'undefined') {
|
|
9065
|
-
throw new Error(formatProdErrorMessage(14) );
|
|
9066
|
-
}
|
|
9067
|
-
|
|
9068
|
-
nextState[_key] = nextStateForKey;
|
|
9069
|
-
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
9070
|
-
}
|
|
9071
|
-
|
|
9072
|
-
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
9073
|
-
return hasChanged ? nextState : state;
|
|
9074
|
-
};
|
|
9075
|
-
}
|
|
9076
|
-
|
|
9077
|
-
/**
|
|
9078
|
-
* Composes single-argument functions from right to left. The rightmost
|
|
9079
|
-
* function can take multiple arguments as it provides the signature for
|
|
9080
|
-
* the resulting composite function.
|
|
9081
|
-
*
|
|
9082
|
-
* @param {...Function} funcs The functions to compose.
|
|
9083
|
-
* @returns {Function} A function obtained by composing the argument functions
|
|
9084
|
-
* from right to left. For example, compose(f, g, h) is identical to doing
|
|
9085
|
-
* (...args) => f(g(h(...args))).
|
|
9086
|
-
*/
|
|
9087
|
-
function compose() {
|
|
9088
|
-
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9089
|
-
funcs[_key] = arguments[_key];
|
|
9090
|
-
}
|
|
9091
|
-
|
|
9092
|
-
if (funcs.length === 0) {
|
|
9093
|
-
return function (arg) {
|
|
9094
|
-
return arg;
|
|
9095
|
-
};
|
|
9096
|
-
}
|
|
9097
|
-
|
|
9098
|
-
if (funcs.length === 1) {
|
|
9099
|
-
return funcs[0];
|
|
9100
|
-
}
|
|
9101
|
-
|
|
9102
|
-
return funcs.reduce(function (a, b) {
|
|
9103
|
-
return function () {
|
|
9104
|
-
return a(b.apply(void 0, arguments));
|
|
9105
|
-
};
|
|
9106
|
-
});
|
|
9107
|
-
}
|
|
9108
|
-
|
|
9109
|
-
/**
|
|
9110
|
-
* Creates a store enhancer that applies middleware to the dispatch method
|
|
9111
|
-
* of the Redux store. This is handy for a variety of tasks, such as expressing
|
|
9112
|
-
* asynchronous actions in a concise manner, or logging every action payload.
|
|
9113
|
-
*
|
|
9114
|
-
* See `redux-thunk` package as an example of the Redux middleware.
|
|
9115
|
-
*
|
|
9116
|
-
* Because middleware is potentially asynchronous, this should be the first
|
|
9117
|
-
* store enhancer in the composition chain.
|
|
9118
|
-
*
|
|
9119
|
-
* Note that each middleware will be given the `dispatch` and `getState` functions
|
|
9120
|
-
* as named arguments.
|
|
9121
|
-
*
|
|
9122
|
-
* @param {...Function} middlewares The middleware chain to be applied.
|
|
9123
|
-
* @returns {Function} A store enhancer applying the middleware.
|
|
9124
|
-
*/
|
|
9125
|
-
|
|
9126
|
-
function applyMiddleware() {
|
|
9127
|
-
for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9128
|
-
middlewares[_key] = arguments[_key];
|
|
9165
|
+
const inicialState = {};
|
|
9166
|
+
/////////////////////////////// REDUCERS ///////////////////////////////
|
|
9167
|
+
function formReducer(state = inicialState, action) {
|
|
9168
|
+
switch (action.type) {
|
|
9169
|
+
case FormActions.METADATA_LOADED:
|
|
9170
|
+
return Object.assign(Object.assign({}, state), { formMetadata: action.payload });
|
|
9171
|
+
case FormActions.CHANGE_TAB:
|
|
9172
|
+
return Object.assign(Object.assign({}, state), { currentSheet: action.payload });
|
|
9173
|
+
default:
|
|
9174
|
+
return state;
|
|
9129
9175
|
}
|
|
9130
|
-
|
|
9131
|
-
return function (createStore) {
|
|
9132
|
-
return function () {
|
|
9133
|
-
var store = createStore.apply(void 0, arguments);
|
|
9134
|
-
|
|
9135
|
-
var _dispatch = function dispatch() {
|
|
9136
|
-
throw new Error(formatProdErrorMessage(15) );
|
|
9137
|
-
};
|
|
9138
|
-
|
|
9139
|
-
var middlewareAPI = {
|
|
9140
|
-
getState: store.getState,
|
|
9141
|
-
dispatch: function dispatch() {
|
|
9142
|
-
return _dispatch.apply(void 0, arguments);
|
|
9143
|
-
}
|
|
9144
|
-
};
|
|
9145
|
-
var chain = middlewares.map(function (middleware) {
|
|
9146
|
-
return middleware(middlewareAPI);
|
|
9147
|
-
});
|
|
9148
|
-
_dispatch = compose.apply(void 0, chain)(store.dispatch);
|
|
9149
|
-
return _objectSpread2(_objectSpread2({}, store), {}, {
|
|
9150
|
-
dispatch: _dispatch
|
|
9151
|
-
});
|
|
9152
|
-
};
|
|
9153
|
-
};
|
|
9154
|
-
}
|
|
9155
|
-
|
|
9156
|
-
/** A function that accepts a potential "extra argument" value to be injected later,
|
|
9157
|
-
* and returns an instance of the thunk middleware that uses that value
|
|
9158
|
-
*/
|
|
9159
|
-
function createThunkMiddleware(extraArgument) {
|
|
9160
|
-
// Standard Redux middleware definition pattern:
|
|
9161
|
-
// See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware
|
|
9162
|
-
var middleware = function middleware(_ref) {
|
|
9163
|
-
var dispatch = _ref.dispatch,
|
|
9164
|
-
getState = _ref.getState;
|
|
9165
|
-
return function (next) {
|
|
9166
|
-
return function (action) {
|
|
9167
|
-
// The thunk middleware looks for any functions that were passed to `store.dispatch`.
|
|
9168
|
-
// If this "action" is really a function, call it and return the result.
|
|
9169
|
-
if (typeof action === 'function') {
|
|
9170
|
-
// Inject the store's `dispatch` and `getState` methods, as well as any "extra arg"
|
|
9171
|
-
return action(dispatch, getState, extraArgument);
|
|
9172
|
-
} // Otherwise, pass the action down the middleware chain as usual
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
return next(action);
|
|
9176
|
-
};
|
|
9177
|
-
};
|
|
9178
|
-
};
|
|
9179
|
-
|
|
9180
|
-
return middleware;
|
|
9181
|
-
}
|
|
9182
|
-
|
|
9183
|
-
var thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version
|
|
9184
|
-
// with whatever "extra arg" they want to inject into their thunks
|
|
9185
|
-
|
|
9186
|
-
thunk.withExtraArgument = createThunkMiddleware;
|
|
9187
|
-
|
|
9188
|
-
function changeFieldValue$1(dataUnit, recordId, fieldName, value) {
|
|
9189
|
-
return {
|
|
9190
|
-
type: "FORM/CHANGEFIELD",
|
|
9191
|
-
payload: { dataUnit, recordId, fieldName, value }
|
|
9192
|
-
};
|
|
9193
|
-
}
|
|
9194
|
-
function changeTab$1(formId, index) {
|
|
9195
|
-
return {
|
|
9196
|
-
type: "FORM/CHANGETAB",
|
|
9197
|
-
payload: { formId, index }
|
|
9198
|
-
};
|
|
9199
|
-
}
|
|
9200
|
-
function clearEdition$1(dataUnit, recordsLimit) {
|
|
9201
|
-
return {
|
|
9202
|
-
type: "FORM/CLEAREDITION",
|
|
9203
|
-
payload: {
|
|
9204
|
-
dataUnit,
|
|
9205
|
-
recordsLimit
|
|
9206
|
-
}
|
|
9207
|
-
};
|
|
9208
|
-
}
|
|
9209
|
-
function collapseExpandGroup(collapseId, collapsed) {
|
|
9210
|
-
return {
|
|
9211
|
-
type: "FORM/COLLAPSEGROUP",
|
|
9212
|
-
payload: { collapseId, collapsed }
|
|
9213
|
-
};
|
|
9214
|
-
}
|
|
9215
|
-
function previousRecord(dataUnit) {
|
|
9216
|
-
return {
|
|
9217
|
-
type: "FORM/NAVIGATE",
|
|
9218
|
-
payload: {
|
|
9219
|
-
dataUnit,
|
|
9220
|
-
limit: 0,
|
|
9221
|
-
backward: true
|
|
9222
|
-
}
|
|
9223
|
-
};
|
|
9224
|
-
}
|
|
9225
|
-
function nextRecord(dataUnit, limit) {
|
|
9226
|
-
return {
|
|
9227
|
-
type: "FORM/NAVIGATE",
|
|
9228
|
-
payload: {
|
|
9229
|
-
dataUnit,
|
|
9230
|
-
limit,
|
|
9231
|
-
backward: false
|
|
9232
|
-
}
|
|
9233
|
-
};
|
|
9234
|
-
}
|
|
9235
|
-
function insertRecord$1(dataUnit, insertionIndex) {
|
|
9236
|
-
return {
|
|
9237
|
-
type: "FORM/INSERT",
|
|
9238
|
-
payload: {
|
|
9239
|
-
dataUnit,
|
|
9240
|
-
insertionIndex
|
|
9241
|
-
}
|
|
9242
|
-
};
|
|
9243
|
-
}
|
|
9244
|
-
function formLoad() {
|
|
9245
|
-
return {
|
|
9246
|
-
type: "FORM/LOAD"
|
|
9247
|
-
};
|
|
9248
|
-
}
|
|
9249
|
-
function dataLoading$1(dataUnit) {
|
|
9250
|
-
return {
|
|
9251
|
-
type: "FORM/DATALOADING",
|
|
9252
|
-
payload: {
|
|
9253
|
-
dataUnit
|
|
9254
|
-
}
|
|
9255
|
-
};
|
|
9256
|
-
}
|
|
9257
|
-
function savingChanges$1(dataUnit) {
|
|
9258
|
-
return {
|
|
9259
|
-
type: "FORM/SAVINGCHANGES",
|
|
9260
|
-
payload: {
|
|
9261
|
-
dataUnit
|
|
9262
|
-
}
|
|
9263
|
-
};
|
|
9264
|
-
}
|
|
9265
|
-
function dataLoaded$1(dataUnit) {
|
|
9266
|
-
return {
|
|
9267
|
-
type: "FORM/DATALOADED",
|
|
9268
|
-
payload: {
|
|
9269
|
-
dataUnit
|
|
9270
|
-
}
|
|
9271
|
-
};
|
|
9272
|
-
}
|
|
9273
|
-
function changesSaved$1(dataUnit) {
|
|
9274
|
-
return {
|
|
9275
|
-
type: "FORM/CHANGESSAVED",
|
|
9276
|
-
payload: {
|
|
9277
|
-
dataUnit
|
|
9278
|
-
}
|
|
9279
|
-
};
|
|
9280
|
-
}
|
|
9281
|
-
function removingRecord$1(dataUnit) {
|
|
9282
|
-
return {
|
|
9283
|
-
type: "FORM/REMOVINGRECORD",
|
|
9284
|
-
payload: {
|
|
9285
|
-
dataUnit
|
|
9286
|
-
}
|
|
9287
|
-
};
|
|
9288
|
-
}
|
|
9289
|
-
function recordRemoved$1(dataUnit) {
|
|
9290
|
-
return {
|
|
9291
|
-
type: "FORM/RECORDREMOVED",
|
|
9292
|
-
payload: {
|
|
9293
|
-
dataUnit
|
|
9294
|
-
}
|
|
9295
|
-
};
|
|
9296
9176
|
}
|
|
9297
|
-
|
|
9177
|
+
/////////////////////////////// ACTION CREATORS ///////////////////////////////
|
|
9178
|
+
function loadMetadata(formMetadata) {
|
|
9298
9179
|
return {
|
|
9299
|
-
type:
|
|
9300
|
-
payload:
|
|
9301
|
-
tabController,
|
|
9302
|
-
tabIndex,
|
|
9303
|
-
dataUnit,
|
|
9304
|
-
recordId,
|
|
9305
|
-
recordIndex,
|
|
9306
|
-
fieldName,
|
|
9307
|
-
errorMessage
|
|
9308
|
-
}
|
|
9180
|
+
type: FormActions.METADATA_LOADED,
|
|
9181
|
+
payload: formMetadata
|
|
9309
9182
|
};
|
|
9310
9183
|
}
|
|
9311
|
-
function
|
|
9184
|
+
function changeTab(currentSheet) {
|
|
9312
9185
|
return {
|
|
9313
|
-
type:
|
|
9314
|
-
payload:
|
|
9315
|
-
buttonName,
|
|
9316
|
-
status
|
|
9317
|
-
}
|
|
9186
|
+
type: FormActions.CHANGE_TAB,
|
|
9187
|
+
payload: currentSheet
|
|
9318
9188
|
};
|
|
9319
9189
|
}
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
Object.defineProperty(exports, "__esModule", {
|
|
9324
|
-
value: true
|
|
9325
|
-
});
|
|
9326
|
-
exports.ActionCreators = exports.ActionTypes = void 0;
|
|
9327
|
-
var ActionTypes = {
|
|
9328
|
-
UNDO: '@@redux-undo/UNDO',
|
|
9329
|
-
REDO: '@@redux-undo/REDO',
|
|
9330
|
-
JUMP_TO_FUTURE: '@@redux-undo/JUMP_TO_FUTURE',
|
|
9331
|
-
JUMP_TO_PAST: '@@redux-undo/JUMP_TO_PAST',
|
|
9332
|
-
JUMP: '@@redux-undo/JUMP',
|
|
9333
|
-
CLEAR_HISTORY: '@@redux-undo/CLEAR_HISTORY'
|
|
9334
|
-
};
|
|
9335
|
-
exports.ActionTypes = ActionTypes;
|
|
9336
|
-
var ActionCreators = {
|
|
9337
|
-
undo: function undo() {
|
|
9338
|
-
return {
|
|
9339
|
-
type: ActionTypes.UNDO
|
|
9340
|
-
};
|
|
9341
|
-
},
|
|
9342
|
-
redo: function redo() {
|
|
9343
|
-
return {
|
|
9344
|
-
type: ActionTypes.REDO
|
|
9345
|
-
};
|
|
9346
|
-
},
|
|
9347
|
-
jumpToFuture: function jumpToFuture(index) {
|
|
9348
|
-
return {
|
|
9349
|
-
type: ActionTypes.JUMP_TO_FUTURE,
|
|
9350
|
-
index: index
|
|
9351
|
-
};
|
|
9352
|
-
},
|
|
9353
|
-
jumpToPast: function jumpToPast(index) {
|
|
9354
|
-
return {
|
|
9355
|
-
type: ActionTypes.JUMP_TO_PAST,
|
|
9356
|
-
index: index
|
|
9357
|
-
};
|
|
9358
|
-
},
|
|
9359
|
-
jump: function jump(index) {
|
|
9360
|
-
return {
|
|
9361
|
-
type: ActionTypes.JUMP,
|
|
9362
|
-
index: index
|
|
9363
|
-
};
|
|
9364
|
-
},
|
|
9365
|
-
clearHistory: function clearHistory() {
|
|
9366
|
-
return {
|
|
9367
|
-
type: ActionTypes.CLEAR_HISTORY
|
|
9368
|
-
};
|
|
9369
|
-
}
|
|
9370
|
-
};
|
|
9371
|
-
exports.ActionCreators = ActionCreators;
|
|
9372
|
-
});
|
|
9373
|
-
|
|
9374
|
-
var helpers = createCommonjsModule(function (module, exports) {
|
|
9375
|
-
|
|
9376
|
-
Object.defineProperty(exports, "__esModule", {
|
|
9377
|
-
value: true
|
|
9378
|
-
});
|
|
9379
|
-
exports.parseActions = parseActions;
|
|
9380
|
-
exports.isHistory = isHistory;
|
|
9381
|
-
exports.includeAction = includeAction;
|
|
9382
|
-
exports.excludeAction = excludeAction;
|
|
9383
|
-
exports.combineFilters = combineFilters;
|
|
9384
|
-
exports.groupByActionTypes = groupByActionTypes;
|
|
9385
|
-
exports.newHistory = newHistory;
|
|
9386
|
-
|
|
9387
|
-
// parseActions helper: takes a string (or array)
|
|
9388
|
-
// and makes it an array if it isn't yet
|
|
9389
|
-
function parseActions(rawActions) {
|
|
9390
|
-
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
9391
|
-
|
|
9392
|
-
if (Array.isArray(rawActions)) {
|
|
9393
|
-
return rawActions;
|
|
9394
|
-
} else if (typeof rawActions === 'string') {
|
|
9395
|
-
return [rawActions];
|
|
9396
|
-
}
|
|
9397
|
-
|
|
9398
|
-
return defaultValue;
|
|
9399
|
-
} // isHistory helper: check for a valid history object
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
function isHistory(history) {
|
|
9403
|
-
return typeof history.present !== 'undefined' && typeof history.future !== 'undefined' && typeof history.past !== 'undefined' && Array.isArray(history.future) && Array.isArray(history.past);
|
|
9404
|
-
} // includeAction helper: whitelist actions to be added to the history
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
function includeAction(rawActions) {
|
|
9408
|
-
var actions = parseActions(rawActions);
|
|
9409
|
-
return function (action) {
|
|
9410
|
-
return actions.indexOf(action.type) >= 0;
|
|
9411
|
-
};
|
|
9412
|
-
} // excludeAction helper: blacklist actions from being added to the history
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
function excludeAction(rawActions) {
|
|
9416
|
-
var actions = parseActions(rawActions);
|
|
9417
|
-
return function (action) {
|
|
9418
|
-
return actions.indexOf(action.type) < 0;
|
|
9419
|
-
};
|
|
9420
|
-
} // combineFilters helper: combine multiple filters to one
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
function combineFilters() {
|
|
9424
|
-
for (var _len = arguments.length, filters = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9425
|
-
filters[_key] = arguments[_key];
|
|
9426
|
-
}
|
|
9427
|
-
|
|
9428
|
-
return filters.reduce(function (prev, curr) {
|
|
9429
|
-
return function (action, currentState, previousHistory) {
|
|
9430
|
-
return prev(action, currentState, previousHistory) && curr(action, currentState, previousHistory);
|
|
9431
|
-
};
|
|
9432
|
-
}, function () {
|
|
9433
|
-
return true;
|
|
9434
|
-
});
|
|
9190
|
+
/////////////////////////////// SELECTORS ///////////////////////////////
|
|
9191
|
+
function selectFormMetadata(state) {
|
|
9192
|
+
return state.formMetadata;
|
|
9435
9193
|
}
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
var actions = parseActions(rawActions);
|
|
9439
|
-
return function (action) {
|
|
9440
|
-
return actions.indexOf(action.type) >= 0 ? action.type : null;
|
|
9441
|
-
};
|
|
9194
|
+
function selectCurrentSheet(state) {
|
|
9195
|
+
return state.currentSheet ? state.formMetadata.getSheet(state.currentSheet) : Array.from(state.formMetadata.getAllSheets().values())[0];
|
|
9442
9196
|
}
|
|
9197
|
+
/////////////////////////////// TYPES ///////////////////////////////
|
|
9198
|
+
var FormActions;
|
|
9199
|
+
(function (FormActions) {
|
|
9200
|
+
FormActions["METADATA_LOADED"] = "FORM/METADATA_LOADED";
|
|
9201
|
+
FormActions["CHANGE_TAB"] = "FORM/CHANGE_TAB";
|
|
9202
|
+
})(FormActions || (FormActions = {}));
|
|
9443
9203
|
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
9453
|
-
|
|
9454
|
-
};
|
|
9455
|
-
}
|
|
9456
|
-
});
|
|
9457
|
-
|
|
9458
|
-
var debug = createCommonjsModule(function (module, exports) {
|
|
9459
|
-
|
|
9460
|
-
Object.defineProperty(exports, "__esModule", {
|
|
9461
|
-
value: true
|
|
9462
|
-
});
|
|
9463
|
-
exports.set = set;
|
|
9464
|
-
exports.start = start;
|
|
9465
|
-
exports.end = end;
|
|
9466
|
-
exports.log = log;
|
|
9467
|
-
|
|
9468
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
9469
|
-
|
|
9470
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
9471
|
-
|
|
9472
|
-
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
|
9473
|
-
|
|
9474
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
|
9475
|
-
|
|
9476
|
-
var __DEBUG__;
|
|
9477
|
-
|
|
9478
|
-
var displayBuffer;
|
|
9479
|
-
var colors = {
|
|
9480
|
-
prevState: '#9E9E9E',
|
|
9481
|
-
action: '#03A9F4',
|
|
9482
|
-
nextState: '#4CAF50'
|
|
9483
|
-
};
|
|
9484
|
-
/* istanbul ignore next: debug messaging is not tested */
|
|
9485
|
-
|
|
9486
|
-
function initBuffer() {
|
|
9487
|
-
displayBuffer = {
|
|
9488
|
-
header: [],
|
|
9489
|
-
prev: [],
|
|
9490
|
-
action: [],
|
|
9491
|
-
next: [],
|
|
9492
|
-
msgs: []
|
|
9493
|
-
};
|
|
9494
|
-
}
|
|
9495
|
-
/* istanbul ignore next: debug messaging is not tested */
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
function printBuffer() {
|
|
9499
|
-
var _displayBuffer = displayBuffer,
|
|
9500
|
-
header = _displayBuffer.header,
|
|
9501
|
-
prev = _displayBuffer.prev,
|
|
9502
|
-
next = _displayBuffer.next,
|
|
9503
|
-
action = _displayBuffer.action,
|
|
9504
|
-
msgs = _displayBuffer.msgs;
|
|
9505
|
-
|
|
9506
|
-
if (console.group) {
|
|
9507
|
-
var _console, _console2, _console3, _console4, _console5;
|
|
9508
|
-
|
|
9509
|
-
(_console = console).groupCollapsed.apply(_console, _toConsumableArray(header));
|
|
9510
|
-
|
|
9511
|
-
(_console2 = console).log.apply(_console2, _toConsumableArray(prev));
|
|
9512
|
-
|
|
9513
|
-
(_console3 = console).log.apply(_console3, _toConsumableArray(action));
|
|
9514
|
-
|
|
9515
|
-
(_console4 = console).log.apply(_console4, _toConsumableArray(next));
|
|
9516
|
-
|
|
9517
|
-
(_console5 = console).log.apply(_console5, _toConsumableArray(msgs));
|
|
9518
|
-
|
|
9519
|
-
console.groupEnd();
|
|
9520
|
-
} else {
|
|
9521
|
-
var _console6, _console7, _console8, _console9, _console10;
|
|
9522
|
-
|
|
9523
|
-
(_console6 = console).log.apply(_console6, _toConsumableArray(header));
|
|
9524
|
-
|
|
9525
|
-
(_console7 = console).log.apply(_console7, _toConsumableArray(prev));
|
|
9526
|
-
|
|
9527
|
-
(_console8 = console).log.apply(_console8, _toConsumableArray(action));
|
|
9528
|
-
|
|
9529
|
-
(_console9 = console).log.apply(_console9, _toConsumableArray(next));
|
|
9530
|
-
|
|
9531
|
-
(_console10 = console).log.apply(_console10, _toConsumableArray(msgs));
|
|
9204
|
+
class DataBinder {
|
|
9205
|
+
constructor(dataUnit) {
|
|
9206
|
+
this._fields = new Map();
|
|
9207
|
+
this._dataUnit = dataUnit;
|
|
9208
|
+
this._dataUnit.subscribe(_action => {
|
|
9209
|
+
var _a;
|
|
9210
|
+
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
9211
|
+
this.updateValue(field.fieldName, field.field);
|
|
9212
|
+
});
|
|
9213
|
+
});
|
|
9532
9214
|
}
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
}
|
|
9540
|
-
/* istanbul ignore next: debug messaging is not tested */
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
function start(action, state) {
|
|
9544
|
-
initBuffer();
|
|
9545
|
-
|
|
9546
|
-
if (__DEBUG__) {
|
|
9547
|
-
if (console.group) {
|
|
9548
|
-
displayBuffer.header = ['%credux-undo', 'font-style: italic', 'action', action.type];
|
|
9549
|
-
displayBuffer.action = colorFormat('action', colors.action, action);
|
|
9550
|
-
displayBuffer.prev = colorFormat('prev history', colors.prevState, state);
|
|
9551
|
-
} else {
|
|
9552
|
-
displayBuffer.header = ['redux-undo action', action.type];
|
|
9553
|
-
displayBuffer.action = ['action', action];
|
|
9554
|
-
displayBuffer.prev = ['prev history', state];
|
|
9555
|
-
}
|
|
9215
|
+
bind(fields) {
|
|
9216
|
+
fields.forEach(fieldElement => {
|
|
9217
|
+
const fieldName = fieldElement.dataset.fieldName;
|
|
9218
|
+
this.updateBind(fieldName, fieldElement);
|
|
9219
|
+
this.updateValue(fieldName, fieldElement);
|
|
9220
|
+
});
|
|
9556
9221
|
}
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
function end(nextState) {
|
|
9562
|
-
if (__DEBUG__) {
|
|
9563
|
-
if (console.group) {
|
|
9564
|
-
displayBuffer.next = colorFormat('next history', colors.nextState, nextState);
|
|
9565
|
-
} else {
|
|
9566
|
-
displayBuffer.next = ['next history', nextState];
|
|
9567
|
-
}
|
|
9568
|
-
|
|
9569
|
-
printBuffer();
|
|
9222
|
+
updateValue(fieldName, field) {
|
|
9223
|
+
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
9570
9224
|
}
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
function log() {
|
|
9576
|
-
if (__DEBUG__) {
|
|
9577
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9578
|
-
args[_key] = arguments[_key];
|
|
9225
|
+
updateBind(fieldName, field) {
|
|
9226
|
+
const oldBind = this._fields.get(fieldName);
|
|
9227
|
+
if (oldBind) {
|
|
9228
|
+
oldBind.destroy();
|
|
9579
9229
|
}
|
|
9580
|
-
|
|
9581
|
-
displayBuffer.msgs = displayBuffer.msgs.concat([].concat(args, ['\n']));
|
|
9230
|
+
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
9582
9231
|
}
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
function set(debug) {
|
|
9588
|
-
__DEBUG__ = debug;
|
|
9589
|
-
}
|
|
9590
|
-
});
|
|
9591
|
-
|
|
9592
|
-
var reducer = createCommonjsModule(function (module, exports) {
|
|
9593
|
-
|
|
9594
|
-
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
9595
|
-
|
|
9596
|
-
Object.defineProperty(exports, "__esModule", {
|
|
9597
|
-
value: true
|
|
9598
|
-
});
|
|
9599
|
-
exports["default"] = undoable;
|
|
9600
|
-
|
|
9601
|
-
var debug$1 = _interopRequireWildcard(debug);
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
9608
|
-
|
|
9609
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
9610
|
-
|
|
9611
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
9612
|
-
|
|
9613
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9614
|
-
|
|
9615
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9616
|
-
|
|
9617
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
9618
|
-
|
|
9619
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
9620
|
-
|
|
9621
|
-
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
|
9622
|
-
|
|
9623
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
|
9624
|
-
|
|
9625
|
-
function createHistory(state, ignoreInitialState) {
|
|
9626
|
-
// ignoreInitialState essentially prevents the user from undoing to the
|
|
9627
|
-
// beginning, in the case that the undoable reducer handles initialization
|
|
9628
|
-
// in a way that can't be redone simply
|
|
9629
|
-
var history = (0, helpers.newHistory)([], state, []);
|
|
9630
|
-
|
|
9631
|
-
if (ignoreInitialState) {
|
|
9632
|
-
history._latestUnfiltered = null;
|
|
9633
|
-
}
|
|
9634
|
-
|
|
9635
|
-
return history;
|
|
9636
|
-
} // insert: insert `state` into history, which means adding the current state
|
|
9637
|
-
// into `past`, setting the new `state` as `present` and erasing
|
|
9638
|
-
// the `future`.
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
function insert(history, state, limit, group) {
|
|
9642
|
-
var lengthWithoutFuture = history.past.length + 1;
|
|
9643
|
-
debug$1.log('inserting', state);
|
|
9644
|
-
debug$1.log('new free: ', limit - lengthWithoutFuture);
|
|
9645
|
-
var past = history.past,
|
|
9646
|
-
_latestUnfiltered = history._latestUnfiltered;
|
|
9647
|
-
var isHistoryOverflow = limit && limit <= lengthWithoutFuture;
|
|
9648
|
-
var pastSliced = past.slice(isHistoryOverflow ? 1 : 0);
|
|
9649
|
-
var newPast = _latestUnfiltered != null ? [].concat(_toConsumableArray(pastSliced), [_latestUnfiltered]) : pastSliced;
|
|
9650
|
-
return (0, helpers.newHistory)(newPast, state, [], group);
|
|
9651
|
-
} // jumpToFuture: jump to requested index in future history
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
function jumpToFuture(history, index) {
|
|
9655
|
-
if (index < 0 || index >= history.future.length) return history;
|
|
9656
|
-
var past = history.past,
|
|
9657
|
-
future = history.future,
|
|
9658
|
-
_latestUnfiltered = history._latestUnfiltered;
|
|
9659
|
-
var newPast = [].concat(_toConsumableArray(past), [_latestUnfiltered], _toConsumableArray(future.slice(0, index)));
|
|
9660
|
-
var newPresent = future[index];
|
|
9661
|
-
var newFuture = future.slice(index + 1);
|
|
9662
|
-
return (0, helpers.newHistory)(newPast, newPresent, newFuture);
|
|
9663
|
-
} // jumpToPast: jump to requested index in past history
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
function jumpToPast(history, index) {
|
|
9667
|
-
if (index < 0 || index >= history.past.length) return history;
|
|
9668
|
-
var past = history.past,
|
|
9669
|
-
future = history.future,
|
|
9670
|
-
_latestUnfiltered = history._latestUnfiltered;
|
|
9671
|
-
var newPast = past.slice(0, index);
|
|
9672
|
-
var newFuture = [].concat(_toConsumableArray(past.slice(index + 1)), [_latestUnfiltered], _toConsumableArray(future));
|
|
9673
|
-
var newPresent = past[index];
|
|
9674
|
-
return (0, helpers.newHistory)(newPast, newPresent, newFuture);
|
|
9675
|
-
} // jump: jump n steps in the past or forward
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
function jump(history, n) {
|
|
9679
|
-
if (n > 0) return jumpToFuture(history, n - 1);
|
|
9680
|
-
if (n < 0) return jumpToPast(history, history.past.length + n);
|
|
9681
|
-
return history;
|
|
9682
|
-
} // helper to dynamically match in the reducer's switch-case
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
function actionTypeAmongClearHistoryType(actionType, clearHistoryType) {
|
|
9686
|
-
return clearHistoryType.indexOf(actionType) > -1 ? actionType : !actionType;
|
|
9687
|
-
} // redux-undo higher order reducer
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
function undoable(reducer) {
|
|
9691
|
-
var rawConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9692
|
-
debug$1.set(rawConfig.debug);
|
|
9693
|
-
|
|
9694
|
-
var config = _objectSpread({
|
|
9695
|
-
limit: undefined,
|
|
9696
|
-
filter: function filter() {
|
|
9697
|
-
return true;
|
|
9698
|
-
},
|
|
9699
|
-
groupBy: function groupBy() {
|
|
9700
|
-
return null;
|
|
9701
|
-
},
|
|
9702
|
-
undoType: actions.ActionTypes.UNDO,
|
|
9703
|
-
redoType: actions.ActionTypes.REDO,
|
|
9704
|
-
jumpToPastType: actions.ActionTypes.JUMP_TO_PAST,
|
|
9705
|
-
jumpToFutureType: actions.ActionTypes.JUMP_TO_FUTURE,
|
|
9706
|
-
jumpType: actions.ActionTypes.JUMP,
|
|
9707
|
-
neverSkipReducer: false,
|
|
9708
|
-
ignoreInitialState: false,
|
|
9709
|
-
syncFilter: false
|
|
9710
|
-
}, rawConfig, {
|
|
9711
|
-
initTypes: (0, helpers.parseActions)(rawConfig.initTypes, ['@@redux-undo/INIT']),
|
|
9712
|
-
clearHistoryType: (0, helpers.parseActions)(rawConfig.clearHistoryType, [actions.ActionTypes.CLEAR_HISTORY])
|
|
9713
|
-
}); // Allows the user to call the reducer with redux-undo specific actions
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
var skipReducer = config.neverSkipReducer ? function (res, action) {
|
|
9717
|
-
for (var _len = arguments.length, slices = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
9718
|
-
slices[_key - 2] = arguments[_key];
|
|
9719
|
-
}
|
|
9720
|
-
|
|
9721
|
-
return _objectSpread({}, res, {
|
|
9722
|
-
present: reducer.apply(void 0, [res.present, action].concat(slices))
|
|
9723
|
-
});
|
|
9724
|
-
} : function (res) {
|
|
9725
|
-
return res;
|
|
9726
|
-
};
|
|
9727
|
-
var initialState;
|
|
9728
|
-
return function () {
|
|
9729
|
-
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
9730
|
-
var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9731
|
-
debug$1.start(action, state);
|
|
9732
|
-
var history = state;
|
|
9733
|
-
|
|
9734
|
-
for (var _len2 = arguments.length, slices = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
9735
|
-
slices[_key2 - 2] = arguments[_key2];
|
|
9736
|
-
}
|
|
9737
|
-
|
|
9738
|
-
if (!initialState) {
|
|
9739
|
-
debug$1.log('history is uninitialized');
|
|
9740
|
-
|
|
9741
|
-
if (state === undefined) {
|
|
9742
|
-
var createHistoryAction = {
|
|
9743
|
-
type: '@@redux-undo/CREATE_HISTORY'
|
|
9744
|
-
};
|
|
9745
|
-
var start = reducer.apply(void 0, [state, createHistoryAction].concat(slices));
|
|
9746
|
-
history = createHistory(start, config.ignoreInitialState);
|
|
9747
|
-
debug$1.log('do not set initialState on probe actions');
|
|
9748
|
-
debug$1.end(history);
|
|
9749
|
-
return history;
|
|
9750
|
-
} else if ((0, helpers.isHistory)(state)) {
|
|
9751
|
-
history = initialState = config.ignoreInitialState ? state : (0, helpers.newHistory)(state.past, state.present, state.future);
|
|
9752
|
-
debug$1.log('initialHistory initialized: initialState is a history', initialState);
|
|
9753
|
-
} else {
|
|
9754
|
-
history = initialState = createHistory(state, config.ignoreInitialState);
|
|
9755
|
-
debug$1.log('initialHistory initialized: initialState is not a history', initialState);
|
|
9756
|
-
}
|
|
9757
|
-
}
|
|
9758
|
-
|
|
9759
|
-
var res;
|
|
9760
|
-
|
|
9761
|
-
switch (action.type) {
|
|
9762
|
-
case undefined:
|
|
9763
|
-
return history;
|
|
9764
|
-
|
|
9765
|
-
case config.undoType:
|
|
9766
|
-
res = jump(history, -1);
|
|
9767
|
-
debug$1.log('perform undo');
|
|
9768
|
-
debug$1.end(res);
|
|
9769
|
-
return skipReducer.apply(void 0, [res, action].concat(slices));
|
|
9770
|
-
|
|
9771
|
-
case config.redoType:
|
|
9772
|
-
res = jump(history, 1);
|
|
9773
|
-
debug$1.log('perform redo');
|
|
9774
|
-
debug$1.end(res);
|
|
9775
|
-
return skipReducer.apply(void 0, [res, action].concat(slices));
|
|
9776
|
-
|
|
9777
|
-
case config.jumpToPastType:
|
|
9778
|
-
res = jumpToPast(history, action.index);
|
|
9779
|
-
debug$1.log("perform jumpToPast to ".concat(action.index));
|
|
9780
|
-
debug$1.end(res);
|
|
9781
|
-
return skipReducer.apply(void 0, [res, action].concat(slices));
|
|
9782
|
-
|
|
9783
|
-
case config.jumpToFutureType:
|
|
9784
|
-
res = jumpToFuture(history, action.index);
|
|
9785
|
-
debug$1.log("perform jumpToFuture to ".concat(action.index));
|
|
9786
|
-
debug$1.end(res);
|
|
9787
|
-
return skipReducer.apply(void 0, [res, action].concat(slices));
|
|
9788
|
-
|
|
9789
|
-
case config.jumpType:
|
|
9790
|
-
res = jump(history, action.index);
|
|
9791
|
-
debug$1.log("perform jump to ".concat(action.index));
|
|
9792
|
-
debug$1.end(res);
|
|
9793
|
-
return skipReducer.apply(void 0, [res, action].concat(slices));
|
|
9794
|
-
|
|
9795
|
-
case actionTypeAmongClearHistoryType(action.type, config.clearHistoryType):
|
|
9796
|
-
res = createHistory(history.present, config.ignoreInitialState);
|
|
9797
|
-
debug$1.log('perform clearHistory');
|
|
9798
|
-
debug$1.end(res);
|
|
9799
|
-
return skipReducer.apply(void 0, [res, action].concat(slices));
|
|
9800
|
-
|
|
9801
|
-
default:
|
|
9802
|
-
res = reducer.apply(void 0, [history.present, action].concat(slices));
|
|
9803
|
-
|
|
9804
|
-
if (config.initTypes.some(function (actionType) {
|
|
9805
|
-
return actionType === action.type;
|
|
9806
|
-
})) {
|
|
9807
|
-
debug$1.log('reset history due to init action');
|
|
9808
|
-
debug$1.end(initialState);
|
|
9809
|
-
return initialState;
|
|
9810
|
-
}
|
|
9811
|
-
|
|
9812
|
-
if (history._latestUnfiltered === res) {
|
|
9813
|
-
// Don't handle this action. Do not call debug.end here,
|
|
9814
|
-
// because this action should not produce side effects to the console
|
|
9815
|
-
return history;
|
|
9816
|
-
}
|
|
9817
|
-
/* eslint-disable-next-line no-case-declarations */
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
var filtered = typeof config.filter === 'function' && !config.filter(action, res, history);
|
|
9821
|
-
|
|
9822
|
-
if (filtered) {
|
|
9823
|
-
// if filtering an action, merely update the present
|
|
9824
|
-
var filteredState = (0, helpers.newHistory)(history.past, res, history.future, history.group);
|
|
9825
|
-
|
|
9826
|
-
if (!config.syncFilter) {
|
|
9827
|
-
filteredState._latestUnfiltered = history._latestUnfiltered;
|
|
9828
|
-
}
|
|
9829
|
-
|
|
9830
|
-
debug$1.log('filter ignored action, not storing it in past');
|
|
9831
|
-
debug$1.end(filteredState);
|
|
9832
|
-
return filteredState;
|
|
9833
|
-
}
|
|
9834
|
-
/* eslint-disable-next-line no-case-declarations */
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
var group = config.groupBy(action, res, history);
|
|
9838
|
-
|
|
9839
|
-
if (group != null && group === history.group) {
|
|
9840
|
-
// if grouping with the previous action, only update the present
|
|
9841
|
-
var groupedState = (0, helpers.newHistory)(history.past, res, history.future, history.group);
|
|
9842
|
-
debug$1.log('groupBy grouped the action with the previous action');
|
|
9843
|
-
debug$1.end(groupedState);
|
|
9844
|
-
return groupedState;
|
|
9845
|
-
} // If the action wasn't filtered or grouped, insert normally
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
history = insert(history, res, config.limit, group);
|
|
9849
|
-
debug$1.log('inserted new state into history');
|
|
9850
|
-
debug$1.end(history);
|
|
9851
|
-
return history;
|
|
9232
|
+
setFieldValue(fieldName, newValue) {
|
|
9233
|
+
if (this._dataUnit.records.length === 0) {
|
|
9234
|
+
this._dataUnit.addRecord();
|
|
9852
9235
|
}
|
|
9853
|
-
|
|
9854
|
-
}
|
|
9855
|
-
});
|
|
9856
|
-
|
|
9857
|
-
var lib = createCommonjsModule(function (module, exports) {
|
|
9858
|
-
|
|
9859
|
-
Object.defineProperty(exports, "__esModule", {
|
|
9860
|
-
value: true
|
|
9861
|
-
});
|
|
9862
|
-
Object.defineProperty(exports, "ActionTypes", {
|
|
9863
|
-
enumerable: true,
|
|
9864
|
-
get: function get() {
|
|
9865
|
-
return actions.ActionTypes;
|
|
9866
|
-
}
|
|
9867
|
-
});
|
|
9868
|
-
Object.defineProperty(exports, "ActionCreators", {
|
|
9869
|
-
enumerable: true,
|
|
9870
|
-
get: function get() {
|
|
9871
|
-
return actions.ActionCreators;
|
|
9872
|
-
}
|
|
9873
|
-
});
|
|
9874
|
-
Object.defineProperty(exports, "parseActions", {
|
|
9875
|
-
enumerable: true,
|
|
9876
|
-
get: function get() {
|
|
9877
|
-
return helpers.parseActions;
|
|
9878
|
-
}
|
|
9879
|
-
});
|
|
9880
|
-
Object.defineProperty(exports, "isHistory", {
|
|
9881
|
-
enumerable: true,
|
|
9882
|
-
get: function get() {
|
|
9883
|
-
return helpers.isHistory;
|
|
9884
|
-
}
|
|
9885
|
-
});
|
|
9886
|
-
Object.defineProperty(exports, "includeAction", {
|
|
9887
|
-
enumerable: true,
|
|
9888
|
-
get: function get() {
|
|
9889
|
-
return helpers.includeAction;
|
|
9890
|
-
}
|
|
9891
|
-
});
|
|
9892
|
-
Object.defineProperty(exports, "excludeAction", {
|
|
9893
|
-
enumerable: true,
|
|
9894
|
-
get: function get() {
|
|
9895
|
-
return helpers.excludeAction;
|
|
9896
|
-
}
|
|
9897
|
-
});
|
|
9898
|
-
Object.defineProperty(exports, "combineFilters", {
|
|
9899
|
-
enumerable: true,
|
|
9900
|
-
get: function get() {
|
|
9901
|
-
return helpers.combineFilters;
|
|
9902
|
-
}
|
|
9903
|
-
});
|
|
9904
|
-
Object.defineProperty(exports, "groupByActionTypes", {
|
|
9905
|
-
enumerable: true,
|
|
9906
|
-
get: function get() {
|
|
9907
|
-
return helpers.groupByActionTypes;
|
|
9908
|
-
}
|
|
9909
|
-
});
|
|
9910
|
-
Object.defineProperty(exports, "newHistory", {
|
|
9911
|
-
enumerable: true,
|
|
9912
|
-
get: function get() {
|
|
9913
|
-
return helpers.newHistory;
|
|
9914
|
-
}
|
|
9915
|
-
});
|
|
9916
|
-
Object.defineProperty(exports, "default", {
|
|
9917
|
-
enumerable: true,
|
|
9918
|
-
get: function get() {
|
|
9919
|
-
return _reducer["default"];
|
|
9920
|
-
}
|
|
9921
|
-
});
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
var _reducer = _interopRequireDefault(reducer);
|
|
9928
|
-
|
|
9929
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9930
|
-
});
|
|
9931
|
-
|
|
9932
|
-
const undoable = /*@__PURE__*/getDefaultExportFromCjs(lib);
|
|
9933
|
-
|
|
9934
|
-
const inicialHistState = {
|
|
9935
|
-
currentTabIndex: {},
|
|
9936
|
-
currentRecordIndex: {},
|
|
9937
|
-
changes: {},
|
|
9938
|
-
collapsedGroups: {},
|
|
9939
|
-
newRecordIndex: {}
|
|
9940
|
-
};
|
|
9941
|
-
const inicialNonHistState = {
|
|
9942
|
-
dataLoading: {},
|
|
9943
|
-
invalidFields: {},
|
|
9944
|
-
visibleButtons: {
|
|
9945
|
-
previousVisible: true,
|
|
9946
|
-
nextVisible: true,
|
|
9947
|
-
addVisible: true,
|
|
9948
|
-
removeVisible: true,
|
|
9949
|
-
saveVisible: true,
|
|
9950
|
-
cancelVisible: true,
|
|
9951
|
-
reloadVisible: false
|
|
9952
|
-
}
|
|
9953
|
-
};
|
|
9954
|
-
function formReducer(state = inicialHistState, action) {
|
|
9955
|
-
switch (action.type) {
|
|
9956
|
-
case "FORM/COLLAPSEGROUP":
|
|
9957
|
-
return collapseGroup(state, action.payload);
|
|
9958
|
-
case "FORM/CHANGETAB":
|
|
9959
|
-
return changeTab(state, action.payload.formId, action.payload.index);
|
|
9960
|
-
case "FORM/NAVIGATE":
|
|
9961
|
-
return navigate(state, action.payload);
|
|
9962
|
-
case "FORM/INSERT":
|
|
9963
|
-
return insertRecord(state, action.payload);
|
|
9964
|
-
case "FORM/CHANGEFIELD":
|
|
9965
|
-
return changeFieldValue(state, action.payload);
|
|
9966
|
-
case "FORM/CLEAREDITION":
|
|
9967
|
-
return clearEdition(state, action.payload);
|
|
9968
|
-
case "FORM/INVALIDFIELD":
|
|
9969
|
-
return navigateToInvalid(state, action.payload);
|
|
9970
|
-
default:
|
|
9971
|
-
return state;
|
|
9236
|
+
this._dataUnit.setFieldValue(fieldName, newValue);
|
|
9972
9237
|
}
|
|
9973
9238
|
}
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
return dataLoading(state, action.payload);
|
|
9978
|
-
case "FORM/DATALOADED":
|
|
9979
|
-
return dataLoaded(state, action.payload);
|
|
9980
|
-
case "FORM/SAVINGCHANGES":
|
|
9981
|
-
return savingChanges(state, action.payload);
|
|
9982
|
-
case "FORM/CHANGESSAVED":
|
|
9983
|
-
return changesSaved(state, action.payload);
|
|
9984
|
-
case "FORM/REMOVINGRECORD":
|
|
9985
|
-
return removingRecord(state, action.payload);
|
|
9986
|
-
case "FORM/RECORDREMOVED":
|
|
9987
|
-
return recordRemoved(state, action.payload);
|
|
9988
|
-
case "FORM/INVALIDFIELD":
|
|
9989
|
-
return invalidField(state, action.payload);
|
|
9990
|
-
case "FORM/CLEAREDITION":
|
|
9991
|
-
return clearAllInvalidFields(state, action.payload);
|
|
9992
|
-
case "FORM/CHANGEFIELD":
|
|
9993
|
-
return clearInvalidField(state, action.payload);
|
|
9994
|
-
case "FORM/SHOWHIDENAVBTN":
|
|
9995
|
-
return showHideNavBtn(state, action.payload);
|
|
9996
|
-
default:
|
|
9997
|
-
return state;
|
|
9239
|
+
class Bind {
|
|
9240
|
+
destroy() {
|
|
9241
|
+
this.field.removeEventListener(this.eventName, this.eventListener);
|
|
9998
9242
|
}
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
9243
|
+
static create(fieldName, field, callback) {
|
|
9244
|
+
const b = new Bind();
|
|
9245
|
+
b.fieldName = fieldName;
|
|
9246
|
+
b.field = field;
|
|
9247
|
+
//FIXME: Verificar se o field é um EzField
|
|
9248
|
+
b.eventListener = (evt) => { callback(fieldName, evt.detail); };
|
|
9249
|
+
b.eventName = "ezChange";
|
|
9250
|
+
b.field.addEventListener(b.eventName, b.eventListener);
|
|
9251
|
+
return b;
|
|
10004
9252
|
}
|
|
10005
|
-
else {
|
|
10006
|
-
delete currentCollapsed[collapseId];
|
|
10007
|
-
}
|
|
10008
|
-
return Object.assign(Object.assign({}, state), { collapsedGroups: currentCollapsed });
|
|
10009
|
-
}
|
|
10010
|
-
function changeTab(state, formId, index) {
|
|
10011
|
-
const currentTabIndex = Object.assign({}, state.currentTabIndex);
|
|
10012
|
-
currentTabIndex[formId] = index;
|
|
10013
|
-
return Object.assign(Object.assign({}, state), { currentTabIndex });
|
|
10014
|
-
}
|
|
10015
|
-
function navigate(state, { dataUnit, limit, backward }) {
|
|
10016
|
-
const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
|
|
10017
|
-
const recIndex = currentRecordIndex[dataUnit] || 0;
|
|
10018
|
-
return gotoIndex(state, dataUnit, backward ? Math.max(limit, recIndex - 1) : Math.min(limit, recIndex + 1));
|
|
10019
|
-
}
|
|
10020
|
-
function gotoIndex(state, dataUnit, index) {
|
|
10021
|
-
const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
|
|
10022
|
-
currentRecordIndex[dataUnit] = index;
|
|
10023
|
-
return Object.assign(Object.assign({}, state), { currentRecordIndex });
|
|
10024
|
-
}
|
|
10025
|
-
function insertRecord(state, { dataUnit, insertionIndex }) {
|
|
10026
|
-
const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
|
|
10027
|
-
const newRecordIndex = Object.assign({}, state.newRecordIndex);
|
|
10028
|
-
currentRecordIndex[dataUnit] = insertionIndex;
|
|
10029
|
-
newRecordIndex[dataUnit] = (state.newRecordIndex[dataUnit] || 0) + 1;
|
|
10030
|
-
return Object.assign(Object.assign({}, state), { currentRecordIndex,
|
|
10031
|
-
newRecordIndex });
|
|
10032
|
-
}
|
|
10033
|
-
function changeFieldValue(state, { dataUnit, recordId, fieldName, value }) {
|
|
10034
|
-
const changes = Object.assign({}, state.changes);
|
|
10035
|
-
const dataUnitChanges = Object.assign({}, changes[dataUnit]);
|
|
10036
|
-
const recordChanges = Object.assign({}, dataUnitChanges[recordId]);
|
|
10037
|
-
recordChanges[fieldName] = value;
|
|
10038
|
-
dataUnitChanges[recordId] = recordChanges;
|
|
10039
|
-
changes[dataUnit] = dataUnitChanges;
|
|
10040
|
-
const invalidFields = Object.assign({}, state.invalidFields);
|
|
10041
|
-
const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
|
|
10042
|
-
const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
|
|
10043
|
-
delete errorMessages[fieldName];
|
|
10044
|
-
dataUnitInvalidRecords[recordId] = errorMessages;
|
|
10045
|
-
invalidFields[dataUnit] = dataUnitInvalidRecords;
|
|
10046
|
-
return Object.assign(Object.assign({}, state), { changes,
|
|
10047
|
-
invalidFields, invalidFieldSelected: undefined });
|
|
10048
|
-
}
|
|
10049
|
-
function clearEdition(state, { dataUnit, recordsLimit }) {
|
|
10050
|
-
const changes = Object.assign({}, state.changes);
|
|
10051
|
-
const newRecordIndex = Object.assign({}, state.newRecordIndex);
|
|
10052
|
-
const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
|
|
10053
|
-
delete changes[dataUnit];
|
|
10054
|
-
delete newRecordIndex[dataUnit];
|
|
10055
|
-
const recIndex = currentRecordIndex[dataUnit] || 0;
|
|
10056
|
-
currentRecordIndex[dataUnit] = Math.min(recordsLimit, recIndex);
|
|
10057
|
-
return Object.assign(Object.assign({}, state), { changes,
|
|
10058
|
-
newRecordIndex,
|
|
10059
|
-
currentRecordIndex });
|
|
10060
|
-
}
|
|
10061
|
-
function navigateToInvalid(state, payload) {
|
|
10062
|
-
let newState = Object.assign({}, state);
|
|
10063
|
-
if (newState.invalidFieldSelected === undefined) {
|
|
10064
|
-
newState.invalidFieldSelected = true;
|
|
10065
|
-
newState = gotoIndex(newState, payload.dataUnit, payload.recordIndex);
|
|
10066
|
-
newState = changeTab(newState, payload.tabController, payload.tabIndex);
|
|
10067
|
-
}
|
|
10068
|
-
return newState;
|
|
10069
|
-
}
|
|
10070
|
-
function dataLoading(state, { dataUnit }) {
|
|
10071
|
-
const dataLoading = Object.assign({}, state.dataLoading);
|
|
10072
|
-
dataLoading[dataUnit] = true;
|
|
10073
|
-
return Object.assign(Object.assign({}, state), { dataLoading });
|
|
10074
|
-
}
|
|
10075
|
-
function dataLoaded(state, { dataUnit }) {
|
|
10076
|
-
const dataLoading = Object.assign({}, state.dataLoading);
|
|
10077
|
-
delete dataLoading[dataUnit];
|
|
10078
|
-
return Object.assign(Object.assign({}, state), { dataLoading });
|
|
10079
|
-
}
|
|
10080
|
-
function savingChanges(state, { dataUnit }) {
|
|
10081
|
-
const dataLoading = Object.assign({}, state.dataLoading);
|
|
10082
|
-
dataLoading[dataUnit] = true;
|
|
10083
|
-
return Object.assign(Object.assign({}, state), { dataLoading });
|
|
10084
|
-
}
|
|
10085
|
-
function changesSaved(state, { dataUnit }) {
|
|
10086
|
-
const dataLoading = Object.assign({}, state.dataLoading);
|
|
10087
|
-
delete dataLoading[dataUnit];
|
|
10088
|
-
return Object.assign(Object.assign({}, state), { dataLoading });
|
|
10089
|
-
}
|
|
10090
|
-
function removingRecord(state, { dataUnit }) {
|
|
10091
|
-
const dataLoading = Object.assign({}, state.dataLoading);
|
|
10092
|
-
dataLoading[dataUnit] = true;
|
|
10093
|
-
return Object.assign(Object.assign({}, state), { dataLoading });
|
|
10094
|
-
}
|
|
10095
|
-
function recordRemoved(state, { dataUnit }) {
|
|
10096
|
-
const dataLoading = Object.assign({}, state.dataLoading);
|
|
10097
|
-
delete dataLoading[dataUnit];
|
|
10098
|
-
return Object.assign(Object.assign({}, state), { dataLoading });
|
|
10099
|
-
}
|
|
10100
|
-
function invalidField(state, { dataUnit, recordId, fieldName, errorMessage }) {
|
|
10101
|
-
const invalidFields = Object.assign({}, state.invalidFields);
|
|
10102
|
-
const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
|
|
10103
|
-
const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
|
|
10104
|
-
errorMessages[fieldName] = errorMessage;
|
|
10105
|
-
dataUnitInvalidRecords[recordId] = errorMessages;
|
|
10106
|
-
invalidFields[dataUnit] = dataUnitInvalidRecords;
|
|
10107
|
-
return Object.assign(Object.assign({}, state), { invalidFields });
|
|
10108
|
-
}
|
|
10109
|
-
function clearAllInvalidFields(state, { dataUnit }) {
|
|
10110
|
-
const invalidFields = Object.assign({}, state.invalidFields);
|
|
10111
|
-
delete invalidFields[dataUnit];
|
|
10112
|
-
return Object.assign(Object.assign({}, state), { invalidFields });
|
|
10113
|
-
}
|
|
10114
|
-
function clearInvalidField(state, { dataUnit, recordId, fieldName }) {
|
|
10115
|
-
const invalidFields = Object.assign({}, state.invalidFields);
|
|
10116
|
-
const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
|
|
10117
|
-
const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
|
|
10118
|
-
delete errorMessages[fieldName];
|
|
10119
|
-
dataUnitInvalidRecords[recordId] = errorMessages;
|
|
10120
|
-
invalidFields[dataUnit] = dataUnitInvalidRecords;
|
|
10121
|
-
return Object.assign(Object.assign({}, state), { invalidFields });
|
|
10122
|
-
}
|
|
10123
|
-
function showHideNavBtn(state, { buttonName, status }) {
|
|
10124
|
-
const visibleButtons = Object.assign({}, state.visibleButtons);
|
|
10125
|
-
visibleButtons[buttonName] = status;
|
|
10126
|
-
return Object.assign(Object.assign({}, state), { visibleButtons });
|
|
10127
9253
|
}
|
|
10128
9254
|
|
|
10129
9255
|
class ApplicationUtils {
|
|
@@ -10158,775 +9284,104 @@ class ApplicationUtils {
|
|
|
10158
9284
|
}
|
|
10159
9285
|
}
|
|
10160
9286
|
|
|
10161
|
-
|
|
10162
|
-
ApplicationUtils.confirm("Exclusão de registro", "Tem certeza que deseja Remover?", null, true).then(ok => {
|
|
10163
|
-
if (ok) {
|
|
10164
|
-
dataUnit.remove();
|
|
10165
|
-
}
|
|
10166
|
-
});
|
|
10167
|
-
}
|
|
10168
|
-
function saveHandler(dataUnit) {
|
|
10169
|
-
setTimeout(() => {
|
|
10170
|
-
//Esse debouncing é necessário quando o usuário clica no botão de salvar
|
|
10171
|
-
//sem ter tirado o foco o último campo alterado.
|
|
10172
|
-
dataUnit.save();
|
|
10173
|
-
}, 50);
|
|
10174
|
-
}
|
|
10175
|
-
const NavigationBar = ({ dataUnit: du, buttonProps, enabled }) => {
|
|
10176
|
-
if (buttonProps.previousVisible
|
|
10177
|
-
|| buttonProps.nextVisible
|
|
10178
|
-
|| buttonProps.addVisible
|
|
10179
|
-
|| buttonProps.removeVisible
|
|
10180
|
-
|| buttonProps.saveVisible
|
|
10181
|
-
|| buttonProps.cancelVisible
|
|
10182
|
-
|| buttonProps.reloadVisible) {
|
|
10183
|
-
return h("div", { class: "col col--sd-12 align--right" },
|
|
10184
|
-
buttonProps.previousVisible ? h("ez-button", { key: du.name + "_previous", title: "Registro anterior", mode: "icon", enabled: enabled && du.hasPrevious(), onClick: () => du.previous(), image: "/themes/default/images/icons/actions-sprite.svg#previous-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
10185
|
-
buttonProps.nextVisible ? h("ez-button", { key: du.name + "_next", title: "Pr\u00F3ximo registro", mode: "icon", enabled: enabled && du.hasNext(), onClick: () => du.next(), image: "/themes/default/images/icons/actions-sprite.svg#next-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
10186
|
-
buttonProps.removeVisible ? h("ez-button", { key: du.name + "_remove", label: "Remover", enabled: enabled && du.hasCurrentRecord(), onClick: () => removeHandler(du), image: "/themes/default/images/icons/actions-sprite.svg#minus-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
10187
|
-
buttonProps.addVisible ? h("ez-button", { key: du.name + "_add", label: "Adicionar", enabled: enabled, onClick: () => du.insert(), class: "button--secondary margin-right--medium" }) : null,
|
|
10188
|
-
buttonProps.reloadVisible ? h("ez-button", { key: du.name + "_reload", title: "Recarregar", enabled: enabled, mode: "icon", onClick: () => du.load(), image: "/themes/default/images/icons/actions-sprite.svg#rotate", class: "button--secondary margin-right--medium" }) : null,
|
|
10189
|
-
buttonProps.cancelVisible ? h("ez-button", { key: du.name + "_cancel", label: "Cancelar", enabled: enabled && du.hasChanges(), onClick: () => du.cancel(), class: "button--secondary margin-right--medium" }) : null,
|
|
10190
|
-
buttonProps.saveVisible ? h("ez-button", { key: du.name + "_save", label: "Salvar", enabled: enabled && du.hasChanges(), onClick: () => saveHandler(du), class: "button--primary margin-right--medium" }) : null);
|
|
10191
|
-
}
|
|
10192
|
-
else {
|
|
10193
|
-
return null;
|
|
10194
|
-
}
|
|
10195
|
-
};
|
|
10196
|
-
|
|
10197
|
-
//histórico
|
|
10198
|
-
const selectCurrentTab = (state, formName) => {
|
|
10199
|
-
const data = state.hist.present.currentTabIndex;
|
|
10200
|
-
return data[formName] || 0;
|
|
10201
|
-
};
|
|
10202
|
-
const selectIsCollapsedFieldSet = (state, fieldSetName) => {
|
|
10203
|
-
const data = state.hist.present.collapsedGroups;
|
|
10204
|
-
return data[fieldSetName];
|
|
10205
|
-
};
|
|
10206
|
-
const selectRecordChanges = (state, dataUnit, recordId) => {
|
|
10207
|
-
const data = selectDataUnitChanges(state, dataUnit);
|
|
10208
|
-
return data ? data[recordId] : undefined;
|
|
10209
|
-
};
|
|
10210
|
-
const selectDataUnitChanges = (state, dataUnit) => {
|
|
10211
|
-
const data = state.hist.present.changes;
|
|
10212
|
-
return data[dataUnit];
|
|
10213
|
-
};
|
|
10214
|
-
const selectCurrentRecordIndex = (state, dataUnit) => {
|
|
10215
|
-
const data = state.hist.present.currentRecordIndex;
|
|
10216
|
-
return data[dataUnit] || 0;
|
|
10217
|
-
};
|
|
10218
|
-
const selectNewRecordIndex = (state, dataUnit) => {
|
|
10219
|
-
const data = state.hist.present.newRecordIndex;
|
|
10220
|
-
return data[dataUnit] || 0;
|
|
10221
|
-
};
|
|
10222
|
-
//não histórico
|
|
10223
|
-
const selectLoadingData = (state, dataUnit) => {
|
|
10224
|
-
const data = state.nonhist.dataLoading;
|
|
10225
|
-
return data[dataUnit];
|
|
10226
|
-
};
|
|
10227
|
-
const selectErrorMessage = (state, dataUnit, recordId, fieldName) => {
|
|
10228
|
-
const data = state.nonhist.invalidFields;
|
|
10229
|
-
const dataUnitMessages = data[dataUnit] || {};
|
|
10230
|
-
const recordMessages = dataUnitMessages[recordId] || {};
|
|
10231
|
-
return recordMessages[fieldName] || "";
|
|
10232
|
-
};
|
|
10233
|
-
const selectVisibleButtons = state => state.nonhist.visibleButtons;
|
|
9287
|
+
const ezFormCss = "ez-form{display:flex;flex-direction:column;width:100%}";
|
|
10234
9288
|
|
|
10235
|
-
class
|
|
10236
|
-
constructor(
|
|
10237
|
-
|
|
10238
|
-
this.
|
|
10239
|
-
this.cardinality = cardinality;
|
|
10240
|
-
this._children = [];
|
|
10241
|
-
this._fields = new Map();
|
|
10242
|
-
this._requiredFields = [];
|
|
10243
|
-
if (parentDU != null) {
|
|
10244
|
-
parentDU._children.push(this);
|
|
10245
|
-
this.parentDU = parentDU;
|
|
10246
|
-
this.parentDUName = parentDU.name;
|
|
10247
|
-
}
|
|
10248
|
-
}
|
|
10249
|
-
set store(store) {
|
|
10250
|
-
this._store = store;
|
|
10251
|
-
}
|
|
10252
|
-
set fields(value) {
|
|
10253
|
-
if (value) {
|
|
10254
|
-
value.forEach(f => this.addFieldMetadata(f));
|
|
10255
|
-
}
|
|
10256
|
-
}
|
|
10257
|
-
addFieldMetadata(field) {
|
|
10258
|
-
this._fields.set(field.name, field);
|
|
10259
|
-
if (field.required) {
|
|
10260
|
-
this._requiredFields.push(field);
|
|
10261
|
-
}
|
|
10262
|
-
}
|
|
10263
|
-
getFieldMetadata(name) {
|
|
10264
|
-
if (this._fields) {
|
|
10265
|
-
return this._fields.get(name);
|
|
10266
|
-
}
|
|
10267
|
-
return undefined;
|
|
10268
|
-
}
|
|
10269
|
-
get requiredFields() {
|
|
10270
|
-
return this._requiredFields;
|
|
10271
|
-
}
|
|
10272
|
-
isLoading() {
|
|
10273
|
-
return selectLoadingData(this._store.getState(), this.name);
|
|
10274
|
-
}
|
|
10275
|
-
hasChanges() {
|
|
10276
|
-
const state = this._store.getState();
|
|
10277
|
-
return selectDataUnitChanges(state, this.name) !== undefined || selectNewRecordIndex(state, this.name) > 0;
|
|
10278
|
-
}
|
|
10279
|
-
hasNext() {
|
|
10280
|
-
return selectCurrentRecordIndex(this._store.getState(), this.name) < (this.records.length - 1);
|
|
10281
|
-
}
|
|
10282
|
-
hasPrevious() {
|
|
10283
|
-
return selectCurrentRecordIndex(this._store.getState(), this.name) > 0;
|
|
10284
|
-
}
|
|
10285
|
-
hasCurrentRecord() {
|
|
10286
|
-
return this.getCurrentRecord() != undefined;
|
|
10287
|
-
}
|
|
10288
|
-
previous() {
|
|
10289
|
-
this._store.dispatch(previousRecord(this.name));
|
|
10290
|
-
}
|
|
10291
|
-
next() {
|
|
10292
|
-
this._store.dispatch(nextRecord(this.name, this.records.length));
|
|
10293
|
-
}
|
|
10294
|
-
getValue(fieldName) {
|
|
10295
|
-
const currentRecord = this.getCurrentRecord();
|
|
10296
|
-
if (!currentRecord) {
|
|
10297
|
-
return undefined;
|
|
10298
|
-
}
|
|
10299
|
-
const changes = this.getRecordChanges(currentRecord);
|
|
10300
|
-
return changes && changes[fieldName] !== undefined ? changes[fieldName] : currentRecord[fieldName] || null;
|
|
10301
|
-
}
|
|
10302
|
-
getErrorMessage(fieldName) {
|
|
10303
|
-
const currentRecord = this.getCurrentRecord();
|
|
10304
|
-
return selectErrorMessage(this._store.getState(), this.name, currentRecord === null || currentRecord === void 0 ? void 0 : currentRecord.record__id, fieldName);
|
|
9289
|
+
let EzForm$1 = class extends HTMLElement$1 {
|
|
9290
|
+
constructor() {
|
|
9291
|
+
super();
|
|
9292
|
+
this.__registerHost();
|
|
10305
9293
|
}
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
this.insert();
|
|
10309
|
-
}
|
|
10310
|
-
if (this._changeDeboucing) {
|
|
10311
|
-
window.clearTimeout(this._changeDeboucing);
|
|
10312
|
-
}
|
|
10313
|
-
this._changeDeboucing = window.setTimeout(() => {
|
|
10314
|
-
const currentRecord = this.getCurrentRecord();
|
|
10315
|
-
this._store.dispatch(changeFieldValue$1(this.name, currentRecord.record__id, fieldName, newValue));
|
|
10316
|
-
}, 100);
|
|
9294
|
+
submit() {
|
|
9295
|
+
return Promise.resolve();
|
|
10317
9296
|
}
|
|
10318
9297
|
cancel() {
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
if (duChanges) {
|
|
10334
|
-
recordChanges = duChanges[r.record__id];
|
|
10335
|
-
}
|
|
10336
|
-
let subChanges = [];
|
|
10337
|
-
this._children.forEach(duChild => {
|
|
10338
|
-
subChanges = subChanges.concat(duChild.getSubChanges(r.record__id));
|
|
10339
|
-
});
|
|
10340
|
-
if (recordChanges || subChanges.length > 0) {
|
|
10341
|
-
const change = {
|
|
10342
|
-
"__data__unit": this.name,
|
|
10343
|
-
"__record__id": r.record__id,
|
|
10344
|
-
"__sub__changes": subChanges
|
|
10345
|
-
};
|
|
10346
|
-
if (recordChanges) {
|
|
10347
|
-
Object.keys(recordChanges).forEach(fieldName => { });
|
|
10348
|
-
}
|
|
10349
|
-
return change;
|
|
10350
|
-
}
|
|
10351
|
-
return undefined;
|
|
10352
|
-
}
|
|
10353
|
-
getSubChanges(id) {
|
|
10354
|
-
const result = [];
|
|
10355
|
-
if (this._records) {
|
|
10356
|
-
this._records.filter(r => r.parent__record__id === id).forEach(r => {
|
|
10357
|
-
const c = this.buildChange(r);
|
|
10358
|
-
if (c) {
|
|
10359
|
-
result.push(c);
|
|
10360
|
-
}
|
|
10361
|
-
});
|
|
10362
|
-
}
|
|
10363
|
-
return result;
|
|
10364
|
-
}
|
|
10365
|
-
getChangesToSave() {
|
|
10366
|
-
let result = [];
|
|
10367
|
-
if (this._records) {
|
|
10368
|
-
this._records.forEach(r => {
|
|
10369
|
-
const change = this.buildChange(r);
|
|
10370
|
-
if (change) {
|
|
10371
|
-
result.push(change);
|
|
10372
|
-
}
|
|
10373
|
-
});
|
|
10374
|
-
}
|
|
10375
|
-
return result;
|
|
10376
|
-
}
|
|
10377
|
-
save() {
|
|
10378
|
-
if (!this.validateRecords("SAVE")) {
|
|
10379
|
-
return;
|
|
10380
|
-
}
|
|
10381
|
-
this._store.dispatch(savingChanges$1(this.name));
|
|
10382
|
-
let saveResult;
|
|
10383
|
-
if (this.saveExecutor) {
|
|
10384
|
-
saveResult = this.saveExecutor(this.getChangesToSave());
|
|
10385
|
-
}
|
|
10386
|
-
if (saveResult instanceof Promise) {
|
|
10387
|
-
saveResult
|
|
10388
|
-
.then(r => this.processSaveResult(r))
|
|
10389
|
-
.catch(e => {
|
|
10390
|
-
this._store.dispatch(dataLoaded$1(this.name));
|
|
10391
|
-
ApplicationUtils.error("Falha ao tentar salvar", e);
|
|
10392
|
-
});
|
|
10393
|
-
}
|
|
10394
|
-
else {
|
|
10395
|
-
this.processSaveResult(saveResult);
|
|
10396
|
-
}
|
|
10397
|
-
}
|
|
10398
|
-
load() {
|
|
10399
|
-
this._store.dispatch(dataLoading$1(this.name));
|
|
10400
|
-
let result;
|
|
10401
|
-
if (this.loadExecutor) {
|
|
10402
|
-
result = this.loadExecutor({ dataUnit: this.name });
|
|
10403
|
-
}
|
|
10404
|
-
if (result instanceof Promise) {
|
|
10405
|
-
result.then(r => this.processLoadResult(r));
|
|
10406
|
-
}
|
|
10407
|
-
else {
|
|
10408
|
-
this.processLoadResult(result);
|
|
10409
|
-
}
|
|
10410
|
-
}
|
|
10411
|
-
remove() {
|
|
10412
|
-
const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
|
|
10413
|
-
this._store.dispatch(removingRecord$1(this.name));
|
|
10414
|
-
let removeResult;
|
|
10415
|
-
if (this.removeExecutor) {
|
|
10416
|
-
const record = this.getCurrentRecord();
|
|
10417
|
-
removeResult = this.removeExecutor({ dataUnit: this.name, recordId: record.record__id, record });
|
|
10418
|
-
}
|
|
10419
|
-
else {
|
|
10420
|
-
removeResult = true;
|
|
10421
|
-
}
|
|
10422
|
-
if (removeResult) {
|
|
10423
|
-
if (removeResult instanceof Promise) {
|
|
10424
|
-
removeResult.then(r => this.processRemoveResult(r, currentIndex));
|
|
10425
|
-
}
|
|
10426
|
-
else {
|
|
10427
|
-
this.processRemoveResult(removeResult, currentIndex);
|
|
10428
|
-
}
|
|
10429
|
-
}
|
|
10430
|
-
}
|
|
10431
|
-
processSaveResult(result) {
|
|
10432
|
-
if (result) {
|
|
10433
|
-
if (result instanceof Array) {
|
|
10434
|
-
result.forEach(item => this.processSaveResult(item));
|
|
10435
|
-
}
|
|
10436
|
-
else {
|
|
10437
|
-
if (result.__data__unit === this.name) {
|
|
10438
|
-
if (this.cardinality === "1") {
|
|
10439
|
-
this.records = [this.buildRecordFromSaveResult(this.records[0], result)];
|
|
10440
|
-
}
|
|
9298
|
+
return Promise.resolve();
|
|
9299
|
+
}
|
|
9300
|
+
validate() {
|
|
9301
|
+
return new Promise((accept, reject) => {
|
|
9302
|
+
const metadata = selectFormMetadata(this._store.getState());
|
|
9303
|
+
const requiredFields = this._staticFields
|
|
9304
|
+
.filter(f => f.dataset.required)
|
|
9305
|
+
.map(f => f.dataset.fieldName)
|
|
9306
|
+
.concat(metadata.getRequiredFields());
|
|
9307
|
+
const records = this.dataUnit.records;
|
|
9308
|
+
for (let i = 0; i < records.length; i++) {
|
|
9309
|
+
if (!this.validateRequired(requiredFields, records[i])) {
|
|
9310
|
+
reject();
|
|
9311
|
+
break;
|
|
10441
9312
|
}
|
|
10442
9313
|
}
|
|
10443
|
-
|
|
10444
|
-
//FIXME: Isso está errado! tem que limpar todas as edições
|
|
10445
|
-
this._store.dispatch(clearEdition$1(this.name, this.records.length - 1));
|
|
10446
|
-
this._store.dispatch(changesSaved$1(this.name));
|
|
10447
|
-
}
|
|
10448
|
-
buildRecordFromSaveResult(baseRecord, saveResult) {
|
|
10449
|
-
const newRecord = baseRecord ? Object.assign({}, baseRecord) : { record__id: "" };
|
|
10450
|
-
Object.keys(saveResult).forEach(attrib => {
|
|
10451
|
-
if (!attrib.startsWith("__")) {
|
|
10452
|
-
newRecord[attrib] = saveResult[attrib];
|
|
10453
|
-
}
|
|
9314
|
+
accept();
|
|
10454
9315
|
});
|
|
10455
|
-
return newRecord;
|
|
10456
9316
|
}
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
this._store.dispatch(clearEdition$1(this.name, this.records.length - 1));
|
|
10466
|
-
}
|
|
10467
|
-
this._store.dispatch(recordRemoved$1(this.name));
|
|
10468
|
-
}
|
|
10469
|
-
set records(records) {
|
|
10470
|
-
this._records = records;
|
|
10471
|
-
if (this.parentDU) {
|
|
10472
|
-
this._records.forEach(r => this.bindToParent(r));
|
|
10473
|
-
}
|
|
10474
|
-
}
|
|
10475
|
-
bindToParent(r) {
|
|
10476
|
-
if (this.parentDU) {
|
|
10477
|
-
const parentRecord = this.parentDU.getCurrentRecord();
|
|
10478
|
-
if (parentRecord) {
|
|
10479
|
-
r.parent__record__id = parentRecord.record__id;
|
|
9317
|
+
validateRequired(requiredFields, record) {
|
|
9318
|
+
const invalidFields = [];
|
|
9319
|
+
requiredFields.forEach(field => {
|
|
9320
|
+
const value = record[field];
|
|
9321
|
+
const fieldElem = this._element.querySelector(`[data-field-name=${field}]`);
|
|
9322
|
+
if (value === null || value === undefined || value === "") {
|
|
9323
|
+
invalidFields.push(field);
|
|
9324
|
+
fieldElem["errorMessage"] = "Essa informação é obrigatória";
|
|
10480
9325
|
}
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
get records() {
|
|
10484
|
-
if (!this._records) {
|
|
10485
|
-
this._records = [];
|
|
10486
|
-
}
|
|
10487
|
-
return this._records;
|
|
10488
|
-
}
|
|
10489
|
-
getCurrentRecord() {
|
|
10490
|
-
const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
|
|
10491
|
-
return this.records[currentIndex];
|
|
10492
|
-
}
|
|
10493
|
-
getRecordChanges(currentRecord = undefined) {
|
|
10494
|
-
if (currentRecord === undefined) {
|
|
10495
|
-
currentRecord = this.getCurrentRecord();
|
|
10496
|
-
}
|
|
10497
|
-
return currentRecord ? selectRecordChanges(this._store.getState(), this.name, currentRecord.record__id) : undefined;
|
|
10498
|
-
}
|
|
10499
|
-
validateRecords(triggedBy = "UNKNOWN") {
|
|
10500
|
-
if (!this.recordsValidator) {
|
|
10501
|
-
return true;
|
|
10502
|
-
}
|
|
10503
|
-
const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
|
|
10504
|
-
const recordsToValidate = [];
|
|
10505
|
-
this.records.forEach((record, i) => {
|
|
10506
|
-
const changes = duChanges ? duChanges[record.record__id] : undefined;
|
|
10507
|
-
if (changes) {
|
|
10508
|
-
recordsToValidate.push(Object.assign(Object.assign(Object.assign({}, record), changes), { record__index: i, record__changedfields: Object.keys(changes) }));
|
|
9326
|
+
else {
|
|
9327
|
+
fieldElem["errorMessage"] = "";
|
|
10509
9328
|
}
|
|
10510
9329
|
});
|
|
10511
|
-
const
|
|
10512
|
-
if (
|
|
10513
|
-
ApplicationUtils.info(
|
|
10514
|
-
}
|
|
10515
|
-
return result.isValid;
|
|
10516
|
-
}
|
|
10517
|
-
}
|
|
10518
|
-
var DependencyType;
|
|
10519
|
-
(function (DependencyType) {
|
|
10520
|
-
DependencyType["SEARCHING"] = "SEARCHING";
|
|
10521
|
-
DependencyType["REQUIREMENT"] = "REQUIREMENT";
|
|
10522
|
-
DependencyType["VISIBILITY"] = "REQUIREMENT";
|
|
10523
|
-
})(DependencyType || (DependencyType = {}));
|
|
10524
|
-
|
|
10525
|
-
function scrollToView(forceScroll, elem) {
|
|
10526
|
-
if (forceScroll) {
|
|
10527
|
-
window.requestAnimationFrame(() => elem.scrollIntoView());
|
|
10528
|
-
}
|
|
10529
|
-
}
|
|
10530
|
-
const Field = ({ dataUnit, field, forceScroll, enabled }) => {
|
|
10531
|
-
const { name, form } = field;
|
|
10532
|
-
const { label, userInterface, properties, required, dependencies, readOnly } = dataUnit.getFieldMetadata(name);
|
|
10533
|
-
const value = dataUnit.getValue(name) || null;
|
|
10534
|
-
const loadingData = dataUnit.isLoading();
|
|
10535
|
-
const formattedLabel = required ? `* ${label} (obrigatório)` : label;
|
|
10536
|
-
const errorMessage = dataUnit.getErrorMessage(name);
|
|
10537
|
-
const key = `${dataUnit.name}-${name}`;
|
|
10538
|
-
const isEnabled = enabled && !readOnly;
|
|
10539
|
-
const changeFieldHandler = (newValue) => {
|
|
10540
|
-
dataUnit.changeValue(name, newValue);
|
|
10541
|
-
};
|
|
10542
|
-
switch (userInterface) {
|
|
10543
|
-
case "LONGTEXT":
|
|
10544
|
-
return h("div", { class: "col col--sd-12 padding--small" }, loadingData ? h("place-holder", null) :
|
|
10545
|
-
h("ez-text-area", { value: value || "", label: formattedLabel, onEzChange: evt => changeFieldHandler(evt.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key, enabled: isEnabled }));
|
|
10546
|
-
case "CHECKBOX":
|
|
10547
|
-
case "SWITCH":
|
|
10548
|
-
return h("div", { class: "col col--sd-12 col--tb-3 padding--small align--middle padding-bottom--large" }, loadingData ? h("place-holder", null) :
|
|
10549
|
-
h("ez-check", { value: value, label: label, enabled: isEnabled, mode: userInterface === "CHECKBOX" ? "regular" : "switch", onEzChange: (event) => changeFieldHandler(event.target["value"]), ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
10550
|
-
case "OPTIONSELECTOR":
|
|
10551
|
-
const optsObj = properties ? JSON.parse(getProp(properties, "options")) : {};
|
|
10552
|
-
const normalized = Object.keys(optsObj).map(key => { return { value: key, label: optsObj[key] }; });
|
|
10553
|
-
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
10554
|
-
h("ez-combo-box", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key, options: normalized }));
|
|
10555
|
-
case "SEARCH":
|
|
10556
|
-
const context = {
|
|
10557
|
-
__MAIN_FORM: form,
|
|
10558
|
-
__DATA_UNIT: dataUnit.name,
|
|
10559
|
-
__FIELD_NAME: name
|
|
10560
|
-
};
|
|
10561
|
-
properties.forEach(({ name, value }) => {
|
|
10562
|
-
context[name] = value;
|
|
10563
|
-
});
|
|
10564
|
-
let criteriaList = [];
|
|
10565
|
-
dependencies === null || dependencies === void 0 ? void 0 : dependencies.forEach(dependency => {
|
|
10566
|
-
var _a;
|
|
10567
|
-
if (dependency.type === DependencyType.SEARCHING) {
|
|
10568
|
-
if (((_a = dependency.masterFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
10569
|
-
let criteria = {
|
|
10570
|
-
expression: dependency.expression,
|
|
10571
|
-
paramNames: [...dependency.masterFields],
|
|
10572
|
-
paramResolver: name => dataUnit.getValue(name)
|
|
10573
|
-
};
|
|
10574
|
-
criteriaList.push(criteria);
|
|
10575
|
-
}
|
|
10576
|
-
}
|
|
10577
|
-
});
|
|
10578
|
-
if (criteriaList.length > 0) {
|
|
10579
|
-
context["CRITERIA"] = criteriaList;
|
|
10580
|
-
}
|
|
10581
|
-
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
10582
|
-
h("ez-search", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, optionLoader: (argument) => {
|
|
10583
|
-
if (form) {
|
|
10584
|
-
return form.loadSearch(argument, context);
|
|
10585
|
-
}
|
|
10586
|
-
}, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
10587
|
-
case "FILE":
|
|
10588
|
-
const target = getProp(properties, "URL");
|
|
10589
|
-
const strHeaders = getProp(properties, "HEADERS");
|
|
10590
|
-
const headers = strHeaders ? JSON.parse(strHeaders) : {};
|
|
10591
|
-
const maxfiles = Number(getProp(properties, "maxfiles") || 0);
|
|
10592
|
-
return (h("div", { class: "col col--sd-12 padding--small" }, loadingData ? h("place-holder", null) :
|
|
10593
|
-
h("ez-upload", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.detail), urlUpload: target, requestHeaders: headers, maxFiles: maxfiles })));
|
|
10594
|
-
case "DATE":
|
|
10595
|
-
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
10596
|
-
h("ez-date-input", { value: !value ? null : DateUtils.clearTime(value), label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
10597
|
-
case "DECIMALNUMBER":
|
|
10598
|
-
case "INTEGERNUMBER":
|
|
10599
|
-
let precision = 0;
|
|
10600
|
-
let prettyPrecision = 0;
|
|
10601
|
-
if (userInterface === "DECIMALNUMBER") {
|
|
10602
|
-
precision = Number(getProp(properties, "precision") || 2);
|
|
10603
|
-
prettyPrecision = Number(getProp(properties, "prettyprecision") || precision);
|
|
10604
|
-
}
|
|
10605
|
-
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
10606
|
-
h("ez-numeric-input", { value: !value ? null : value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, precision: precision, prettyprecision: prettyPrecision, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
10607
|
-
//IMAGE, DATETIME, ELAPSEDTIME, PASSWORD, MASKEDTEXT, HTML
|
|
10608
|
-
default:
|
|
10609
|
-
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
10610
|
-
h("ez-text-input", { value: value, label: formattedLabel, enabled: isEnabled, loading: loadingData, onInput: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
10611
|
-
}
|
|
10612
|
-
};
|
|
10613
|
-
function getProp(properties, name) {
|
|
10614
|
-
var _a;
|
|
10615
|
-
return properties ? (_a = properties.find(prop => prop.name === name)) === null || _a === void 0 ? void 0 : _a.value : null;
|
|
10616
|
-
}
|
|
10617
|
-
|
|
10618
|
-
const FieldSet = ({ store, formName, source, dataUnit, enabled }) => {
|
|
10619
|
-
const { label, fields } = source;
|
|
10620
|
-
const fieldSetName = formName + label;
|
|
10621
|
-
let isCollapsed = selectIsCollapsedFieldSet(store.getState(), formName + label);
|
|
10622
|
-
let fieldToScroll;
|
|
10623
|
-
source.fields.forEach((field) => {
|
|
10624
|
-
if (fieldToScroll === undefined) {
|
|
10625
|
-
const fieldError = dataUnit.getErrorMessage(field.name);
|
|
10626
|
-
if (fieldError !== undefined && fieldError !== null && fieldError !== "") {
|
|
10627
|
-
fieldToScroll = field.name;
|
|
10628
|
-
}
|
|
10629
|
-
}
|
|
10630
|
-
});
|
|
10631
|
-
if (fieldToScroll) {
|
|
10632
|
-
isCollapsed = false;
|
|
10633
|
-
}
|
|
10634
|
-
return h("div", { class: "col col--sd-12 padding--small" },
|
|
10635
|
-
h("div", { class: "row margin-top--large" },
|
|
10636
|
-
h("div", { class: "col col--sd-12 align--middle padding-horizontal--medium" },
|
|
10637
|
-
h("ez-collapsible-box", { value: isCollapsed, label: label, onEzChange: () => store.dispatch(collapseExpandGroup(fieldSetName, !isCollapsed)) }),
|
|
10638
|
-
isCollapsed ? null :
|
|
10639
|
-
h("div", { class: "col col--sd-12" }, fields.map(field => h(Field, { enabled: enabled, field: field, dataUnit: dataUnit, forceScroll: fieldToScroll === field.name }))))));
|
|
10640
|
-
};
|
|
10641
|
-
|
|
10642
|
-
function buildFormItem(source, formName, store, dataUnit, enabled) {
|
|
10643
|
-
if ("fields" in source) {
|
|
10644
|
-
return h(FieldSet, { enabled: enabled, source: source, store: store, formName: formName, dataUnit: dataUnit });
|
|
10645
|
-
}
|
|
10646
|
-
const fieldName = source.name;
|
|
10647
|
-
const errorMsg = dataUnit.getErrorMessage(fieldName);
|
|
10648
|
-
const forceScroll = errorMsg === undefined || errorMsg === null || errorMsg === "" ? false : true;
|
|
10649
|
-
return h(Field, { enabled: enabled, field: source, dataUnit: dataUnit, forceScroll: forceScroll });
|
|
10650
|
-
}
|
|
10651
|
-
const FormSheet = ({ store, parentName, source, parentDataUnit, dataUnitBuilder, enabled }) => {
|
|
10652
|
-
const selectedTab = selectCurrentTab(store.getState(), parentName);
|
|
10653
|
-
const tabs = source.length > 1 ? source.map(form => h("ez-tab", { label: form.label, tabKey: form.name })) : null;
|
|
10654
|
-
const { subForms, items, name } = source[selectedTab];
|
|
10655
|
-
const dataUnit = dataUnitBuilder(source[selectedTab].dataUnit, parentDataUnit);
|
|
10656
|
-
source[selectedTab].dataUnit = dataUnit;
|
|
10657
|
-
const hasSubForms = subForms && subForms.length > 0;
|
|
10658
|
-
const changeTabHandler = (index) => {
|
|
10659
|
-
store.dispatch(changeTab$1(parentName, index));
|
|
10660
|
-
};
|
|
10661
|
-
//todos os campos e subformulários precisam estar ligados a um DU
|
|
10662
|
-
const currentDU = dataUnit || parentDataUnit;
|
|
10663
|
-
let buttons = selectVisibleButtons(store.getState());
|
|
10664
|
-
if (currentDU.cardinality === "1") {
|
|
10665
|
-
buttons.addVisible = false;
|
|
10666
|
-
buttons.removeVisible = false;
|
|
10667
|
-
buttons.nextVisible = false;
|
|
10668
|
-
buttons.previousVisible = false;
|
|
10669
|
-
}
|
|
10670
|
-
return h("div", { class: "form-sheet" },
|
|
10671
|
-
tabs ? h("ez-tabselector", { selectedIndex: selectedTab, selectedTab: name, onEzChange: (evt) => changeTabHandler(evt.target.selectedindex) }, tabs) : null,
|
|
10672
|
-
dataUnit ? h(NavigationBar, { enabled: enabled, dataUnit: dataUnit, buttonProps: buttons }) : null,
|
|
10673
|
-
h("div", { class: "tab__container" },
|
|
10674
|
-
items ? items.map(item => buildFormItem(item, name, store, currentDU, enabled)) : null,
|
|
10675
|
-
hasSubForms ? h(FormSheet, { enabled: enabled, store: store, source: subForms, parentName: name, parentDataUnit: currentDU, dataUnitBuilder: dataUnitBuilder }) : null));
|
|
10676
|
-
};
|
|
10677
|
-
|
|
10678
|
-
const ezFormCss = "ez-form{display:flex;flex-direction:column;width:100%}.form-sheet{display:flex;width:100%;flex-wrap:wrap;position:relative}.tab__container{display:flex;width:100%;flex-wrap:wrap;position:relative}";
|
|
10679
|
-
|
|
10680
|
-
let EzForm$1 = class extends HTMLElement$1 {
|
|
10681
|
-
constructor() {
|
|
10682
|
-
super();
|
|
10683
|
-
this.__registerHost();
|
|
10684
|
-
this.enabled = true;
|
|
10685
|
-
this.loading = false;
|
|
10686
|
-
this._dataUnits = new Map();
|
|
10687
|
-
this._duSources = new Map();
|
|
10688
|
-
this._tabPositionByField = new Map();
|
|
10689
|
-
this._duToLoad = [];
|
|
10690
|
-
}
|
|
10691
|
-
cleanPreparedMetadata() {
|
|
10692
|
-
this._preparedMetadata = undefined;
|
|
10693
|
-
}
|
|
10694
|
-
async validate() {
|
|
10695
|
-
const duSourcesNames = Array.from(this._duSources.keys());
|
|
10696
|
-
for (let i = 0; i < this._duSources.size; i++) {
|
|
10697
|
-
const duName = duSourcesNames[i];
|
|
10698
|
-
let du = this._dataUnits.get(duName);
|
|
10699
|
-
if (du === undefined) {
|
|
10700
|
-
const source = this._duSources.get(duName);
|
|
10701
|
-
du = this.buildDataUnit(source, source.parentDUName);
|
|
10702
|
-
}
|
|
10703
|
-
if (!du.validateRecords()) {
|
|
10704
|
-
return false;
|
|
10705
|
-
}
|
|
10706
|
-
}
|
|
10707
|
-
return true;
|
|
10708
|
-
}
|
|
10709
|
-
async getChanges() {
|
|
10710
|
-
let allChanges = [];
|
|
10711
|
-
const dataUnits = Array.from(this._dataUnits.values());
|
|
10712
|
-
for (let i = 0; i < this._dataUnits.size; i++) {
|
|
10713
|
-
const du = dataUnits[i];
|
|
10714
|
-
//Só devemos buscar as alterações de DU raiz, pois os sub DUs serão enviados junto.
|
|
10715
|
-
if (!du.parentDU) {
|
|
10716
|
-
const duChanges = du.getChangesToSave();
|
|
10717
|
-
if (duChanges) {
|
|
10718
|
-
allChanges = allChanges.concat(duChanges);
|
|
10719
|
-
}
|
|
10720
|
-
}
|
|
10721
|
-
}
|
|
10722
|
-
return allChanges;
|
|
10723
|
-
}
|
|
10724
|
-
async changeFieldValue(dataUnit, fieldName, value) {
|
|
10725
|
-
const du = this._dataUnits.get(dataUnit);
|
|
10726
|
-
if (du) {
|
|
10727
|
-
du.changeValue(fieldName, value);
|
|
9330
|
+
const isValid = invalidFields.length === 0;
|
|
9331
|
+
if (!isValid) {
|
|
9332
|
+
ApplicationUtils.info("Há pelo menos um campo obrigatório não preenchido.");
|
|
10728
9333
|
}
|
|
9334
|
+
return isValid;
|
|
10729
9335
|
}
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
const
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
}
|
|
10739
|
-
if (field.userInterface === "SWITCH" || field.userInterface === "CHECKBOX") {
|
|
10740
|
-
return false;
|
|
10741
|
-
}
|
|
10742
|
-
return true;
|
|
10743
|
-
};
|
|
10744
|
-
const recordValidator = record => {
|
|
10745
|
-
dataUnit.requiredFields.forEach(field => {
|
|
10746
|
-
if (validateField(field)) {
|
|
10747
|
-
const recordIndex = record["record__index"];
|
|
10748
|
-
const fieldName = field.name;
|
|
10749
|
-
const fieldValue = record[fieldName];
|
|
10750
|
-
if (fieldValue === null || fieldValue === undefined || fieldValue === "") {
|
|
10751
|
-
const tabPosition = this._tabPositionByField.get(dataUnit.name + field.name);
|
|
10752
|
-
this._store.dispatch(invalidField$1(tabPosition.tabName, tabPosition.index, dataUnit.name, recordIndex, record.record__id, field.name, "Essa informação é obrigatória"));
|
|
10753
|
-
result.isValid = false;
|
|
10754
|
-
result.message = "Há pelo menos um campo obrigatório não preenchido.";
|
|
10755
|
-
}
|
|
10756
|
-
}
|
|
10757
|
-
});
|
|
10758
|
-
};
|
|
10759
|
-
if (dataUnit.records.length === 0) {
|
|
10760
|
-
recordValidator({});
|
|
9336
|
+
getDynamicContent() {
|
|
9337
|
+
var _a;
|
|
9338
|
+
const formMD = selectFormMetadata(this._store.getState());
|
|
9339
|
+
if (!formMD)
|
|
9340
|
+
return null;
|
|
9341
|
+
const currentSheet = selectCurrentSheet((_a = this._store) === null || _a === void 0 ? void 0 : _a.getState());
|
|
9342
|
+
if (!currentSheet) {
|
|
9343
|
+
return null;
|
|
10761
9344
|
}
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
validatedRecords[r.record__id] = true;
|
|
10767
|
-
});
|
|
10768
|
-
dataUnit.records.forEach(r => {
|
|
10769
|
-
if (!validatedRecords[r.record__id]) {
|
|
10770
|
-
recordValidator(r);
|
|
10771
|
-
}
|
|
10772
|
-
});
|
|
9345
|
+
const allSheets = Array.from(formMD.getAllSheets().values());
|
|
9346
|
+
const result = [];
|
|
9347
|
+
if (allSheets.length > 1) {
|
|
9348
|
+
result.push(h("ez-tabselector", { onEzChange: (evt) => this._store.dispatch(changeTab(evt.detail)), selectedTab: currentSheet.name }, allSheets.map(s => h("ez-tab", { tabKey: s.name, label: s.label }))));
|
|
10773
9349
|
}
|
|
9350
|
+
result.push(h(FormSheet, { store: this._store, source: currentSheet }));
|
|
10774
9351
|
return result;
|
|
10775
9352
|
}
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
if (result) {
|
|
10781
|
-
if (result instanceof Promise) {
|
|
10782
|
-
result.then(md => {
|
|
10783
|
-
callBack(md);
|
|
10784
|
-
});
|
|
10785
|
-
}
|
|
10786
|
-
else {
|
|
10787
|
-
callBack(result);
|
|
10788
|
-
}
|
|
10789
|
-
}
|
|
10790
|
-
}
|
|
10791
|
-
}
|
|
10792
|
-
loadMDFromElement(callBack) {
|
|
10793
|
-
const metadata = [];
|
|
10794
|
-
Array.from(this._host.children).forEach(elem => {
|
|
10795
|
-
if (elem.tagName === "FORM-METADATA") {
|
|
10796
|
-
const formMetadata = elem;
|
|
10797
|
-
metadata.push(formMetadata.metadata);
|
|
10798
|
-
}
|
|
10799
|
-
});
|
|
10800
|
-
callBack(metadata.length > 0 ? metadata : null);
|
|
10801
|
-
}
|
|
10802
|
-
updateMetadata(metadata) {
|
|
10803
|
-
if (metadata) {
|
|
10804
|
-
const processFields = (duName, form, tabController, tabIndex) => {
|
|
10805
|
-
var _a;
|
|
10806
|
-
form.items.forEach(item => {
|
|
10807
|
-
if ("fields" in item) {
|
|
10808
|
-
const fSet = item;
|
|
10809
|
-
fSet.fields.forEach(f => {
|
|
10810
|
-
f.form = this;
|
|
10811
|
-
this._tabPositionByField.set(duName + f.name, { tabName: tabController, index: tabIndex });
|
|
10812
|
-
});
|
|
10813
|
-
}
|
|
10814
|
-
else {
|
|
10815
|
-
const f = item;
|
|
10816
|
-
f.form = this;
|
|
10817
|
-
this._tabPositionByField.set(duName + f.name, { tabName: tabController, index: tabIndex });
|
|
10818
|
-
}
|
|
10819
|
-
});
|
|
10820
|
-
(_a = form.subForms) === null || _a === void 0 ? void 0 : _a.forEach((subForm, index) => {
|
|
10821
|
-
const subDu = subForm.dataUnit;
|
|
10822
|
-
if (subDu) {
|
|
10823
|
-
this._duSources.set(subDu.name, subDu);
|
|
10824
|
-
subDu.parentDUName = duName;
|
|
10825
|
-
}
|
|
10826
|
-
processFields(subDu ? subDu.name : duName, subForm, form.name, index);
|
|
10827
|
-
});
|
|
10828
|
-
};
|
|
10829
|
-
this._preparedMetadata = metadata.map((form, index) => {
|
|
10830
|
-
const du = form.dataUnit;
|
|
10831
|
-
if (form.autoLoad) {
|
|
10832
|
-
this._duToLoad.push(du);
|
|
10833
|
-
}
|
|
10834
|
-
this.decorateDU(du);
|
|
10835
|
-
const duName = du.name;
|
|
10836
|
-
this._duSources.set(duName, du);
|
|
10837
|
-
processFields(duName, form, "__MAIN__FORM__", index);
|
|
10838
|
-
return form;
|
|
10839
|
-
});
|
|
10840
|
-
this._store.dispatch(formLoad());
|
|
9353
|
+
processMetadata() {
|
|
9354
|
+
if (!this.isStatic()) {
|
|
9355
|
+
const metadata = this.config && this.config.length > 0 ? buildFromConfig(this.config, this.dataUnit) : buildFromDataUnit(this.dataUnit);
|
|
9356
|
+
this._store.dispatch(loadMetadata(metadata));
|
|
10841
9357
|
}
|
|
10842
9358
|
}
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
}
|
|
10847
|
-
return null;
|
|
9359
|
+
isStatic() {
|
|
9360
|
+
var _a;
|
|
9361
|
+
return ((_a = this._staticFields) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
10848
9362
|
}
|
|
10849
|
-
|
|
10850
|
-
if (this.
|
|
10851
|
-
|
|
10852
|
-
"hist": undoable(formReducer),
|
|
10853
|
-
"nonhist": formNonHistoricReducer
|
|
10854
|
-
});
|
|
10855
|
-
this._store = createStore(rootReducer, applyMiddleware(thunk));
|
|
10856
|
-
this._store.subscribe(() => { forceUpdate(this); });
|
|
10857
|
-
if (this.slaveMode) {
|
|
10858
|
-
this._store.dispatch(showHideNavigationButtons("saveVisible", false));
|
|
10859
|
-
this._store.dispatch(showHideNavigationButtons("cancelVisible", false));
|
|
10860
|
-
this._store.dispatch(showHideNavigationButtons("reloadVisible", false));
|
|
10861
|
-
}
|
|
9363
|
+
componentWillLoad() {
|
|
9364
|
+
if (this.dataUnit === undefined) {
|
|
9365
|
+
this.dataUnit = new DataUnit("ez-form");
|
|
10862
9366
|
}
|
|
10863
|
-
|
|
10864
|
-
if (
|
|
10865
|
-
this.
|
|
9367
|
+
this.dataUnit.subscribe(action => {
|
|
9368
|
+
if (action.type === Action.METADATA_LOADED) {
|
|
9369
|
+
this.processMetadata();
|
|
10866
9370
|
}
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
}
|
|
9371
|
+
});
|
|
9372
|
+
this._dataBinder = new DataBinder(this.dataUnit);
|
|
9373
|
+
this._store = createStore(formReducer);
|
|
9374
|
+
this._store.subscribe(() => forceUpdate(this));
|
|
9375
|
+
this._staticFields = Array.from(this._element.querySelectorAll("[data-field-name]"));
|
|
9376
|
+
this.processMetadata();
|
|
10874
9377
|
}
|
|
10875
9378
|
componentDidRender() {
|
|
10876
|
-
this.
|
|
10877
|
-
this._duToLoad = [];
|
|
10878
|
-
}
|
|
10879
|
-
loadSearch(argument, context) {
|
|
10880
|
-
const fieldSearchExecutor = this.parseExecutor(this.fieldSearchExecutor);
|
|
10881
|
-
if (fieldSearchExecutor) {
|
|
10882
|
-
return fieldSearchExecutor(argument, context);
|
|
10883
|
-
}
|
|
10884
|
-
else {
|
|
10885
|
-
return [{ value: 0, label: "Sem resultados" }];
|
|
10886
|
-
}
|
|
10887
|
-
}
|
|
10888
|
-
buildDataUnit(dataUnit, parentDataUnit) {
|
|
10889
|
-
if (dataUnit) {
|
|
10890
|
-
const { name, unitLabel, records, cardinality, fields } = dataUnit;
|
|
10891
|
-
if (!(dataUnit instanceof DataUnit)) {
|
|
10892
|
-
let parent;
|
|
10893
|
-
if (parentDataUnit instanceof DataUnit) {
|
|
10894
|
-
parent = parentDataUnit;
|
|
10895
|
-
}
|
|
10896
|
-
else {
|
|
10897
|
-
parent = this._dataUnits.get(parentDataUnit);
|
|
10898
|
-
}
|
|
10899
|
-
dataUnit = new DataUnit(name, unitLabel, cardinality, parent);
|
|
10900
|
-
dataUnit.fields = fields;
|
|
10901
|
-
this._dataUnits.set(dataUnit.name, dataUnit);
|
|
10902
|
-
if (records) {
|
|
10903
|
-
dataUnit.records = records;
|
|
10904
|
-
}
|
|
10905
|
-
}
|
|
10906
|
-
this.decorateDU(dataUnit);
|
|
10907
|
-
}
|
|
10908
|
-
return dataUnit;
|
|
10909
|
-
}
|
|
10910
|
-
decorateDU(dataUnit) {
|
|
10911
|
-
dataUnit.store = this._store;
|
|
10912
|
-
dataUnit.loadExecutor = this.parseExecutor(this.loadExecutor);
|
|
10913
|
-
dataUnit.saveExecutor = this.parseExecutor(this.saveExecutor);
|
|
10914
|
-
dataUnit.removeExecutor = this.parseExecutor(this.removeExecutor);
|
|
10915
|
-
dataUnit.recordsValidator = this;
|
|
9379
|
+
this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")));
|
|
10916
9380
|
}
|
|
10917
9381
|
render() {
|
|
10918
|
-
|
|
10919
|
-
return h("place-holder", null);
|
|
10920
|
-
}
|
|
10921
|
-
else {
|
|
10922
|
-
return this._preparedMetadata ? h(FormSheet, { enabled: this.enabled, store: this._store, source: this._preparedMetadata, parentName: "__MAIN__FORM__", dataUnitBuilder: (du, parentDataUnit) => this.buildDataUnit(du, parentDataUnit) }) : null;
|
|
10923
|
-
}
|
|
9382
|
+
return (h(Host, null, this.isStatic() ? null : this.getDynamicContent()));
|
|
10924
9383
|
}
|
|
10925
|
-
|
|
10926
|
-
get _host() { return this; }
|
|
10927
|
-
static get watchers() { return {
|
|
10928
|
-
"metadata": ["cleanPreparedMetadata"]
|
|
10929
|
-
}; }
|
|
9384
|
+
get _element() { return this; }
|
|
10930
9385
|
static get style() { return ezFormCss; }
|
|
10931
9386
|
};
|
|
10932
9387
|
|
|
@@ -123181,128 +121636,6 @@ let EzUpload$1 = class extends HTMLElement$1 {
|
|
|
123181
121636
|
static get style() { return ezUploadCss; }
|
|
123182
121637
|
};
|
|
123183
121638
|
|
|
123184
|
-
let FormMetadata$1 = class extends HTMLElement$1 {
|
|
123185
|
-
constructor() {
|
|
123186
|
-
super();
|
|
123187
|
-
this.__registerHost();
|
|
123188
|
-
this.__attachShadow();
|
|
123189
|
-
}
|
|
123190
|
-
buildField(element) {
|
|
123191
|
-
let label = element.getAttribute("label");
|
|
123192
|
-
let name = element.getAttribute("name") || label;
|
|
123193
|
-
let userInterface = element.getAttribute("ui") || "SHORTTEXT";
|
|
123194
|
-
let properties = [];
|
|
123195
|
-
if (userInterface === "OPTIONSELECTOR") {
|
|
123196
|
-
if (!label) {
|
|
123197
|
-
label = "Selecione uma das opções:";
|
|
123198
|
-
}
|
|
123199
|
-
const objOpts = {};
|
|
123200
|
-
Array.from(element.getElementsByTagName("OPTION")).forEach((optElem, index) => {
|
|
123201
|
-
const optValue = optElem.getAttribute("value") || index;
|
|
123202
|
-
const optLabel = optElem.textContent;
|
|
123203
|
-
objOpts[optValue] = optLabel;
|
|
123204
|
-
});
|
|
123205
|
-
properties.push({ name: "options", value: JSON.stringify(objOpts) });
|
|
123206
|
-
}
|
|
123207
|
-
else if (userInterface === "FILE") {
|
|
123208
|
-
const urlElement = element.querySelector("URL");
|
|
123209
|
-
const headersElement = element.querySelectorAll("HEADERS>HEADER");
|
|
123210
|
-
if (urlElement) {
|
|
123211
|
-
properties.push({ name: "URL", value: urlElement.textContent });
|
|
123212
|
-
}
|
|
123213
|
-
if (headersElement && headersElement.length > 0) {
|
|
123214
|
-
const headers = {};
|
|
123215
|
-
headersElement.forEach(header => {
|
|
123216
|
-
headers[header.getAttribute("name")] = header.textContent;
|
|
123217
|
-
});
|
|
123218
|
-
properties.push({ name: "HEADERS", value: JSON.stringify(headers) });
|
|
123219
|
-
}
|
|
123220
|
-
this.addPropertyIfExists(properties, element, "maxfiles");
|
|
123221
|
-
}
|
|
123222
|
-
else {
|
|
123223
|
-
if (!label) {
|
|
123224
|
-
label = element.textContent;
|
|
123225
|
-
}
|
|
123226
|
-
this.addPropertyIfExists(properties, element, "precision");
|
|
123227
|
-
this.addPropertyIfExists(properties, element, "prettyprecision");
|
|
123228
|
-
}
|
|
123229
|
-
const defaultValue = element.getAttribute("defaultValue");
|
|
123230
|
-
const required = element.getAttribute("required") === "true";
|
|
123231
|
-
const readOnly = element.getAttribute("readonly") === "true";
|
|
123232
|
-
return { name, userInterface, label, defaultValue, required, readOnly, properties };
|
|
123233
|
-
}
|
|
123234
|
-
addPropertyIfExists(properties, element, name) {
|
|
123235
|
-
const value = element.getAttribute(name);
|
|
123236
|
-
if (value) {
|
|
123237
|
-
properties.push({ name, value });
|
|
123238
|
-
}
|
|
123239
|
-
}
|
|
123240
|
-
buildFieldSet(dataUnit, element) {
|
|
123241
|
-
const label = element.getAttribute("label");
|
|
123242
|
-
const fields = Array.from(element.getElementsByTagName("FIELD")).map(f => {
|
|
123243
|
-
const field = this.buildField(f);
|
|
123244
|
-
dataUnit.addFieldMetadata(field);
|
|
123245
|
-
return { name: field.name };
|
|
123246
|
-
});
|
|
123247
|
-
return { label, fields };
|
|
123248
|
-
}
|
|
123249
|
-
fromElements(elements, label, name, dataUnit, autoLoad) {
|
|
123250
|
-
const form = {
|
|
123251
|
-
name: name || label,
|
|
123252
|
-
dataUnit,
|
|
123253
|
-
label,
|
|
123254
|
-
autoLoad
|
|
123255
|
-
};
|
|
123256
|
-
Array.from(elements).forEach(child => {
|
|
123257
|
-
const tagName = child.tagName.toUpperCase();
|
|
123258
|
-
switch (tagName) {
|
|
123259
|
-
case "FIELD":
|
|
123260
|
-
if (!form.items) {
|
|
123261
|
-
form.items = [];
|
|
123262
|
-
}
|
|
123263
|
-
const f = this.buildField(child);
|
|
123264
|
-
dataUnit.addFieldMetadata(f);
|
|
123265
|
-
form.items.push({ name: f.name });
|
|
123266
|
-
break;
|
|
123267
|
-
case "FIELD-SET":
|
|
123268
|
-
if (!form.items) {
|
|
123269
|
-
form.items = [];
|
|
123270
|
-
}
|
|
123271
|
-
form.items.push(this.buildFieldSet(dataUnit, child));
|
|
123272
|
-
break;
|
|
123273
|
-
case "SUB-FORM":
|
|
123274
|
-
if (!form.subForms) {
|
|
123275
|
-
form.subForms = [];
|
|
123276
|
-
}
|
|
123277
|
-
const label = child.getAttribute("label") || "Subform " + (form.subForms.length + 1);
|
|
123278
|
-
const name = child.getAttribute("name") || label;
|
|
123279
|
-
const subDuName = child.getAttribute("dataunit");
|
|
123280
|
-
let subDu;
|
|
123281
|
-
if (subDuName) {
|
|
123282
|
-
subDu = new DataUnit(subDuName, "noname", child.hasAttribute("many") ? "N" : "1");
|
|
123283
|
-
}
|
|
123284
|
-
else {
|
|
123285
|
-
subDu = dataUnit;
|
|
123286
|
-
}
|
|
123287
|
-
form.subForms.push(this.fromElements(child.children, label, name, subDu, child.getAttribute("autoload") === "true"));
|
|
123288
|
-
break;
|
|
123289
|
-
}
|
|
123290
|
-
});
|
|
123291
|
-
return form;
|
|
123292
|
-
}
|
|
123293
|
-
connectedCallback() {
|
|
123294
|
-
if (!this.dataunit) {
|
|
123295
|
-
this.dataunit = "dataunit_" + (this.name || this.label || new Date().getTime());
|
|
123296
|
-
}
|
|
123297
|
-
const du = new DataUnit(this.dataunit, "noname", this.many ? "N" : "1");
|
|
123298
|
-
this.metadata = this.fromElements(this._host.children, this.label, this.name, du, this.autoload);
|
|
123299
|
-
}
|
|
123300
|
-
render() {
|
|
123301
|
-
return h(Host, null);
|
|
123302
|
-
}
|
|
123303
|
-
get _host() { return this; }
|
|
123304
|
-
};
|
|
123305
|
-
|
|
123306
121639
|
const gridConfigCss = ":host{--ez-grid-config__footer--padding-top:var(--space--medium, 12px);--ez-grid-config__main--padding-right:var(--space--medium, 12px);--ez-grid-config__tabselector-container--padding:var(--space--medium, 12px);--ez-grid-config__button-close--padding-left:var(--space--medium, 12px);--ez-grid-config__subtitle--font-family:var(--font-pattern, \"Sora\");--ez-grid-config__title--font-family:var(--font-pattern, \"Sora\");--ez-grid-config__title--font-weight:var(--text-weight--large, 14px);--ez-grid-config__subtitle--font-size:var(--text--medium, 14px);--ez-grid-config__scrollbar--width:var(--space--medium, 12px);--ez-grid-config__main__scrollbar--background-color:var(--text--primary, #626e82);--ez-grid-config__main__scrollbar--border-radius:var(--border--radius-medium, 12px);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}.padding-right--medium{padding-right:var(--space--medium)}ez-list{height:100%}.grid-config__footer{padding-top:var(--ez-grid-config__footer--padding-top);display:flex;justify-content:flex-end;width:100%}.hidden{display:none}.grid-config__main{padding-right:var(--ez-grid-config__main--padding-right);overflow-y:auto}.tabselector-container{padding:var(--ez-grid-config__tabselector-container--padding) 0}.button-close{padding-left:var(--ez-grid-config__button-close--padding-left)}.title-container{display:flex;justify-content:center;align-items:center}.subtitle{font-family:var(--ez-grid-config__subtitle--font-family);font-size:var(--ez-grid-config__subtitle--font-size)}.title{display:flex;font-family:var(--ez-grid-config__title--font-family);margin:0;font-weight:var(--ez-grid-config__title--font-weight);line-height:1.3}.grid-config__main::-webkit-scrollbar-track{background-color:#f0f2f5}.grid-config__main::-webkit-scrollbar-thumb{background-color:var(--ez-grid-config__main__scrollbar--background-color);border-radius:var(--ez-grid-config__main__scrollbar--border-radius)}.grid-config__main::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-grid-config__scrollbar--width);max-width:var(--ez-grid-config__scrollbar--width);min-width:var(--ez-grid-config__scrollbar--width)}";
|
|
123307
121640
|
|
|
123308
121641
|
let GridConfig$1 = class extends HTMLElement$1 {
|
|
@@ -123553,20 +121886,6 @@ let GridConfig$1 = class extends HTMLElement$1 {
|
|
|
123553
121886
|
static get style() { return gridConfigCss; }
|
|
123554
121887
|
};
|
|
123555
121888
|
|
|
123556
|
-
const placeHolderCss = ":host{display:flex;width:100%;height:42px;border-radius:12px;background:var(--background--medium);background-image:linear-gradient(to right, var(--background--medium) 0%, var(--background--strong) 20%, var(--background--medium) 40%, var(--background--medium) 100%);background-repeat:no-repeat;background-size:800px 1000px;animation-duration:1s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:placeholderShimmer;animation-timing-function:linear}@keyframes placeholderShimmer{0%{background-position:-800px 0}100%{background-position:800px 0}}";
|
|
123557
|
-
|
|
123558
|
-
let PlaceHolder$1 = class extends HTMLElement$1 {
|
|
123559
|
-
constructor() {
|
|
123560
|
-
super();
|
|
123561
|
-
this.__registerHost();
|
|
123562
|
-
this.__attachShadow();
|
|
123563
|
-
}
|
|
123564
|
-
render() {
|
|
123565
|
-
return h(Host, null);
|
|
123566
|
-
}
|
|
123567
|
-
static get style() { return placeHolderCss; }
|
|
123568
|
-
};
|
|
123569
|
-
|
|
123570
121889
|
const selectBoxCss = "select{border:1px solid #DCE0E8;font-family:'Sora';border-radius:3px;outline:none;cursor:pointer}";
|
|
123571
121890
|
|
|
123572
121891
|
let SelectBox$1 = class extends HTMLElement$1 {
|
|
@@ -123602,34 +121921,77 @@ let TestDu$1 = class extends HTMLElement$1 {
|
|
|
123602
121921
|
constructor() {
|
|
123603
121922
|
super();
|
|
123604
121923
|
this.__registerHost();
|
|
123605
|
-
this._dataUnit = new DataUnit$1("duteste");
|
|
123606
121924
|
}
|
|
123607
|
-
|
|
123608
|
-
this.
|
|
123609
|
-
|
|
123610
|
-
|
|
123611
|
-
{ __record__id__: "registro2", CODPARC: 20, NOMEPARC: "Parceiro 20" }
|
|
123612
|
-
]);
|
|
123613
|
-
};
|
|
123614
|
-
this._dataUnit.metadata = {
|
|
123615
|
-
name: "Parceiro",
|
|
121925
|
+
componentWillLoad() {
|
|
121926
|
+
this.dataUnit = new DataUnit("testes_com_formulario");
|
|
121927
|
+
this.dataUnit.metadata = {
|
|
121928
|
+
name: "dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",
|
|
123616
121929
|
label: "Parceiro",
|
|
123617
121930
|
fields: [
|
|
123618
121931
|
{
|
|
123619
121932
|
name: "CODPARC",
|
|
123620
|
-
label: "
|
|
123621
|
-
dataType: DataType.NUMBER
|
|
121933
|
+
label: "Parceiro",
|
|
121934
|
+
dataType: DataType.NUMBER,
|
|
121935
|
+
userInterface: UserInterface.SEARCH,
|
|
121936
|
+
required: true,
|
|
121937
|
+
properties: {}
|
|
121938
|
+
},
|
|
121939
|
+
{
|
|
121940
|
+
name: "RECDESP",
|
|
121941
|
+
label: "Receita/Despesa",
|
|
121942
|
+
dataType: DataType.TEXT,
|
|
121943
|
+
userInterface: UserInterface.OPTIONSELECTOR,
|
|
121944
|
+
required: true,
|
|
121945
|
+
properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
|
|
123622
121946
|
},
|
|
123623
121947
|
{
|
|
123624
|
-
name: "
|
|
123625
|
-
label: "
|
|
123626
|
-
dataType: DataType.TEXT
|
|
121948
|
+
name: "P",
|
|
121949
|
+
label: "pera",
|
|
121950
|
+
dataType: DataType.TEXT,
|
|
121951
|
+
userInterface: UserInterface.OPTIONSELECTOR,
|
|
121952
|
+
properties: { options: `{"M": "Madura", "V": "Verde", "P": "Passada"}` }
|
|
121953
|
+
},
|
|
121954
|
+
{
|
|
121955
|
+
name: "ME",
|
|
121956
|
+
label: "ME",
|
|
121957
|
+
dataType: DataType.NUMBER,
|
|
121958
|
+
userInterface: UserInterface.DECIMALNUMBER,
|
|
121959
|
+
properties: { precision: 4, prettyPrecision: 1 }
|
|
123627
121960
|
}
|
|
123628
121961
|
]
|
|
123629
121962
|
};
|
|
121963
|
+
this.formConfig = [
|
|
121964
|
+
{ name: "CODPARC", label: "Parceiro" },
|
|
121965
|
+
{ name: "NOMEPARC", label: "Mamão" },
|
|
121966
|
+
{ name: "P", label: "Pêra", group: "Grupo 1" },
|
|
121967
|
+
{ name: "ME", label: "Melancia", tab: "aba 1", group: "Grupo 2" },
|
|
121968
|
+
{ name: "L", label: "Laranja", tab: "aba 1", group: "Grupo 1" },
|
|
121969
|
+
{ name: "LI", label: "Limão", tab: "aba 1", group: "Grupo 2" }
|
|
121970
|
+
];
|
|
121971
|
+
this.dataUnit.records = [
|
|
121972
|
+
{
|
|
121973
|
+
__record__id__: "1321321321321321",
|
|
121974
|
+
CODPARC: 10,
|
|
121975
|
+
NOMEPARC: "Parceiro 10",
|
|
121976
|
+
P: "M",
|
|
121977
|
+
L: "Bagaço",
|
|
121978
|
+
LI: "Azedo"
|
|
121979
|
+
}
|
|
121980
|
+
];
|
|
123630
121981
|
}
|
|
123631
121982
|
render() {
|
|
123632
|
-
return
|
|
121983
|
+
//return this.conteudoEstatico();
|
|
121984
|
+
//return this.somenteDataUnit();
|
|
121985
|
+
return this.configurado();
|
|
121986
|
+
}
|
|
121987
|
+
conteudoEstatico() {
|
|
121988
|
+
return (h("div", null, h("button", { onClick: () => this.form.validate() }, "Validate"), h("ez-form", { ref: ref => this.form = ref }, h("div", null, h("ez-text-input", { label: "Nome (Label est\u00E1tico)", "data-field-name": "NOMEPARC", "data-required": "true" }), h("ez-text-input", { label: "C\u00F3d parc (Label est\u00E1tico)", "data-field-name": "CODPARC", "data-required": "true" })))));
|
|
121989
|
+
}
|
|
121990
|
+
somenteDataUnit() {
|
|
121991
|
+
return (h("ez-form", { dataUnit: this.dataUnit }));
|
|
121992
|
+
}
|
|
121993
|
+
configurado() {
|
|
121994
|
+
return (h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig, ref: ref => this.form = ref }));
|
|
123633
121995
|
}
|
|
123634
121996
|
static get style() { return testDuCss; }
|
|
123635
121997
|
};
|
|
@@ -123644,7 +122006,7 @@ const EzComboBox = /*@__PURE__*/proxyCustomElement(EzComboBox$1, [1,"ez-combo-bo
|
|
|
123644
122006
|
const EzDateInput = /*@__PURE__*/proxyCustomElement(EzDateInput$1, [1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"]}]);
|
|
123645
122007
|
const EzDateTimeInput = /*@__PURE__*/proxyCustomElement(EzDateTimeInput$1, [1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"]}]);
|
|
123646
122008
|
const EzDialog = /*@__PURE__*/proxyCustomElement(EzDialog$1, [1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"]}]);
|
|
123647
|
-
const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [0,"ez-form",{"
|
|
122009
|
+
const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [0,"ez-form",{"dataUnit":[1040],"config":[16]}]);
|
|
123648
122010
|
const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [0,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32]}]);
|
|
123649
122011
|
const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513]}]);
|
|
123650
122012
|
const EzLabelChip = /*@__PURE__*/proxyCustomElement(EzLabelChip$1, [1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540]}]);
|
|
@@ -123660,9 +122022,7 @@ const EzTextInput = /*@__PURE__*/proxyCustomElement(EzTextInput$1, [1,"ez-text-i
|
|
|
123660
122022
|
const EzTimeInput = /*@__PURE__*/proxyCustomElement(EzTimeInput$1, [1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"]}]);
|
|
123661
122023
|
const EzToast = /*@__PURE__*/proxyCustomElement(EzToast$1, [1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"]}]);
|
|
123662
122024
|
const EzUpload = /*@__PURE__*/proxyCustomElement(EzUpload$1, [1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040]}]);
|
|
123663
|
-
const FormMetadata = /*@__PURE__*/proxyCustomElement(FormMetadata$1, [1,"form-metadata",{"name":[1],"label":[1],"dataunit":[1025],"many":[4],"autoload":[4],"metadata":[1040]}]);
|
|
123664
122025
|
const GridConfig = /*@__PURE__*/proxyCustomElement(GridConfig$1, [1,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]);
|
|
123665
|
-
const PlaceHolder = /*@__PURE__*/proxyCustomElement(PlaceHolder$1, [1,"place-holder"]);
|
|
123666
122026
|
const SelectBox = /*@__PURE__*/proxyCustomElement(SelectBox$1, [1,"select-box",{"selectedOption":[1,"selected-option"]}]);
|
|
123667
122027
|
const TestDu = /*@__PURE__*/proxyCustomElement(TestDu$1, [0,"test-du"]);
|
|
123668
122028
|
const defineCustomElements = (opts) => {
|
|
@@ -123694,9 +122054,7 @@ const defineCustomElements = (opts) => {
|
|
|
123694
122054
|
EzTimeInput,
|
|
123695
122055
|
EzToast,
|
|
123696
122056
|
EzUpload,
|
|
123697
|
-
FormMetadata,
|
|
123698
122057
|
GridConfig,
|
|
123699
|
-
PlaceHolder,
|
|
123700
122058
|
SelectBox,
|
|
123701
122059
|
TestDu
|
|
123702
122060
|
].forEach(cmp => {
|
|
@@ -123707,4 +122065,4 @@ const defineCustomElements = (opts) => {
|
|
|
123707
122065
|
}
|
|
123708
122066
|
};
|
|
123709
122067
|
|
|
123710
|
-
export { EzActionChip, EzApplication, EzButton, EzCalendar, EzCheck, EzCollapsibleBox, EzComboBox, EzDateInput, EzDateTimeInput, EzDialog, EzForm, EzGrid, EzIcon, EzLabelChip, EzList, EzModal, EzNumberInput, EzPopover, EzPopup, EzSearch, EzTabselector, EzTextArea, EzTextInput, EzTimeInput, EzToast, EzUpload,
|
|
122068
|
+
export { EzActionChip, EzApplication, EzButton, EzCalendar, EzCheck, EzCollapsibleBox, EzComboBox, EzDateInput, EzDateTimeInput, EzDialog, EzForm, EzGrid, EzIcon, EzLabelChip, EzList, EzModal, EzNumberInput, EzPopover, EzPopup, EzSearch, EzTabselector, EzTextArea, EzTextInput, EzTimeInput, EzToast, EzUpload, GridConfig, SelectBox, TestDu, defineCustomElements };
|