@sankhyalabs/sankhyablocks 9.1.0-dev.3 → 9.1.0-dev.5

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 (40) hide show
  1. package/dist/cjs/field-config_2.cjs.entry.js +1 -1
  2. package/dist/cjs/fields-layout.cjs.entry.js +1 -1
  3. package/dist/cjs/fields-selector.cjs.entry.js +2 -2
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  6. package/dist/cjs/snk-attach.cjs.entry.js +28 -11
  7. package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -7
  8. package/dist/collection/components/snk-attach/snk-attach.js +45 -11
  9. package/dist/collection/components/snk-form-config/field-item/field-item.css +3 -23
  10. package/dist/collection/components/snk-form-config/fields-layout/fields-layout.css +4 -12
  11. package/dist/collection/components/snk-form-config/fields-selector/fields-selector.css +4 -0
  12. package/dist/collection/components/snk-form-config/fields-selector/fields-selector.js +1 -1
  13. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +8 -8
  14. package/dist/components/field-item2.js +1 -1
  15. package/dist/components/fields-layout2.js +1 -1
  16. package/dist/components/fields-selector2.js +2 -2
  17. package/dist/components/snk-attach2.js +29 -11
  18. package/dist/components/snk-simple-crud2.js +7 -7
  19. package/dist/esm/field-config_2.entry.js +1 -1
  20. package/dist/esm/fields-layout.entry.js +1 -1
  21. package/dist/esm/fields-selector.entry.js +2 -2
  22. package/dist/esm/loader.js +1 -1
  23. package/dist/esm/sankhyablocks.js +1 -1
  24. package/dist/esm/snk-attach.entry.js +28 -11
  25. package/dist/esm/snk-simple-crud.entry.js +7 -7
  26. package/dist/sankhyablocks/p-0d72d9c3.entry.js +1 -0
  27. package/dist/sankhyablocks/{p-349d1968.entry.js → p-23b20add.entry.js} +1 -1
  28. package/dist/sankhyablocks/{p-bd665460.entry.js → p-33a44ca7.entry.js} +1 -1
  29. package/dist/sankhyablocks/{p-a06bf7b9.entry.js → p-7ced2cf4.entry.js} +1 -1
  30. package/dist/sankhyablocks/p-cfc219f6.entry.js +1 -0
  31. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  32. package/dist/types/components/snk-attach/interfaces/ICrudConfig.d.ts +1 -1
  33. package/dist/types/components/snk-attach/snk-attach.d.ts +5 -0
  34. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +1 -1
  35. package/dist/types/components.d.ts +8 -0
  36. package/package.json +1 -1
  37. package/dist/sankhyablocks/p-50b68b68.entry.js +0 -1
  38. package/dist/sankhyablocks/p-c3324d79.entry.js +0 -1
  39. /package/dist/collection/components/snk-simple-crud/{regular-buttons.js → snk-simple-crud.constants.js} +0 -0
  40. /package/dist/types/components/snk-simple-crud/{regular-buttons.d.ts → snk-simple-crud.constants.d.ts} +0 -0
@@ -1 +1 @@
1
- import{r as i,c as e,f as t,h as s,H as o,g as n}from"./p-d8d8169b.js";import{StringUtils as a,ObjectUtils as r}from"@sankhyalabs/core";import{S as l}from"./p-51833248.js";import{S as d,d as h,I as u}from"./p-35e73c5d.js";import{a as c,G as p}from"./p-9019a32f.js";import{ApplicationUtils as g}from"@sankhyalabs/ezui/dist/collection/utils";const f=class{constructor(t){i(this,t),this.isEditingGuideName=e(this,"isEditingGuideName",7),this.isEditingGroupName=e(this,"isEditingGroupName",7),this.layoutChanged=e(this,"layoutChanged",7),this.setFieldListAsAvailable=e(this,"setFieldListAsAvailable",7),this.guideRenamed=e(this,"guideRenamed",7),this.ID_GROUPS="container-groups",this.ID_FIELDS="container-fields",this.reservedGuideNames=[c.main.toLowerCase(),c.general.toLocaleLowerCase()],this.groupsListMemory=[],this.groupsRefList=[],this.isEditGuideNameActive=!1,this.selectedGuide=void 0,this.groupsList=[],this.guideNames=[],this.dataUnit=void 0,this.messagesBuilder=void 0}handleFieldConfigChanged({detail:i}){const e=i,t=this.groupsListMemory.find((i=>i.name===e.group));if(!t)return;const s=t.fields.map((i=>i.name===e.name?e:i)),o=this.groupsListMemory.map((i=>i.name===t.name?{name:i.name,fields:s}:i));this.applyGroupUpdate(o)}observeSelectedGuide(){this.isEditGuideNameActive=!1,t(this),this.isEditingGroupName.emit(!1)}observeGroupList(i){this.groupsListMemory=[...i]}observeIsEditGuideNameActive(i){this.isEditingGuideName.emit(i)}async addFieldToLayout(i){i.group=p.noGroup,i.tab=this.selectedGuide.name;const e=this.getFixedFieldsGroup(),t={name:p.noGroup,fields:e?[...e.fields,i]:[i]},s=e?[t,...this.groupsListMemory.slice(1)]:[t,...this.groupsListMemory];this.applyGroupUpdate(s)}getFixedFieldsGroup(){return this.groupsListMemory.find((i=>i.name===p.noGroup))}getMessage(i,e){return this.messagesBuilder.getMessage(i,e)}handleAddGroup(){const i={name:this.buildNewGroupName(),fields:[]},e=[...this.groupsListMemory,i];this.applyGroupUpdate(e)}buildNewGroupName(){var i,e;const t=null!==(e=null===(i=this.groupsListMemory.filter((i=>i.name.includes(p.newGroup))))||void 0===i?void 0:i.length)&&void 0!==e?e:0;return 0===t?p.newGroup:`${p.newGroup} (${t})`}makeDynamicFieldsContainersDraggable(){this.groupsList.filter((i=>i.name!==p.noGroup)).forEach((i=>{this.makeFieldContainerDraggable(this.getFieldsContainerId(i.name))}))}getFieldsContainerId(i){return`${this.ID_FIELDS}-${a.replaceBlankCharacters(i)}`}handleSortGroups(i){var e;const t=null===(e=i.to)||void 0===e?void 0:e.children;if(!t)return;const s=Array.from(t).map((i=>i.getAttribute("data-group-name"))),o=[],n=this.getFixedFieldsGroup();n&&o.push(n),s.forEach((i=>{const e=this.groupsListMemory.find((e=>e.name===i));e&&o.push(e)})),this.applyGroupUpdate(o)}handleFieldsChanged(i){let e=[...this.groupsListMemory];e=[...this.handleFieldsOnGroupUpdate(e,i,d.FROM)],e=[...this.handleFieldsOnGroupUpdate(e,i,d.TO)],this.applyGroupUpdate(e)}applyGroupUpdate(i){var e;return null===(e=this.groupsRefList)||void 0===e||e.forEach((i=>null==i?void 0:i.cancelEdition())),!r.equals(i,this.groupsListMemory)&&(this.groupsListMemory=[...i],this.layoutChanged.emit(this.groupsListMemory),!0)}handleFieldsOnGroupUpdate(i,e,t){const s=e[t];return s.id===u?i:this.updateGroupList(i,s,t,e)}updateGroupList(i,e,t,s){const o=e.getAttribute("data-group-name"),n={name:o,fields:h(s,t,o,this.selectedGuide.name)};return this.replaceGroup(i,n)}replaceGroup(i,e){return i.map((i=>i.name===e.name?e:i))}makeGroupsDraggable(){try{const i=this.getContainerElement(this.ID_GROUPS);if(!i)return;new l(i,{group:"groups",ghostClass:"ghost",direction:"horizontal",animation:15,onSort:i=>this.handleSortGroups(i)})}catch(i){console.error("Falha ao tornar container de grupos arrastável: ",this.ID_GROUPS)}}makeFieldContainerDraggable(i){try{const e=this.getContainerElement(i);if(!e)return;new l(e,{group:"fields",ghostClass:"ghost",direction:"vertical",animation:15,onAdd:i=>this.handleFieldsChanged(i),onRemove:i=>this.handleFieldsChanged(i),onSort:i=>this.handleFieldsChanged(i)})}catch(e){console.error("Falha ao tornar grupo arrastável: ",i)}}getContainerElement(i){return this.el.querySelector(`[id="${i}"]`)}handleSetFieldAsAvailable(i){var e;const t=null!==(e=i.group)&&void 0!==e?e:p.noGroup,s=this.groupsListMemory.find((i=>i.name===t)).fields.filter((e=>e.name!==i.name)),o=[...this.replaceGroup(this.groupsListMemory,{name:t,fields:s})];this.applyGroupUpdate(o)}removeGroup(i){var e,t;const s=null!==(t=null===(e=this.groupsListMemory.find((e=>e.name===i.name)))||void 0===e?void 0:e.fields)&&void 0!==t?t:[],o=[...this.groupsListMemory.filter((e=>e.name!==i.name))];this.applyGroupUpdate(o)&&this.setFieldListAsAvailable.emit(s)}handleRenameGroup(i){const{value:e,newValue:t}=i.detail,s=this.groupsListMemory.map((i=>{if(i.name!==e)return Object.assign({},i);const s=i.fields.map((i=>Object.assign(Object.assign({},i),{group:t})));return{name:t,fields:s}}));this.applyGroupUpdate(s)}canSaveGroup(i,e){if(!this.groupsList.some((e=>{var t;return(null!==(t=e.name)&&void 0!==t?t:"").toLocaleLowerCase()===(null!=i?i:"").toLocaleLowerCase()})))return!0;const t=this.getMessage("snkFormConfig.confirm.title"),s=this.buildDuplicatedGroupNameContent(i);return g.alert(t,s).then((()=>{var i;return null===(i=this.groupsRefList[e])||void 0===i?void 0:i.applyFocusTextEdit()})),!1}buildDuplicatedGroupNameContent(i){const e=this.selectedGuide.name;return`\n ${this.getMessage("snkFormConfig.alert.titleGroupExists")}\n <b>${i}</b>\n ${this.getMessage("snkFormConfig.alert.inTab")}\n <b>${e===c.main?this.getMessage("snkFormConfig.form.mainArea"):e}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}buildDuplicatedTabNameContent(i){return`\n ${this.getMessage("snkFormConfig.alert.titleGuideExists")}\n <b>${i}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}buildReservedTabNameContent(i){return`\n ${this.getMessage("snkFormConfig.alert.titleGuideReservedName")}\n <br/><br/>\n <b>${i}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}renderFields(i){if(0!==i.length)return i.map((i=>s("field-item",{key:i.name,fieldConfig:i,onLayoutConfig:!0,dataUnit:this.dataUnit,messagesBuilder:this.messagesBuilder,onSetFieldAsAvailable:i=>this.handleSetFieldAsAvailable(i.detail)})))}renderDraggableGroups(){return this.groupsList.filter((i=>i.name!==p.noGroup)).map(((i,e)=>{var t;return s("div",{key:i.name,class:"group-config","data-group-name":i.name},s("ez-collapsible-box",{ref:i=>this.groupsRefList[e]=i,label:i.name,headerSize:"large",editable:!0,removable:!0,"icon-placement":"left",onEzRemove:()=>this.removeGroup(i),onEzSaveEditLabel:i=>this.handleRenameGroup(i),onEzEditLabelMode:({detail:i})=>this.isEditingGroupName.emit(i),conditionalSave:i=>this.canSaveGroup(i,e)},s("div",{id:this.getFieldsContainerId(i.name),class:"group-content "+((null===(t=i.fields)||void 0===t?void 0:t.length)?"":"empty-content"),"data-group-name":i.name},this.renderFields(i.fields))))}))}renderFixedFields(){var i,e;const t=null!==(e=null===(i=this.groupsList.find((i=>i.name===p.noGroup)))||void 0===i?void 0:i.fields)&&void 0!==e?e:[];return this.renderFields(t)}handleRenameGuide(i){const{value:e,newValue:t}=i.detail;if(this.isEditGuideNameActive=!1,t===e)return;const s=this.guideNames.includes(t.toLowerCase()),o=this.reservedGuideNames.includes(t.toLowerCase());if(o||s){const i=this.getMessage("snkFormConfig.confirm.title"),e=o?this.buildReservedTabNameContent(t):this.buildDuplicatedTabNameContent(t);g.alert(i,e).then((()=>this._refTextEdit.applyFocusSelect()))}else this.guideRenamed.emit(t)}cancelEditGuideName(){this.isEditGuideNameActive=!1}async startGuideNameEdition(){this.isEditGuideNameActive=!0,setTimeout((async()=>{await this._refTextEdit.applyFocusSelect()}),200)}getTextEditStyle(){return{fontSize:"20px",fontWeight:"500",fontFamily:"Roboto"}}renderGuideName(){var i,e;return this.isEditGuideNameActive?s("div",{class:"guide-header"},s("ez-text-edit",{class:"collapsible-box__text-edit",ref:i=>this._refTextEdit=i,value:null===(i=this.selectedGuide)||void 0===i?void 0:i.label,styled:this.getTextEditStyle(),onSaveEdition:i=>this.handleRenameGuide(i),onCancelEdition:()=>this.cancelEditGuideName()})):s("div",{class:"guide-header"},s("span",{class:"guide-header-label"},null===(e=this.selectedGuide)||void 0===e?void 0:e.label),this.renderEditGuideNameButton())}renderEditGuideNameButton(){var i;if((null===(i=this.selectedGuide)||void 0===i?void 0:i.name)!==c.main)return s("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:()=>this.startGuideNameEdition(),size:"medium",iconName:"edit",title:"Renomear"})}componentDidRender(){this.makeGroupsDraggable(),this.makeDynamicFieldsContainersDraggable(),this.makeFieldContainerDraggable(p.noGroup)}render(){return this.selectedGuide?s(o,{class:"ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container"},this.renderGuideName(),s("div",{class:"layout-container"},s("ez-scroller",{direction:"vertical",activeShadow:!0},s("div",{class:"no-group-container"},s("div",{id:p.noGroup,class:"group-content","data-group-name":p.noGroup},this.renderFixedFields())),s("hr",null),s("div",{id:this.ID_GROUPS,class:"groups-container"},this.renderDraggableGroups()))),s("div",{class:"add-group-container",onClick:this.handleAddGroup.bind(this)},s("ez-icon",{slot:"leftIcon",iconName:"plus"}),s("span",null,"Criar novo grupo"))):s(o,{class:"ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container"},s("span",{class:"no-guide-selected"},"Selecione uma guia e comece a configurar"))}get el(){return n(this)}static get watchers(){return{selectedGuide:["observeSelectedGuide"],groupsList:["observeGroupList"],isEditGuideNameActive:["observeIsEditGuideNameActive"]}}};f.style='.sc-fields-layout-h{display:flex;padding:12px;box-shadow:var(--shadow--small, 0 0 16px rgba(0, 38, 111, 0.07));border-radius:var(--border--radius-medium, 6px);height:var(--snk-form-config-container-height);flex-direction:column}.layout-container.sc-fields-layout{container-type:inline-size;display:flex;flex-direction:column;overflow:auto;height:calc(100vh - 225px)}.guide-header.sc-fields-layout{display:flex;width:100%;font-size:20px;border-bottom:1px solid #dce0e8;margin-bottom:6px;align-items:center;height:45px}.guide-header.sc-fields-layout ez-button.sc-fields-layout{transition:all 0.2s ease-in-out;visibility:hidden;opacity:0}.guide-header.sc-fields-layout:hover ez-button.sc-fields-layout{visibility:visible;opacity:1}.guide-header-label.sc-fields-layout{display:block;padding:10px 0}.group-config.sc-fields-layout{padding:12px 0;display:flex;flex-direction:column;width:100%}.group-content.sc-fields-layout{display:flex;flex-direction:row;flex-wrap:wrap;gap:12px;min-height:65px;width:100%;padding:6px 0}.group-content.empty-content.sc-fields-layout{position:relative}.group-content.empty-content.sc-fields-layout::before{content:"Arraste e solte um campo aqui";color:#cbcfd7;font-size:16px;font-weight:500;text-align:center;position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;transition:opacity 0.3s;width:100%;height:100%;box-sizing:border-box;padding:10px;background:#f9f9f9;border:1px dashed #dce0e8;border-radius:6px}.no-group-container.sc-fields-layout{padding:12px 0;width:100%;border-bottom:1px solid #dce0e8}.no-group-container.sc-fields-layout::before{content:"Inclua estes campos nos grupos ou deixe-os separados no topo do formulário";width:100%;display:block;font-size:16px;font-weight:400;color:#AFB6C0;padding-bottom:12px}.add-group-container.sc-fields-layout{display:flex;align-items:center;border-top:1px solid #dce0e8;padding-top:22px;padding-bottom:12px;gap:6px;cursor:pointer;justify-content:center;width:100%;height:55px}.no-guide-selected.sc-fields-layout{display:block;margin:auto;font-size:24px;color:#AFB6C0;font-weight:500}.ghost.sc-fields-layout{opacity:.5;background:#c8fbe2}';export{f as fields_layout}
1
+ import{r as i,c as e,f as t,h as s,H as o,g as n}from"./p-d8d8169b.js";import{StringUtils as a,ObjectUtils as r}from"@sankhyalabs/core";import{S as l}from"./p-51833248.js";import{S as d,d as h,I as u}from"./p-35e73c5d.js";import{a as c,G as p}from"./p-9019a32f.js";import{ApplicationUtils as g}from"@sankhyalabs/ezui/dist/collection/utils";const m=class{constructor(t){i(this,t),this.isEditingGuideName=e(this,"isEditingGuideName",7),this.isEditingGroupName=e(this,"isEditingGroupName",7),this.layoutChanged=e(this,"layoutChanged",7),this.setFieldListAsAvailable=e(this,"setFieldListAsAvailable",7),this.guideRenamed=e(this,"guideRenamed",7),this.ID_GROUPS="container-groups",this.ID_FIELDS="container-fields",this.reservedGuideNames=[c.main.toLowerCase(),c.general.toLocaleLowerCase()],this.groupsListMemory=[],this.groupsRefList=[],this.isEditGuideNameActive=!1,this.selectedGuide=void 0,this.groupsList=[],this.guideNames=[],this.dataUnit=void 0,this.messagesBuilder=void 0}handleFieldConfigChanged({detail:i}){const e=i,t=this.groupsListMemory.find((i=>i.name===e.group));if(!t)return;const s=t.fields.map((i=>i.name===e.name?e:i)),o=this.groupsListMemory.map((i=>i.name===t.name?{name:i.name,fields:s}:i));this.applyGroupUpdate(o)}observeSelectedGuide(){this.isEditGuideNameActive=!1,t(this),this.isEditingGroupName.emit(!1)}observeGroupList(i){this.groupsListMemory=[...i]}observeIsEditGuideNameActive(i){this.isEditingGuideName.emit(i)}async addFieldToLayout(i){i.group=p.noGroup,i.tab=this.selectedGuide.name;const e=this.getFixedFieldsGroup(),t={name:p.noGroup,fields:e?[...e.fields,i]:[i]},s=e?[t,...this.groupsListMemory.slice(1)]:[t,...this.groupsListMemory];this.applyGroupUpdate(s)}getFixedFieldsGroup(){return this.groupsListMemory.find((i=>i.name===p.noGroup))}getMessage(i,e){return this.messagesBuilder.getMessage(i,e)}handleAddGroup(){const i={name:this.buildNewGroupName(),fields:[]},e=[...this.groupsListMemory,i];this.applyGroupUpdate(e)}buildNewGroupName(){var i,e;const t=null!==(e=null===(i=this.groupsListMemory.filter((i=>i.name.includes(p.newGroup))))||void 0===i?void 0:i.length)&&void 0!==e?e:0;return 0===t?p.newGroup:`${p.newGroup} (${t})`}makeDynamicFieldsContainersDraggable(){this.groupsList.filter((i=>i.name!==p.noGroup)).forEach((i=>{this.makeFieldContainerDraggable(this.getFieldsContainerId(i.name))}))}getFieldsContainerId(i){return`${this.ID_FIELDS}-${a.replaceBlankCharacters(i)}`}handleSortGroups(i){var e;const t=null===(e=i.to)||void 0===e?void 0:e.children;if(!t)return;const s=Array.from(t).map((i=>i.getAttribute("data-group-name"))),o=[],n=this.getFixedFieldsGroup();n&&o.push(n),s.forEach((i=>{const e=this.groupsListMemory.find((e=>e.name===i));e&&o.push(e)})),this.applyGroupUpdate(o)}handleFieldsChanged(i){let e=[...this.groupsListMemory];e=[...this.handleFieldsOnGroupUpdate(e,i,d.FROM)],e=[...this.handleFieldsOnGroupUpdate(e,i,d.TO)],this.applyGroupUpdate(e)}applyGroupUpdate(i){var e;return null===(e=this.groupsRefList)||void 0===e||e.forEach((i=>null==i?void 0:i.cancelEdition())),!r.equals(i,this.groupsListMemory)&&(this.groupsListMemory=[...i],this.layoutChanged.emit(this.groupsListMemory),!0)}handleFieldsOnGroupUpdate(i,e,t){const s=e[t];return s.id===u?i:this.updateGroupList(i,s,t,e)}updateGroupList(i,e,t,s){const o=e.getAttribute("data-group-name"),n={name:o,fields:h(s,t,o,this.selectedGuide.name)};return this.replaceGroup(i,n)}replaceGroup(i,e){return i.map((i=>i.name===e.name?e:i))}makeGroupsDraggable(){try{const i=this.getContainerElement(this.ID_GROUPS);if(!i)return;new l(i,{group:"groups",ghostClass:"ghost",direction:"horizontal",animation:15,onSort:i=>this.handleSortGroups(i)})}catch(i){console.error("Falha ao tornar container de grupos arrastável: ",this.ID_GROUPS)}}makeFieldContainerDraggable(i){try{const e=this.getContainerElement(i);if(!e)return;new l(e,{group:"fields",ghostClass:"ghost",direction:"vertical",animation:15,onAdd:i=>this.handleFieldsChanged(i),onRemove:i=>this.handleFieldsChanged(i),onSort:i=>this.handleFieldsChanged(i)})}catch(e){console.error("Falha ao tornar grupo arrastável: ",i)}}getContainerElement(i){return this.el.querySelector(`[id="${i}"]`)}handleSetFieldAsAvailable(i){var e;const t=null!==(e=i.group)&&void 0!==e?e:p.noGroup,s=this.groupsListMemory.find((i=>i.name===t)).fields.filter((e=>e.name!==i.name)),o=[...this.replaceGroup(this.groupsListMemory,{name:t,fields:s})];this.applyGroupUpdate(o)}removeGroup(i){var e,t;const s=null!==(t=null===(e=this.groupsListMemory.find((e=>e.name===i.name)))||void 0===e?void 0:e.fields)&&void 0!==t?t:[],o=[...this.groupsListMemory.filter((e=>e.name!==i.name))];this.applyGroupUpdate(o)&&this.setFieldListAsAvailable.emit(s)}handleRenameGroup(i){const{value:e,newValue:t}=i.detail,s=this.groupsListMemory.map((i=>{if(i.name!==e)return Object.assign({},i);const s=i.fields.map((i=>Object.assign(Object.assign({},i),{group:t})));return{name:t,fields:s}}));this.applyGroupUpdate(s)}canSaveGroup(i,e){if(!this.groupsList.some((e=>{var t;return(null!==(t=e.name)&&void 0!==t?t:"").toLocaleLowerCase()===(null!=i?i:"").toLocaleLowerCase()})))return!0;const t=this.getMessage("snkFormConfig.confirm.title"),s=this.buildDuplicatedGroupNameContent(i);return g.alert(t,s).then((()=>{var i;return null===(i=this.groupsRefList[e])||void 0===i?void 0:i.applyFocusTextEdit()})),!1}buildDuplicatedGroupNameContent(i){const e=this.selectedGuide.name;return`\n ${this.getMessage("snkFormConfig.alert.titleGroupExists")}\n <b>${i}</b>\n ${this.getMessage("snkFormConfig.alert.inTab")}\n <b>${e===c.main?this.getMessage("snkFormConfig.form.mainArea"):e}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}buildDuplicatedTabNameContent(i){return`\n ${this.getMessage("snkFormConfig.alert.titleGuideExists")}\n <b>${i}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}buildReservedTabNameContent(i){return`\n ${this.getMessage("snkFormConfig.alert.titleGuideReservedName")}\n <br/><br/>\n <b>${i}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}renderFields(i){if(0!==i.length)return i.map((i=>s("field-item",{key:i.name,fieldConfig:i,onLayoutConfig:!0,dataUnit:this.dataUnit,messagesBuilder:this.messagesBuilder,onSetFieldAsAvailable:i=>this.handleSetFieldAsAvailable(i.detail)})))}renderDraggableGroups(){return this.groupsList.filter((i=>i.name!==p.noGroup)).map(((i,e)=>{var t;return s("div",{key:i.name,class:"group-config","data-group-name":i.name},s("ez-collapsible-box",{ref:i=>this.groupsRefList[e]=i,label:i.name,headerSize:"large",editable:!0,removable:!0,"icon-placement":"left",onEzRemove:()=>this.removeGroup(i),onEzSaveEditLabel:i=>this.handleRenameGroup(i),onEzEditLabelMode:({detail:i})=>this.isEditingGroupName.emit(i),conditionalSave:i=>this.canSaveGroup(i,e)},s("div",{id:this.getFieldsContainerId(i.name),class:"group-content "+((null===(t=i.fields)||void 0===t?void 0:t.length)?"":"empty-content"),"data-group-name":i.name},this.renderFields(i.fields))))}))}renderFixedFields(){var i,e;const t=null!==(e=null===(i=this.groupsList.find((i=>i.name===p.noGroup)))||void 0===i?void 0:i.fields)&&void 0!==e?e:[];return this.renderFields(t)}handleRenameGuide(i){const{value:e,newValue:t}=i.detail;if(this.isEditGuideNameActive=!1,t===e)return;const s=this.guideNames.includes(t.toLowerCase()),o=this.reservedGuideNames.includes(t.toLowerCase());if(o||s){const i=this.getMessage("snkFormConfig.confirm.title"),e=o?this.buildReservedTabNameContent(t):this.buildDuplicatedTabNameContent(t);g.alert(i,e).then((()=>this._refTextEdit.applyFocusSelect()))}else this.guideRenamed.emit(t)}cancelEditGuideName(){this.isEditGuideNameActive=!1}async startGuideNameEdition(){this.isEditGuideNameActive=!0,setTimeout((async()=>{await this._refTextEdit.applyFocusSelect()}),200)}getTextEditStyle(){return{fontSize:"20px",fontWeight:"500",fontFamily:"Roboto"}}renderGuideName(){var i,e;return this.isEditGuideNameActive?s("div",{class:"guide-header"},s("ez-text-edit",{class:"collapsible-box__text-edit",ref:i=>this._refTextEdit=i,value:null===(i=this.selectedGuide)||void 0===i?void 0:i.label,styled:this.getTextEditStyle(),onSaveEdition:i=>this.handleRenameGuide(i),onCancelEdition:()=>this.cancelEditGuideName()})):s("div",{class:"guide-header"},s("span",{class:"guide-header-label"},null===(e=this.selectedGuide)||void 0===e?void 0:e.label),this.renderEditGuideNameButton())}renderEditGuideNameButton(){var i;if((null===(i=this.selectedGuide)||void 0===i?void 0:i.name)!==c.main)return s("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:()=>this.startGuideNameEdition(),size:"medium",iconName:"edit",title:"Renomear"})}componentDidRender(){this.makeGroupsDraggable(),this.makeDynamicFieldsContainersDraggable(),this.makeFieldContainerDraggable(p.noGroup)}render(){return this.selectedGuide?s(o,{class:"ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container"},this.renderGuideName(),s("div",{class:"layout-container"},s("ez-scroller",{direction:"vertical",activeShadow:!0},s("div",{class:"no-group-container"},s("div",{id:p.noGroup,class:"group-content","data-group-name":p.noGroup},this.renderFixedFields())),s("hr",null),s("div",{id:this.ID_GROUPS,class:"groups-container"},this.renderDraggableGroups()))),s("div",{class:"add-group-container",onClick:this.handleAddGroup.bind(this)},s("ez-icon",{slot:"leftIcon",iconName:"plus"}),s("span",null,"Criar novo grupo"))):s(o,{class:"ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container"},s("span",{class:"no-guide-selected"},"Selecione uma guia e comece a configurar"))}get el(){return n(this)}static get watchers(){return{selectedGuide:["observeSelectedGuide"],groupsList:["observeGroupList"],isEditGuideNameActive:["observeIsEditGuideNameActive"]}}};m.style='.sc-fields-layout-h{display:flex;padding:12px;box-shadow:var(--shadow--small, 0 0 16px rgba(0, 38, 111, 0.07));border-radius:var(--border--radius-medium, 6px);height:var(--snk-form-config-container-height);flex-direction:column}.layout-container.sc-fields-layout{container-type:inline-size;display:flex;flex-direction:column;overflow:auto;height:calc(100vh - 225px)}.guide-header.sc-fields-layout{display:flex;width:100%;font-size:20px;border-bottom:1px solid #dce0e8;margin-bottom:6px;align-items:center;height:45px}.guide-header.sc-fields-layout ez-button.sc-fields-layout{transition:all 0.2s ease-in-out;visibility:hidden;opacity:0}.guide-header.sc-fields-layout:hover ez-button.sc-fields-layout{visibility:visible;opacity:1}.guide-header-label.sc-fields-layout{display:block;padding:10px 0}.group-config.sc-fields-layout{padding:12px 0;display:flex;flex-direction:column;width:100%}.group-content.sc-fields-layout{display:grid;gap:12px;min-height:65px;width:100%;padding:6px 0;grid-template-columns:repeat(auto-fill, minmax(250px, 1fr))}.group-content.empty-content.sc-fields-layout{position:relative}.group-content.empty-content.sc-fields-layout::before{content:"Arraste e solte um campo aqui";color:#cbcfd7;font-size:16px;font-weight:500;text-align:center;position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;transition:opacity 0.3s;height:100%;box-sizing:border-box;padding:10px;background:#f9f9f9;border:1px dashed #dce0e8;border-radius:6px}.no-group-container.sc-fields-layout{padding:12px 0;width:100%;border-bottom:1px solid #dce0e8}.no-group-container.sc-fields-layout::before{content:"Inclua estes campos nos grupos ou deixe-os separados no topo do formulário";width:100%;display:block;font-size:16px;font-weight:400;color:#AFB6C0;padding-bottom:12px}.add-group-container.sc-fields-layout{display:flex;align-items:center;border-top:1px solid #dce0e8;padding-top:22px;padding-bottom:12px;gap:6px;cursor:pointer;justify-content:center;width:100%;height:55px}.no-guide-selected.sc-fields-layout{display:block;margin:auto;font-size:24px;color:#AFB6C0;font-weight:500}.ghost.sc-fields-layout{opacity:.5;background:#c8fbe2}';export{m as fields_layout}
@@ -1 +1 @@
1
- import{r as t,c as i,h as e}from"./p-d8d8169b.js";import{ApplicationContext as a,DataType as s,Action as n,UserInterface as o,StringUtils as r,DataUnitLoaderUtils as l,DataUnit as d}from"@sankhyalabs/core";import{D as h}from"./p-fbba7e3d.js";import{S as c}from"./p-6dd38d7b.js";import"./p-0f3698af.js";import{P as v,D as u,I as m}from"./p-7993b2e3.js";import"./p-ff1990ad.js";import"./p-601b252b.js";import{V as A}from"./p-9019a32f.js";import{A as O}from"./p-73285a8a.js";import{T as p}from"./p-7de79adf.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-a349689a.js";class w{constructor(t){this.dataUnitName=t}async save({dataUnit:t,record:i,updatingFields:e,operation:a}){var s,n;const o="INSERT"==a,r=o?e:i;if(!o&&(null==e?void 0:e.DESCRICAO)&&(null==e?void 0:e.DESCRICAO)!==(null==i?void 0:i.DESCRICAO))throw new Error(c.DESCRIPTION_CANNOT_BE_CHANGED);const l={anexo:{codata:o?null==e?void 0:e.REGISTER_KEY:null==i?void 0:i.CODATA,sequencia:(null==r?void 0:r.SEQUENCIA)||"0",tipo:(null==r?void 0:r.TIPO)||"N",descricao:null==r?void 0:r.DESCRICAO,arquivo:null===(n=null===(s=e.CAMINHO_ARQUIVO)||void 0===s?void 0:s[0])||void 0===n?void 0:n.name,ehInclusao:o?"S":"N",ehArquivoRepositorio:"N"}};return new Promise(((i,a)=>{h.get().callServiceBroker("Attach.save",JSON.stringify(l)).then((a=>{var s;return i([Object.assign(Object.assign(Object.assign({},a),e),{__owner__dataunit__name__:null!==(s=this.dataUnitName)&&void 0!==s?s:t})])})).catch((t=>a(t)))}))}async edit(t){throw new Error("Method not implemented.")}async delete(t){var i={anexo:{codata:t.CODATA,tipo:t.TIPO,descricao:t.DESCRICAO}};const e=await h.get().callServiceBroker("Attach.remove",JSON.stringify(i));return Promise.resolve(e)}async getDownloadKey(t){var i,e,a;if("S"==t.EHARQUIVOREPOSITORIO){const a={config:{path:t.ARQUIVO,tipoconteudo:t.TIPOCONTEUDO}},s=await h.get().callServiceBroker("RepositorioArquivoSP.abreArquivo",JSON.stringify(a));return Promise.resolve({chave:{valor:null===(e=null===(i=null==s?void 0:s.responseBody)||void 0===i?void 0:i.chave)||void 0===e?void 0:e.valor}})}const s={anexo:{codata:t.CODATA,codemp:t.CODEMP,sequencia:t.SEQUENCIA,tipo:t.TIPO,descricao:t.DESCRICAO,tipoConteudo:t.TIPOCONTEUDO}},n=await h.get().callServiceBroker("Attach.view",JSON.stringify(s));return(null==n?void 0:n.chaveAnexo)?Promise.resolve({chave:{valor:null===(a=null==n?void 0:n.chaveAnexo)||void 0===a?void 0:a.idChaveAnexo}}):Promise.reject(new Error("File not found."))}}const k="AnexoSistemaSP.salvar",I="AnexoSistemaSP.excluir",S="AnexoSistemaSP.baixar";class _{constructor(t,i){var e;this.entityName=t,this.dataUnitName=i,this.validateFields=t=>{if(t.LINK&&t.NOMEARQUIVO)throw new Error(c.LINK_AND_FILE_AT_THE_SAME_TIME);if(!t.LINK&&!t.NOMEARQUIVO)throw new Error(c.ANY_LINK_OR_FILE_FILLED);if(!this._registerKey)throw new Error("Register key can not be null")},this.resourceID=window.resourceID||(null===(e=window.workspace)||void 0===e?void 0:e.resourceID)}set registerKey(t){this._registerKey=t}async save(t){var i,e;let{updatingFields:a}=t;a=Object.assign(Object.assign({},a),{NOMEARQUIVO:null===(i=a.NOMEARQUIVO)||void 0===i?void 0:i[0]});try{this.validateFields(a);const t=a.LINK?null:a.NOMEARQUIVO,i={serviceName:k,requestBody:{params:{resourceID:this.resourceID,description:a.DESCRICAO,fileSelect:t?1:0,keySession:null===(e=null==t?void 0:t.properties)||void 0===e?void 0:e.fileNameTmp,nameAttach:null==t?void 0:t.name,link:a.LINK,nameEntity:this.entityName,pkEntity:this._registerKey,typeAcess:a.TIPOACESSO,typeApres:a.TIPOAPRES}}},s=await h.get().callServiceBroker(k,JSON.stringify(i));return Promise.resolve([Object.assign(Object.assign(Object.assign({},s),a),{ARQUIVOOULINK:a.LINK?a.LINK:null==t?void 0:t.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}async edit(t){var i,e,a;let{updatingFields:s,record:n}=t;const o=t=>void 0!==s[t]?s[t]:n[t],r=o("NOMEARQUIVO"),l=null===(e=null===(i=s.NOMEARQUIVO)||void 0===i?void 0:i[0])||void 0===e?void 0:e.downloadURL;s=Object.assign(Object.assign({},s),{DESCRICAO:o("DESCRICAO"),LINK:o("LINK"),TIPOACESSO:o("TIPOACESSO"),TIPOAPRES:o("TIPOAPRES"),CHAVEARQUIVO:n.CHAVEARQUIVO,NOMEARQUIVO:null==r?void 0:r[0]});const d=s.LINK?null:s.NOMEARQUIVO;try{this.validateFields(s);const t={serviceName:k,requestBody:{params:{resourceID:this.resourceID,nuAttach:null==n?void 0:n.NUATTACH,description:s.DESCRICAO,fileSelect:l?1:0,keySession:null===(a=null==d?void 0:d.properties)||void 0===a?void 0:a.fileNameTmp,keyAttach:s.CHAVEARQUIVO,nameAttach:null==d?void 0:d.name,link:s.LINK,nameEntity:this.entityName,pkEntity:this._registerKey,typeAcess:s.TIPOACESSO,typeApres:s.TIPOAPRES}}},i=await h.get().callServiceBroker(k,JSON.stringify(t));return Promise.resolve([Object.assign(Object.assign(Object.assign({},i),s),{ARQUIVOOULINK:s.LINK?s.LINK:null==d?void 0:d.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}delete(t){var i;const e=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},a={serviceName:I,requestBody:{paramsDelete:{keyAttach:t.CHAVEARQUIVO,nameAttach:null==e?void 0:e.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO}}};return new Promise(((t,i)=>{h.get().callServiceBroker(I,JSON.stringify(a)).then((i=>t(i))).catch((t=>i(t)))}))}getDownloadKey(t){var i;const e=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},a={serviceName:S,requestBody:{paramsDown:{nameAttach:null==e?void 0:e.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO,keyAttach:t.CHAVEARQUIVO}}};return new Promise(((t,i)=>{h.get().callServiceBroker(S,JSON.stringify(a)).then((i=>t(i))).catch((t=>i(t)))}))}}class b{constructor(t,i){this.entityName=t,this.getMessage=i,this._application=a.getContextValue("__SNK__APPLICATION__")}initLoaders(t,i,e){this.loader||(this.loader=t.dataLoader),t.dataLoader=(t,i)=>this.dataLoader(t,i),t.saveLoader=(t,a)=>this.saveLoader(a,i).then((t=>(t.length&&e(),t))),t.removeLoader=(t,a)=>this.removeLoader(t,a,i).then((t=>(t.length&&e(),t)))}metadataLoader(t){throw new Error("Method not implemented.")}dataLoader(t,i){return new Promise((e=>{this.loader(t,i).then((t=>{const i=((null==t?void 0:t.records)||[]).map((t=>{let i;return t.LINK||(i=[{name:t.NOMEARQUIVO}]),Object.assign(Object.assign({},t),{ARQUIVOOULINK:t.LINK?t.LINK:t.NOMEARQUIVO,NOMEARQUIVO:i})}));e(Object.assign(Object.assign({},t),{records:i}))}))}))}saveLoader(t,i){return new Promise((e=>{var a;const s=Array.isArray(t)?t[0]:{};((null===(a=null==s?void 0:s.record)||void 0===a?void 0:a.NUATTACH)>=0?i.edit.bind(i):i.save.bind(i))(s).then((t=>{e(t)})).catch((t=>t.message===c.LINK_AND_FILE_AT_THE_SAME_TIME?(this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),e([])):t.message===c.ANY_LINK_OR_FILE_FILLED?(this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),e([])):t.message?(this._application.error(t.title||t.name,t.message),e([])):void e([])))}))}removeLoader(t,i,e){return new Promise((a=>{const{records:s}=t.getSelectionInfo(),n=s[0];e.delete(n).then((()=>(v.removeRecords(t,[n]),a(i))))}))}getFilters(t){return[{name:"AttachmentsByPK",expression:"this.PKREGISTRO = :PKREGISTRO",params:[{name:"PKREGISTRO",dataType:s.TEXT,value:`${t}_${this.entityName}`}]}]}getInterceptions(t,i,e){return new Promise((a=>i.type===n.EDITION_CANCELED?t.isDirty()?this._application.confirm(this.getMessage("snkAttach.cancelConfirmation.title"),this.getMessage("snkAttach.cancelConfirmation.message")).then((t=>t?(e.goToView(A.GRID),a(i)):a(void 0))):a(i):i.type===n.DATA_SAVED?(t.loadData(),a(i)):void a(i)))}}const y=a.getContextValue("__SNK__APPLICATION__"),f=t=>{var i,e;return null===(e=null===(i=null==y?void 0:y.messagesBuilder)||void 0===i?void 0:i.getMessage)||void 0===e?void 0:e.call(i,t,null)},E={grid:{columns:[{name:"CODATA",orderIndex:0,width:0},{name:"DESCRICAO",orderIndex:1,width:0},{name:"ARQUIVO",orderIndex:2,width:0},{name:"DTALTER",orderIndex:3,width:0},{name:"USUARIO",orderIndex:4,width:0}]},form:{emptyConfig:!1,fields:[{name:"DESCRICAO",label:f("snkAttach.attachMetadata.lblDescription"),visible:!0,readOnly:!1,required:!0},{name:"CAMINHO_ARQUIVO",label:f("snkAttach.attachMetadata.lblFile"),visible:!0,readOnly:!1,required:!0}]}},N={name:"Attach",label:"Attach List",fields:[{name:"CODATA",label:f("snkAttach.attachMetadata.lblCode"),dataType:s.TEXT},{name:"DESCRICAO",label:f("snkAttach.attachMetadata.lblDescription"),dataType:s.TEXT,readOnly:!1},{name:"ARQUIVO",label:f("snkAttach.attachMetadata.lblFileOrLink"),dataType:s.TEXT},{name:"USUARIO",label:f("snkAttach.attachMetadata.lblUser"),dataType:s.TEXT},{name:"DTALTER",label:f("snkAttach.attachMetadata.lblDate"),dataType:s.TEXT},{name:"CAMINHO_ARQUIVO",label:f("snkAttach.attachMetadata.lblFileUpload"),dataType:s.OBJECT,userInterface:o.FILE,readOnly:!1,required:!0,visible:!0,properties:{subTitle:f("snkAttach.attachMetadata.lblSubTitle"),MAX_FILES:1,STORAGESTRATEGY:"SESSION",INTERNAL_FILENAME:"Attach.upload"}}]};class g{constructor(t){this.getMessage=t,this._records=[],this._application=a.getContextValue("__SNK__APPLICATION__")}initLoaders(t,i,e){t.metadataLoader=t=>this.metadataLoader(t),t.dataLoader=(t,i)=>this.dataLoader(t,i),t.saveLoader=(t,a)=>this.saveLoader(a,i).then((t=>(t.length&&e(),t))),t.removeLoader=(t,a)=>this.removeLoader(t,a,i).then((t=>(t.length&&e(),t)))}metadataLoader(t){return Promise.resolve(N)}async dataLoader(t,i){if(!i.source)return Promise.resolve({records:this._records});if(!Number.isNaN(Number(i.source))){const t={criteria:{codata:i.source,tipoAnexo:"N"}},e=await this._application.getDataFetcher(),{anexos:{anexo:a=[]}}=await e.callServiceBroker("Attach.load",JSON.stringify(t)),s=[];a.forEach((t=>{s.push(Object.assign({__record__id__:r.generateUUID(),CAMINHO_ARQUIVO:[{name:null==t?void 0:t.ARQUIVO}]},t))})),this._records=s}return l.buildLoadDataResponse(this._records,t,i)}saveLoader(t,i){return new Promise((e=>{const a=Array.isArray(t)?t[0]:{};i.save(a).then(e).catch((t=>t.message===c.DESCRIPTION_CANNOT_BE_CHANGED?(this._application.alert(this.getMessage("snkAttach.alertValidation.descriptionCannotBeChanged.title"),this.getMessage("snkAttach.alertValidation.descriptionCannotBeChanged.message")),e([])):t.message===c.LINK_AND_FILE_AT_THE_SAME_TIME?(this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),e([])):t.message===c.ANY_LINK_OR_FILE_FILLED?(this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),e([])):t.message?(this._application.error(t.title||t.name,t.message),e([])):void e([])))}))}removeLoader(t,i,e){return new Promise((a=>{t.getSelectionInfo().records.forEach((async t=>{this._application.hasAccess(O.REMOVE).then((async s=>{s&&(await e.delete(t),a(i))}))}))}))}getFilters(){throw new Error("Method not implemented.")}getInterceptions(t,i,e){return new Promise((a=>{var s,o,r,l,d,h;switch(i.type){case n.EDITION_CANCELED:return t.isDirty()?this._application.confirm(this.getMessage("snkAttach.cancelConfirmation.title"),this.getMessage("snkAttach.cancelConfirmation.message")).then((t=>t?(e.goToView(A.GRID),a(i)):a(void 0))):a(i);case n.DATA_SAVED:return t.loadData(void 0,void 0,!1,null===(r=null===(o=null===(s=null==i?void 0:i.payload)||void 0===s?void 0:s.records)||void 0===o?void 0:o[0])||void 0===r?void 0:r.REGISTER_KEY),a(i);case n.RECORDS_REMOVED:return t.loadData(void 0,void 0,!1,null===(h=null===(d=null===(l=null==i?void 0:i.payload)||void 0===l?void 0:l.cachedRecords)||void 0===d?void 0:d[0])||void 0===h?void 0:h.CODATA),a(i)}a(i)}))}}const C=a.getContextValue("__SNK__APPLICATION__"),T=t=>{var i,e;return null===(e=null===(i=null==C?void 0:C.messagesBuilder)||void 0===i?void 0:i.getMessage)||void 0===e?void 0:e.call(i,t,null)},L={DOWNLOAD:{hint:T("snkAttach.taskbar.titleDownload"),name:"DOWNLOAD",iconName:"file-download"},LINK:{hint:T("snkAttach.taskbar.titleLink"),name:"LINK",iconName:"launch"}},P=()=>{const t=[p.REMOVE,"DOWNLOAD","LINK"];return{getButtons:(t,i,e)=>{const a=e.indexOf(p.REFRESH);if((null==i?void 0:i.insertionMode)||(null==i?void 0:i.isDirty))return e.reverse();-1!==a&&e.splice(a,1);const{selectedRecord:s}=i||{},n=(null==s?void 0:s.LINK)?L.LINK:L.DOWNLOAD;e.splice(e.indexOf(p.DIVIDER)+1,0,p.REMOVE,n,p.DIVIDER);const o=[p.CLONE,p.DATA_EXPORTER],r=Array.from(new Set(e.filter((t=>!o.includes(t)))));return r.splice(r.indexOf(n)+1,0,p.DIVIDER),r},isEnabled:(i,e,a)=>{const s=void 0!==(null==e?void 0:e.selectedRecord);return!(t.includes(a)&&!s)}}},R={grid:{columns:[{name:"ARQUIVOOULINK",orderIndex:0,width:0},{name:"DESCRICAO",orderIndex:1,width:0},{name:"DHCAD",orderIndex:2,width:0},{name:"DHALTER",orderIndex:3,width:0},{name:"TIPOAPRES",orderIndex:4,width:0},{name:"TIPOACESSO",orderIndex:5,width:0},{name:"CODUSU",orderIndex:6,width:0},{name:"CODUSUALT",orderIndex:7,width:0}]},form:{emptyConfig:!1,fields:[{name:"DESCRICAO",required:!0},{name:"TIPOAPRES",required:!0},{name:"TIPOACESSO",required:!0},{name:"LINK"},{name:"NOMEARQUIVO"}]}},x=class{constructor(e){t(this,e),this.back=i(this,"back",7),this.handleTaskbarClick=async({detail:t})=>{if(["DOWNLOAD","LINK"].includes(t))return this.downloadAttachment(this._currentDataUnit.getSelectedRecord());"Attach"===this.fetcherType&&["SAVE"].includes(t)&&this._currentDataUnit.isDirty()&&await this._currentDataUnit.setFieldValue("REGISTER_KEY",this.registerKey)},this.handleBack=()=>{this._currentDataUnit.cancelEdition().then((t=>{t&&this.back.emit()}))},this.handleFinish=()=>{if(!this._currentDataUnit.isDirty())return this.back.emit();this.validateAnexoSistema()&&this._currentDataUnit.saveData().then((()=>{this.showFinishedToast(),this.back.emit()}))},this.fetcherType=void 0,this.fetcher=void 0,this.dataUnit=void 0,this.dataUnitBuilder=void 0,this.registerKey=void 0,this.entityName=void 0,this.messagesBuilder=void 0,this._currentFetcher=void 0,this._currentDataUnit=void 0,this.crudConfig=void 0}async registerKeyWatcher(t,i){var e;null==this._currentDataUnit&&this.loadAttachmentDataUnit(),i!==t&&(this._currentFetcher instanceof _&&(this._currentFetcher.registerKey=t),await(null===(e=this._currentDataUnit)||void 0===e?void 0:e.loadData()))}getAnexoSistemaFetcherInstance(){var t;const i=new _(this.entityName,null===(t=this._currentDataUnit)||void 0===t?void 0:t.name);return i.registerKey=this.registerKey,i}async initAttach(){var t,i,e,a,s;if(this.fetcherType||this.registerKey){if(this.fetcherType||(this.fetcherType="AnexoSistema"),this.returnToGridMode(),"AnexoSistema"===this.fetcherType)return this._currentFetcher=this.getAnexoSistemaFetcherInstance(),null===(t=this._currentDataUnitBuilder)||void 0===t||t.initLoaders(this._currentDataUnit,this._currentFetcher,this.returnToGridMode.bind(this)),void await(null===(i=this._currentDataUnit)||void 0===i?void 0:i.loadData());if("Attach"===this.fetcherType&&(null===(e=this.registerKey)||void 0===e?void 0:e.split("_").length)>1)return;await(null===(a=this._currentDataUnit)||void 0===a?void 0:a.loadMetadata()),await(null===(s=this._currentDataUnit)||void 0===s?void 0:s.loadData(void 0,void 0,!0,this.registerKey))}}getMessage(t,i){if(this.messagesBuilder)return this.messagesBuilder.getMessage(t,i)}showFinishedToast(){this._application.info(this.getMessage("snkAttach.finishedMessage"),{iconName:"check"})}downloadAttachment(t){if(!t)throw new Error("Nenhum registro selecionado");t.LINK?window.open(`${t.LINK}`):this._currentFetcher.getDownloadKey(t).then((({chave:i})=>{var e;let a=!1;(null===(e=null==t?void 0:t.ARQUIVO)||void 0===e?void 0:e.endsWith(".pdf"))||(a=!0),window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${i.valor}${a?"&forcarDownload=S":""}`)}))}returnToGridMode(){var t;null===(t=this._currentDataUnit)||void 0===t||t.clearSelection(),this._crudElement&&this._crudElement.goToView(A.GRID)}async loadAttachmentDataUnit(){try{switch(this.fetcherType){case"AnexoSistema":await this.loadAnexoSistema();break;case"Attach":await this.loadAttach();break;default:this._currentFetcher=this.fetcher,this._currentDataUnit=this.dataUnit,this._currentDataUnitBuilder=this.dataUnitBuilder}}catch(t){throw new Error("There was an error while creating the data unit")}}async loadAnexoSistema(){var t,i;this._currentDataUnit=(new u).getDataUnit("AnexoSistema","br.com.sankhya.core.v3.anexoSistema"),this._currentFetcher=this.getAnexoSistemaFetcherInstance(),this._currentDataUnit.metadata||(await(null===(t=this._currentDataUnit)||void 0===t?void 0:t.loadMetadata()),this.crudConfig=Object.assign({},R)),this.initDataUnitLoaders(),this._currentDataUnit.addFilterProvider({getFilter:()=>this._currentDataUnitBuilder.getFilters(this.registerKey)}),this._currentDataUnit.addInterceptor({interceptAction:t=>this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit,t,this._crudElement)}),await(null===(i=this._currentDataUnit)||void 0===i?void 0:i.loadData()),this.disableEditFieldsNotInForm()}async loadAttach(){var t,i;this._currentFetcher=new w,this._currentDataUnit=new d(m.IN_MEMORY_DATA_UNIT_NAME),this._currentDataUnit.pageSize=150,this.initDataUnitLoaders(),this._currentDataUnit.addInterceptor({interceptAction:t=>{var i;return t.type===n.METADATA_LOADED&&(this.crudConfig=Object.assign({},E),null===(i=this._crudElement)||void 0===i||i.updateConfig()),this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit,t,this._crudElement)}}),this._currentDataUnit.metadata||(await(null===(t=this._currentDataUnit)||void 0===t?void 0:t.loadMetadata()),this.crudConfig=Object.assign({},E),await(null===(i=this._currentDataUnit)||void 0===i?void 0:i.loadData(void 0,void 0,!0,this.registerKey)),this.disableEditFieldsNotInForm())}initDataUnitLoaders(){var t,i;"AnexoSistema"===this.fetcherType&&(this._currentFetcher=this.getAnexoSistemaFetcherInstance(),this._currentDataUnitBuilder=new b(this.entityName,this.getMessage.bind(this)),null===(t=this._currentDataUnitBuilder)||void 0===t||t.initLoaders(this._currentDataUnit,this._currentFetcher,this.returnToGridMode.bind(this))),"Attach"===this.fetcherType&&(this._currentFetcher=new w,this._currentDataUnitBuilder=new g(this.getMessage.bind(this)),null===(i=this._currentDataUnitBuilder)||void 0===i||i.initLoaders(this._currentDataUnit,this._currentFetcher,(async()=>{this.returnToGridMode(),await this._currentDataUnit.loadData(void 0,void 0,!0,this.registerKey)})))}disableEditFieldsNotInForm(){var t;null===(t=this.crudConfig)||void 0===t||t.grid.columns.forEach((t=>{var i;const e=t.name;(null===(i=this.crudConfig)||void 0===i?void 0:i.form.fields.some((t=>t.name===e)))||this._currentDataUnit.disableField(e)}))}validateAnexoSistema(){var t;if(this._currentFetcher instanceof _)try{let i=this._currentDataUnit.getSelectedRecord();i=Object.assign(Object.assign({},i),{NOMEARQUIVO:null===(t=i.NOMEARQUIVO)||void 0===t?void 0:t[0]}),this._currentFetcher.validateFields(i)}catch(t){if(t.message===c.LINK_AND_FILE_AT_THE_SAME_TIME)return this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),!1;if(t.message===c.ANY_LINK_OR_FILE_FILLED)return this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),!1}return!0}async componentWillLoad(){this._application=a.getContextValue("__SNK__APPLICATION__"),await this.initAttach()}componentWillRender(){this.fetcherType||(this.fetcherType="AnexoSistema"),null==this._currentDataUnit&&this.loadAttachmentDataUnit()}async handleOnDataStateChange({detail:t}){"Attach"===this.fetcherType&&(t.insertionMode?this._currentDataUnit.enableField("DESCRICAO"):this._currentDataUnit.disableField("DESCRICAO"),await this._currentDataUnit.loadMetadata())}render(){var t,i;return this._currentDataUnit?e("main",{class:"snk-attach__main"},e("header",{class:"snk-attach__header"},e("snk-simple-bar",{onExit:this.handleBack,messagesBuilder:this.messagesBuilder},e("div",{slot:"rightSlot"},e("ez-button",{class:"ez-button--primary",label:this.getMessage("snkAttach.finish"),onClick:this.handleFinish})))),e("div",{class:"snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column"},e("div",{class:"ez-box__container"},e("snk-simple-crud",{ref:t=>this._crudElement=t,dataUnit:this._currentDataUnit,taskbarManager:P(),gridConfig:null===(t=this.crudConfig)||void 0===t?void 0:t.grid,formConfig:null===(i=this.crudConfig)||void 0===i?void 0:i.form,useCancelConfirm:!1,onActionClick:this.handleTaskbarClick,messagesBuilder:this.messagesBuilder,onDataStateChange:this.handleOnDataStateChange.bind(this),multipleSelection:!0},e("div",{slot:"snkSimpleCrudHeader"},e("div",{class:"ez-flex ez-flex--column"},e("span",{class:"ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium"},this.getMessage("snkAttach.title")),e("span",{class:"ez-text ez-text--medium ez-text--secondary ez-padding-bottom--medium"},this.getMessage("snkAttach.description")))))))):null}static get watchers(){return{registerKey:["registerKeyWatcher"]}}};x.style=".snk-attach__header.sc-snk-attach,.snk-attach__crud-section.sc-snk-attach{padding:0 var(--space--lg)}.snk-attach__file-info.sc-snk-attach{padding:var(--space--small);max-width:50%}.snk-attach__main.sc-snk-attach{height:85%}.ez-box__container.sc-snk-attach{height:100%}";export{x as snk_attach}
1
+ import{r as t,c as i,h as e}from"./p-d8d8169b.js";import{ApplicationContext as a,DataType as s,Action as n,UserInterface as o,StringUtils as r,DataUnitLoaderUtils as l,DataUnit as d}from"@sankhyalabs/core";import{D as h}from"./p-fbba7e3d.js";import{S as c}from"./p-6dd38d7b.js";import"./p-0f3698af.js";import{P as v,D as u,I as m}from"./p-7993b2e3.js";import"./p-ff1990ad.js";import"./p-601b252b.js";import{V as A}from"./p-9019a32f.js";import{A as O}from"./p-73285a8a.js";import{T as p}from"./p-7de79adf.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-a349689a.js";class w{constructor(t){this.dataUnitName=t}async save({dataUnit:t,record:i,updatingFields:e,operation:a}){var s,n;const o="INSERT"==a,r=o?e:i;if(!o&&(null==e?void 0:e.DESCRICAO)&&(null==e?void 0:e.DESCRICAO)!==(null==i?void 0:i.DESCRICAO))throw new Error(c.DESCRIPTION_CANNOT_BE_CHANGED);const l={anexo:{codata:o?null==e?void 0:e.REGISTER_KEY:null==i?void 0:i.CODATA,sequencia:(null==r?void 0:r.SEQUENCIA)||"0",tipo:(null==r?void 0:r.TIPO)||"N",descricao:null==r?void 0:r.DESCRICAO,arquivo:null===(n=null===(s=e.CAMINHO_ARQUIVO)||void 0===s?void 0:s[0])||void 0===n?void 0:n.name,ehInclusao:o?"S":"N",ehArquivoRepositorio:"N"}};return new Promise(((i,a)=>{h.get().callServiceBroker("Attach.save",JSON.stringify(l)).then((a=>{var s;return i([Object.assign(Object.assign(Object.assign({},a),e),{__owner__dataunit__name__:null!==(s=this.dataUnitName)&&void 0!==s?s:t})])})).catch((t=>a(t)))}))}async edit(t){throw new Error("Method not implemented.")}async delete(t){var i={anexo:{codata:t.CODATA,tipo:t.TIPO,descricao:t.DESCRICAO}};const e=await h.get().callServiceBroker("Attach.remove",JSON.stringify(i));return Promise.resolve(e)}async getDownloadKey(t){var i,e,a;if("S"==t.EHARQUIVOREPOSITORIO){const a={config:{path:t.ARQUIVO,tipoconteudo:t.TIPOCONTEUDO}},s=await h.get().callServiceBroker("RepositorioArquivoSP.abreArquivo",JSON.stringify(a));return Promise.resolve({chave:{valor:null===(e=null===(i=null==s?void 0:s.responseBody)||void 0===i?void 0:i.chave)||void 0===e?void 0:e.valor}})}const s={anexo:{codata:t.CODATA,codemp:t.CODEMP,sequencia:t.SEQUENCIA,tipo:t.TIPO,descricao:t.DESCRICAO,tipoConteudo:t.TIPOCONTEUDO}},n=await h.get().callServiceBroker("Attach.view",JSON.stringify(s));return(null==n?void 0:n.chaveAnexo)?Promise.resolve({chave:{valor:null===(a=null==n?void 0:n.chaveAnexo)||void 0===a?void 0:a.idChaveAnexo}}):Promise.reject(new Error("File not found."))}}const I="AnexoSistemaSP.salvar",k="AnexoSistemaSP.excluir",S="AnexoSistemaSP.baixar";class _{constructor(t,i){var e;this.entityName=t,this.dataUnitName=i,this.validateFields=t=>{if(t.LINK&&t.NOMEARQUIVO)throw new Error(c.LINK_AND_FILE_AT_THE_SAME_TIME);if(!t.LINK&&!t.NOMEARQUIVO)throw new Error(c.ANY_LINK_OR_FILE_FILLED);if(!this._registerKey)throw new Error("Register key can not be null")},this.resourceID=window.resourceID||(null===(e=window.workspace)||void 0===e?void 0:e.resourceID)}set registerKey(t){this._registerKey=t}async save(t){var i,e;let{updatingFields:a}=t;a=Object.assign(Object.assign({},a),{NOMEARQUIVO:null===(i=a.NOMEARQUIVO)||void 0===i?void 0:i[0]});try{this.validateFields(a);const t=a.LINK?null:a.NOMEARQUIVO,i={serviceName:I,requestBody:{params:{resourceID:this.resourceID,description:a.DESCRICAO,fileSelect:t?1:0,keySession:null===(e=null==t?void 0:t.properties)||void 0===e?void 0:e.fileNameTmp,nameAttach:null==t?void 0:t.name,link:a.LINK,nameEntity:this.entityName,pkEntity:this._registerKey,typeAcess:a.TIPOACESSO,typeApres:a.TIPOAPRES}}},s=await h.get().callServiceBroker(I,JSON.stringify(i));return Promise.resolve([Object.assign(Object.assign(Object.assign({},s),a),{ARQUIVOOULINK:a.LINK?a.LINK:null==t?void 0:t.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}async edit(t){var i,e,a;let{updatingFields:s,record:n}=t;const o=t=>void 0!==s[t]?s[t]:n[t],r=o("NOMEARQUIVO"),l=null===(e=null===(i=s.NOMEARQUIVO)||void 0===i?void 0:i[0])||void 0===e?void 0:e.downloadURL;s=Object.assign(Object.assign({},s),{DESCRICAO:o("DESCRICAO"),LINK:o("LINK"),TIPOACESSO:o("TIPOACESSO"),TIPOAPRES:o("TIPOAPRES"),CHAVEARQUIVO:n.CHAVEARQUIVO,NOMEARQUIVO:null==r?void 0:r[0]});const d=s.LINK?null:s.NOMEARQUIVO;try{this.validateFields(s);const t={serviceName:I,requestBody:{params:{resourceID:this.resourceID,nuAttach:null==n?void 0:n.NUATTACH,description:s.DESCRICAO,fileSelect:l?1:0,keySession:null===(a=null==d?void 0:d.properties)||void 0===a?void 0:a.fileNameTmp,keyAttach:s.CHAVEARQUIVO,nameAttach:null==d?void 0:d.name,link:s.LINK,nameEntity:this.entityName,pkEntity:this._registerKey,typeAcess:s.TIPOACESSO,typeApres:s.TIPOAPRES}}},i=await h.get().callServiceBroker(I,JSON.stringify(t));return Promise.resolve([Object.assign(Object.assign(Object.assign({},i),s),{ARQUIVOOULINK:s.LINK?s.LINK:null==d?void 0:d.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}delete(t){var i;const e=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},a={serviceName:k,requestBody:{paramsDelete:{keyAttach:t.CHAVEARQUIVO,nameAttach:null==e?void 0:e.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO}}};return new Promise(((t,i)=>{h.get().callServiceBroker(k,JSON.stringify(a)).then((i=>t(i))).catch((t=>i(t)))}))}getDownloadKey(t){var i;const e=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},a={serviceName:S,requestBody:{paramsDown:{nameAttach:null==e?void 0:e.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO,keyAttach:t.CHAVEARQUIVO}}};return new Promise(((t,i)=>{h.get().callServiceBroker(S,JSON.stringify(a)).then((i=>t(i))).catch((t=>i(t)))}))}}class f{constructor(t,i){this.entityName=t,this.getMessage=i,this._application=a.getContextValue("__SNK__APPLICATION__")}initLoaders(t,i,e){this.loader||(this.loader=t.dataLoader),t.dataLoader=(t,i)=>this.dataLoader(t,i),t.saveLoader=(t,a)=>this.saveLoader(a,i).then((t=>(t.length&&e(),t))),t.removeLoader=(t,a)=>this.removeLoader(t,a,i).then((t=>(t.length&&e(),t)))}metadataLoader(t){throw new Error("Method not implemented.")}dataLoader(t,i){return new Promise((e=>{this.loader(t,i).then((t=>{const i=((null==t?void 0:t.records)||[]).map((t=>{let i;return t.LINK||(i=[{name:t.NOMEARQUIVO}]),Object.assign(Object.assign({},t),{ARQUIVOOULINK:t.LINK?t.LINK:t.NOMEARQUIVO,NOMEARQUIVO:i})}));e(Object.assign(Object.assign({},t),{records:i}))}))}))}saveLoader(t,i){return new Promise((e=>{var a;const s=Array.isArray(t)?t[0]:{};((null===(a=null==s?void 0:s.record)||void 0===a?void 0:a.NUATTACH)>=0?i.edit.bind(i):i.save.bind(i))(s).then((t=>{e(t)})).catch((t=>t.message===c.LINK_AND_FILE_AT_THE_SAME_TIME?(this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),e([])):t.message===c.ANY_LINK_OR_FILE_FILLED?(this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),e([])):t.message?(this._application.error(t.title||t.name,t.message),e([])):void e([])))}))}removeLoader(t,i,e){return new Promise((a=>{const{records:s}=t.getSelectionInfo(),n=s[0];e.delete(n).then((()=>(v.removeRecords(t,[n]),a(i))))}))}getFilters(t){return[{name:"AttachmentsByPK",expression:"this.PKREGISTRO = :PKREGISTRO",params:[{name:"PKREGISTRO",dataType:s.TEXT,value:`${t}_${this.entityName}`}]}]}getInterceptions(t,i,e){return new Promise((a=>i.type===n.EDITION_CANCELED?t.isDirty()?this._application.confirm(this.getMessage("snkAttach.cancelConfirmation.title"),this.getMessage("snkAttach.cancelConfirmation.message")).then((t=>t?(e.goToView(A.GRID),a(i)):a(void 0))):a(i):i.type===n.DATA_SAVED?(t.loadData(),a(i)):void a(i)))}}const y=a.getContextValue("__SNK__APPLICATION__"),b=t=>{var i,e;return null===(e=null===(i=null==y?void 0:y.messagesBuilder)||void 0===i?void 0:i.getMessage)||void 0===e?void 0:e.call(i,t,null)},g={grid:{columns:[{name:"CODATA",orderIndex:0,width:0},{name:"DESCRICAO",orderIndex:1,width:0},{name:"ARQUIVO",orderIndex:2,width:0},{name:"DTALTER",orderIndex:3,width:0},{name:"USUARIO",orderIndex:4,width:0}]},form:{emptyConfig:!1,fields:[{name:"DESCRICAO",label:b("snkAttach.attachMetadata.lblDescription"),visible:!0,readOnly:!1,required:!0},{name:"CAMINHO_ARQUIVO",label:b("snkAttach.attachMetadata.lblFile"),visible:!0,readOnly:!1,required:!0}]}},N={name:"Attach",label:"Attach List",fields:[{name:"CODATA",label:b("snkAttach.attachMetadata.lblCode"),dataType:s.TEXT},{name:"DESCRICAO",label:b("snkAttach.attachMetadata.lblDescription"),dataType:s.TEXT,readOnly:!1},{name:"ARQUIVO",label:b("snkAttach.attachMetadata.lblFileOrLink"),dataType:s.TEXT},{name:"USUARIO",label:b("snkAttach.attachMetadata.lblUser"),dataType:s.TEXT},{name:"DTALTER",label:b("snkAttach.attachMetadata.lblDate"),dataType:s.TEXT},{name:"CAMINHO_ARQUIVO",label:b("snkAttach.attachMetadata.lblFileUpload"),dataType:s.OBJECT,userInterface:o.FILE,readOnly:!1,required:!0,visible:!0,properties:{subTitle:b("snkAttach.attachMetadata.lblSubTitle"),MAX_FILES:1,STORAGESTRATEGY:"SESSION",INTERNAL_FILENAME:"Attach.upload"}}]};class E{constructor(t){this.getMessage=t,this._records=[],this._application=a.getContextValue("__SNK__APPLICATION__")}initLoaders(t,i,e){t.metadataLoader=t=>this.metadataLoader(t),t.dataLoader=(t,i)=>this.dataLoader(t,i),t.saveLoader=(t,a)=>this.saveLoader(a,i).then((t=>(t.length&&e(),t))),t.removeLoader=(t,a)=>this.removeLoader(t,a,i).then((t=>(t.length&&e(),t)))}metadataLoader(t){return Promise.resolve(N)}async dataLoader(t,i){if(!i.source)return Promise.resolve({records:this._records});if(!Number.isNaN(Number(i.source))){const t={criteria:{codata:i.source,tipoAnexo:"N"}},e=await this._application.getDataFetcher(),{anexos:{anexo:a=[]}}=await e.callServiceBroker("Attach.load",JSON.stringify(t)),s=[];a.forEach((t=>{s.push(Object.assign({__record__id__:r.generateUUID(),CAMINHO_ARQUIVO:[{name:null==t?void 0:t.ARQUIVO}]},t))})),this._records=s}return l.buildLoadDataResponse(this._records,t,i)}saveLoader(t,i){return new Promise((e=>{const a=Array.isArray(t)?t[0]:{};i.save(a).then(e).catch((t=>t.message===c.DESCRIPTION_CANNOT_BE_CHANGED?(this._application.alert(this.getMessage("snkAttach.alertValidation.descriptionCannotBeChanged.title"),this.getMessage("snkAttach.alertValidation.descriptionCannotBeChanged.message")),e([])):t.message===c.LINK_AND_FILE_AT_THE_SAME_TIME?(this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),e([])):t.message===c.ANY_LINK_OR_FILE_FILLED?(this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),e([])):t.message?(this._application.error(t.title||t.name,t.message),e([])):void e([])))}))}removeLoader(t,i,e){return new Promise((a=>{t.getSelectionInfo().records.forEach((async t=>{this._application.hasAccess(O.REMOVE).then((async s=>{s&&(await e.delete(t),a(i))}))}))}))}getFilters(){throw new Error("Method not implemented.")}getInterceptions(t,i,e){return new Promise((a=>{var s,o,r,l,d,h;switch(i.type){case n.EDITION_CANCELED:return t.isDirty()?this._application.confirm(this.getMessage("snkAttach.cancelConfirmation.title"),this.getMessage("snkAttach.cancelConfirmation.message")).then((t=>t?(e.goToView(A.GRID),a(i)):a(void 0))):a(i);case n.DATA_SAVED:return t.loadData(void 0,void 0,!1,null===(r=null===(o=null===(s=null==i?void 0:i.payload)||void 0===s?void 0:s.records)||void 0===o?void 0:o[0])||void 0===r?void 0:r.REGISTER_KEY),a(i);case n.RECORDS_REMOVED:return t.loadData(void 0,void 0,!1,null===(h=null===(d=null===(l=null==i?void 0:i.payload)||void 0===l?void 0:l.cachedRecords)||void 0===d?void 0:d[0])||void 0===h?void 0:h.CODATA),a(i)}a(i)}))}}const C=a.getContextValue("__SNK__APPLICATION__"),L=t=>{var i,e;return null===(e=null===(i=null==C?void 0:C.messagesBuilder)||void 0===i?void 0:i.getMessage)||void 0===e?void 0:e.call(i,t,null)},T={DOWNLOAD:{hint:L("snkAttach.taskbar.titleDownload"),name:"DOWNLOAD",iconName:"file-download"},LINK:{hint:L("snkAttach.taskbar.titleLink"),name:"LINK",iconName:"launch"}},R=()=>{const t=[p.REMOVE,"DOWNLOAD","LINK"];return{getButtons:(t,i,e)=>{const a=e.indexOf(p.REFRESH);if((null==i?void 0:i.insertionMode)||(null==i?void 0:i.isDirty))return e.reverse();-1!==a&&e.splice(a,1);const{selectedRecord:s}=i||{},n=(null==s?void 0:s.LINK)?T.LINK:T.DOWNLOAD;e.splice(e.indexOf(p.DIVIDER)+1,0,p.REMOVE,n,p.DIVIDER);const o=[p.CLONE,p.DATA_EXPORTER],r=Array.from(new Set(e.filter((t=>!o.includes(t)))));return r.splice(r.indexOf(n)+1,0,p.DIVIDER),r},isEnabled:(i,e,a)=>{const s=void 0!==(null==e?void 0:e.selectedRecord);return!(t.includes(a)&&!s)}}},x={grid:{columns:[{name:"ARQUIVOOULINK",orderIndex:0,width:0},{name:"DESCRICAO",orderIndex:1,width:0},{name:"DHCAD",orderIndex:2,width:0},{name:"DHALTER",orderIndex:3,width:0},{name:"TIPOAPRES",orderIndex:4,width:0},{name:"TIPOACESSO",orderIndex:5,width:0},{name:"CODUSU",orderIndex:6,width:0},{name:"CODUSUALT",orderIndex:7,width:0}]},form:{emptyConfig:!1,fields:[{name:"DESCRICAO",required:!0},{name:"TIPOAPRES",required:!0},{name:"TIPOACESSO",required:!0},{name:"LINK"},{name:"NOMEARQUIVO"}]}},P=class{constructor(e){t(this,e),this.back=i(this,"back",7),this.handleTaskbarClick=async({detail:t})=>{if(["DOWNLOAD","LINK"].includes(t))return this.downloadAttachment(this._currentDataUnit.getSelectedRecord());"Attach"===this.fetcherType&&["SAVE"].includes(t)&&this._currentDataUnit.isDirty()&&await this._currentDataUnit.setFieldValue("REGISTER_KEY",this.registerKey)},this.handleBack=()=>{this._currentDataUnit.cancelEdition().then((t=>{t&&this.back.emit()}))},this.handleFinish=()=>{if(!this._currentDataUnit.isDirty())return this.back.emit();this.validateAnexoSistema()&&this._currentDataUnit.saveData().then((()=>{this.showFinishedToast(),this.back.emit()}))},this.gridLegacyConfigName=void 0,this.fetcherType=void 0,this.fetcher=void 0,this.dataUnit=void 0,this.dataUnitBuilder=void 0,this.registerKey=void 0,this.entityName=void 0,this.messagesBuilder=void 0,this._currentFetcher=void 0,this._currentDataUnit=void 0,this.crudConfig=void 0}async registerKeyWatcher(t,i){var e;null==this._currentDataUnit&&this.loadAttachmentDataUnit(),i!==t&&(this._currentFetcher instanceof _&&(this._currentFetcher.registerKey=t),await(null===(e=this._currentDataUnit)||void 0===e?void 0:e.loadData()))}getAnexoSistemaFetcherInstance(){var t;const i=new _(this.entityName,null===(t=this._currentDataUnit)||void 0===t?void 0:t.name);return i.registerKey=this.registerKey,i}async initAttach(){var t,i,e,a,s;if(this.fetcherType||this.registerKey){if(this.fetcherType||(this.fetcherType="AnexoSistema"),this.returnToGridMode(),"AnexoSistema"===this.fetcherType)return this._currentFetcher=this.getAnexoSistemaFetcherInstance(),null===(t=this._currentDataUnitBuilder)||void 0===t||t.initLoaders(this._currentDataUnit,this._currentFetcher,this.returnToGridMode.bind(this)),void await(null===(i=this._currentDataUnit)||void 0===i?void 0:i.loadData());if("Attach"===this.fetcherType&&(null===(e=this.registerKey)||void 0===e?void 0:e.split("_").length)>1)return;await(null===(a=this._currentDataUnit)||void 0===a?void 0:a.loadMetadata()),await(null===(s=this._currentDataUnit)||void 0===s?void 0:s.loadData(void 0,void 0,!0,this.registerKey))}}getMessage(t,i){if(this.messagesBuilder)return this.messagesBuilder.getMessage(t,i)}showFinishedToast(){this._application.info(this.getMessage("snkAttach.finishedMessage"),{iconName:"check"})}downloadAttachment(t){if(!t)throw new Error("Nenhum registro selecionado");t.LINK?window.open(`${t.LINK}`):this._currentFetcher.getDownloadKey(t).then((({chave:i})=>{var e;let a=!1;(null===(e=null==t?void 0:t.ARQUIVO)||void 0===e?void 0:e.endsWith(".pdf"))||(a=!0),window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${i.valor}${a?"&forcarDownload=S":""}`)}))}returnToGridMode(){var t;null===(t=this._currentDataUnit)||void 0===t||t.clearSelection(),this._crudElement&&this._crudElement.goToView(A.GRID)}async loadAttachmentDataUnit(){try{switch(this.fetcherType){case"AnexoSistema":await this.loadAnexoSistema();break;case"Attach":await this.loadAttach();break;default:this._currentFetcher=this.fetcher,this._currentDataUnit=this.dataUnit,this._currentDataUnitBuilder=this.dataUnitBuilder}}catch(t){throw new Error("There was an error while creating the data unit")}}async loadAnexoSistema(){var t,i;let e;this._currentDataUnit=(new u).getDataUnit("AnexoSistema","br.com.sankhya.core.v3.anexoSistema"),this._currentFetcher=this.getAnexoSistemaFetcherInstance(),this._currentDataUnit.metadata||(await(null===(t=this._currentDataUnit)||void 0===t?void 0:t.loadMetadata()),this.crudConfig=this.entityName?{form:null==x?void 0:x.form}:Object.assign({},x),e={grid:null==x?void 0:x.grid}),this.initDataUnitLoaders(),this._currentDataUnit.addFilterProvider({getFilter:()=>this._currentDataUnitBuilder.getFilters(this.registerKey)}),this._currentDataUnit.addInterceptor({interceptAction:t=>this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit,t,this._crudElement)}),await(null===(i=this._currentDataUnit)||void 0===i?void 0:i.loadData()),this.disableEditFieldsNotInForm(e)}async loadAttach(){var t,i;let e;this._currentFetcher=new w,this._currentDataUnit=new d(m.IN_MEMORY_DATA_UNIT_NAME),this._currentDataUnit.pageSize=150,this.initDataUnitLoaders(),this._currentDataUnit.addInterceptor({interceptAction:t=>{var i;return t.type===n.METADATA_LOADED&&(this.crudConfig=this.entityName?{form:null==g?void 0:g.form}:Object.assign({},g),e={grid:null==g?void 0:g.grid},null===(i=this._crudElement)||void 0===i||i.updateConfig()),this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit,t,this._crudElement)}}),this._currentDataUnit.metadata||(await(null===(t=this._currentDataUnit)||void 0===t?void 0:t.loadMetadata()),this.crudConfig=this.entityName?{form:null==g?void 0:g.form}:Object.assign({},g),e={grid:null==g?void 0:g.grid},await(null===(i=this._currentDataUnit)||void 0===i?void 0:i.loadData(void 0,void 0,!0,this.registerKey)),this.disableEditFieldsNotInForm(e))}initDataUnitLoaders(){var t,i;"AnexoSistema"===this.fetcherType&&(this._currentFetcher=this.getAnexoSistemaFetcherInstance(),this._currentDataUnitBuilder=new f(this.entityName,this.getMessage.bind(this)),null===(t=this._currentDataUnitBuilder)||void 0===t||t.initLoaders(this._currentDataUnit,this._currentFetcher,this.returnToGridMode.bind(this))),"Attach"===this.fetcherType&&(this._currentFetcher=new w,this._currentDataUnitBuilder=new E(this.getMessage.bind(this)),null===(i=this._currentDataUnitBuilder)||void 0===i||i.initLoaders(this._currentDataUnit,this._currentFetcher,(async()=>{this.returnToGridMode(),await this._currentDataUnit.loadData(void 0,void 0,!0,this.registerKey)})))}disableEditFieldsNotInForm(t){var i,e,a,s,n;const o=(null===(e=null===(i=this._crudElement)||void 0===i?void 0:i.gridConfig)||void 0===e?void 0:e.columns)||(null===(a=null==t?void 0:t.grid)||void 0===a?void 0:a.columns)||(null===(n=null===(s=this.crudConfig)||void 0===s?void 0:s.grid)||void 0===n?void 0:n.columns);this.getGridLegacyConfigName()&&this._currentDataUnit.disableField("ARQUIVOOULINK"),null==o||o.forEach((t=>{var i,e;const a=t.name;(null===(e=null===(i=this.crudConfig)||void 0===i?void 0:i.form)||void 0===e?void 0:e.fields.some((t=>(null==t?void 0:t.name)===a)))||this._currentDataUnit.disableField(a)}))}validateAnexoSistema(){var t;if(this._currentFetcher instanceof _)try{let i=this._currentDataUnit.getSelectedRecord();i=Object.assign(Object.assign({},i),{NOMEARQUIVO:null===(t=i.NOMEARQUIVO)||void 0===t?void 0:t[0]}),this._currentFetcher.validateFields(i)}catch(t){if(t.message===c.LINK_AND_FILE_AT_THE_SAME_TIME)return this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),!1;if(t.message===c.ANY_LINK_OR_FILE_FILLED)return this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),!1}return!0}async componentWillLoad(){this._application=a.getContextValue("__SNK__APPLICATION__"),await this.initAttach()}componentWillRender(){this.fetcherType||(this.fetcherType="AnexoSistema"),null==this._currentDataUnit&&this.loadAttachmentDataUnit()}async handleOnDataStateChange({detail:t}){"Attach"===this.fetcherType&&(t.insertionMode?this._currentDataUnit.enableField("DESCRICAO"):this._currentDataUnit.disableField("DESCRICAO"),await this._currentDataUnit.loadMetadata())}getGridLegacyConfigName(){return this.gridLegacyConfigName?this.gridLegacyConfigName:this.entityName?"GrdCfgHtml5:grdcfg.dynaform.anexo."+this.entityName:this.entityName}render(){var t,i;return this._currentDataUnit?e("main",{class:"snk-attach__main"},e("header",{class:"snk-attach__header"},e("snk-simple-bar",{onExit:this.handleBack,messagesBuilder:this.messagesBuilder},e("div",{slot:"rightSlot"},e("ez-button",{class:"ez-button--primary",label:this.getMessage("snkAttach.finish"),onClick:this.handleFinish})))),e("div",{class:"snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column"},e("div",{class:"ez-box__container"},e("snk-simple-crud",{ref:t=>this._crudElement=t,dataUnit:this._currentDataUnit,taskbarManager:R(),gridConfig:null===(t=this.crudConfig)||void 0===t?void 0:t.grid,formConfig:null===(i=this.crudConfig)||void 0===i?void 0:i.form,useCancelConfirm:!1,onActionClick:this.handleTaskbarClick,messagesBuilder:this.messagesBuilder,onDataStateChange:this.handleOnDataStateChange.bind(this),multipleSelection:!0,configName:this.entityName,ignoreReadOnlyFormFields:!!this.entityName,gridLegacyConfigName:this.getGridLegacyConfigName()},e("div",{slot:"snkSimpleCrudHeader"},e("div",{class:"ez-flex ez-flex--column"},e("span",{class:"ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium"},this.getMessage("snkAttach.title")),e("span",{class:"ez-text ez-text--medium ez-text--secondary ez-padding-bottom--medium"},this.getMessage("snkAttach.description")))))))):null}static get watchers(){return{registerKey:["registerKeyWatcher"]}}};P.style=".snk-attach__header.sc-snk-attach,.snk-attach__crud-section.sc-snk-attach{padding:0 var(--space--lg)}.snk-attach__file-info.sc-snk-attach{padding:var(--space--small);max-width:50%}.snk-attach__main.sc-snk-attach{height:85%}.ez-box__container.sc-snk-attach{height:100%}";export{P as snk_attach}
@@ -1 +1 @@
1
- import{r as i,c as s,h as e,H as t,g as o}from"./p-d8d8169b.js";import{S as d}from"./p-51833248.js";import{I as a}from"./p-35e73c5d.js";import{ArrayUtils as l}from"@sankhyalabs/core";import"./p-9019a32f.js";const n=class{constructor(e){i(this,e),this.fieldListChanged=s(this,"fieldListChanged",7),this.availableFields=[],this.dataUnit=void 0,this.filterTerm=""}onAddField(i){const s=this.addItemInPosition(i.newIndex,i.item.fieldConfig);this.fieldListChanged.emit(s)}addItemInPosition(i,s){return[...this.availableFields.slice(0,i),s,...this.availableFields.slice(i)]}onRemoveField(i){const s=i.item,e=s.fieldConfig.name,t=[...this.availableFields.filter((i=>i.name!==e))];this.fieldListChanged.emit(t),requestAnimationFrame((()=>s.remove()))}renderFields(){return l.applyStringFilter(this.filterTerm,this.availableFields).map((i=>e("field-item",{key:i.name,dataUnit:this.dataUnit,fieldConfig:i})))}getCountText(){return this.availableFields.length?1===this.availableFields.length?"1 campo disponível":`${this.availableFields.length} campos disponíveis`:"Nenhum campo disponível"}initializeDraggableContainer(){new d(this.el.querySelector(`#${a}`),{group:"fields",direction:"vertical",ghostClass:"ghost",animation:15,onAdd:i=>this.onAddField(i),onRemove:i=>this.onRemoveField(i)})}componentDidRender(){this.initializeDraggableContainer()}render(){return e(t,{class:"ez-col ez-col--sd-4 ez-col--tb-4 ez-padding--medium"},e("span",{class:"fields-label ez-padding-bottom--small"},"Campos disponíveis"),e("ez-filter-input",{slot:"content",mode:"slim",label:"Buscar campo",onEzChange:i=>this.filterTerm=i.detail}),e("span",{class:"fields-count"},this.getCountText()),e("ez-scroller",{direction:"vertical",activeShadow:!0},e("div",{id:a,class:"fields-container"},this.renderFields())))}get el(){return o(this)}};n.style=".sc-fields-selector-h{width:33.33333%;display:flex;box-shadow:var(--shadow--small, 0 0 16px rgba(0, 38, 111, 0.07));border-radius:var(--border--radius-medium, 6px);height:var(--snk-form-config-container-height);max-width:260px}.fields-label.sc-fields-selector{display:block;font-size:16px;font-weight:500;width:100%}.fields-count.sc-fields-selector{display:block;color:#AFB6C0;font-size:14px;padding:12px 0;font-weight:400;width:100%}.fields-container.sc-fields-selector{display:flex;flex-direction:column;gap:12px;height:calc(100vh - 220px);width:100%}.ghost.sc-fields-selector{opacity:.5;background:#c8fbe2}";export{n as fields_selector}
1
+ import{r as i,c as s,h as e,H as t,g as o}from"./p-d8d8169b.js";import{S as a}from"./p-51833248.js";import{I as d}from"./p-35e73c5d.js";import{ArrayUtils as l}from"@sankhyalabs/core";import"./p-9019a32f.js";const n=class{constructor(e){i(this,e),this.fieldListChanged=s(this,"fieldListChanged",7),this.availableFields=[],this.dataUnit=void 0,this.filterTerm=""}onAddField(i){const s=this.addItemInPosition(i.newIndex,i.item.fieldConfig);this.fieldListChanged.emit(s)}addItemInPosition(i,s){return[...this.availableFields.slice(0,i),s,...this.availableFields.slice(i)]}onRemoveField(i){const s=i.item,e=s.fieldConfig.name,t=[...this.availableFields.filter((i=>i.name!==e))];this.fieldListChanged.emit(t),requestAnimationFrame((()=>s.remove()))}renderFields(){return l.applyStringFilter(this.filterTerm,this.availableFields).map((i=>e("field-item",{key:i.name,dataUnit:this.dataUnit,fieldConfig:i})))}getCountText(){return this.availableFields.length?1===this.availableFields.length?"1 campo disponível":`${this.availableFields.length} campos disponíveis`:"Nenhum campo disponível"}initializeDraggableContainer(){new a(this.el.querySelector(`#${d}`),{group:"fields",direction:"vertical",ghostClass:"ghost",animation:15,onAdd:i=>this.onAddField(i),onRemove:i=>this.onRemoveField(i)})}componentDidRender(){this.initializeDraggableContainer()}render(){return e(t,{class:"ez-col ez-col--sd-4 ez-col--tb-4 ez-padding--medium"},e("span",{class:"fields-label ez-padding-bottom--small"},"Campos disponíveis"),e("ez-filter-input",{class:"filter-input",slot:"content",mode:"slim",label:"Buscar campo",onEzChange:i=>this.filterTerm=i.detail}),e("span",{class:"fields-count"},this.getCountText()),e("ez-scroller",{direction:"vertical",activeShadow:!0},e("div",{id:d,class:"fields-container"},this.renderFields())))}get el(){return o(this)}};n.style=".sc-fields-selector-h{width:33.33333%;display:flex;box-shadow:var(--shadow--small, 0 0 16px rgba(0, 38, 111, 0.07));border-radius:var(--border--radius-medium, 6px);height:var(--snk-form-config-container-height);max-width:260px}.fields-label.sc-fields-selector{display:block;font-size:16px;font-weight:500;width:100%}.fields-count.sc-fields-selector{display:block;color:#AFB6C0;font-size:14px;padding:12px 0;font-weight:400;width:100%}.fields-container.sc-fields-selector{display:flex;flex-direction:column;gap:12px;height:calc(100vh - 220px);width:100%}.ghost.sc-fields-selector{opacity:.5;background:#c8fbe2}.filter-input.sc-fields-selector{padding-right:var(--space--2xs, 8px)}";export{n as fields_selector}
@@ -0,0 +1 @@
1
+ import{r as i,c as e,f as t,h as s,H as l}from"./p-d8d8169b.js";import{UserInterface as a,StringUtils as n,ObjectUtils as o,ApplicationContext as h}from"@sankhyalabs/core";import{b as d,D as r,c as u}from"./p-9019a32f.js";import{getConvertedValue as c}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{CheckMode as p}from"@sankhyalabs/ezui/dist/collection/utils";import{e as f,f as v,h as b,i as m}from"./p-35e73c5d.js";const g=class{constructor(t){i(this,t),this.fieldConfigChanged=e(this,"fieldConfigChanged",7),this.fieldLabel=void 0,this.fieldLabelErrorMessage=void 0,this.fieldDefaultValue=void 0,this.fieldCleanOnCopy=void 0,this.fieldRequired=void 0,this.fieldReadOnly=void 0,this._defaultType=void 0,this.dataUnit=void 0,this.fieldConfig=void 0,this.fieldDescriptor=void 0,this.messagesBuilder=void 0}observeFieldLabel(){this.validateFieldLabel&&(this.fieldLabelErrorMessage=void 0)}async show(i){this._popoupElement.opened=!0,this.initializeValues(),t(this)}validateFieldLabel(){var i;return!!(null===(i=this.fieldLabel)||void 0===i?void 0:i.trim())||(this.applyErrorMessage(),!1)}getMessage(i,e){return this.messagesBuilder.getMessage(i,e)}isAllowDefault(){var i;const e=null===(i=this.fieldDescriptor.properties)||void 0===i?void 0:i.allowDefault;return null==e||"true"===e}enabledValueDefault(){var i,e,t;const s=null===(i=this.fieldDescriptor.properties)||void 0===i?void 0:i.allowDefault;return(d.UserInterface.hasOwnProperty(null===(e=this.fieldDescriptor)||void 0===e?void 0:e.userInterface)||(null===(t=this.fieldDescriptor)||void 0===t?void 0:t.userInterface)===a.SEARCH)&&(null==s||"true"===s)}getDefaultType(){var i,e;return null!==(e=null===(i=this.fieldDefaultValue)||void 0===i?void 0:i.type)&&void 0!==e?e:r.fixed}emitFieldChanged(){this.fieldConfigChanged.emit(this.fieldConfig)}handleLabelChanged({detail:i}){this.fieldLabel=i}handleDefaultTypeChanged({detail:i}){const e=i.value;null!=e&&(this._defaultType=e,this.fieldDefaultValue={type:this._defaultType})}handleDefaultValueChanged({detail:i}){this.fieldDefaultValue.value=null==i?void 0:i.value}onChangeDefaultValue(i){this.fieldDefaultValue.value=f(i,this.dataUnit,this.fieldConfig.name)}handleClearDuplicateChanged({detail:i}){this.fieldCleanOnCopy=i}handleRequiredChanged({detail:i}){this.fieldRequired=i}handleReadOnlyChanged({detail:i}){this.fieldReadOnly=i}loadDefaultValue(){var i;(null===(i=this.fieldConfig.defaultValue)||void 0===i?void 0:i.type)?this._defaultType=this.fieldConfig.defaultValue.type:(this._defaultType=r.fixed,this.fieldConfig.defaultValue={type:this._defaultType})}buildOptions(){let i=this.fieldDescriptor.userInterface;return i===a.SEARCH&&(i=a.INTEGERNUMBER),d.UserInterface[i]}renderDefaultValueEditor(){return this._defaultType===r.variable?s("ez-combo-box",{label:this.getMessage("snkConfigOptions.label.valueDefault"),enabled:this.isAllowDefault(),onEzChange:i=>this.handleDefaultValueChanged(i),value:this.fieldDefaultValue.value,options:this.buildOptions()}):this.fieldDescriptor.userInterface&&this.buildFieldDefaultValueElement()}buildFieldDefaultValueElement(){var i;const{userInterface:e,properties:t,dataType:s}=this.fieldDescriptor;let l,o=n.getBooleanValue(null==t?void 0:t.allowDefault,!this.fieldReadOnly);e===a.FILE&&(o=!1),o&&(l=null===(i=this.fieldDefaultValue)||void 0===i?void 0:i.value,null!=l&&(l=c(s,l)));const h={value:l,enabled:o,label:this.fieldConfig.label,name:this.fieldConfig.name,required:this.fieldRequired,userInterface:e};switch(e){case a.SWITCH:return this.buildInputDefault(h,void 0,p.SWITCH);case a.CHECKBOX:return this.buildInputDefault(h,void 0,p.REGULAR);case a.OPTIONSELECTOR:case a.DECIMALNUMBER:return this.buildInputDefault(h,t);default:return this.buildInputDefault(h)}}buildInputDefault({value:i,enabled:e,label:t,name:l,required:n,userInterface:h},d,r){let c,p=0,f=0;const v=null==h||null==u[h]?u.DEFAULT:u[h];if(h===a.OPTIONSELECTOR){const i=null==d?void 0:d.options;if("string"==typeof i){const e=o.stringToObject(i);c=Object.keys(e).map((i=>({value:i,label:e[i]})))}else c=i}else h===a.DECIMALNUMBER&&(p=Number((null==d?void 0:d.precision)||2),f=Number((null==d?void 0:d.prettyPrecision)||p));return s(v,Object.assign({value:i,enabled:e,label:t,"data-field-name":l,key:l,onEzChange:i=>this.onChangeDefaultValue(null==i?void 0:i.detail)},this.getConditionalAttributes(h,n,c,p,f,r)))}getConditionalAttributes(i,e,t,s,l,n){const o=i==a.SEARCHPLUS;switch(i){case a.SEARCH:case a.SEARCHPLUS:return{suppressEmptyOption:e,optionLoader:i=>this.onSearchDefaultValue(i,{useSearchPlus:o})};case a.OPTIONSELECTOR:return{suppressEmptyOption:e,options:t};case a.CHECKBOX:case a.SWITCH:return{mode:n};case a.INTEGERNUMBER:case a.DECIMALNUMBER:return{precision:s,prettyPrecision:l,onEzStartChange:i=>this.onChangeDefaultValue(null==i?void 0:i.detail)};case a.DATE:case a.DATETIME:case a.TIME:return{onEzStartChange:i=>this.onChangeDefaultValue(null==i?void 0:i.detail)};default:return{}}}onSearchDefaultValue(i,e){if(this._application&&this.fieldConfig)return this._application.executeSearch(i,this.fieldConfig.name,this.dataUnit,e)}initializeValues(){this.fieldLabel=this.fieldConfig.label,this.fieldDefaultValue=this.fieldConfig.defaultValue,this.fieldRequired=this.fieldConfig.required,this.fieldReadOnly=this.fieldConfig.readOnly,this.fieldCleanOnCopy=this.fieldConfig.cleanOnCopy}handleApplyChanges(){this.validateFieldLabel()&&(this.fieldConfig.label=this.fieldLabel,this.fieldConfig.defaultValue=this.fieldDefaultValue,this.fieldConfig.required=this.fieldRequired,this.fieldConfig.readOnly=this.fieldReadOnly,this.fieldConfig.cleanOnCopy=this.fieldCleanOnCopy,this.emitFieldChanged(),this._popoupElement.opened=!1)}applyErrorMessage(){this.fieldLabelErrorMessage=`Informe um valor para ${this.getMessage("snkConfigOptions.label.nameField")}`}handleDiscardChanges(){this.initializeValues(),this._popoupElement.opened=!1}componentWillLoad(){this.loadDefaultValue(),this._application=h.getContextValue("__SNK__APPLICATION__")}render(){return s("ez-popup",{heightMode:"auto",size:"auto","ez-title":"Configuração do campo",onEzClosePopup:()=>this.handleDiscardChanges(),ref:i=>this._popoupElement=i},s("div",{class:"field-config-container"},s("ez-text-input",{label:this.getMessage("snkConfigOptions.label.nameField"),value:this.fieldLabel,errorMessage:this.fieldLabelErrorMessage,hasInvalid:!!this.fieldLabelErrorMessage,onEzChange:i=>this.handleLabelChanged(i)}),s("ez-combo-box",{label:this.getMessage("snkConfigOptions.label.typeValueDefault"),suppressEmptyOption:!0,enabled:this.enabledValueDefault(),onEzChange:i=>this.handleDefaultTypeChanged(i),value:this.getDefaultType()},s("option",{value:r.fixed},this.getMessage("snkConfigOptions.options.valueFixed")),s("option",{value:r.variable},this.getMessage("snkConfigOptions.options.variable"))),this.renderDefaultValueEditor(),s("ez-check",{label:this.getMessage("snkConfigOptions.label.clearDuplicate"),value:this.fieldCleanOnCopy,onEzChange:i=>this.handleClearDuplicateChanged(i)}),s("ez-check",{label:this.getMessage("snkConfigOptions.label.requiredField"),enabled:v("required","systemRequired",this.fieldDescriptor),value:b("required",this.fieldDescriptor,this.fieldRequired),onEzChange:i=>this.handleRequiredChanged(i)}),s("ez-check",{label:this.getMessage("snkConfigOptions.label.protectedField"),enabled:v("readOnly","systemReadOnly",this.fieldDescriptor),value:b("readOnly",this.fieldDescriptor,this.fieldReadOnly),onEzChange:i=>this.handleReadOnlyChanged(i)}),s("div",{class:"actions"},s("ez-button",{label:"Cancelar",onClick:()=>this.handleDiscardChanges()}),s("ez-button",{label:"Confirmar",class:"ez-button--primary",onClick:()=>this.handleApplyChanges()}))))}static get watchers(){return{fieldLabel:["observeFieldLabel"]}}};g.style=".field-config-container.sc-field-config{font-family:'Roboto';color:#2b3a54;display:flex;flex-direction:column;gap:10px;width:330px;justify-content:space-between}.header.sc-field-config{display:flex;font-weight:500;font-size:16px}.actions.sc-field-config{display:flex;align-items:flex-end;gap:12px}";const y=class{constructor(t){i(this,t),this.setFieldAsAvailable=e(this,"setFieldAsAvailable",7),this.addFieldToGuide=e(this,"addFieldToGuide",7),this.fieldDescriptor=void 0,this.fieldConfig=void 0,this.onLayoutConfig=!1,this.dataUnit=void 0,this.messagesBuilder=void 0}observeDataUnit(){this.loadFieldDescriptor()}isRequired(){var i,e;const t=this.dataUnit&&this.dataUnit.getField(null===(i=this.fieldConfig)||void 0===i?void 0:i.name);return!0===(null==t?void 0:t.required)||!0===(null===(e=this.fieldConfig)||void 0===e?void 0:e.required)}async showFieldConfig(){var i;await(null===(i=this._refFieldConfig)||void 0===i?void 0:i.show(this._editIconRef))}renderFieldConfig(){if(this.onLayoutConfig&&this.dataUnit&&this.messagesBuilder)return s("field-config",{ref:i=>this._refFieldConfig=i,fieldConfig:this.fieldConfig,dataUnit:this.dataUnit,fieldDescriptor:this.fieldDescriptor,messagesBuilder:this.messagesBuilder,onFieldConfigChanged:()=>t(this)})}renderActions(){return this.onLayoutConfig?s("div",{class:"actions hiddeble"},s("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:()=>this.setFieldAsAvailable.emit(this.fieldConfig),size:"medium",iconName:"minus",title:"Remover"}),s("ez-button",{ref:i=>this._editIconRef=i,mode:"icon",class:"ez-button--tertiary",onClick:this.showFieldConfig.bind(this),iconName:"edit",size:"medium",title:"Editar"})):s("div",{class:"actions hiddeble"},s("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:()=>this.addFieldToGuide.emit(this.fieldConfig),iconName:"plus",size:"medium",title:"Adicionar ao Layout"}))}loadFieldDescriptor(){this.dataUnit&&(this.fieldDescriptor=this.dataUnit.getField(this.fieldConfig.name))}renderRequiredMark(){if(this.isRequired())return s("span",{class:"required-mark"},"*")}componentWillLoad(){this.loadFieldDescriptor()}getFieldLabel(){var i,e;return(null===(i=this.fieldConfig)||void 0===i?void 0:i.label)?this.fieldConfig.label:null===(e=this.fieldDescriptor)||void 0===e?void 0:e.label}render(){var i;return s(l,{class:this.onLayoutConfig?"":"full-width"},s("div",{class:"icons"},s("ez-icon",{iconName:"drag-indicator"}),s("ez-icon",{iconName:m(null===(i=this.fieldDescriptor)||void 0===i?void 0:i.userInterface)})),s("span",{class:"label"},s("span",{class:"label-text",title:this.getFieldLabel()},this.getFieldLabel()),this.renderRequiredMark()),this.renderActions(),this.renderFieldConfig())}static get watchers(){return{dataUnit:["observeDataUnit"]}}};y.style=".sc-field-item-h{width:100%;display:flex;padding:12px 8px;border-radius:var(--border--radius-small, 4px);border:1px solid #dce0e8;cursor:grab;align-items:center;height:42px;max-height:42px;background:#FAFCFF}.full-width.sc-field-item-h{width:100%}ez-icon.sc-field-item{--ez-icon--color:#A2ABB9}.icons.sc-field-item{display:flex}.label.sc-field-item{display:flex;flex-grow:1;padding-left:8px;font-size:14px;align-items:center;gap:4px;height:22px}.label-text.sc-field-item{overflow:hidden;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;height:auto;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;display:-webkit-box;-o-text-overflow:ellipsis;text-overflow:ellipsis;word-break:break-word}.required-mark.sc-field-item{color:#cf3105;background:#F7E0E5;width:12px;height:12px;border-radius:50%;display:flex;align-items:center;justify-content:center;padding-top:5px;font-size:16px;align-self:self-start}.actions.sc-field-item{display:flex;flex-direction:row;align-content:center;gap:4px}ez-button.sc-field-item{width:24px;align-items:center;justify-content:center;display:flex}.sc-field-item-h .hiddeble.sc-field-item{transition:0.2s ease-in-out;visibility:hidden;opacity:0}.sc-field-item-h:hover .hiddeble.sc-field-item{visibility:visible;opacity:1}";export{g as field_config,y as field_item}
@@ -1 +1 @@
1
- import{p as e,b as a}from"./p-d8d8169b.js";export{s as setNonce}from"./p-d8d8169b.js";(()=>{const a=import.meta.url,t={};return""!==a&&(t.resourcesUrl=new URL(".",a).href),e(t)})().then((e=>a(JSON.parse('[["p-7345782c",[[2,"snk-actions-form",{"action":[16],"applyParameters":[16],"dataUnit":[32],"openPopup":[64]}]]],["p-180716b2",[[2,"snk-client-confirm",{"titleMessage":[1,"title-message"],"message":[1],"accept":[16],"cancel":[16],"openPopup":[64]}]]],["p-667cab42",[[6,"snk-custom-slot-elements",{"slotName":[1,"slot-name"]}]]],["p-e824d565",[[2,"snk-entity-list",{"config":[1040],"rightListSlotBuilder":[1040],"maxHeightList":[1,"max-height-list"],"_searchValue":[32],"_ezListSource":[32],"reloadList":[64]}]]],["p-a76e6d51",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"presentationMode":[2,"presentation-mode"],"resetValues":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-dff65083",[[0,"snk-filter-checkbox-list",{"config":[1040],"optionsList":[32]}]]],["p-c6a8a8bc",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-d67526b6",[[0,"snk-filter-number",{"config":[16],"getMessage":[16],"value":[2],"presentationMode":[2,"presentation-mode"],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-49d968e2",[[0,"snk-filter-period",{"config":[16],"getMessage":[16],"value":[8],"presentationMode":[2,"presentation-mode"],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-9fd87bfd",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-398cdd67",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-83c100f2",[[2,"snk-personalized-filter-editor",{"messagesBuilder":[1040],"presentationMode":[2,"presentation-mode"],"config":[16],"value":[1040],"items":[32],"show":[64]}]]],["p-3d41f5a8",[[2,"snk-print-selector",{"_printServerActive":[32],"_selectedPrinter":[32],"_remotePrintersDataSource":[32],"_localPrintersDataSource":[32],"_printJobData":[32],"openPrintSelector":[64]}]]],["p-afffa6cb",[[2,"pesquisa-grid",{"metadata":[16],"dataSource":[16],"pkField":[1,"pk-field"],"descriptionField":[1,"description-field"],"entityName":[1,"entity-name"],"shouldLoadConfig":[4,"should-load-config"],"_gridConfig":[32],"_inMemoryLoader":[32],"_dataunit":[32]}],[2,"pesquisa-tree",{"treeLoader":[16],"argument":[1025],"allowsNonAnalytic":[4,"allows-non-analytic"],"shouldLoadTree":[4,"should-load-tree"],"items":[32],"applyFilter":[64]}]]],["p-1456d7cb",[[2,"snk-pesquisa",{"searchLoader":[16],"treeLoader":[16],"selectItem":[16],"entityName":[1,"entity-name"],"argument":[1025],"isHierarchyEntity":[4,"is-hierarchy-entity"],"allowsNonAnalytic":[4,"allows-non-analytic"],"_itemList":[32],"_startLoading":[32],"_presentationMode":[32],"_currentView":[32],"_valideDataSource":[32]}]]],["p-3d452f27",[[2,"snk-application",{"enableLockManagerLoadingApp":[4,"enable-lock-manager-loading-app"],"messagesBuilder":[1040],"configName":[1,"config-name"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"loadByPK":[16],"_applicationReady":[32],"_templateSkeleton":[32],"_activeScrimWindow":[32],"getKeyboardManager":[64],"getLayoutFormConfig":[64],"isUserSup":[64],"addPendingAction":[64],"callServiceBroker":[64],"initOnboarding":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"showAlerts":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"webConnection":[64],"createDataunit":[64],"updateDataunitCache":[64],"getDataUnit":[64],"addClientEvent":[64],"removeClientEvent":[64],"hasClientEvent":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadTotals":[64],"isLoadedByPk":[64],"preloadMangerRemoveRecord":[64],"executeSearch":[64],"executePreparedSearchPlus":[64],"executePreparedSearch":[64],"isDebugMode":[64],"getAppLabel":[64],"addSearchListener":[64],"importScript":[64],"getApplicationPath":[64],"executeSelectDistinct":[64],"getDataFetcher":[64],"whenApplicationReady":[64],"setSearchFilterContext":[64],"clearPopUpTitle":[64],"setPopUpTitle":[64],"showScrimApp":[64],"markToReload":[64],"addLoadingLock":[64]}]]],["p-27482793",[[1,"teste-pesquisa"]]],["p-60dd1d27",[[2,"snk-default-filter",{"getMessage":[16],"hasDefaultFilter":[4,"has-default-filter"],"_opened":[32]}]]],["p-c926cf6b",[[0,"snk-filter-modal-item",{"filterItem":[1040],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"]}]]],["p-c3324d79",[[2,"field-item",{"fieldConfig":[8,"field-config"],"onLayoutConfig":[4,"on-layout-config"],"dataUnit":[16],"messagesBuilder":[1040],"fieldDescriptor":[32]}],[2,"field-config",{"dataUnit":[16],"fieldConfig":[1544,"field-config"],"fieldDescriptor":[16],"messagesBuilder":[1040],"fieldLabel":[32],"fieldLabelErrorMessage":[32],"fieldDefaultValue":[32],"fieldCleanOnCopy":[32],"fieldRequired":[32],"fieldReadOnly":[32],"_defaultType":[32],"show":[64]}]]],["p-349d1968",[[2,"fields-layout",{"selectedGuide":[16],"groupsList":[16],"guideNames":[16],"dataUnit":[16],"messagesBuilder":[1040],"isEditGuideNameActive":[32],"addFieldToLayout":[64]},[[16,"fieldConfigChanged","handleFieldConfigChanged"]]]]],["p-9751c42f",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"messagesBuilder":[1040],"formLegacyConfigName":[1,"form-legacy-config-name"],"resourceID":[1,"resource-i-d"],"_dataUnit":[32],"_dataState":[32],"_showFormConfig":[32],"_configManager":[32],"showConfig":[64],"hideConfig":[64],"addCustomEditor":[64],"setFieldProp":[64]}],[2,"snk-form-config",{"dataUnit":[16],"configManager":[16],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"messagesBuilder":[1040],"availableFields":[32],"guidesList":[32],"groupsList":[32],"selectedGuide":[32],"_formConfig":[32],"configOptions":[32],"originalConfigSelected":[32],"configSelected":[32],"hasChanges":[32],"optionConfigChanged":[32]},[[16,"fieldConfigChanged","handleFieldConfigChanged"],[16,"formConfigOptionSelected","handleFormConfigOptionSelected"],[16,"addFieldToGuide","handleAddFieldToGuide"],[16,"setFieldAsAvailable","handleSetFieldAsAvailable"],[16,"removeFieldFromAvailable","handleRemoveFieldFromAvailable"]]]]],["p-2fdac5e6",[[2,"snk-form-summary",{"fixed":[1540],"contracted":[1540],"summary":[16]}]]],["p-0024d3fd",[[6,"snk-form-view",{"levelPath":[1,"level-path"],"fieldSearch":[16],"label":[1],"name":[1],"fields":[16],"formMetadata":[8,"form-metadata"],"dataUnit":[16],"contracted":[4],"fixed":[1540],"summaryFields":[16],"canExpand":[4,"can-expand"],"canFix":[4,"can-fix"],"recordsValidator":[16],"fieldToFocus":[1,"field-to-focus"],"customEditors":[16],"fieldsProps":[16],"showUp":[64],"addCustomEditor":[64],"setFieldProp":[64],"showSearchField":[64]}]]],["p-a06bf7b9",[[2,"fields-selector",{"availableFields":[16],"dataUnit":[16],"filterTerm":[32]}]]],["p-a5bb2f93",[[2,"snk-personalized-filter",{"messagesBuilder":[1040],"entityUri":[1025,"entity-uri"],"filterId":[1025,"filter-id"],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"],"isDefaultFilter":[4,"is-default-filter"],"_filterAssistentMode":[32],"_filterAssistent":[32],"createPersonalizedFilter":[64]}]]],["p-7e250432",[[2,"configs-button",{"configOptions":[16],"selectedConfig":[16],"hasChanges":[4,"has-changes"],"messagesBuilder":[1040]}]]],["p-4d2ff2fb",[[2,"config-header",{"configOptions":[16],"selectedConfig":[16],"messagesBuilder":[1040],"hasChanges":[4,"has-changes"],"optionConfigChanged":[4,"option-config-changed"],"isEditingGuide":[32],"isEditingGroup":[32]},[[16,"isEditingGuideName","handleIsEditingGuideName"],[16,"isEditingGroupName","handleIsEditingGroupName"]]]]],["p-86bd4478",[[2,"guides-configurator",{"guidesList":[16],"selectedGuide":[16],"messagesBuilder":[1040],"mainGuide":[32],"filterTerm":[32],"visibleGuides":[32],"hiddenGuides":[32]}]]],["p-9ad3557c",[[2,"snk-configurator",{"showActionButtons":[4,"show-action-buttons"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"viewMode":[2,"view-mode"],"customContainerId":[1,"custom-container-id"],"layoutFormConfig":[4,"layout-form-config"],"messagesBuilder":[1040],"_opened":[32],"_permissions":[32],"open":[64],"close":[64]}]]],["p-aa72089a",[[2,"snk-data-unit",{"dataState":[1040],"messagesBuilder":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"useCancelConfirm":[4,"use-cancel-confirm"],"ignoreSaveMessage":[4,"ignore-save-message"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"domainMessagesBuilder":[1,"domain-messages-builder"],"fieldsToLink":[32],"getDataUnit":[64],"getSelectedRecordsIDsInfo":[64],"getFieldsWithRmp":[64],"getFieldsWithRmPrecision":[64],"getRowMetadata":[64]},[[0,"snkMasterFormConfigChange","onMasterFormConfigChange"]]]]],["p-90805683",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"showHardFixed":[4,"show-hard-fixed"],"show":[64]}]]],["p-9a63f3f7",[[0,"snk-exporter-email-sender",{"getMessage":[16],"_config":[32],"_opened":[32],"_currentStep":[32],"open":[64],"close":[64]}]]],["p-05f3a2da",[[2,"snk-data-exporter",{"provider":[16],"messagesBuilder":[1040],"_items":[32],"_showDropdown":[32]}]]],["p-471b34f4",[[2,"snk-filter-field-search",{"searchable":[4],"fieldsDataSource":[16],"breadcrumbItems":[32],"linkItems":[32],"fieldItems":[32],"searchEmpty":[32],"groupEmpty":[32],"show":[64],"applyFilter":[64]}],[0,"snk-filter-param-config",{"messagesBuilder":[1040],"_opened":[32],"_configType":[32],"_expressionItem":[32],"_informedInstance":[32],"_canSave":[32],"open":[64],"close":[64]}]]],["p-71a05822",[[2,"snk-expression-group",{"parentTop":[1026,"parent-top"],"group":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityURI":[1025,"entity-u-r-i"],"isDefaultFilter":[4,"is-default-filter"],"_conditionOperator":[32],"_group":[32],"_selfTop":[32],"canAddExpression":[32],"_showDashes":[32],"getExpressionGroup":[64]},[[8,"ezExpressionLayoutChanged","todoCompletedHandler"]]],[2,"snk-expression-item",{"expression":[16],"canRemove":[516,"can-remove"],"messagesBuilder":[1040],"isDefaultFilter":[4,"is-default-filter"],"entityURI":[1025,"entity-u-r-i"],"_showValueVariable":[32],"_fieldSelected":[32],"_optionNotNull":[32]}]]],["p-3bf2f5cd",[[0,"snk-simple-form-config",{"dataUnit":[16],"configName":[1,"config-name"],"avaliableFields":[32],"selectedFields":[32],"show":[64]}],[2,"snk-grid-config",{"selectedIndex":[1026,"selected-index"],"columns":[1040],"config":[1040],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"_collapsibleBoxListOrder":[32],"_collapsibleBoxListSelect":[32]}],[2,"snk-layout-form-config",{"layoutType":[32],"save":[64]}],[2,"snk-actions-button",{"_items":[32],"_showDropdown":[32]}],[1,"snk-select-box",{"selectedOption":[1,"selected-option"]}],[2,"snk-view-representation",{"mode":[8]}],[2,"taskbar-actions-button",{"title":[1],"enabled":[4],"actions":[16],"_showDropdown":[32],"showActions":[64],"hideActions":[64],"isOpened":[64]},[[8,"keydown","handleKeyDown"],[8,"ezOpenModal","handleClose"]]],[2,"taskbar-split-button",{"iconName":[1,"icon-name"],"action":[16],"name":[1],"className":[1,"class-name"],"dataElementId":[1,"data-element-id"],"title":[1],"enabled":[4],"actions":[16],"_showDropdown":[32]}]]],["p-72c8c847",[[6,"snk-taskbar",{"alignRigth":[4,"align-rigth"],"customSlotId":[1,"custom-slot-id"],"customContainerId":[1,"custom-container-id"],"overflowStrategy":[1,"overflow-strategy"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"buttons":[1],"customButtons":[16],"actionsList":[16],"actionsSettingsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"presentationMode":[1537,"presentation-mode"],"messagesBuilder":[1040],"_permissions":[32],"_overFlowedElements":[32],"_customElements":[32],"_customElementsId":[32],"_slotContainer":[32],"_hiddenActionsList":[32],"_lastWidth":[32],"_hasToUpdateOverFlow":[32],"_isWaitingForSave":[32]},[[8,"snkCustomSlotElementsLoaded","handleCustomSlotElementsLoaded"],[8,"taskbarSaveLocker","handleTaskbarSaveLocker"],[8,"taskbarSaveUnlocker","handleTaskbarSaveUnlocker"]]]]],["p-50b68b68",[[6,"snk-simple-crud",{"enableLockManagerLoadingComp":[4,"enable-lock-manager-loading-comp"],"enableLockManagerTaskbarClick":[4,"enable-lock-manager-taskbar-click"],"dataState":[16],"dataUnit":[16],"entityName":[1,"entity-name"],"mode":[2],"gridConfig":[1040],"formConfig":[1040],"enableContinuousInsert":[1028,"enable-continuous-insert"],"multipleSelection":[4,"multiple-selection"],"useCancelConfirm":[4,"use-cancel-confirm"],"pageSize":[2,"page-size"],"resourceID":[1,"resource-i-d"],"enableGridInsert":[4,"enable-grid-insert"],"paginationCounterMode":[1,"pagination-counter-mode"],"taskbarManager":[16],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"actionsList":[16],"configName":[1025,"config-name"],"showConfiguratorButtons":[4,"show-configurator-buttons"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"autoFocus":[4,"auto-focus"],"domainMessagesBuilder":[1,"domain-messages-builder"],"multipleEditionEnabled":[4,"multiple-edition-enabled"],"layoutFormConfig":[4,"layout-form-config"],"autoLoad":[4,"auto-load"],"outlineMode":[4,"outline-mode"],"_container":[32],"_showPopUpGridConfig":[32],"_currentViewMode":[32],"_config":[32],"_fieldToGetFocus":[32],"_customContainerId":[32],"_formFields":[32],"_fieldsProps":[32],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFieldProp":[64],"goToView":[64],"setMetadata":[64],"setRecords":[64],"getRecords":[64],"openConfigurator":[64],"closeConfigurator":[64],"updateConfig":[64]},[[0,"actionClick","actionClickListener"]]]]],["p-91a9abb6",[[6,"snk-simple-bar",{"label":[1],"breadcrumbItens":[16],"messagesBuilder":[1040]}]]],["p-21107f0d",[[2,"snk-filter-assistent-mode",{"filterAssistent":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityUri":[1025,"entity-uri"],"application":[1040],"isDefaultFilter":[4,"is-default-filter"]}],[2,"snk-filter-advanced-mode",{"filterAssistent":[1040],"application":[1040]}]]],["p-d9491f6f",[[0,"snk-filter-modal",{"getMessage":[16],"configName":[1025,"config-name"],"filters":[1040],"applyFilters":[16],"closeModal":[16],"addPersonalizedFilter":[16],"editPersonalizedFilter":[16],"deletePersonalizedFilter":[16],"filtersToDelete":[1040],"filterDefaultToDelete":[1040],"disablePersonalizedFilter":[4,"disable-personalized-filter"]},[[0,"deleteFilter","deletePersonalizedFilterListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]],[2,"snk-filter-bar",{"enableLockManagerLoadingComp":[4,"enable-lock-manager-loading-comp"],"customFilterBarConfig":[16],"dataUnit":[1040],"title":[1],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"mode":[1],"filterConfig":[1040],"messagesBuilder":[1040],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"autoLoad":[4,"auto-load"],"afterApplyConfig":[16],"allowDefault":[32],"scrollerLocked":[32],"showPersonalizedFilter":[32],"personalizedFilterId":[32],"reload":[64],"getFilterItem":[64],"updateFilterItem":[64],"addFilterItem":[64],"removeFilterItem":[64],"showFilterModal":[64]},[[0,"filterChange","filterChangeListener"]]],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"showChips":[4,"show-chips"],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]]]],["p-b31cc92d",[[6,"snk-grid",{"columnFilterDataSource":[1040],"enableLockManagerLoadingComp":[4,"enable-lock-manager-loading-comp"],"enableLockManagerTaskbarClick":[4,"enable-lock-manager-taskbar-click"],"configName":[1,"config-name"],"filterBarTitle":[1,"filter-bar-title"],"resourceID":[1,"resource-i-d"],"selectionToastConfig":[16],"actionsList":[16],"isDetail":[4,"is-detail"],"taskbarManager":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"gridHeaderCustomSlotId":[1,"grid-header-custom-slot-id"],"topTaskbarCustomSlotId":[1,"top-taskbar-custom-slot-id"],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"autoLoad":[4,"auto-load"],"autoFocus":[4,"auto-focus"],"enableGridInsert":[4,"enable-grid-insert"],"outlineMode":[4,"outline-mode"],"suppressHorizontalScroll":[4,"suppress-horizontal-scroll"],"strategyExporter":[1025,"strategy-exporter"],"useSearchColumn":[4,"use-search-column"],"multipleEditionEnabled":[4,"multiple-edition-enabled"],"paginationCounterMode":[1,"pagination-counter-mode"],"suppressCheckboxColumn":[4,"suppress-checkbox-column"],"compact":[4],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"_popUpGridConfig":[32],"_showSnkFilterBar":[32],"_enableContinuousInsert":[32],"reloadConfig":[64],"showConfig":[64],"hideConfig":[64],"setConfig":[64],"reloadFilterBar":[64],"getFilterBar":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFocus":[64]},[[2,"click","handleClick"]]]]],["p-bd665460",[[2,"snk-attach",{"fetcherType":[1,"fetcher-type"],"fetcher":[16],"dataUnit":[16],"dataUnitBuilder":[16],"registerKey":[1,"register-key"],"entityName":[1,"entity-name"],"messagesBuilder":[1040],"_currentFetcher":[32],"_currentDataUnit":[32],"crudConfig":[32]}]]],["p-6a1b38d2",[[6,"snk-detail-view",{"formConfigManager":[1040],"dataUnitName":[1,"data-unit-name"],"resourceID":[1,"resource-i-d"],"guideItemPath":[16],"entityName":[1,"entity-name"],"label":[1],"dataUnit":[1040],"selectedForm":[1025,"selected-form"],"dataState":[1040],"messagesBuilder":[1040],"branchGuide":[1040],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"customEditors":[16],"customRenders":[16],"presentationMode":[1,"presentation-mode"],"_disabledButtons":[32],"_currentView":[32],"attachmentRegisterKey":[32],"_fieldToGetFocus":[32],"_hasToCreateFieldSearch":[32],"changeViewMode":[64],"configGrid":[64],"showUp":[64],"addCustomEditor":[64],"addGridCustomRender":[64]},[[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-e7cccc45",[[6,"snk-guides-viewer",{"dataUnit":[16],"dataState":[16],"configName":[1,"config-name"],"entityPath":[1,"entity-path"],"actionsList":[16],"recordsValidator":[16],"masterFormConfig":[1040],"selectedGuide":[16],"taskbarManager":[16],"messagesBuilder":[1040],"canEdit":[4,"can-edit"],"presentationMode":[1,"presentation-mode"],"resourceID":[1,"resource-i-d"],"detailTaskbarCustomContainerId":[1,"detail-taskbar-custom-container-id"],"formLegacyConfigName":[1,"form-legacy-config-name"],"enableGridInsert":[4,"enable-grid-insert"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"getCustomTitle":[16],"_hasToCreateFieldSearch":[32],"_breadcrumbItems":[32],"_guides":[32],"_formEditorConfigManager":[32],"_formEditorDataUnit":[32],"_fieldToGetFocus":[32],"_customEditors":[32],"_customRenders":[32],"_fieldsProps":[32],"_mainForm":[32],"showFormConfig":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"setFieldProp":[64],"setFocus":[64]},[[2,"actionClick","onActionClick"],[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-cfd0a4c6",[[6,"snk-crud",{"enableLockManagerLoadingComp":[4,"enable-lock-manager-loading-comp"],"enableLockManagerTaskbarClick":[4,"enable-lock-manager-taskbar-click"],"configName":[1025,"config-name"],"filterBarTitle":[1,"filter-bar-title"],"selectionToastConfig":[16],"showActionButtons":[4,"show-action-buttons"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"autoLoad":[4,"auto-load"],"autoFocus":[4,"auto-focus"],"enableGridInsert":[4,"enable-grid-insert"],"domainMessagesBuilder":[1,"domain-messages-builder"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"setCustomFormTitle":[16],"strategyExporter":[1025,"strategy-exporter"],"layoutFormConfig":[4,"layout-form-config"],"multipleEditionEnabled":[4,"multiple-edition-enabled"],"paginationCounterMode":[1,"pagination-counter-mode"],"_dataUnit":[32],"_dataState":[32],"attachmentRegisterKey":[32],"_currentViewMode":[32],"_canEdit":[32],"_resourceID":[32],"customContainerId":[32],"goToView":[64],"openConfigurator":[64],"closeConfigurator":[64],"reloadFilterBar":[64],"getFilterBar":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFieldProp":[64]}]]]]'),e)));
1
+ import{p as e,b as a}from"./p-d8d8169b.js";export{s as setNonce}from"./p-d8d8169b.js";(()=>{const a=import.meta.url,t={};return""!==a&&(t.resourcesUrl=new URL(".",a).href),e(t)})().then((e=>a(JSON.parse('[["p-7345782c",[[2,"snk-actions-form",{"action":[16],"applyParameters":[16],"dataUnit":[32],"openPopup":[64]}]]],["p-180716b2",[[2,"snk-client-confirm",{"titleMessage":[1,"title-message"],"message":[1],"accept":[16],"cancel":[16],"openPopup":[64]}]]],["p-667cab42",[[6,"snk-custom-slot-elements",{"slotName":[1,"slot-name"]}]]],["p-e824d565",[[2,"snk-entity-list",{"config":[1040],"rightListSlotBuilder":[1040],"maxHeightList":[1,"max-height-list"],"_searchValue":[32],"_ezListSource":[32],"reloadList":[64]}]]],["p-a76e6d51",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"presentationMode":[2,"presentation-mode"],"resetValues":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-dff65083",[[0,"snk-filter-checkbox-list",{"config":[1040],"optionsList":[32]}]]],["p-c6a8a8bc",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-d67526b6",[[0,"snk-filter-number",{"config":[16],"getMessage":[16],"value":[2],"presentationMode":[2,"presentation-mode"],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-49d968e2",[[0,"snk-filter-period",{"config":[16],"getMessage":[16],"value":[8],"presentationMode":[2,"presentation-mode"],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-9fd87bfd",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-398cdd67",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-83c100f2",[[2,"snk-personalized-filter-editor",{"messagesBuilder":[1040],"presentationMode":[2,"presentation-mode"],"config":[16],"value":[1040],"items":[32],"show":[64]}]]],["p-3d41f5a8",[[2,"snk-print-selector",{"_printServerActive":[32],"_selectedPrinter":[32],"_remotePrintersDataSource":[32],"_localPrintersDataSource":[32],"_printJobData":[32],"openPrintSelector":[64]}]]],["p-afffa6cb",[[2,"pesquisa-grid",{"metadata":[16],"dataSource":[16],"pkField":[1,"pk-field"],"descriptionField":[1,"description-field"],"entityName":[1,"entity-name"],"shouldLoadConfig":[4,"should-load-config"],"_gridConfig":[32],"_inMemoryLoader":[32],"_dataunit":[32]}],[2,"pesquisa-tree",{"treeLoader":[16],"argument":[1025],"allowsNonAnalytic":[4,"allows-non-analytic"],"shouldLoadTree":[4,"should-load-tree"],"items":[32],"applyFilter":[64]}]]],["p-1456d7cb",[[2,"snk-pesquisa",{"searchLoader":[16],"treeLoader":[16],"selectItem":[16],"entityName":[1,"entity-name"],"argument":[1025],"isHierarchyEntity":[4,"is-hierarchy-entity"],"allowsNonAnalytic":[4,"allows-non-analytic"],"_itemList":[32],"_startLoading":[32],"_presentationMode":[32],"_currentView":[32],"_valideDataSource":[32]}]]],["p-3d452f27",[[2,"snk-application",{"enableLockManagerLoadingApp":[4,"enable-lock-manager-loading-app"],"messagesBuilder":[1040],"configName":[1,"config-name"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"loadByPK":[16],"_applicationReady":[32],"_templateSkeleton":[32],"_activeScrimWindow":[32],"getKeyboardManager":[64],"getLayoutFormConfig":[64],"isUserSup":[64],"addPendingAction":[64],"callServiceBroker":[64],"initOnboarding":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"showAlerts":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"webConnection":[64],"createDataunit":[64],"updateDataunitCache":[64],"getDataUnit":[64],"addClientEvent":[64],"removeClientEvent":[64],"hasClientEvent":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadTotals":[64],"isLoadedByPk":[64],"preloadMangerRemoveRecord":[64],"executeSearch":[64],"executePreparedSearchPlus":[64],"executePreparedSearch":[64],"isDebugMode":[64],"getAppLabel":[64],"addSearchListener":[64],"importScript":[64],"getApplicationPath":[64],"executeSelectDistinct":[64],"getDataFetcher":[64],"whenApplicationReady":[64],"setSearchFilterContext":[64],"clearPopUpTitle":[64],"setPopUpTitle":[64],"showScrimApp":[64],"markToReload":[64],"addLoadingLock":[64]}]]],["p-27482793",[[1,"teste-pesquisa"]]],["p-60dd1d27",[[2,"snk-default-filter",{"getMessage":[16],"hasDefaultFilter":[4,"has-default-filter"],"_opened":[32]}]]],["p-c926cf6b",[[0,"snk-filter-modal-item",{"filterItem":[1040],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"]}]]],["p-cfc219f6",[[2,"field-item",{"fieldConfig":[8,"field-config"],"onLayoutConfig":[4,"on-layout-config"],"dataUnit":[16],"messagesBuilder":[1040],"fieldDescriptor":[32]}],[2,"field-config",{"dataUnit":[16],"fieldConfig":[1544,"field-config"],"fieldDescriptor":[16],"messagesBuilder":[1040],"fieldLabel":[32],"fieldLabelErrorMessage":[32],"fieldDefaultValue":[32],"fieldCleanOnCopy":[32],"fieldRequired":[32],"fieldReadOnly":[32],"_defaultType":[32],"show":[64]}]]],["p-23b20add",[[2,"fields-layout",{"selectedGuide":[16],"groupsList":[16],"guideNames":[16],"dataUnit":[16],"messagesBuilder":[1040],"isEditGuideNameActive":[32],"addFieldToLayout":[64]},[[16,"fieldConfigChanged","handleFieldConfigChanged"]]]]],["p-9751c42f",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"messagesBuilder":[1040],"formLegacyConfigName":[1,"form-legacy-config-name"],"resourceID":[1,"resource-i-d"],"_dataUnit":[32],"_dataState":[32],"_showFormConfig":[32],"_configManager":[32],"showConfig":[64],"hideConfig":[64],"addCustomEditor":[64],"setFieldProp":[64]}],[2,"snk-form-config",{"dataUnit":[16],"configManager":[16],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"messagesBuilder":[1040],"availableFields":[32],"guidesList":[32],"groupsList":[32],"selectedGuide":[32],"_formConfig":[32],"configOptions":[32],"originalConfigSelected":[32],"configSelected":[32],"hasChanges":[32],"optionConfigChanged":[32]},[[16,"fieldConfigChanged","handleFieldConfigChanged"],[16,"formConfigOptionSelected","handleFormConfigOptionSelected"],[16,"addFieldToGuide","handleAddFieldToGuide"],[16,"setFieldAsAvailable","handleSetFieldAsAvailable"],[16,"removeFieldFromAvailable","handleRemoveFieldFromAvailable"]]]]],["p-2fdac5e6",[[2,"snk-form-summary",{"fixed":[1540],"contracted":[1540],"summary":[16]}]]],["p-0024d3fd",[[6,"snk-form-view",{"levelPath":[1,"level-path"],"fieldSearch":[16],"label":[1],"name":[1],"fields":[16],"formMetadata":[8,"form-metadata"],"dataUnit":[16],"contracted":[4],"fixed":[1540],"summaryFields":[16],"canExpand":[4,"can-expand"],"canFix":[4,"can-fix"],"recordsValidator":[16],"fieldToFocus":[1,"field-to-focus"],"customEditors":[16],"fieldsProps":[16],"showUp":[64],"addCustomEditor":[64],"setFieldProp":[64],"showSearchField":[64]}]]],["p-7ced2cf4",[[2,"fields-selector",{"availableFields":[16],"dataUnit":[16],"filterTerm":[32]}]]],["p-a5bb2f93",[[2,"snk-personalized-filter",{"messagesBuilder":[1040],"entityUri":[1025,"entity-uri"],"filterId":[1025,"filter-id"],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"],"isDefaultFilter":[4,"is-default-filter"],"_filterAssistentMode":[32],"_filterAssistent":[32],"createPersonalizedFilter":[64]}]]],["p-7e250432",[[2,"configs-button",{"configOptions":[16],"selectedConfig":[16],"hasChanges":[4,"has-changes"],"messagesBuilder":[1040]}]]],["p-4d2ff2fb",[[2,"config-header",{"configOptions":[16],"selectedConfig":[16],"messagesBuilder":[1040],"hasChanges":[4,"has-changes"],"optionConfigChanged":[4,"option-config-changed"],"isEditingGuide":[32],"isEditingGroup":[32]},[[16,"isEditingGuideName","handleIsEditingGuideName"],[16,"isEditingGroupName","handleIsEditingGroupName"]]]]],["p-86bd4478",[[2,"guides-configurator",{"guidesList":[16],"selectedGuide":[16],"messagesBuilder":[1040],"mainGuide":[32],"filterTerm":[32],"visibleGuides":[32],"hiddenGuides":[32]}]]],["p-9ad3557c",[[2,"snk-configurator",{"showActionButtons":[4,"show-action-buttons"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"viewMode":[2,"view-mode"],"customContainerId":[1,"custom-container-id"],"layoutFormConfig":[4,"layout-form-config"],"messagesBuilder":[1040],"_opened":[32],"_permissions":[32],"open":[64],"close":[64]}]]],["p-aa72089a",[[2,"snk-data-unit",{"dataState":[1040],"messagesBuilder":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"useCancelConfirm":[4,"use-cancel-confirm"],"ignoreSaveMessage":[4,"ignore-save-message"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"domainMessagesBuilder":[1,"domain-messages-builder"],"fieldsToLink":[32],"getDataUnit":[64],"getSelectedRecordsIDsInfo":[64],"getFieldsWithRmp":[64],"getFieldsWithRmPrecision":[64],"getRowMetadata":[64]},[[0,"snkMasterFormConfigChange","onMasterFormConfigChange"]]]]],["p-90805683",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"showHardFixed":[4,"show-hard-fixed"],"show":[64]}]]],["p-9a63f3f7",[[0,"snk-exporter-email-sender",{"getMessage":[16],"_config":[32],"_opened":[32],"_currentStep":[32],"open":[64],"close":[64]}]]],["p-05f3a2da",[[2,"snk-data-exporter",{"provider":[16],"messagesBuilder":[1040],"_items":[32],"_showDropdown":[32]}]]],["p-471b34f4",[[2,"snk-filter-field-search",{"searchable":[4],"fieldsDataSource":[16],"breadcrumbItems":[32],"linkItems":[32],"fieldItems":[32],"searchEmpty":[32],"groupEmpty":[32],"show":[64],"applyFilter":[64]}],[0,"snk-filter-param-config",{"messagesBuilder":[1040],"_opened":[32],"_configType":[32],"_expressionItem":[32],"_informedInstance":[32],"_canSave":[32],"open":[64],"close":[64]}]]],["p-71a05822",[[2,"snk-expression-group",{"parentTop":[1026,"parent-top"],"group":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityURI":[1025,"entity-u-r-i"],"isDefaultFilter":[4,"is-default-filter"],"_conditionOperator":[32],"_group":[32],"_selfTop":[32],"canAddExpression":[32],"_showDashes":[32],"getExpressionGroup":[64]},[[8,"ezExpressionLayoutChanged","todoCompletedHandler"]]],[2,"snk-expression-item",{"expression":[16],"canRemove":[516,"can-remove"],"messagesBuilder":[1040],"isDefaultFilter":[4,"is-default-filter"],"entityURI":[1025,"entity-u-r-i"],"_showValueVariable":[32],"_fieldSelected":[32],"_optionNotNull":[32]}]]],["p-3bf2f5cd",[[0,"snk-simple-form-config",{"dataUnit":[16],"configName":[1,"config-name"],"avaliableFields":[32],"selectedFields":[32],"show":[64]}],[2,"snk-grid-config",{"selectedIndex":[1026,"selected-index"],"columns":[1040],"config":[1040],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"_collapsibleBoxListOrder":[32],"_collapsibleBoxListSelect":[32]}],[2,"snk-layout-form-config",{"layoutType":[32],"save":[64]}],[2,"snk-actions-button",{"_items":[32],"_showDropdown":[32]}],[1,"snk-select-box",{"selectedOption":[1,"selected-option"]}],[2,"snk-view-representation",{"mode":[8]}],[2,"taskbar-actions-button",{"title":[1],"enabled":[4],"actions":[16],"_showDropdown":[32],"showActions":[64],"hideActions":[64],"isOpened":[64]},[[8,"keydown","handleKeyDown"],[8,"ezOpenModal","handleClose"]]],[2,"taskbar-split-button",{"iconName":[1,"icon-name"],"action":[16],"name":[1],"className":[1,"class-name"],"dataElementId":[1,"data-element-id"],"title":[1],"enabled":[4],"actions":[16],"_showDropdown":[32]}]]],["p-72c8c847",[[6,"snk-taskbar",{"alignRigth":[4,"align-rigth"],"customSlotId":[1,"custom-slot-id"],"customContainerId":[1,"custom-container-id"],"overflowStrategy":[1,"overflow-strategy"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"buttons":[1],"customButtons":[16],"actionsList":[16],"actionsSettingsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"presentationMode":[1537,"presentation-mode"],"messagesBuilder":[1040],"_permissions":[32],"_overFlowedElements":[32],"_customElements":[32],"_customElementsId":[32],"_slotContainer":[32],"_hiddenActionsList":[32],"_lastWidth":[32],"_hasToUpdateOverFlow":[32],"_isWaitingForSave":[32]},[[8,"snkCustomSlotElementsLoaded","handleCustomSlotElementsLoaded"],[8,"taskbarSaveLocker","handleTaskbarSaveLocker"],[8,"taskbarSaveUnlocker","handleTaskbarSaveUnlocker"]]]]],["p-0d72d9c3",[[6,"snk-simple-crud",{"enableLockManagerLoadingComp":[4,"enable-lock-manager-loading-comp"],"enableLockManagerTaskbarClick":[4,"enable-lock-manager-taskbar-click"],"dataState":[16],"dataUnit":[16],"entityName":[1,"entity-name"],"mode":[2],"gridConfig":[1040],"formConfig":[1040],"enableContinuousInsert":[1028,"enable-continuous-insert"],"multipleSelection":[4,"multiple-selection"],"useCancelConfirm":[4,"use-cancel-confirm"],"pageSize":[2,"page-size"],"resourceID":[1,"resource-i-d"],"enableGridInsert":[4,"enable-grid-insert"],"paginationCounterMode":[1,"pagination-counter-mode"],"taskbarManager":[16],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"actionsList":[16],"configName":[1025,"config-name"],"showConfiguratorButtons":[4,"show-configurator-buttons"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"autoFocus":[4,"auto-focus"],"domainMessagesBuilder":[1,"domain-messages-builder"],"multipleEditionEnabled":[4,"multiple-edition-enabled"],"layoutFormConfig":[4,"layout-form-config"],"autoLoad":[4,"auto-load"],"outlineMode":[4,"outline-mode"],"_container":[32],"_showPopUpGridConfig":[32],"_currentViewMode":[32],"_config":[32],"_fieldToGetFocus":[32],"_customContainerId":[32],"_formFields":[32],"_fieldsProps":[32],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFieldProp":[64],"goToView":[64],"setMetadata":[64],"setRecords":[64],"getRecords":[64],"openConfigurator":[64],"closeConfigurator":[64],"updateConfig":[64]},[[0,"actionClick","actionClickListener"]]]]],["p-91a9abb6",[[6,"snk-simple-bar",{"label":[1],"breadcrumbItens":[16],"messagesBuilder":[1040]}]]],["p-21107f0d",[[2,"snk-filter-assistent-mode",{"filterAssistent":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityUri":[1025,"entity-uri"],"application":[1040],"isDefaultFilter":[4,"is-default-filter"]}],[2,"snk-filter-advanced-mode",{"filterAssistent":[1040],"application":[1040]}]]],["p-d9491f6f",[[0,"snk-filter-modal",{"getMessage":[16],"configName":[1025,"config-name"],"filters":[1040],"applyFilters":[16],"closeModal":[16],"addPersonalizedFilter":[16],"editPersonalizedFilter":[16],"deletePersonalizedFilter":[16],"filtersToDelete":[1040],"filterDefaultToDelete":[1040],"disablePersonalizedFilter":[4,"disable-personalized-filter"]},[[0,"deleteFilter","deletePersonalizedFilterListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]],[2,"snk-filter-bar",{"enableLockManagerLoadingComp":[4,"enable-lock-manager-loading-comp"],"customFilterBarConfig":[16],"dataUnit":[1040],"title":[1],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"mode":[1],"filterConfig":[1040],"messagesBuilder":[1040],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"autoLoad":[4,"auto-load"],"afterApplyConfig":[16],"allowDefault":[32],"scrollerLocked":[32],"showPersonalizedFilter":[32],"personalizedFilterId":[32],"reload":[64],"getFilterItem":[64],"updateFilterItem":[64],"addFilterItem":[64],"removeFilterItem":[64],"showFilterModal":[64]},[[0,"filterChange","filterChangeListener"]]],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"showChips":[4,"show-chips"],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]]]],["p-b31cc92d",[[6,"snk-grid",{"columnFilterDataSource":[1040],"enableLockManagerLoadingComp":[4,"enable-lock-manager-loading-comp"],"enableLockManagerTaskbarClick":[4,"enable-lock-manager-taskbar-click"],"configName":[1,"config-name"],"filterBarTitle":[1,"filter-bar-title"],"resourceID":[1,"resource-i-d"],"selectionToastConfig":[16],"actionsList":[16],"isDetail":[4,"is-detail"],"taskbarManager":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"gridHeaderCustomSlotId":[1,"grid-header-custom-slot-id"],"topTaskbarCustomSlotId":[1,"top-taskbar-custom-slot-id"],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"autoLoad":[4,"auto-load"],"autoFocus":[4,"auto-focus"],"enableGridInsert":[4,"enable-grid-insert"],"outlineMode":[4,"outline-mode"],"suppressHorizontalScroll":[4,"suppress-horizontal-scroll"],"strategyExporter":[1025,"strategy-exporter"],"useSearchColumn":[4,"use-search-column"],"multipleEditionEnabled":[4,"multiple-edition-enabled"],"paginationCounterMode":[1,"pagination-counter-mode"],"suppressCheckboxColumn":[4,"suppress-checkbox-column"],"compact":[4],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"_popUpGridConfig":[32],"_showSnkFilterBar":[32],"_enableContinuousInsert":[32],"reloadConfig":[64],"showConfig":[64],"hideConfig":[64],"setConfig":[64],"reloadFilterBar":[64],"getFilterBar":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFocus":[64]},[[2,"click","handleClick"]]]]],["p-33a44ca7",[[2,"snk-attach",{"gridLegacyConfigName":[1,"grid-legacy-config-name"],"fetcherType":[1,"fetcher-type"],"fetcher":[16],"dataUnit":[16],"dataUnitBuilder":[16],"registerKey":[1,"register-key"],"entityName":[1,"entity-name"],"messagesBuilder":[1040],"_currentFetcher":[32],"_currentDataUnit":[32],"crudConfig":[32]}]]],["p-6a1b38d2",[[6,"snk-detail-view",{"formConfigManager":[1040],"dataUnitName":[1,"data-unit-name"],"resourceID":[1,"resource-i-d"],"guideItemPath":[16],"entityName":[1,"entity-name"],"label":[1],"dataUnit":[1040],"selectedForm":[1025,"selected-form"],"dataState":[1040],"messagesBuilder":[1040],"branchGuide":[1040],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"customEditors":[16],"customRenders":[16],"presentationMode":[1,"presentation-mode"],"_disabledButtons":[32],"_currentView":[32],"attachmentRegisterKey":[32],"_fieldToGetFocus":[32],"_hasToCreateFieldSearch":[32],"changeViewMode":[64],"configGrid":[64],"showUp":[64],"addCustomEditor":[64],"addGridCustomRender":[64]},[[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-e7cccc45",[[6,"snk-guides-viewer",{"dataUnit":[16],"dataState":[16],"configName":[1,"config-name"],"entityPath":[1,"entity-path"],"actionsList":[16],"recordsValidator":[16],"masterFormConfig":[1040],"selectedGuide":[16],"taskbarManager":[16],"messagesBuilder":[1040],"canEdit":[4,"can-edit"],"presentationMode":[1,"presentation-mode"],"resourceID":[1,"resource-i-d"],"detailTaskbarCustomContainerId":[1,"detail-taskbar-custom-container-id"],"formLegacyConfigName":[1,"form-legacy-config-name"],"enableGridInsert":[4,"enable-grid-insert"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"getCustomTitle":[16],"_hasToCreateFieldSearch":[32],"_breadcrumbItems":[32],"_guides":[32],"_formEditorConfigManager":[32],"_formEditorDataUnit":[32],"_fieldToGetFocus":[32],"_customEditors":[32],"_customRenders":[32],"_fieldsProps":[32],"_mainForm":[32],"showFormConfig":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"setFieldProp":[64],"setFocus":[64]},[[2,"actionClick","onActionClick"],[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-cfd0a4c6",[[6,"snk-crud",{"enableLockManagerLoadingComp":[4,"enable-lock-manager-loading-comp"],"enableLockManagerTaskbarClick":[4,"enable-lock-manager-taskbar-click"],"configName":[1025,"config-name"],"filterBarTitle":[1,"filter-bar-title"],"selectionToastConfig":[16],"showActionButtons":[4,"show-action-buttons"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"autoLoad":[4,"auto-load"],"autoFocus":[4,"auto-focus"],"enableGridInsert":[4,"enable-grid-insert"],"domainMessagesBuilder":[1,"domain-messages-builder"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"setCustomFormTitle":[16],"strategyExporter":[1025,"strategy-exporter"],"layoutFormConfig":[4,"layout-form-config"],"multipleEditionEnabled":[4,"multiple-edition-enabled"],"paginationCounterMode":[1,"pagination-counter-mode"],"_dataUnit":[32],"_dataState":[32],"attachmentRegisterKey":[32],"_currentViewMode":[32],"_canEdit":[32],"_resourceID":[32],"customContainerId":[32],"goToView":[64],"openConfigurator":[64],"closeConfigurator":[64],"reloadFilterBar":[64],"getFilterBar":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFieldProp":[64]}]]]]'),e)));
@@ -1,6 +1,6 @@
1
1
  import { IGridConfig } from "@sankhyalabs/ezui/dist/types/components/ez-grid/controller/EzGridController";
2
2
  import { IFormConfig } from '@sankhyalabs/ezui/dist/types/utils/form/interfaces';
3
3
  export type TCrudConfig = {
4
- grid: IGridConfig;
4
+ grid?: IGridConfig;
5
5
  form: IFormConfig;
6
6
  };
@@ -9,6 +9,10 @@ export declare class SnkAttach {
9
9
  private _application;
10
10
  private _crudElement;
11
11
  private _currentDataUnitBuilder;
12
+ /**
13
+ * Chave da configuração legado da grid.
14
+ */
15
+ gridLegacyConfigName: string;
12
16
  /**
13
17
  * FetcherType define o tipo de fetcher responsável por carregar os dados do DataUnit.
14
18
  */
@@ -69,5 +73,6 @@ export declare class SnkAttach {
69
73
  componentWillLoad(): Promise<void>;
70
74
  componentWillRender(): void;
71
75
  private handleOnDataStateChange;
76
+ private getGridLegacyConfigName;
72
77
  render(): any;
73
78
  }
@@ -181,7 +181,7 @@ export declare class SnkSimpleCrud {
181
181
  * Quando true, aplica o padrão de outline ao componente (Utilizar quando estiver contido em outro elemento como um painel ou pop-up)
182
182
  */
183
183
  outlineMode?: boolean;
184
- handleResourceIDChanged(newValue: string, oldValue: string): void;
184
+ handleResourceIDChanged(newValue: string, oldValue: string): Promise<void>;
185
185
  /**
186
186
  * Registra um formatador de valores para uma coluna da grid.
187
187
  */
@@ -452,6 +452,10 @@ export namespace Components {
452
452
  * FetcherType define o tipo de fetcher responsável por carregar os dados do DataUnit.
453
453
  */
454
454
  "fetcherType": TFetcherType;
455
+ /**
456
+ * Chave da configuração legado da grid.
457
+ */
458
+ "gridLegacyConfigName": string;
455
459
  /**
456
460
  * Responsável por flexibilizar e padronizar o uso de mensagens nos blocos de construção.
457
461
  */
@@ -2953,6 +2957,10 @@ declare namespace LocalJSX {
2953
2957
  * FetcherType define o tipo de fetcher responsável por carregar os dados do DataUnit.
2954
2958
  */
2955
2959
  "fetcherType"?: TFetcherType;
2960
+ /**
2961
+ * Chave da configuração legado da grid.
2962
+ */
2963
+ "gridLegacyConfigName"?: string;
2956
2964
  /**
2957
2965
  * Responsável por flexibilizar e padronizar o uso de mensagens nos blocos de construção.
2958
2966
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/sankhyablocks",
3
- "version": "9.1.0-dev.3",
3
+ "version": "9.1.0-dev.5",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- import{r as i,c as t,h as s,g as e}from"./p-d8d8169b.js";import{StringUtils as n,ApplicationContext as o,ObjectUtils as h,Action as a,DataType as r,UserInterface as d,KeyboardManager as l,ElementIDUtils as u}from"@sankhyalabs/core";import{CSSVarsUtils as c,buildFieldSearch as m,LABEL_SEARCH_COLUMN as v,LABEL_SEARCH_FIELD as p}from"@sankhyalabs/ezui/dist/collection/utils";import{V as g,S as f}from"./p-9019a32f.js";import{T as C}from"./p-7de79adf.js";import"./p-fbba7e3d.js";import"./p-6dd38d7b.js";import{S as b,R as S,b as k,a as y,c as w}from"./p-763b04fa.js";import{P as F}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{I as E}from"./p-7993b2e3.js";import"./p-ff1990ad.js";import{F as I}from"./p-601b252b.js";import{T}from"./p-1a0caadb.js";import{C as _}from"./p-6416975c.js";import{S as z}from"./p-a6513fcb.js";import{s as R}from"./p-a349689a.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";import"./p-7dd49d15.js";import"./p-8f3f2306.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";const M=["INSERT","REFRESH","PREVIOUS","NEXT","DIVIDER","MORE_OPTIONS"],D=["INSERT","REFRESH","PREVIOUS","NEXT","DIVIDER","CLONE","REMOVE","DIVIDER","MORE_OPTIONS"],L=class{constructor(s){i(this,s),this.dataStateChange=t(this,"dataStateChange",3),this.dataUnitReady=t(this,"dataUnitReady",3),this.actionClick=t(this,"actionClick",7),this.formItemsReady=t(this,"formItemsReady",7),this.configuratorSave=t(this,"configuratorSave",7),this.configuratorCancel=t(this,"configuratorCancel",7),this._multiSelectionListDataSource=new b,this._formConfigFetcher=new I,this._customEditors=new Map,this._customRenders=new Map,this._container=void 0,this._showPopUpGridConfig=!1,this._currentViewMode=g.GRID,this._config=void 0,this._fieldToGetFocus=void 0,this._customContainerId=`SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${n.generateUUID()}`,this.enableLockManagerLoadingComp=!1,this.enableLockManagerTaskbarClick=!1,this.dataState=void 0,this.dataUnit=void 0,this.entityName=void 0,this.mode=f.SERVER,this.gridConfig=void 0,this.formConfig=void 0,this._formFields=[],this._fieldsProps=new Map,this.enableContinuousInsert=!1,this.multipleSelection=void 0,this.useCancelConfirm=!0,this.pageSize=150,this.resourceID=void 0,this.enableGridInsert=!1,this.paginationCounterMode="auto",this.taskbarManager=void 0,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.actionsList=void 0,this.configName=void 0,this.showConfiguratorButtons=!1,this.gridLegacyConfigName=void 0,this.formLegacyConfigName=void 0,this.ignoreReadOnlyFormFields=!1,this.autoFocus=!0,this.domainMessagesBuilder=void 0,this.multipleEditionEnabled=!0,this.layoutFormConfig=!1,this.autoLoad=void 0,this.outlineMode=!1}async addCustomEditor(i,t){if(this._grid&&this._form)return this._grid.addCustomEditor(i,t),void this._form.addCustomEditor(i,t);const s=new Map(this._customEditors);s.set(i,t),this._customEditors=s}async addGridCustomRender(i,t){if(this._grid)return void this._grid.addGridCustomRender(i,t);const s=new Map(this._customRenders);s.set(i,t),this._customRenders=s}handleResourceIDChanged(i,t){n.isEmpty(i)||i!==t&&(this.loadFormConfig(!0),this.loadGridConfig(!0))}async addCustomValueFormatter(i,t){this._grid.addCustomValueFormatter(i,t)}async removeCustomValueFormatter(i){this._grid.removeCustomValueFormatter(i)}async setFieldProp(i,t,s){const e=new Map(this._fieldsProps),n=this._fieldsProps.get(i);e.set(i,Object.assign(Object.assign({},n),{[t]:s})),this._fieldsProps=e}loadTaskbarProcessor(){const i={};i[O.FORM_REGULAR]=this.getButtons(!1,[C.GRID_MODE],!0),i[O.GRID_REGULAR]=this.getButtons(!1,[C.DATA_EXPORTER,C.FORM_MODE]),i[O.FORM_SELECTED]=this.getButtons(!0,[C.GRID_MODE],!0),i[O.GRID_SELECTED]=this.getGridSelectedButtonsCallBack.bind(this),i[O.FINISH_EDITION]=this.getFinishEditionButtonsCallback.bind(this),i[O.MULTIPLE_EDITION]=[C.CANCEL],this._taskbarProcessor=new T(i)}getGridSelectedButtonsCallBack(){var i,t,s;return this.multipleEditionEnabled&&1!==(null===(s=null===(t=null===(i=this.dataState)||void 0===i?void 0:i.selectionInfo)||void 0===t?void 0:t.records)||void 0===s?void 0:s.length)?this.getButtons(!0,[C.UPDATE_MULTIPLE,C.DATA_EXPORTER,C.FORM_MODE]):this.getButtons(!0,[C.DATA_EXPORTER,C.FORM_MODE])}getFinishEditionButtonsCallback(){const i=[C.CANCEL,C.SAVE];return this.enableGridInsert&&this._currentViewMode!==g.ATTACHMENT&&i.push(this._currentViewMode===g.GRID?C.FORM_MODE:C.GRID_MODE),i}getButtons(i,t,s){let e=i?D:M;return s&&(e=e.filter((i=>i!==C.REFRESH))),this.addConfigButton(this.resolveInMemoryBtns(e).concat(t))}addConfigButton(i){return void 0===this.configName?i:i.concat(C.CONFIGURATOR)}get application(){return o.getContextValue("__SNK__APPLICATION__")}resolveInMemoryBtns(i){const t=[...i];return this.mode===f.IN_MEMORY&&t.splice(1,1),t}async goToView(i){this._currentViewMode=i,this._viewStack&&(i===g.GRID&&(this.dataUnit.isMultipleEdition=!1),this._viewStack.show(i)),i===g.GRID&&requestAnimationFrame((()=>this.focusToGrid())),i===g.FORM&&requestAnimationFrame((()=>this.focusToForm()))}actionClickListener(i){this.handleTaskbarAction(i.detail),i.stopPropagation()}handleTaskbarAction(i){switch(i){case C.CONFIGURATOR:this._snkConfigurator.open();break;case C.GRID_MODE:this.goToView(g.GRID);break;case C.FORM_MODE:this.goToView(g.FORM);break;case C.UPDATE_MULTIPLE:this.dataUnit.isMultipleEdition=!0,this.goToView(g.FORM)}}async onChangeEntityName(i){if(this.dataUnit)return;const t=o.getContextValue("__SNK__APPLICATION__");this.dataUnit=await t.getDataUnit(i,null,null,this.configName)}onModeChange(){this.mode==f.IN_MEMORY&&this.initInMemoryDataUnit()}observeDataState(i,t){this.handleDataStateChange(i,t)}async observeFormLegacy(i,t){await this.handleUpdateFormLegacyConfig(i,t)}async observeGridLegacy(i,t){await this.handleUpdateGridLegacyConfig(i,t)}async handleDataStateChange(i,t){h.objectToString(t)!=h.objectToString(i)&&this.dataStateChange.emit(i),await this.processRmPrecision()}async processRmPrecision(){var i,t;const s=await this._snkDataUnit.getFieldsWithRmPrecision();for(const e of s||[]){if(!e)continue;const s=null===(t=null===(i=this.dataState)||void 0===i?void 0:i.rowMetadata)||void 0===t?void 0:t.getProp("rm_precision",e);(s||0===s)&&(await this.setFieldProp(e,"precision",s),await this.setFieldProp(e,"prettyPrecision",s))}this._rmPrecisionCustomValueFormatter.setDataState(this.dataState)}async handleUpdateGridLegacyConfig(i,t){null!=i&&i!=t&&this._gridConfigAlreadyLoaded&&await this.loadGridConfig(!0)}async handleUpdateFormLegacyConfig(i,t){null!=i&&i!=t&&this._formConfigAlreadyLoaded&&this.loadFormConfig(!0)}openConfig(i){this._snkConfigurator.close(),i===g.GRID?this.openGridConfig():i===g.FORM&&this.openFormConfig()}openGridConfig(){this._grid.getColumnsState().then((i=>{this._snkGridConfig.columns=i.filter((i=>i.name)),this._snkGridConfig.selectedIndex=0,this._showPopUpGridConfig=!0}))}async openFormConfig(){(this.formLegacyConfigName||this.configName)&&await this._snkSimpleFormConfig.show()}addGridLegacyConfigName(){this.gridLegacyConfigName&&this.configName&&_.addGridLegacyConfig(this.configName,this.gridLegacyConfigName)}loadGridConfig(i){if(void 0!==this.configName&&(null==this.gridConfig&&!this._gridConfigAlreadyLoaded||i))return this.addGridLegacyConfigName(),this._gridConfigAlreadyLoaded=!0,new Promise(((i,t)=>{_.loadGridConfig(this.configName,this.resolveResourceID()).then((t=>{this.setGridConfig(t),i()})).catch((i=>{t(i)}))}))}formConfigIsLoaded(){return null!=this.formConfig||this._formConfigAlreadyLoaded}async loadFormConfig(i=!1,t=!1){if(void 0===this.configName)return;if(null==this._formConfigManager&&(this._formConfigManager=new z(this.configName,this.resolveResourceID(),void 0,this.dataUnit),this._formConfigManager.setConfig(this.formConfig)),this.formConfigIsLoaded()&&!i)return;this._formConfigAlreadyLoaded=!0;let s=await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);if(null!=s)return this._formConfigManager.setConfig(s),void this.setFormConfig(s,t);this.setFormConfig(await this._formConfigManager.loadConfig())}async componentWillRender(){this.loadTaskbarProcessor(),this._resourceID=await this.application.getResourceID(),this.dataExporterProviderStore(),this.dataExporterProviderStore(),this._taskbarProcessor.process(this.getTaskBarId(),this.taskbarManager,this.dataState,this.getTaskBarDisabledButtons()),void 0!==this.configName&&(null!=this.gridConfig||this._gridConfigAlreadyLoaded||(await this.addGridLegacyConfigName(),this.loadGridConfig(),this.loadFormConfig()))}componentDidRender(){this._rmPrecisionCustomValueFormatter.setGrid(this._grid),this.addGridCustomValueFormattters(),this.setFieldsProps(),this.setCustomRenders(),this.setCustomEditors()}componentWillLoad(){this.processMetadata(),this.onModeChange(),this.configDatasource(),this._rmPrecisionCustomValueFormatter=new S,this._continuousInsertUtils=new k(this.application,this.resolveResourceID(),this.configName),this.enableGridInsert&&this._continuousInsertUtils.getConfig().then((i=>this.enableContinuousInsert=i))}componentDidLoad(){c.applyVarsGrid(this._element,this._grid),this.initKeyboardManager(),this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this))}async dataUnitActionHandler(i){i.type!==a.EDITION_CANCELED&&i.type!==a.DATA_SAVED||this.dataUnit.isMultipleEdition&&this.goToView(g.GRID)}disconnectedCallback(){var i;null===(i=this._keyboardManager)||void 0===i||i.unbindAllShortcutKeys()}setCustomRenders(){if(this._grid)for(const[i,t]of this._customRenders)this._grid.addGridCustomRender(i,t),this._customRenders.delete(i)}setCustomEditors(){if(this._grid&&this._form)for(const[i,t]of this._customEditors)this._grid.addCustomEditor(i,t),this._form.addCustomEditor(i,t),this._customEditors.delete(i)}configDatasource(){this._multiSelectionListDataSource.setApplication(this.application),this._multiSelectionListDataSource.setDataUnit(this.dataUnit)}setFieldsProps(){if(this._form)for(const[i,t]of this._fieldsProps){for(const s in t)this._form.setFieldProp(i,s,t[s]);this._fieldsProps.delete(i)}}getTaskBarId(){var i,t;return(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?O.FINISH_EDITION:this.dataUnit.isMultipleEdition?O.MULTIPLE_EDITION:(null===(t=this.dataState)||void 0===t?void 0:t.selectionInfo)&&!this.dataState.selectionInfo.isAllRecords()&&this.dataState.selectionInfo.length>0?this._currentViewMode===g.GRID?O.GRID_SELECTED:O.FORM_SELECTED:this._currentViewMode===g.GRID?O.GRID_REGULAR:O.FORM_REGULAR}initInMemoryDataUnit(){this._inMemoryLoader=new E(this._metadata,void 0,{autoLoad:this.autoLoad}),this.dataUnit=this._inMemoryLoader.dataUnit,this.dataUnitReady.emit(this.dataUnit)}setMetadata(i){return this._inMemoryLoader?this._inMemoryLoader.metadata=i:this.dataUnit&&(this.dataUnit.metadata=i),Promise.resolve()}setRecords(i){return this._inMemoryLoader?this._inMemoryLoader.records=i:this.dataUnit&&(this.dataUnit.records=i),Promise.resolve()}getRecords(){return Promise.resolve(this.dataUnit.records)}async openConfigurator(){var i;null===(i=this._snkConfigurator)||void 0===i||i.open()}async closeConfigurator(){var i;null===(i=this._snkConfigurator)||void 0===i||i.close()}async updateConfig(){null==this._formConfigManager&&(this._formConfigManager=new z(this.configName,this.resolveResourceID())),this._formConfigManager.setConfig(this.formConfig)}processMetadata(){const i=this._element.querySelectorAll("snk-field-metadata"),t=[],s={fields:[],emptyConfig:!1};i.forEach((i=>{const e={name:i.getAttribute("name")||i.getAttribute("label"),label:i.getAttribute("label"),dataType:r[i.getAttribute("dataType")]||r.TEXT,userInterface:d[i.getAttribute("userInterface")]||d.SHORTTEXT,readOnly:"true"==i.getAttribute("readOnly"),required:"true"==i.getAttribute("required"),tab:i.getAttribute("tab")||void 0,visible:"false"!=i.getAttribute("visible")};s.fields.push({name:e.name,tab:e.tab,visible:e.visible}),t.push(e)})),t.length>0&&(this.formConfig||(this.formConfig=s),this._metadata={name:"SimpleCrud",label:"SimpleCrud",fields:t})}addGridCustomValueFormattters(){var i,t,s;const e=(null===(i=this._metadata)||void 0===i?void 0:i.fields)||(null===(s=null===(t=this.dataUnit)||void 0===t?void 0:t.metadata)||void 0===s?void 0:s.fields);if(!e)return;const n=[];e.forEach((i=>{var t;(null===(t=i.properties)||void 0===t?void 0:t.rm_precision)&&!n.includes(i.name)&&n.push(i.name)})),n.forEach((i=>{this.addCustomValueFormatter(i,this._rmPrecisionCustomValueFormatter)}))}onDataStateChange(i){this.dataState=Object.assign({},i.detail)}getTaskBarDisabledButtons(){var i,t,s,e,n,o;const h=[];return(null===(i=this.dataState)||void 0===i?void 0:i.hasNext)||h.push(C.NEXT),(null===(t=this.dataState)||void 0===t?void 0:t.hasPrevious)||h.push(C.PREVIOUS),(null===(e=null===(s=this.dataState)||void 0===s?void 0:s.selectionInfo)||void 0===e?void 0:e.isEmpty())&&h.push(C.FORM_MODE),(null===(o=null===(n=this.dataState)||void 0===n?void 0:n.selectionInfo)||void 0===o?void 0:o.length)>1&&h.push(C.CLONE),h}handleCancelEdit(){var i;(null===(i=this.dataState)||void 0===i?void 0:i.recordsIsEmpty)&&(this.goToView(g.GRID),this.dataUnit.clearSelection())}handleConfiguratorEvent(i,t){i.stopImmediatePropagation(),"SAVE"!==t?this.configuratorCancel.emit():this.configuratorSave.emit()}onSelectField(i){null!=i&&(this._fieldToGetFocus=i.value)}getFieldSearch(i,t){return null!=this._fieldSearch||(this._splitButtonForm=i,this._fieldSearch=m(t,(({argument:i})=>this.fieldsOptionLoader(i)),(i=>this.onSelectField(i)))),this._fieldSearch}getFormFields(){var i,t;return null!==(t=null===(i=this.formConfig)||void 0===i?void 0:i.fields)&&void 0!==t?t:this._formFields}handleFormSetFields(i){h.equals(this._formFields,i)||(this._formFields=null!=i?i:[])}fieldsOptionLoader(i){const t=null==i?void 0:i.toLowerCase(),s=this.getFormFields().map((i=>{var t;return null===(t=this.dataUnit)||void 0===t?void 0:t.getField(i.name)})).filter((i=>{var s,e;return(null===(s=i.name)||void 0===s?void 0:s.toLowerCase().includes(t))||(null===(e=i.label)||void 0===e?void 0:e.toLowerCase().includes(t))})).map((i=>({value:i.name,label:i.label})));return Promise.resolve(s)}isGridInsertActive(){return this.enableGridInsert&&this.dataUnit.hasNewRecord()}getColumnSearch(i,t){return null!=this._columnSearch||(this._splitButton=i,this._columnSearch=m(t,(({argument:i})=>new Promise((t=>{this._grid.filterColumns(i).then((i=>{t(i.filter((i=>!i.hidden)).map((i=>({label:i.label,value:i.name}))))}))}))),(i=>{null!=i&&this._grid.locateColumn(i.value)}))),this._columnSearch}getActionsList(){const i=[];if(this.enableGridInsert&&i.push(this._continuousInsertUtils.actionContinuousInsert(this.enableContinuousInsert,(()=>{this.enableContinuousInsert=!this.enableContinuousInsert,this._continuousInsertUtils.handleSaveConfig(this.enableContinuousInsert)}))),this.isGridInsertActive())return i;if(null!=this.taskbarManager&&null!=this.taskbarManager.getMoreOptions){const t=this.getTopTaskBarId();return i.concat(this.taskbarManager.getMoreOptions(t,this.configName,this.dataState,this.actionsList))}return i.concat(this.actionsList)}getSettingsListGrid(){var i,t;return[{value:n.generateUUID(),label:null!==(t=null===(i=this.messagesBuilder)||void 0===i?void 0:i.getMessage("snkSimpleCrud.findColumn",{}))&&void 0!==t?t:v,disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,t)=>this.getColumnSearch(i,t)}]}getSettingsListForm(){var i,t;return[{value:n.generateUUID(),label:null!==(t=null===(i=this.messagesBuilder)||void 0===i?void 0:i.getMessage("snkSimpleCrud.findFields",{}))&&void 0!==t?t:p,disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,t)=>this.getFieldSearch(i,t)}]}getTopTaskBarId(){var i;return(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?`snkGridTopTaskbar.finish_edition${F.PRIMARY}`:`snkGridTopTaskbar.regular${F.PRIMARY}`}clearFieldToFocusHandler(){this._fieldToGetFocus=void 0}gridConfigChangeHandler(i){i.stopPropagation(),this.configName&&_.saveGridConfig(i.detail,this.configName,this.resolveResourceID())}modalConfigChangeHandler(i){const t=i.detail;this._grid.setColumnsState(t.columns).then((()=>{this.setGridConfig(t),this.closeGridConfig(),this.dataExporterProviderStore()})),i.stopPropagation()}async dataExporterProviderStore(){if(null==this.dataUnit)return;if(null==this._grid)return;const i=new w(this.dataUnit,this._grid);R.set("exporterProviders",Object.assign(Object.assign({},R.get("exporterProviders")),{[this.getDataExporterStoreKey()]:i}))}getDataExporterStoreKey(){return`SnkSimpleCrudDataExporter:${null==this.configName?this.dataUnit.name:this.configName}`}setGridConfig(i){this.gridConfig=i,y.assertDefaultSorting(this.gridConfig,this.dataUnit)}setFormConfig(i,t){this.formConfig&&!t||(this.formConfig=i)}closeGridConfig(){this._showPopUpGridConfig=!1}getPageSize(){return this.mode===f.IN_MEMORY?0:null==this.pageSize?150:this.pageSize}resolveResourceID(){return n.isEmpty(this.resourceID)?this._resourceID:this.resourceID}getFormConfig(){var i;const t=null===(i=this._formConfigManager)||void 0===i?void 0:i.getConfig(this.dataUnit,this.ignoreReadOnlyFormFields);return this.configName||t?t:this.formConfig}updateFormConfig(){let i=this.formConfig;null==this.formLegacyConfigName&&(i=Object.assign(Object.assign({},this.formConfig),{fields:this.dataUnit.metadata.fields})),this.setFormConfig(i,!0),null==this._formConfigManager&&(this._formConfigManager=new z(this.configName,this.resolveResourceID())),this._formConfigManager.setConfig(this.formConfig)}handleDataUnitOnInsertionMode(){this.enableGridInsert||this.goToView(g.FORM)}async initKeyboardManager(){var i;this._keyboardManager=new l({propagate:!1,element:this._element});const t=this.dataUnit||await(null===(i=this._snkDataUnit)||void 0===i?void 0:i.getDataUnit());null!=t&&this._keyboardManager.bind("F7",(()=>t.saveData()),{description:"Salva os dados.",element:this._element}).bind("F8",t.addRecord.bind(t),{description:"Adiciona um novo registro.",element:this._element}).bind("F9",t.removeSelectedRecords.bind(t),{description:"Remove o registro selecionado.",element:this._element}).bind("Escape",(()=>{t.isDirty()&&t.cancelEdition()}),{debounceTime:1e3,description:"Cancela uma ação.",element:this._element})}async handleFormConfigSaved(){await this.loadFormConfig(!0,!0)}focusToGrid(){this._grid.focus()}focusToForm(){this._form.focus()}renderTaskbarContent(i){var t;return s("snk-taskbar",{class:"ez-box--no-outline ez-box "+(this._currentViewMode===g.FORM?(this.outlineMode?"ez-box--outline":"ez-box--shadow-xsmall")+" ez-padding--small":""),dataUnit:this.dataUnit,primaryButton:(null===(t=this.dataState)||void 0===t?void 0:t.isDirty)?"SAVE":"INSERT","data-element-id":"grid_left",messagesBuilder:this.messagesBuilder,buttons:this._taskbarProcessor.buttons,actionsList:this.getActionsList(),actionsSettingsList:i===g.GRID?this.getSettingsListGrid():this.getSettingsListForm(),disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,"data-exporter-store-key":this.getDataExporterStoreKey(),slot:"leftButtons",presentationMode:F.SECONDARY,tabindex:"0"},s("slot",{name:"TASKBAR_CUSTOM_ELEMENTS"}))}render(){var i;if(null!=this.dataUnit)return s("snk-data-unit",{ref:i=>this._snkDataUnit=i,class:"simple-crud__container",dataUnit:this.dataUnit,useCancelConfirm:this.useCancelConfirm,onDataStateChange:i=>this.onDataStateChange(i),onCancelEdition:this.handleCancelEdit.bind(this),pageSize:this.getPageSize(),onInsertionMode:this.handleDataUnitOnInsertionMode.bind(this),onDataUnitReady:i=>this.dataUnitReady.emit(i.detail),onMessagesBuilderUpdated:i=>this.messagesBuilder=i.detail,onDataUnitFieldsHidded:this.updateFormConfig.bind(this),domainMessagesBuilder:this.domainMessagesBuilder},s("header",null,s("slot",{name:"snkSimpleCrudHeader"})),s("section",{class:`ez-box ez-box--no-outline ${this.outlineMode?"ez-box--outline":"ez-box--shadow"} simple-crud__container-section`,ref:i=>this._container=i,tabindex:"0"},s("ez-view-stack",{ref:i=>this._viewStack=i,"data-element-id":"simple-crud"},s("stack-item",null,s("ez-grid",{class:"ez-margin-bottom--large ez-box--no-outline",ref:i=>this._grid=i,dataUnit:this.dataUnit,config:this.gridConfig,"no-header":!0,multipleSelection:this.multipleSelection,onEzDoubleClick:()=>this.goToView(g.FORM),onConfigChange:i=>this.gridConfigChangeHandler(i),columnfilterDataSource:this.dataUnit.name&&this.dataUnit.name.includes(E.IN_MEMORY_DATA_UNIT_NAME)?void 0:this._multiSelectionListDataSource,useEnterLikeTab:this.useEnterLikeTab,autoFocus:this.autoFocus,enableGridInsert:this.enableGridInsert,enableContinuousInsert:this.enableContinuousInsert,enableLockManagerTaskbarClick:this.enableLockManagerTaskbarClick,enableLockManagerLoadingComp:this.enableLockManagerLoadingComp,outlineMode:this.outlineMode,tabindex:"0",paginationCounterMode:this.paginationCounterMode},this.renderTaskbarContent(g.GRID),s("div",{slot:"footer"},s("slot",{name:"snkSimpleCrudFooter"})))),s("stack-item",null,this.renderTaskbarContent(g.FORM),s("ez-form",{ref:i=>this._form=i,class:"ez-margin-top--large ez-box--no-outline",dataUnit:this.dataUnit,config:this.getFormConfig(),fieldToFocus:this._fieldToGetFocus,onEzFormSetFields:i=>this.handleFormSetFields(i.detail),onEzFormRequestClearFieldToFocus:this.clearFieldToFocusHandler.bind(this),elementFocusSearchField:this._container,tabindex:"0"}),s("snk-simple-form-config",{ref:i=>this._snkSimpleFormConfig=i,dataUnit:this.dataUnit,onSnkConfigSaved:this.handleFormConfigSaved.bind(this),configName:null!==(i=this.formLegacyConfigName)&&void 0!==i?i:this.configName})),this.messagesBuilder&&s("snk-configurator",{ref:i=>this._snkConfigurator=i,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:i=>this.goToView(i.detail),onOpenConfig:i=>this.openConfig(i.detail),showActionButtons:this.showConfiguratorButtons,onSave:i=>this.handleConfiguratorEvent(i,"SAVE"),onCancel:i=>this.handleConfiguratorEvent(i,"CANCEL"),resourceID:this.resolveResourceID(),customContainerId:this._customContainerId,layoutFormConfig:this.layoutFormConfig})),s("div",{id:`${this._customContainerId}`},s("slot",{name:"SnkConfigContainerSlot"}))),s("ez-popup",{size:"medium",heightMode:"auto",useHeader:!1,opened:this._showPopUpGridConfig,onEzClosePopup:()=>this.closeGridConfig()},s("snk-grid-config",{ref:i=>this._snkGridConfig=i,config:this.gridConfig,"data-element-id":this._element.getAttribute(u.DATA_ELEMENT_ID_ATTRIBUTE_NAME),selectedIndex:0,configName:this.configName,onConfigChange:i=>this.modalConfigChangeHandler(i),onConfigCancel:()=>this.closeGridConfig(),resourceID:this.resolveResourceID()})))}get _element(){return e(this)}static get watchers(){return{resourceID:["handleResourceIDChanged"],entityName:["onChangeEntityName"],mode:["onModeChange"],dataState:["observeDataState"],formLegacyConfigName:["observeFormLegacy"],gridLegacyConfigName:["observeGridLegacy"]}}};var O;!function(i){i.FORM_REGULAR="snkSimpleCrudTaskbar.form_regular",i.GRID_REGULAR="snkSimpleCrudTaskbar.grid_regular",i.FORM_SELECTED="snkSimpleCrudTaskbar.form_selected",i.GRID_SELECTED="snkSimpleCrudTaskbar.grid_selected",i.FINISH_EDITION="snkSimpleCrudTaskbar.finish_edition",i.MULTIPLE_EDITION="snkSimpleCrudTaskbar.multiple_edition"}(O||(O={})),L.style=".sc-snk-simple-crud-h{display:flex;height:100%;width:100%;--snk-simple-crud-grid--min-height:300px}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto 1fr;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}.simple-crud__form--hidden.sc-snk-simple-crud{display:none}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;--ez-grid__container--shadow--outline:none;--ez-grid--min-height:var(--snk-simple-crud-grid--min-height)}ez-form.sc-snk-simple-crud{min-height:300px}";export{L as snk_simple_crud}
@@ -1 +0,0 @@
1
- import{r as i,c as e,f as t,h as s,H as n}from"./p-d8d8169b.js";import{UserInterface as l,StringUtils as a,ObjectUtils as o,ApplicationContext as h}from"@sankhyalabs/core";import{b as d,D as r,c}from"./p-9019a32f.js";import{getConvertedValue as u}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{CheckMode as p}from"@sankhyalabs/ezui/dist/collection/utils";import{e as f,f as v,h as b,i as m}from"./p-35e73c5d.js";const g=class{constructor(t){i(this,t),this.fieldConfigChanged=e(this,"fieldConfigChanged",7),this.fieldLabel=void 0,this.fieldLabelErrorMessage=void 0,this.fieldDefaultValue=void 0,this.fieldCleanOnCopy=void 0,this.fieldRequired=void 0,this.fieldReadOnly=void 0,this._defaultType=void 0,this.dataUnit=void 0,this.fieldConfig=void 0,this.fieldDescriptor=void 0,this.messagesBuilder=void 0}observeFieldLabel(){this.validateFieldLabel&&(this.fieldLabelErrorMessage=void 0)}async show(i){this._popoupElement.opened=!0,this.initializeValues(),t(this)}validateFieldLabel(){var i;return!!(null===(i=this.fieldLabel)||void 0===i?void 0:i.trim())||(this.applyErrorMessage(),!1)}getMessage(i,e){return this.messagesBuilder.getMessage(i,e)}isAllowDefault(){var i;const e=null===(i=this.fieldDescriptor.properties)||void 0===i?void 0:i.allowDefault;return null==e||"true"===e}enabledValueDefault(){var i,e,t;const s=null===(i=this.fieldDescriptor.properties)||void 0===i?void 0:i.allowDefault;return(d.UserInterface.hasOwnProperty(null===(e=this.fieldDescriptor)||void 0===e?void 0:e.userInterface)||(null===(t=this.fieldDescriptor)||void 0===t?void 0:t.userInterface)===l.SEARCH)&&(null==s||"true"===s)}getDefaultType(){var i,e;return null!==(e=null===(i=this.fieldDefaultValue)||void 0===i?void 0:i.type)&&void 0!==e?e:r.fixed}emitFieldChanged(){this.fieldConfigChanged.emit(this.fieldConfig)}handleLabelChanged({detail:i}){this.fieldLabel=i}handleDefaultTypeChanged({detail:i}){const e=i.value;null!=e&&(this._defaultType=e,this.fieldDefaultValue={type:this._defaultType})}handleDefaultValueChanged({detail:i}){this.fieldDefaultValue.value=null==i?void 0:i.value}onChangeDefaultValue(i){this.fieldDefaultValue.value=f(i,this.dataUnit,this.fieldConfig.name)}handleClearDuplicateChanged({detail:i}){this.fieldCleanOnCopy=i}handleRequiredChanged({detail:i}){this.fieldRequired=i}handleReadOnlyChanged({detail:i}){this.fieldReadOnly=i}loadDefaultValue(){var i;(null===(i=this.fieldConfig.defaultValue)||void 0===i?void 0:i.type)?this._defaultType=this.fieldConfig.defaultValue.type:(this._defaultType=r.fixed,this.fieldConfig.defaultValue={type:this._defaultType})}buildOptions(){let i=this.fieldDescriptor.userInterface;return i===l.SEARCH&&(i=l.INTEGERNUMBER),d.UserInterface[i]}renderDefaultValueEditor(){return this._defaultType===r.variable?s("ez-combo-box",{label:this.getMessage("snkConfigOptions.label.valueDefault"),enabled:this.isAllowDefault(),onEzChange:i=>this.handleDefaultValueChanged(i),value:this.fieldDefaultValue.value,options:this.buildOptions()}):this.fieldDescriptor.userInterface&&this.buildFieldDefaultValueElement()}buildFieldDefaultValueElement(){var i;const{userInterface:e,properties:t,dataType:s}=this.fieldDescriptor;let n,o=a.getBooleanValue(null==t?void 0:t.allowDefault,!this.fieldReadOnly);e===l.FILE&&(o=!1),o&&(n=null===(i=this.fieldDefaultValue)||void 0===i?void 0:i.value,null!=n&&(n=u(s,n)));const h={value:n,enabled:o,label:this.fieldConfig.label,name:this.fieldConfig.name,required:this.fieldRequired,userInterface:e};switch(e){case l.SWITCH:return this.buildInputDefault(h,void 0,p.SWITCH);case l.CHECKBOX:return this.buildInputDefault(h,void 0,p.REGULAR);case l.OPTIONSELECTOR:case l.DECIMALNUMBER:return this.buildInputDefault(h,t);default:return this.buildInputDefault(h)}}buildInputDefault({value:i,enabled:e,label:t,name:n,required:a,userInterface:h},d,r){let u,p=0,f=0;const v=null==h||null==c[h]?c.DEFAULT:c[h];if(h===l.OPTIONSELECTOR){const i=null==d?void 0:d.options;if("string"==typeof i){const e=o.stringToObject(i);u=Object.keys(e).map((i=>({value:i,label:e[i]})))}else u=i}else h===l.DECIMALNUMBER&&(p=Number((null==d?void 0:d.precision)||2),f=Number((null==d?void 0:d.prettyPrecision)||p));return s(v,Object.assign({value:i,enabled:e,label:t,"data-field-name":n,key:n,onEzChange:i=>this.onChangeDefaultValue(null==i?void 0:i.detail)},this.getConditionalAttributes(h,a,u,p,f,r)))}getConditionalAttributes(i,e,t,s,n,a){const o=i==l.SEARCHPLUS;switch(i){case l.SEARCH:case l.SEARCHPLUS:return{suppressEmptyOption:e,optionLoader:i=>this.onSearchDefaultValue(i,{useSearchPlus:o})};case l.OPTIONSELECTOR:return{suppressEmptyOption:e,options:t};case l.CHECKBOX:case l.SWITCH:return{mode:a};case l.INTEGERNUMBER:case l.DECIMALNUMBER:return{precision:s,prettyPrecision:n,onEzStartChange:i=>this.onChangeDefaultValue(null==i?void 0:i.detail)};case l.DATE:case l.DATETIME:case l.TIME:return{onEzStartChange:i=>this.onChangeDefaultValue(null==i?void 0:i.detail)};default:return{}}}onSearchDefaultValue(i,e){if(this._application&&this.fieldConfig)return this._application.executeSearch(i,this.fieldConfig.name,this.dataUnit,e)}initializeValues(){this.fieldLabel=this.fieldConfig.label,this.fieldDefaultValue=this.fieldConfig.defaultValue,this.fieldRequired=this.fieldConfig.required,this.fieldReadOnly=this.fieldConfig.readOnly,this.fieldCleanOnCopy=this.fieldConfig.cleanOnCopy}handleApplyChanges(){this.validateFieldLabel()&&(this.fieldConfig.label=this.fieldLabel,this.fieldConfig.defaultValue=this.fieldDefaultValue,this.fieldConfig.required=this.fieldRequired,this.fieldConfig.readOnly=this.fieldReadOnly,this.fieldConfig.cleanOnCopy=this.fieldCleanOnCopy,this.emitFieldChanged(),this._popoupElement.opened=!1)}applyErrorMessage(){this.fieldLabelErrorMessage=`Informe um valor para ${this.getMessage("snkConfigOptions.label.nameField")}`}handleDiscardChanges(){this.initializeValues(),this._popoupElement.opened=!1}componentWillLoad(){this.loadDefaultValue(),this._application=h.getContextValue("__SNK__APPLICATION__")}render(){return s("ez-popup",{heightMode:"auto",size:"auto","ez-title":"Configuração do campo",onEzClosePopup:()=>this.handleDiscardChanges(),ref:i=>this._popoupElement=i},s("div",{class:"field-config-container"},s("ez-text-input",{label:this.getMessage("snkConfigOptions.label.nameField"),value:this.fieldLabel,errorMessage:this.fieldLabelErrorMessage,hasInvalid:!!this.fieldLabelErrorMessage,onEzChange:i=>this.handleLabelChanged(i)}),s("ez-combo-box",{label:this.getMessage("snkConfigOptions.label.typeValueDefault"),suppressEmptyOption:!0,enabled:this.enabledValueDefault(),onEzChange:i=>this.handleDefaultTypeChanged(i),value:this.getDefaultType()},s("option",{value:r.fixed},this.getMessage("snkConfigOptions.options.valueFixed")),s("option",{value:r.variable},this.getMessage("snkConfigOptions.options.variable"))),this.renderDefaultValueEditor(),s("ez-check",{label:this.getMessage("snkConfigOptions.label.clearDuplicate"),value:this.fieldCleanOnCopy,onEzChange:i=>this.handleClearDuplicateChanged(i)}),s("ez-check",{label:this.getMessage("snkConfigOptions.label.requiredField"),enabled:v("required","systemRequired",this.fieldDescriptor),value:b("required",this.fieldDescriptor,this.fieldRequired),onEzChange:i=>this.handleRequiredChanged(i)}),s("ez-check",{label:this.getMessage("snkConfigOptions.label.protectedField"),enabled:v("readOnly","systemReadOnly",this.fieldDescriptor),value:b("readOnly",this.fieldDescriptor,this.fieldReadOnly),onEzChange:i=>this.handleReadOnlyChanged(i)}),s("div",{class:"actions"},s("ez-button",{label:"Cancelar",onClick:()=>this.handleDiscardChanges()}),s("ez-button",{label:"Confirmar",class:"ez-button--primary",onClick:()=>this.handleApplyChanges()}))))}static get watchers(){return{fieldLabel:["observeFieldLabel"]}}};g.style=".field-config-container.sc-field-config{font-family:'Roboto';color:#2b3a54;display:flex;flex-direction:column;gap:10px;width:330px;justify-content:space-between}.header.sc-field-config{display:flex;font-weight:500;font-size:16px}.actions.sc-field-config{display:flex;align-items:flex-end;gap:12px}";const y=class{constructor(t){i(this,t),this.setFieldAsAvailable=e(this,"setFieldAsAvailable",7),this.addFieldToGuide=e(this,"addFieldToGuide",7),this.fieldDescriptor=void 0,this.fieldConfig=void 0,this.onLayoutConfig=!1,this.dataUnit=void 0,this.messagesBuilder=void 0}observeDataUnit(){this.loadFieldDescriptor()}isRequired(){var i,e;const t=this.dataUnit&&this.dataUnit.getField(null===(i=this.fieldConfig)||void 0===i?void 0:i.name);return!0===(null==t?void 0:t.required)||!0===(null===(e=this.fieldConfig)||void 0===e?void 0:e.required)}async showFieldConfig(){var i;await(null===(i=this._refFieldConfig)||void 0===i?void 0:i.show(this._editIconRef))}renderFieldConfig(){if(this.onLayoutConfig&&this.dataUnit&&this.messagesBuilder)return s("field-config",{ref:i=>this._refFieldConfig=i,fieldConfig:this.fieldConfig,dataUnit:this.dataUnit,fieldDescriptor:this.fieldDescriptor,messagesBuilder:this.messagesBuilder,onFieldConfigChanged:()=>t(this)})}renderActions(){return this.onLayoutConfig?s("div",{class:"actions hiddeble"},s("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:()=>this.setFieldAsAvailable.emit(this.fieldConfig),size:"medium",iconName:"minus",title:"Remover"}),s("ez-button",{ref:i=>this._editIconRef=i,mode:"icon",class:"ez-button--tertiary",onClick:this.showFieldConfig.bind(this),iconName:"edit",size:"medium",title:"Editar"})):s("div",{class:"actions hiddeble"},s("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:()=>this.addFieldToGuide.emit(this.fieldConfig),iconName:"plus",size:"medium",title:"Adicionar ao Layout"}))}loadFieldDescriptor(){this.dataUnit&&(this.fieldDescriptor=this.dataUnit.getField(this.fieldConfig.name))}renderRequiredMark(){if(this.isRequired())return s("span",{class:"required-mark"},"*")}componentWillLoad(){this.loadFieldDescriptor()}getFieldLabel(){var i,e;return(null===(i=this.fieldConfig)||void 0===i?void 0:i.label)?this.fieldConfig.label:null===(e=this.fieldDescriptor)||void 0===e?void 0:e.label}render(){var i;return s(n,{class:this.onLayoutConfig?"":"full-width"},s("div",{class:"icons"},s("ez-icon",{iconName:"drag-indicator"}),s("ez-icon",{iconName:m(null===(i=this.fieldDescriptor)||void 0===i?void 0:i.userInterface)})),s("span",{class:"label"},s("span",{class:"label-text",title:this.getFieldLabel()},this.getFieldLabel()),this.renderRequiredMark()),this.renderActions(),this.renderFieldConfig())}static get watchers(){return{dataUnit:["observeDataUnit"]}}};y.style=".sc-field-item-h {\n width: 32%;\n min-width: 200px;\n display: flex;\n padding: 12px 8px;\n border-radius: var(--border--radius-small, 4px);\n border: 1px solid #dce0e8;\n cursor: grab;\n align-items: center;\n height: 42px;\n max-height: 42px;\n background: #FAFCFF;\n}\n\n.ghost.sc-field-item-h{\n width: 32% !important;\n}\n\n@container (max-width: 430px) {\n .sc-field-item-h,\n .sc-field-item-h.ghost{\n width: 100% !important;\n }\n}\n\n@container (min-width: 431px) and (max-width: 632px) {\n .sc-field-item-h,\n .sc-field-item-h.ghost {\n width: 48% !important;\n }\n}\n\n.full-width.sc-field-item-h{\n width: 100%;\n}\n\nez-icon.sc-field-item {\n --ez-icon--color: #A2ABB9;\n}\n\n.icons.sc-field-item {\n display: flex;\n}\n\n.label.sc-field-item {\n display: flex;\n flex-grow: 1;\n padding-left: 8px;\n font-size: 14px;\n align-items: center;\n gap: 4px;\n height: 22px;\n}\n\n.label-text.sc-field-item {\n overflow: hidden;\n -webkit-hyphens: auto;\n -ms-hyphens: auto;\n hyphens: auto;\n height: auto;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n display: -webkit-box;\n -o-text-overflow: ellipsis;\n text-overflow: ellipsis;\n word-break: break-word;\n}\n\n.required-mark.sc-field-item {\n color: #cf3105;\n background: #F7E0E5;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n padding-top: 5px;\n font-size: 16px;\n align-self: self-start;\n}\n\n\n.actions.sc-field-item {\n display: flex;\n flex-direction: row;\n align-content: center;\n gap: 4px;\n}\n\nez-button.sc-field-item {\n width: 24px;\n align-items: center;\n justify-content: center;\n display: flex;\n}\n\n.sc-field-item-h .hiddeble.sc-field-item {\n transition: 0.2s ease-in-out;\n visibility: hidden;\n opacity: 0;\n}\n\n.sc-field-item-h:hover .hiddeble.sc-field-item {\n visibility: visible;\n opacity: 1;\n}";export{g as field_config,y as field_item}