@sankhyalabs/ezui 5.22.0-dev.41 → 5.22.0-dev.42

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 (161) hide show
  1. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
  2. package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-alert.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-badge.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-card-item_3.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-chip.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-combo-box.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +2 -2
  16. package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
  17. package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
  18. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-dropdown_2.cjs.entry.js +1 -1
  20. package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
  21. package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-form.cjs.entry.js +1 -1
  23. package/dist/cjs/ez-grid.cjs.entry.js +19 -8
  24. package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
  25. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  26. package/dist/cjs/ez-list.cjs.entry.js +1 -1
  27. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  28. package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
  29. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  30. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
  31. package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
  32. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  33. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  34. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  35. package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
  36. package/dist/cjs/ez-search.cjs.entry.js +1 -1
  37. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
  38. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  39. package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
  40. package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
  41. package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
  42. package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
  43. package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
  44. package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
  45. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  46. package/dist/cjs/ez-tree.cjs.entry.js +1 -1
  47. package/dist/cjs/ez-upload.cjs.entry.js +1 -1
  48. package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
  49. package/dist/cjs/ezui.cjs.js +1 -1
  50. package/dist/cjs/filter-column.cjs.entry.js +1 -1
  51. package/dist/cjs/{index-9e5554cb.js → index-a7b0c73d.js} +0 -3
  52. package/dist/cjs/loader.cjs.js +1 -1
  53. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +16 -2
  54. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +2 -5
  55. package/dist/custom-elements/index.js +18 -7
  56. package/dist/esm/ez-actions-button.entry.js +1 -1
  57. package/dist/esm/ez-alert-list.entry.js +1 -1
  58. package/dist/esm/ez-alert.entry.js +1 -1
  59. package/dist/esm/ez-application.entry.js +1 -1
  60. package/dist/esm/ez-badge.entry.js +1 -1
  61. package/dist/esm/ez-breadcrumb.entry.js +1 -1
  62. package/dist/esm/ez-button.entry.js +1 -1
  63. package/dist/esm/ez-calendar.entry.js +1 -1
  64. package/dist/esm/ez-card-item_3.entry.js +1 -1
  65. package/dist/esm/ez-chart.entry.js +1 -1
  66. package/dist/esm/ez-check.entry.js +1 -1
  67. package/dist/esm/ez-chip.entry.js +1 -1
  68. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  69. package/dist/esm/ez-combo-box.entry.js +1 -1
  70. package/dist/esm/ez-custom-form-input_2.entry.js +2 -2
  71. package/dist/esm/ez-date-input.entry.js +1 -1
  72. package/dist/esm/ez-date-time-input.entry.js +1 -1
  73. package/dist/esm/ez-dialog.entry.js +1 -1
  74. package/dist/esm/ez-dropdown_2.entry.js +1 -1
  75. package/dist/esm/ez-file-item.entry.js +1 -1
  76. package/dist/esm/ez-form-view.entry.js +1 -1
  77. package/dist/esm/ez-form.entry.js +1 -1
  78. package/dist/esm/ez-grid.entry.js +19 -8
  79. package/dist/esm/ez-guide-navigator.entry.js +1 -1
  80. package/dist/esm/ez-icon.entry.js +1 -1
  81. package/dist/esm/ez-list.entry.js +1 -1
  82. package/dist/esm/ez-loading-bar.entry.js +1 -1
  83. package/dist/esm/ez-modal-container.entry.js +1 -1
  84. package/dist/esm/ez-modal.entry.js +1 -1
  85. package/dist/esm/ez-multi-selection-list.entry.js +1 -1
  86. package/dist/esm/ez-number-input.entry.js +1 -1
  87. package/dist/esm/ez-popover.entry.js +1 -1
  88. package/dist/esm/ez-popup.entry.js +1 -1
  89. package/dist/esm/ez-radio-button.entry.js +1 -1
  90. package/dist/esm/ez-scroller_2.entry.js +1 -1
  91. package/dist/esm/ez-search.entry.js +1 -1
  92. package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
  93. package/dist/esm/ez-split-button.entry.js +1 -1
  94. package/dist/esm/ez-split-item.entry.js +1 -1
  95. package/dist/esm/ez-split-panel.entry.js +1 -1
  96. package/dist/esm/ez-tabselector.entry.js +1 -1
  97. package/dist/esm/ez-text-area.entry.js +1 -1
  98. package/dist/esm/ez-text-input.entry.js +1 -1
  99. package/dist/esm/ez-time-input.entry.js +1 -1
  100. package/dist/esm/ez-toast.entry.js +1 -1
  101. package/dist/esm/ez-tree.entry.js +1 -1
  102. package/dist/esm/ez-upload.entry.js +1 -1
  103. package/dist/esm/ez-view-stack.entry.js +1 -1
  104. package/dist/esm/ezui.js +2 -2
  105. package/dist/esm/filter-column.entry.js +1 -1
  106. package/dist/esm/{index-5a720e56.js → index-baa5e267.js} +1 -3
  107. package/dist/esm/loader.js +2 -2
  108. package/dist/ezui/ezui.esm.js +1 -1
  109. package/dist/ezui/{p-e6b38ade.entry.js → p-0306dff7.entry.js} +1 -1
  110. package/dist/ezui/{p-91ccae0c.entry.js → p-09de35a2.entry.js} +1 -1
  111. package/dist/ezui/{p-3d38bfea.entry.js → p-0a75bb05.entry.js} +1 -1
  112. package/dist/ezui/{p-3cc9b84a.entry.js → p-0db68715.entry.js} +1 -1
  113. package/dist/ezui/p-10820c20.entry.js +1 -0
  114. package/dist/ezui/{p-11b09aa1.entry.js → p-1285c902.entry.js} +1 -1
  115. package/dist/ezui/{p-b2f6bc0a.entry.js → p-17be134a.entry.js} +1 -1
  116. package/dist/ezui/{p-bfc59380.entry.js → p-19098a3f.entry.js} +1 -1
  117. package/dist/ezui/{p-81461d2f.entry.js → p-1e7a8633.entry.js} +1 -1
  118. package/dist/ezui/{p-6b51c9cc.entry.js → p-1f50fa05.entry.js} +1 -1
  119. package/dist/ezui/{p-6bc25bc8.entry.js → p-1f830a2f.entry.js} +1 -1
  120. package/dist/ezui/{p-e4c7eb39.js → p-23a36bb6.js} +2 -2
  121. package/dist/ezui/{p-a4ee2991.entry.js → p-2aa8e4b2.entry.js} +1 -1
  122. package/dist/ezui/{p-802dc63e.entry.js → p-3dd919b7.entry.js} +1 -1
  123. package/dist/ezui/{p-0378416a.entry.js → p-44caad9a.entry.js} +1 -1
  124. package/dist/ezui/{p-7567ccdd.entry.js → p-555c9018.entry.js} +1 -1
  125. package/dist/ezui/{p-6fc26622.entry.js → p-5ed81457.entry.js} +1 -1
  126. package/dist/ezui/{p-f1c2c19e.entry.js → p-650e4b6d.entry.js} +1 -1
  127. package/dist/ezui/{p-554522db.entry.js → p-6d79930d.entry.js} +1 -1
  128. package/dist/ezui/{p-fc194825.entry.js → p-6e429cff.entry.js} +1 -1
  129. package/dist/ezui/{p-11bfeca3.entry.js → p-77a4bd35.entry.js} +1 -1
  130. package/dist/ezui/{p-3f8c33e0.entry.js → p-7bc07c31.entry.js} +1 -1
  131. package/dist/ezui/{p-e18d9e6a.entry.js → p-7fdd479f.entry.js} +1 -1
  132. package/dist/ezui/{p-1b08bf3c.entry.js → p-8888d9ed.entry.js} +1 -1
  133. package/dist/ezui/{p-82fa4b09.entry.js → p-8df1ca33.entry.js} +1 -1
  134. package/dist/ezui/{p-e7395eae.entry.js → p-90bcd2ba.entry.js} +1 -1
  135. package/dist/ezui/{p-57528846.entry.js → p-91266ddd.entry.js} +1 -1
  136. package/dist/ezui/{p-be34c77f.entry.js → p-97af4b13.entry.js} +1 -1
  137. package/dist/ezui/{p-880f73ea.entry.js → p-98dc7ce3.entry.js} +2 -2
  138. package/dist/ezui/{p-a921e3e7.entry.js → p-990b4318.entry.js} +1 -1
  139. package/dist/ezui/{p-076e868b.entry.js → p-9ceefe4d.entry.js} +1 -1
  140. package/dist/ezui/{p-e3ec7422.entry.js → p-9d9ecb7c.entry.js} +1 -1
  141. package/dist/ezui/{p-c2b20f78.entry.js → p-9f5fa3f9.entry.js} +1 -1
  142. package/dist/ezui/{p-3b546374.entry.js → p-a2e5b8c3.entry.js} +1 -1
  143. package/dist/ezui/{p-d960a031.entry.js → p-a5b91a77.entry.js} +1 -1
  144. package/dist/ezui/{p-dfca5946.entry.js → p-a80b1287.entry.js} +1 -1
  145. package/dist/ezui/{p-2de9f0aa.entry.js → p-abce5219.entry.js} +1 -1
  146. package/dist/ezui/{p-0e1cc2d1.entry.js → p-b54e17d2.entry.js} +1 -1
  147. package/dist/ezui/{p-30951bd7.entry.js → p-baf80b13.entry.js} +1 -1
  148. package/dist/ezui/p-bc2f844e.entry.js +1 -0
  149. package/dist/ezui/{p-868b56f7.entry.js → p-bcb53f27.entry.js} +1 -1
  150. package/dist/ezui/{p-7f5afb1f.entry.js → p-bfad39eb.entry.js} +1 -1
  151. package/dist/ezui/{p-92748142.entry.js → p-c0d9c4f8.entry.js} +1 -1
  152. package/dist/ezui/{p-b858fc6e.entry.js → p-c3045972.entry.js} +1 -1
  153. package/dist/ezui/{p-a563df31.entry.js → p-c4320a39.entry.js} +1 -1
  154. package/dist/ezui/{p-8f026744.entry.js → p-cd2e78f0.entry.js} +1 -1
  155. package/dist/ezui/{p-16e21a40.entry.js → p-d0ca26fe.entry.js} +1 -1
  156. package/dist/ezui/{p-bef7daac.entry.js → p-e347df9c.entry.js} +1 -1
  157. package/dist/ezui/{p-70f1c812.entry.js → p-f9e551de.entry.js} +1 -1
  158. package/dist/ezui/{p-bfc30e61.entry.js → p-ffd246f5.entry.js} +1 -1
  159. package/package.json +1 -1
  160. package/dist/ezui/p-6ec40dec.entry.js +0 -1
  161. package/dist/ezui/p-940760bf.entry.js +0 -1
@@ -1 +1 @@
1
- import{r as t,c as e,h as i,f as n,H as r,g as s}from"./p-e4c7eb39.js";import{DateUtils as o,Action as l,StringUtils as a,DataUnit as h,ElementIDUtils as c}from"@sankhyalabs/core";import{b as u,D as d}from"./p-455e737c.js";import"./p-2187f86c.js";import"./p-ab574d59.js";const f=/child\[([^\]]+)\]/,p=/\$\{.+\}/;class v{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const e=f.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=p.exec(i);t&&(i=this.getDefaultVar(t[0]))}t[e]=i})),t}getDefaultVar(t){return"${data}"===t?o.getToday():"${datahora}"===t?o.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const m=(t,e)=>"__main"==t[0].label?-1:(t[0].order||1e4)-(e[0].order||1e4);function b(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 y="function"==typeof Symbol&&Symbol.observable||"@@observable",w=function(){return Math.random().toString(36).substring(7).split("").join(".")},g={INIT:"@@redux/INIT"+w(),REPLACE:"@@redux/REPLACE"+w(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+w()}};function E(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 O(t,e,i){var n;if("function"==typeof e&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(b(0));if("function"==typeof e&&void 0===i&&(i=e,e=void 0),void 0!==i){if("function"!=typeof i)throw new Error(b(1));return i(O)(t,e)}if("function"!=typeof t)throw new Error(b(2));var r=t,s=e,o=[],l=o,a=!1;function h(){l===o&&(l=o.slice())}function c(){if(a)throw new Error(b(3));return s}function u(t){if("function"!=typeof t)throw new Error(b(4));if(a)throw new Error(b(5));var e=!0;return h(),l.push(t),function(){if(e){if(a)throw new Error(b(6));e=!1,h();var i=l.indexOf(t);l.splice(i,1),o=null}}}function d(t){if(!E(t))throw new Error(b(7));if(void 0===t.type)throw new Error(b(8));if(a)throw new Error(b(9));try{a=!0,s=r(s,t)}finally{a=!1}for(var e=o=l,i=0;i<e.length;i++)(0,e[i])();return t}function f(t){if("function"!=typeof t)throw new Error(b(10));r=t,d({type:g.REPLACE})}function p(){var t,e=u;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(b(11));function i(){t.next&&t.next(c())}return i(),{unsubscribe:e(i)}}})[y]=function(){return this},t}return d({type:g.INIT}),(n={dispatch:d,subscribe:u,getState:c,replaceReducer:f})[y]=p,n}const C={};function j(t=C,e){switch(e.type){case F.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:e.payload,currentSheet:void 0});case F.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:e.payload});default:return t}}function _(t){return t.formMetadata}function A(t){const e=function(t){return t.currentSheet}(t);return e?t.formMetadata.getSheet(e):Array.from(t.formMetadata.getAllSheets().values())[0]}var F;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(F||(F={}));const z=class{constructor(i){t(this,i),this.ezFormRequestClearFieldToFocus=e(this,"ezFormRequestClearFieldToFocus",7),this.ezFormSetFields=e(this,"ezFormSetFields",7),this.ezReady=e(this,"ezReady",7),this.formItemsReady=e(this,"formItemsReady",7),this._customEditors=new Map,this.onDataUnitAction=t=>{t.type===l.METADATA_LOADED&&this.processMetadata()},this._fieldsProps=new Map,this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0,this.fieldToFocus=void 0,this.onlyStaticFields=!1}validate(){return this._dataBinder.validate()}async addCustomEditor(t,e,i){if(this._formView)return void this._formView.addCustomEditor(t,e,i);const n=new Map(this._customEditors);n.set(t,{customEditor:e,detailContext:i}),this._customEditors=n}observeConfig(){this.processMetadata()}async setFieldProp(t,e,i){const n=new Map(this._fieldsProps),r=this._fieldsProps.get(t);n.set(t,Object.assign(Object.assign({},r),{[e]:i})),this._fieldsProps=n}getDynamicContent(){var t;const e=_(this._store.getState());if(!e)return null;const n=Array.from(e.getAllSheets().values()),r=A(null===(t=this._store)||void 0===t?void 0:t.getState());let s=[];if(n.length>1){const t=n.map(((t,e)=>({tabKey:t.name,label:t.label,index:e}))),e="selector";s.push(i("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:F.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:r.name,"data-element-id":e}))}return s=s.concat(this.buildFormContent(r)),s}buildFormContent(t){const e=null==t?void 0:t.fields;if(null==t)return;this.ezFormSetFields.emit(e);const n=`${a.replaceAccentuatedChars(a.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return i("div",{class:"dynamic-content","data-element-id":n},i("ez-form-view",{ref:t=>this._formView=t,class:"ez-row ez-padding-vertical--small",fields:e,selectedRecord:this.dataUnit.getSelectedRecord()}))}processMetadata(){if(this.bindFields()&&this.dataUnit&&this._store){const t=((t,e,i=!1)=>{var n,r;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 s=new Map,o=new Map,l=[],a=[],h={};null===(n=null==t?void 0:t.tabs)||void 0===n||n.forEach((t=>{o.has(t.label)||!1!==t.visible||o.set(t.label,t)})),null===(r=null==t?void 0:t.fields)||void 0===r||r.forEach((t=>{var i,n,r;if(!1!==t.visible){const c=((t,e)=>("string"==typeof t?Array.from(e.keys()).find((e=>e.label===t)):t)||{label:t,visible:!0})(t.tab||"__main",s);if(o.has(c.label))return;const d=e.getField(t.name);if(d&&c.visible){s.has(c)||s.set(c,[]);const e=u(d,t);s.get(c).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))&&a.push(t.name);let o=null==t.defaultValue?null===(r=d.properties)||void 0===r?void 0:r.defaultValue:t.defaultValue;if(o&&null!=o.value){const{type:e,value:i}=o;if(e)if("V"===e)o=i;else try{const t=JSON.parse(i);o=t&&"value"in t?t:i}catch(t){}h[t.name]=o}}}}));const c=new v;if(c.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);s.set({name:i,label:e},n)}))}return Array.from(s.entries()).sort(m).forEach((([t,e])=>{c.addSheet({label:"__main"===t.label?"Principal":t.label,name:t.name||t.label,fields:e})})),c.addRequiredFields(l),c.addCleanOnCopyFields(a),c.addDefaultValues(h),c})(this.config,this.dataUnit);this._store.dispatch({type:F.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}bindFields(){return!this.isStatic()||!1===this.onlyStaticFields}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new h("ez-form")),this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new d(this.dataUnit),this._store=O(j),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),c.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}componentDidRender(){const t=_(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(),this.handleFieldToFocus(),this.setCustomEditors(),this.setFieldsProps()}setCustomEditors(){if(this._formView)for(const[t,e]of this._customEditors)this._formView.addCustomEditor(t,e.customEditor,e.detailContext),this._customEditors.delete(t)}handleFieldToFocus(){var t;if(null==this.fieldToFocus)return;const e=A(null===(t=this._store)||void 0===t?void 0:t.getState());(null==e?void 0:e.fields).some((t=>t.name===this.fieldToFocus))&&requestAnimationFrame((()=>{this._dataBinder.setFocus(this.fieldToFocus),this.ezFormRequestClearFieldToFocus.emit()}))}setFieldsProps(){if(this._formView)for(const[t,e]of this._fieldsProps){for(const i in e)this._formView.setFieldProp(t,i,e[i]);this._fieldsProps.delete(t)}}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback()}buildIdTabSelector(t){return t&&t.forEach((t=>t[c.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=a.toCamelCase(t.label))),t}render(){return i(r,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return s(this)}static get watchers(){return{config:["observeConfig"]}}};z.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{z as ez_form}
1
+ import{r as t,c as e,h as i,f as n,H as r,g as s}from"./p-23a36bb6.js";import{DateUtils as o,Action as l,StringUtils as a,DataUnit as h,ElementIDUtils as u}from"@sankhyalabs/core";import{b as c,D as d}from"./p-455e737c.js";import"./p-2187f86c.js";import"./p-ab574d59.js";const f=/child\[([^\]]+)\]/,p=/\$\{.+\}/;class v{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const e=f.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=p.exec(i);t&&(i=this.getDefaultVar(t[0]))}t[e]=i})),t}getDefaultVar(t){return"${data}"===t?o.getToday():"${datahora}"===t?o.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const m=(t,e)=>"__main"==t[0].label?-1:(t[0].order||1e4)-(e[0].order||1e4);function b(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 y="function"==typeof Symbol&&Symbol.observable||"@@observable",w=function(){return Math.random().toString(36).substring(7).split("").join(".")},g={INIT:"@@redux/INIT"+w(),REPLACE:"@@redux/REPLACE"+w(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+w()}};function E(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 O(t,e,i){var n;if("function"==typeof e&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(b(0));if("function"==typeof e&&void 0===i&&(i=e,e=void 0),void 0!==i){if("function"!=typeof i)throw new Error(b(1));return i(O)(t,e)}if("function"!=typeof t)throw new Error(b(2));var r=t,s=e,o=[],l=o,a=!1;function h(){l===o&&(l=o.slice())}function u(){if(a)throw new Error(b(3));return s}function c(t){if("function"!=typeof t)throw new Error(b(4));if(a)throw new Error(b(5));var e=!0;return h(),l.push(t),function(){if(e){if(a)throw new Error(b(6));e=!1,h();var i=l.indexOf(t);l.splice(i,1),o=null}}}function d(t){if(!E(t))throw new Error(b(7));if(void 0===t.type)throw new Error(b(8));if(a)throw new Error(b(9));try{a=!0,s=r(s,t)}finally{a=!1}for(var e=o=l,i=0;i<e.length;i++)(0,e[i])();return t}function f(t){if("function"!=typeof t)throw new Error(b(10));r=t,d({type:g.REPLACE})}function p(){var t,e=c;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(b(11));function i(){t.next&&t.next(u())}return i(),{unsubscribe:e(i)}}})[y]=function(){return this},t}return d({type:g.INIT}),(n={dispatch:d,subscribe:c,getState:u,replaceReducer:f})[y]=p,n}const C={};function j(t=C,e){switch(e.type){case F.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:e.payload,currentSheet:void 0});case F.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:e.payload});default:return t}}function _(t){return t.formMetadata}function A(t){const e=function(t){return t.currentSheet}(t);return e?t.formMetadata.getSheet(e):Array.from(t.formMetadata.getAllSheets().values())[0]}var F;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(F||(F={}));const z=class{constructor(i){t(this,i),this.ezFormRequestClearFieldToFocus=e(this,"ezFormRequestClearFieldToFocus",7),this.ezFormSetFields=e(this,"ezFormSetFields",7),this.ezReady=e(this,"ezReady",7),this.formItemsReady=e(this,"formItemsReady",7),this._customEditors=new Map,this.onDataUnitAction=t=>{t.type===l.METADATA_LOADED&&this.processMetadata()},this._fieldsProps=new Map,this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0,this.fieldToFocus=void 0,this.onlyStaticFields=!1}validate(){return this._dataBinder.validate()}async addCustomEditor(t,e,i){if(this._formView)return void this._formView.addCustomEditor(t,e,i);const n=new Map(this._customEditors);n.set(t,{customEditor:e,detailContext:i}),this._customEditors=n}observeConfig(){this.processMetadata()}async setFieldProp(t,e,i){const n=new Map(this._fieldsProps),r=this._fieldsProps.get(t);n.set(t,Object.assign(Object.assign({},r),{[e]:i})),this._fieldsProps=n}getDynamicContent(){var t;const e=_(this._store.getState());if(!e)return null;const n=Array.from(e.getAllSheets().values()),r=A(null===(t=this._store)||void 0===t?void 0:t.getState());let s=[];if(n.length>1){const t=n.map(((t,e)=>({tabKey:t.name,label:t.label,index:e}))),e="selector";s.push(i("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:F.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:r.name,"data-element-id":e}))}return s=s.concat(this.buildFormContent(r)),s}buildFormContent(t){const e=null==t?void 0:t.fields;if(null==t)return;this.ezFormSetFields.emit(e);const n=`${a.replaceAccentuatedChars(a.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return i("div",{class:"dynamic-content","data-element-id":n},i("ez-form-view",{ref:t=>this._formView=t,class:"ez-row ez-padding-vertical--small",fields:e,selectedRecord:this.dataUnit.getSelectedRecord()}))}processMetadata(){if(this.bindFields()&&this.dataUnit&&this._store){const t=((t,e,i=!1)=>{var n,r;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 s=new Map,o=new Map,l=[],a=[],h={};null===(n=null==t?void 0:t.tabs)||void 0===n||n.forEach((t=>{o.has(t.label)||!1!==t.visible||o.set(t.label,t)})),null===(r=null==t?void 0:t.fields)||void 0===r||r.forEach((t=>{var i,n,r;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",s);if(o.has(u.label))return;const d=e.getField(t.name);if(d&&u.visible){s.has(u)||s.set(u,[]);const e=c(d,t);s.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))&&a.push(t.name);let o=null==t.defaultValue?null===(r=d.properties)||void 0===r?void 0:r.defaultValue:t.defaultValue;if(o&&null!=o.value){const{type:e,value:i}=o;if(e)if("V"===e)o=i;else try{const t=JSON.parse(i);o=t&&"value"in t?t:i}catch(t){}h[t.name]=o}}}}));const u=new v;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);s.set({name:i,label:e},n)}))}return Array.from(s.entries()).sort(m).forEach((([t,e])=>{u.addSheet({label:"__main"===t.label?"Principal":t.label,name:t.name||t.label,fields:e})})),u.addRequiredFields(l),u.addCleanOnCopyFields(a),u.addDefaultValues(h),u})(this.config,this.dataUnit);this._store.dispatch({type:F.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}bindFields(){return!this.isStatic()||!1===this.onlyStaticFields}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new h("ez-form")),this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new d(this.dataUnit),this._store=O(j),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),u.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}componentDidRender(){const t=_(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(),this.handleFieldToFocus(),this.setCustomEditors(),this.setFieldsProps()}setCustomEditors(){if(this._formView)for(const[t,e]of this._customEditors)this._formView.addCustomEditor(t,e.customEditor,e.detailContext),this._customEditors.delete(t)}handleFieldToFocus(){var t;if(null==this.fieldToFocus)return;const e=A(null===(t=this._store)||void 0===t?void 0:t.getState());(null==e?void 0:e.fields).some((t=>t.name===this.fieldToFocus))&&requestAnimationFrame((()=>{this._dataBinder.setFocus(this.fieldToFocus),this.ezFormRequestClearFieldToFocus.emit()}))}setFieldsProps(){if(this._formView)for(const[t,e]of this._fieldsProps){for(const i in e)this._formView.setFieldProp(t,i,e[i]);this._fieldsProps.delete(t)}}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback()}buildIdTabSelector(t){return t&&t.forEach((t=>t[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=a.toCamelCase(t.label))),t}render(){return i(r,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return s(this)}static get watchers(){return{config:["observeConfig"]}}};z.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{z as ez_form}
@@ -1 +1 @@
1
- import{r as t,c as s,h as i,g as e}from"./p-e4c7eb39.js";import{NumberUtils as h,StringUtils as r,ElementIDUtils as n}from"@sankhyalabs/core";import{C as o}from"./p-9e11fc7b.js";const a=class{constructor(i){t(this,i),this.ezChange=s(this,"ezChange",7),this.ezStartChange=s(this,"ezStartChange",7),this.ezCancelWaitingChange=s(this,"ezCancelWaitingChange",7),this._focused=!1,this._changePending=!1,this._valuePromiseCallbacks=[],this._value=void 0,this.label=void 0,this.value=void 0,this.enabled=!0,this.canShowError=!0,this.errorMessage=void 0,this.allowNegative=!0,this.precision=void 0,this.prettyPrecision=void 0,this.mode="regular",this.autoFocus=!1}async setFocus(t){this._textInput.setFocus(t)}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,s){this._textInput&&t!=s&&this.handleNewValue(t,s),this._changePending=!1}observePrecision(){this._textInput&&this.setInputValue()}handleNewValue(t,s){const i=this.validateValue(t),e=this.validateValue(s);if(null===i&&(this._value=""),i===e)return;const h=this.getTextValue(i)||"",r=this.getParsedNumber(h);(this._value||"")===h||void 0===r&&this._focused||(this._value=h,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===i?void 0:i)}validateValue(t){return isNaN(t)||void 0===t?null:t}getTextValue(t){if(null==t)return;let s=this.precision>=0?h.format(t.toString(),Number(this.precision),Number(this.prettyPrecision)):t.toString();return 0===this.precision?r.replaceAll(s,".",""):s}changeValue(t){this.errorMessage="",this.value!=t?this.value=void 0===t?null:t:(this.setInputValue(),this.ezCancelWaitingChange.emit())}setError(t){this.value=null,this.errorMessage=t,this.ezCancelWaitingChange.emit()}handleBlur(){if(this._changePending)try{const t=this.getParsedNumber();if(void 0!==t&&isNaN(t))this.setError("O valor digitado não é um número válido");else try{this.changeValue(t)}catch(t){return void this.setError(t.message)}}finally{for(const t of this._valuePromiseCallbacks)t(this.value);this._valuePromiseCallbacks=[]}}handleInput(){this.getParsedNumber()!==this.value&&(this._focused=!0,this._changePending=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1}))}getParsedNumber(t=this._textInput.value){return(null==t?void 0:t.trim())?h.stringToNumber(t):void 0}setInputValue(){const t=this.getTextValue(this.value)||"";(this._value||"")!==t&&(this._value=t,this._textInput.value=this._value)}componentDidLoad(){o.applyVarsTextInput(this._elem,this._textInput),this.setInputValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}render(){n.addIDInfoIfNotExists(this._elem,"input");let t=this.precision>0?"0123456789,.":"0123456789";return this.allowNegative&&(t+="-"),i("ez-text-input",{class:"number__input","data-element-id":n.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,onBlur:()=>this.handleBlur(),onInput:()=>this.handleInput(),restrict:t,enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,canShowError:this.canShowError,value:this._value})}get _elem(){return e(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"],precision:["observePrecision"],prettyPrecision:["observePrecision"]}}};a.style=":host{display:block;width:100%}.number__input{height:100%}";export{a as ez_number_input}
1
+ import{r as t,c as s,h as i,g as e}from"./p-23a36bb6.js";import{NumberUtils as h,StringUtils as r,ElementIDUtils as n}from"@sankhyalabs/core";import{C as o}from"./p-9e11fc7b.js";const a=class{constructor(i){t(this,i),this.ezChange=s(this,"ezChange",7),this.ezStartChange=s(this,"ezStartChange",7),this.ezCancelWaitingChange=s(this,"ezCancelWaitingChange",7),this._focused=!1,this._changePending=!1,this._valuePromiseCallbacks=[],this._value=void 0,this.label=void 0,this.value=void 0,this.enabled=!0,this.canShowError=!0,this.errorMessage=void 0,this.allowNegative=!0,this.precision=void 0,this.prettyPrecision=void 0,this.mode="regular",this.autoFocus=!1}async setFocus(t){this._textInput.setFocus(t)}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,s){this._textInput&&t!=s&&this.handleNewValue(t,s),this._changePending=!1}observePrecision(){this._textInput&&this.setInputValue()}handleNewValue(t,s){const i=this.validateValue(t),e=this.validateValue(s);if(null===i&&(this._value=""),i===e)return;const h=this.getTextValue(i)||"",r=this.getParsedNumber(h);(this._value||"")===h||void 0===r&&this._focused||(this._value=h,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===i?void 0:i)}validateValue(t){return isNaN(t)||void 0===t?null:t}getTextValue(t){if(null==t)return;let s=this.precision>=0?h.format(t.toString(),Number(this.precision),Number(this.prettyPrecision)):t.toString();return 0===this.precision?r.replaceAll(s,".",""):s}changeValue(t){this.errorMessage="",this.value!=t?this.value=void 0===t?null:t:(this.setInputValue(),this.ezCancelWaitingChange.emit())}setError(t){this.value=null,this.errorMessage=t,this.ezCancelWaitingChange.emit()}handleBlur(){if(this._changePending)try{const t=this.getParsedNumber();if(void 0!==t&&isNaN(t))this.setError("O valor digitado não é um número válido");else try{this.changeValue(t)}catch(t){return void this.setError(t.message)}}finally{for(const t of this._valuePromiseCallbacks)t(this.value);this._valuePromiseCallbacks=[]}}handleInput(){this.getParsedNumber()!==this.value&&(this._focused=!0,this._changePending=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1}))}getParsedNumber(t=this._textInput.value){return(null==t?void 0:t.trim())?h.stringToNumber(t):void 0}setInputValue(){const t=this.getTextValue(this.value)||"";(this._value||"")!==t&&(this._value=t,this._textInput.value=this._value)}componentDidLoad(){o.applyVarsTextInput(this._elem,this._textInput),this.setInputValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}render(){n.addIDInfoIfNotExists(this._elem,"input");let t=this.precision>0?"0123456789,.":"0123456789";return this.allowNegative&&(t+="-"),i("ez-text-input",{class:"number__input","data-element-id":n.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,onBlur:()=>this.handleBlur(),onInput:()=>this.handleInput(),restrict:t,enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,canShowError:this.canShowError,value:this._value})}get _elem(){return e(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"],precision:["observePrecision"],prettyPrecision:["observePrecision"]}}};a.style=":host{display:block;width:100%}.number__input{height:100%}";export{a as ez_number_input}