@sankhyalabs/ezui 4.0.3 → 4.0.4

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.
@@ -78,12 +78,12 @@ const buildFormConfigFromDataUnit = (dataUnit) => {
78
78
  .filter(descriptor => descriptor.visible !== false)
79
79
  .map(descriptor => { return { name: descriptor.name, defaultValue: descriptor.defaultValue }; });
80
80
  }
81
- const config = { fields };
81
+ const config = { emptyConfig: false, fields };
82
82
  return config;
83
83
  };
84
84
  const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
85
85
  var _a, _b;
86
- if (config == undefined) {
86
+ if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
87
87
  config = buildFormConfigFromDataUnit(dataUnit);
88
88
  }
89
89
  const sheets = new Map();
@@ -70,12 +70,12 @@ export const buildFormConfigFromDataUnit = (dataUnit) => {
70
70
  .filter(descriptor => descriptor.visible !== false)
71
71
  .map(descriptor => { return { name: descriptor.name, defaultValue: descriptor.defaultValue }; });
72
72
  }
73
- const config = { fields };
73
+ const config = { emptyConfig: false, fields };
74
74
  return config;
75
75
  };
76
76
  export const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
77
77
  var _a, _b;
78
- if (config == undefined) {
78
+ if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
79
79
  config = buildFormConfigFromDataUnit(dataUnit);
80
80
  }
81
81
  const sheets = new Map();
@@ -220,12 +220,12 @@ const buildFormConfigFromDataUnit = (dataUnit) => {
220
220
  .filter(descriptor => descriptor.visible !== false)
221
221
  .map(descriptor => { return { name: descriptor.name, defaultValue: descriptor.defaultValue }; });
222
222
  }
223
- const config = { fields };
223
+ const config = { emptyConfig: false, fields };
224
224
  return config;
225
225
  };
226
226
  const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
227
227
  var _a, _b;
228
- if (config == undefined) {
228
+ if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
229
229
  config = buildFormConfigFromDataUnit(dataUnit);
230
230
  }
231
231
  const sheets = new Map();
@@ -74,12 +74,12 @@ const buildFormConfigFromDataUnit = (dataUnit) => {
74
74
  .filter(descriptor => descriptor.visible !== false)
75
75
  .map(descriptor => { return { name: descriptor.name, defaultValue: descriptor.defaultValue }; });
76
76
  }
77
- const config = { fields };
77
+ const config = { emptyConfig: false, fields };
78
78
  return config;
79
79
  };
80
80
  const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
81
81
  var _a, _b;
82
- if (config == undefined) {
82
+ if (config == undefined || (config === null || config === void 0 ? void 0 : config.emptyConfig) === true) {
83
83
  config = buildFormConfigFromDataUnit(dataUnit);
84
84
  }
85
85
  const sheets = new Map();
@@ -1 +1 @@
1
- import{p as e,b as o}from"./p-7ffd12e7.js";export{s as setNonce}from"./p-7ffd12e7.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-e6f3d036",[[1,"ez-actions-button",{enabled:[516],actions:[1040],size:[513],showLabel:[516,"show-label"],displayIcon:[513,"display-icon"],checkOption:[516,"check-option"],value:[513],isTransparent:[516,"is-transparent"],arrowActive:[516,"arrow-active"],_selectedAction:[32],hideActions:[64],isOpened:[64]}]]],["p-9a1549c2",[[1,"ez-breadcrumb",{items:[1040],fillMode:[1025,"fill-mode"],maxItems:[1026,"max-items"],positionEllipsis:[1026,"position-ellipsis"],visibleItems:[32],hiddenItems:[32],showDropdown:[32],collapseConfigPosition:[32]}]]],["p-fd87638e",[[1,"ez-dialog",{confirm:[1028],dialogType:[1025,"dialog-type"],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],show:[64]}]]],["p-dc15b6d1",[[6,"ez-grid",{multipleSelection:[4,"multiple-selection"],config:[1040],serverUrl:[1,"server-url"],dataUnit:[16],statusResolver:[16],_paginationInfo:[32],_paginationChangedByKeyboard:[32],setColumnsDef:[64],addColumnMenuItem:[64],setColumnsState:[64],setData:[64],getSelection:[64],getColumnsState:[64],getColumns:[64],quickFilter:[64]},[[0,"ezSelectionChange","onSelectionChange"]]]]],["p-7c8fb43e",[[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-6818dd0a",[[1,"ez-alert",{alertType:[513,"alert-type"]}]]],["p-06b3e801",[[1,"ez-chip",{label:[513],enabled:[516],removePosition:[513,"remove-position"],mode:[513],value:[1540],setFocus:[64],setBlur:[64]}]]],["p-9613fae6",[[1,"ez-file-item",{canRemove:[4,"can-remove"],fileName:[1,"file-name"],iconName:[1,"icon-name"],fileSize:[2,"file-size"],progress:[2]}]]],["p-ada6e6b0",[[0,"ez-application"]]],["p-07b99b94",[[1,"ez-card-item",{item:[16]}]]],["p-8d5ec02b",[[1,"ez-list",{dataSource:[1040],useGroups:[1540,"use-groups"],ezDraggable:[1028,"ez-draggable"],ezSelectable:[1028,"ez-selectable"],itemSlotBuilder:[1040],hoverFeedback:[1028,"hover-feedback"],_listItems:[32],_listGroupItems:[32],clearHistory:[64],scrollToTop:[64],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-0c7e81fe",[[1,"ez-loading-bar",{_showLoading:[32],hide:[64],show:[64]}]]],["p-eceb9382",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-62481744",[[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"],overlayType:[513,"overlay-type"],updatePosition:[64],show:[64],hide:[64]}]]],["p-600f1732",[[1,"ez-popup",{size:[1],opened:[1540],useHeader:[516,"use-header"],heightMode:[513,"height-mode"],ezTitle:[1,"ez-title"]}]]],["p-b941aeee",[[1,"ez-radio-button",{value:[1544],options:[1040],enabled:[516],label:[513],direction:[1537]}]]],["p-e85f1a6a",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-b3c7b243",[[0,"ez-view-stack",{show:[64],getSelectedIndex:[64]}]]],["p-e748b5d3",[[2,"ez-form-view",{fields:[16],showUp:[64]}]]],["p-99d822cc",[[1,"ez-tabselector",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1],_processedTabs:[32]}]]],["p-493e2af4",[[1,"ez-text-input",{label:[513],value:[1537],enabled:[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-09271677",[[1,"ez-guide-navigator",{open:[1540],selectedId:[1537,"selected-id"],items:[16],tooltipResolver:[16],filterText:[32],disableItem:[64],enableItem:[64],updateItem:[64],getItem:[64],getCurrentPath:[64],selectGuide:[64],getParent:[64]}]]],["p-a67e056f",[[1,"ez-dropdown",{items:[1040],value:[1040],itemBuilder:[16]}]]],["p-bbccda3f",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],headerAlign:[513,"header-align"],removable:[516],editable:[516],conditionalSave:[16],_activeEditText:[32],showHide:[64],applyFocusTextEdit:[64],cancelEdition:[64]}]]],["p-695facd0",[[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-4555df8f",[[1,"ez-date-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-581df847",[[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-36f7ec68",[[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-86d29565",[[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-a323b415",[[1,"ez-check",{label:[513],value:[1540],enabled:[1540],indeterminate:[516],mode:[513],getMode:[64],setFocus:[64]}]]],["p-c0184982",[[1,"ez-text-area",{label:[513],value:[1537],enabled:[516],errorMessage:[1537,"error-message"],rows:[1538],canShowError:[516,"can-show-error"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-622c2d53",[[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-7147d43a",[[1,"ez-text-edit",{value:[1],styled:[16],_newValue:[32],applyFocusSelect:[64]}]]],["p-50883460",[[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-6cf406ff",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],asyncSearch:[516,"async-search"],setFocus:[64],setBlur:[64],isInvalid:[64],setValue:[64],endSearch:[64]}],[1,"ez-tree",{items:[1040],value:[1040],selectedId:[1537,"selected-id"],iconResolver:[16],tooltipResolver:[16],_tree:[32],_waintingForLoad:[32],selectItem:[64],openItem:[64],disableItem:[64],enableItem:[64],addChild:[64],applyFilter:[64],updateItem:[64],getItem:[64],getCurrentPath:[64],getParent:[64]},[[2,"keydown","onKeyDownListener"]]],[1,"ez-scroller",{direction:[1],locked:[4],activeShadow:[4,"active-shadow"],isActive:[32]},[[2,"click","clickListener"],[1,"mousedown","mouseDownHandler"],[1,"mouseup","mouseUpHandler"],[1,"mousemove","mouseMoveHandler"]]],[1,"ez-sidebar-button"]]],["p-a4b281ca",[[1,"ez-calendar",{value:[1040],floating:[516],time:[516],showSeconds:[516,"show-seconds"],show:[64],fitVertical:[64],hide:[64]}]]],["p-cc40fcb3",[[1,"ez-icon",{size:[513],href:[513],iconName:[513,"icon-name"]}]]],["p-36374dfe",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]},[[2,"click","clickListener"]]]]],["p-0e53898b",[[2,"ez-form",{dataUnit:[1040],config:[16],recordsValidator:[16],validate:[64]}]]]],e)));
1
+ import{p as e,b as o}from"./p-7ffd12e7.js";export{s as setNonce}from"./p-7ffd12e7.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-e6f3d036",[[1,"ez-actions-button",{enabled:[516],actions:[1040],size:[513],showLabel:[516,"show-label"],displayIcon:[513,"display-icon"],checkOption:[516,"check-option"],value:[513],isTransparent:[516,"is-transparent"],arrowActive:[516,"arrow-active"],_selectedAction:[32],hideActions:[64],isOpened:[64]}]]],["p-9a1549c2",[[1,"ez-breadcrumb",{items:[1040],fillMode:[1025,"fill-mode"],maxItems:[1026,"max-items"],positionEllipsis:[1026,"position-ellipsis"],visibleItems:[32],hiddenItems:[32],showDropdown:[32],collapseConfigPosition:[32]}]]],["p-fd87638e",[[1,"ez-dialog",{confirm:[1028],dialogType:[1025,"dialog-type"],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],show:[64]}]]],["p-dc15b6d1",[[6,"ez-grid",{multipleSelection:[4,"multiple-selection"],config:[1040],serverUrl:[1,"server-url"],dataUnit:[16],statusResolver:[16],_paginationInfo:[32],_paginationChangedByKeyboard:[32],setColumnsDef:[64],addColumnMenuItem:[64],setColumnsState:[64],setData:[64],getSelection:[64],getColumnsState:[64],getColumns:[64],quickFilter:[64]},[[0,"ezSelectionChange","onSelectionChange"]]]]],["p-7c8fb43e",[[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-6818dd0a",[[1,"ez-alert",{alertType:[513,"alert-type"]}]]],["p-06b3e801",[[1,"ez-chip",{label:[513],enabled:[516],removePosition:[513,"remove-position"],mode:[513],value:[1540],setFocus:[64],setBlur:[64]}]]],["p-9613fae6",[[1,"ez-file-item",{canRemove:[4,"can-remove"],fileName:[1,"file-name"],iconName:[1,"icon-name"],fileSize:[2,"file-size"],progress:[2]}]]],["p-ada6e6b0",[[0,"ez-application"]]],["p-07b99b94",[[1,"ez-card-item",{item:[16]}]]],["p-8d5ec02b",[[1,"ez-list",{dataSource:[1040],useGroups:[1540,"use-groups"],ezDraggable:[1028,"ez-draggable"],ezSelectable:[1028,"ez-selectable"],itemSlotBuilder:[1040],hoverFeedback:[1028,"hover-feedback"],_listItems:[32],_listGroupItems:[32],clearHistory:[64],scrollToTop:[64],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-0c7e81fe",[[1,"ez-loading-bar",{_showLoading:[32],hide:[64],show:[64]}]]],["p-eceb9382",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-62481744",[[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"],overlayType:[513,"overlay-type"],updatePosition:[64],show:[64],hide:[64]}]]],["p-600f1732",[[1,"ez-popup",{size:[1],opened:[1540],useHeader:[516,"use-header"],heightMode:[513,"height-mode"],ezTitle:[1,"ez-title"]}]]],["p-b941aeee",[[1,"ez-radio-button",{value:[1544],options:[1040],enabled:[516],label:[513],direction:[1537]}]]],["p-e85f1a6a",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-b3c7b243",[[0,"ez-view-stack",{show:[64],getSelectedIndex:[64]}]]],["p-e748b5d3",[[2,"ez-form-view",{fields:[16],showUp:[64]}]]],["p-99d822cc",[[1,"ez-tabselector",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1],_processedTabs:[32]}]]],["p-493e2af4",[[1,"ez-text-input",{label:[513],value:[1537],enabled:[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-09271677",[[1,"ez-guide-navigator",{open:[1540],selectedId:[1537,"selected-id"],items:[16],tooltipResolver:[16],filterText:[32],disableItem:[64],enableItem:[64],updateItem:[64],getItem:[64],getCurrentPath:[64],selectGuide:[64],getParent:[64]}]]],["p-a67e056f",[[1,"ez-dropdown",{items:[1040],value:[1040],itemBuilder:[16]}]]],["p-bbccda3f",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],headerAlign:[513,"header-align"],removable:[516],editable:[516],conditionalSave:[16],_activeEditText:[32],showHide:[64],applyFocusTextEdit:[64],cancelEdition:[64]}]]],["p-695facd0",[[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-4555df8f",[[1,"ez-date-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-581df847",[[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-36f7ec68",[[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-86d29565",[[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-a323b415",[[1,"ez-check",{label:[513],value:[1540],enabled:[1540],indeterminate:[516],mode:[513],getMode:[64],setFocus:[64]}]]],["p-c0184982",[[1,"ez-text-area",{label:[513],value:[1537],enabled:[516],errorMessage:[1537,"error-message"],rows:[1538],canShowError:[516,"can-show-error"],mode:[513],setFocus:[64],setBlur:[64],isInvalid:[64]}]]],["p-622c2d53",[[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-7147d43a",[[1,"ez-text-edit",{value:[1],styled:[16],_newValue:[32],applyFocusSelect:[64]}]]],["p-50883460",[[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-6cf406ff",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],asyncSearch:[516,"async-search"],setFocus:[64],setBlur:[64],isInvalid:[64],setValue:[64],endSearch:[64]}],[1,"ez-tree",{items:[1040],value:[1040],selectedId:[1537,"selected-id"],iconResolver:[16],tooltipResolver:[16],_tree:[32],_waintingForLoad:[32],selectItem:[64],openItem:[64],disableItem:[64],enableItem:[64],addChild:[64],applyFilter:[64],updateItem:[64],getItem:[64],getCurrentPath:[64],getParent:[64]},[[2,"keydown","onKeyDownListener"]]],[1,"ez-scroller",{direction:[1],locked:[4],activeShadow:[4,"active-shadow"],isActive:[32]},[[2,"click","clickListener"],[1,"mousedown","mouseDownHandler"],[1,"mouseup","mouseUpHandler"],[1,"mousemove","mouseMoveHandler"]]],[1,"ez-sidebar-button"]]],["p-a4b281ca",[[1,"ez-calendar",{value:[1040],floating:[516],time:[516],showSeconds:[516,"show-seconds"],show:[64],fitVertical:[64],hide:[64]}]]],["p-cc40fcb3",[[1,"ez-icon",{size:[513],href:[513],iconName:[513,"icon-name"]}]]],["p-36374dfe",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]},[[2,"click","clickListener"]]]]],["p-08f4a048",[[2,"ez-form",{dataUnit:[1040],config:[16],recordsValidator:[16],validate:[64]}]]]],e)));
@@ -1 +1 @@
1
- import{r as t,c as e,h as i,f as n,H as s,g as r}from"./p-7ffd12e7.js";import{UserInterface as o,DateUtils as a,Action as l,WaitingChangeException as h,ApplicationContext as c,DataUnitAction as u,StringUtils as d,DataUnit as f,ElementIDUtils as v}from"@sankhyalabs/core";import{A as p}from"./p-efb43dd8.js";import"./p-ab574d59.js";const b=/child\[([^\]]+)\]/,m=/\$\{.+\}/;class g{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const e=b.exec(t);return e?e[1]:void 0}getSheet(t){return this._sheets.get(t)}getAllSheets(){return this._sheets}addSheet(t){this._sheets.set(t.name,t)}addRequiredFields(t){this._requiredFields=this._requiredFields.concat(t)}getRequiredFields(){return this._requiredFields}addCleanOnCopyFields(t){this._cleanOnCopyFields=this._cleanOnCopyFields.concat(t)}getCleanOnCopyFields(){return this._cleanOnCopyFields}addDefaultValues(t){return this._defaultValues=Object.assign(Object.assign({},this._defaultValues),t)}getDefaultValues(){const t={};return Object.entries(this._defaultValues).forEach((([e,i])=>{if("string"==typeof i){const t=m.exec(i);t&&(i=this.getDefaultVar(t[0]))}t[e]=i})),t}getDefaultVar(t){return"${data}"===t?a.getToday():"${datahora}"===t?a.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const y=(t,e)=>"__main"==t[0].label?-1:(t[0].order||1e4)-(e[0].order||1e4);class _{constructor(t){this._invalidFields=new Map,this.onDataUnitEvent=t=>{var e;switch(t.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===(e=this._fields)||void 0===e||e.forEach((t=>{this.updateValue(t.fieldName,t.field)}))}},this._fields=new Map,this._dataUnit=t,this._dataUnit.subscribe(this.onDataUnitEvent),this._dataUnit.addInterceptor(this)}bind(t,e,i,n){t.forEach((t=>{const{fieldName:i,contextName:n}=t.dataset;null!=n&&n!==e||this.updateBind(i,t)})),this._formMetadata=i,this._recordsValidator=n}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent),this._dataUnit.removeInterceptor(this)}markInvalid(t){if(this._invalidFields.set(t.name,t),this._fields.has(t.name)){const e=this._fields.get(t.name).field;e.errorMessage||this.updateErrorMessage(t.name,e)}}clearInvalid(){this._invalidFields.clear(),this._fields.forEach((t=>{t.field.errorMessage=""}))}updateValue(t,e){const i=this._fields.get(t);try{i&&(i.listen=!1),e.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,e)}finally{i&&(i.listen=!0)}}validate(){return new Promise(((t,e)=>{var i;const n=this._dataUnit.getModifiedRecords();for(let t=0;t<n.length;t++){const s=n[t],r=[];let o=this.validateRequired(s);if(o&&!o.isValid&&r.push(o),o=null===(i=this._recordsValidator)||void 0===i?void 0:i.validateRecord(s),o&&!o.isValid&&r.push(o),r.length>0){this.processValidationResult(r),e();break}}return t()}))}validateRequired(t){const e=this._formMetadata.getRequiredFields(),i=[];if(new Set(e).forEach((e=>{const n=t[e];if(null==n||""===n){const t=this.getErrorMessage(e);i.push(t?{name:e,message:t}:{name:e,message:"Essa informação é obrigatória"})}})),i.length>0)return{isValid:!1,invalidFields:i,infoMessage:"Há pelo menos um campo obrigatório não preenchido."}}processValidationResult(t){t.forEach((t=>{const e=t.invalidFields;if(e&&e.forEach((t=>{this.markInvalid(t)})),t.infoMessage&&p.info(t.infoMessage),t.errorMessage){const{errorTitle:e,errorMessage:i}=t;p.error(e,i)}}))}updateErrorMessage(t,e){const i=this._invalidFields.get(t);i&&(e.errorMessage=i.message)}getErrorMessage(t){if(this._fields.has(t))return this._fields.get(t).field.errorMessage||null}updateBind(t,e){const i=this._fields.get(t);i&&i.destroy(),e.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,e),this._fields.set(t,w.create(t,e,((t,e)=>this.changeStarted(t,e)),(t=>this.cancelWaitingChange(t)),((t,e)=>this.setFieldValue(t,e)))),this.bindSearchOptionsLoader(t,e),this.applyEzUploadContext(t,e)}changeStarted(t,e){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),!e.blocking&&null==e.promise){const i=this._fields.get(t);i&&(e.promise=new Promise(((t,e)=>{i.waitingChangePromiseResolve=t,i.waitingChangePromiseReject=e})))}this._dataUnit.startChange(t,e)}cancelWaitingChange(t){if(this._dataUnit.waitingForChange(t)){this._dataUnit.cancelWaitingChange(t);const e=this._fields.get(t);e&&e.rejectWaitingChange(new h("Change canceled",t))}}setFieldValue(t,e){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._invalidFields.delete(t),this._dataUnit.setFieldValue(t,e),this._dataUnit.waitingForChange(t)){const e=this._fields.get(t);e&&e.acceptWaitingChange()}}bindSearchOptionsLoader(t,e){if("EZ-SEARCH"===e.nodeName&&null==e.optionLoader){const i=c.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");i&&(e.optionLoader=e=>i(e,t,this._dataUnit))}}applyEzUploadContext(t,e){var i,n;if("EZ-UPLOAD"===e.nodeName){e.urlUpload=c.getContextValue("__EZUI__UPLOAD__ADD__URL__"),e.urlDelete=c.getContextValue("__EZUI__UPLOAD__DEL__URL__");const s=this._dataUnit.getField(t),r=null===(i=s.properties)||void 0===i?void 0:i.DESTINATION;r&&(e.requestHeaders={XTRAINF:`{"destination": "${r}"}`}),e.maxFiles=(null===(n=s.properties)||void 0===n?void 0:n.MAX_FILES)||0}}interceptAction(t){var e;if(t.type===l.RECORDS_COPIED){const e=this._formMetadata.getCleanOnCopyFields();if(e)return new u(l.RECORDS_COPIED,t.payload.map((t=>{const i=Object.assign({},t);return e.forEach((t=>delete i[t])),i})))}if(t.type===l.SAVING_DATA)return new Promise((e=>{this.validate().then((()=>e(t))).catch((()=>{}))}));if(t.type===l.RECORDS_ADDED){const i=null===(e=this._formMetadata)||void 0===e?void 0:e.getDefaultValues();if(i)return new u(l.RECORDS_ADDED,t.payload.map((t=>{const e=Object.assign({},t);for(const t in i){const n=this.getFormattedValue(i[t]),s="function"==typeof n?n():n;e[t]=this._dataUnit.valueFromString(t,s)}return e})))}return t}getFormattedValue(t){return null==t||"object"!=typeof t?t:"formattedValue"in t?t.formattedValue:t.value}}class w{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(t){this.waitingChangePromiseReject&&(this.waitingChangePromiseReject(t),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}static create(t,e,i,n,s){const r=new w;return r.field=e,r.fieldName=t,r.startChangeListener=e=>{r.listen&&i(t,e.detail)},r.field.addEventListener(r.startChangeEventName,r.startChangeListener),r.cancelWaitingChangeListener=()=>{r.listen&&n(t)},r.field.addEventListener(r.cancelWaitingChangeEventName,r.cancelWaitingChangeListener),r.changeListener=e=>{r.listen&&s(t,e.detail)},r.field.addEventListener(r.changeEventName,r.changeListener),r}}function E(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var O="function"==typeof Symbol&&Symbol.observable||"@@observable",C=function(){return Math.random().toString(36).substring(7).split("").join(".")},A={INIT:"@@redux/INIT"+C(),REPLACE:"@@redux/REPLACE"+C(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+C()}};function j(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function R(t,e,i){var n;if("function"==typeof e&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(E(0));if("function"==typeof e&&void 0===i&&(i=e,e=void 0),void 0!==i){if("function"!=typeof i)throw new Error(E(1));return i(R)(t,e)}if("function"!=typeof t)throw new Error(E(2));var s=t,r=e,o=[],a=o,l=!1;function h(){a===o&&(a=o.slice())}function c(){if(l)throw new Error(E(3));return r}function u(t){if("function"!=typeof t)throw new Error(E(4));if(l)throw new Error(E(5));var e=!0;return h(),a.push(t),function(){if(e){if(l)throw new Error(E(6));e=!1,h();var i=a.indexOf(t);a.splice(i,1),o=null}}}function d(t){if(!j(t))throw new Error(E(7));if(void 0===t.type)throw new Error(E(8));if(l)throw new Error(E(9));try{l=!0,r=s(r,t)}finally{l=!1}for(var e=o=a,i=0;i<e.length;i++)(0,e[i])();return t}function f(t){if("function"!=typeof t)throw new Error(E(10));s=t,d({type:A.REPLACE})}function v(){var t,e=u;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(E(11));function i(){t.next&&t.next(c())}return i(),{unsubscribe:e(i)}}})[O]=function(){return this},t}return d({type:A.INIT}),(n={dispatch:d,subscribe:u,getState:c,replaceReducer:f})[O]=v,n}const z={};function D(t=z,e){switch(e.type){case M.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:e.payload,currentSheet:void 0});case M.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:e.payload});default:return t}}function x(t){return t.formMetadata}var M;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(M||(M={}));const N=class{constructor(i){t(this,i),this.ezReady=e(this,"ezReady",7),this.onDataUnitAction=t=>{t.type===l.METADATA_LOADED&&this.processMetadata()},this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0}validate(){return this._dataBinder.validate()}observeConfig(){this.processMetadata()}getDynamicContent(){var t;const e=x(this._store.getState());if(!e)return null;const n=Array.from(e.getAllSheets().values()),s=function(t){const e=function(t){return t.currentSheet}(t);return e?t.formMetadata.getSheet(e):Array.from(t.formMetadata.getAllSheets().values())[0]}(null===(t=this._store)||void 0===t?void 0:t.getState());let r=[];if(n.length>1){const t=n.map(((t,e)=>({tabKey:t.name,label:t.label,index:e}))),e="selector";r.push(i("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:M.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:s.name,"data-element-id":e}))}return r=r.concat(this.buildFormContent(s)),r}buildFormContent(t){const e=null==t?void 0:t.fields;if(null==t)return;const n=`${d.replaceAccentuatedChars(d.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return i("div",{class:"dynamic-content","data-element-id":n},i("ez-form-view",{class:"ez-row ez-padding-vertical--small",fields:e}))}processMetadata(){if(!this.isStatic()&&this.dataUnit&&this._store){const t=((t,e,i=!1)=>{var n,s;null==t&&(t=(t=>{const e=t.metadata;let i;return e&&(i=e.fields.filter((t=>!1!==t.visible)).map((t=>({name:t.name,defaultValue:t.defaultValue})))),{fields:i}})(e));const r=new Map,a=new Map,l=[],h=[],c={};null===(n=null==t?void 0:t.tabs)||void 0===n||n.forEach((t=>{a.has(t.label)||!1!==t.visible||a.set(t.label,t)})),null===(s=null==t?void 0:t.fields)||void 0===s||s.forEach((t=>{var i,n,s;if(!1!==t.visible){const u=((t,e)=>("string"==typeof t?Array.from(e.keys()).find((e=>e.label===t)):t)||{label:t,visible:!0})(t.tab||"__main",r);if(a.has(u.label))return;const d=e.getField(t.name);if(d&&u.visible){r.has(u)||r.set(u,[]);const e=((t,e)=>{let i,n,{name:s,label:r,group:a}=Object.assign({},e),{readOnly:l,required:h}=Object.assign({},e);return t&&(r=r||t.label,s=s||t.name,h=t.required||(null==e?void 0:e.required),l=t.readOnly||(null==e?void 0:e.readOnly),i=t.properties,n=t.userInterface),{name:s,label:r,group:a,readOnly:l,required:h,props:i,userInterface:n||o.SHORTTEXT}})(d,t);r.get(u).push(e),e.required&&l.push(t.name),((null==t.cleanOnCopy?null===(i=d.properties)||void 0===i?void 0:i.cleanOnCopy:t.cleanOnCopy)||(null===(n=d.properties)||void 0===n?void 0:n.cleanOnCopy))&&h.push(t.name);let a=null==t.defaultValue?null===(s=d.properties)||void 0===s?void 0:s.defaultValue:t.defaultValue;a&&("object"==typeof a&&"V"===a.type&&(a=a.value),c[t.name]=a)}}}));const u=new g;if(u.setDefaultVars(t.defaultVars),i){const t=e.metadata;null!=t&&null!=t.children&&t.children.forEach((t=>{const{label:e,name:i,fields:n}=(t=>({name:`child[${t.name}]`,label:t.label,fields:[]}))(t);r.set({name:i,label:e},n)}))}return Array.from(r.entries()).sort(y).forEach((([t,e])=>{u.addSheet({label:"__main"===t.label?"Principal":t.label,name:t.name||t.label,fields:e})})),u.addRequiredFields(l),u.addCleanOnCopyFields(h),u.addDefaultValues(c),u})(this.config,this.dataUnit);this._store.dispatch({type:M.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new f("ez-form")),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new _(this.dataUnit),this._store=R(D),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),v.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}componentDidRender(){const t=x(this._store.getState());t.addRequiredFields(this._staticFields.filter((t=>t.dataset.required)).map((t=>t.dataset.fieldName))),this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")),this.dataUnit.dataUnitId,t,this.recordsValidator),this.ezReady.emit()}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback()}buildIdTabSelector(t){return t&&t.forEach((t=>t[v.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=d.toCamelCase(t.label))),t}render(){return i(s,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return r(this)}static get watchers(){return{config:["observeConfig"]}}};N.style=".sc-ez-form-h{display:flex;flex-direction:column;width:100%}.dynamic-content.sc-ez-form ez-collapsible-box.sc-ez-form{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{N as ez_form}
1
+ import{r as t,c as e,h as i,f as n,H as s,g as r}from"./p-7ffd12e7.js";import{UserInterface as o,DateUtils as a,Action as l,WaitingChangeException as h,ApplicationContext as c,DataUnitAction as u,StringUtils as d,DataUnit as f,ElementIDUtils as v}from"@sankhyalabs/core";import{A as p}from"./p-efb43dd8.js";import"./p-ab574d59.js";const b=/child\[([^\]]+)\]/,m=/\$\{.+\}/;class g{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const e=b.exec(t);return e?e[1]:void 0}getSheet(t){return this._sheets.get(t)}getAllSheets(){return this._sheets}addSheet(t){this._sheets.set(t.name,t)}addRequiredFields(t){this._requiredFields=this._requiredFields.concat(t)}getRequiredFields(){return this._requiredFields}addCleanOnCopyFields(t){this._cleanOnCopyFields=this._cleanOnCopyFields.concat(t)}getCleanOnCopyFields(){return this._cleanOnCopyFields}addDefaultValues(t){return this._defaultValues=Object.assign(Object.assign({},this._defaultValues),t)}getDefaultValues(){const t={};return Object.entries(this._defaultValues).forEach((([e,i])=>{if("string"==typeof i){const t=m.exec(i);t&&(i=this.getDefaultVar(t[0]))}t[e]=i})),t}getDefaultVar(t){return"${data}"===t?a.getToday():"${datahora}"===t?a.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const y=(t,e)=>"__main"==t[0].label?-1:(t[0].order||1e4)-(e[0].order||1e4);class _{constructor(t){this._invalidFields=new Map,this.onDataUnitEvent=t=>{var e;switch(t.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===(e=this._fields)||void 0===e||e.forEach((t=>{this.updateValue(t.fieldName,t.field)}))}},this._fields=new Map,this._dataUnit=t,this._dataUnit.subscribe(this.onDataUnitEvent),this._dataUnit.addInterceptor(this)}bind(t,e,i,n){t.forEach((t=>{const{fieldName:i,contextName:n}=t.dataset;null!=n&&n!==e||this.updateBind(i,t)})),this._formMetadata=i,this._recordsValidator=n}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent),this._dataUnit.removeInterceptor(this)}markInvalid(t){if(this._invalidFields.set(t.name,t),this._fields.has(t.name)){const e=this._fields.get(t.name).field;e.errorMessage||this.updateErrorMessage(t.name,e)}}clearInvalid(){this._invalidFields.clear(),this._fields.forEach((t=>{t.field.errorMessage=""}))}updateValue(t,e){const i=this._fields.get(t);try{i&&(i.listen=!1),e.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,e)}finally{i&&(i.listen=!0)}}validate(){return new Promise(((t,e)=>{var i;const n=this._dataUnit.getModifiedRecords();for(let t=0;t<n.length;t++){const s=n[t],r=[];let o=this.validateRequired(s);if(o&&!o.isValid&&r.push(o),o=null===(i=this._recordsValidator)||void 0===i?void 0:i.validateRecord(s),o&&!o.isValid&&r.push(o),r.length>0){this.processValidationResult(r),e();break}}return t()}))}validateRequired(t){const e=this._formMetadata.getRequiredFields(),i=[];if(new Set(e).forEach((e=>{const n=t[e];if(null==n||""===n){const t=this.getErrorMessage(e);i.push(t?{name:e,message:t}:{name:e,message:"Essa informação é obrigatória"})}})),i.length>0)return{isValid:!1,invalidFields:i,infoMessage:"Há pelo menos um campo obrigatório não preenchido."}}processValidationResult(t){t.forEach((t=>{const e=t.invalidFields;if(e&&e.forEach((t=>{this.markInvalid(t)})),t.infoMessage&&p.info(t.infoMessage),t.errorMessage){const{errorTitle:e,errorMessage:i}=t;p.error(e,i)}}))}updateErrorMessage(t,e){const i=this._invalidFields.get(t);i&&(e.errorMessage=i.message)}getErrorMessage(t){if(this._fields.has(t))return this._fields.get(t).field.errorMessage||null}updateBind(t,e){const i=this._fields.get(t);i&&i.destroy(),e.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,e),this._fields.set(t,w.create(t,e,((t,e)=>this.changeStarted(t,e)),(t=>this.cancelWaitingChange(t)),((t,e)=>this.setFieldValue(t,e)))),this.bindSearchOptionsLoader(t,e),this.applyEzUploadContext(t,e)}changeStarted(t,e){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),!e.blocking&&null==e.promise){const i=this._fields.get(t);i&&(e.promise=new Promise(((t,e)=>{i.waitingChangePromiseResolve=t,i.waitingChangePromiseReject=e})))}this._dataUnit.startChange(t,e)}cancelWaitingChange(t){if(this._dataUnit.waitingForChange(t)){this._dataUnit.cancelWaitingChange(t);const e=this._fields.get(t);e&&e.rejectWaitingChange(new h("Change canceled",t))}}setFieldValue(t,e){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._invalidFields.delete(t),this._dataUnit.setFieldValue(t,e),this._dataUnit.waitingForChange(t)){const e=this._fields.get(t);e&&e.acceptWaitingChange()}}bindSearchOptionsLoader(t,e){if("EZ-SEARCH"===e.nodeName&&null==e.optionLoader){const i=c.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");i&&(e.optionLoader=e=>i(e,t,this._dataUnit))}}applyEzUploadContext(t,e){var i,n;if("EZ-UPLOAD"===e.nodeName){e.urlUpload=c.getContextValue("__EZUI__UPLOAD__ADD__URL__"),e.urlDelete=c.getContextValue("__EZUI__UPLOAD__DEL__URL__");const s=this._dataUnit.getField(t),r=null===(i=s.properties)||void 0===i?void 0:i.DESTINATION;r&&(e.requestHeaders={XTRAINF:`{"destination": "${r}"}`}),e.maxFiles=(null===(n=s.properties)||void 0===n?void 0:n.MAX_FILES)||0}}interceptAction(t){var e;if(t.type===l.RECORDS_COPIED){const e=this._formMetadata.getCleanOnCopyFields();if(e)return new u(l.RECORDS_COPIED,t.payload.map((t=>{const i=Object.assign({},t);return e.forEach((t=>delete i[t])),i})))}if(t.type===l.SAVING_DATA)return new Promise((e=>{this.validate().then((()=>e(t))).catch((()=>{}))}));if(t.type===l.RECORDS_ADDED){const i=null===(e=this._formMetadata)||void 0===e?void 0:e.getDefaultValues();if(i)return new u(l.RECORDS_ADDED,t.payload.map((t=>{const e=Object.assign({},t);for(const t in i){const n=this.getFormattedValue(i[t]),s="function"==typeof n?n():n;e[t]=this._dataUnit.valueFromString(t,s)}return e})))}return t}getFormattedValue(t){return null==t||"object"!=typeof t?t:"formattedValue"in t?t.formattedValue:t.value}}class w{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(t){this.waitingChangePromiseReject&&(this.waitingChangePromiseReject(t),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}static create(t,e,i,n,s){const r=new w;return r.field=e,r.fieldName=t,r.startChangeListener=e=>{r.listen&&i(t,e.detail)},r.field.addEventListener(r.startChangeEventName,r.startChangeListener),r.cancelWaitingChangeListener=()=>{r.listen&&n(t)},r.field.addEventListener(r.cancelWaitingChangeEventName,r.cancelWaitingChangeListener),r.changeListener=e=>{r.listen&&s(t,e.detail)},r.field.addEventListener(r.changeEventName,r.changeListener),r}}function E(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var O="function"==typeof Symbol&&Symbol.observable||"@@observable",C=function(){return Math.random().toString(36).substring(7).split("").join(".")},A={INIT:"@@redux/INIT"+C(),REPLACE:"@@redux/REPLACE"+C(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+C()}};function j(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function R(t,e,i){var n;if("function"==typeof e&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(E(0));if("function"==typeof e&&void 0===i&&(i=e,e=void 0),void 0!==i){if("function"!=typeof i)throw new Error(E(1));return i(R)(t,e)}if("function"!=typeof t)throw new Error(E(2));var s=t,r=e,o=[],a=o,l=!1;function h(){a===o&&(a=o.slice())}function c(){if(l)throw new Error(E(3));return r}function u(t){if("function"!=typeof t)throw new Error(E(4));if(l)throw new Error(E(5));var e=!0;return h(),a.push(t),function(){if(e){if(l)throw new Error(E(6));e=!1,h();var i=a.indexOf(t);a.splice(i,1),o=null}}}function d(t){if(!j(t))throw new Error(E(7));if(void 0===t.type)throw new Error(E(8));if(l)throw new Error(E(9));try{l=!0,r=s(r,t)}finally{l=!1}for(var e=o=a,i=0;i<e.length;i++)(0,e[i])();return t}function f(t){if("function"!=typeof t)throw new Error(E(10));s=t,d({type:A.REPLACE})}function v(){var t,e=u;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(E(11));function i(){t.next&&t.next(c())}return i(),{unsubscribe:e(i)}}})[O]=function(){return this},t}return d({type:A.INIT}),(n={dispatch:d,subscribe:u,getState:c,replaceReducer:f})[O]=v,n}const z={};function D(t=z,e){switch(e.type){case M.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:e.payload,currentSheet:void 0});case M.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:e.payload});default:return t}}function x(t){return t.formMetadata}var M;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(M||(M={}));const N=class{constructor(i){t(this,i),this.ezReady=e(this,"ezReady",7),this.onDataUnitAction=t=>{t.type===l.METADATA_LOADED&&this.processMetadata()},this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0}validate(){return this._dataBinder.validate()}observeConfig(){this.processMetadata()}getDynamicContent(){var t;const e=x(this._store.getState());if(!e)return null;const n=Array.from(e.getAllSheets().values()),s=function(t){const e=function(t){return t.currentSheet}(t);return e?t.formMetadata.getSheet(e):Array.from(t.formMetadata.getAllSheets().values())[0]}(null===(t=this._store)||void 0===t?void 0:t.getState());let r=[];if(n.length>1){const t=n.map(((t,e)=>({tabKey:t.name,label:t.label,index:e}))),e="selector";r.push(i("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:M.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:s.name,"data-element-id":e}))}return r=r.concat(this.buildFormContent(s)),r}buildFormContent(t){const e=null==t?void 0:t.fields;if(null==t)return;const n=`${d.replaceAccentuatedChars(d.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return i("div",{class:"dynamic-content","data-element-id":n},i("ez-form-view",{class:"ez-row ez-padding-vertical--small",fields:e}))}processMetadata(){if(!this.isStatic()&&this.dataUnit&&this._store){const t=((t,e,i=!1)=>{var n,s;null!=t&&!0!==(null==t?void 0:t.emptyConfig)||(t=(t=>{const e=t.metadata;let i;return e&&(i=e.fields.filter((t=>!1!==t.visible)).map((t=>({name:t.name,defaultValue:t.defaultValue})))),{emptyConfig:!1,fields:i}})(e));const r=new Map,a=new Map,l=[],h=[],c={};null===(n=null==t?void 0:t.tabs)||void 0===n||n.forEach((t=>{a.has(t.label)||!1!==t.visible||a.set(t.label,t)})),null===(s=null==t?void 0:t.fields)||void 0===s||s.forEach((t=>{var i,n,s;if(!1!==t.visible){const u=((t,e)=>("string"==typeof t?Array.from(e.keys()).find((e=>e.label===t)):t)||{label:t,visible:!0})(t.tab||"__main",r);if(a.has(u.label))return;const d=e.getField(t.name);if(d&&u.visible){r.has(u)||r.set(u,[]);const e=((t,e)=>{let i,n,{name:s,label:r,group:a}=Object.assign({},e),{readOnly:l,required:h}=Object.assign({},e);return t&&(r=r||t.label,s=s||t.name,h=t.required||(null==e?void 0:e.required),l=t.readOnly||(null==e?void 0:e.readOnly),i=t.properties,n=t.userInterface),{name:s,label:r,group:a,readOnly:l,required:h,props:i,userInterface:n||o.SHORTTEXT}})(d,t);r.get(u).push(e),e.required&&l.push(t.name),((null==t.cleanOnCopy?null===(i=d.properties)||void 0===i?void 0:i.cleanOnCopy:t.cleanOnCopy)||(null===(n=d.properties)||void 0===n?void 0:n.cleanOnCopy))&&h.push(t.name);let a=null==t.defaultValue?null===(s=d.properties)||void 0===s?void 0:s.defaultValue:t.defaultValue;a&&("object"==typeof a&&"V"===a.type&&(a=a.value),c[t.name]=a)}}}));const u=new g;if(u.setDefaultVars(t.defaultVars),i){const t=e.metadata;null!=t&&null!=t.children&&t.children.forEach((t=>{const{label:e,name:i,fields:n}=(t=>({name:`child[${t.name}]`,label:t.label,fields:[]}))(t);r.set({name:i,label:e},n)}))}return Array.from(r.entries()).sort(y).forEach((([t,e])=>{u.addSheet({label:"__main"===t.label?"Principal":t.label,name:t.name||t.label,fields:e})})),u.addRequiredFields(l),u.addCleanOnCopyFields(h),u.addDefaultValues(c),u})(this.config,this.dataUnit);this._store.dispatch({type:M.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new f("ez-form")),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new _(this.dataUnit),this._store=R(D),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),v.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}componentDidRender(){const t=x(this._store.getState());t.addRequiredFields(this._staticFields.filter((t=>t.dataset.required)).map((t=>t.dataset.fieldName))),this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")),this.dataUnit.dataUnitId,t,this.recordsValidator),this.ezReady.emit()}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback()}buildIdTabSelector(t){return t&&t.forEach((t=>t[v.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=d.toCamelCase(t.label))),t}render(){return i(s,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return r(this)}static get watchers(){return{config:["observeConfig"]}}};N.style=".sc-ez-form-h{display:flex;flex-direction:column;width:100%}.dynamic-content.sc-ez-form ez-collapsible-box.sc-ez-form{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{N as ez_form}
@@ -3,8 +3,9 @@ import { IFormCardConfig } from "./IFormCardConfig";
3
3
  import { ISummaryField } from "./ISummaryField";
4
4
  import { ITabConfig } from "./ITabConfig";
5
5
  export interface IFormConfig {
6
- tabs?: Array<ITabConfig>;
6
+ emptyConfig: boolean;
7
7
  fields: Array<IFieldConfig>;
8
+ tabs?: Array<ITabConfig>;
8
9
  defaultConfiguration?: boolean;
9
10
  cardsState?: Map<string, IFormCardConfig>;
10
11
  summary?: Map<string, Array<ISummaryField>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/ezui",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "Biblioteca de componentes Sankhya.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/custom-elements/index.js",