@sankhyalabs/ezui 1.1.126 → 1.1.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ez-form.cjs.entry.js +4 -1
- package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +4 -1
- package/dist/custom-elements/index.js +4 -1
- package/dist/esm/ez-form.entry.js +4 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-7d5657c7.entry.js +1 -0
- package/package.json +1 -1
- package/dist/ezui/p-91706181.entry.js +0 -1
|
@@ -182,6 +182,9 @@ function getTabConfig(tab, sheets) {
|
|
|
182
182
|
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
183
183
|
return tabConfig || { label: tab, visible: true };
|
|
184
184
|
}
|
|
185
|
+
function sortTabs(a, b) {
|
|
186
|
+
return a[0].label == 'Geral' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
187
|
+
}
|
|
185
188
|
const buildFromConfig = (fields, dataUnit) => {
|
|
186
189
|
const sheets = new Map();
|
|
187
190
|
const requiredFields = [];
|
|
@@ -223,7 +226,7 @@ const buildFromConfig = (fields, dataUnit) => {
|
|
|
223
226
|
});
|
|
224
227
|
const metadata = new FormMetadata();
|
|
225
228
|
Array.from(sheets.entries())
|
|
226
|
-
.sort(
|
|
229
|
+
.sort(sortTabs)
|
|
227
230
|
.forEach(([key, value]) => {
|
|
228
231
|
metadata.addSheet({
|
|
229
232
|
label: key.label,
|
|
@@ -46,6 +46,9 @@ function getTabConfig(tab, sheets) {
|
|
|
46
46
|
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
47
47
|
return tabConfig || { label: tab, visible: true };
|
|
48
48
|
}
|
|
49
|
+
function sortTabs(a, b) {
|
|
50
|
+
return a[0].label == 'Geral' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
51
|
+
}
|
|
49
52
|
export const buildFromConfig = (fields, dataUnit) => {
|
|
50
53
|
const sheets = new Map();
|
|
51
54
|
const requiredFields = [];
|
|
@@ -87,7 +90,7 @@ export const buildFromConfig = (fields, dataUnit) => {
|
|
|
87
90
|
});
|
|
88
91
|
const metadata = new FormMetadata();
|
|
89
92
|
Array.from(sheets.entries())
|
|
90
|
-
.sort(
|
|
93
|
+
.sort(sortTabs)
|
|
91
94
|
.forEach(([key, value]) => {
|
|
92
95
|
metadata.addSheet({
|
|
93
96
|
label: key.label,
|
|
@@ -1336,6 +1336,9 @@ function getTabConfig(tab, sheets) {
|
|
|
1336
1336
|
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
1337
1337
|
return tabConfig || { label: tab, visible: true };
|
|
1338
1338
|
}
|
|
1339
|
+
function sortTabs(a, b) {
|
|
1340
|
+
return a[0].label == 'Geral' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
1341
|
+
}
|
|
1339
1342
|
const buildFromConfig = (fields, dataUnit) => {
|
|
1340
1343
|
const sheets = new Map();
|
|
1341
1344
|
const requiredFields = [];
|
|
@@ -1377,7 +1380,7 @@ const buildFromConfig = (fields, dataUnit) => {
|
|
|
1377
1380
|
});
|
|
1378
1381
|
const metadata = new FormMetadata();
|
|
1379
1382
|
Array.from(sheets.entries())
|
|
1380
|
-
.sort(
|
|
1383
|
+
.sort(sortTabs)
|
|
1381
1384
|
.forEach(([key, value]) => {
|
|
1382
1385
|
metadata.addSheet({
|
|
1383
1386
|
label: key.label,
|
|
@@ -178,6 +178,9 @@ function getTabConfig(tab, sheets) {
|
|
|
178
178
|
const tabConfig = (typeof tab === "string" ? Array.from(sheets.keys()).find(t => t.label === tab) : tab);
|
|
179
179
|
return tabConfig || { label: tab, visible: true };
|
|
180
180
|
}
|
|
181
|
+
function sortTabs(a, b) {
|
|
182
|
+
return a[0].label == 'Geral' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
|
|
183
|
+
}
|
|
181
184
|
const buildFromConfig = (fields, dataUnit) => {
|
|
182
185
|
const sheets = new Map();
|
|
183
186
|
const requiredFields = [];
|
|
@@ -219,7 +222,7 @@ const buildFromConfig = (fields, dataUnit) => {
|
|
|
219
222
|
});
|
|
220
223
|
const metadata = new FormMetadata();
|
|
221
224
|
Array.from(sheets.entries())
|
|
222
|
-
.sort(
|
|
225
|
+
.sort(sortTabs)
|
|
223
226
|
.forEach(([key, value]) => {
|
|
224
227
|
metadata.addSheet({
|
|
225
228
|
label: key.label,
|
package/dist/ezui/ezui.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as s}from"./p-60138b72.js";(()=>{const s=import.meta.url,o={};return""!==s&&(o.resourcesUrl=new URL(".",s).href),e(o)})().then((e=>s([["p-248d8511",[[6,"ez-grid",{multipleSelection:[4,"multiple-selection"],config:[1040],pageSize:[2,"page-size"],serverUrl:[1,"server-url"],dataUnit:[16],_navigationHasPrevious:[32],_navigationHasNext:[32],_navigationFirstRow:[32],_navigationLastRow:[32],_navigationTotalRows:[32],_popUpVisible:[32],setColumnsDef:[64],addColumnMenuItem:[64],setColumnsState:[64],setData:[64],getSelection:[64],getColumnsState:[64],getColumns:[64],refresh:[64],quickFilter:[64]}]]],["p-05cca198",[[1,"ez-dialog",{confirm:[1028],critical:[1028],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],handleButtonClick:[64],show:[64]}]]],["p-ec205792",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],loading:[516],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-8a0e5e59",[[1,"ez-action-chip",{label:[513],enabled:[516]}]]],["p-4884b056",[[0,"ez-application"]]],["p-bd29c55f",[[1,"ez-label-chip",{label:[513],enabled:[516],removable:[516],value:[1540],setFocus:[64],setBlur:[64]}]]],["p-0cb4aec1",[[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-1ced597f",[[1,"ez-popup",{size:[1],opened:[1540],useHeader:[1540,"use-header"],ezTitle:[1,"ez-title"]}]]],["p-2d55888f",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-b59ab2d5",[[2,"grid-config",{selectedTab:[1025,"selected-tab"],columns:[1040],config:[1040]}]]],["p-ef8f1275",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-f65302bb",[[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],setFocus:[64],setBlur:[64]}]]],["p-cbfb94cb",[[1,"ez-date-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-5f725a93",[[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]}]]],["p-5821c335",[[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]}]]],["p-ed1e0331",[[1,"ez-time-input",{label:[513],viewValue:[1537,"view-value"],value:[1026],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-35edc488",[[1,"select-box",{selectedOption:[1,"selected-option"]}]]],["p-c6b2b2e5",[[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]}]]],["p-7d5b2ebf",[[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],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-5a9ab4f7",[[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]}]]],["p-fa9157c1",[[1,"ez-icon",{size:[513],href:[513],iconName:[513,"icon-name"]}]]],["p-7f87f762",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],stretchTitle:[516,"stretch-title"],showHide:[64]}]]],["p-a4a21738",[[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-495cdb4c",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]}]]],["p-7df61f4a",[[1,"ez-calendar",{value:[1040],floating:[516],time:[516],showSeconds:[516,"show-seconds"],show:[64],fitVertical:[64],hide:[64]}]]],["p-dc0aa563",[[1,"ez-check",{label:[513],value:[1540],enabled:[1540],mode:[513],getMode:[64],setFocus:[64]}]]],["p-1c28d99b",[[1,"ez-tabselector",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1]}]]],["p-cf8309fc",[[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],setFocus:[64],setBlur:[64]}]]],["p-
|
|
1
|
+
import{p as e,b as s}from"./p-60138b72.js";(()=>{const s=import.meta.url,o={};return""!==s&&(o.resourcesUrl=new URL(".",s).href),e(o)})().then((e=>s([["p-248d8511",[[6,"ez-grid",{multipleSelection:[4,"multiple-selection"],config:[1040],pageSize:[2,"page-size"],serverUrl:[1,"server-url"],dataUnit:[16],_navigationHasPrevious:[32],_navigationHasNext:[32],_navigationFirstRow:[32],_navigationLastRow:[32],_navigationTotalRows:[32],_popUpVisible:[32],setColumnsDef:[64],addColumnMenuItem:[64],setColumnsState:[64],setData:[64],getSelection:[64],getColumnsState:[64],getColumns:[64],refresh:[64],quickFilter:[64]}]]],["p-05cca198",[[1,"ez-dialog",{confirm:[1028],critical:[1028],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],handleButtonClick:[64],show:[64]}]]],["p-ec205792",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],loading:[516],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-8a0e5e59",[[1,"ez-action-chip",{label:[513],enabled:[516]}]]],["p-4884b056",[[0,"ez-application"]]],["p-bd29c55f",[[1,"ez-label-chip",{label:[513],enabled:[516],removable:[516],value:[1540],setFocus:[64],setBlur:[64]}]]],["p-0cb4aec1",[[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-1ced597f",[[1,"ez-popup",{size:[1],opened:[1540],useHeader:[1540,"use-header"],ezTitle:[1,"ez-title"]}]]],["p-2d55888f",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-b59ab2d5",[[2,"grid-config",{selectedTab:[1025,"selected-tab"],columns:[1040],config:[1040]}]]],["p-ef8f1275",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-f65302bb",[[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],setFocus:[64],setBlur:[64]}]]],["p-cbfb94cb",[[1,"ez-date-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-5f725a93",[[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]}]]],["p-5821c335",[[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]}]]],["p-ed1e0331",[[1,"ez-time-input",{label:[513],viewValue:[1537,"view-value"],value:[1026],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-35edc488",[[1,"select-box",{selectedOption:[1,"selected-option"]}]]],["p-c6b2b2e5",[[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]}]]],["p-7d5b2ebf",[[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],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-5a9ab4f7",[[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]}]]],["p-fa9157c1",[[1,"ez-icon",{size:[513],href:[513],iconName:[513,"icon-name"]}]]],["p-7f87f762",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],stretchTitle:[516,"stretch-title"],showHide:[64]}]]],["p-a4a21738",[[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-495cdb4c",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]}]]],["p-7df61f4a",[[1,"ez-calendar",{value:[1040],floating:[516],time:[516],showSeconds:[516,"show-seconds"],show:[64],fitVertical:[64],hide:[64]}]]],["p-dc0aa563",[[1,"ez-check",{label:[513],value:[1540],enabled:[1540],mode:[513],getMode:[64],setFocus:[64]}]]],["p-1c28d99b",[[1,"ez-tabselector",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1]}]]],["p-cf8309fc",[[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],setFocus:[64],setBlur:[64]}]]],["p-7d5657c7",[[0,"ez-form",{dataUnit:[1040],config:[16],submit:[64],cancel:[64],validate:[64]}]]],["p-6aa0c6f1",[[0,"test-du",{isDirty:[32]}]]]],e)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as e,r as t,c as i,f as n,H as r,g as o}from"./p-60138b72.js";import{UserInterface as a,Action as s,ApplicationContext as l,DataUnitAction as c,DataUnit as d}from"@sankhyalabs/core";import{A as u}from"./p-0cd386db.js";const h=({name:t,label:i})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-text-input",{label:i,"data-field-name":t,key:t}));function f(t,i,n,r=!1){return e("div",{class:"col col--sd-12 col--tb-3 align--middle padding-horizontal--small padding-bottom--large"},e("ez-check",{enabled:!n,label:i,mode:r?"switch":"regular","data-field-name":t,key:t}))}function b(t,i,n,r,o){return e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-number-input",{enabled:!n,label:i,precision:r,prettyPrecision:o,"data-field-name":t,key:t}))}const p=new Map;p.set(a.LONGTEXT,(({name:t,label:i,readOnly:n})=>e("div",{class:"col col--sd-12 padding-horizontal--small",key:t},e("ez-text-area",{enabled:!n,label:i,"data-field-name":t})))),p.set(a.CHECKBOX,(e=>f(e.name,e.label,e.readOnly,!1))),p.set(a.SWITCH,(e=>f(e.name,e.label,e.readOnly,!0))),p.set(a.OPTIONSELECTOR,(({name:t,label:i,readOnly:n,required:r},o)=>{const a=null==o?void 0:o.options;let s;if("string"==typeof a){const e=JSON.parse(a);s=Object.keys(e).map((t=>({value:t,label:e[t]})))}else s=a;return e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-combo-box",{enabled:!n,suppressEmptyOption:r,label:i,"data-field-name":t,key:t,options:s}))})),p.set(a.SEARCH,(({name:t,label:i,readOnly:n,required:r})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-search",{enabled:!n,suppressEmptyOption:r,label:i,"data-field-name":t,key:t})))),p.set(a.FILE,(({name:t,label:i,readOnly:n})=>e("div",{class:"col col--sd-12 padding-horizontal--small"},e("ez-upload",{enabled:!n,label:i,"data-field-name":t,key:t})))),p.set(a.DATE,(({name:t,label:i,readOnly:n})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-date-input",{enabled:!n,label:i,"data-field-name":t,key:t})))),p.set(a.TIME,(({name:t,label:i})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-time-input",{label:i,"data-field-name":t,key:t})))),p.set(a.DATETIME,(({name:t,label:i})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-date-time-input",{label:i,"data-field-name":t,key:t})))),p.set(a.DECIMALNUMBER,(({name:e,label:t,readOnly:i},n)=>{const r=Number((null==n?void 0:n.precision)||2);return b(e,t,i,r,Number((null==n?void 0:n.prettyPrecision)||r))})),p.set(a.INTEGERNUMBER,(({name:e,label:t,readOnly:i})=>b(e,t,i,0,0)));const m=e=>{const t=e.descriptor,i=Object.assign({},e.config);let n,r;return t&&(i.label||(i.label=t.label),i.name||(i.name=t.name),void 0===i.required&&(i.required=t.required),void 0===i.readOnly&&(i.readOnly=t.readOnly),r=t.properties,n=p.get(t.userInterface)),i.required&&(i.label=`* ${i.label} (obrigatório)`),n||(n=h),n(i,r)},v=({source:t})=>"items"in t?e("ez-collapsible-box",{label:t.label,"header-size":"large"},t.items.map((e=>m(e)))):m(t),y=({store:t,source:i})=>e("div",{class:"dynamic-content box__container"},e("div",{class:"row padding-vertical--small"},i.items.map((i=>e(v,{store:t,source:i})))));class g{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[]}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)}getRequiredFields(){return this._requiredFields}getCleanOnCopyFields(){return this._cleanOnCopyFields}}function _(e,t){return"Geral"==e[0].label?-1:(e[0].order||1e4)-(t[0].order||1e4)}function w(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 O="function"==typeof Symbol&&Symbol.observable||"@@observable",E=function(){return Math.random().toString(36).substring(7).split("").join(".")},z={INIT:"@@redux/INIT"+E(),REPLACE:"@@redux/REPLACE"+E(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+E()}};function A(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 C(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(w(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(w(1));return i(C)(e,t)}if("function"!=typeof e)throw new Error(w(2));var r=e,o=t,a=[],s=a,l=!1;function c(){s===a&&(s=a.slice())}function d(){if(l)throw new Error(w(3));return o}function u(e){if("function"!=typeof e)throw new Error(w(4));if(l)throw new Error(w(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(w(6));t=!1,c();var i=s.indexOf(e);s.splice(i,1),a=null}}}function h(e){if(!A(e))throw new Error(w(7));if(void 0===e.type)throw new Error(w(8));if(l)throw new Error(w(9));try{l=!0,o=r(o,e)}finally{l=!1}for(var t=a=s,i=0;i<t.length;i++)(0,t[i])();return e}function f(e){if("function"!=typeof e)throw new Error(w(10));r=e,h({type:z.REPLACE})}function b(){var e,t=u;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(w(11));function i(){e.next&&e.next(d())}return i(),{unsubscribe:t(i)}}})[O]=function(){return this},e}return h({type:z.INIT}),(n={dispatch:h,subscribe:u,getState:d,replaceReducer:f})[O]=b,n}const x={};function R(e=x,t){switch(t.type){case j.METADATA_LOADED:return Object.assign(Object.assign({},e),{formMetadata:t.payload});case j.CHANGE_TAB:return Object.assign(Object.assign({},e),{currentSheet:t.payload});default:return e}}function N(e){return e.formMetadata}var j;!function(e){e.METADATA_LOADED="FORM/METADATA_LOADED",e.CHANGE_TAB="FORM/CHANGE_TAB"}(j||(j={}));class k{constructor(e){this.onDataUnitEvent=e=>{var t;switch(e.type){case s.DATA_LOADED:case s.DATA_SAVED:case s.RECORDS_REMOVED:case s.RECORDS_ADDED:case s.RECORDS_COPIED:case s.DATA_CHANGED:case s.EDITION_CANCELED:case s.CHANGE_UNDONE:case s.CHANGE_REDONE:case s.SELECTION_CHANGED:case s.NEXT_SELECTED:case s.PREVIOUS_SELECTED: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)}updateValue(e,t){const i=t.value,n=this._dataUnit.getFieldValue(e);i!=n&&(t.value=n)}updateBind(e,t){const i=this._fields.get(e);i&&i.destroy(),t.value=this._dataUnit.getFieldValue(e),this._fields.set(e,S.create(e,t,((e,t)=>this.changeStarted(e,t)),((e,t)=>this.setFieldValue(e,t)))),this.bindSearchOptionsLoader(e,t),this.applyEzUploadContext(e,t)}changeStarted(e,t){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.startChange(e,t)}setFieldValue(e,t){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.setFieldValue(e,t)}bindSearchOptionsLoader(e,t){if("EZ-SEARCH"===t.nodeName&&void 0===t.optionLoader){const i=l.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=l.getContextValue("__EZUI__UPLOAD__ADD__URL__"),t.urlDelete=l.getContextValue("__EZUI__UPLOAD__DEL__URL__");const r=this._dataUnit.getField(e),o=null===(i=r.properties)||void 0===i?void 0:i.DESTINATION;o&&(t.requestHeaders={XTRAINF:`{"destination": "${o}"}`}),t.maxFiles=(null===(n=r.properties)||void 0===n?void 0:n.MAX_FILES)||0}}}class S{constructor(){this.startChangeEventName="ezStartChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}static create(e,t,i,n){const r=new S;return r.field=t,r.fieldName=e,r.startChangeListener=t=>{i(e,t.detail)},r.field.addEventListener(r.startChangeEventName,r.startChangeListener),r.changeListener=t=>{n(e,t.detail)},r.field.addEventListener(r.changeEventName,r.changeListener),r}}let D=class{constructor(e){t(this,e),this.ezReady=i(this,"ezReady",7),this.onDataUnitAction=e=>{e.type===s.METADATA_LOADED&&this.processMetadata()}}submit(){return Promise.resolve()}cancel(){return Promise.resolve()}validate(){return new Promise(((e,t)=>{const i=N(this._store.getState()),n=this._staticFields.filter((e=>e.dataset.required)).map((e=>e.dataset.fieldName)).concat(i.getRequiredFields()),r=this.dataUnit.records;for(let e=0;e<r.length;e++)if(!this.validateRequired(n,r[e])){t();break}e()}))}configChanged(){this.processMetadata()}validateRequired(e,t){const i=[];e.forEach((e=>{const n=t[e],r=this._element.querySelector(`[data-field-name=${e}]`);null==n||""===n?(i.push(e),r.errorMessage="Essa informação é obrigatória"):r.errorMessage=""}));const n=0===i.length;return n||u.info("Há pelo menos um campo obrigatório não preenchido."),n}getDynamicContent(){var t;const i=N(this._store.getState());if(!i)return null;const n=(r=null===(t=this._store)||void 0===t?void 0:t.getState()).currentSheet?r.formMetadata.getSheet(r.currentSheet):Array.from(r.formMetadata.getAllSheets().values())[0];var r;if(!n)return null;const o=Array.from(i.getAllSheets().values()),a=[];return o.length>1&&a.push(e("ez-tabselector",{onEzChange:e=>this._store.dispatch(function(e){return{type:j.CHANGE_TAB,payload:e.tabKey}}(e.detail)),selectedTab:n.name},o.map((t=>e("ez-tab",{tabKey:t.name,label:t.label}))))),a.push(e(y,{store:this._store,source:n})),a}processMetadata(){if(!this.isStatic()){const e=this.config&&this.config.length>0?((e,t)=>{const i=new Map,n=[],r=[];e.forEach((e=>{var o;if(!1!==e.visible){const a=function(e,t){return("string"==typeof e?Array.from(t.keys()).find((t=>t.label===e)):e)||{label:e,visible:!0}}(e.tab||"Geral",i),s=t.getField(e.name);if(s&&a.visible){i.has(a)||i.set(a,new Map);const t=i.get(a);(void 0===e.required?s.required:e.required)&&n.push(e.name),(void 0===e.cleanOnCopy?null===(o=s.properties)||void 0===o?void 0:o.cleanOnCopy:e.cleanOnCopy)&&r.push(e.name);const l={config:e,descriptor:s},c=e.group;if(c){const e=`group::${c}`;t.has(e)?t.get(e).items.push(l):t.set(e,{label:c,items:[l]})}else t.set(e.name,l)}}}));const o=new g;return Array.from(i.entries()).sort(_).forEach((([e,t])=>{o.addSheet({label:e.label,name:e.label,items:Array.from(t.values()),requiredFields:n,cleanOnCopyFields:r})})),o})(this.config,this.dataUnit):(()=>{var e;const t=this.dataUnit.metadata,i=new g;if(t){const n=null===(e=t.fields)||void 0===e?void 0:e.filter((e=>!1!==e.visible));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;return null===(t=e.properties)||void 0===t?void 0:t.cleanOnCopy})).map((e=>e.name))})}return i})();this._store.dispatch({type:j.METADATA_LOADED,payload:e})}}isStatic(){var e;return(null===(e=this._staticFields)||void 0===e?void 0:e.length)>0}interceptAction(e){if(e.type===s.RECORDS_COPIED){const t=N(this._store.getState()).getCleanOnCopyFields();if(t)return new c(s.RECORDS_COPIED,e.payload.map((e=>{const i=Object.assign({},e);return t.forEach((e=>delete i[e])),i})))}return e}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new d("ez-form")),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new k(this.dataUnit),this._store=C(R),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(r,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return o(this)}static get watchers(){return{config:["configChanged"]}}};D.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{D as ez_form}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e,r as t,c as i,f as n,H as r,g as o}from"./p-60138b72.js";import{UserInterface as a,Action as s,ApplicationContext as l,DataUnitAction as c,DataUnit as d}from"@sankhyalabs/core";import{A as u}from"./p-0cd386db.js";const h=({name:t,label:i})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-text-input",{label:i,"data-field-name":t,key:t}));function f(t,i,n,r=!1){return e("div",{class:"col col--sd-12 col--tb-3 align--middle padding-horizontal--small padding-bottom--large"},e("ez-check",{enabled:!n,label:i,mode:r?"switch":"regular","data-field-name":t,key:t}))}function b(t,i,n,r,o){return e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-number-input",{enabled:!n,label:i,precision:r,prettyPrecision:o,"data-field-name":t,key:t}))}const p=new Map;p.set(a.LONGTEXT,(({name:t,label:i,readOnly:n})=>e("div",{class:"col col--sd-12 padding-horizontal--small",key:t},e("ez-text-area",{enabled:!n,label:i,"data-field-name":t})))),p.set(a.CHECKBOX,(e=>f(e.name,e.label,e.readOnly,!1))),p.set(a.SWITCH,(e=>f(e.name,e.label,e.readOnly,!0))),p.set(a.OPTIONSELECTOR,(({name:t,label:i,readOnly:n,required:r},o)=>{const a=null==o?void 0:o.options;let s;if("string"==typeof a){const e=JSON.parse(a);s=Object.keys(e).map((t=>({value:t,label:e[t]})))}else s=a;return e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-combo-box",{enabled:!n,suppressEmptyOption:r,label:i,"data-field-name":t,key:t,options:s}))})),p.set(a.SEARCH,(({name:t,label:i,readOnly:n,required:r})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-search",{enabled:!n,suppressEmptyOption:r,label:i,"data-field-name":t,key:t})))),p.set(a.FILE,(({name:t,label:i,readOnly:n})=>e("div",{class:"col col--sd-12 padding-horizontal--small"},e("ez-upload",{enabled:!n,label:i,"data-field-name":t,key:t})))),p.set(a.DATE,(({name:t,label:i,readOnly:n})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-date-input",{enabled:!n,label:i,"data-field-name":t,key:t})))),p.set(a.TIME,(({name:t,label:i})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-time-input",{label:i,"data-field-name":t,key:t})))),p.set(a.DATETIME,(({name:t,label:i})=>e("div",{class:"col col--sd-12 col--tb-3 padding-horizontal--small"},e("ez-date-time-input",{label:i,"data-field-name":t,key:t})))),p.set(a.DECIMALNUMBER,(({name:e,label:t,readOnly:i},n)=>{const r=Number((null==n?void 0:n.precision)||2);return b(e,t,i,r,Number((null==n?void 0:n.prettyPrecision)||r))})),p.set(a.INTEGERNUMBER,(({name:e,label:t,readOnly:i})=>b(e,t,i,0,0)));const m=e=>{const t=e.descriptor,i=Object.assign({},e.config);let n,r;return t&&(i.label||(i.label=t.label),i.name||(i.name=t.name),void 0===i.required&&(i.required=t.required),void 0===i.readOnly&&(i.readOnly=t.readOnly),r=t.properties,n=p.get(t.userInterface)),i.required&&(i.label=`* ${i.label} (obrigatório)`),n||(n=h),n(i,r)},v=({source:t})=>"items"in t?e("ez-collapsible-box",{label:t.label,"header-size":"large"},t.items.map((e=>m(e)))):m(t),y=({store:t,source:i})=>e("div",{class:"dynamic-content box__container"},e("div",{class:"row padding-vertical--small"},i.items.map((i=>e(v,{store:t,source:i})))));class g{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[]}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)}getRequiredFields(){return this._requiredFields}getCleanOnCopyFields(){return this._cleanOnCopyFields}}function _(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 w="function"==typeof Symbol&&Symbol.observable||"@@observable",O=function(){return Math.random().toString(36).substring(7).split("").join(".")},E={INIT:"@@redux/INIT"+O(),REPLACE:"@@redux/REPLACE"+O(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+O()}};function z(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 A(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(_(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(_(1));return i(A)(e,t)}if("function"!=typeof e)throw new Error(_(2));var r=e,o=t,a=[],s=a,l=!1;function c(){s===a&&(s=a.slice())}function d(){if(l)throw new Error(_(3));return o}function u(e){if("function"!=typeof e)throw new Error(_(4));if(l)throw new Error(_(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(_(6));t=!1,c();var i=s.indexOf(e);s.splice(i,1),a=null}}}function h(e){if(!z(e))throw new Error(_(7));if(void 0===e.type)throw new Error(_(8));if(l)throw new Error(_(9));try{l=!0,o=r(o,e)}finally{l=!1}for(var t=a=s,i=0;i<t.length;i++)(0,t[i])();return e}function f(e){if("function"!=typeof e)throw new Error(_(10));r=e,h({type:E.REPLACE})}function b(){var e,t=u;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(_(11));function i(){e.next&&e.next(d())}return i(),{unsubscribe:t(i)}}})[w]=function(){return this},e}return h({type:E.INIT}),(n={dispatch:h,subscribe:u,getState:d,replaceReducer:f})[w]=b,n}const C={};function x(e=C,t){switch(t.type){case N.METADATA_LOADED:return Object.assign(Object.assign({},e),{formMetadata:t.payload});case N.CHANGE_TAB:return Object.assign(Object.assign({},e),{currentSheet:t.payload});default:return e}}function R(e){return e.formMetadata}var N;!function(e){e.METADATA_LOADED="FORM/METADATA_LOADED",e.CHANGE_TAB="FORM/CHANGE_TAB"}(N||(N={}));class j{constructor(e){this.onDataUnitEvent=e=>{var t;switch(e.type){case s.DATA_LOADED:case s.DATA_SAVED:case s.RECORDS_REMOVED:case s.RECORDS_ADDED:case s.RECORDS_COPIED:case s.DATA_CHANGED:case s.EDITION_CANCELED:case s.CHANGE_UNDONE:case s.CHANGE_REDONE:case s.SELECTION_CHANGED:case s.NEXT_SELECTED:case s.PREVIOUS_SELECTED: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)}updateValue(e,t){const i=t.value,n=this._dataUnit.getFieldValue(e);i!=n&&(t.value=n)}updateBind(e,t){const i=this._fields.get(e);i&&i.destroy(),t.value=this._dataUnit.getFieldValue(e),this._fields.set(e,k.create(e,t,((e,t)=>this.changeStarted(e,t)),((e,t)=>this.setFieldValue(e,t)))),this.bindSearchOptionsLoader(e,t),this.applyEzUploadContext(e,t)}changeStarted(e,t){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.startChange(e,t)}setFieldValue(e,t){0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.setFieldValue(e,t)}bindSearchOptionsLoader(e,t){if("EZ-SEARCH"===t.nodeName&&void 0===t.optionLoader){const i=l.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=l.getContextValue("__EZUI__UPLOAD__ADD__URL__"),t.urlDelete=l.getContextValue("__EZUI__UPLOAD__DEL__URL__");const r=this._dataUnit.getField(e),o=null===(i=r.properties)||void 0===i?void 0:i.DESTINATION;o&&(t.requestHeaders={XTRAINF:`{"destination": "${o}"}`}),t.maxFiles=(null===(n=r.properties)||void 0===n?void 0:n.MAX_FILES)||0}}}class k{constructor(){this.startChangeEventName="ezStartChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}static create(e,t,i,n){const r=new k;return r.field=t,r.fieldName=e,r.startChangeListener=t=>{i(e,t.detail)},r.field.addEventListener(r.startChangeEventName,r.startChangeListener),r.changeListener=t=>{n(e,t.detail)},r.field.addEventListener(r.changeEventName,r.changeListener),r}}let S=class{constructor(e){t(this,e),this.ezReady=i(this,"ezReady",7),this.onDataUnitAction=e=>{e.type===s.METADATA_LOADED&&this.processMetadata()}}submit(){return Promise.resolve()}cancel(){return Promise.resolve()}validate(){return new Promise(((e,t)=>{const i=R(this._store.getState()),n=this._staticFields.filter((e=>e.dataset.required)).map((e=>e.dataset.fieldName)).concat(i.getRequiredFields()),r=this.dataUnit.records;for(let e=0;e<r.length;e++)if(!this.validateRequired(n,r[e])){t();break}e()}))}configChanged(){this.processMetadata()}validateRequired(e,t){const i=[];e.forEach((e=>{const n=t[e],r=this._element.querySelector(`[data-field-name=${e}]`);null==n||""===n?(i.push(e),r.errorMessage="Essa informação é obrigatória"):r.errorMessage=""}));const n=0===i.length;return n||u.info("Há pelo menos um campo obrigatório não preenchido."),n}getDynamicContent(){var t;const i=R(this._store.getState());if(!i)return null;const n=(r=null===(t=this._store)||void 0===t?void 0:t.getState()).currentSheet?r.formMetadata.getSheet(r.currentSheet):Array.from(r.formMetadata.getAllSheets().values())[0];var r;if(!n)return null;const o=Array.from(i.getAllSheets().values()),a=[];return o.length>1&&a.push(e("ez-tabselector",{onEzChange:e=>this._store.dispatch(function(e){return{type:N.CHANGE_TAB,payload:e.tabKey}}(e.detail)),selectedTab:n.name},o.map((t=>e("ez-tab",{tabKey:t.name,label:t.label}))))),a.push(e(y,{store:this._store,source:n})),a}processMetadata(){if(!this.isStatic()){const e=this.config&&this.config.length>0?((e,t)=>{const i=new Map,n=[],r=[];e.forEach((e=>{var o;if(!1!==e.visible){const a=function(e,t){return("string"==typeof e?Array.from(t.keys()).find((t=>t.label===e)):e)||{label:e,visible:!0}}(e.tab||"Geral",i),s=t.getField(e.name);if(s&&a.visible){i.has(a)||i.set(a,new Map);const t=i.get(a);(void 0===e.required?s.required:e.required)&&n.push(e.name),(void 0===e.cleanOnCopy?null===(o=s.properties)||void 0===o?void 0:o.cleanOnCopy:e.cleanOnCopy)&&r.push(e.name);const l={config:e,descriptor:s},c=e.group;if(c){const e=`group::${c}`;t.has(e)?t.get(e).items.push(l):t.set(e,{label:c,items:[l]})}else t.set(e.name,l)}}}));const o=new g;return Array.from(i.entries()).sort(((e,t)=>(e[0].order||1e4)-(t[0].order||1e4))).forEach((([e,t])=>{o.addSheet({label:e.label,name:e.label,items:Array.from(t.values()),requiredFields:n,cleanOnCopyFields:r})})),o})(this.config,this.dataUnit):(()=>{var e;const t=this.dataUnit.metadata,i=new g;if(t){const n=null===(e=t.fields)||void 0===e?void 0:e.filter((e=>!1!==e.visible));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;return null===(t=e.properties)||void 0===t?void 0:t.cleanOnCopy})).map((e=>e.name))})}return i})();this._store.dispatch({type:N.METADATA_LOADED,payload:e})}}isStatic(){var e;return(null===(e=this._staticFields)||void 0===e?void 0:e.length)>0}interceptAction(e){if(e.type===s.RECORDS_COPIED){const t=R(this._store.getState()).getCleanOnCopyFields();if(t)return new c(s.RECORDS_COPIED,e.payload.map((e=>{const i=Object.assign({},e);return t.forEach((e=>delete i[e])),i})))}return e}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new d("ez-form")),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new j(this.dataUnit),this._store=A(x),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(r,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return o(this)}static get watchers(){return{config:["configChanged"]}}};S.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{S as ez_form}
|