@sankhyalabs/ezui 1.1.135 → 1.1.138

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/cjs/ez-calendar.cjs.entry.js +2 -2
  2. package/dist/cjs/ez-check.cjs.entry.js +3 -3
  3. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-combo-box.cjs.entry.js +5 -5
  5. package/dist/cjs/ez-date-input.cjs.entry.js +10 -10
  6. package/dist/cjs/ez-date-time-input.cjs.entry.js +8 -8
  7. package/dist/cjs/ez-filter-input.cjs.entry.js +6 -6
  8. package/dist/cjs/ez-form.cjs.entry.js +36 -5
  9. package/dist/cjs/ez-grid.cjs.entry.js +4 -4
  10. package/dist/cjs/ez-modal.cjs.entry.js +3 -3
  11. package/dist/cjs/ez-number-input.cjs.entry.js +25 -18
  12. package/dist/cjs/ez-popover.cjs.entry.js +2 -2
  13. package/dist/cjs/ez-search.cjs.entry.js +2 -2
  14. package/dist/cjs/ez-text-area.cjs.entry.js +11 -11
  15. package/dist/cjs/ez-text-input.cjs.entry.js +22 -15
  16. package/dist/cjs/ez-time-input.cjs.entry.js +36 -30
  17. package/dist/cjs/ez-upload.cjs.entry.js +5 -5
  18. package/dist/cjs/ez-view-stack.cjs.entry.js +71 -0
  19. package/dist/cjs/ezui.cjs.js +1 -1
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/cjs/test-du.cjs.entry.js +43 -10
  22. package/dist/collection/collection-manifest.json +1 -0
  23. package/dist/collection/components/ez-calendar/ez-calendar.js +2 -2
  24. package/dist/collection/components/ez-check/ez-check.js +3 -3
  25. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +14 -2
  26. package/dist/collection/components/ez-combo-box/ez-combo-box.js +5 -5
  27. package/dist/collection/components/ez-date-input/ez-date-input.js +10 -10
  28. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +8 -8
  29. package/dist/collection/components/ez-filter-input/ez-filter-input.js +6 -6
  30. package/dist/collection/components/ez-form/ez-form.js +17 -2
  31. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +19 -3
  32. package/dist/collection/components/ez-grid/ez-grid.js +4 -4
  33. package/dist/collection/components/ez-modal/ez-modal.js +3 -3
  34. package/dist/collection/components/ez-number-input/ez-number-input.js +26 -19
  35. package/dist/collection/components/ez-popover/ez-popover.js +2 -2
  36. package/dist/collection/components/ez-search/ez-search.js +2 -2
  37. package/dist/collection/components/ez-text-area/ez-text-area.js +11 -11
  38. package/dist/collection/components/ez-text-input/ez-text-input.js +40 -15
  39. package/dist/collection/components/ez-time-input/ez-time-input.js +52 -31
  40. package/dist/collection/components/ez-upload/ez-upload.css +1 -0
  41. package/dist/collection/components/ez-upload/ez-upload.js +4 -4
  42. package/dist/collection/components/ez-view-stack/ez-view-stack.css +9 -0
  43. package/dist/collection/components/ez-view-stack/ez-view-stack.js +87 -0
  44. package/dist/collection/components/test-du/test-du.js +44 -10
  45. package/dist/custom-elements/index.d.ts +6 -0
  46. package/dist/custom-elements/index.js +293 -142
  47. package/dist/esm/ez-calendar.entry.js +2 -2
  48. package/dist/esm/ez-check.entry.js +3 -3
  49. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  50. package/dist/esm/ez-combo-box.entry.js +5 -5
  51. package/dist/esm/ez-date-input.entry.js +10 -10
  52. package/dist/esm/ez-date-time-input.entry.js +8 -8
  53. package/dist/esm/ez-filter-input.entry.js +6 -6
  54. package/dist/esm/ez-form.entry.js +36 -5
  55. package/dist/esm/ez-grid.entry.js +4 -4
  56. package/dist/esm/ez-modal.entry.js +3 -3
  57. package/dist/esm/ez-number-input.entry.js +25 -18
  58. package/dist/esm/ez-popover.entry.js +2 -2
  59. package/dist/esm/ez-search.entry.js +2 -2
  60. package/dist/esm/ez-text-area.entry.js +11 -11
  61. package/dist/esm/ez-text-input.entry.js +22 -15
  62. package/dist/esm/ez-time-input.entry.js +37 -31
  63. package/dist/esm/ez-upload.entry.js +5 -5
  64. package/dist/esm/ez-view-stack.entry.js +67 -0
  65. package/dist/esm/ezui.js +1 -1
  66. package/dist/esm/loader.js +1 -1
  67. package/dist/esm/test-du.entry.js +43 -10
  68. package/dist/ezui/ezui.esm.js +1 -1
  69. package/dist/ezui/p-248361f5.entry.js +1 -0
  70. package/dist/ezui/p-30e3793f.entry.js +1 -0
  71. package/dist/ezui/p-4c3cd534.entry.js +1 -0
  72. package/dist/ezui/p-517d7759.entry.js +1 -0
  73. package/dist/ezui/{p-5f2add6f.entry.js → p-51cdfa9e.entry.js} +1 -1
  74. package/dist/ezui/p-659df655.entry.js +1 -0
  75. package/dist/ezui/p-6d4b1628.entry.js +1 -0
  76. package/dist/ezui/p-8be1a4d6.entry.js +1 -0
  77. package/dist/ezui/p-b65e22a1.entry.js +1 -0
  78. package/dist/ezui/p-b8d64970.entry.js +1 -0
  79. package/dist/ezui/{p-c6c91589.entry.js → p-c246e251.entry.js} +1 -1
  80. package/dist/ezui/p-c2de757f.entry.js +1 -0
  81. package/dist/ezui/p-c620258b.entry.js +1 -0
  82. package/dist/ezui/p-cabe3671.entry.js +1 -0
  83. package/dist/ezui/p-cb73bee7.entry.js +1 -0
  84. package/dist/ezui/p-db0981c1.entry.js +1 -0
  85. package/dist/ezui/p-dd6f4872.entry.js +1 -0
  86. package/dist/ezui/p-ec8419f1.entry.js +1 -0
  87. package/dist/ezui/p-fc9b9487.entry.js +1 -0
  88. package/dist/types/components/ez-calendar/ez-calendar.d.ts +1 -1
  89. package/dist/types/components/ez-check/ez-check.d.ts +1 -1
  90. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -1
  91. package/dist/types/components/ez-date-input/ez-date-input.d.ts +3 -3
  92. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +3 -3
  93. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +3 -3
  94. package/dist/types/components/ez-form/ez-form.d.ts +1 -1
  95. package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +3 -0
  96. package/dist/types/components/ez-grid/ez-grid.d.ts +1 -1
  97. package/dist/types/components/ez-modal/ez-modal.d.ts +1 -1
  98. package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -3
  99. package/dist/types/components/ez-popover/ez-popover.d.ts +1 -1
  100. package/dist/types/components/ez-search/ez-search.d.ts +1 -1
  101. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -4
  102. package/dist/types/components/ez-text-input/ez-text-input.d.ts +8 -4
  103. package/dist/types/components/ez-time-input/ez-time-input.d.ts +9 -3
  104. package/dist/types/components/ez-upload/ez-upload.d.ts +2 -2
  105. package/dist/types/components/ez-view-stack/ez-view-stack.d.ts +16 -0
  106. package/dist/types/components/test-du/test-du.d.ts +1 -0
  107. package/dist/types/components.d.ts +29 -0
  108. package/package.json +1 -1
  109. package/react/components.d.ts +1 -0
  110. package/react/components.js +1 -0
  111. package/react/components.js.map +1 -1
  112. package/dist/ezui/p-097d5dc6.entry.js +0 -1
  113. package/dist/ezui/p-0fd2624d.entry.js +0 -1
  114. package/dist/ezui/p-1587cbbc.entry.js +0 -1
  115. package/dist/ezui/p-18d67107.entry.js +0 -1
  116. package/dist/ezui/p-49f70be3.entry.js +0 -1
  117. package/dist/ezui/p-50038ae3.entry.js +0 -1
  118. package/dist/ezui/p-53110643.entry.js +0 -1
  119. package/dist/ezui/p-67d30ea7.entry.js +0 -1
  120. package/dist/ezui/p-685a35b3.entry.js +0 -1
  121. package/dist/ezui/p-699c31d1.entry.js +0 -1
  122. package/dist/ezui/p-6c22c9f9.entry.js +0 -1
  123. package/dist/ezui/p-a1304302.entry.js +0 -1
  124. package/dist/ezui/p-b2cc27e5.entry.js +0 -1
  125. package/dist/ezui/p-b71d454d.entry.js +0 -1
  126. package/dist/ezui/p-dcf5f013.entry.js +0 -1
  127. package/dist/ezui/p-e472517c.entry.js +0 -1
@@ -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-139ed2f6.js";import{UserInterface as s,Action as a,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:"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}));function f(t,i,n,r=!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:r?"switch":"regular","data-field-name":t,key:t}))}function b(t,i,n,r,o){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:r,prettyPrecision:o,"data-field-name":t,key:t}))}const p=new Map;p.set(s.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})))),p.set(s.CHECKBOX,(e=>f(e.name,e.label,e.readOnly,!1))),p.set(s.SWITCH,(e=>f(e.name,e.label,e.readOnly,!0))),p.set(s.OPTIONSELECTOR,(({name:t,label:i,readOnly:n,required:r},o)=>{const s=null==o?void 0:o.options;let a;if("string"==typeof s){const e=JSON.parse(s);a=Object.keys(e).map((t=>({value:t,label:e[t]})))}else a=s;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:r,label:i,"data-field-name":t,key:t,options:a}))})),p.set(s.SEARCH,(({name:t,label:i,readOnly:n,required:r})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-search",{enabled:!n,suppressEmptyOption:r,label:i,"data-field-name":t,key:t})))),p.set(s.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})))),p.set(s.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})))),p.set(s.TIME,(({name:t,label:i})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-time-input",{label:i,"data-field-name":t,key:t})))),p.set(s.DATETIME,(({name:t,label:i})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-time-input",{label:i,"data-field-name":t,key:t})))),p.set(s.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(s.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)},z=({source:t})=>"items"in t?e("ez-collapsible-box",{label:t.label,"header-size":"large"},t.items.map((e=>m(e)))):m(t),v=({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(z,{store:t,source:i})))));class y{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 g(e,t){return"Geral"==e[0].label?-1:(e[0].order||1e4)-(t[0].order||1e4)}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 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(_(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(C)(e,t)}if("function"!=typeof e)throw new Error(_(2));var r=e,o=t,s=[],a=s,l=!1;function c(){a===s&&(a=s.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(),a.push(e),function(){if(t){if(l)throw new Error(_(6));t=!1,c();var i=a.indexOf(e);a.splice(i,1),s=null}}}function h(e){if(!A(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=s=a,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 x={};function R(e=x,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 j(e){return e.formMetadata}var N;!function(e){e.METADATA_LOADED="FORM/METADATA_LOADED",e.CHANGE_TAB="FORM/CHANGE_TAB"}(N||(N={}));class k{constructor(e){this.onDataUnitEvent=e=>{var t;switch(e.type){case a.DATA_LOADED:case a.DATA_SAVED:case a.RECORDS_REMOVED:case a.RECORDS_ADDED:case a.RECORDS_COPIED:case a.DATA_CHANGED:case a.EDITION_CANCELED:case a.CHANGE_UNDONE:case a.CHANGE_REDONE:case a.SELECTION_CHANGED:case a.NEXT_SELECTED:case a.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&&(void 0===n?t.removeAttribute("value"):t.value=n)}updateBind(e,t){const i=this._fields.get(e);i&&i.destroy();const n=this._dataUnit.getFieldValue(e);void 0===n?t.removeAttribute("value"):t.value=n,this._fields.set(e,D.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 D{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 D;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===a.METADATA_LOADED&&this.processMetadata()}}submit(){return Promise.resolve()}cancel(){return Promise.resolve()}validate(){return new Promise(((e,t)=>{const i=j(this._store.getState()),n=this._staticFields.filter((e=>e.dataset.required)).map((e=>e.dataset.fieldName)).concat(i.getRequiredFields()),r=this.dataUnit.getModifiedRecords();for(let e=0;e<r.length;e++)if(!this.validateRequired(n,r[e])){t();break}e()}))}observeConfig(){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=j(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()),s=[];return o.length>1&&s.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}))))),s.push(e(v,{store:this._store,source:n})),s}processMetadata(){if(!this.isStatic()){const e=this.config&&this.config.length>0?((e,t)=>{const i=new Map,n=[],r=[],o={};e.forEach((e=>{var s,a;if(!1!==e.visible){const l=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),c=t.getField(e.name);if(c&&l.visible){i.has(l)||i.set(l,new Map);const t=i.get(l);(void 0===e.required?c.required:e.required)&&n.push(e.name),(void 0===e.cleanOnCopy?null===(s=c.properties)||void 0===s?void 0:s.cleanOnCopy:e.cleanOnCopy)&&r.push(e.name),(void 0===e.defaultValue?null===(a=c.properties)||void 0===a?void 0:a.defaultValue:e.defaultValue)&&(o[e.name]=e.defaultValue);const d={config:e,descriptor:c},u=e.group;if(u){const e=`group::${u}`;t.has(e)?t.get(e).items.push(d):t.set(e,{label:u,items:[d]})}else t.set(e.name,d)}}}));const s=new y;return Array.from(i.entries()).sort(g).forEach((([e,t])=>{s.addSheet({label:e.label,name:e.label,items:Array.from(t.values()),requiredFields:n,cleanOnCopyFields:r,defaultValues:o})})),s})(this.config,this.dataUnit):(()=>{var e;const t=this.dataUnit.metadata,i=new y;if(t){const n=null===(e=t.fields)||void 0===e?void 0:e.filter((e=>!1!==e.visible));let r={};n.filter((e=>e.defaultValue)).map((e=>r[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;return null===(t=e.properties)||void 0===t?void 0:t.cleanOnCopy})).map((e=>e.name)),defaultValues:r})}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===a.RECORDS_COPIED){const t=j(this._store.getState()).getCleanOnCopyFields();if(t)return new c(a.RECORDS_COPIED,e.payload.map((e=>{const i=Object.assign({},e);return t.forEach((e=>delete i[e])),i})))}if(e.type===a.RECORDS_ADDED){const t=j(this._store.getState()).getDefaultValues();if(t)return new c(a.RECORDS_ADDED,e.payload.map((e=>{const i=Object.assign({},e);for(const e in t)i[e]=this.dataUnit.valueFromString(e,t[e]);return 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:["observeConfig"]}}};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}
@@ -0,0 +1 @@
1
+ import{r as e,h as a}from"./p-139ed2f6.js";import{ApplicationContext as t,DataUnit as r,DataType as s,UserInterface as i}from"@sankhyalabs/core";import{A as o}from"./p-0cd386db.js";let n=class{constructor(a){e(this,a)}componentWillLoad(){t.setContextValue("__EZUI__UPLOAD__ADD__URL__","http://localhost:8080/mge/ez.uploading"),this.dataUnit=new r("testes_com_formulario"),this.dataUnit.subscribe((()=>this.isDirty=this.dataUnit.isDirty())),this.dataUnit.metadata={name:"dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",label:"Parceiro",fields:[{name:"CODPARC",label:"Parceiro",dataType:s.NUMBER,userInterface:i.INTEGERNUMBER,defaultValue:666,required:!1,properties:{}},{name:"RECDESP",label:"Receita/Despesa",dataType:s.TEXT,userInterface:i.OPTIONSELECTOR,required:!0,properties:{options:'{"-1": "Despesa", "1": "Receita"}'}},{name:"P",label:"pera",dataType:s.TEXT,userInterface:i.OPTIONSELECTOR,properties:{options:'{"M": "Madura", "V": "Verde", "P": "Passada"}'}}]},this.formConfig=[{name:"CODPARC",label:"Parceiro",dataType:s.NUMBER,userInterface:i.INTEGERNUMBER,defaultValue:666,required:!1,properties:{}},{name:"RECDESP",label:"Receita/Despesa",dataType:s.TEXT,userInterface:i.OPTIONSELECTOR,required:!0,properties:{options:'{"-1": "Despesa", "1": "Receita"}'}}],this.dataUnit.dataLoader=()=>new Promise((e=>e({records:[{__record__id__:"1321321321321321",CODPARC:10,NOMEPARC:"Parceiro 10",P:"M",L:"Bagaço",LI:"Azedo"}],limit:0,offset:2,total:100,hasMore:!0}))),this.dataUnit.saveLoader=(e,a)=>{const t=[];return a.forEach((e=>{t.push(Object.assign(Object.assign({},e.record),e.updatingFields))})),Promise.resolve(t)}}save(){this.dataUnit.saveData().catch((e=>{"WAITING_CHANGE_ERROR"===e.kind&&o.alert(`Alterando campo ${e.fieldName}`,e.message)}))}render(){return a("div",null,a("button",{onClick:()=>this.dataUnit.addRecord()},"Novo"),a("button",{onClick:()=>this.dataUnit.loadData()},"Carregar"),a("button",{onClick:()=>this.save(),disabled:!this.isDirty},"Salvar"),a("ez-form",{dataUnit:this.dataUnit,config:this.formConfig}))}};n.style=":host{display:block}";export{n as test_du}
@@ -0,0 +1 @@
1
+ import{r as i,h as t,g as e,H as s}from"./p-139ed2f6.js";let h=class{constructor(t){i(this,t)}async show(i){i!==this._focusedIndex&&0<=i&&i<this._totalStackItems&&(this.policyHideRemove(),this.policyShowAppend(i),this._focusedIndex=i)}policyHideRemove(){let i=this._hostElem.querySelector(`#el_${this._focusedIndex}`);this.checkElementVisibility(i)}policyShowAppend(i){let t=this._hostElem.querySelector(`#el_${i}`);t?t.removeAttribute("style"):this._hostElem.append(this._elemList[i])}checkElementVisibility(i){"hide"!==i.getAttribute("hidePolicy")&&i.getAttribute("hidePolicy")?"remove"===i.getAttribute("hidePolicy")&&i.remove():i.setAttribute("style","display: none")}componentWillRender(){this._elemList||(this._elemList=[],this._focusedIndex=0,this._totalStackItems=0,this._hostElem.classList.add("ez-view-stack__container"),this._hostElem.querySelectorAll("stack-item").forEach(((i,t)=>{i.setAttribute("id",`el_${t}`),0!==t&&this.checkElementVisibility(i),this._totalStackItems++,this._elemList.push(i)})))}disconectCallback(){this._hostElem=null,this._elemList=null}render(){return t(s,null)}get _hostElem(){return e(this)}};h.style=":host{width:100%;height:100%}.ez-view-stack__container{width:100%;height:100%}";export{h as ez_view_stack}