@sankhyalabs/ezui 1.1.80 → 1.1.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/cjs/ApplicationUtils-d1c1db56.js +35 -0
  2. package/dist/cjs/{AssetsUtils-02db4f46.js → AssetsUtils-caf95dab.js} +1 -1
  3. package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  5. package/dist/cjs/{ez-grid.cjs.entry.js → ez-button_11.cjs.entry.js} +1448 -22
  6. package/dist/cjs/ez-calendar.cjs.entry.js +217 -0
  7. package/dist/cjs/ez-collapsible-box_7.cjs.entry.js +853 -0
  8. package/dist/cjs/ez-combo-box.cjs.entry.js +254 -0
  9. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-form.cjs.entry.js +722 -0
  11. package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-popover.cjs.entry.js +2 -2
  13. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-time-input.cjs.entry.js +3 -3
  15. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  16. package/dist/cjs/ezui.cjs.js +2 -2
  17. package/dist/cjs/{index-2003dec4.js → index-0bce1636.js} +3 -0
  18. package/dist/cjs/{index-a2266984.js → index-2fc1b5fa.js} +115 -72
  19. package/dist/cjs/loader.cjs.js +2 -2
  20. package/dist/collection/components/ez-form/DataBinder.js +7 -1
  21. package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +2 -1
  22. package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +4 -0
  23. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +19 -25
  24. package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +10 -7
  25. package/dist/collection/components/ez-grid/ez-grid.css +4 -1
  26. package/dist/collection/components/ez-grid/ez-grid.js +4 -0
  27. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +1 -1
  28. package/dist/collection/components/test-du/test-du.js +3 -27
  29. package/dist/custom-elements/index.js +150 -116
  30. package/dist/esm/ApplicationUtils-01280a9d.js +33 -0
  31. package/dist/esm/{AssetsUtils-76ca41e1.js → AssetsUtils-9b1d9c38.js} +1 -1
  32. package/dist/esm/ez-action-chip.entry.js +1 -1
  33. package/dist/esm/ez-application.entry.js +1 -1
  34. package/dist/esm/{ez-grid.entry.js → ez-button_11.entry.js} +1428 -12
  35. package/dist/esm/ez-calendar.entry.js +213 -0
  36. package/dist/esm/ez-collapsible-box_7.entry.js +843 -0
  37. package/dist/esm/ez-combo-box.entry.js +250 -0
  38. package/dist/esm/ez-dialog.entry.js +1 -1
  39. package/dist/esm/ez-form.entry.js +718 -0
  40. package/dist/esm/ez-label-chip.entry.js +1 -1
  41. package/dist/esm/ez-popover.entry.js +2 -2
  42. package/dist/esm/ez-popup.entry.js +1 -1
  43. package/dist/esm/ez-time-input.entry.js +3 -3
  44. package/dist/esm/ez-toast.entry.js +1 -1
  45. package/dist/esm/ezui.js +2 -2
  46. package/dist/esm/{index-afe19542.js → index-015d8d70.js} +116 -73
  47. package/dist/esm/{index-077c7fcf.js → index-d80a8d1f.js} +3 -0
  48. package/dist/esm/loader.js +2 -2
  49. package/dist/ezui/ezui.esm.js +1 -1
  50. package/dist/ezui/{p-5509ee41.entry.js → p-058b8138.entry.js} +46 -46
  51. package/dist/ezui/{p-7a1f2e0e.entry.js → p-07d2c50f.entry.js} +1 -1
  52. package/dist/ezui/{p-57ea4b84.entry.js → p-091b27f2.entry.js} +1 -1
  53. package/dist/ezui/{p-6d157776.entry.js → p-19d8a928.entry.js} +1 -1
  54. package/dist/ezui/{p-a4a39579.entry.js → p-39218c31.entry.js} +1 -1
  55. package/dist/ezui/{p-da31cd21.entry.js → p-6206515e.entry.js} +1 -1
  56. package/dist/ezui/p-62ee7026.entry.js +1 -0
  57. package/dist/ezui/p-7107d7ef.js +1 -0
  58. package/dist/ezui/{p-7de3c95d.js → p-7c101b34.js} +1 -1
  59. package/dist/ezui/{p-857ead8e.entry.js → p-8592635e.entry.js} +1 -1
  60. package/dist/ezui/p-93ce25bc.entry.js +1 -0
  61. package/dist/ezui/p-96c336db.js +1 -0
  62. package/dist/ezui/p-a06aa43a.entry.js +1 -0
  63. package/dist/ezui/{p-920bb8c9.entry.js → p-a52b3368.entry.js} +1 -1
  64. package/dist/ezui/{p-0a2056d9.entry.js → p-b678dc80.entry.js} +1 -1
  65. package/dist/ezui/p-ca3dac07.entry.js +1 -0
  66. package/dist/ezui/p-f87c7082.js +1 -0
  67. package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +4 -0
  68. package/dist/types/components/ez-grid/controller/DataUnitBridge.d.ts +2 -1
  69. package/dist/types/components/test-du/test-du.d.ts +0 -6
  70. package/package.json +2 -2
  71. package/react/{readme.md → .keepfolder} +0 -0
  72. package/dist/cjs/DateUtils-716769e0.js +0 -46
  73. package/dist/cjs/ez-button_3.cjs.entry.js +0 -520
  74. package/dist/cjs/ez-calendar_13.cjs.entry.js +0 -2421
  75. package/dist/cjs/ez-date-time-input.cjs.entry.js +0 -133
  76. package/dist/cjs/ez-icon.cjs.entry.js +0 -30
  77. package/dist/cjs/ez-modal_2.cjs.entry.js +0 -370
  78. package/dist/esm/DateUtils-0a1bbd7a.js +0 -44
  79. package/dist/esm/ez-button_3.entry.js +0 -514
  80. package/dist/esm/ez-calendar_13.entry.js +0 -2405
  81. package/dist/esm/ez-date-time-input.entry.js +0 -129
  82. package/dist/esm/ez-icon.entry.js +0 -26
  83. package/dist/esm/ez-modal_2.entry.js +0 -365
  84. package/dist/ezui/p-00b837e2.js +0 -1
  85. package/dist/ezui/p-0d8368fc.entry.js +0 -1
  86. package/dist/ezui/p-1e36e3ff.entry.js +0 -1
  87. package/dist/ezui/p-446ec85b.js +0 -1
  88. package/dist/ezui/p-49f3432a.entry.js +0 -1
  89. package/dist/ezui/p-c89629eb.js +0 -1
  90. package/dist/ezui/p-d5699f29.entry.js +0 -1
  91. package/dist/ezui/p-d64a3939.entry.js +0 -1
@@ -899,6 +899,7 @@ var Action;
899
899
  Action["DATA_SAVED"] = "dataSaved";
900
900
  Action["RECORDS_REMOVED"] = "recordsRemoved";
901
901
  Action["RECORDS_ADDED"] = "recordsAdded";
902
+ Action["RECORDS_COPIED"] = "recordsCopied";
902
903
  Action["DATA_CHANGED"] = "dataChanged";
903
904
  Action["EDITION_CANCELED"] = "editionCanceled";
904
905
  Action["CHANGE_UNDONE"] = "changeUndone";
@@ -937,7 +938,6 @@ class StateManager {
937
938
  }
938
939
  process(action) {
939
940
  const oldPresent = this._present;
940
- let hasChange = false;
941
941
  let hasHistChange = false;
942
942
  this._histClean = false;
943
943
  this._reducers.forEach(reducer => {
@@ -947,7 +947,6 @@ class StateManager {
947
947
  const newSlice = reducer.reduce(this, oldSlice, action);
948
948
  if (newSlice !== oldSlice) {
949
949
  this.updateSlice(sliceName, newSlice, isHistoric);
950
- hasChange = true;
951
950
  hasHistChange || (hasHistChange = isHistoric);
952
951
  }
953
952
  });
@@ -956,16 +955,6 @@ class StateManager {
956
955
  this._future = [];
957
956
  document.dispatchEvent(new CustomEvent("undoableAction", { detail: this }));
958
957
  }
959
- if (hasChange) {
960
- console.log(JSON.stringify(this, (_key, value) => {
961
- if (value instanceof Map) {
962
- return { dataType: "Map", value: Array.from(value.entries()) };
963
- }
964
- else {
965
- return value;
966
- }
967
- }, 3));
968
- }
969
958
  }
970
959
  select(sliceName, selector) {
971
960
  const isHistoric = this.isHistoric(sliceName);
@@ -1128,11 +1117,8 @@ class AddedRecordsReducerImpl {
1128
1117
  reduce(_stateManager, currentState, action) {
1129
1118
  switch (action.type) {
1130
1119
  case Action.RECORDS_ADDED:
1131
- const newState = currentState ? currentState.slice() : [];
1132
- action.payload.forEach((r) => {
1133
- newState.push(Object.assign({ __record__id__: "NEW_" + (newState.length + 1) }, r));
1134
- });
1135
- return newState;
1120
+ case Action.RECORDS_COPIED:
1121
+ return (currentState || []).concat(action.payload);
1136
1122
  case Action.DATA_SAVED:
1137
1123
  case Action.EDITION_CANCELED:
1138
1124
  return undefined;
@@ -1144,6 +1130,10 @@ const AddedRecordsReducer = new AddedRecordsReducerImpl();
1144
1130
  const getAddedRecords = (stateManager) => {
1145
1131
  return stateManager.select(AddedRecordsReducer.sliceName, (state) => state);
1146
1132
  };
1133
+ const prepareAddedRecordId = (stateManager, source) => {
1134
+ let index = (getAddedRecords(stateManager) || []).length;
1135
+ return source.map(item => { return Object.assign(Object.assign({}, item), { __record__id__: "NEW_" + (index++) }); });
1136
+ };
1147
1137
 
1148
1138
  class ChangesReducerImpl {
1149
1139
  constructor() {
@@ -1156,7 +1146,9 @@ class ChangesReducerImpl {
1156
1146
  if (selection) {
1157
1147
  const newState = new Map(currentState);
1158
1148
  selection.forEach(recordId => {
1159
- newState.set(recordId, Object.assign(Object.assign({}, newState.get(recordId)), action.payload));
1149
+ const newChanges = Object.assign(Object.assign({}, newState.get(recordId)), action.payload);
1150
+ delete newChanges.records;
1151
+ newState.set(recordId, newChanges);
1160
1152
  });
1161
1153
  return newState;
1162
1154
  }
@@ -1185,16 +1177,14 @@ const getChangesToSave = (dataUnit, stateManager) => {
1185
1177
  const result = [];
1186
1178
  const changes = getChanges(stateManager);
1187
1179
  const records = getRecords(stateManager);
1188
- if (records) {
1189
- records.forEach(r => {
1190
- if (changes) {
1191
- const c = changes.get(r.__record__id__);
1192
- if (c) {
1193
- result.push(new Change(dataUnit, r, c, ChangeOperation.UPDATE));
1194
- }
1180
+ records === null || records === void 0 ? void 0 : records.forEach(r => {
1181
+ if (changes) {
1182
+ const c = changes.get(r.__record__id__);
1183
+ if (c) {
1184
+ result.push(new Change(dataUnit, r, c, ChangeOperation.UPDATE));
1195
1185
  }
1196
- });
1197
- }
1186
+ }
1187
+ });
1198
1188
  const addedRecords = getAddedRecords(stateManager);
1199
1189
  if (addedRecords) {
1200
1190
  addedRecords.forEach(r => {
@@ -1203,7 +1193,7 @@ const getChangesToSave = (dataUnit, stateManager) => {
1203
1193
  }
1204
1194
  const removedRecords = getRemovedRecords(stateManager);
1205
1195
  const recordsById = {};
1206
- records.forEach(r => recordsById[r.__record__id__] = r);
1196
+ records === null || records === void 0 ? void 0 : records.forEach(r => recordsById[r.__record__id__] = r);
1207
1197
  if (removedRecords) {
1208
1198
  removedRecords.forEach(id => {
1209
1199
  result.push(new Change(dataUnit, recordsById[id], undefined, ChangeOperation.DELETE));
@@ -1259,6 +1249,9 @@ class SelectionReducerImpl {
1259
1249
  }
1260
1250
  reduce(stateManager, currentState, action) {
1261
1251
  switch (action.type) {
1252
+ case Action.RECORDS_ADDED:
1253
+ case Action.RECORDS_COPIED:
1254
+ return action.payload.map((r) => r.__record__id__);
1262
1255
  case Action.DATA_SAVED:
1263
1256
  return updateSavedIds(stateManager, action.payload.records);
1264
1257
  case Action.RECORDS_REMOVED:
@@ -1360,6 +1353,15 @@ function updateSavedIds(stateManager, savedRecords) {
1360
1353
  return currentSelection;
1361
1354
  }
1362
1355
 
1356
+ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
1357
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1358
+ return new (P || (P = Promise))(function (resolve, reject) {
1359
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1360
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1361
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1362
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1363
+ });
1364
+ };
1363
1365
  class DataUnit {
1364
1366
  constructor(name) {
1365
1367
  this._name = name;
@@ -1376,6 +1378,7 @@ class DataUnit {
1376
1378
  this._observers = [];
1377
1379
  this._filterProviders = [];
1378
1380
  this._sortingProvider = undefined;
1381
+ this._interceptors = [];
1379
1382
  }
1380
1383
  get name() {
1381
1384
  return this._name;
@@ -1401,34 +1404,51 @@ class DataUnit {
1401
1404
  }
1402
1405
  // Loaders
1403
1406
  loadMetadata() {
1404
- this.dispatchAction(Action.LOADING_METADATA);
1405
- if (this.metadataLoader) {
1406
- this.metadataLoader(this._name).then(metadata => this.metadata = metadata);
1407
- }
1407
+ return __awaiter(this, void 0, void 0, function* () {
1408
+ this.dispatchAction(Action.LOADING_METADATA);
1409
+ return new Promise((resolve, fail) => {
1410
+ if (this.metadataLoader) {
1411
+ this.metadataLoader(this._name).then(metadata => {
1412
+ this.metadata = metadata;
1413
+ resolve(this.metadata);
1414
+ }).catch(error => fail(error));
1415
+ }
1416
+ });
1417
+ });
1408
1418
  }
1409
1419
  loadData() {
1410
- this.dispatchAction(Action.LOADING_DATA);
1411
- return new Promise((resolve, fail) => {
1412
- if (this.dataLoader) {
1413
- const sort = this.getSort();
1414
- const filters = this.getFilters();
1415
- this.dataLoader(this._name, sort, filters).then(records => {
1416
- this.records = records;
1417
- resolve(this.records);
1418
- }).catch(() => fail());
1419
- }
1420
+ return __awaiter(this, void 0, void 0, function* () {
1421
+ this.dispatchAction(Action.LOADING_DATA);
1422
+ return new Promise((resolve, fail) => {
1423
+ if (this.dataLoader) {
1424
+ const sort = this.getSort();
1425
+ const filters = this.getFilters();
1426
+ this.dataLoader(this._name, sort, filters).then(records => {
1427
+ this.records = records;
1428
+ resolve(this.records);
1429
+ }).catch(error => fail(error));
1430
+ }
1431
+ });
1420
1432
  });
1421
1433
  }
1422
1434
  saveData() {
1423
- const changes = getChangesToSave(this._name, this._stateManager);
1424
- if (changes.length > 0) {
1425
- this.dispatchAction(Action.SAVING_DATA);
1426
- if (this.saveLoader) {
1427
- this.saveLoader(this._name, changes).then(records => this.dispatchAction(Action.DATA_SAVED, { changes, records }));
1435
+ return __awaiter(this, void 0, void 0, function* () {
1436
+ const changes = getChangesToSave(this._name, this._stateManager);
1437
+ if (changes.length > 0) {
1438
+ this.dispatchAction(Action.SAVING_DATA);
1439
+ return new Promise((resolve, fail) => {
1440
+ if (this.saveLoader) {
1441
+ this.saveLoader(this._name, changes).then(records => this.dispatchAction(Action.DATA_SAVED, { changes, records })).catch(error => fail(error));
1442
+ }
1443
+ });
1428
1444
  }
1429
- }
1445
+ return Promise.resolve();
1446
+ });
1430
1447
  }
1431
1448
  // API
1449
+ addInterceptor(interceptor) {
1450
+ this._interceptors.push(interceptor);
1451
+ }
1432
1452
  addFilterProvider(provider) {
1433
1453
  this._filterProviders.push(provider);
1434
1454
  }
@@ -1452,7 +1472,13 @@ class DataUnit {
1452
1472
  return getField(this._stateManager, fieldName);
1453
1473
  }
1454
1474
  addRecord() {
1455
- this.dispatchAction(Action.RECORDS_ADDED, [{}]);
1475
+ this.dispatchAction(Action.RECORDS_ADDED, prepareAddedRecordId(this._stateManager, [{}]));
1476
+ }
1477
+ copySelected() {
1478
+ const selectedRecords = this.getSelectedRecords();
1479
+ if (selectedRecords) {
1480
+ this.dispatchAction(Action.RECORDS_COPIED, prepareAddedRecordId(this._stateManager, selectedRecords));
1481
+ }
1456
1482
  }
1457
1483
  removeSelectedRecords() {
1458
1484
  const selection = getSelection(this._stateManager);
@@ -1479,6 +1505,13 @@ class DataUnit {
1479
1505
  setSelectionByIndex(selection) {
1480
1506
  this.dispatchAction(Action.SELECTION_CHANGED, { type: "index", selection });
1481
1507
  }
1508
+ getSelectedRecords() {
1509
+ const selection = this.getSelection();
1510
+ if (selection) {
1511
+ const currentRecords = this.records;
1512
+ return currentRecords === null || currentRecords === void 0 ? void 0 : currentRecords.filter(r => selection.includes(r.__record__id__));
1513
+ }
1514
+ }
1482
1515
  nextRecord() {
1483
1516
  this.dispatchAction(Action.NEXT_SELECTED);
1484
1517
  }
@@ -1511,10 +1544,17 @@ class DataUnit {
1511
1544
  }
1512
1545
  // Actions / State manager
1513
1546
  dispatchAction(actionType, payload) {
1514
- const action = new DataUnitAction(actionType, payload);
1515
- //interceptor
1516
- this._stateManager.process(action);
1517
- this._observers.forEach(f => f(action));
1547
+ var _a;
1548
+ let action = new DataUnitAction(actionType, payload);
1549
+ (_a = this._interceptors) === null || _a === void 0 ? void 0 : _a.forEach(interceptor => {
1550
+ if (action) {
1551
+ action = interceptor.interceptAction(action);
1552
+ }
1553
+ });
1554
+ if (action) {
1555
+ this._stateManager.process(action);
1556
+ this._observers.forEach(f => f(action));
1557
+ }
1518
1558
  }
1519
1559
  subscribe(observer) {
1520
1560
  this._observers.push(observer);
@@ -1525,9 +1565,9 @@ class DataUnit {
1525
1565
  }
1526
1566
  var ChangeOperation;
1527
1567
  (function (ChangeOperation) {
1528
- ChangeOperation[ChangeOperation["INSERT"] = 0] = "INSERT";
1529
- ChangeOperation[ChangeOperation["UPDATE"] = 1] = "UPDATE";
1530
- ChangeOperation[ChangeOperation["DELETE"] = 2] = "DELETE";
1568
+ ChangeOperation["INSERT"] = "INSERT";
1569
+ ChangeOperation["UPDATE"] = "UPDATE";
1570
+ ChangeOperation["DELETE"] = "DELETE";
1531
1571
  })(ChangeOperation || (ChangeOperation = {}));
1532
1572
  class Change {
1533
1573
  constructor(dataUnit, record, updates, operation) {
@@ -1536,6 +1576,9 @@ class Change {
1536
1576
  this.updatingFields = updates;
1537
1577
  this._operation = operation;
1538
1578
  }
1579
+ get operation() {
1580
+ return this._operation.toString();
1581
+ }
1539
1582
  isInsert() {
1540
1583
  return this._operation === ChangeOperation.INSERT;
1541
1584
  }
@@ -8654,6 +8697,10 @@ const buildDate = ({ name, label }) => {
8654
8697
  return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
8655
8698
  h("ez-date-input", { label: label, "data-field-name": name, key: name })));
8656
8699
  };
8700
+ const buildTimeDate = ({ name, label }) => {
8701
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
8702
+ h("ez-date-time-input", { label: label, "data-field-name": name, key: name })));
8703
+ };
8657
8704
 
8658
8705
  const buildDecimal = ({ name, label }, properties) => {
8659
8706
  const precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
@@ -8676,6 +8723,7 @@ uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
8676
8723
  uiBuilders.set(UserInterface.SEARCH, buildSearch);
8677
8724
  uiBuilders.set(UserInterface.FILE, buildFile);
8678
8725
  uiBuilders.set(UserInterface.DATE, buildDate);
8726
+ uiBuilders.set(UserInterface.DATETIME, buildTimeDate);
8679
8727
  uiBuilders.set(UserInterface.DECIMALNUMBER, buildDecimal);
8680
8728
  uiBuilders.set(UserInterface.INTEGERNUMBER, buildInteger);
8681
8729
  const buildField = (field) => {
@@ -8762,36 +8810,30 @@ const buildFromConfig = (fields, dataUnit) => {
8762
8810
  if (config.visible !== false) {
8763
8811
  const tab = config.tab || "Geral";
8764
8812
  const descriptor = dataUnit.getField(config.name);
8765
- if (!sheets.has(tab)) {
8766
- sheets.set(tab, new Map());
8767
- }
8768
- let isRequired = false;
8769
- if (config.required === undefined) {
8770
- if (descriptor) {
8771
- isRequired = descriptor.required;
8813
+ if (descriptor) {
8814
+ if (!sheets.has(tab)) {
8815
+ sheets.set(tab, new Map());
8772
8816
  }
8773
- }
8774
- else {
8775
- isRequired = config.required;
8776
- }
8777
- if (isRequired) {
8778
- requiredFields.push(config.name);
8779
- }
8780
- const tabItens = sheets.get(tab);
8781
- const fieldMD = { config, descriptor };
8782
- const group = config.group;
8783
- if (group) {
8784
- const key = `group::${group}`;
8785
- if (!tabItens.has(key)) {
8786
- tabItens.set(key, { label: group, items: [fieldMD] });
8817
+ const isRequired = config.required === undefined ? descriptor.required : config.required;
8818
+ if (isRequired) {
8819
+ requiredFields.push(config.name);
8820
+ }
8821
+ const tabItens = sheets.get(tab);
8822
+ const fieldMD = { config, descriptor };
8823
+ const group = config.group;
8824
+ if (group) {
8825
+ const key = `group::${group}`;
8826
+ if (!tabItens.has(key)) {
8827
+ tabItens.set(key, { label: group, items: [fieldMD] });
8828
+ }
8829
+ else {
8830
+ tabItens.get(key).items.push(fieldMD);
8831
+ }
8787
8832
  }
8788
8833
  else {
8789
- tabItens.get(key).items.push(fieldMD);
8834
+ tabItens.set(config.name, fieldMD);
8790
8835
  }
8791
8836
  }
8792
- else {
8793
- tabItens.set(config.name, fieldMD);
8794
- }
8795
8837
  }
8796
8838
  });
8797
8839
  const metadata = new FormMetadata();
@@ -9170,8 +9212,14 @@ var FormActions;
9170
9212
 
9171
9213
  class DataBinder {
9172
9214
  constructor(dataUnit) {
9173
- this._dataUnit = dataUnit;
9174
9215
  this._fields = new Map();
9216
+ this._dataUnit = dataUnit;
9217
+ this._dataUnit.subscribe(_action => {
9218
+ var _a;
9219
+ (_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
9220
+ this.updateValue(field.fieldName, field.field);
9221
+ });
9222
+ });
9175
9223
  }
9176
9224
  bind(fields) {
9177
9225
  fields.forEach(fieldElement => {
@@ -119609,19 +119657,22 @@ class DataUnitBridge {
119609
119657
  processAction(action) {
119610
119658
  switch (action.type) {
119611
119659
  case Action.METADATA_LOADED:
119612
- const columnDefs = [];
119613
- this._dataUnit.metadata.fields.forEach(f => {
119614
- if (f.visible !== false) {
119615
- columnDefs.push({ label: f.label, name: f.name });
119616
- }
119617
- });
119618
- this._gridController.setColumnsDef(columnDefs, true);
119660
+ this._gridController.setColumnsDef(this.buildColumnDefs(), true);
119619
119661
  break;
119620
119662
  }
119621
119663
  }
119664
+ buildColumnDefs() {
119665
+ const columnDefs = [];
119666
+ this._dataUnit.metadata.fields.forEach(f => {
119667
+ if (f.visible !== false) {
119668
+ columnDefs.push({ label: f.label, name: f.name });
119669
+ }
119670
+ });
119671
+ return columnDefs;
119672
+ }
119622
119673
  }
119623
119674
 
119624
- const ezGridCss = ":host{--ezgrid__header--background-color:var(--background--xlight, #FFF)}.grid__header{display:flex;justify-content:flex-end;align-items:center;background-color:var(--ezgrid__header--background-color)}";
119675
+ const ezGridCss = ".sc-ez-grid-h{display:grid;grid-template-rows:auto 1fr auto;height:100%;width:100%;--ezgrid__header--background-color:var(--background--xlight, #FFF)}.grid__header.sc-ez-grid{display:flex;justify-content:flex-end;align-items:center;background-color:var(--ezgrid__header--background-color)}";
119625
119676
 
119626
119677
  let EzGrid$1 = class extends HTMLElement$1 {
119627
119678
  constructor() {
@@ -119702,6 +119753,9 @@ let EzGrid$1 = class extends HTMLElement$1 {
119702
119753
  serverURL: this.serverUrl,
119703
119754
  dataUnit: this.dataUnit
119704
119755
  });
119756
+ if (this._dataUnitBridge) {
119757
+ this._gridController.setColumnsDef(this._dataUnitBridge.buildColumnDefs(), true);
119758
+ }
119705
119759
  }
119706
119760
  getPaginationControl() {
119707
119761
  if (this.pageSize === -1) {
@@ -121597,13 +121651,12 @@ let EzUpload$1 = class extends HTMLElement$1 {
121597
121651
  static get style() { return ezUploadCss; }
121598
121652
  };
121599
121653
 
121600
- 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)}";
121654
+ const gridConfigCss = ".sc-grid-config-h{--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.sc-grid-config{padding-right:var(--space--medium)}ez-list.sc-grid-config{height:100%}.grid-config__footer.sc-grid-config{padding-top:var(--ez-grid-config__footer--padding-top);display:flex;justify-content:flex-end;width:100%}.hidden.sc-grid-config{display:none}.grid-config__main.sc-grid-config{padding-right:var(--ez-grid-config__main--padding-right);overflow-y:auto}.tabselector-container.sc-grid-config{padding:var(--ez-grid-config__tabselector-container--padding) 0}.button-close.sc-grid-config{padding-left:var(--ez-grid-config__button-close--padding-left)}.title-container.sc-grid-config{display:flex;justify-content:center;align-items:center}.subtitle.sc-grid-config{font-family:var(--ez-grid-config__subtitle--font-family);font-size:var(--ez-grid-config__subtitle--font-size)}.title.sc-grid-config{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.sc-grid-config::-webkit-scrollbar-track{background-color:#f0f2f5}.grid-config__main.sc-grid-config::-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.sc-grid-config::-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)}";
121601
121655
 
121602
121656
  let GridConfig$1 = class extends HTMLElement$1 {
121603
121657
  constructor() {
121604
121658
  super();
121605
121659
  this.__registerHost();
121606
- this.__attachShadow();
121607
121660
  this.configFinish = createEvent(this, "configFinish", 7);
121608
121661
  this.configCancel = createEvent(this, "configCancel", 7);
121609
121662
  this._columnListHistory = [];
@@ -121921,15 +121974,7 @@ let TestDu$1 = class extends HTMLElement$1 {
121921
121974
  }
121922
121975
  ]
121923
121976
  };
121924
- this.formConfig = [
121925
- { name: "CODPARC", label: "Parceiro" },
121926
- { name: "NOMEPARC", label: "Mamão" },
121927
- { name: "P", label: "Pêra", group: "Grupo 1" },
121928
- { name: "ME", label: "Melancia", tab: "aba 1", group: "Grupo 2" },
121929
- { name: "L", label: "Laranja", tab: "aba 1", group: "Grupo 1" },
121930
- { name: "LI", label: "Limão", tab: "aba 1", group: "Grupo 2" }
121931
- ];
121932
- this.dataUnit.records = [
121977
+ this.dataUnit.dataLoader = () => new Promise(accept => accept([
121933
121978
  {
121934
121979
  __record__id__: "1321321321321321",
121935
121980
  CODPARC: 10,
@@ -121938,21 +121983,10 @@ let TestDu$1 = class extends HTMLElement$1 {
121938
121983
  L: "Bagaço",
121939
121984
  LI: "Azedo"
121940
121985
  }
121941
- ];
121986
+ ]));
121942
121987
  }
121943
121988
  render() {
121944
- //return this.conteudoEstatico();
121945
- //return this.somenteDataUnit();
121946
- return this.configurado();
121947
- }
121948
- conteudoEstatico() {
121949
- 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" })))));
121950
- }
121951
- somenteDataUnit() {
121952
- return (h("ez-form", { dataUnit: this.dataUnit }));
121953
- }
121954
- configurado() {
121955
- return (h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig, ref: ref => this.form = ref }));
121989
+ return (h("ez-grid", { dataUnit: this.dataUnit }));
121956
121990
  }
121957
121991
  static get style() { return testDuCss; }
121958
121992
  };
@@ -121968,7 +122002,7 @@ const EzDateInput = /*@__PURE__*/proxyCustomElement(EzDateInput$1, [1,"ez-date-i
121968
122002
  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"]}]);
121969
122003
  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"]}]);
121970
122004
  const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [0,"ez-form",{"dataUnit":[1040],"config":[16]}]);
121971
- 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]}]);
122005
+ const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [2,"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]}]);
121972
122006
  const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513]}]);
121973
122007
  const EzLabelChip = /*@__PURE__*/proxyCustomElement(EzLabelChip$1, [1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540]}]);
121974
122008
  const EzList = /*@__PURE__*/proxyCustomElement(EzList$1, [1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32]}]);
@@ -121983,7 +122017,7 @@ const EzTextInput = /*@__PURE__*/proxyCustomElement(EzTextInput$1, [1,"ez-text-i
121983
122017
  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"]}]);
121984
122018
  const EzToast = /*@__PURE__*/proxyCustomElement(EzToast$1, [1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"]}]);
121985
122019
  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]}]);
121986
- const GridConfig = /*@__PURE__*/proxyCustomElement(GridConfig$1, [1,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]);
122020
+ const GridConfig = /*@__PURE__*/proxyCustomElement(GridConfig$1, [2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]);
121987
122021
  const SelectBox = /*@__PURE__*/proxyCustomElement(SelectBox$1, [1,"select-box",{"selectedOption":[1,"selected-option"]}]);
121988
122022
  const TestDu = /*@__PURE__*/proxyCustomElement(TestDu$1, [0,"test-du"]);
121989
122023
  const defineCustomElements = (opts) => {
@@ -0,0 +1,33 @@
1
+ class ApplicationUtils {
2
+ static async showDialog(title, message, icon = null, confirm, critical = false) {
3
+ return new Promise(resolve => {
4
+ let dialog = document.querySelector("ez-dialog");
5
+ if (!dialog) {
6
+ dialog = document.createElement("ez-dialog");
7
+ window.document.body.appendChild(dialog);
8
+ }
9
+ dialog.show(title, message, critical, confirm, icon).then(ok => resolve(ok));
10
+ });
11
+ }
12
+ static async alert(title, message, icon = null) {
13
+ return ApplicationUtils.showDialog(title, message, icon, false, false);
14
+ }
15
+ static async error(title, message, icon = null) {
16
+ return ApplicationUtils.showDialog(title, message, icon, false, true);
17
+ }
18
+ static async confirm(title, message, icon = null, critical = false) {
19
+ return ApplicationUtils.showDialog(title, message, icon, true, critical);
20
+ }
21
+ static async info(message) {
22
+ let toast = document.querySelector("ez-toast");
23
+ if (!toast) {
24
+ toast = document.createElement("ez-toast");
25
+ window.document.body.appendChild(toast);
26
+ }
27
+ toast.message = message;
28
+ toast.fadeTime = 4000;
29
+ toast.show();
30
+ }
31
+ }
32
+
33
+ export { ApplicationUtils as A };
@@ -1,4 +1,4 @@
1
- import { a as getAssetPath, s as setAssetPath } from './index-077c7fcf.js';
1
+ import { a as getAssetPath, s as setAssetPath } from './index-d80a8d1f.js';
2
2
 
3
3
  const getSpritePath = (sprite) => `${getContextAssetsPath("../assets/actions-sprite.svg")}#${sprite}`;
4
4
  let ctxLoaded = false;
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-077c7fcf.js';
1
+ import { r as registerInstance, c as createEvent, h } from './index-d80a8d1f.js';
2
2
 
3
3
  const ezActionChipCss = ":host{--ez-action-chip--height:36px;--ez-action-chip--border-radius:var(--border--radius-large, 24px);--ez-action-chip__border:1px solid;--ez-action-chip__border-color-strokes:var(--color--strokes, #DCE0E8);--ez-action-chip--font-size:var(--text--medium, 14px);--ez-action-chip--font-family:var(--font-pattern, Arial);--ez-action-chip--font-weight:var(--text-weight--large, 500);--ez-action-chip__label--title--primary:var(--title--primary, #919191);--ez-action-chip__label-color--disable-secondary:var(--color--disable-secondary, #F2F5F8);--ez-action-chip__label__default--background-color--hover:var(--color--primary-200, #f2faf8);--ez-action-chip__label__default--border-color--hover:var(--color--primary-600, #007a5a)}.label__container{width:fit-content;display:flex;flex-wrap:wrap;position:relative;background-color:#FFFFFF;align-items:center;align-self:center;cursor:pointer;color:var(--ez-action-chip__label--title--primary);fill:var(--ez-action-chip__label--title--primary);border:var(--ez-action-chip__border);border-radius:var(--ez-action-chip--border-radius);border-color:var(--ez-action-chip__border-color-strokes);padding-right:var(--space--medium, 12px);padding-left:var(--space--medium, 12px)}.label__container:hover{border-color:var(--ez-action-chip__label__default--border-color--hover);background-color:var(--ez-action-chip__label__default--background-color--hover)}label{display:flex;align-items:center;font-weight:var(--text-weight--large, 600);cursor:pointer;height:var(--ez-action-chip--height);font-family:var(--ez-action-chip--font-family);font-size:var(--ez-action-chip--font-size)}";
4
4
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-077c7fcf.js';
1
+ import { r as registerInstance, c as createEvent, h } from './index-d80a8d1f.js';
2
2
 
3
3
  const ezApplicationCss = "";
4
4