@sankhyalabs/ezui 1.1.77 → 1.1.80

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 (174) hide show
  1. package/dist/cjs/{AssetsUtils-dd585fba.js → AssetsUtils-02db4f46.js} +1 -1
  2. package/dist/cjs/CSSVarsUtils-66e86394.js +18 -0
  3. package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-application.cjs.entry.js +1 -3
  5. package/dist/cjs/ez-button_3.cjs.entry.js +520 -0
  6. package/dist/cjs/ez-calendar_13.cjs.entry.js +2421 -0
  7. package/dist/cjs/ez-date-time-input.cjs.entry.js +26 -37
  8. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  9. package/dist/cjs/{ez-button_11.cjs.entry.js → ez-grid.cjs.entry.js} +14 -1410
  10. package/dist/cjs/ez-icon.cjs.entry.js +30 -0
  11. package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-modal_2.cjs.entry.js +370 -0
  13. package/dist/cjs/ez-popover.cjs.entry.js +2 -2
  14. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-time-input.cjs.entry.js +4 -4
  16. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  17. package/dist/cjs/ezui.cjs.js +2 -2
  18. package/dist/cjs/{index-4e4bae01.js → index-2003dec4.js} +0 -10
  19. package/dist/cjs/{index-262d703b.js → index-a2266984.js} +18 -43
  20. package/dist/cjs/loader.cjs.js +2 -2
  21. package/dist/collection/collection-manifest.json +0 -2
  22. package/dist/collection/components/ez-application/ez-application.js +0 -2
  23. package/dist/collection/components/ez-calendar/ez-calendar.js +7 -2
  24. package/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -5
  25. package/dist/collection/components/ez-combo-box/ez-combo-box.js +4 -0
  26. package/dist/collection/components/ez-date-input/ez-date-input.css +2 -2
  27. package/dist/collection/components/ez-date-input/ez-date-input.js +1 -1
  28. package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +0 -5
  29. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +23 -34
  30. package/dist/collection/components/ez-form/DataBinder.js +44 -0
  31. package/dist/collection/components/ez-form/ez-form.css +1 -15
  32. package/dist/collection/components/ez-form/ez-form.js +112 -427
  33. package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +45 -0
  34. package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +11 -0
  35. package/dist/collection/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.js +14 -0
  36. package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +5 -0
  37. package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +5 -0
  38. package/dist/collection/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.js +13 -0
  39. package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +5 -0
  40. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextArea.tpl.js +5 -0
  41. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextInput.tpl.js +5 -0
  42. package/dist/collection/components/ez-form/store/form.slice.js +38 -0
  43. package/dist/collection/components/ez-form/structure/FormItem.js +11 -0
  44. package/dist/collection/components/ez-form/structure/FormSheet.js +5 -0
  45. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +86 -0
  46. package/dist/collection/components/ez-number-input/ez-number-input.css +0 -9
  47. package/dist/collection/components/ez-number-input/ez-number-input.js +20 -115
  48. package/dist/collection/components/ez-search/ez-search.js +6 -1
  49. package/dist/collection/components/test-du/test-du.js +65 -23
  50. package/dist/collection/utils/CSSVarsUtils.js +6 -6
  51. package/dist/custom-elements/index.d.ts +0 -12
  52. package/dist/custom-elements/index.js +530 -2278
  53. package/dist/esm/{AssetsUtils-3803e935.js → AssetsUtils-76ca41e1.js} +1 -1
  54. package/dist/esm/CSSVarsUtils-aeee9825.js +16 -0
  55. package/dist/esm/ez-action-chip.entry.js +1 -1
  56. package/dist/esm/ez-application.entry.js +1 -3
  57. package/dist/esm/ez-button_3.entry.js +514 -0
  58. package/dist/esm/ez-calendar_13.entry.js +2405 -0
  59. package/dist/esm/ez-date-time-input.entry.js +26 -37
  60. package/dist/esm/ez-dialog.entry.js +1 -1
  61. package/dist/esm/{ez-button_11.entry.js → ez-grid.entry.js} +4 -1390
  62. package/dist/esm/ez-icon.entry.js +26 -0
  63. package/dist/esm/ez-label-chip.entry.js +1 -1
  64. package/dist/esm/ez-modal_2.entry.js +365 -0
  65. package/dist/esm/ez-popover.entry.js +2 -2
  66. package/dist/esm/ez-popup.entry.js +1 -1
  67. package/dist/esm/ez-time-input.entry.js +4 -4
  68. package/dist/esm/ez-toast.entry.js +1 -1
  69. package/dist/esm/ezui.js +2 -2
  70. package/dist/esm/{index-1dacecd3.js → index-077c7fcf.js} +0 -10
  71. package/dist/esm/{index-cfd5e193.js → index-afe19542.js} +17 -40
  72. package/dist/esm/loader.js +2 -2
  73. package/dist/ezui/ezui.esm.js +1 -1
  74. package/dist/ezui/p-00b837e2.js +1 -0
  75. package/dist/ezui/{p-516d0e0f.entry.js → p-0a2056d9.entry.js} +1 -1
  76. package/dist/ezui/p-0d8368fc.entry.js +1 -0
  77. package/dist/ezui/p-1e36e3ff.entry.js +1 -0
  78. package/dist/ezui/p-446ec85b.js +1 -0
  79. package/dist/ezui/p-49f3432a.entry.js +1 -0
  80. package/dist/ezui/{p-1ea8187e.entry.js → p-5509ee41.entry.js} +46 -46
  81. package/dist/ezui/{p-a18a2d7b.entry.js → p-57ea4b84.entry.js} +1 -1
  82. package/dist/ezui/{p-5a86e18a.entry.js → p-6d157776.entry.js} +1 -1
  83. package/dist/ezui/{p-8c51a6aa.entry.js → p-7a1f2e0e.entry.js} +1 -1
  84. package/dist/ezui/p-7de3c95d.js +1 -0
  85. package/dist/ezui/{p-7ef97c5f.entry.js → p-857ead8e.entry.js} +1 -1
  86. package/dist/ezui/p-8b099482.js +1 -0
  87. package/dist/ezui/{p-c6d469fc.entry.js → p-920bb8c9.entry.js} +1 -1
  88. package/dist/ezui/p-a4a39579.entry.js +1 -0
  89. package/dist/ezui/p-d5699f29.entry.js +1 -0
  90. package/dist/ezui/p-d64a3939.entry.js +1 -0
  91. package/dist/ezui/{p-5da66d3e.entry.js → p-da31cd21.entry.js} +1 -1
  92. package/dist/types/components/ez-application/ez-application.d.ts +0 -2
  93. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -0
  94. package/dist/types/components/ez-form/DataBinder.d.ts +10 -0
  95. package/dist/types/components/ez-form/ez-form.d.ts +25 -32
  96. package/dist/types/components/ez-form/fieldbuilder/FieldBuilder.d.ts +2 -0
  97. package/dist/types/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.d.ts +3 -0
  98. package/dist/types/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.d.ts +4 -0
  99. package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +4 -0
  100. package/dist/types/components/ez-form/fieldbuilder/tpl/FileInput.tpl.d.ts +4 -0
  101. package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +8 -0
  102. package/dist/types/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.d.ts +4 -0
  103. package/dist/types/components/ez-form/fieldbuilder/tpl/TextArea.tpl.d.ts +4 -0
  104. package/dist/types/components/ez-form/fieldbuilder/tpl/TextInput.tpl.d.ts +4 -0
  105. package/dist/types/components/ez-form/store/form.slice.d.ts +24 -0
  106. package/dist/types/components/ez-form/structure/FormItem.d.ts +9 -0
  107. package/dist/types/components/ez-form/structure/FormSheet.d.ts +9 -0
  108. package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +27 -0
  109. package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -20
  110. package/dist/types/components/ez-search/ez-search.d.ts +2 -0
  111. package/dist/types/components/test-du/test-du.d.ts +8 -2
  112. package/dist/types/components.d.ts +12 -82
  113. package/dist/types/utils/CSSVarsUtils.d.ts +1 -1
  114. package/package.json +1 -1
  115. package/react/components.d.ts +0 -2
  116. package/react/components.js +0 -2
  117. package/react/components.js.map +1 -1
  118. package/dist/cjs/ApplicationUtils-d1c1db56.js +0 -35
  119. package/dist/cjs/CSSVarsUtils-f8827674.js +0 -18
  120. package/dist/cjs/DataUnit-fdd7c70e.js +0 -474
  121. package/dist/cjs/ez-calendar.cjs.entry.js +0 -212
  122. package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +0 -630
  123. package/dist/cjs/ez-combo-box.cjs.entry.js +0 -250
  124. package/dist/cjs/ez-form.cjs.entry.js +0 -1838
  125. package/dist/cjs/ez-number-input.cjs.entry.js +0 -121
  126. package/dist/cjs/form-metadata.cjs.entry.js +0 -129
  127. package/dist/collection/components/ez-form/assets/trash-can-outline.svg +0 -3
  128. package/dist/collection/components/ez-form/store/Form.actions.js +0 -132
  129. package/dist/collection/components/ez-form/store/Form.reducer.js +0 -194
  130. package/dist/collection/components/ez-form/store/Form.selectors.js +0 -44
  131. package/dist/collection/components/ez-form/subcomponents/DataUnit.js +0 -301
  132. package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +0 -8
  133. package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +0 -24
  134. package/dist/collection/components/ez-form/subcomponents/form-metadata.js +0 -227
  135. package/dist/collection/components/ez-form/subcomponents/place-holder.js +0 -14
  136. package/dist/collection/components/ez-form/subcomponents/structure/Field.js +0 -95
  137. package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +0 -27
  138. package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +0 -41
  139. package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +0 -37
  140. package/dist/esm/ApplicationUtils-01280a9d.js +0 -33
  141. package/dist/esm/CSSVarsUtils-e0128b01.js +0 -16
  142. package/dist/esm/DataUnit-1cd45202.js +0 -464
  143. package/dist/esm/ez-calendar.entry.js +0 -208
  144. package/dist/esm/ez-collapsible-box_6.entry.js +0 -621
  145. package/dist/esm/ez-combo-box.entry.js +0 -246
  146. package/dist/esm/ez-form.entry.js +0 -1834
  147. package/dist/esm/ez-number-input.entry.js +0 -117
  148. package/dist/esm/form-metadata.entry.js +0 -125
  149. package/dist/ezui/assets/trash-can-outline.svg +0 -3
  150. package/dist/ezui/p-37a611ea.js +0 -1
  151. package/dist/ezui/p-45689464.entry.js +0 -1
  152. package/dist/ezui/p-57291f97.entry.js +0 -1
  153. package/dist/ezui/p-69416bec.entry.js +0 -1
  154. package/dist/ezui/p-7107d7ef.js +0 -1
  155. package/dist/ezui/p-88f45a83.entry.js +0 -1
  156. package/dist/ezui/p-8f4851a6.js +0 -1
  157. package/dist/ezui/p-9dfd537e.js +0 -1
  158. package/dist/ezui/p-a223eed8.entry.js +0 -1
  159. package/dist/ezui/p-b36308e7.js +0 -1
  160. package/dist/ezui/p-c0af195b.entry.js +0 -1
  161. package/dist/ezui/p-d1889704.js +0 -1
  162. package/dist/ezui/p-e7ee2836.entry.js +0 -1
  163. package/dist/ezui/p-f7b835cf.entry.js +0 -1
  164. package/dist/types/components/ez-form/store/Form.actions.d.ts +0 -111
  165. package/dist/types/components/ez-form/store/Form.reducer.d.ts +0 -20
  166. package/dist/types/components/ez-form/store/Form.selectors.d.ts +0 -14
  167. package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +0 -91
  168. package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +0 -24
  169. package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +0 -16
  170. package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +0 -3
  171. package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +0 -11
  172. package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +0 -13
  173. package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +0 -14
  174. package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +0 -19
@@ -23,6 +23,88 @@ let EzLabelChip$2 = class extends HTMLElement$1 {
23
23
  static get style() { return ezActionChipCss; }
24
24
  };
25
25
 
26
+ const ezApplicationCss = "";
27
+
28
+ let EzApplication$1 = class extends HTMLElement$1 {
29
+ constructor() {
30
+ super();
31
+ this.__registerHost();
32
+ this.applicationLoaded = createEvent(this, "applicationLoaded", 7);
33
+ }
34
+ componentWillLoad() {
35
+ //Initizalize application
36
+ }
37
+ componentDidLoad() {
38
+ this.applicationLoaded.emit(true);
39
+ }
40
+ render() {
41
+ return (h("div", null));
42
+ }
43
+ static get style() { return ezApplicationCss; }
44
+ };
45
+
46
+ const ezButtonCss = ":host{--ez-button--min-width:100px;--ez-button--height:42px;--ez-button__icon--width:18px;--ez-button__inline__icon--padding:12px;--ez-button--padding-top:var(--space--medium, 12px);--ez-button--padding-bottom:var(--space--medium, 12px);--ez-button--padding-right:var(--space--large, 24px);--ez-button--padding-left:var(--space--large, 24px);--ez-button--color:var(--text--primary, #FFF);--ez-button--font-size:var(--text--medium, 14px);--ez-button--font-family:var(--font-pattern, Arial);--ez-button--font-weight:var(--text-weight--large);--ez-button--background-color:var(--background--medium, #c0c0c0);--ez-button--border-radius:var(--border--radius-large, 12px);--ez-button--border:none;--ez-button--hover--background-color:var(--background--strong, var(--ez-button--background-color));--ez-button--disabled-color:var(--text--disable);--ez-button--disabled--background-color:var(--color--disable-secondary);--ez-button--focus--border:var(--ez-button--border);--ez-button--focus--box-shadow:none;--ez-button--link-color:var(--title--primary, '#C0C0C0')}ez-icon{--ez-icon--color:inherit}button{display:flex;align-items:center;justify-content:center;margin:0;cursor:pointer;transition:background-color 0.2s linear;min-width:var(--ez-button--min-width);height:var(--ez-button--height);font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);padding:var(--ez-button--padding-top) var(--ez-button--padding-right) var(--ez-button--padding-bottom) var(--ez-button--padding-left);border-radius:var(--ez-button--border-radius);background-color:var(--ez-button--background-color);color:var(--ez-button--color);fill:var(--ez-button--color);border:var(--ez-button--border)}button:hover{background-color:var(--ez-button--hover--background-color)}button:focus{outline:none;border:var(--ez-button--focus--border);box-shadow:var(--ez-button--focus--box-shadow)}button:disabled{background-color:var(--ez-button--disabled--background-color);color:var(--ez-button--disabled-color);fill:var(--ez-button--disabled-color);border:none;cursor:no-drop}button.icon{padding:0px}button.small{width:32px;min-width:32px;height:32px}button.medium{width:42px;min-width:42px;height:42px}button.large{width:52px;min-width:52px;height:52px}.label-icon{display:flex;flex-direction:column;align-items:center;color:var(--ez-button--color)}.label-icon label{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight)}a{font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);color:var(--ez-button--link-color);cursor:pointer;display:flex;align-items:center;justify-content:center;}";
47
+
48
+ let EzButton$1 = class extends HTMLElement$1 {
49
+ constructor() {
50
+ super();
51
+ this.__registerHost();
52
+ this.__attachShadow();
53
+ /**
54
+ * Deixa o botão disponível ou não para interação com o usuário.
55
+ */
56
+ this.enabled = true;
57
+ /**
58
+ * Define o modo de uso do botão; opções: icon, link e regular
59
+ */
60
+ this.mode = "regular";
61
+ /**
62
+ * Quando em modo "icon" pode-se escolher entre [small,medium,large] (somente para o modo "icon")
63
+ */
64
+ this.size = "medium";
65
+ }
66
+ getIconSize() {
67
+ return this.size;
68
+ }
69
+ handleSlotChange(ev) {
70
+ const slot = ev.target;
71
+ const content = slot.assignedElements()[0];
72
+ if (this.mode == "link") {
73
+ content.style.display = "inline";
74
+ if (slot.name == "leftIcon") {
75
+ content.style.paddingRight = "var(--ez-button__inline__icon--padding)";
76
+ }
77
+ else if (slot.name == "rightIcon") {
78
+ content.style.paddingLeft = "var(--ez-button__inline__icon--padding)";
79
+ }
80
+ }
81
+ else {
82
+ content.style.setProperty('--ez-icon--color', 'var(--ez-icon--color)');
83
+ }
84
+ }
85
+ render() {
86
+ if (this.mode == "icon") {
87
+ return (h("button", { class: "icon " + this.size, type: "button", disabled: !this.enabled }, h("ez-icon", { class: "icon", href: this.image, size: this.getIconSize(), onClick: evt => {
88
+ if (!this.enabled)
89
+ evt.stopPropagation();
90
+ } })));
91
+ }
92
+ else if (this.mode == "label-icon") {
93
+ return (h("div", { class: "label-icon" }, h("button", { class: "icon", type: "button", disabled: !this.enabled }, h("ez-icon", { class: "icon", href: this.image, size: "large", onClick: evt => {
94
+ if (!this.enabled)
95
+ evt.stopPropagation();
96
+ } })), h("label", { title: this.label }, this.label)));
97
+ }
98
+ else if (this.mode == "link") {
99
+ return (h("a", null, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label, h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
100
+ }
101
+ else {
102
+ return (h("button", { type: "button", disabled: !this.enabled }, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label, h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
103
+ }
104
+ }
105
+ static get style() { return ezButtonCss; }
106
+ };
107
+
26
108
  /**
27
109
  * Classe com utiliários comuns para Strings.
28
110
  */
@@ -1278,7 +1360,7 @@ function updateSavedIds(stateManager, savedRecords) {
1278
1360
  return currentSelection;
1279
1361
  }
1280
1362
 
1281
- class DataUnit$1 {
1363
+ class DataUnit {
1282
1364
  constructor(name) {
1283
1365
  this._name = name;
1284
1366
  this._stateManager = new StateManager([
@@ -1470,12 +1552,12 @@ var SortMode;
1470
1552
  SortMode["ASC"] = "ASC";
1471
1553
  SortMode["DESC"] = "DESC";
1472
1554
  })(SortMode || (SortMode = {}));
1473
- var DependencyType$1;
1555
+ var DependencyType;
1474
1556
  (function (DependencyType) {
1475
1557
  DependencyType["SEARCHING"] = "SEARCHING";
1476
1558
  DependencyType["REQUIREMENT"] = "REQUIREMENT";
1477
1559
  DependencyType["VISIBILITY"] = "REQUIREMENT";
1478
- })(DependencyType$1 || (DependencyType$1 = {}));
1560
+ })(DependencyType || (DependencyType = {}));
1479
1561
  var UserInterface;
1480
1562
  (function (UserInterface) {
1481
1563
  UserInterface["FILE"] = "FILE";
@@ -1496,25 +1578,6 @@ var UserInterface;
1496
1578
  UserInterface["HTML"] = "HTML";
1497
1579
  })(UserInterface || (UserInterface = {}));
1498
1580
 
1499
- class Application {
1500
- constructor() { }
1501
- static get() {
1502
- if (Application.instance === undefined) {
1503
- Application.instance = new Application();
1504
- Application.element = document.querySelector('ez-application');
1505
- }
1506
- return Application.instance;
1507
- }
1508
- onLoaded(listener) {
1509
- var _a;
1510
- (_a = Application.element) === null || _a === void 0 ? void 0 : _a.addEventListener('applicationLoaded', () => listener());
1511
- }
1512
- getResourceID() {
1513
- return "br.com.sankhya.mge.cad.parceiro"; //TODO: Remover mock
1514
- }
1515
- }
1516
- Application.element = null;
1517
-
1518
1581
  var LoadStatus;
1519
1582
  (function (LoadStatus) {
1520
1583
  LoadStatus["DOM_LOADED"] = "DOM_LOADED";
@@ -1528,10 +1591,6 @@ var LoadType;
1528
1591
 
1529
1592
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1530
1593
 
1531
- function getDefaultExportFromCjs (x) {
1532
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1533
- }
1534
-
1535
1594
  function createCommonjsModule(fn, basedir, module) {
1536
1595
  return module = {
1537
1596
  path: basedir,
@@ -7675,89 +7734,6 @@ function HeadersInstanceToPlainObject(headers) {
7675
7734
  //# sourceMappingURL=index.js.map
7676
7735
  });
7677
7736
 
7678
- const ezApplicationCss = "";
7679
-
7680
- let EzApplication$1 = class extends HTMLElement$1 {
7681
- constructor() {
7682
- super();
7683
- this.__registerHost();
7684
- this.applicationLoaded = createEvent(this, "applicationLoaded", 7);
7685
- }
7686
- componentWillLoad() {
7687
- //Initizalize application
7688
- this.application = Application.get();
7689
- }
7690
- componentDidLoad() {
7691
- this.applicationLoaded.emit(true);
7692
- }
7693
- render() {
7694
- return (h("div", null));
7695
- }
7696
- static get style() { return ezApplicationCss; }
7697
- };
7698
-
7699
- const ezButtonCss = ":host{--ez-button--min-width:100px;--ez-button--height:42px;--ez-button__icon--width:18px;--ez-button__inline__icon--padding:12px;--ez-button--padding-top:var(--space--medium, 12px);--ez-button--padding-bottom:var(--space--medium, 12px);--ez-button--padding-right:var(--space--large, 24px);--ez-button--padding-left:var(--space--large, 24px);--ez-button--color:var(--text--primary, #FFF);--ez-button--font-size:var(--text--medium, 14px);--ez-button--font-family:var(--font-pattern, Arial);--ez-button--font-weight:var(--text-weight--large);--ez-button--background-color:var(--background--medium, #c0c0c0);--ez-button--border-radius:var(--border--radius-large, 12px);--ez-button--border:none;--ez-button--hover--background-color:var(--background--strong, var(--ez-button--background-color));--ez-button--disabled-color:var(--text--disable);--ez-button--disabled--background-color:var(--color--disable-secondary);--ez-button--focus--border:var(--ez-button--border);--ez-button--focus--box-shadow:none;--ez-button--link-color:var(--title--primary, '#C0C0C0')}ez-icon{--ez-icon--color:inherit}button{display:flex;align-items:center;justify-content:center;margin:0;cursor:pointer;transition:background-color 0.2s linear;min-width:var(--ez-button--min-width);height:var(--ez-button--height);font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);padding:var(--ez-button--padding-top) var(--ez-button--padding-right) var(--ez-button--padding-bottom) var(--ez-button--padding-left);border-radius:var(--ez-button--border-radius);background-color:var(--ez-button--background-color);color:var(--ez-button--color);fill:var(--ez-button--color);border:var(--ez-button--border)}button:hover{background-color:var(--ez-button--hover--background-color)}button:focus{outline:none;border:var(--ez-button--focus--border);box-shadow:var(--ez-button--focus--box-shadow)}button:disabled{background-color:var(--ez-button--disabled--background-color);color:var(--ez-button--disabled-color);fill:var(--ez-button--disabled-color);border:none;cursor:no-drop}button.icon{padding:0px}button.small{width:32px;min-width:32px;height:32px}button.medium{width:42px;min-width:42px;height:42px}button.large{width:52px;min-width:52px;height:52px}.label-icon{display:flex;flex-direction:column;align-items:center;color:var(--ez-button--color)}.label-icon label{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight)}a{font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);color:var(--ez-button--link-color);cursor:pointer;display:flex;align-items:center;justify-content:center;}";
7700
-
7701
- let EzButton$1 = class extends HTMLElement$1 {
7702
- constructor() {
7703
- super();
7704
- this.__registerHost();
7705
- this.__attachShadow();
7706
- /**
7707
- * Deixa o botão disponível ou não para interação com o usuário.
7708
- */
7709
- this.enabled = true;
7710
- /**
7711
- * Define o modo de uso do botão; opções: icon, link e regular
7712
- */
7713
- this.mode = "regular";
7714
- /**
7715
- * Quando em modo "icon" pode-se escolher entre [small,medium,large] (somente para o modo "icon")
7716
- */
7717
- this.size = "medium";
7718
- }
7719
- getIconSize() {
7720
- return this.size;
7721
- }
7722
- handleSlotChange(ev) {
7723
- const slot = ev.target;
7724
- const content = slot.assignedElements()[0];
7725
- if (this.mode == "link") {
7726
- content.style.display = "inline";
7727
- if (slot.name == "leftIcon") {
7728
- content.style.paddingRight = "var(--ez-button__inline__icon--padding)";
7729
- }
7730
- else if (slot.name == "rightIcon") {
7731
- content.style.paddingLeft = "var(--ez-button__inline__icon--padding)";
7732
- }
7733
- }
7734
- else {
7735
- content.style.setProperty('--ez-icon--color', 'var(--ez-icon--color)');
7736
- }
7737
- }
7738
- render() {
7739
- if (this.mode == "icon") {
7740
- return (h("button", { class: "icon " + this.size, type: "button", disabled: !this.enabled }, h("ez-icon", { class: "icon", href: this.image, size: this.getIconSize(), onClick: evt => {
7741
- if (!this.enabled)
7742
- evt.stopPropagation();
7743
- } })));
7744
- }
7745
- else if (this.mode == "label-icon") {
7746
- return (h("div", { class: "label-icon" }, h("button", { class: "icon", type: "button", disabled: !this.enabled }, h("ez-icon", { class: "icon", href: this.image, size: "large", onClick: evt => {
7747
- if (!this.enabled)
7748
- evt.stopPropagation();
7749
- } })), h("label", { title: this.label }, this.label)));
7750
- }
7751
- else if (this.mode == "link") {
7752
- return (h("a", null, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label, h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
7753
- }
7754
- else {
7755
- return (h("button", { type: "button", disabled: !this.enabled }, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label, h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
7756
- }
7757
- }
7758
- static get style() { return ezButtonCss; }
7759
- };
7760
-
7761
7737
  const ezCalendarCss = ":host{--ez-calendar--font-family:var(--font-pattern, Arial);--ez-calendar--color:var(--title--primary, #626e82);--ez-calendar--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-calendar__body--background-color:var(--background--xlight, #FFF);--ez-calendar__Time--background-color:var(--background--xlight, #FAFAFA);--ez-calendar__body--padding:var(--space--medium, 12px);--ez-calendar__body--border-radius:var(--border--radius-medium, 12px);--ez-calendar__body--shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-calendar__header-line--stroke:2px;--ez-calendar__header-line--color:var(--color--strokes, #C0C0C0);--ez-calendar__nav-btn--fill:var(--text--primary, #008561);--ez-calendar__nav-btn--hover--fill:var(--color--primary, #350404);--ez-calendar__nav-btn--width:10px;--ez-calendar__nav-btn--height:16px;--ez-calendar__nav-btn--previous-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z\"/></svg>');--ez-calendar__nav-btn--next-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>');--ez-calendar__cell--margin:0px var(--space--small, 12px);--ez-calendar__cell--width:var(--space--large, 24px);--ez-calendar__cell--padding:var(--space--extra-small, 3px) 0px;--ez-calendar__cell--border-radius:var(--border--radius-small, 6px);--ez-calendar__cell--over--background-color:var(--color--strokes, #E2F4EF);--ez-calendar__cell--outset--color:var(--color--strokes, #C0C0C0);--ez-calendar__cell--selected--background-color:var(--color--primary, #008561);--ez-calendar__cell--selected--color:var(--color--inverted, #FFF);--ez-calendar__btn-today--color:var(--color--primary);--ez-calendar__btn-today--hover--background-color:var(--color--strokes, #E2F4EF);--ez-calendar__btn-today--border-radius:var(--border--radius-small, 6px);position:relative;display:flex;user-select:none}.calendar{z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-calendar__body--background-color);padding:var(--ez-calendar__body--padding);border-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__header{display:flex;justify-content:space-between;padding-bottom:var(--space--medium, 12px);margin:var(--space--small, 6px) var(--space--, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color)}.calendar__btn-next,.calendar__btn-previous{outline:none;border:none;background-color:unset;cursor:pointer;padding:0px}.calendar__btn-next::after,.calendar__btn-previous::after{content:'';display:flex;background-color:var(--ez-calendar__nav-btn--fill);width:var(--ez-calendar__nav-btn--width);height:var(--ez-calendar__nav-btn--height)}.calendar__btn-previous::after{-webkit-mask-image:var(--ez-calendar__nav-btn--previous-image);mask-image:var(--ez-calendar__nav-btn--previous-image)}.calendar__btn-next::after{-webkit-mask-image:var(--ez-calendar__nav-btn--next-image);mask-image:var(--ez-calendar__nav-btn--next-image)}.calendar__btn-next:hover::after,.calendar__btn-previous:hover::after{background-color:var(--ez-calendar__nav-btn--hover--fill)}.calendar__lbl-month{font-weight:var(--text-weight--large, 600);font-size:var(--title--medium, 16px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__line{display:flex;padding:0px;margin:0px}.calendar__cell{display:flex;justify-content:center;align-content:center;cursor:pointer;font-size:var(--text--small, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);padding:var(--ez-calendar__cell--padding);margin:var(--ez-calendar__cell--margin);min-width:var(--ez-calendar__cell--width);border-radius:var(--ez-calendar__cell--border-radius)}.calendar__cell:hover{background-color:var(--ez-calendar__cell--over--background-color)}.calendar__cell--secondary{color:var(--ez-calendar__cell--outset--color)}.calendar__cell--unselectable:hover{background-color:unset;border-radius:unset;cursor:unset}.calendar__cell--unselectable{font-weight:var(--text-weight--large, 600);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__cell--selected,.calendar__cell--selected:hover{background-color:var(--ez-calendar__cell--selected--background-color);color:var(--ez-calendar__cell--selected--color)}.calendar__body{padding:var(--space--small, 6px) 0px}.calendar__footer{display:flex;flex-direction:column}.calendar__btn-today{border:none;background-color:unset;cursor:pointer;font-weight:var(--text-weight--large, 600);font-size:var(--title--small);padding:var(--space--extra-small, 6px);font-family:var(--ez-calendar--font-family);text-shadow:var(--ez-calendar--text-shadow);color:var(--ez-calendar__btn-today--color);border-radius:var(--ez-calendar__btn-today--border-radius)}.calendar__btn-today:hover{background-color:var(--ez-calendar__btn-today--hover--background-color)}section{display:flex}.calendarTime{margin-left:-10px;display:flex;flex-direction:column;padding:12px 6px;padding-left:16px;padding-bottom:0px;background-color:var(--ez-calendar__Time--background-color);border-top-right-radius:var(--ez-calendar__body--border-radius);border-bottom-right-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__column{height:180px;padding:0px;margin:0px;overflow:auto}.calendar__column::-webkit-scrollbar{width:0px;max-width:0px;min-width:0px}.calendarTime__header{padding-left:6px;padding-right:6px;display:flex;justify-content:space-between;padding-bottom:var(--space--medium, 12px);margin:var(--space--small, 6px) var(--space--, 12px);font-weight:var(--text-weight--large, 600);font-size:var(--title--medium, 16px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.separatorTime{color:#A2ABB9}.endHidden{-webkit-mask-image:linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%)}";
7762
7738
 
7763
7739
  let EzCalendar$1 = class extends HTMLElement$1 {
@@ -7847,10 +7823,15 @@ let EzCalendar$1 = class extends HTMLElement$1 {
7847
7823
  }
7848
7824
  selectDate(d) {
7849
7825
  let newDate = d;
7850
- if (this.value) {
7826
+ if (this.value && (this.time || this.showSeconds)) {
7851
7827
  newDate.setHours(this.value.getHours());
7852
7828
  newDate.setMinutes(this.value.getMinutes());
7853
- newDate.setSeconds(this.value.getSeconds());
7829
+ if (this.showSeconds) {
7830
+ newDate.setSeconds(this.value.getSeconds());
7831
+ }
7832
+ else {
7833
+ newDate.setSeconds(0);
7834
+ }
7854
7835
  }
7855
7836
  this.value = newDate;
7856
7837
  this.ezChange.emit();
@@ -8073,7 +8054,22 @@ let EzCollapsibleBox$1 = class extends HTMLElement$1 {
8073
8054
  static get style() { return ezCollapsibleBoxCss; }
8074
8055
  };
8075
8056
 
8076
- const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn-search--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-search-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-search-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__btn-options--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-options-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-options-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #919191);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium));--ez-combo-box__drop-down-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"16px\"><path d=\"M 1.8585859,3.0707069 7.9999998,9.2121212 14.141414,3.0707069 16,5.0101006 7.9999998,12.929293 0,4.9292932 Z\"/></svg>');--ez-combo-box__search-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"22px\" width=\"22px\"><path d=\"m 9.4,2.3 c 4.1,0 7.4,3.2 7.4,7.2 0,1.8 -0.7,3.4 -1.8,4.7 l 0.3,0.3 h 0.9 l 5.7,5.6 -1.7,1.7 -5.7,-5.6 V 15.3 L 14.3,15 C 13,16.1 11.3,16.7 9.5,16.7 5.3,16.7 2,13.5 2,9.5 2,5.5 5.3,2.3 9.4,2.3 m 0,2.2 c -2.9,0 -5.1,2.2 -5.1,5 0,2.8 2.3,5 5.1,5 2.8,0 5.1,-2.2 5.1,-5 0,-2.8 -2.2,-5 -5.1,-5 z\"/></svg>');--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}ez-text-input{--ez-text-input__input--background-color:var(--ez-combo-box__input--background-color, #FFFFFF);--ez-text-input__input--border-color:var(--ez-combo-box__input--border-color, #DCE0E8)}.list-container{position:relative;width:100%}.options-list{box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-combo-box--background-color--xlight);padding:var(--ez-combo-box--space--small);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);scroll-behavior:smooth;max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small));overflow:auto}.item{text-align:left;display:flex;justify-content:space-between;align-items:center;border-radius:var(--ez-combo-box--border-radius-small);padding:0 var(--ez-combo-box--space--small);list-style-type:none;min-height:var(--ez-combo-box__list-height)}.item--label{text-align:left;flex-basis:85%;flex-grow:1;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.item--value{text-align:right;flex-basis:15%;flex-grow:0;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn-open-options{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-options:disabled{cursor:unset}.btn-open-options::after{content:'';display:flex;background-color:var(--ez-combo-box__btn-options--background-color);width:16px;height:16px;-webkit-mask-image:var(--ez-combo-box__drop-down-image);mask-image:var(--ez-combo-box__drop-down-image)}.btn-open-options:disabled:after{background-color:var(--ez-combo-box__btn-options-disabled--background-color)}.btn-open-options:enabled:hover::after{background-color:var(--ez-combo-box__btn-options-hover--background-color)}.btn-open-search{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-search:disabled{cursor:unset}.btn-open-search::after{content:'';display:flex;background-color:var(--ez-combo-box__btn-search--background-color);width:22px;height:22px;-webkit-mask-image:var(--ez-combo-box__search-image);mask-image:var(--ez-combo-box__search-image)}.btn-open-search:disabled:after{background-color:var(--ez-combo-box__btn-search-disabled--background-color)}.btn-open-search:enabled:hover::after{background-color:var(--ez-combo-box__btn-search-hover--background-color)}";
8057
+ class CSSVarsUtils {
8058
+ static applyVarsTextInput(host, child) {
8059
+ if (child) {
8060
+ CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--background-color');
8061
+ CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--border-color');
8062
+ }
8063
+ }
8064
+ static applyIfExists(host, element, varName) {
8065
+ const prop = getComputedStyle(host).getPropertyValue(varName);
8066
+ if (prop) {
8067
+ element.style.setProperty(varName, prop);
8068
+ }
8069
+ }
8070
+ }
8071
+
8072
+ const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn-search--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-search-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-search-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__btn-options--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-options-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-options-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #919191);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium));--ez-combo-box__drop-down-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"16px\"><path d=\"M 1.8585859,3.0707069 7.9999998,9.2121212 14.141414,3.0707069 16,5.0101006 7.9999998,12.929293 0,4.9292932 Z\"/></svg>');--ez-combo-box__search-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"22px\" width=\"22px\"><path d=\"m 9.4,2.3 c 4.1,0 7.4,3.2 7.4,7.2 0,1.8 -0.7,3.4 -1.8,4.7 l 0.3,0.3 h 0.9 l 5.7,5.6 -1.7,1.7 -5.7,-5.6 V 15.3 L 14.3,15 C 13,16.1 11.3,16.7 9.5,16.7 5.3,16.7 2,13.5 2,9.5 2,5.5 5.3,2.3 9.4,2.3 m 0,2.2 c -2.9,0 -5.1,2.2 -5.1,5 0,2.8 2.3,5 5.1,5 2.8,0 5.1,-2.2 5.1,-5 0,-2.8 -2.2,-5 -5.1,-5 z\"/></svg>');--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}.list-container{position:relative;width:100%}.options-list{box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-combo-box--background-color--xlight);padding:var(--ez-combo-box--space--small);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);scroll-behavior:smooth;max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small));overflow:auto}.item{text-align:left;display:flex;justify-content:space-between;align-items:center;border-radius:var(--ez-combo-box--border-radius-small);padding:0 var(--ez-combo-box--space--small);list-style-type:none;min-height:var(--ez-combo-box__list-height)}.item--label{text-align:left;flex-basis:85%;flex-grow:1;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.item--value{text-align:right;flex-basis:15%;flex-grow:0;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn-open-options{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-options:disabled{cursor:unset}.btn-open-options::after{content:'';display:flex;background-color:var(--ez-combo-box__btn-options--background-color);width:16px;height:16px;-webkit-mask-image:var(--ez-combo-box__drop-down-image);mask-image:var(--ez-combo-box__drop-down-image)}.btn-open-options:disabled:after{background-color:var(--ez-combo-box__btn-options-disabled--background-color)}.btn-open-options:enabled:hover::after{background-color:var(--ez-combo-box__btn-options-hover--background-color)}.btn-open-search{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-search:disabled{cursor:unset}.btn-open-search::after{content:'';display:flex;background-color:var(--ez-combo-box__btn-search--background-color);width:22px;height:22px;-webkit-mask-image:var(--ez-combo-box__search-image);mask-image:var(--ez-combo-box__search-image)}.btn-open-search:disabled:after{background-color:var(--ez-combo-box__btn-search-disabled--background-color)}.btn-open-search:enabled:hover::after{background-color:var(--ez-combo-box__btn-search-hover--background-color)}";
8077
8073
 
8078
8074
  let EzComboBox$1 = class extends HTMLElement$1 {
8079
8075
  constructor() {
@@ -8254,6 +8250,9 @@ let EzComboBox$1 = class extends HTMLElement$1 {
8254
8250
  this._optionsList.remove();
8255
8251
  }
8256
8252
  }
8253
+ componentDidLoad() {
8254
+ CSSVarsUtils.applyVarsTextInput(this.el, this._inputElement);
8255
+ }
8257
8256
  //---------------------------------------------
8258
8257
  // Event handlers
8259
8258
  //---------------------------------------------
@@ -8316,22 +8315,7 @@ let EzComboBox$1 = class extends HTMLElement$1 {
8316
8315
  static get style() { return ezComboBoxCss; }
8317
8316
  };
8318
8317
 
8319
- class CSSVarsUtils {
8320
- static applyVarsTextInput(host, textInput) {
8321
- if (textInput) {
8322
- CSSVarsUtils.applyIfExists(host, textInput, '--text-input__input--background-color');
8323
- CSSVarsUtils.applyIfExists(host, textInput, '--text-input__input--border-color');
8324
- }
8325
- }
8326
- static applyIfExists(host, textInput, varName) {
8327
- const prop = getComputedStyle(host).getPropertyValue(varName);
8328
- if (prop) {
8329
- textInput.style.setProperty(varName, prop);
8330
- }
8331
- }
8332
- }
8333
-
8334
- const ezDateInputCss = ":host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"15px\"><path d=\"M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z\"/></svg>')}.text-input{--ez-text-input__input--background-color:inherit;--ez-text-input__input--border-color:inherit}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:unset}.btn-open-cal::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}";
8318
+ const ezDateInputCss = ":host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"15px\"><path d=\"M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z\"/></svg>')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:unset}.btn-open-cal::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}";
8335
8319
 
8336
8320
  let EzDateInput$1 = class extends HTMLElement$1 {
8337
8321
  constructor() {
@@ -8358,7 +8342,7 @@ let EzDateInput$1 = class extends HTMLElement$1 {
8358
8342
  changeValue(newValue) {
8359
8343
  newValue = newValue == null ? null : DateUtils.clearTime(newValue);
8360
8344
  this._textInput.errorMessage = "";
8361
- if (this.getTextValue(newValue) !== this.getTextValue(this.value)) {
8345
+ if (newValue !== this.value) {
8362
8346
  this.value = newValue;
8363
8347
  this.ezChange.emit();
8364
8348
  }
@@ -8412,7 +8396,7 @@ let EzDateInput$1 = class extends HTMLElement$1 {
8412
8396
  static get style() { return ezDateInputCss; }
8413
8397
  };
8414
8398
 
8415
- const ezDateTimeInputCss = ":host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"15px\"><path d=\"M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z\"/></svg>')}.text-input{--ez-text-input__input--background-color:inherit;--ez-text-input__input--border-color:inherit}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:unset}.btn-open-cal::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}";
8399
+ const ezDateTimeInputCss = ":host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"15px\"><path d=\"M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z\"/></svg>')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:unset}.btn-open-cal::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}";
8416
8400
 
8417
8401
  let EzDateTimeInput$1 = class extends HTMLElement$1 {
8418
8402
  constructor() {
@@ -8447,29 +8431,18 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
8447
8431
  }
8448
8432
  else if (ev.shiftKey && ev.key === "Tab") {
8449
8433
  if (input.selectionStart > 0) {
8450
- let selectIni = input.value.lastIndexOf(":", input.selectionStart);
8451
- selectIni = selectIni === -1 ? input.value.lastIndexOf(" ", input.selectionStart) : selectIni;
8452
- selectIni = selectIni === -1 ? input.value.lastIndexOf("/", input.selectionStart) : selectIni;
8453
- selectIni = selectIni === -1 ? input.selectionStart : selectIni;
8454
- let selectFin = input.value.lastIndexOf(":", selectIni - 1);
8455
- selectFin = selectFin === -1 ? input.value.lastIndexOf(" ", selectIni - 1) : selectFin;
8456
- selectFin = selectFin === -1 ? input.value.lastIndexOf("/", selectIni - 1) : selectFin;
8457
- selectFin = selectFin === -1 ? 0 : selectFin + 1;
8458
- input.setSelectionRange(selectFin, selectIni);
8459
- ev.preventDefault();
8434
+ let selectIni = input.value.lastIndexOf(" ", input.selectionStart);
8435
+ if (selectIni !== -1) {
8436
+ input.setSelectionRange(0, selectIni);
8437
+ ev.preventDefault();
8438
+ }
8460
8439
  }
8461
8440
  }
8462
8441
  else if (ev.key === "Tab") {
8463
8442
  if (input.value.length !== input.selectionEnd) {
8464
- let selectIni = input.value.indexOf("/", input.selectionEnd);
8465
- selectIni = selectIni === -1 ? input.value.indexOf(" ", input.selectionEnd) : selectIni;
8466
- selectIni = selectIni === -1 ? input.value.indexOf(":", input.selectionEnd) : selectIni;
8443
+ let selectIni = input.value.indexOf(" ", input.selectionEnd);
8467
8444
  selectIni = selectIni === -1 ? input.selectionEnd : selectIni + 1;
8468
- let selectFin = input.value.indexOf("/", selectIni);
8469
- selectFin = selectFin === -1 ? input.value.indexOf(" ", selectIni) : selectFin;
8470
- selectFin = selectFin === -1 ? input.value.indexOf(":", selectIni) : selectFin;
8471
- selectFin = selectFin === -1 ? input.value.length : selectFin;
8472
- input.setSelectionRange(selectIni, selectFin);
8445
+ input.setSelectionRange(selectIni, input.value.length);
8473
8446
  ev.preventDefault();
8474
8447
  }
8475
8448
  }
@@ -8477,27 +8450,22 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
8477
8450
  onFocused() {
8478
8451
  const input = this._textInput.shadowRoot.querySelector('input');
8479
8452
  if (input.selectionStart !== input.selectionEnd) {
8480
- let selectFin = input.value.indexOf("/");
8481
- selectFin = selectFin === -1 ? input.value.indexOf(" ") : selectFin;
8482
- selectFin = selectFin === -1 ? input.value.indexOf(":") : selectFin;
8483
- selectFin = selectFin === -1 ? input.value.length : selectFin;
8484
- input.setSelectionRange(0, selectFin);
8453
+ let selectIni = input.value.indexOf(" ", input.selectionStart);
8454
+ selectIni = selectIni === -1 ? input.value.length : selectIni;
8455
+ input.setSelectionRange(0, selectIni);
8485
8456
  }
8486
8457
  }
8487
8458
  onClicked() {
8488
8459
  const input = this._textInput.shadowRoot.querySelector('input');
8489
- let selectIni = input.value.indexOf("/", input.selectionEnd);
8490
- selectIni = selectIni === -1 ? input.value.indexOf(" ", input.selectionEnd) : selectIni;
8491
- selectIni = selectIni === -1 ? input.value.indexOf(":", input.selectionEnd) : selectIni;
8492
- let selectFin = input.value.lastIndexOf(":", input.selectionEnd);
8493
- selectFin = selectFin === -1 ? input.value.lastIndexOf(" ", selectIni - 1) : selectFin;
8494
- selectFin = selectFin === -1 ? input.value.lastIndexOf("/", selectIni - 1) : selectFin;
8495
- selectFin = selectFin === -1 ? 0 : selectFin + 1;
8496
- input.setSelectionRange(selectFin, selectIni);
8460
+ let selectIni = input.value.lastIndexOf(" ", input.selectionEnd);
8461
+ selectIni = selectIni === -1 ? 0 : selectIni + 1;
8462
+ selectIni = selectIni > input.selectionEnd ? 0 : selectIni;
8463
+ let selectFin = selectIni === 0 ? input.value.indexOf(" ") : input.value.length;
8464
+ input.setSelectionRange(selectIni, selectFin);
8497
8465
  }
8498
8466
  changeValue(newValue) {
8499
8467
  this._textInput.errorMessage = "";
8500
- if (this.getTextValue(newValue) !== this.getTextValue(this.value)) {
8468
+ if (newValue !== this.value) {
8501
8469
  this.value = newValue;
8502
8470
  this.ezChange.emit();
8503
8471
  }
@@ -8509,7 +8477,12 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
8509
8477
  }
8510
8478
  parseDate() {
8511
8479
  const strValue = this._textInput.value;
8512
- const parsedDate = DateUtils.strToDate(strValue);
8480
+ const partsDateTime = (strValue && strValue.length > 0) ? strValue.split(" ") : [];
8481
+ const onlyDate = partsDateTime.length > 0 ? partsDateTime[0] : strValue;
8482
+ const onlyTime = partsDateTime[1] ? partsDateTime[1] : "";
8483
+ const parsedTime = TimeFormatter.prepareValue(onlyTime, this.showSeconds);
8484
+ const strDateTime = onlyDate + (parsedTime && " " + parsedTime);
8485
+ const parsedDate = DateUtils.strToDate(strDateTime);
8513
8486
  if (parsedDate || !strValue) {
8514
8487
  if (this.value === parsedDate) {
8515
8488
  this.changeValue(this.value);
@@ -8632,58 +8605,206 @@ let EzDialog$1 = class extends HTMLElement$1 {
8632
8605
  static get style() { return ezDialogCss; }
8633
8606
  };
8634
8607
 
8635
- function _defineProperty(obj, key, value) {
8636
- if (key in obj) {
8637
- Object.defineProperty(obj, key, {
8638
- value: value,
8639
- enumerable: true,
8640
- configurable: true,
8641
- writable: true
8642
- });
8643
- } else {
8644
- obj[key] = value;
8645
- }
8608
+ const buildTextArea = ({ name, label }) => {
8609
+ return (h("div", { class: "col col--sd-12 padding--small", key: name },
8610
+ h("ez-text-area", { label: label, "data-field-name": name })));
8611
+ };
8612
+
8613
+ const buildTextInput = ({ name, label }) => {
8614
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
8615
+ h("ez-text-input", { label: label, "data-field-name": name, key: name })));
8616
+ };
8646
8617
 
8647
- return obj;
8618
+ const buildSwitch = (fieldConfig) => {
8619
+ return buildField$1(fieldConfig.name, fieldConfig.label, true);
8620
+ };
8621
+ const buildCheckBox = (fieldConfig) => {
8622
+ return buildField$1(fieldConfig.name, fieldConfig.label, false);
8623
+ };
8624
+ function buildField$1(fieldName, fieldLabel, switchMode = false) {
8625
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding--small align--middle padding-bottom--large" },
8626
+ h("ez-check", { label: fieldLabel, mode: switchMode ? "switch" : "regular", "data-field-name": fieldName, key: fieldName })));
8648
8627
  }
8649
8628
 
8650
- function ownKeys(object, enumerableOnly) {
8651
- var keys = Object.keys(object);
8629
+ const buildComboBox = ({ name, label }, properties) => {
8630
+ const prop = properties === null || properties === void 0 ? void 0 : properties.options;
8631
+ let options;
8632
+ if (typeof prop === "string") {
8633
+ const parsed = JSON.parse(prop);
8634
+ options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
8635
+ }
8636
+ else {
8637
+ options = prop;
8638
+ }
8639
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
8640
+ h("ez-combo-box", { label: label, "data-field-name": name, key: name, options: options })));
8641
+ };
8652
8642
 
8653
- if (Object.getOwnPropertySymbols) {
8654
- var symbols = Object.getOwnPropertySymbols(object);
8643
+ const buildSearch = ({ name, label }) => {
8644
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
8645
+ h("ez-search", { label: label, optionLoader: (_argument) => { }, "data-field-name": name, key: name })));
8646
+ };
8655
8647
 
8656
- if (enumerableOnly) {
8657
- symbols = symbols.filter(function (sym) {
8658
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
8659
- });
8660
- }
8648
+ const buildFile = ({ name, label }) => {
8649
+ return (h("div", { class: "col col--sd-12 padding--small" },
8650
+ h("ez-upload", { label: label, urlUpload: "", requestHeaders: "", maxFiles: 10, "data-field-name": name, key: name })));
8651
+ };
8661
8652
 
8662
- keys.push.apply(keys, symbols);
8663
- }
8653
+ const buildDate = ({ name, label }) => {
8654
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
8655
+ h("ez-date-input", { label: label, "data-field-name": name, key: name })));
8656
+ };
8664
8657
 
8665
- return keys;
8658
+ const buildDecimal = ({ name, label }, properties) => {
8659
+ const precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
8660
+ const prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
8661
+ return buildNumeric(name, label, precision, prettyPrecision);
8662
+ };
8663
+ const buildInteger = ({ name, label }) => {
8664
+ return buildNumeric(name, label, 0, 0);
8665
+ };
8666
+ function buildNumeric(fieldName, fieldLabel, precision, prettyPrecision) {
8667
+ return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
8668
+ h("ez-number-input", { label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, key: fieldName })));
8666
8669
  }
8667
8670
 
8668
- function _objectSpread2(target) {
8669
- for (var i = 1; i < arguments.length; i++) {
8670
- var source = arguments[i] != null ? arguments[i] : {};
8671
-
8672
- if (i % 2) {
8673
- ownKeys(Object(source), true).forEach(function (key) {
8674
- _defineProperty(target, key, source[key]);
8675
- });
8676
- } else if (Object.getOwnPropertyDescriptors) {
8677
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
8678
- } else {
8679
- ownKeys(Object(source)).forEach(function (key) {
8680
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
8681
- });
8671
+ const uiBuilders = new Map();
8672
+ uiBuilders.set(UserInterface.LONGTEXT, buildTextArea);
8673
+ uiBuilders.set(UserInterface.CHECKBOX, buildCheckBox);
8674
+ uiBuilders.set(UserInterface.SWITCH, buildSwitch);
8675
+ uiBuilders.set(UserInterface.OPTIONSELECTOR, buildComboBox);
8676
+ uiBuilders.set(UserInterface.SEARCH, buildSearch);
8677
+ uiBuilders.set(UserInterface.FILE, buildFile);
8678
+ uiBuilders.set(UserInterface.DATE, buildDate);
8679
+ uiBuilders.set(UserInterface.DECIMALNUMBER, buildDecimal);
8680
+ uiBuilders.set(UserInterface.INTEGERNUMBER, buildInteger);
8681
+ const buildField = (field) => {
8682
+ const descriptor = field.descriptor;
8683
+ const config = Object.assign({}, field.config);
8684
+ let builder;
8685
+ let props;
8686
+ if (descriptor) {
8687
+ builder = uiBuilders.get(descriptor.userInterface);
8688
+ if (!config.label) {
8689
+ config.label = descriptor.label;
8690
+ }
8691
+ if (!config.name) {
8692
+ config.name = descriptor.name;
8693
+ }
8694
+ if (config.required === undefined) {
8695
+ config.required = descriptor.required;
8682
8696
  }
8697
+ props = descriptor.properties;
8698
+ }
8699
+ if (config.required) {
8700
+ config.label = `* ${config.label} (obrigatório)`;
8701
+ }
8702
+ if (!builder) {
8703
+ builder = buildTextInput;
8704
+ }
8705
+ return builder(config, props);
8706
+ };
8707
+
8708
+ const FormItem = ({ source }) => {
8709
+ if ("items" in source) {
8710
+ const fieldSet = source;
8711
+ return h("ez-collapsible-box", { label: source.label }, fieldSet.items.map(fi => buildField(fi)));
8712
+ }
8713
+ else {
8714
+ return buildField(source);
8683
8715
  }
8716
+ };
8684
8717
 
8685
- return target;
8718
+ const FormSheet = ({ store, source }) => {
8719
+ return (h("div", { class: "box__container" }, source.items.map(item => h(FormItem, { store: store, source: item }))));
8720
+ };
8721
+
8722
+ class FormMetadata {
8723
+ constructor() {
8724
+ this._sheets = new Map();
8725
+ this._requiredFields = [];
8726
+ }
8727
+ getSheet(name) {
8728
+ return this._sheets.get(name);
8729
+ }
8730
+ getAllSheets() {
8731
+ return this._sheets;
8732
+ }
8733
+ addSheet(sheet) {
8734
+ this._sheets.set(sheet.name, sheet);
8735
+ this._requiredFields = this._requiredFields.concat(sheet.requiredFields);
8736
+ }
8737
+ getRequiredFields() {
8738
+ return this._requiredFields;
8739
+ }
8686
8740
  }
8741
+ const buildFromDataUnit = (dataUnit) => {
8742
+ var _a;
8743
+ const unitMD = dataUnit.metadata;
8744
+ const metadata = new FormMetadata();
8745
+ if (unitMD) {
8746
+ const visibleFields = (_a = unitMD.fields) === null || _a === void 0 ? void 0 : _a.filter(descriptor => descriptor.visible !== false);
8747
+ metadata.addSheet({
8748
+ label: unitMD.label,
8749
+ name: unitMD.name,
8750
+ items: visibleFields.map(descriptor => { return { descriptor }; }),
8751
+ requiredFields: visibleFields
8752
+ .filter(descriptor => descriptor.required)
8753
+ .map(descriptor => descriptor.name)
8754
+ });
8755
+ }
8756
+ return metadata;
8757
+ };
8758
+ const buildFromConfig = (fields, dataUnit) => {
8759
+ const sheets = new Map();
8760
+ const requiredFields = [];
8761
+ fields.forEach(config => {
8762
+ if (config.visible !== false) {
8763
+ const tab = config.tab || "Geral";
8764
+ 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;
8772
+ }
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] });
8787
+ }
8788
+ else {
8789
+ tabItens.get(key).items.push(fieldMD);
8790
+ }
8791
+ }
8792
+ else {
8793
+ tabItens.set(config.name, fieldMD);
8794
+ }
8795
+ }
8796
+ });
8797
+ const metadata = new FormMetadata();
8798
+ sheets.forEach((value, key) => {
8799
+ metadata.addSheet({
8800
+ label: key,
8801
+ name: key,
8802
+ items: Array.from(value.values()),
8803
+ requiredFields
8804
+ });
8805
+ });
8806
+ return metadata;
8807
+ };
8687
8808
 
8688
8809
  /**
8689
8810
  * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
@@ -9008,1145 +9129,88 @@ function createStore(reducer, preloadedState, enhancer) {
9008
9129
  }, _ref2[$$observable] = observable, _ref2;
9009
9130
  }
9010
9131
 
9011
- function assertReducerShape(reducers) {
9012
- Object.keys(reducers).forEach(function (key) {
9013
- var reducer = reducers[key];
9014
- var initialState = reducer(undefined, {
9015
- type: ActionTypes.INIT
9016
- });
9017
-
9018
- if (typeof initialState === 'undefined') {
9019
- throw new Error(formatProdErrorMessage(12) );
9020
- }
9021
-
9022
- if (typeof reducer(undefined, {
9023
- type: ActionTypes.PROBE_UNKNOWN_ACTION()
9024
- }) === 'undefined') {
9025
- throw new Error(formatProdErrorMessage(13) );
9026
- }
9027
- });
9028
- }
9029
- /**
9030
- * Turns an object whose values are different reducer functions, into a single
9031
- * reducer function. It will call every child reducer, and gather their results
9032
- * into a single state object, whose keys correspond to the keys of the passed
9033
- * reducer functions.
9034
- *
9035
- * @param {Object} reducers An object whose values correspond to different
9036
- * reducer functions that need to be combined into one. One handy way to obtain
9037
- * it is to use ES6 `import * as reducers` syntax. The reducers may never return
9038
- * undefined for any action. Instead, they should return their initial state
9039
- * if the state passed to them was undefined, and the current state for any
9040
- * unrecognized action.
9041
- *
9042
- * @returns {Function} A reducer function that invokes every reducer inside the
9043
- * passed object, and builds a state object with the same shape.
9044
- */
9045
-
9046
-
9047
- function combineReducers(reducers) {
9048
- var reducerKeys = Object.keys(reducers);
9049
- var finalReducers = {};
9050
-
9051
- for (var i = 0; i < reducerKeys.length; i++) {
9052
- var key = reducerKeys[i];
9053
-
9054
- if (typeof reducers[key] === 'function') {
9055
- finalReducers[key] = reducers[key];
9056
- }
9057
- }
9058
-
9059
- var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
9060
-
9061
- var shapeAssertionError;
9062
-
9063
- try {
9064
- assertReducerShape(finalReducers);
9065
- } catch (e) {
9066
- shapeAssertionError = e;
9067
- }
9068
-
9069
- return function combination(state, action) {
9070
- if (state === void 0) {
9071
- state = {};
9072
- }
9073
-
9074
- if (shapeAssertionError) {
9075
- throw shapeAssertionError;
9076
- }
9077
-
9078
- var hasChanged = false;
9079
- var nextState = {};
9080
-
9081
- for (var _i = 0; _i < finalReducerKeys.length; _i++) {
9082
- var _key = finalReducerKeys[_i];
9083
- var reducer = finalReducers[_key];
9084
- var previousStateForKey = state[_key];
9085
- var nextStateForKey = reducer(previousStateForKey, action);
9086
-
9087
- if (typeof nextStateForKey === 'undefined') {
9088
- throw new Error(formatProdErrorMessage(14) );
9089
- }
9090
-
9091
- nextState[_key] = nextStateForKey;
9092
- hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
9093
- }
9094
-
9095
- hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
9096
- return hasChanged ? nextState : state;
9097
- };
9098
- }
9099
-
9100
- /**
9101
- * Composes single-argument functions from right to left. The rightmost
9102
- * function can take multiple arguments as it provides the signature for
9103
- * the resulting composite function.
9104
- *
9105
- * @param {...Function} funcs The functions to compose.
9106
- * @returns {Function} A function obtained by composing the argument functions
9107
- * from right to left. For example, compose(f, g, h) is identical to doing
9108
- * (...args) => f(g(h(...args))).
9109
- */
9110
- function compose() {
9111
- for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
9112
- funcs[_key] = arguments[_key];
9113
- }
9114
-
9115
- if (funcs.length === 0) {
9116
- return function (arg) {
9117
- return arg;
9118
- };
9119
- }
9120
-
9121
- if (funcs.length === 1) {
9122
- return funcs[0];
9132
+ const inicialState = {};
9133
+ /////////////////////////////// REDUCERS ///////////////////////////////
9134
+ function formReducer(state = inicialState, action) {
9135
+ switch (action.type) {
9136
+ case FormActions.METADATA_LOADED:
9137
+ return Object.assign(Object.assign({}, state), { formMetadata: action.payload });
9138
+ case FormActions.CHANGE_TAB:
9139
+ return Object.assign(Object.assign({}, state), { currentSheet: action.payload });
9140
+ default:
9141
+ return state;
9123
9142
  }
9124
-
9125
- return funcs.reduce(function (a, b) {
9126
- return function () {
9127
- return a(b.apply(void 0, arguments));
9128
- };
9129
- });
9130
9143
  }
9131
-
9132
- /**
9133
- * Creates a store enhancer that applies middleware to the dispatch method
9134
- * of the Redux store. This is handy for a variety of tasks, such as expressing
9135
- * asynchronous actions in a concise manner, or logging every action payload.
9136
- *
9137
- * See `redux-thunk` package as an example of the Redux middleware.
9138
- *
9139
- * Because middleware is potentially asynchronous, this should be the first
9140
- * store enhancer in the composition chain.
9141
- *
9142
- * Note that each middleware will be given the `dispatch` and `getState` functions
9143
- * as named arguments.
9144
- *
9145
- * @param {...Function} middlewares The middleware chain to be applied.
9146
- * @returns {Function} A store enhancer applying the middleware.
9147
- */
9148
-
9149
- function applyMiddleware() {
9150
- for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
9151
- middlewares[_key] = arguments[_key];
9152
- }
9153
-
9154
- return function (createStore) {
9155
- return function () {
9156
- var store = createStore.apply(void 0, arguments);
9157
-
9158
- var _dispatch = function dispatch() {
9159
- throw new Error(formatProdErrorMessage(15) );
9160
- };
9161
-
9162
- var middlewareAPI = {
9163
- getState: store.getState,
9164
- dispatch: function dispatch() {
9165
- return _dispatch.apply(void 0, arguments);
9166
- }
9167
- };
9168
- var chain = middlewares.map(function (middleware) {
9169
- return middleware(middlewareAPI);
9170
- });
9171
- _dispatch = compose.apply(void 0, chain)(store.dispatch);
9172
- return _objectSpread2(_objectSpread2({}, store), {}, {
9173
- dispatch: _dispatch
9174
- });
9175
- };
9176
- };
9177
- }
9178
-
9179
- /** A function that accepts a potential "extra argument" value to be injected later,
9180
- * and returns an instance of the thunk middleware that uses that value
9181
- */
9182
- function createThunkMiddleware(extraArgument) {
9183
- // Standard Redux middleware definition pattern:
9184
- // See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware
9185
- var middleware = function middleware(_ref) {
9186
- var dispatch = _ref.dispatch,
9187
- getState = _ref.getState;
9188
- return function (next) {
9189
- return function (action) {
9190
- // The thunk middleware looks for any functions that were passed to `store.dispatch`.
9191
- // If this "action" is really a function, call it and return the result.
9192
- if (typeof action === 'function') {
9193
- // Inject the store's `dispatch` and `getState` methods, as well as any "extra arg"
9194
- return action(dispatch, getState, extraArgument);
9195
- } // Otherwise, pass the action down the middleware chain as usual
9196
-
9197
-
9198
- return next(action);
9199
- };
9200
- };
9201
- };
9202
-
9203
- return middleware;
9204
- }
9205
-
9206
- var thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version
9207
- // with whatever "extra arg" they want to inject into their thunks
9208
-
9209
- thunk.withExtraArgument = createThunkMiddleware;
9210
-
9211
- function changeFieldValue$1(dataUnit, recordId, fieldName, value) {
9144
+ /////////////////////////////// ACTION CREATORS ///////////////////////////////
9145
+ function loadMetadata(formMetadata) {
9212
9146
  return {
9213
- type: "FORM/CHANGEFIELD",
9214
- payload: { dataUnit, recordId, fieldName, value }
9147
+ type: FormActions.METADATA_LOADED,
9148
+ payload: formMetadata
9215
9149
  };
9216
9150
  }
9217
- function changeTab$1(formId, index) {
9151
+ function changeTab(currentSheet) {
9218
9152
  return {
9219
- type: "FORM/CHANGETAB",
9220
- payload: { formId, index }
9153
+ type: FormActions.CHANGE_TAB,
9154
+ payload: currentSheet
9221
9155
  };
9222
9156
  }
9223
- function clearEdition$1(dataUnit, recordsLimit) {
9224
- return {
9225
- type: "FORM/CLEAREDITION",
9226
- payload: {
9227
- dataUnit,
9228
- recordsLimit
9229
- }
9230
- };
9157
+ /////////////////////////////// SELECTORS ///////////////////////////////
9158
+ function selectFormMetadata(state) {
9159
+ return state.formMetadata;
9231
9160
  }
9232
- function collapseExpandGroup(collapseId, collapsed) {
9233
- return {
9234
- type: "FORM/COLLAPSEGROUP",
9235
- payload: { collapseId, collapsed }
9236
- };
9237
- }
9238
- function previousRecord(dataUnit) {
9239
- return {
9240
- type: "FORM/NAVIGATE",
9241
- payload: {
9242
- dataUnit,
9243
- limit: 0,
9244
- backward: true
9245
- }
9246
- };
9247
- }
9248
- function nextRecord(dataUnit, limit) {
9249
- return {
9250
- type: "FORM/NAVIGATE",
9251
- payload: {
9252
- dataUnit,
9253
- limit,
9254
- backward: false
9255
- }
9256
- };
9257
- }
9258
- function insertRecord$1(dataUnit, insertionIndex) {
9259
- return {
9260
- type: "FORM/INSERT",
9261
- payload: {
9262
- dataUnit,
9263
- insertionIndex
9264
- }
9265
- };
9266
- }
9267
- function formLoad() {
9268
- return {
9269
- type: "FORM/LOAD"
9270
- };
9271
- }
9272
- function dataLoading$1(dataUnit) {
9273
- return {
9274
- type: "FORM/DATALOADING",
9275
- payload: {
9276
- dataUnit
9277
- }
9278
- };
9279
- }
9280
- function savingChanges$1(dataUnit) {
9281
- return {
9282
- type: "FORM/SAVINGCHANGES",
9283
- payload: {
9284
- dataUnit
9285
- }
9286
- };
9287
- }
9288
- function dataLoaded$1(dataUnit) {
9289
- return {
9290
- type: "FORM/DATALOADED",
9291
- payload: {
9292
- dataUnit
9293
- }
9294
- };
9295
- }
9296
- function changesSaved$1(dataUnit) {
9297
- return {
9298
- type: "FORM/CHANGESSAVED",
9299
- payload: {
9300
- dataUnit
9301
- }
9302
- };
9303
- }
9304
- function removingRecord$1(dataUnit) {
9305
- return {
9306
- type: "FORM/REMOVINGRECORD",
9307
- payload: {
9308
- dataUnit
9309
- }
9310
- };
9311
- }
9312
- function recordRemoved$1(dataUnit) {
9313
- return {
9314
- type: "FORM/RECORDREMOVED",
9315
- payload: {
9316
- dataUnit
9317
- }
9318
- };
9319
- }
9320
- function invalidField$1(tabController, tabIndex, dataUnit, recordIndex, recordId, fieldName, errorMessage) {
9321
- return {
9322
- type: "FORM/INVALIDFIELD",
9323
- payload: {
9324
- tabController,
9325
- tabIndex,
9326
- dataUnit,
9327
- recordId,
9328
- recordIndex,
9329
- fieldName,
9330
- errorMessage
9331
- }
9332
- };
9333
- }
9334
- function showHideNavigationButtons(buttonName, status) {
9335
- return {
9336
- type: "FORM/SHOWHIDENAVBTN",
9337
- payload: {
9338
- buttonName,
9339
- status
9340
- }
9341
- };
9161
+ function selectCurrentSheet(state) {
9162
+ return state.currentSheet ? state.formMetadata.getSheet(state.currentSheet) : Array.from(state.formMetadata.getAllSheets().values())[0];
9342
9163
  }
9164
+ /////////////////////////////// TYPES ///////////////////////////////
9165
+ var FormActions;
9166
+ (function (FormActions) {
9167
+ FormActions["METADATA_LOADED"] = "FORM/METADATA_LOADED";
9168
+ FormActions["CHANGE_TAB"] = "FORM/CHANGE_TAB";
9169
+ })(FormActions || (FormActions = {}));
9343
9170
 
9344
- var actions = createCommonjsModule(function (module, exports) {
9345
-
9346
- Object.defineProperty(exports, "__esModule", {
9347
- value: true
9348
- });
9349
- exports.ActionCreators = exports.ActionTypes = void 0;
9350
- var ActionTypes = {
9351
- UNDO: '@@redux-undo/UNDO',
9352
- REDO: '@@redux-undo/REDO',
9353
- JUMP_TO_FUTURE: '@@redux-undo/JUMP_TO_FUTURE',
9354
- JUMP_TO_PAST: '@@redux-undo/JUMP_TO_PAST',
9355
- JUMP: '@@redux-undo/JUMP',
9356
- CLEAR_HISTORY: '@@redux-undo/CLEAR_HISTORY'
9357
- };
9358
- exports.ActionTypes = ActionTypes;
9359
- var ActionCreators = {
9360
- undo: function undo() {
9361
- return {
9362
- type: ActionTypes.UNDO
9363
- };
9364
- },
9365
- redo: function redo() {
9366
- return {
9367
- type: ActionTypes.REDO
9368
- };
9369
- },
9370
- jumpToFuture: function jumpToFuture(index) {
9371
- return {
9372
- type: ActionTypes.JUMP_TO_FUTURE,
9373
- index: index
9374
- };
9375
- },
9376
- jumpToPast: function jumpToPast(index) {
9377
- return {
9378
- type: ActionTypes.JUMP_TO_PAST,
9379
- index: index
9380
- };
9381
- },
9382
- jump: function jump(index) {
9383
- return {
9384
- type: ActionTypes.JUMP,
9385
- index: index
9386
- };
9387
- },
9388
- clearHistory: function clearHistory() {
9389
- return {
9390
- type: ActionTypes.CLEAR_HISTORY
9391
- };
9392
- }
9393
- };
9394
- exports.ActionCreators = ActionCreators;
9395
- });
9396
-
9397
- var helpers = createCommonjsModule(function (module, exports) {
9398
-
9399
- Object.defineProperty(exports, "__esModule", {
9400
- value: true
9401
- });
9402
- exports.parseActions = parseActions;
9403
- exports.isHistory = isHistory;
9404
- exports.includeAction = includeAction;
9405
- exports.excludeAction = excludeAction;
9406
- exports.combineFilters = combineFilters;
9407
- exports.groupByActionTypes = groupByActionTypes;
9408
- exports.newHistory = newHistory;
9409
-
9410
- // parseActions helper: takes a string (or array)
9411
- // and makes it an array if it isn't yet
9412
- function parseActions(rawActions) {
9413
- var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
9414
-
9415
- if (Array.isArray(rawActions)) {
9416
- return rawActions;
9417
- } else if (typeof rawActions === 'string') {
9418
- return [rawActions];
9419
- }
9420
-
9421
- return defaultValue;
9422
- } // isHistory helper: check for a valid history object
9423
-
9424
-
9425
- function isHistory(history) {
9426
- return typeof history.present !== 'undefined' && typeof history.future !== 'undefined' && typeof history.past !== 'undefined' && Array.isArray(history.future) && Array.isArray(history.past);
9427
- } // includeAction helper: whitelist actions to be added to the history
9428
-
9429
-
9430
- function includeAction(rawActions) {
9431
- var actions = parseActions(rawActions);
9432
- return function (action) {
9433
- return actions.indexOf(action.type) >= 0;
9434
- };
9435
- } // excludeAction helper: blacklist actions from being added to the history
9436
-
9437
-
9438
- function excludeAction(rawActions) {
9439
- var actions = parseActions(rawActions);
9440
- return function (action) {
9441
- return actions.indexOf(action.type) < 0;
9442
- };
9443
- } // combineFilters helper: combine multiple filters to one
9444
-
9445
-
9446
- function combineFilters() {
9447
- for (var _len = arguments.length, filters = new Array(_len), _key = 0; _key < _len; _key++) {
9448
- filters[_key] = arguments[_key];
9449
- }
9450
-
9451
- return filters.reduce(function (prev, curr) {
9452
- return function (action, currentState, previousHistory) {
9453
- return prev(action, currentState, previousHistory) && curr(action, currentState, previousHistory);
9454
- };
9455
- }, function () {
9456
- return true;
9457
- });
9458
- }
9459
-
9460
- function groupByActionTypes(rawActions) {
9461
- var actions = parseActions(rawActions);
9462
- return function (action) {
9463
- return actions.indexOf(action.type) >= 0 ? action.type : null;
9464
- };
9465
- }
9466
-
9467
- function newHistory(past, present, future) {
9468
- var group = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
9469
- return {
9470
- past: past,
9471
- present: present,
9472
- future: future,
9473
- group: group,
9474
- _latestUnfiltered: present,
9475
- index: past.length,
9476
- limit: past.length + future.length + 1
9477
- };
9478
- }
9479
- });
9480
-
9481
- var debug = createCommonjsModule(function (module, exports) {
9482
-
9483
- Object.defineProperty(exports, "__esModule", {
9484
- value: true
9485
- });
9486
- exports.set = set;
9487
- exports.start = start;
9488
- exports.end = end;
9489
- exports.log = log;
9490
-
9491
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
9492
-
9493
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
9494
-
9495
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
9496
-
9497
- 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; } }
9498
-
9499
- var __DEBUG__;
9500
-
9501
- var displayBuffer;
9502
- var colors = {
9503
- prevState: '#9E9E9E',
9504
- action: '#03A9F4',
9505
- nextState: '#4CAF50'
9506
- };
9507
- /* istanbul ignore next: debug messaging is not tested */
9508
-
9509
- function initBuffer() {
9510
- displayBuffer = {
9511
- header: [],
9512
- prev: [],
9513
- action: [],
9514
- next: [],
9515
- msgs: []
9516
- };
9517
- }
9518
- /* istanbul ignore next: debug messaging is not tested */
9519
-
9520
-
9521
- function printBuffer() {
9522
- var _displayBuffer = displayBuffer,
9523
- header = _displayBuffer.header,
9524
- prev = _displayBuffer.prev,
9525
- next = _displayBuffer.next,
9526
- action = _displayBuffer.action,
9527
- msgs = _displayBuffer.msgs;
9528
-
9529
- if (console.group) {
9530
- var _console, _console2, _console3, _console4, _console5;
9531
-
9532
- (_console = console).groupCollapsed.apply(_console, _toConsumableArray(header));
9533
-
9534
- (_console2 = console).log.apply(_console2, _toConsumableArray(prev));
9535
-
9536
- (_console3 = console).log.apply(_console3, _toConsumableArray(action));
9537
-
9538
- (_console4 = console).log.apply(_console4, _toConsumableArray(next));
9539
-
9540
- (_console5 = console).log.apply(_console5, _toConsumableArray(msgs));
9541
-
9542
- console.groupEnd();
9543
- } else {
9544
- var _console6, _console7, _console8, _console9, _console10;
9545
-
9546
- (_console6 = console).log.apply(_console6, _toConsumableArray(header));
9547
-
9548
- (_console7 = console).log.apply(_console7, _toConsumableArray(prev));
9549
-
9550
- (_console8 = console).log.apply(_console8, _toConsumableArray(action));
9551
-
9552
- (_console9 = console).log.apply(_console9, _toConsumableArray(next));
9553
-
9554
- (_console10 = console).log.apply(_console10, _toConsumableArray(msgs));
9171
+ class DataBinder {
9172
+ constructor(dataUnit) {
9173
+ this._dataUnit = dataUnit;
9174
+ this._fields = new Map();
9555
9175
  }
9556
- }
9557
- /* istanbul ignore next: debug messaging is not tested */
9558
-
9559
-
9560
- function colorFormat(text, color, obj) {
9561
- return ["%c".concat(text), "color: ".concat(color, "; font-weight: bold"), obj];
9562
- }
9563
- /* istanbul ignore next: debug messaging is not tested */
9564
-
9565
-
9566
- function start(action, state) {
9567
- initBuffer();
9568
-
9569
- if (__DEBUG__) {
9570
- if (console.group) {
9571
- displayBuffer.header = ['%credux-undo', 'font-style: italic', 'action', action.type];
9572
- displayBuffer.action = colorFormat('action', colors.action, action);
9573
- displayBuffer.prev = colorFormat('prev history', colors.prevState, state);
9574
- } else {
9575
- displayBuffer.header = ['redux-undo action', action.type];
9576
- displayBuffer.action = ['action', action];
9577
- displayBuffer.prev = ['prev history', state];
9578
- }
9176
+ bind(fields) {
9177
+ fields.forEach(fieldElement => {
9178
+ const fieldName = fieldElement.dataset.fieldName;
9179
+ this.updateBind(fieldName, fieldElement);
9180
+ this.updateValue(fieldName, fieldElement);
9181
+ });
9579
9182
  }
9580
- }
9581
- /* istanbul ignore next: debug messaging is not tested */
9582
-
9583
-
9584
- function end(nextState) {
9585
- if (__DEBUG__) {
9586
- if (console.group) {
9587
- displayBuffer.next = colorFormat('next history', colors.nextState, nextState);
9588
- } else {
9589
- displayBuffer.next = ['next history', nextState];
9590
- }
9591
-
9592
- printBuffer();
9183
+ updateValue(fieldName, field) {
9184
+ field["value"] = this._dataUnit.getFieldValue(fieldName);
9593
9185
  }
9594
- }
9595
- /* istanbul ignore next: debug messaging is not tested */
9596
-
9597
-
9598
- function log() {
9599
- if (__DEBUG__) {
9600
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9601
- args[_key] = arguments[_key];
9186
+ updateBind(fieldName, field) {
9187
+ const oldBind = this._fields.get(fieldName);
9188
+ if (oldBind) {
9189
+ oldBind.destroy();
9602
9190
  }
9603
-
9604
- displayBuffer.msgs = displayBuffer.msgs.concat([].concat(args, ['\n']));
9605
- }
9606
- }
9607
- /* istanbul ignore next: debug messaging is not tested */
9608
-
9609
-
9610
- function set(debug) {
9611
- __DEBUG__ = debug;
9612
- }
9613
- });
9614
-
9615
- var reducer = createCommonjsModule(function (module, exports) {
9616
-
9617
- 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); }
9618
-
9619
- Object.defineProperty(exports, "__esModule", {
9620
- value: true
9621
- });
9622
- exports["default"] = undoable;
9623
-
9624
- var debug$1 = _interopRequireWildcard(debug);
9625
-
9626
-
9627
-
9628
-
9629
-
9630
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
9631
-
9632
- 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; }
9633
-
9634
- 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; }
9635
-
9636
- 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; }
9637
-
9638
- 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; }
9639
-
9640
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
9641
-
9642
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
9643
-
9644
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
9645
-
9646
- 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; } }
9647
-
9648
- function createHistory(state, ignoreInitialState) {
9649
- // ignoreInitialState essentially prevents the user from undoing to the
9650
- // beginning, in the case that the undoable reducer handles initialization
9651
- // in a way that can't be redone simply
9652
- var history = (0, helpers.newHistory)([], state, []);
9653
-
9654
- if (ignoreInitialState) {
9655
- history._latestUnfiltered = null;
9191
+ this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
9656
9192
  }
9657
-
9658
- return history;
9659
- } // insert: insert `state` into history, which means adding the current state
9660
- // into `past`, setting the new `state` as `present` and erasing
9661
- // the `future`.
9662
-
9663
-
9664
- function insert(history, state, limit, group) {
9665
- var lengthWithoutFuture = history.past.length + 1;
9666
- debug$1.log('inserting', state);
9667
- debug$1.log('new free: ', limit - lengthWithoutFuture);
9668
- var past = history.past,
9669
- _latestUnfiltered = history._latestUnfiltered;
9670
- var isHistoryOverflow = limit && limit <= lengthWithoutFuture;
9671
- var pastSliced = past.slice(isHistoryOverflow ? 1 : 0);
9672
- var newPast = _latestUnfiltered != null ? [].concat(_toConsumableArray(pastSliced), [_latestUnfiltered]) : pastSliced;
9673
- return (0, helpers.newHistory)(newPast, state, [], group);
9674
- } // jumpToFuture: jump to requested index in future history
9675
-
9676
-
9677
- function jumpToFuture(history, index) {
9678
- if (index < 0 || index >= history.future.length) return history;
9679
- var past = history.past,
9680
- future = history.future,
9681
- _latestUnfiltered = history._latestUnfiltered;
9682
- var newPast = [].concat(_toConsumableArray(past), [_latestUnfiltered], _toConsumableArray(future.slice(0, index)));
9683
- var newPresent = future[index];
9684
- var newFuture = future.slice(index + 1);
9685
- return (0, helpers.newHistory)(newPast, newPresent, newFuture);
9686
- } // jumpToPast: jump to requested index in past history
9687
-
9688
-
9689
- function jumpToPast(history, index) {
9690
- if (index < 0 || index >= history.past.length) return history;
9691
- var past = history.past,
9692
- future = history.future,
9693
- _latestUnfiltered = history._latestUnfiltered;
9694
- var newPast = past.slice(0, index);
9695
- var newFuture = [].concat(_toConsumableArray(past.slice(index + 1)), [_latestUnfiltered], _toConsumableArray(future));
9696
- var newPresent = past[index];
9697
- return (0, helpers.newHistory)(newPast, newPresent, newFuture);
9698
- } // jump: jump n steps in the past or forward
9699
-
9700
-
9701
- function jump(history, n) {
9702
- if (n > 0) return jumpToFuture(history, n - 1);
9703
- if (n < 0) return jumpToPast(history, history.past.length + n);
9704
- return history;
9705
- } // helper to dynamically match in the reducer's switch-case
9706
-
9707
-
9708
- function actionTypeAmongClearHistoryType(actionType, clearHistoryType) {
9709
- return clearHistoryType.indexOf(actionType) > -1 ? actionType : !actionType;
9710
- } // redux-undo higher order reducer
9711
-
9712
-
9713
- function undoable(reducer) {
9714
- var rawConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9715
- debug$1.set(rawConfig.debug);
9716
-
9717
- var config = _objectSpread({
9718
- limit: undefined,
9719
- filter: function filter() {
9720
- return true;
9721
- },
9722
- groupBy: function groupBy() {
9723
- return null;
9724
- },
9725
- undoType: actions.ActionTypes.UNDO,
9726
- redoType: actions.ActionTypes.REDO,
9727
- jumpToPastType: actions.ActionTypes.JUMP_TO_PAST,
9728
- jumpToFutureType: actions.ActionTypes.JUMP_TO_FUTURE,
9729
- jumpType: actions.ActionTypes.JUMP,
9730
- neverSkipReducer: false,
9731
- ignoreInitialState: false,
9732
- syncFilter: false
9733
- }, rawConfig, {
9734
- initTypes: (0, helpers.parseActions)(rawConfig.initTypes, ['@@redux-undo/INIT']),
9735
- clearHistoryType: (0, helpers.parseActions)(rawConfig.clearHistoryType, [actions.ActionTypes.CLEAR_HISTORY])
9736
- }); // Allows the user to call the reducer with redux-undo specific actions
9737
-
9738
-
9739
- var skipReducer = config.neverSkipReducer ? function (res, action) {
9740
- for (var _len = arguments.length, slices = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
9741
- slices[_key - 2] = arguments[_key];
9193
+ setFieldValue(fieldName, newValue) {
9194
+ if (this._dataUnit.records.length === 0) {
9195
+ this._dataUnit.addRecord();
9742
9196
  }
9743
-
9744
- return _objectSpread({}, res, {
9745
- present: reducer.apply(void 0, [res.present, action].concat(slices))
9746
- });
9747
- } : function (res) {
9748
- return res;
9749
- };
9750
- var initialState;
9751
- return function () {
9752
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
9753
- var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9754
- debug$1.start(action, state);
9755
- var history = state;
9756
-
9757
- for (var _len2 = arguments.length, slices = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
9758
- slices[_key2 - 2] = arguments[_key2];
9759
- }
9760
-
9761
- if (!initialState) {
9762
- debug$1.log('history is uninitialized');
9763
-
9764
- if (state === undefined) {
9765
- var createHistoryAction = {
9766
- type: '@@redux-undo/CREATE_HISTORY'
9767
- };
9768
- var start = reducer.apply(void 0, [state, createHistoryAction].concat(slices));
9769
- history = createHistory(start, config.ignoreInitialState);
9770
- debug$1.log('do not set initialState on probe actions');
9771
- debug$1.end(history);
9772
- return history;
9773
- } else if ((0, helpers.isHistory)(state)) {
9774
- history = initialState = config.ignoreInitialState ? state : (0, helpers.newHistory)(state.past, state.present, state.future);
9775
- debug$1.log('initialHistory initialized: initialState is a history', initialState);
9776
- } else {
9777
- history = initialState = createHistory(state, config.ignoreInitialState);
9778
- debug$1.log('initialHistory initialized: initialState is not a history', initialState);
9779
- }
9780
- }
9781
-
9782
- var res;
9783
-
9784
- switch (action.type) {
9785
- case undefined:
9786
- return history;
9787
-
9788
- case config.undoType:
9789
- res = jump(history, -1);
9790
- debug$1.log('perform undo');
9791
- debug$1.end(res);
9792
- return skipReducer.apply(void 0, [res, action].concat(slices));
9793
-
9794
- case config.redoType:
9795
- res = jump(history, 1);
9796
- debug$1.log('perform redo');
9797
- debug$1.end(res);
9798
- return skipReducer.apply(void 0, [res, action].concat(slices));
9799
-
9800
- case config.jumpToPastType:
9801
- res = jumpToPast(history, action.index);
9802
- debug$1.log("perform jumpToPast to ".concat(action.index));
9803
- debug$1.end(res);
9804
- return skipReducer.apply(void 0, [res, action].concat(slices));
9805
-
9806
- case config.jumpToFutureType:
9807
- res = jumpToFuture(history, action.index);
9808
- debug$1.log("perform jumpToFuture to ".concat(action.index));
9809
- debug$1.end(res);
9810
- return skipReducer.apply(void 0, [res, action].concat(slices));
9811
-
9812
- case config.jumpType:
9813
- res = jump(history, action.index);
9814
- debug$1.log("perform jump to ".concat(action.index));
9815
- debug$1.end(res);
9816
- return skipReducer.apply(void 0, [res, action].concat(slices));
9817
-
9818
- case actionTypeAmongClearHistoryType(action.type, config.clearHistoryType):
9819
- res = createHistory(history.present, config.ignoreInitialState);
9820
- debug$1.log('perform clearHistory');
9821
- debug$1.end(res);
9822
- return skipReducer.apply(void 0, [res, action].concat(slices));
9823
-
9824
- default:
9825
- res = reducer.apply(void 0, [history.present, action].concat(slices));
9826
-
9827
- if (config.initTypes.some(function (actionType) {
9828
- return actionType === action.type;
9829
- })) {
9830
- debug$1.log('reset history due to init action');
9831
- debug$1.end(initialState);
9832
- return initialState;
9833
- }
9834
-
9835
- if (history._latestUnfiltered === res) {
9836
- // Don't handle this action. Do not call debug.end here,
9837
- // because this action should not produce side effects to the console
9838
- return history;
9839
- }
9840
- /* eslint-disable-next-line no-case-declarations */
9841
-
9842
-
9843
- var filtered = typeof config.filter === 'function' && !config.filter(action, res, history);
9844
-
9845
- if (filtered) {
9846
- // if filtering an action, merely update the present
9847
- var filteredState = (0, helpers.newHistory)(history.past, res, history.future, history.group);
9848
-
9849
- if (!config.syncFilter) {
9850
- filteredState._latestUnfiltered = history._latestUnfiltered;
9851
- }
9852
-
9853
- debug$1.log('filter ignored action, not storing it in past');
9854
- debug$1.end(filteredState);
9855
- return filteredState;
9856
- }
9857
- /* eslint-disable-next-line no-case-declarations */
9858
-
9859
-
9860
- var group = config.groupBy(action, res, history);
9861
-
9862
- if (group != null && group === history.group) {
9863
- // if grouping with the previous action, only update the present
9864
- var groupedState = (0, helpers.newHistory)(history.past, res, history.future, history.group);
9865
- debug$1.log('groupBy grouped the action with the previous action');
9866
- debug$1.end(groupedState);
9867
- return groupedState;
9868
- } // If the action wasn't filtered or grouped, insert normally
9869
-
9870
-
9871
- history = insert(history, res, config.limit, group);
9872
- debug$1.log('inserted new state into history');
9873
- debug$1.end(history);
9874
- return history;
9875
- }
9876
- };
9877
- }
9878
- });
9879
-
9880
- var lib = createCommonjsModule(function (module, exports) {
9881
-
9882
- Object.defineProperty(exports, "__esModule", {
9883
- value: true
9884
- });
9885
- Object.defineProperty(exports, "ActionTypes", {
9886
- enumerable: true,
9887
- get: function get() {
9888
- return actions.ActionTypes;
9889
- }
9890
- });
9891
- Object.defineProperty(exports, "ActionCreators", {
9892
- enumerable: true,
9893
- get: function get() {
9894
- return actions.ActionCreators;
9895
- }
9896
- });
9897
- Object.defineProperty(exports, "parseActions", {
9898
- enumerable: true,
9899
- get: function get() {
9900
- return helpers.parseActions;
9901
- }
9902
- });
9903
- Object.defineProperty(exports, "isHistory", {
9904
- enumerable: true,
9905
- get: function get() {
9906
- return helpers.isHistory;
9907
- }
9908
- });
9909
- Object.defineProperty(exports, "includeAction", {
9910
- enumerable: true,
9911
- get: function get() {
9912
- return helpers.includeAction;
9913
- }
9914
- });
9915
- Object.defineProperty(exports, "excludeAction", {
9916
- enumerable: true,
9917
- get: function get() {
9918
- return helpers.excludeAction;
9919
- }
9920
- });
9921
- Object.defineProperty(exports, "combineFilters", {
9922
- enumerable: true,
9923
- get: function get() {
9924
- return helpers.combineFilters;
9925
- }
9926
- });
9927
- Object.defineProperty(exports, "groupByActionTypes", {
9928
- enumerable: true,
9929
- get: function get() {
9930
- return helpers.groupByActionTypes;
9931
- }
9932
- });
9933
- Object.defineProperty(exports, "newHistory", {
9934
- enumerable: true,
9935
- get: function get() {
9936
- return helpers.newHistory;
9937
- }
9938
- });
9939
- Object.defineProperty(exports, "default", {
9940
- enumerable: true,
9941
- get: function get() {
9942
- return _reducer["default"];
9943
- }
9944
- });
9945
-
9946
-
9947
-
9948
-
9949
-
9950
- var _reducer = _interopRequireDefault(reducer);
9951
-
9952
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9953
- });
9954
-
9955
- const undoable = /*@__PURE__*/getDefaultExportFromCjs(lib);
9956
-
9957
- const inicialHistState = {
9958
- currentTabIndex: {},
9959
- currentRecordIndex: {},
9960
- changes: {},
9961
- collapsedGroups: {},
9962
- newRecordIndex: {}
9963
- };
9964
- const inicialNonHistState = {
9965
- dataLoading: {},
9966
- invalidFields: {},
9967
- visibleButtons: {
9968
- previousVisible: true,
9969
- nextVisible: true,
9970
- addVisible: true,
9971
- removeVisible: true,
9972
- saveVisible: true,
9973
- cancelVisible: true,
9974
- reloadVisible: false
9975
- }
9976
- };
9977
- function formReducer(state = inicialHistState, action) {
9978
- switch (action.type) {
9979
- case "FORM/COLLAPSEGROUP":
9980
- return collapseGroup(state, action.payload);
9981
- case "FORM/CHANGETAB":
9982
- return changeTab(state, action.payload.formId, action.payload.index);
9983
- case "FORM/NAVIGATE":
9984
- return navigate(state, action.payload);
9985
- case "FORM/INSERT":
9986
- return insertRecord(state, action.payload);
9987
- case "FORM/CHANGEFIELD":
9988
- return changeFieldValue(state, action.payload);
9989
- case "FORM/CLEAREDITION":
9990
- return clearEdition(state, action.payload);
9991
- case "FORM/INVALIDFIELD":
9992
- return navigateToInvalid(state, action.payload);
9993
- default:
9994
- return state;
9197
+ this._dataUnit.setFieldValue(fieldName, newValue);
9995
9198
  }
9996
9199
  }
9997
- function formNonHistoricReducer(state = inicialNonHistState, action) {
9998
- switch (action.type) {
9999
- case "FORM/DATALOADING":
10000
- return dataLoading(state, action.payload);
10001
- case "FORM/DATALOADED":
10002
- return dataLoaded(state, action.payload);
10003
- case "FORM/SAVINGCHANGES":
10004
- return savingChanges(state, action.payload);
10005
- case "FORM/CHANGESSAVED":
10006
- return changesSaved(state, action.payload);
10007
- case "FORM/REMOVINGRECORD":
10008
- return removingRecord(state, action.payload);
10009
- case "FORM/RECORDREMOVED":
10010
- return recordRemoved(state, action.payload);
10011
- case "FORM/INVALIDFIELD":
10012
- return invalidField(state, action.payload);
10013
- case "FORM/CLEAREDITION":
10014
- return clearAllInvalidFields(state, action.payload);
10015
- case "FORM/CHANGEFIELD":
10016
- return clearInvalidField(state, action.payload);
10017
- case "FORM/SHOWHIDENAVBTN":
10018
- return showHideNavBtn(state, action.payload);
10019
- default:
10020
- return state;
9200
+ class Bind {
9201
+ destroy() {
9202
+ this.field.removeEventListener(this.eventName, this.eventListener);
10021
9203
  }
10022
- }
10023
- function collapseGroup(state, { collapseId, collapsed }) {
10024
- const currentCollapsed = Object.assign({}, state.collapsedGroups);
10025
- if (collapsed) {
10026
- currentCollapsed[collapseId] = true;
9204
+ static create(fieldName, field, callback) {
9205
+ const b = new Bind();
9206
+ b.fieldName = fieldName;
9207
+ b.field = field;
9208
+ //FIXME: Verificar se o field é um EzField
9209
+ b.eventListener = (evt) => { callback(fieldName, evt.detail); };
9210
+ b.eventName = "ezChange";
9211
+ b.field.addEventListener(b.eventName, b.eventListener);
9212
+ return b;
10027
9213
  }
10028
- else {
10029
- delete currentCollapsed[collapseId];
10030
- }
10031
- return Object.assign(Object.assign({}, state), { collapsedGroups: currentCollapsed });
10032
- }
10033
- function changeTab(state, formId, index) {
10034
- const currentTabIndex = Object.assign({}, state.currentTabIndex);
10035
- currentTabIndex[formId] = index;
10036
- return Object.assign(Object.assign({}, state), { currentTabIndex });
10037
- }
10038
- function navigate(state, { dataUnit, limit, backward }) {
10039
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
10040
- const recIndex = currentRecordIndex[dataUnit] || 0;
10041
- return gotoIndex(state, dataUnit, backward ? Math.max(limit, recIndex - 1) : Math.min(limit, recIndex + 1));
10042
- }
10043
- function gotoIndex(state, dataUnit, index) {
10044
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
10045
- currentRecordIndex[dataUnit] = index;
10046
- return Object.assign(Object.assign({}, state), { currentRecordIndex });
10047
- }
10048
- function insertRecord(state, { dataUnit, insertionIndex }) {
10049
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
10050
- const newRecordIndex = Object.assign({}, state.newRecordIndex);
10051
- currentRecordIndex[dataUnit] = insertionIndex;
10052
- newRecordIndex[dataUnit] = (state.newRecordIndex[dataUnit] || 0) + 1;
10053
- return Object.assign(Object.assign({}, state), { currentRecordIndex,
10054
- newRecordIndex });
10055
- }
10056
- function changeFieldValue(state, { dataUnit, recordId, fieldName, value }) {
10057
- const changes = Object.assign({}, state.changes);
10058
- const dataUnitChanges = Object.assign({}, changes[dataUnit]);
10059
- const recordChanges = Object.assign({}, dataUnitChanges[recordId]);
10060
- recordChanges[fieldName] = value;
10061
- dataUnitChanges[recordId] = recordChanges;
10062
- changes[dataUnit] = dataUnitChanges;
10063
- const invalidFields = Object.assign({}, state.invalidFields);
10064
- const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
10065
- const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
10066
- delete errorMessages[fieldName];
10067
- dataUnitInvalidRecords[recordId] = errorMessages;
10068
- invalidFields[dataUnit] = dataUnitInvalidRecords;
10069
- return Object.assign(Object.assign({}, state), { changes,
10070
- invalidFields, invalidFieldSelected: undefined });
10071
- }
10072
- function clearEdition(state, { dataUnit, recordsLimit }) {
10073
- const changes = Object.assign({}, state.changes);
10074
- const newRecordIndex = Object.assign({}, state.newRecordIndex);
10075
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
10076
- delete changes[dataUnit];
10077
- delete newRecordIndex[dataUnit];
10078
- const recIndex = currentRecordIndex[dataUnit] || 0;
10079
- currentRecordIndex[dataUnit] = Math.min(recordsLimit, recIndex);
10080
- return Object.assign(Object.assign({}, state), { changes,
10081
- newRecordIndex,
10082
- currentRecordIndex });
10083
- }
10084
- function navigateToInvalid(state, payload) {
10085
- let newState = Object.assign({}, state);
10086
- if (newState.invalidFieldSelected === undefined) {
10087
- newState.invalidFieldSelected = true;
10088
- newState = gotoIndex(newState, payload.dataUnit, payload.recordIndex);
10089
- newState = changeTab(newState, payload.tabController, payload.tabIndex);
10090
- }
10091
- return newState;
10092
- }
10093
- function dataLoading(state, { dataUnit }) {
10094
- const dataLoading = Object.assign({}, state.dataLoading);
10095
- dataLoading[dataUnit] = true;
10096
- return Object.assign(Object.assign({}, state), { dataLoading });
10097
- }
10098
- function dataLoaded(state, { dataUnit }) {
10099
- const dataLoading = Object.assign({}, state.dataLoading);
10100
- delete dataLoading[dataUnit];
10101
- return Object.assign(Object.assign({}, state), { dataLoading });
10102
- }
10103
- function savingChanges(state, { dataUnit }) {
10104
- const dataLoading = Object.assign({}, state.dataLoading);
10105
- dataLoading[dataUnit] = true;
10106
- return Object.assign(Object.assign({}, state), { dataLoading });
10107
- }
10108
- function changesSaved(state, { dataUnit }) {
10109
- const dataLoading = Object.assign({}, state.dataLoading);
10110
- delete dataLoading[dataUnit];
10111
- return Object.assign(Object.assign({}, state), { dataLoading });
10112
- }
10113
- function removingRecord(state, { dataUnit }) {
10114
- const dataLoading = Object.assign({}, state.dataLoading);
10115
- dataLoading[dataUnit] = true;
10116
- return Object.assign(Object.assign({}, state), { dataLoading });
10117
- }
10118
- function recordRemoved(state, { dataUnit }) {
10119
- const dataLoading = Object.assign({}, state.dataLoading);
10120
- delete dataLoading[dataUnit];
10121
- return Object.assign(Object.assign({}, state), { dataLoading });
10122
- }
10123
- function invalidField(state, { dataUnit, recordId, fieldName, errorMessage }) {
10124
- const invalidFields = Object.assign({}, state.invalidFields);
10125
- const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
10126
- const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
10127
- errorMessages[fieldName] = errorMessage;
10128
- dataUnitInvalidRecords[recordId] = errorMessages;
10129
- invalidFields[dataUnit] = dataUnitInvalidRecords;
10130
- return Object.assign(Object.assign({}, state), { invalidFields });
10131
- }
10132
- function clearAllInvalidFields(state, { dataUnit }) {
10133
- const invalidFields = Object.assign({}, state.invalidFields);
10134
- delete invalidFields[dataUnit];
10135
- return Object.assign(Object.assign({}, state), { invalidFields });
10136
- }
10137
- function clearInvalidField(state, { dataUnit, recordId, fieldName }) {
10138
- const invalidFields = Object.assign({}, state.invalidFields);
10139
- const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
10140
- const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
10141
- delete errorMessages[fieldName];
10142
- dataUnitInvalidRecords[recordId] = errorMessages;
10143
- invalidFields[dataUnit] = dataUnitInvalidRecords;
10144
- return Object.assign(Object.assign({}, state), { invalidFields });
10145
- }
10146
- function showHideNavBtn(state, { buttonName, status }) {
10147
- const visibleButtons = Object.assign({}, state.visibleButtons);
10148
- visibleButtons[buttonName] = status;
10149
- return Object.assign(Object.assign({}, state), { visibleButtons });
10150
9214
  }
10151
9215
 
10152
9216
  class ApplicationUtils {
@@ -10181,775 +9245,104 @@ class ApplicationUtils {
10181
9245
  }
10182
9246
  }
10183
9247
 
10184
- function removeHandler(dataUnit) {
10185
- ApplicationUtils.confirm("Exclusão de registro", "Tem certeza que deseja Remover?", null, true).then(ok => {
10186
- if (ok) {
10187
- dataUnit.remove();
10188
- }
10189
- });
10190
- }
10191
- function saveHandler(dataUnit) {
10192
- setTimeout(() => {
10193
- //Esse debouncing é necessário quando o usuário clica no botão de salvar
10194
- //sem ter tirado o foco o último campo alterado.
10195
- dataUnit.save();
10196
- }, 50);
10197
- }
10198
- const NavigationBar = ({ dataUnit: du, buttonProps, enabled }) => {
10199
- if (buttonProps.previousVisible
10200
- || buttonProps.nextVisible
10201
- || buttonProps.addVisible
10202
- || buttonProps.removeVisible
10203
- || buttonProps.saveVisible
10204
- || buttonProps.cancelVisible
10205
- || buttonProps.reloadVisible) {
10206
- return h("div", { class: "col col--sd-12 align--right" },
10207
- 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,
10208
- 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,
10209
- 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,
10210
- buttonProps.addVisible ? h("ez-button", { key: du.name + "_add", label: "Adicionar", enabled: enabled, onClick: () => du.insert(), class: "button--secondary margin-right--medium" }) : null,
10211
- 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,
10212
- 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,
10213
- 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);
10214
- }
10215
- else {
10216
- return null;
10217
- }
10218
- };
10219
-
10220
- //histórico
10221
- const selectCurrentTab = (state, formName) => {
10222
- const data = state.hist.present.currentTabIndex;
10223
- return data[formName] || 0;
10224
- };
10225
- const selectIsCollapsedFieldSet = (state, fieldSetName) => {
10226
- const data = state.hist.present.collapsedGroups;
10227
- return data[fieldSetName];
10228
- };
10229
- const selectRecordChanges = (state, dataUnit, recordId) => {
10230
- const data = selectDataUnitChanges(state, dataUnit);
10231
- return data ? data[recordId] : undefined;
10232
- };
10233
- const selectDataUnitChanges = (state, dataUnit) => {
10234
- const data = state.hist.present.changes;
10235
- return data[dataUnit];
10236
- };
10237
- const selectCurrentRecordIndex = (state, dataUnit) => {
10238
- const data = state.hist.present.currentRecordIndex;
10239
- return data[dataUnit] || 0;
10240
- };
10241
- const selectNewRecordIndex = (state, dataUnit) => {
10242
- const data = state.hist.present.newRecordIndex;
10243
- return data[dataUnit] || 0;
10244
- };
10245
- //não histórico
10246
- const selectLoadingData = (state, dataUnit) => {
10247
- const data = state.nonhist.dataLoading;
10248
- return data[dataUnit];
10249
- };
10250
- const selectErrorMessage = (state, dataUnit, recordId, fieldName) => {
10251
- const data = state.nonhist.invalidFields;
10252
- const dataUnitMessages = data[dataUnit] || {};
10253
- const recordMessages = dataUnitMessages[recordId] || {};
10254
- return recordMessages[fieldName] || "";
10255
- };
10256
- const selectVisibleButtons = state => state.nonhist.visibleButtons;
9248
+ const ezFormCss = "ez-form{display:flex;flex-direction:column;width:100%}";
10257
9249
 
10258
- class DataUnit {
10259
- constructor(name, unitLabel, cardinality = "1", parentDU = null) {
10260
- this.name = name;
10261
- this.unitLabel = unitLabel;
10262
- this.cardinality = cardinality;
10263
- this._children = [];
10264
- this._fields = new Map();
10265
- this._requiredFields = [];
10266
- if (parentDU != null) {
10267
- parentDU._children.push(this);
10268
- this.parentDU = parentDU;
10269
- this.parentDUName = parentDU.name;
10270
- }
10271
- }
10272
- set store(store) {
10273
- this._store = store;
10274
- }
10275
- set fields(value) {
10276
- if (value) {
10277
- value.forEach(f => this.addFieldMetadata(f));
10278
- }
10279
- }
10280
- addFieldMetadata(field) {
10281
- this._fields.set(field.name, field);
10282
- if (field.required) {
10283
- this._requiredFields.push(field);
10284
- }
10285
- }
10286
- getFieldMetadata(name) {
10287
- if (this._fields) {
10288
- return this._fields.get(name);
10289
- }
10290
- return undefined;
10291
- }
10292
- get requiredFields() {
10293
- return this._requiredFields;
10294
- }
10295
- isLoading() {
10296
- return selectLoadingData(this._store.getState(), this.name);
10297
- }
10298
- hasChanges() {
10299
- const state = this._store.getState();
10300
- return selectDataUnitChanges(state, this.name) !== undefined || selectNewRecordIndex(state, this.name) > 0;
10301
- }
10302
- hasNext() {
10303
- return selectCurrentRecordIndex(this._store.getState(), this.name) < (this.records.length - 1);
10304
- }
10305
- hasPrevious() {
10306
- return selectCurrentRecordIndex(this._store.getState(), this.name) > 0;
10307
- }
10308
- hasCurrentRecord() {
10309
- return this.getCurrentRecord() != undefined;
10310
- }
10311
- previous() {
10312
- this._store.dispatch(previousRecord(this.name));
10313
- }
10314
- next() {
10315
- this._store.dispatch(nextRecord(this.name, this.records.length));
10316
- }
10317
- getValue(fieldName) {
10318
- const currentRecord = this.getCurrentRecord();
10319
- if (!currentRecord) {
10320
- return undefined;
10321
- }
10322
- const changes = this.getRecordChanges(currentRecord);
10323
- return changes && changes[fieldName] !== undefined ? changes[fieldName] : currentRecord[fieldName] || null;
10324
- }
10325
- getErrorMessage(fieldName) {
10326
- const currentRecord = this.getCurrentRecord();
10327
- return selectErrorMessage(this._store.getState(), this.name, currentRecord === null || currentRecord === void 0 ? void 0 : currentRecord.record__id, fieldName);
9250
+ let EzForm$1 = class extends HTMLElement$1 {
9251
+ constructor() {
9252
+ super();
9253
+ this.__registerHost();
10328
9254
  }
10329
- changeValue(fieldName, newValue) {
10330
- if (this.records.length == 0) {
10331
- this.insert();
10332
- }
10333
- if (this._changeDeboucing) {
10334
- window.clearTimeout(this._changeDeboucing);
10335
- }
10336
- this._changeDeboucing = window.setTimeout(() => {
10337
- const currentRecord = this.getCurrentRecord();
10338
- this._store.dispatch(changeFieldValue$1(this.name, currentRecord.record__id, fieldName, newValue));
10339
- }, 100);
9255
+ submit() {
9256
+ return Promise.resolve();
10340
9257
  }
10341
9258
  cancel() {
10342
- this.records = this.records.filter(r => !r.record__id.startsWith("NEW_"));
10343
- this._store.dispatch(clearEdition$1(this.name, this.records.length - 1));
10344
- }
10345
- insert() {
10346
- const insertionIndex = this.records.length;
10347
- const newRecordIndex = selectNewRecordIndex(this._store.getState(), this.name);
10348
- const newRecord = { record__id: "NEW_" + (newRecordIndex + 1) };
10349
- this.bindToParent(newRecord);
10350
- this.records.push(newRecord);
10351
- this._store.dispatch(insertRecord$1(this.name, insertionIndex));
10352
- }
10353
- buildChange(r) {
10354
- const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
10355
- let recordChanges;
10356
- if (duChanges) {
10357
- recordChanges = duChanges[r.record__id];
10358
- }
10359
- let subChanges = [];
10360
- this._children.forEach(duChild => {
10361
- subChanges = subChanges.concat(duChild.getSubChanges(r.record__id));
10362
- });
10363
- if (recordChanges || subChanges.length > 0) {
10364
- const change = {
10365
- "__data__unit": this.name,
10366
- "__record__id": r.record__id,
10367
- "__sub__changes": subChanges
10368
- };
10369
- if (recordChanges) {
10370
- Object.keys(recordChanges).forEach(fieldName => { });
10371
- }
10372
- return change;
10373
- }
10374
- return undefined;
10375
- }
10376
- getSubChanges(id) {
10377
- const result = [];
10378
- if (this._records) {
10379
- this._records.filter(r => r.parent__record__id === id).forEach(r => {
10380
- const c = this.buildChange(r);
10381
- if (c) {
10382
- result.push(c);
10383
- }
10384
- });
10385
- }
10386
- return result;
10387
- }
10388
- getChangesToSave() {
10389
- let result = [];
10390
- if (this._records) {
10391
- this._records.forEach(r => {
10392
- const change = this.buildChange(r);
10393
- if (change) {
10394
- result.push(change);
10395
- }
10396
- });
10397
- }
10398
- return result;
10399
- }
10400
- save() {
10401
- if (!this.validateRecords("SAVE")) {
10402
- return;
10403
- }
10404
- this._store.dispatch(savingChanges$1(this.name));
10405
- let saveResult;
10406
- if (this.saveExecutor) {
10407
- saveResult = this.saveExecutor(this.getChangesToSave());
10408
- }
10409
- if (saveResult instanceof Promise) {
10410
- saveResult
10411
- .then(r => this.processSaveResult(r))
10412
- .catch(e => {
10413
- this._store.dispatch(dataLoaded$1(this.name));
10414
- ApplicationUtils.error("Falha ao tentar salvar", e);
10415
- });
10416
- }
10417
- else {
10418
- this.processSaveResult(saveResult);
10419
- }
10420
- }
10421
- load() {
10422
- this._store.dispatch(dataLoading$1(this.name));
10423
- let result;
10424
- if (this.loadExecutor) {
10425
- result = this.loadExecutor({ dataUnit: this.name });
10426
- }
10427
- if (result instanceof Promise) {
10428
- result.then(r => this.processLoadResult(r));
10429
- }
10430
- else {
10431
- this.processLoadResult(result);
10432
- }
10433
- }
10434
- remove() {
10435
- const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
10436
- this._store.dispatch(removingRecord$1(this.name));
10437
- let removeResult;
10438
- if (this.removeExecutor) {
10439
- const record = this.getCurrentRecord();
10440
- removeResult = this.removeExecutor({ dataUnit: this.name, recordId: record.record__id, record });
10441
- }
10442
- else {
10443
- removeResult = true;
10444
- }
10445
- if (removeResult) {
10446
- if (removeResult instanceof Promise) {
10447
- removeResult.then(r => this.processRemoveResult(r, currentIndex));
10448
- }
10449
- else {
10450
- this.processRemoveResult(removeResult, currentIndex);
10451
- }
10452
- }
10453
- }
10454
- processSaveResult(result) {
10455
- if (result) {
10456
- if (result instanceof Array) {
10457
- result.forEach(item => this.processSaveResult(item));
10458
- }
10459
- else {
10460
- if (result.__data__unit === this.name) {
10461
- if (this.cardinality === "1") {
10462
- this.records = [this.buildRecordFromSaveResult(this.records[0], result)];
10463
- }
9259
+ return Promise.resolve();
9260
+ }
9261
+ validate() {
9262
+ return new Promise((accept, reject) => {
9263
+ const metadata = selectFormMetadata(this._store.getState());
9264
+ const requiredFields = this._staticFields
9265
+ .filter(f => f.dataset.required)
9266
+ .map(f => f.dataset.fieldName)
9267
+ .concat(metadata.getRequiredFields());
9268
+ const records = this.dataUnit.records;
9269
+ for (let i = 0; i < records.length; i++) {
9270
+ if (!this.validateRequired(requiredFields, records[i])) {
9271
+ reject();
9272
+ break;
10464
9273
  }
10465
9274
  }
10466
- }
10467
- //FIXME: Isso está errado! tem que limpar todas as edições
10468
- this._store.dispatch(clearEdition$1(this.name, this.records.length - 1));
10469
- this._store.dispatch(changesSaved$1(this.name));
10470
- }
10471
- buildRecordFromSaveResult(baseRecord, saveResult) {
10472
- const newRecord = baseRecord ? Object.assign({}, baseRecord) : { record__id: "" };
10473
- Object.keys(saveResult).forEach(attrib => {
10474
- if (!attrib.startsWith("__")) {
10475
- newRecord[attrib] = saveResult[attrib];
10476
- }
9275
+ accept();
10477
9276
  });
10478
- return newRecord;
10479
- }
10480
- processLoadResult(records) {
10481
- this.records = records;
10482
- this._store.dispatch(clearEdition$1(this.name, this.records.length - 1));
10483
- this._store.dispatch(dataLoaded$1(this.name));
10484
9277
  }
10485
- processRemoveResult(removed, recordIndex) {
10486
- if (removed) {
10487
- this.records.splice(recordIndex, 1);
10488
- this._store.dispatch(clearEdition$1(this.name, this.records.length - 1));
10489
- }
10490
- this._store.dispatch(recordRemoved$1(this.name));
10491
- }
10492
- set records(records) {
10493
- this._records = records;
10494
- if (this.parentDU) {
10495
- this._records.forEach(r => this.bindToParent(r));
10496
- }
10497
- }
10498
- bindToParent(r) {
10499
- if (this.parentDU) {
10500
- const parentRecord = this.parentDU.getCurrentRecord();
10501
- if (parentRecord) {
10502
- r.parent__record__id = parentRecord.record__id;
9278
+ validateRequired(requiredFields, record) {
9279
+ const invalidFields = [];
9280
+ requiredFields.forEach(field => {
9281
+ const value = record[field];
9282
+ const fieldElem = this._element.querySelector(`[data-field-name=${field}]`);
9283
+ if (value === null || value === undefined || value === "") {
9284
+ invalidFields.push(field);
9285
+ fieldElem["errorMessage"] = "Essa informação é obrigatória";
10503
9286
  }
10504
- }
10505
- }
10506
- get records() {
10507
- if (!this._records) {
10508
- this._records = [];
10509
- }
10510
- return this._records;
10511
- }
10512
- getCurrentRecord() {
10513
- const currentIndex = selectCurrentRecordIndex(this._store.getState(), this.name);
10514
- return this.records[currentIndex];
10515
- }
10516
- getRecordChanges(currentRecord = undefined) {
10517
- if (currentRecord === undefined) {
10518
- currentRecord = this.getCurrentRecord();
10519
- }
10520
- return currentRecord ? selectRecordChanges(this._store.getState(), this.name, currentRecord.record__id) : undefined;
10521
- }
10522
- validateRecords(triggedBy = "UNKNOWN") {
10523
- if (!this.recordsValidator) {
10524
- return true;
10525
- }
10526
- const duChanges = selectDataUnitChanges(this._store.getState(), this.name);
10527
- const recordsToValidate = [];
10528
- this.records.forEach((record, i) => {
10529
- const changes = duChanges ? duChanges[record.record__id] : undefined;
10530
- if (changes) {
10531
- recordsToValidate.push(Object.assign(Object.assign(Object.assign({}, record), changes), { record__index: i, record__changedfields: Object.keys(changes) }));
9287
+ else {
9288
+ fieldElem["errorMessage"] = "";
10532
9289
  }
10533
9290
  });
10534
- const result = this.recordsValidator.validateRecords(this, recordsToValidate, triggedBy);
10535
- if (result.message) {
10536
- ApplicationUtils.info(result.message);
9291
+ const isValid = invalidFields.length === 0;
9292
+ if (!isValid) {
9293
+ ApplicationUtils.info("Há pelo menos um campo obrigatório não preenchido.");
10537
9294
  }
10538
- return result.isValid;
9295
+ return isValid;
10539
9296
  }
10540
- }
10541
- var DependencyType;
10542
- (function (DependencyType) {
10543
- DependencyType["SEARCHING"] = "SEARCHING";
10544
- DependencyType["REQUIREMENT"] = "REQUIREMENT";
10545
- DependencyType["VISIBILITY"] = "REQUIREMENT";
10546
- })(DependencyType || (DependencyType = {}));
10547
-
10548
- function scrollToView(forceScroll, elem) {
10549
- if (forceScroll) {
10550
- window.requestAnimationFrame(() => elem.scrollIntoView());
10551
- }
10552
- }
10553
- const Field = ({ dataUnit, field, forceScroll, enabled }) => {
10554
- const { name, form } = field;
10555
- const { label, userInterface, properties, required, dependencies, readOnly } = dataUnit.getFieldMetadata(name);
10556
- const value = dataUnit.getValue(name) || null;
10557
- const loadingData = dataUnit.isLoading();
10558
- const formattedLabel = required ? `* ${label} (obrigatório)` : label;
10559
- const errorMessage = dataUnit.getErrorMessage(name);
10560
- const key = `${dataUnit.name}-${name}`;
10561
- const isEnabled = enabled && !readOnly;
10562
- const changeFieldHandler = (newValue) => {
10563
- dataUnit.changeValue(name, newValue);
10564
- };
10565
- switch (userInterface) {
10566
- case "LONGTEXT":
10567
- return h("div", { class: "col col--sd-12 padding--small" }, loadingData ? h("place-holder", null) :
10568
- 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 }));
10569
- case "CHECKBOX":
10570
- case "SWITCH":
10571
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small align--middle padding-bottom--large" }, loadingData ? h("place-holder", null) :
10572
- 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 }));
10573
- case "OPTIONSELECTOR":
10574
- const optsObj = properties ? JSON.parse(getProp(properties, "options")) : {};
10575
- const normalized = Object.keys(optsObj).map(key => { return { value: key, label: optsObj[key] }; });
10576
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
10577
- 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 }));
10578
- case "SEARCH":
10579
- const context = {
10580
- __MAIN_FORM: form,
10581
- __DATA_UNIT: dataUnit.name,
10582
- __FIELD_NAME: name
10583
- };
10584
- properties.forEach(({ name, value }) => {
10585
- context[name] = value;
10586
- });
10587
- let criteriaList = [];
10588
- dependencies === null || dependencies === void 0 ? void 0 : dependencies.forEach(dependency => {
10589
- var _a;
10590
- if (dependency.type === DependencyType.SEARCHING) {
10591
- if (((_a = dependency.masterFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
10592
- let criteria = {
10593
- expression: dependency.expression,
10594
- paramNames: [...dependency.masterFields],
10595
- paramResolver: name => dataUnit.getValue(name)
10596
- };
10597
- criteriaList.push(criteria);
10598
- }
10599
- }
10600
- });
10601
- if (criteriaList.length > 0) {
10602
- context["CRITERIA"] = criteriaList;
10603
- }
10604
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
10605
- h("ez-search", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, optionLoader: (argument) => {
10606
- if (form) {
10607
- return form.loadSearch(argument, context);
10608
- }
10609
- }, ref: elem => scrollToView(forceScroll, elem), key: key }));
10610
- case "FILE":
10611
- const target = getProp(properties, "URL");
10612
- const strHeaders = getProp(properties, "HEADERS");
10613
- const headers = strHeaders ? JSON.parse(strHeaders) : {};
10614
- const maxfiles = Number(getProp(properties, "maxfiles") || 0);
10615
- return (h("div", { class: "col col--sd-12 padding--small" }, loadingData ? h("place-holder", null) :
10616
- h("ez-upload", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.detail), urlUpload: target, requestHeaders: headers, maxFiles: maxfiles })));
10617
- case "DATE":
10618
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
10619
- 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 }));
10620
- case "DECIMALNUMBER":
10621
- case "INTEGERNUMBER":
10622
- let precision = 0;
10623
- let prettyPrecision = 0;
10624
- if (userInterface === "DECIMALNUMBER") {
10625
- precision = Number(getProp(properties, "precision") || 2);
10626
- prettyPrecision = Number(getProp(properties, "prettyprecision") || precision);
10627
- }
10628
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
10629
- 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 }));
10630
- //IMAGE, DATETIME, ELAPSEDTIME, PASSWORD, MASKEDTEXT, HTML
10631
- default:
10632
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
10633
- 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 }));
10634
- }
10635
- };
10636
- function getProp(properties, name) {
10637
- var _a;
10638
- return properties ? (_a = properties.find(prop => prop.name === name)) === null || _a === void 0 ? void 0 : _a.value : null;
10639
- }
10640
-
10641
- const FieldSet = ({ store, formName, source, dataUnit, enabled }) => {
10642
- const { label, fields } = source;
10643
- const fieldSetName = formName + label;
10644
- let isCollapsed = selectIsCollapsedFieldSet(store.getState(), formName + label);
10645
- let fieldToScroll;
10646
- source.fields.forEach((field) => {
10647
- if (fieldToScroll === undefined) {
10648
- const fieldError = dataUnit.getErrorMessage(field.name);
10649
- if (fieldError !== undefined && fieldError !== null && fieldError !== "") {
10650
- fieldToScroll = field.name;
10651
- }
10652
- }
10653
- });
10654
- if (fieldToScroll) {
10655
- isCollapsed = false;
10656
- }
10657
- return h("div", { class: "col col--sd-12 padding--small" },
10658
- h("div", { class: "row margin-top--large" },
10659
- h("div", { class: "col col--sd-12 align--middle padding-horizontal--medium" },
10660
- h("ez-collapsible-box", { value: isCollapsed, label: label, onEzChange: () => store.dispatch(collapseExpandGroup(fieldSetName, !isCollapsed)) }),
10661
- isCollapsed ? null :
10662
- h("div", { class: "col col--sd-12" }, fields.map(field => h(Field, { enabled: enabled, field: field, dataUnit: dataUnit, forceScroll: fieldToScroll === field.name }))))));
10663
- };
10664
-
10665
- function buildFormItem(source, formName, store, dataUnit, enabled) {
10666
- if ("fields" in source) {
10667
- return h(FieldSet, { enabled: enabled, source: source, store: store, formName: formName, dataUnit: dataUnit });
10668
- }
10669
- const fieldName = source.name;
10670
- const errorMsg = dataUnit.getErrorMessage(fieldName);
10671
- const forceScroll = errorMsg === undefined || errorMsg === null || errorMsg === "" ? false : true;
10672
- return h(Field, { enabled: enabled, field: source, dataUnit: dataUnit, forceScroll: forceScroll });
10673
- }
10674
- const FormSheet = ({ store, parentName, source, parentDataUnit, dataUnitBuilder, enabled }) => {
10675
- const selectedTab = selectCurrentTab(store.getState(), parentName);
10676
- const tabs = source.length > 1 ? source.map(form => h("ez-tab", { label: form.label, tabKey: form.name })) : null;
10677
- const { subForms, items, name } = source[selectedTab];
10678
- const dataUnit = dataUnitBuilder(source[selectedTab].dataUnit, parentDataUnit);
10679
- source[selectedTab].dataUnit = dataUnit;
10680
- const hasSubForms = subForms && subForms.length > 0;
10681
- const changeTabHandler = (index) => {
10682
- store.dispatch(changeTab$1(parentName, index));
10683
- };
10684
- //todos os campos e subformulários precisam estar ligados a um DU
10685
- const currentDU = dataUnit || parentDataUnit;
10686
- let buttons = selectVisibleButtons(store.getState());
10687
- if (currentDU.cardinality === "1") {
10688
- buttons.addVisible = false;
10689
- buttons.removeVisible = false;
10690
- buttons.nextVisible = false;
10691
- buttons.previousVisible = false;
10692
- }
10693
- return h("div", { class: "form-sheet" },
10694
- tabs ? h("ez-tabselector", { selectedIndex: selectedTab, selectedTab: name, onEzChange: (evt) => changeTabHandler(evt.target.selectedindex) }, tabs) : null,
10695
- dataUnit ? h(NavigationBar, { enabled: enabled, dataUnit: dataUnit, buttonProps: buttons }) : null,
10696
- h("div", { class: "tab__container" },
10697
- items ? items.map(item => buildFormItem(item, name, store, currentDU, enabled)) : null,
10698
- hasSubForms ? h(FormSheet, { enabled: enabled, store: store, source: subForms, parentName: name, parentDataUnit: currentDU, dataUnitBuilder: dataUnitBuilder }) : null));
10699
- };
10700
-
10701
- 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}";
10702
-
10703
- let EzForm$1 = class extends HTMLElement$1 {
10704
- constructor() {
10705
- super();
10706
- this.__registerHost();
10707
- this.enabled = true;
10708
- this.loading = false;
10709
- this._dataUnits = new Map();
10710
- this._duSources = new Map();
10711
- this._tabPositionByField = new Map();
10712
- this._duToLoad = [];
10713
- }
10714
- cleanPreparedMetadata() {
10715
- this._preparedMetadata = undefined;
10716
- }
10717
- async validate() {
10718
- const duSourcesNames = Array.from(this._duSources.keys());
10719
- for (let i = 0; i < this._duSources.size; i++) {
10720
- const duName = duSourcesNames[i];
10721
- let du = this._dataUnits.get(duName);
10722
- if (du === undefined) {
10723
- const source = this._duSources.get(duName);
10724
- du = this.buildDataUnit(source, source.parentDUName);
10725
- }
10726
- if (!du.validateRecords()) {
10727
- return false;
10728
- }
10729
- }
10730
- return true;
10731
- }
10732
- async getChanges() {
10733
- let allChanges = [];
10734
- const dataUnits = Array.from(this._dataUnits.values());
10735
- for (let i = 0; i < this._dataUnits.size; i++) {
10736
- const du = dataUnits[i];
10737
- //Só devemos buscar as alterações de DU raiz, pois os sub DUs serão enviados junto.
10738
- if (!du.parentDU) {
10739
- const duChanges = du.getChangesToSave();
10740
- if (duChanges) {
10741
- allChanges = allChanges.concat(duChanges);
10742
- }
10743
- }
10744
- }
10745
- return allChanges;
10746
- }
10747
- async changeFieldValue(dataUnit, fieldName, value) {
10748
- const du = this._dataUnits.get(dataUnit);
10749
- if (du) {
10750
- du.changeValue(fieldName, value);
10751
- }
10752
- }
10753
- validateRecords(dataUnit, records, triggedBy) {
10754
- const result = { isValid: true, message: "" };
10755
- if (this.ignoreSaveValidation && triggedBy === "SAVE") {
10756
- return result;
10757
- }
10758
- const validateField = (field) => {
10759
- if (field.readOnly) {
10760
- return false;
10761
- }
10762
- if (field.userInterface === "SWITCH" || field.userInterface === "CHECKBOX") {
10763
- return false;
10764
- }
10765
- return true;
10766
- };
10767
- const recordValidator = record => {
10768
- dataUnit.requiredFields.forEach(field => {
10769
- if (validateField(field)) {
10770
- const recordIndex = record["record__index"];
10771
- const fieldName = field.name;
10772
- const fieldValue = record[fieldName];
10773
- if (fieldValue === null || fieldValue === undefined || fieldValue === "") {
10774
- const tabPosition = this._tabPositionByField.get(dataUnit.name + field.name);
10775
- this._store.dispatch(invalidField$1(tabPosition.tabName, tabPosition.index, dataUnit.name, recordIndex, record.record__id, field.name, "Essa informação é obrigatória"));
10776
- result.isValid = false;
10777
- result.message = "Há pelo menos um campo obrigatório não preenchido.";
10778
- }
10779
- }
10780
- });
10781
- };
10782
- if (dataUnit.records.length === 0) {
10783
- recordValidator({});
9297
+ getDynamicContent() {
9298
+ var _a;
9299
+ const formMD = selectFormMetadata(this._store.getState());
9300
+ if (!formMD)
9301
+ return null;
9302
+ const currentSheet = selectCurrentSheet((_a = this._store) === null || _a === void 0 ? void 0 : _a.getState());
9303
+ if (!currentSheet) {
9304
+ return null;
10784
9305
  }
10785
- else {
10786
- let validatedRecords = {};
10787
- records.forEach(r => {
10788
- recordValidator(r);
10789
- validatedRecords[r.record__id] = true;
10790
- });
10791
- dataUnit.records.forEach(r => {
10792
- if (!validatedRecords[r.record__id]) {
10793
- recordValidator(r);
10794
- }
10795
- });
9306
+ const allSheets = Array.from(formMD.getAllSheets().values());
9307
+ const result = [];
9308
+ if (allSheets.length > 1) {
9309
+ 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 }))));
10796
9310
  }
9311
+ result.push(h(FormSheet, { store: this._store, source: currentSheet }));
10797
9312
  return result;
10798
9313
  }
10799
- loadMDFromExecutor(callBack) {
10800
- const loadMetadataFunction = this.parseExecutor(this.metadataExecutor);
10801
- if (loadMetadataFunction) {
10802
- const result = loadMetadataFunction();
10803
- if (result) {
10804
- if (result instanceof Promise) {
10805
- result.then(md => {
10806
- callBack(md);
10807
- });
10808
- }
10809
- else {
10810
- callBack(result);
10811
- }
10812
- }
9314
+ processMetadata() {
9315
+ if (!this.isStatic()) {
9316
+ const metadata = this.config && this.config.length > 0 ? buildFromConfig(this.config, this.dataUnit) : buildFromDataUnit(this.dataUnit);
9317
+ this._store.dispatch(loadMetadata(metadata));
10813
9318
  }
10814
9319
  }
10815
- loadMDFromElement(callBack) {
10816
- const metadata = [];
10817
- Array.from(this._host.children).forEach(elem => {
10818
- if (elem.tagName === "FORM-METADATA") {
10819
- const formMetadata = elem;
10820
- metadata.push(formMetadata.metadata);
10821
- }
10822
- });
10823
- callBack(metadata.length > 0 ? metadata : null);
10824
- }
10825
- updateMetadata(metadata) {
10826
- if (metadata) {
10827
- const processFields = (duName, form, tabController, tabIndex) => {
10828
- var _a;
10829
- form.items.forEach(item => {
10830
- if ("fields" in item) {
10831
- const fSet = item;
10832
- fSet.fields.forEach(f => {
10833
- f.form = this;
10834
- this._tabPositionByField.set(duName + f.name, { tabName: tabController, index: tabIndex });
10835
- });
10836
- }
10837
- else {
10838
- const f = item;
10839
- f.form = this;
10840
- this._tabPositionByField.set(duName + f.name, { tabName: tabController, index: tabIndex });
10841
- }
10842
- });
10843
- (_a = form.subForms) === null || _a === void 0 ? void 0 : _a.forEach((subForm, index) => {
10844
- const subDu = subForm.dataUnit;
10845
- if (subDu) {
10846
- this._duSources.set(subDu.name, subDu);
10847
- subDu.parentDUName = duName;
10848
- }
10849
- processFields(subDu ? subDu.name : duName, subForm, form.name, index);
10850
- });
10851
- };
10852
- this._preparedMetadata = metadata.map((form, index) => {
10853
- const du = form.dataUnit;
10854
- if (form.autoLoad) {
10855
- this._duToLoad.push(du);
10856
- }
10857
- this.decorateDU(du);
10858
- const duName = du.name;
10859
- this._duSources.set(duName, du);
10860
- processFields(duName, form, "__MAIN__FORM__", index);
10861
- return form;
10862
- });
10863
- this._store.dispatch(formLoad());
10864
- }
10865
- }
10866
- parseExecutor(executor) {
10867
- if (executor) {
10868
- return executor instanceof Function ? executor : eval(executor);
10869
- }
10870
- return null;
9320
+ isStatic() {
9321
+ var _a;
9322
+ return ((_a = this._staticFields) === null || _a === void 0 ? void 0 : _a.length) > 0;
10871
9323
  }
10872
- componentWillRender() {
10873
- if (this._store === undefined) {
10874
- const rootReducer = combineReducers({
10875
- "hist": undoable(formReducer),
10876
- "nonhist": formNonHistoricReducer
10877
- });
10878
- this._store = createStore(rootReducer, applyMiddleware(thunk));
10879
- this._store.subscribe(() => { forceUpdate(this); });
10880
- if (this.slaveMode) {
10881
- this._store.dispatch(showHideNavigationButtons("saveVisible", false));
10882
- this._store.dispatch(showHideNavigationButtons("cancelVisible", false));
10883
- this._store.dispatch(showHideNavigationButtons("reloadVisible", false));
10884
- }
9324
+ componentWillLoad() {
9325
+ if (this.dataUnit === undefined) {
9326
+ this.dataUnit = new DataUnit("ez-form");
10885
9327
  }
10886
- if (this._preparedMetadata === undefined) {
10887
- if (this.metadata) {
10888
- this.updateMetadata(this.metadata);
9328
+ this.dataUnit.subscribe(action => {
9329
+ if (action.type === Action.METADATA_LOADED) {
9330
+ this.processMetadata();
10889
9331
  }
10890
- else {
10891
- this.loadMDFromElement((md) => this.updateMetadata(md));
10892
- if (!this._preparedMetadata) {
10893
- this.loadMDFromExecutor((md) => this.updateMetadata(md));
10894
- }
10895
- }
10896
- }
9332
+ });
9333
+ this._dataBinder = new DataBinder(this.dataUnit);
9334
+ this._store = createStore(formReducer);
9335
+ this._store.subscribe(() => forceUpdate(this));
9336
+ this._staticFields = Array.from(this._element.querySelectorAll("[data-field-name]"));
9337
+ this.processMetadata();
10897
9338
  }
10898
9339
  componentDidRender() {
10899
- this._duToLoad.forEach(du => du.load());
10900
- this._duToLoad = [];
10901
- }
10902
- loadSearch(argument, context) {
10903
- const fieldSearchExecutor = this.parseExecutor(this.fieldSearchExecutor);
10904
- if (fieldSearchExecutor) {
10905
- return fieldSearchExecutor(argument, context);
10906
- }
10907
- else {
10908
- return [{ value: 0, label: "Sem resultados" }];
10909
- }
10910
- }
10911
- buildDataUnit(dataUnit, parentDataUnit) {
10912
- if (dataUnit) {
10913
- const { name, unitLabel, records, cardinality, fields } = dataUnit;
10914
- if (!(dataUnit instanceof DataUnit)) {
10915
- let parent;
10916
- if (parentDataUnit instanceof DataUnit) {
10917
- parent = parentDataUnit;
10918
- }
10919
- else {
10920
- parent = this._dataUnits.get(parentDataUnit);
10921
- }
10922
- dataUnit = new DataUnit(name, unitLabel, cardinality, parent);
10923
- dataUnit.fields = fields;
10924
- this._dataUnits.set(dataUnit.name, dataUnit);
10925
- if (records) {
10926
- dataUnit.records = records;
10927
- }
10928
- }
10929
- this.decorateDU(dataUnit);
10930
- }
10931
- return dataUnit;
10932
- }
10933
- decorateDU(dataUnit) {
10934
- dataUnit.store = this._store;
10935
- dataUnit.loadExecutor = this.parseExecutor(this.loadExecutor);
10936
- dataUnit.saveExecutor = this.parseExecutor(this.saveExecutor);
10937
- dataUnit.removeExecutor = this.parseExecutor(this.removeExecutor);
10938
- dataUnit.recordsValidator = this;
9340
+ this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")));
10939
9341
  }
10940
9342
  render() {
10941
- if (this.loading) {
10942
- return h("place-holder", null);
10943
- }
10944
- else {
10945
- 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;
10946
- }
9343
+ return (h(Host, null, this.isStatic() ? null : this.getDynamicContent()));
10947
9344
  }
10948
- static get assetsDirs() { return ["assets"]; }
10949
- get _host() { return this; }
10950
- static get watchers() { return {
10951
- "metadata": ["cleanPreparedMetadata"]
10952
- }; }
9345
+ get _element() { return this; }
10953
9346
  static get style() { return ezFormCss; }
10954
9347
  };
10955
9348
 
@@ -121949,7 +120342,7 @@ let EzModal$1 = class extends HTMLElement$1 {
121949
120342
  static get style() { return ezModalCss; }
121950
120343
  };
121951
120344
 
121952
- const ezNumberInputCss = ":host{display:block;width:100%;--ez-number-input__input--background-color:var(--background--medium, #e0e0e0);--ez-number-input__input--border-color:var(--ez-number-input__input--background-color)}.text-input{--ez-number-input__input--background-color:inherit;--ez-number-input__input--border-color:inherit}";
120345
+ const ezNumberInputCss = ":host{display:block;width:100%}";
121953
120346
 
121954
120347
  let EzNumberInput$1 = class extends HTMLElement$1 {
121955
120348
  constructor() {
@@ -121961,17 +120354,6 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
121961
120354
  * Deixa o campo disponível ou não para uso.
121962
120355
  */
121963
120356
  this.enabled = true;
121964
- /**
121965
- * Configura o alinhamento do texto.
121966
- */
121967
- this.textleft = false;
121968
- /**
121969
- * Opção de configurar a transformação de string to number entre formatação pt-BR e en-US
121970
- * (formatação de ENTRADA e SAÍDA do componente: pt-BR="###.###,##" en-US="###,###.##"; Default: "pt-BR")
121971
- * Qualquer outro valor que não seja "en-US", adotará a formatação "pt-BR"
121972
- * Não é case sensitive
121973
- */
121974
- this.formatNumber = "PT-BR";
121975
120357
  }
121976
120358
  setLabel() {
121977
120359
  this._textInput.label = this.label;
@@ -121984,22 +120366,11 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
121984
120366
  this._textInput.value = this.getTextValue(this.value);
121985
120367
  }
121986
120368
  }
121987
- onPrecisionChanged(newPrecision) {
121988
- if (isNaN(newPrecision)) {
121989
- this.precision = 0;
121990
- }
121991
- }
121992
- onPrettyPrecisionChanged(newPrettyPrecision) {
121993
- if (isNaN(newPrettyPrecision)) {
121994
- this.prettyPrecision = 0;
121995
- }
121996
- }
121997
120369
  changeValue(newValue) {
121998
120370
  this.errorMessage = "";
121999
120371
  if (newValue && newValue !== this.value) {
122000
120372
  this.value = newValue;
122001
- this._textInput.value = this.getTextValue(newValue);
122002
- this.ezChange.emit();
120373
+ this.ezChange.emit(this.value);
122003
120374
  }
122004
120375
  }
122005
120376
  parseNumber() {
@@ -122018,48 +120389,22 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
122018
120389
  }
122019
120390
  }
122020
120391
  getTextValue(value) {
122021
- const parsedNumber = value ? NumberUtils.stringToNumber(value) : null;
122022
- if (parsedNumber != null && isNaN(parsedNumber)) {
122023
- this.errorMessage = "O valor digitado não é um número válido";
122024
- }
122025
- else {
122026
- return this.formatNumber.toUpperCase() !== "EN-US" ? NumberUtils.format(value.toString(), this.precision, this.prettyPrecision) : NumberUtils.changeFormat(NumberUtils.format(value.toString(), this.precision, this.prettyPrecision));
120392
+ if (value) {
120393
+ return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
122027
120394
  }
122028
- return "";
120395
+ return null;
122029
120396
  }
122030
120397
  componentDidLoad() {
122031
- if (!this.textleft) {
122032
- this._textInput.shadowRoot.querySelector('input').classList.add('text--right');
122033
- }
122034
- let rightItem;
122035
- let letfItem;
122036
- for (const key in this._hostElement.children) {
122037
- if (Object.prototype.hasOwnProperty.call(this._hostElement.children, key)) {
122038
- const element = this._hostElement.children[key];
122039
- if (element.getAttribute('slot') === 'rightIcon') {
122040
- rightItem = element;
122041
- }
122042
- else if (element.getAttribute('slot') === 'leftIcon') {
122043
- letfItem = element;
122044
- }
122045
- }
122046
- }
122047
- this._leftSlotItem = letfItem;
122048
- this._rightSlotItem = rightItem;
122049
- }
122050
- componentWillLoad() {
122051
- this.onPrecisionChanged(this.precision);
122052
- this.onPrettyPrecisionChanged(this.prettyPrecision);
120398
+ CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
122053
120399
  }
122054
120400
  render() {
122055
- return (h(Host, { ref: elem => this._hostElement = elem }, h("ez-text-input", { class: "text-input", ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789-,.", enabled: this.enabled, errorMessage: this.errorMessage }, this._rightSlotItem ? h("slot", { name: "rightIcon", slot: "rightIcon" }) : undefined, this._leftSlotItem ? h("slot", { name: "leftIcon", slot: "leftIcon" }) : undefined)));
120401
+ return (h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage }));
122056
120402
  }
120403
+ get _elem() { return this; }
122057
120404
  static get watchers() { return {
122058
120405
  "label": ["setLabel"],
122059
120406
  "errorMessage": ["setErrorMessage"],
122060
- "value": ["applyValueToInput"],
122061
- "precision": ["onPrecisionChanged"],
122062
- "prettyPrecision": ["onPrettyPrecisionChanged"]
120407
+ "value": ["applyValueToInput"]
122063
120408
  }; }
122064
120409
  static get style() { return ezNumberInputCss; }
122065
120410
  };
@@ -122253,10 +120598,14 @@ let EzSearch$1 = class extends HTMLElement$1 {
122253
120598
  this.value = evt.detail;
122254
120599
  this.ezChange.emit(evt.detail);
122255
120600
  }
120601
+ componentDidLoad() {
120602
+ CSSVarsUtils.applyVarsTextInput(this._elem, this._comboElement);
120603
+ }
122256
120604
  render() {
122257
120605
  return (h("ez-combo-box", { ref: elem => this._comboElement = elem, value: this.value, label: this.label, enabled: this.enabled, errorMessage: this.errorMessage, optionLoader: this.optionLoader, searchMode: true, onEzChange: evt => this.onComboChange(evt), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue }));
122258
120606
  }
122259
120607
  ;
120608
+ get _elem() { return this; }
122260
120609
  static get watchers() { return {
122261
120610
  "value": ["updateValue"]
122262
120611
  }; }
@@ -123248,128 +121597,6 @@ let EzUpload$1 = class extends HTMLElement$1 {
123248
121597
  static get style() { return ezUploadCss; }
123249
121598
  };
123250
121599
 
123251
- let FormMetadata$1 = class extends HTMLElement$1 {
123252
- constructor() {
123253
- super();
123254
- this.__registerHost();
123255
- this.__attachShadow();
123256
- }
123257
- buildField(element) {
123258
- let label = element.getAttribute("label");
123259
- let name = element.getAttribute("name") || label;
123260
- let userInterface = element.getAttribute("ui") || "SHORTTEXT";
123261
- let properties = [];
123262
- if (userInterface === "OPTIONSELECTOR") {
123263
- if (!label) {
123264
- label = "Selecione uma das opções:";
123265
- }
123266
- const objOpts = {};
123267
- Array.from(element.getElementsByTagName("OPTION")).forEach((optElem, index) => {
123268
- const optValue = optElem.getAttribute("value") || index;
123269
- const optLabel = optElem.textContent;
123270
- objOpts[optValue] = optLabel;
123271
- });
123272
- properties.push({ name: "options", value: JSON.stringify(objOpts) });
123273
- }
123274
- else if (userInterface === "FILE") {
123275
- const urlElement = element.querySelector("URL");
123276
- const headersElement = element.querySelectorAll("HEADERS>HEADER");
123277
- if (urlElement) {
123278
- properties.push({ name: "URL", value: urlElement.textContent });
123279
- }
123280
- if (headersElement && headersElement.length > 0) {
123281
- const headers = {};
123282
- headersElement.forEach(header => {
123283
- headers[header.getAttribute("name")] = header.textContent;
123284
- });
123285
- properties.push({ name: "HEADERS", value: JSON.stringify(headers) });
123286
- }
123287
- this.addPropertyIfExists(properties, element, "maxfiles");
123288
- }
123289
- else {
123290
- if (!label) {
123291
- label = element.textContent;
123292
- }
123293
- this.addPropertyIfExists(properties, element, "precision");
123294
- this.addPropertyIfExists(properties, element, "prettyprecision");
123295
- }
123296
- const defaultValue = element.getAttribute("defaultValue");
123297
- const required = element.getAttribute("required") === "true";
123298
- const readOnly = element.getAttribute("readonly") === "true";
123299
- return { name, userInterface, label, defaultValue, required, readOnly, properties };
123300
- }
123301
- addPropertyIfExists(properties, element, name) {
123302
- const value = element.getAttribute(name);
123303
- if (value) {
123304
- properties.push({ name, value });
123305
- }
123306
- }
123307
- buildFieldSet(dataUnit, element) {
123308
- const label = element.getAttribute("label");
123309
- const fields = Array.from(element.getElementsByTagName("FIELD")).map(f => {
123310
- const field = this.buildField(f);
123311
- dataUnit.addFieldMetadata(field);
123312
- return { name: field.name };
123313
- });
123314
- return { label, fields };
123315
- }
123316
- fromElements(elements, label, name, dataUnit, autoLoad) {
123317
- const form = {
123318
- name: name || label,
123319
- dataUnit,
123320
- label,
123321
- autoLoad
123322
- };
123323
- Array.from(elements).forEach(child => {
123324
- const tagName = child.tagName.toUpperCase();
123325
- switch (tagName) {
123326
- case "FIELD":
123327
- if (!form.items) {
123328
- form.items = [];
123329
- }
123330
- const f = this.buildField(child);
123331
- dataUnit.addFieldMetadata(f);
123332
- form.items.push({ name: f.name });
123333
- break;
123334
- case "FIELD-SET":
123335
- if (!form.items) {
123336
- form.items = [];
123337
- }
123338
- form.items.push(this.buildFieldSet(dataUnit, child));
123339
- break;
123340
- case "SUB-FORM":
123341
- if (!form.subForms) {
123342
- form.subForms = [];
123343
- }
123344
- const label = child.getAttribute("label") || "Subform " + (form.subForms.length + 1);
123345
- const name = child.getAttribute("name") || label;
123346
- const subDuName = child.getAttribute("dataunit");
123347
- let subDu;
123348
- if (subDuName) {
123349
- subDu = new DataUnit(subDuName, "noname", child.hasAttribute("many") ? "N" : "1");
123350
- }
123351
- else {
123352
- subDu = dataUnit;
123353
- }
123354
- form.subForms.push(this.fromElements(child.children, label, name, subDu, child.getAttribute("autoload") === "true"));
123355
- break;
123356
- }
123357
- });
123358
- return form;
123359
- }
123360
- connectedCallback() {
123361
- if (!this.dataunit) {
123362
- this.dataunit = "dataunit_" + (this.name || this.label || new Date().getTime());
123363
- }
123364
- const du = new DataUnit(this.dataunit, "noname", this.many ? "N" : "1");
123365
- this.metadata = this.fromElements(this._host.children, this.label, this.name, du, this.autoload);
123366
- }
123367
- render() {
123368
- return h(Host, null);
123369
- }
123370
- get _host() { return this; }
123371
- };
123372
-
123373
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)}";
123374
121601
 
123375
121602
  let GridConfig$1 = class extends HTMLElement$1 {
@@ -123620,20 +121847,6 @@ let GridConfig$1 = class extends HTMLElement$1 {
123620
121847
  static get style() { return gridConfigCss; }
123621
121848
  };
123622
121849
 
123623
- 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}}";
123624
-
123625
- let PlaceHolder$1 = class extends HTMLElement$1 {
123626
- constructor() {
123627
- super();
123628
- this.__registerHost();
123629
- this.__attachShadow();
123630
- }
123631
- render() {
123632
- return h(Host, null);
123633
- }
123634
- static get style() { return placeHolderCss; }
123635
- };
123636
-
123637
121850
  const selectBoxCss = "select{border:1px solid #DCE0E8;font-family:'Sora';border-radius:3px;outline:none;cursor:pointer}";
123638
121851
 
123639
121852
  let SelectBox$1 = class extends HTMLElement$1 {
@@ -123669,34 +121882,77 @@ let TestDu$1 = class extends HTMLElement$1 {
123669
121882
  constructor() {
123670
121883
  super();
123671
121884
  this.__registerHost();
123672
- this._dataUnit = new DataUnit$1("duteste");
123673
121885
  }
123674
- componentDidLoad() {
123675
- this._dataUnit.dataLoader = (_dataUnit, _sort, _filters) => {
123676
- return Promise.resolve([
123677
- { __record__id__: "registro1", CODPARC: 10, NOMEPARC: "Parceiro 10" },
123678
- { __record__id__: "registro2", CODPARC: 20, NOMEPARC: "Parceiro 20" }
123679
- ]);
123680
- };
123681
- this._dataUnit.metadata = {
123682
- name: "Parceiro",
121886
+ componentWillLoad() {
121887
+ this.dataUnit = new DataUnit("testes_com_formulario");
121888
+ this.dataUnit.metadata = {
121889
+ name: "dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",
123683
121890
  label: "Parceiro",
123684
121891
  fields: [
123685
121892
  {
123686
121893
  name: "CODPARC",
123687
- label: "Cód. Parceiro",
123688
- dataType: DataType.NUMBER
121894
+ label: "Parceiro",
121895
+ dataType: DataType.NUMBER,
121896
+ userInterface: UserInterface.SEARCH,
121897
+ required: true,
121898
+ properties: {}
123689
121899
  },
123690
121900
  {
123691
- name: "NOMEPARC",
123692
- label: "Nome Parceiro",
123693
- dataType: DataType.TEXT
121901
+ name: "RECDESP",
121902
+ label: "Receita/Despesa",
121903
+ dataType: DataType.TEXT,
121904
+ userInterface: UserInterface.OPTIONSELECTOR,
121905
+ required: true,
121906
+ properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
121907
+ },
121908
+ {
121909
+ name: "P",
121910
+ label: "pera",
121911
+ dataType: DataType.TEXT,
121912
+ userInterface: UserInterface.OPTIONSELECTOR,
121913
+ properties: { options: `{"M": "Madura", "V": "Verde", "P": "Passada"}` }
121914
+ },
121915
+ {
121916
+ name: "ME",
121917
+ label: "ME",
121918
+ dataType: DataType.NUMBER,
121919
+ userInterface: UserInterface.DECIMALNUMBER,
121920
+ properties: { precision: 4, prettyPrecision: 1 }
123694
121921
  }
123695
121922
  ]
123696
121923
  };
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 = [
121933
+ {
121934
+ __record__id__: "1321321321321321",
121935
+ CODPARC: 10,
121936
+ NOMEPARC: "Parceiro 10",
121937
+ P: "M",
121938
+ L: "Bagaço",
121939
+ LI: "Azedo"
121940
+ }
121941
+ ];
123697
121942
  }
123698
121943
  render() {
123699
- return (h("section", { class: "padding--large" }, h("div", { class: "row margin-bottom--large" }, h("h1", { class: "title title--primary" }, "Formul\u00E1rios")), h("div", { class: "col col--sd-12", style: { height: "600px" } }, h("ez-grid", { dataUnit: this._dataUnit, "server-url": "https://www.ag-grid.com/example-assets/row-data.json", "multiple-selection": true, "page-size": "100" }))));
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 }));
123700
121956
  }
123701
121957
  static get style() { return testDuCss; }
123702
121958
  };
@@ -123711,13 +121967,13 @@ const EzComboBox = /*@__PURE__*/proxyCustomElement(EzComboBox$1, [1,"ez-combo-bo
123711
121967
  const EzDateInput = /*@__PURE__*/proxyCustomElement(EzDateInput$1, [1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"]}]);
123712
121968
  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"]}]);
123713
121969
  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"]}]);
123714
- const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [0,"ez-form",{"metadataExecutor":[1,"metadata-executor"],"loadExecutor":[1,"load-executor"],"saveExecutor":[1,"save-executor"],"removeExecutor":[1,"remove-executor"],"fieldSearchExecutor":[1,"field-search-executor"],"ignoreSaveValidation":[4,"ignore-save-validation"],"metadata":[16],"slaveMode":[4,"slave-mode"],"enabled":[4],"loading":[1540]}]);
121970
+ const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [0,"ez-form",{"dataUnit":[1040],"config":[16]}]);
123715
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]}]);
123716
121972
  const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513]}]);
123717
121973
  const EzLabelChip = /*@__PURE__*/proxyCustomElement(EzLabelChip$1, [1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540]}]);
123718
121974
  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]}]);
123719
121975
  const EzModal = /*@__PURE__*/proxyCustomElement(EzModal$1, [1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]);
123720
- const EzNumberInput = /*@__PURE__*/proxyCustomElement(EzNumberInput$1, [1,"ez-number-input",{"label":[513],"value":[1544],"enabled":[516],"errorMessage":[1537,"error-message"],"precision":[1538],"prettyPrecision":[1538,"pretty-precision"],"textleft":[516],"formatNumber":[513,"format-number"],"_leftSlotItem":[32],"_rightSlotItem":[32]}]);
121976
+ const EzNumberInput = /*@__PURE__*/proxyCustomElement(EzNumberInput$1, [1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"]}]);
123721
121977
  const EzPopover = /*@__PURE__*/proxyCustomElement(EzPopover$1, [1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540]}]);
123722
121978
  const EzPopup = /*@__PURE__*/proxyCustomElement(EzPopup$1, [1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]);
123723
121979
  const EzSearch = /*@__PURE__*/proxyCustomElement(EzSearch$1, [1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"]}]);
@@ -123727,9 +121983,7 @@ const EzTextInput = /*@__PURE__*/proxyCustomElement(EzTextInput$1, [1,"ez-text-i
123727
121983
  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"]}]);
123728
121984
  const EzToast = /*@__PURE__*/proxyCustomElement(EzToast$1, [1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"]}]);
123729
121985
  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]}]);
123730
- const FormMetadata = /*@__PURE__*/proxyCustomElement(FormMetadata$1, [1,"form-metadata",{"name":[1],"label":[1],"dataunit":[1025],"many":[4],"autoload":[4],"metadata":[1040]}]);
123731
121986
  const GridConfig = /*@__PURE__*/proxyCustomElement(GridConfig$1, [1,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]);
123732
- const PlaceHolder = /*@__PURE__*/proxyCustomElement(PlaceHolder$1, [1,"place-holder"]);
123733
121987
  const SelectBox = /*@__PURE__*/proxyCustomElement(SelectBox$1, [1,"select-box",{"selectedOption":[1,"selected-option"]}]);
123734
121988
  const TestDu = /*@__PURE__*/proxyCustomElement(TestDu$1, [0,"test-du"]);
123735
121989
  const defineCustomElements = (opts) => {
@@ -123761,9 +122015,7 @@ const defineCustomElements = (opts) => {
123761
122015
  EzTimeInput,
123762
122016
  EzToast,
123763
122017
  EzUpload,
123764
- FormMetadata,
123765
122018
  GridConfig,
123766
- PlaceHolder,
123767
122019
  SelectBox,
123768
122020
  TestDu
123769
122021
  ].forEach(cmp => {
@@ -123774,4 +122026,4 @@ const defineCustomElements = (opts) => {
123774
122026
  }
123775
122027
  };
123776
122028
 
123777
- 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, FormMetadata, GridConfig, PlaceHolder, SelectBox, TestDu, defineCustomElements };
122029
+ 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 };