@sankhyalabs/ezui 1.2.0-beta.24 → 1.2.0-beta.25

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.
@@ -57,13 +57,13 @@ const buildDate = ({ name, label, readOnly }) => {
57
57
  return (index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
58
58
  index.h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
59
59
  };
60
- const buildTime = ({ name, label }) => {
60
+ const buildTime = ({ name, label, readOnly }) => {
61
61
  return (index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
62
- index.h("ez-time-input", { label: label, "data-field-name": name, key: name })));
62
+ index.h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
63
63
  };
64
- const buildTimeDate = ({ name, label }) => {
64
+ const buildTimeDate = ({ name, label, readOnly }) => {
65
65
  return (index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
66
- index.h("ez-date-time-input", { label: label, "data-field-name": name, key: name })));
66
+ index.h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
67
67
  };
68
68
 
69
69
  const buildDecimal = ({ name, label, readOnly }, properties) => {
@@ -103,10 +103,10 @@ const buildField = (field) => {
103
103
  if (!config.name) {
104
104
  config.name = descriptor.name;
105
105
  }
106
- if (config.required === undefined) {
106
+ if (config.required == undefined || descriptor.required === true) {
107
107
  config.required = descriptor.required;
108
108
  }
109
- if (config.readOnly === undefined) {
109
+ if (config.readOnly == undefined || descriptor.readOnly === true) {
110
110
  config.readOnly = descriptor.readOnly;
111
111
  }
112
112
  props = descriptor.properties;
@@ -226,8 +226,8 @@ const buildFromConfig = (config, dataUnit) => {
226
226
  if (isRequired) {
227
227
  requiredFields.push(field.name);
228
228
  }
229
- const clearOnCopy = field.cleanOnCopy == undefined ? (((_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy) || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum)) : field.cleanOnCopy;
230
- if (clearOnCopy) {
229
+ const cleanOnCopy = field.cleanOnCopy == undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : field.cleanOnCopy;
230
+ if (cleanOnCopy || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum)) {
231
231
  cleanOnCopyFields.push(field.name);
232
232
  }
233
233
  const defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
@@ -114939,7 +114939,8 @@ class AgGridController {
114939
114939
  let columns = this.getColumnsDef();
114940
114940
  let visibleColumns = [];
114941
114941
  let sort = [];
114942
- state.forEach((cfgColumn) => {
114942
+ state.forEach((cfgColumn, index) => {
114943
+ this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + 2);
114943
114944
  this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, cfgColumn.width);
114944
114945
  visibleColumns.push(cfgColumn.name);
114945
114946
  if (cfgColumn.ascending !== undefined) {
@@ -31,10 +31,10 @@ export const buildField = (field) => {
31
31
  if (!config.name) {
32
32
  config.name = descriptor.name;
33
33
  }
34
- if (config.required === undefined) {
34
+ if (config.required == undefined || descriptor.required === true) {
35
35
  config.required = descriptor.required;
36
36
  }
37
- if (config.readOnly === undefined) {
37
+ if (config.readOnly == undefined || descriptor.readOnly === true) {
38
38
  config.readOnly = descriptor.readOnly;
39
39
  }
40
40
  props = descriptor.properties;
@@ -3,11 +3,11 @@ export const buildDate = ({ name, label, readOnly }) => {
3
3
  return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
4
4
  h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
5
5
  };
6
- export const buildTime = ({ name, label }) => {
6
+ export const buildTime = ({ name, label, readOnly }) => {
7
7
  return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
8
- h("ez-time-input", { label: label, "data-field-name": name, key: name })));
8
+ h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
9
9
  };
10
- export const buildTimeDate = ({ name, label }) => {
10
+ export const buildTimeDate = ({ name, label, readOnly }) => {
11
11
  return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
12
- h("ez-date-time-input", { label: label, "data-field-name": name, key: name })));
12
+ h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
13
13
  };
@@ -88,8 +88,8 @@ export const buildFromConfig = (config, dataUnit) => {
88
88
  if (isRequired) {
89
89
  requiredFields.push(field.name);
90
90
  }
91
- const clearOnCopy = field.cleanOnCopy == undefined ? (((_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy) || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum)) : field.cleanOnCopy;
92
- if (clearOnCopy) {
91
+ const cleanOnCopy = field.cleanOnCopy == undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : field.cleanOnCopy;
92
+ if (cleanOnCopy || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum)) {
93
93
  cleanOnCopyFields.push(field.name);
94
94
  }
95
95
  const defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
@@ -237,7 +237,8 @@ export default class AgGridController {
237
237
  let columns = this.getColumnsDef();
238
238
  let visibleColumns = [];
239
239
  let sort = [];
240
- state.forEach((cfgColumn) => {
240
+ state.forEach((cfgColumn, index) => {
241
+ this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + 2);
241
242
  this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, cfgColumn.width);
242
243
  visibleColumns.push(cfgColumn.name);
243
244
  if (cfgColumn.ascending !== undefined) {
@@ -2031,13 +2031,13 @@ const buildDate = ({ name, label, readOnly }) => {
2031
2031
  return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
2032
2032
  h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
2033
2033
  };
2034
- const buildTime = ({ name, label }) => {
2034
+ const buildTime = ({ name, label, readOnly }) => {
2035
2035
  return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
2036
- h("ez-time-input", { label: label, "data-field-name": name, key: name })));
2036
+ h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
2037
2037
  };
2038
- const buildTimeDate = ({ name, label }) => {
2038
+ const buildTimeDate = ({ name, label, readOnly }) => {
2039
2039
  return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
2040
- h("ez-date-time-input", { label: label, "data-field-name": name, key: name })));
2040
+ h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
2041
2041
  };
2042
2042
 
2043
2043
  const buildDecimal = ({ name, label, readOnly }, properties) => {
@@ -2077,10 +2077,10 @@ const buildField = (field) => {
2077
2077
  if (!config.name) {
2078
2078
  config.name = descriptor.name;
2079
2079
  }
2080
- if (config.required === undefined) {
2080
+ if (config.required == undefined || descriptor.required === true) {
2081
2081
  config.required = descriptor.required;
2082
2082
  }
2083
- if (config.readOnly === undefined) {
2083
+ if (config.readOnly == undefined || descriptor.readOnly === true) {
2084
2084
  config.readOnly = descriptor.readOnly;
2085
2085
  }
2086
2086
  props = descriptor.properties;
@@ -2200,8 +2200,8 @@ const buildFromConfig = (config, dataUnit) => {
2200
2200
  if (isRequired) {
2201
2201
  requiredFields.push(field.name);
2202
2202
  }
2203
- const clearOnCopy = field.cleanOnCopy == undefined ? (((_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy) || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum)) : field.cleanOnCopy;
2204
- if (clearOnCopy) {
2203
+ const cleanOnCopy = field.cleanOnCopy == undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : field.cleanOnCopy;
2204
+ if (cleanOnCopy || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum)) {
2205
2205
  cleanOnCopyFields.push(field.name);
2206
2206
  }
2207
2207
  const defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
@@ -117918,7 +117918,8 @@ class AgGridController {
117918
117918
  let columns = this.getColumnsDef();
117919
117919
  let visibleColumns = [];
117920
117920
  let sort = [];
117921
- state.forEach((cfgColumn) => {
117921
+ state.forEach((cfgColumn, index) => {
117922
+ this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + 2);
117922
117923
  this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, cfgColumn.width);
117923
117924
  visibleColumns.push(cfgColumn.name);
117924
117925
  if (cfgColumn.ascending !== undefined) {
@@ -53,13 +53,13 @@ const buildDate = ({ name, label, readOnly }) => {
53
53
  return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
54
54
  h("ez-date-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
55
55
  };
56
- const buildTime = ({ name, label }) => {
56
+ const buildTime = ({ name, label, readOnly }) => {
57
57
  return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
58
- h("ez-time-input", { label: label, "data-field-name": name, key: name })));
58
+ h("ez-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
59
59
  };
60
- const buildTimeDate = ({ name, label }) => {
60
+ const buildTimeDate = ({ name, label, readOnly }) => {
61
61
  return (h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small" },
62
- h("ez-date-time-input", { label: label, "data-field-name": name, key: name })));
62
+ h("ez-date-time-input", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
63
63
  };
64
64
 
65
65
  const buildDecimal = ({ name, label, readOnly }, properties) => {
@@ -99,10 +99,10 @@ const buildField = (field) => {
99
99
  if (!config.name) {
100
100
  config.name = descriptor.name;
101
101
  }
102
- if (config.required === undefined) {
102
+ if (config.required == undefined || descriptor.required === true) {
103
103
  config.required = descriptor.required;
104
104
  }
105
- if (config.readOnly === undefined) {
105
+ if (config.readOnly == undefined || descriptor.readOnly === true) {
106
106
  config.readOnly = descriptor.readOnly;
107
107
  }
108
108
  props = descriptor.properties;
@@ -222,8 +222,8 @@ const buildFromConfig = (config, dataUnit) => {
222
222
  if (isRequired) {
223
223
  requiredFields.push(field.name);
224
224
  }
225
- const clearOnCopy = field.cleanOnCopy == undefined ? (((_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy) || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum)) : field.cleanOnCopy;
226
- if (clearOnCopy) {
225
+ const cleanOnCopy = field.cleanOnCopy == undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : field.cleanOnCopy;
226
+ if (cleanOnCopy || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum)) {
227
227
  cleanOnCopyFields.push(field.name);
228
228
  }
229
229
  const defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
@@ -114935,7 +114935,8 @@ class AgGridController {
114935
114935
  let columns = this.getColumnsDef();
114936
114936
  let visibleColumns = [];
114937
114937
  let sort = [];
114938
- state.forEach((cfgColumn) => {
114938
+ state.forEach((cfgColumn, index) => {
114939
+ this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + 2);
114939
114940
  this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, cfgColumn.width);
114940
114941
  visibleColumns.push(cfgColumn.name);
114941
114942
  if (cfgColumn.ascending !== undefined) {
@@ -1 +1 @@
1
- import{p as e,b as o}from"./p-3c7ea91b.js";(()=>{const o=import.meta.url,s={};return""!==o&&(s.resourcesUrl=new URL(".",o).href),e(s)})().then((e=>o([["p-198c487e",[[6,"ez-grid",{multipleSelection:[4,"multiple-selection"],config:[1040],serverUrl:[1,"server-url"],dataUnit:[16],statusResolver:[16],_paginationInfo:[32],_popUpGridConfig:[32],setColumnsDef:[64],addColumnMenuItem:[64],setColumnsState:[64],setData:[64],getSelection:[64],getColumnsState:[64],getColumns:[64],quickFilter:[64],closeGridConfig:[64],openGridConfig:[64]}]]],["p-77ec47ac",[[1,"ez-actions-button",{enabled:[516],actions:[1040],size:[513],showLabel:[516,"show-label"],iconName:[513,"icon-name"],checkOption:[516,"check-option"],value:[513],isTransparent:[516,"is-transparent"],arrowActive:[516,"arrow-active"],_selectedAction:[32],hideActions:[64],isOpened:[64]}]]],["p-3987f8d8",[[1,"ez-dialog",{confirm:[1028],dialogType:[1025,"dialog-type"],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],handleButtonClick:[64],show:[64]}]]],["p-43bb6a59",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],loading:[516],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-dfcf55e0",[[6,"ez-modal-container",{modalTitle:[1,"modal-title"],modalSubTitle:[1,"modal-sub-title"],showTitleBar:[4,"show-title-bar"],cancelButtonLabel:[1,"cancel-button-label"],okButtonLabel:[1,"ok-button-label"],cancelButtonStatus:[1,"cancel-button-status"],okButtonStatus:[1,"ok-button-status"]}]]],["p-9b9ebf95",[[1,"ez-chip",{label:[513],enabled:[516],removePosition:[513,"remove-position"],mode:[513],value:[1540],setFocus:[64],setBlur:[64]}]]],["p-1cc11468",[[0,"ez-application"]]],["p-fe75f477",[[1,"ez-card-item",{item:[16]}]]],["p-ed2135a5",[[1,"ez-loading-bar",{_showLoading:[32],hide:[64],show:[64]}]]],["p-bffae598",[[1,"ez-popover",{autoClose:[516,"auto-close"],top:[1537],left:[1537],bottom:[1537],right:[1537],boxWidth:[513,"box-width"],opened:[1540],innerElement:[1537,"inner-element"],updatePosition:[64],show:[64],hide:[64]}]]],["p-cfcc23e6",[[1,"ez-popup",{size:[1],opened:[1540],useHeader:[1540,"use-header"],heightMode:[1537,"height-mode"],ezTitle:[1,"ez-title"]}]]],["p-be06251d",[[1,"ez-radio-button",{value:[1544],options:[1040],enabled:[516],label:[513],direction:[1537]}]]],["p-e3ee814c",[[1,"ez-scroller",{direction:[1]},[[2,"click","clickListener"],[1,"mousedown","mouseDownHandler"],[1,"mouseup","mouseUpHandler"],[1,"mousemove","mouseMoveHandler"]]]]],["p-482c3dd8",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-0c7203d5",[[0,"ez-view-stack",{show:[64],getSelectedIndex:[64]}]]],["p-2c6398b3",[[2,"ez-grid-config",{selectedTab:[1025,"selected-tab"],columns:[1040],config:[1040]}]]],["p-659616e4",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],stretchTitle:[516,"stretch-title"],removable:[516],editable:[516],conditionalSave:[16],_activeEditText:[32],showHide:[64],applyFocusTextEdit:[64],cancelEdition:[64]}]]],["p-56688470",[[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"],suppressEmptyOption:[4,"suppress-empty-option"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-63d567cc",[[1,"ez-calendar",{value:[1040],floating:[516],time:[516],showSeconds:[516,"show-seconds"],show:[64],fitVertical:[64],hide:[64]}]]],["p-2ccad880",[[1,"ez-text-input",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],mask:[1],canShowError:[516,"can-show-error"],restrict:[1],mode:[513],noBorder:[516,"no-border"],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-e230bfd2",[[1,"ez-date-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-e1f2b5da",[[1,"ez-date-time-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-744eb735",[[1,"ez-time-input",{label:[513],value:[1026],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-5a1927a2",[[1,"ez-number-input",{label:[1],value:[1538],enabled:[4],errorMessage:[1537,"error-message"],precision:[2],prettyPrecision:[2,"pretty-precision"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-7c227b86",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-e697ffd5",[[1,"ez-text-area",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],rows:[1538],canShowError:[516,"can-show-error"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-efa32bcc",[[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],addFiles:[64],setFocus:[64],setBlur:[64]}]]],["p-5bdb1a41",[[1,"ez-text-edit",{value:[1],styled:[16],_newValue:[32],applyFocusSelect:[64]}]]],["p-42c6493e",[[1,"ez-list",{dataSource:[1040],useGroups:[1540,"use-groups"],ezDraggable:[1028,"ez-draggable"],ezSelectable:[1028,"ez-selectable"],itemSlotBuilder:[1040],_listItems:[32],_listGroupItems:[32],clearHistory:[64],scrollToTop:[64],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-cd4677d4",[[1,"ez-tabselector",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1]}]]],["p-2213da1f",[[1,"ez-check",{label:[513],value:[1540],enabled:[1540],mode:[513],getMode:[64],setFocus:[64]}]]],["p-ec9decf2",[[1,"ez-icon",{size:[513],href:[513],iconName:[513,"icon-name"]}]]],["p-6608b9a5",[[1,"ez-combo-box",{value:[1537],label:[513],enabled:[516],options:[1040],errorMessage:[1537,"error-message"],searchMode:[4,"search-mode"],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],suppressSearch:[4,"suppress-search"],optionLoader:[16],suppressEmptyOption:[4,"suppress-empty-option"],canShowError:[516,"can-show-error"],mode:[513],_preSelection:[32],_visibleOptions:[32],_startLoading:[32],_showLoading:[32],_criteria:[32],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-9b1700f7",[[1,"ez-select-box",{selectedOption:[1,"selected-option"]}]]],["p-333d79c4",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]}]]],["p-e6971baf",[[0,"ez-form",{dataUnit:[1040],config:[16],recordsValidator:[16],submit:[64],cancel:[64],validate:[64]}]]]],e)));
1
+ import{p as e,b as o}from"./p-3c7ea91b.js";(()=>{const o=import.meta.url,s={};return""!==o&&(s.resourcesUrl=new URL(".",o).href),e(s)})().then((e=>o([["p-ae5af8f9",[[6,"ez-grid",{multipleSelection:[4,"multiple-selection"],config:[1040],serverUrl:[1,"server-url"],dataUnit:[16],statusResolver:[16],_paginationInfo:[32],_popUpGridConfig:[32],setColumnsDef:[64],addColumnMenuItem:[64],setColumnsState:[64],setData:[64],getSelection:[64],getColumnsState:[64],getColumns:[64],quickFilter:[64],closeGridConfig:[64],openGridConfig:[64]}]]],["p-77ec47ac",[[1,"ez-actions-button",{enabled:[516],actions:[1040],size:[513],showLabel:[516,"show-label"],iconName:[513,"icon-name"],checkOption:[516,"check-option"],value:[513],isTransparent:[516,"is-transparent"],arrowActive:[516,"arrow-active"],_selectedAction:[32],hideActions:[64],isOpened:[64]}]]],["p-3987f8d8",[[1,"ez-dialog",{confirm:[1028],dialogType:[1025,"dialog-type"],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],handleButtonClick:[64],show:[64]}]]],["p-43bb6a59",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],loading:[516],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-dfcf55e0",[[6,"ez-modal-container",{modalTitle:[1,"modal-title"],modalSubTitle:[1,"modal-sub-title"],showTitleBar:[4,"show-title-bar"],cancelButtonLabel:[1,"cancel-button-label"],okButtonLabel:[1,"ok-button-label"],cancelButtonStatus:[1,"cancel-button-status"],okButtonStatus:[1,"ok-button-status"]}]]],["p-9b9ebf95",[[1,"ez-chip",{label:[513],enabled:[516],removePosition:[513,"remove-position"],mode:[513],value:[1540],setFocus:[64],setBlur:[64]}]]],["p-1cc11468",[[0,"ez-application"]]],["p-fe75f477",[[1,"ez-card-item",{item:[16]}]]],["p-ed2135a5",[[1,"ez-loading-bar",{_showLoading:[32],hide:[64],show:[64]}]]],["p-bffae598",[[1,"ez-popover",{autoClose:[516,"auto-close"],top:[1537],left:[1537],bottom:[1537],right:[1537],boxWidth:[513,"box-width"],opened:[1540],innerElement:[1537,"inner-element"],updatePosition:[64],show:[64],hide:[64]}]]],["p-cfcc23e6",[[1,"ez-popup",{size:[1],opened:[1540],useHeader:[1540,"use-header"],heightMode:[1537,"height-mode"],ezTitle:[1,"ez-title"]}]]],["p-be06251d",[[1,"ez-radio-button",{value:[1544],options:[1040],enabled:[516],label:[513],direction:[1537]}]]],["p-e3ee814c",[[1,"ez-scroller",{direction:[1]},[[2,"click","clickListener"],[1,"mousedown","mouseDownHandler"],[1,"mouseup","mouseUpHandler"],[1,"mousemove","mouseMoveHandler"]]]]],["p-482c3dd8",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-0c7203d5",[[0,"ez-view-stack",{show:[64],getSelectedIndex:[64]}]]],["p-2c6398b3",[[2,"ez-grid-config",{selectedTab:[1025,"selected-tab"],columns:[1040],config:[1040]}]]],["p-659616e4",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],stretchTitle:[516,"stretch-title"],removable:[516],editable:[516],conditionalSave:[16],_activeEditText:[32],showHide:[64],applyFocusTextEdit:[64],cancelEdition:[64]}]]],["p-56688470",[[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"],suppressEmptyOption:[4,"suppress-empty-option"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-63d567cc",[[1,"ez-calendar",{value:[1040],floating:[516],time:[516],showSeconds:[516,"show-seconds"],show:[64],fitVertical:[64],hide:[64]}]]],["p-2ccad880",[[1,"ez-text-input",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],mask:[1],canShowError:[516,"can-show-error"],restrict:[1],mode:[513],noBorder:[516,"no-border"],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-e230bfd2",[[1,"ez-date-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-e1f2b5da",[[1,"ez-date-time-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-744eb735",[[1,"ez-time-input",{label:[513],value:[1026],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-5a1927a2",[[1,"ez-number-input",{label:[1],value:[1538],enabled:[4],errorMessage:[1537,"error-message"],precision:[2],prettyPrecision:[2,"pretty-precision"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-7c227b86",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-e697ffd5",[[1,"ez-text-area",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],rows:[1538],canShowError:[516,"can-show-error"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-efa32bcc",[[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],addFiles:[64],setFocus:[64],setBlur:[64]}]]],["p-5bdb1a41",[[1,"ez-text-edit",{value:[1],styled:[16],_newValue:[32],applyFocusSelect:[64]}]]],["p-42c6493e",[[1,"ez-list",{dataSource:[1040],useGroups:[1540,"use-groups"],ezDraggable:[1028,"ez-draggable"],ezSelectable:[1028,"ez-selectable"],itemSlotBuilder:[1040],_listItems:[32],_listGroupItems:[32],clearHistory:[64],scrollToTop:[64],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-cd4677d4",[[1,"ez-tabselector",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1]}]]],["p-2213da1f",[[1,"ez-check",{label:[513],value:[1540],enabled:[1540],mode:[513],getMode:[64],setFocus:[64]}]]],["p-ec9decf2",[[1,"ez-icon",{size:[513],href:[513],iconName:[513,"icon-name"]}]]],["p-6608b9a5",[[1,"ez-combo-box",{value:[1537],label:[513],enabled:[516],options:[1040],errorMessage:[1537,"error-message"],searchMode:[4,"search-mode"],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],suppressSearch:[4,"suppress-search"],optionLoader:[16],suppressEmptyOption:[4,"suppress-empty-option"],canShowError:[516,"can-show-error"],mode:[513],_preSelection:[32],_visibleOptions:[32],_startLoading:[32],_showLoading:[32],_criteria:[32],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-9b1700f7",[[1,"ez-select-box",{selectedOption:[1,"selected-option"]}]]],["p-333d79c4",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]}]]],["p-04a41a44",[[0,"ez-form",{dataUnit:[1040],config:[16],recordsValidator:[16],submit:[64],cancel:[64],validate:[64]}]]]],e)));
@@ -0,0 +1 @@
1
+ import{h as e,r as t,c as i,f as n,H as s,g as r}from"./p-3c7ea91b.js";import{UserInterface as a,Action as l,WaitingChangeException as o,ApplicationContext as c,DateUtils as d,DataUnitAction as h,DataUnit as u}from"@sankhyalabs/core";import{C as f}from"./p-b853763b.js";import{A as b}from"./p-0b44cf1c.js";import"./p-e1148f5c.js";const p=({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-text-input",{label:i,"data-field-name":t,key:t,enabled:!n}));function m(t,i,n,s=!1){return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-align--middle ez-padding-horizontal--small ez-padding-bottom--large"},e("ez-check",{enabled:!n,label:i,mode:s?f.SWITCH:f.REGULAR,"data-field-name":t,key:t}))}function v(t,i,n,s,r){return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-number-input",{enabled:!n,label:i,precision:s,prettyPrecision:r,"data-field-name":t,key:t}))}const z=new Map;z.set(a.LONGTEXT,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-padding-horizontal--small",key:t},e("ez-text-area",{enabled:!n,label:i,"data-field-name":t})))),z.set(a.CHECKBOX,(e=>m(e.name,e.label,e.readOnly,!1))),z.set(a.SWITCH,(e=>m(e.name,e.label,e.readOnly,!0))),z.set(a.OPTIONSELECTOR,(({name:t,label:i,readOnly:n,required:s},r)=>{const a=null==r?void 0:r.options;let l;if("string"==typeof a){const e=JSON.parse(a);l=Object.keys(e).map((t=>({value:t,label:e[t]})))}else l=a;return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-combo-box",{enabled:!n,suppressEmptyOption:s,label:i,"data-field-name":t,key:t,options:l}))})),z.set(a.SEARCH,(({name:t,label:i,readOnly:n,required:s})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-search",{enabled:!n,suppressEmptyOption:s,label:i,"data-field-name":t,key:t})))),z.set(a.FILE,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-padding-horizontal--small"},e("ez-upload",{enabled:!n,label:i,"data-field-name":t,key:t})))),z.set(a.DATE,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-input",{enabled:!n,label:i,"data-field-name":t,key:t})))),z.set(a.TIME,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-time-input",{enabled:!n,label:i,"data-field-name":t,key:t})))),z.set(a.DATETIME,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-time-input",{enabled:!n,label:i,"data-field-name":t,key:t})))),z.set(a.DECIMALNUMBER,(({name:e,label:t,readOnly:i},n)=>{const s=Number((null==n?void 0:n.precision)||2);return v(e,t,i,s,Number((null==n?void 0:n.prettyPrecision)||s))})),z.set(a.INTEGERNUMBER,(({name:e,label:t,readOnly:i})=>v(e,t,i,0,0)));const y=e=>{const t=e.descriptor,i=Object.assign({},e.config);let n,s;return t&&(i.label||(i.label=t.label),i.name||(i.name=t.name),null!=i.required&&!0!==t.required||(i.required=t.required),null!=i.readOnly&&!0!==t.readOnly||(i.readOnly=t.readOnly),s=t.properties,n=z.get(t.userInterface)),i.required&&(i.label=`${i.label} (obrigatório) *`),n||(n=p),n(i,s)},g=({source:t})=>"items"in t?e("ez-collapsible-box",{label:t.label,"header-size":"large"},t.items.map((e=>y(e)))):y(t),_=({store:t,source:i})=>e("div",{class:"dynamic-content ez-box__container"},e("div",{class:"ez-row ez-padding-vertical--small"},i.items.map((i=>e(g,{store:t,source:i})))));class w{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}getSheet(e){return this._sheets.get(e)}getAllSheets(){return this._sheets}addSheet(e){this._sheets.set(e.name,e),this._requiredFields=this._requiredFields.concat(e.requiredFields),this._cleanOnCopyFields=this._cleanOnCopyFields.concat(e.cleanOnCopyFields),this._defaultValues=e.defaultValues}getRequiredFields(){return this._requiredFields}getCleanOnCopyFields(){return this._cleanOnCopyFields}getDefaultValues(){return this._defaultValues}}function O(e,t){return"__main"==e[0].label?-1:(e[0].order||1e4)-(t[0].order||1e4)}function E(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var A="function"==typeof Symbol&&Symbol.observable||"@@observable",C=function(){return Math.random().toString(36).substring(7).split("").join(".")},j={INIT:"@@redux/INIT"+C(),REPLACE:"@@redux/REPLACE"+C(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+C()}};function x(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function R(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(E(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(E(1));return i(R)(e,t)}if("function"!=typeof e)throw new Error(E(2));var s=e,r=t,a=[],l=a,o=!1;function c(){l===a&&(l=a.slice())}function d(){if(o)throw new Error(E(3));return r}function h(e){if("function"!=typeof e)throw new Error(E(4));if(o)throw new Error(E(5));var t=!0;return c(),l.push(e),function(){if(t){if(o)throw new Error(E(6));t=!1,c();var i=l.indexOf(e);l.splice(i,1),a=null}}}function u(e){if(!x(e))throw new Error(E(7));if(void 0===e.type)throw new Error(E(8));if(o)throw new Error(E(9));try{o=!0,r=s(r,e)}finally{o=!1}for(var t=a=l,i=0;i<t.length;i++)(0,t[i])();return e}function f(e){if("function"!=typeof e)throw new Error(E(10));s=e,u({type:j.REPLACE})}function b(){var e,t=h;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(E(11));function i(){e.next&&e.next(d())}return i(),{unsubscribe:t(i)}}})[A]=function(){return this},e}return u({type:j.INIT}),(n={dispatch:u,subscribe:h,getState:d,replaceReducer:f})[A]=b,n}const M={};function k(e=M,t){switch(t.type){case P.METADATA_LOADED:return Object.assign(Object.assign({},e),{formMetadata:t.payload});case P.CHANGE_TAB:return Object.assign(Object.assign({},e),{currentSheet:t.payload});default:return e}}function N(e){return e.formMetadata}var P;!function(e){e.METADATA_LOADED="FORM/METADATA_LOADED",e.CHANGE_TAB="FORM/CHANGE_TAB"}(P||(P={}));class D{constructor(e){this._invalidFields=new Map,this.onDataUnitEvent=e=>{var t;switch(e.type){case l.DATA_LOADED:case l.DATA_SAVED:case l.RECORDS_REMOVED:case l.RECORDS_ADDED:case l.RECORDS_COPIED:case l.EDITION_CANCELED:case l.SELECTION_CHANGED:case l.NEXT_SELECTED:case l.PREVIOUS_SELECTED:this.clearInvalid();case l.DATA_CHANGED:case l.CHANGE_UNDONE:case l.CHANGE_REDONE:case l.RECORD_LOADED:null===(t=this._fields)||void 0===t||t.forEach((e=>{this.updateValue(e.fieldName,e.field)}))}},this._fields=new Map,this._dataUnit=e,this._dataUnit.subscribe(this.onDataUnitEvent)}bind(e){e.forEach((e=>{this.updateBind(e.dataset.fieldName,e)}))}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent)}markInvalid(e){this._invalidFields.set(e.name,e),this._fields.has(e.name)&&this.updateErrorMessage(e.name,this._fields.get(e.name).field)}clearInvalid(){this._invalidFields.clear(),this._fields.forEach((e=>{this.updateErrorMessage(e.field.dataset.fieldName,e.field)}))}updateValue(e,t){const i=this._fields.get(e);try{i&&(i.listen=!1),t.value=this._dataUnit.getFieldValue(e),this.updateErrorMessage(e,t)}finally{i&&(i.listen=!0)}}updateErrorMessage(e,t){const i=this._invalidFields.get(e);t.errorMessage=i?i.message:""}updateBind(e,t){const i=this._fields.get(e);i&&i.destroy(),t.value=this._dataUnit.getFieldValue(e),this.updateErrorMessage(e,t),this._fields.set(e,S.create(e,t,((e,t)=>this.changeStarted(e,t)),(e=>this.cancelWaitingChange(e)),((e,t)=>this.setFieldValue(e,t)))),this.bindSearchOptionsLoader(e,t),this.applyEzUploadContext(e,t)}changeStarted(e,t){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),!t.blocking&&null==t.promise){const i=this._fields.get(e);i&&(t.promise=new Promise(((e,t)=>{i.waitingChangePromiseResolve=e,i.waitingChangePromiseReject=t})))}this._dataUnit.startChange(e,t)}cancelWaitingChange(e){if(this._dataUnit.waitingForChange(e)){this._dataUnit.cancelWaitingChange(e);const t=this._fields.get(e);t&&t.rejectWaitingChange(new o("Change canceled",e))}}setFieldValue(e,t){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._invalidFields.delete(e),this._dataUnit.setFieldValue(e,t),this._dataUnit.waitingForChange(e)){const t=this._fields.get(e);t&&t.acceptWaitingChange()}}bindSearchOptionsLoader(e,t){if("EZ-SEARCH"===t.nodeName&&null==t.optionLoader){const i=c.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");i&&(t.optionLoader=t=>i(t,e,this._dataUnit))}}applyEzUploadContext(e,t){var i,n;if("EZ-UPLOAD"===t.nodeName){t.urlUpload=c.getContextValue("__EZUI__UPLOAD__ADD__URL__"),t.urlDelete=c.getContextValue("__EZUI__UPLOAD__DEL__URL__");const s=this._dataUnit.getField(e),r=null===(i=s.properties)||void 0===i?void 0:i.DESTINATION;r&&(t.requestHeaders={XTRAINF:`{"destination": "${r}"}`}),t.maxFiles=(null===(n=s.properties)||void 0===n?void 0:n.MAX_FILES)||0}}}class S{constructor(){this.listen=!0,this.startChangeEventName="ezStartChange",this.cancelWaitingChangeEventName="ezCancelWaitingChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.cancelWaitingChangeEventName,this.cancelWaitingChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}acceptWaitingChange(){this.waitingChangePromiseResolve&&(this.waitingChangePromiseResolve(),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}rejectWaitingChange(e){this.waitingChangePromiseReject&&(this.waitingChangePromiseReject(e),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}static create(e,t,i,n,s){const r=new S;return r.field=t,r.fieldName=e,r.startChangeListener=t=>{r.listen&&i(e,t.detail)},r.field.addEventListener(r.startChangeEventName,r.startChangeListener),r.cancelWaitingChangeListener=()=>{r.listen&&n(e)},r.field.addEventListener(r.cancelWaitingChangeEventName,r.cancelWaitingChangeListener),r.changeListener=t=>{r.listen&&s(e,t.detail)},r.field.addEventListener(r.changeEventName,r.changeListener),r}}let I=class{constructor(e){t(this,e),this.ezReady=i(this,"ezReady",7),this.onDataUnitAction=e=>{e.type===l.METADATA_LOADED&&this.processMetadata()}}submit(){return Promise.resolve()}cancel(){return Promise.resolve()}validate(){return new Promise(((e,t)=>{var i;const n=this.dataUnit.getModifiedRecords();for(let e=0;e<n.length;e++){const s=n[e],r=[];let a=this.validateRequired(s);if(a&&!a.isValid&&r.push(a),a=null===(i=this.recordsValidator)||void 0===i?void 0:i.validateRecord(this,s),a&&!a.isValid&&r.push(a),r.length>0){this.processValidationResult(r),t();break}}e()}))}observeConfig(){this.processMetadata()}validateRequired(e){const t=N(this._store.getState()),i=this._staticFields.filter((e=>e.dataset.required)).map((e=>e.dataset.fieldName)).concat(t.getRequiredFields()),n=[];if(i.forEach((t=>{const i=e[t];null!=i&&""!==i||n.push({name:t,message:"Essa informação é obrigatória"})})),n.length>0)return{isValid:!1,invalidFields:n,infoMessage:"Há pelo menos um campo obrigatório não preenchido."}}processValidationResult(e){e.forEach((e=>{const t=e.invalidFields;if(t&&t.forEach((e=>{this._dataBinder.markInvalid(e)})),e.infoMessage&&b.info(e.infoMessage),e.errorMessage){const{errorTitle:t,errorMessage:i}=e;b.error(t,i)}}))}getDynamicContent(){var t;const i=N(this._store.getState());if(!i)return null;const n=(s=null===(t=this._store)||void 0===t?void 0:t.getState()).currentSheet?s.formMetadata.getSheet(s.currentSheet):Array.from(s.formMetadata.getAllSheets().values())[0];var s;if(!n)return null;const r=Array.from(i.getAllSheets().values()),a=[];return r.length>1&&a.push(e("ez-tabselector",{onEzChange:e=>this._store.dispatch(function(e){return{type:P.CHANGE_TAB,payload:e.tabKey}}(e.detail)),selectedTab:n.name},r.map((t=>e("ez-tab",{tabKey:t.name,label:t.label}))))),a.push(e(_,{store:this._store,source:n})),a}processMetadata(){if(!this.isStatic()&&this.dataUnit){const e=null!=this.config?((e,t)=>{var i,n;const s=new Map,r=new Map,a=[],l=[],o={};null===(i=null==e?void 0:e.tabs)||void 0===i||i.forEach((e=>{r.has(e.label)||!1!==e.visible||r.set(e.label,e)})),null===(n=null==e?void 0:e.fields)||void 0===n||n.forEach((e=>{var i,n,c;if(!1!==e.visible){const d=function(e,t){return("string"==typeof e?Array.from(t.keys()).find((t=>t.label===e)):e)||{label:e,visible:!0}}(e.tab||"__main",s);if(r.has(d.label))return;const h=t.getField(e.name);if(h&&d.visible){s.has(d)||s.set(d,new Map);const t=s.get(d);(null==e.required?h.required:e.required)&&a.push(e.name),((null==e.cleanOnCopy?null===(i=h.properties)||void 0===i?void 0:i.cleanOnCopy:e.cleanOnCopy)||(null===(n=h.properties)||void 0===n?void 0:n.autoNum))&&l.push(e.name),(null==e.defaultValue?null===(c=h.properties)||void 0===c?void 0:c.defaultValue:e.defaultValue)&&(o[e.name]=e.defaultValue);const r={config:e,descriptor:h},u=e.group;if(u){const e=`group::${u}`;t.has(e)?t.get(e).items.push(r):t.set(e,{label:u,items:[r]})}else t.set(e.name,r)}}}));const c=new w;return Array.from(s.entries()).sort(O).forEach((([e,t])=>{c.addSheet({label:"__main"===e.label?"Principal":e.label,name:e.label,items:Array.from(t.values()),requiredFields:a,cleanOnCopyFields:l,defaultValues:o})})),c})(this.config,this.dataUnit):(()=>{var e;const t=this.dataUnit.metadata,i=new w;if(t){const n=null===(e=t.fields)||void 0===e?void 0:e.filter((e=>!1!==e.visible));let s={};n.filter((e=>e.defaultValue)).map((e=>s[e.name]=e.defaultValue)),i.addSheet({label:t.label,name:t.name,items:n.map((e=>({descriptor:e}))),requiredFields:n.filter((e=>e.required)).map((e=>e.name)),cleanOnCopyFields:n.filter((e=>{var t,i;return(null===(t=e.properties)||void 0===t?void 0:t.cleanOnCopy)||(null===(i=e.properties)||void 0===i?void 0:i.autoNum)})).map((e=>e.name)),defaultValues:s})}return i})();this._store.dispatch({type:P.METADATA_LOADED,payload:e})}}isStatic(){var e;return(null===(e=this._staticFields)||void 0===e?void 0:e.length)>0}getValidatedValue(e){switch(e){case"${data}":return d.getToday();case"${datahora}":return d.getToday(!0);default:return e}}interceptAction(e){if(e.type===l.RECORDS_COPIED){const t=N(this._store.getState()).getCleanOnCopyFields();if(t)return new h(l.RECORDS_COPIED,e.payload.map((e=>{const i=Object.assign({},e);return t.forEach((e=>delete i[e])),i})))}if(e.type===l.SAVING_DATA)return new Promise((t=>{this.validate().then((()=>t(e))).catch((()=>{}))}));if(e.type===l.RECORDS_ADDED){const t=N(this._store.getState()).getDefaultValues();if(t)return new h(l.RECORDS_ADDED,e.payload.map((e=>{const i=Object.assign({},e);for(const e in t){const n=t[e].value;i[e]=this.dataUnit.valueFromString(e,this.getValidatedValue(null!=n?n:t[e]))}return i})))}return e}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new u("ez-form")),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new D(this.dataUnit),this._store=R(k),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata()}componentDidRender(){this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]"))),this.ezReady.emit()}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.removeInterceptor(this),this._dataBinder.onDisconnectedCallback()}render(){return e(s,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return r(this)}static get watchers(){return{config:["observeConfig"]}}};I.style="ez-form{display:flex;flex-direction:column;width:100%}.dynamic-content ez-collapsible-box{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{I as ez_form}