@sankhyalabs/sankhyablocks 10.1.0-dev.13 → 10.1.0-dev.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-5c0590b3.js → ConfigStorage-a4e1e518.js} +2 -2
- package/dist/cjs/{DataFetcher-5181a917.js → DataFetcher-0b6aa084.js} +11 -22
- package/dist/cjs/{ISave-0f98a457.js → ISave-2c455a77.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-1907ffed.js → SnkFormConfigManager-b8c81493.js} +2 -2
- package/dist/cjs/{SnkMultiSelectionListDataSource-e4e38139.js → SnkMultiSelectionListDataSource-72925620.js} +5 -5
- package/dist/cjs/{auth-fetcher-cff55b1f.js → auth-fetcher-7e7796c9.js} +1 -1
- package/dist/cjs/config-header.cjs.entry.js +1 -1
- package/dist/cjs/configs-button.cjs.entry.js +1 -1
- package/dist/cjs/{dataunit-fetcher-1ba5e2cc.js → dataunit-fetcher-8dffbcdf.js} +1 -1
- package/dist/cjs/field-config_2.cjs.entry.js +1 -1
- package/dist/cjs/fields-layout.cjs.entry.js +1 -1
- package/dist/cjs/fields-selector.cjs.entry.js +1 -1
- package/dist/cjs/{form-config-fetcher-4a679e23.js → form-config-fetcher-5516d68a.js} +1 -1
- package/dist/cjs/guides-configurator.cjs.entry.js +1 -1
- package/dist/cjs/{index-13d05f03.js → index-516250fa.js} +1 -1
- package/dist/cjs/{index-1cf293c1.js → index-dc83c596.js} +0 -17
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +5 -5
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_9.cjs.entry.js +6 -6
- package/dist/cjs/snk-actions-form.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +7 -7
- package/dist/cjs/snk-attach.cjs.entry.js +8 -8
- package/dist/cjs/snk-client-confirm.cjs.entry.js +1 -1
- package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +8 -8
- package/dist/cjs/snk-custom-slot-elements.cjs.entry.js +1 -1
- package/dist/cjs/snk-custom-slot-guide.cjs.entry.js +1 -1
- package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -6
- package/dist/cjs/{snk-data-unit-061487a8.js → snk-data-unit-47f02b9e.js} +3 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
- package/dist/cjs/snk-default-filter.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +10 -10
- package/dist/cjs/snk-entity-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
- package/dist/cjs/snk-expression-group_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +4 -4
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +4 -4
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-summary.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-view.cjs.entry.js +1 -1
- package/dist/cjs/snk-form_2.cjs.entry.js +5 -5
- package/dist/cjs/snk-grid.cjs.entry.js +20 -14
- package/dist/cjs/{snk-guides-viewer-2efe60a7.js → snk-guides-viewer-41c22d96.js} +7 -7
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +10 -10
- package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +5 -5
- package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
- package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +10 -10
- package/dist/cjs/snk-taskbar.cjs.entry.js +3 -3
- package/dist/cjs/{taskbar-elements-fb5d1e08.js → taskbar-elements-756fcbe7.js} +2 -2
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.js +12 -7
- package/dist/collection/lib/message/SnkMessageBuilder.js +11 -2
- package/dist/components/DataFetcher.js +11 -2
- package/dist/components/snk-grid2.js +12 -6
- package/dist/esm/{ConfigStorage-bd096633.js → ConfigStorage-39ac8fef.js} +2 -2
- package/dist/esm/{DataFetcher-5780ad39.js → DataFetcher-0b9da57d.js} +11 -2
- package/dist/esm/{ISave-8a22ec18.js → ISave-f1c9269b.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-437e98bb.js → SnkFormConfigManager-a87566c8.js} +2 -2
- package/dist/esm/{SnkMultiSelectionListDataSource-42125ef4.js → SnkMultiSelectionListDataSource-493ae8c8.js} +5 -5
- package/dist/esm/{auth-fetcher-28b9d0db.js → auth-fetcher-acdc1cb4.js} +1 -1
- package/dist/esm/config-header.entry.js +1 -1
- package/dist/esm/configs-button.entry.js +1 -1
- package/dist/esm/{dataunit-fetcher-c4251d80.js → dataunit-fetcher-4c312b43.js} +1 -1
- package/dist/esm/field-config_2.entry.js +1 -1
- package/dist/esm/fields-layout.entry.js +1 -1
- package/dist/esm/fields-selector.entry.js +1 -1
- package/dist/esm/{form-config-fetcher-d0536a71.js → form-config-fetcher-7cda6254.js} +1 -1
- package/dist/esm/guides-configurator.entry.js +1 -1
- package/dist/esm/{index-446f9341.js → index-3355bd17.js} +1 -1
- package/dist/esm/{index-479e1293.js → index-7fd74680.js} +0 -17
- package/dist/esm/loader.js +2 -2
- package/dist/esm/pesquisa-grid_2.entry.js +5 -5
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-actions-button_9.entry.js +6 -6
- package/dist/esm/snk-actions-form.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +7 -7
- package/dist/esm/snk-attach.entry.js +8 -8
- package/dist/esm/snk-client-confirm.entry.js +1 -1
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +8 -8
- package/dist/esm/snk-custom-slot-elements.entry.js +1 -1
- package/dist/esm/snk-custom-slot-guide.entry.js +1 -1
- package/dist/esm/snk-data-exporter.entry.js +6 -6
- package/dist/esm/{snk-data-unit-4a1ef77f.js → snk-data-unit-9e9d9d46.js} +3 -3
- package/dist/esm/snk-data-unit.entry.js +4 -4
- package/dist/esm/snk-default-filter.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +10 -10
- package/dist/esm/snk-entity-list.entry.js +1 -1
- package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
- package/dist/esm/snk-expression-group_2.entry.js +2 -2
- package/dist/esm/snk-filter-advanced-mode_2.entry.js +1 -1
- package/dist/esm/snk-filter-bar_4.entry.js +4 -4
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
- package/dist/esm/snk-filter-detail.entry.js +1 -1
- package/dist/esm/snk-filter-field-search_2.entry.js +1 -1
- package/dist/esm/snk-filter-modal-item.entry.js +4 -4
- package/dist/esm/snk-filter-multi-select.entry.js +1 -1
- package/dist/esm/snk-filter-number.entry.js +1 -1
- package/dist/esm/snk-filter-period.entry.js +1 -1
- package/dist/esm/snk-filter-search.entry.js +1 -1
- package/dist/esm/snk-filter-text.entry.js +1 -1
- package/dist/esm/snk-form-summary.entry.js +1 -1
- package/dist/esm/snk-form-view.entry.js +1 -1
- package/dist/esm/snk-form_2.entry.js +5 -5
- package/dist/esm/snk-grid.entry.js +20 -14
- package/dist/esm/{snk-guides-viewer-c182d058.js → snk-guides-viewer-31ef5fc6.js} +7 -7
- package/dist/esm/snk-guides-viewer.entry.js +10 -10
- package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
- package/dist/esm/snk-personalized-filter.entry.js +5 -5
- package/dist/esm/snk-pesquisa.entry.js +5 -5
- package/dist/esm/snk-print-selector.entry.js +1 -1
- package/dist/esm/snk-simple-bar.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +10 -10
- package/dist/esm/snk-taskbar.entry.js +3 -3
- package/dist/esm/{taskbar-elements-faaf5d8f.js → taskbar-elements-bf5b73f1.js} +2 -2
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/p-02cb4829.entry.js +1 -0
- package/dist/sankhyablocks/{p-78d4b3e3.entry.js → p-0893a694.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5d408e7e.entry.js → p-0da30fd9.entry.js} +1 -1
- package/dist/sankhyablocks/{p-55d7abe7.js → p-156c9f38.js} +1 -1
- package/dist/sankhyablocks/{p-f35f2eb3.entry.js → p-17856827.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b987e15d.js → p-1be69fd4.js} +1 -1
- package/dist/sankhyablocks/{p-e679c75a.entry.js → p-1dba30c9.entry.js} +1 -1
- package/dist/sankhyablocks/{p-21107f0d.entry.js → p-1e469905.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0e4f8b86.js → p-1f310bc6.js} +1 -1
- package/dist/sankhyablocks/{p-96d45943.entry.js → p-227e82b2.entry.js} +1 -1
- package/dist/sankhyablocks/p-2624dfd2.entry.js +1 -0
- package/dist/sankhyablocks/{p-aca74b21.js → p-2ac55a5d.js} +1 -1
- package/dist/sankhyablocks/{p-99a11017.entry.js → p-301baf9c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2e882241.entry.js → p-357e10e0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-987cd79d.entry.js → p-35a26068.entry.js} +1 -1
- package/dist/sankhyablocks/{p-180716b2.entry.js → p-3671cdd4.entry.js} +1 -1
- package/dist/sankhyablocks/{p-27482793.entry.js → p-4575c4aa.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3c046287.js → p-48a5c311.js} +2 -2
- package/dist/sankhyablocks/{p-3d41f5a8.entry.js → p-497ece60.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6e5af618.entry.js → p-4deb7f46.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9f16d33e.entry.js → p-4e9e570c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3b167a03.entry.js → p-516411de.entry.js} +1 -1
- package/dist/sankhyablocks/{p-162bddae.entry.js → p-522d36aa.entry.js} +1 -1
- package/dist/sankhyablocks/p-52691b42.js +1 -0
- package/dist/sankhyablocks/{p-825098c1.entry.js → p-56b1b397.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d3534985.js → p-59158ba4.js} +1 -1
- package/dist/sankhyablocks/{p-c98c79c3.entry.js → p-5c9bea92.entry.js} +1 -1
- package/dist/sankhyablocks/{p-91a9abb6.entry.js → p-613eb22e.entry.js} +1 -1
- package/dist/sankhyablocks/{p-49ddc27a.entry.js → p-670b8802.entry.js} +1 -1
- package/dist/sankhyablocks/{p-60dd1d27.entry.js → p-67137d7c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1b1373b6.js → p-6768f176.js} +1 -1
- package/dist/sankhyablocks/{p-03f02b12.entry.js → p-7375bf6a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b7e891cc.entry.js → p-7961c550.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4db9dbf8.js → p-7ee6b1bf.js} +1 -1
- package/dist/sankhyablocks/{p-75af335e.entry.js → p-82b59a45.entry.js} +1 -1
- package/dist/sankhyablocks/p-82bb3eda.js +2 -0
- package/dist/sankhyablocks/{p-55798617.js → p-8336900b.js} +1 -1
- package/dist/sankhyablocks/{p-d2ec9a24.entry.js → p-8488fa7e.entry.js} +1 -1
- package/dist/sankhyablocks/{p-cb4343c4.entry.js → p-8783d550.entry.js} +1 -1
- package/dist/sankhyablocks/{p-471b34f4.entry.js → p-8d76a0ca.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9a63f3f7.entry.js → p-8d84d6ab.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a1d23fef.js → p-907e96eb.js} +1 -1
- package/dist/sankhyablocks/{p-e258de96.entry.js → p-939523b3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a9b16874.entry.js → p-959fe522.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7e250432.entry.js → p-98c70173.entry.js} +1 -1
- package/dist/sankhyablocks/{p-82a3d522.entry.js → p-98e3d0a1.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9ab6ae1e.js → p-9e4555ab.js} +2 -2
- package/dist/sankhyablocks/{p-2fdac5e6.entry.js → p-abfc9880.entry.js} +1 -1
- package/dist/sankhyablocks/{p-1037ea7b.entry.js → p-b5832fa0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-01ca59fc.entry.js → p-c2bb0659.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7f7fe6c4.entry.js → p-c60d864f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-028fb380.entry.js → p-cb7c592f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f3027bc9.entry.js → p-cc68a0c1.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c3dbf441.entry.js → p-ce207f2a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c4fcf1fb.entry.js → p-cfa4c183.entry.js} +1 -1
- package/dist/sankhyablocks/{p-42272de8.entry.js → p-d5d7fe52.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b04db4ac.entry.js → p-dd89bc02.entry.js} +1 -1
- package/dist/sankhyablocks/{p-667cab42.entry.js → p-def17f0e.entry.js} +1 -1
- package/dist/sankhyablocks/p-e41c86b2.entry.js +1 -0
- package/dist/sankhyablocks/{p-4c2e2767.entry.js → p-e47d6f17.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7345782c.entry.js → p-fd1a5a61.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-grid/snk-grid.d.ts +1 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-30a58e29.entry.js +0 -1
- package/dist/sankhyablocks/p-903fa0b4.entry.js +0 -1
- package/dist/sankhyablocks/p-b9699067.js +0 -1
- package/dist/sankhyablocks/p-d8d8169b.js +0 -2
- package/dist/sankhyablocks/p-fd05e31d.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,c as t,h as e,F as s,H as n}from"./p-d8d8169b.js";import{StringUtils as l,ObjectUtils as a,ApplicationContext as r,ElementIDUtils as o}from"@sankhyalabs/core";import{P as h}from"./p-988afe78.js";import{P as d,C as c}from"./p-0e4f8b86.js";import{ApplicationUtils as f}from"@sankhyalabs/ezui/dist/collection/utils";import{a as p,D as z}from"./p-84345e7a.js";import{s as u}from"./p-55798617.js";import"./p-ff1990ad.js";import"./p-4db9dbf8.js";import"./p-1b1373b6.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";const m=class{constructor(e){i(this,e),this.ezCancel=t(this,"ezCancel",7),this.ezSave=t(this,"ezSave",7),this.ezAfterSave=t(this,"ezAfterSave",7),this._personalizedFilterFetcher=new d,this._filterMetadataStorage=new Map,this._dataSourceFetcher={fetchData:async i=>{let t=null==i?void 0:i.uri;if(l.isEmpty(t)&&(t=this.entityUri),!this._filterMetadataStorage.has(t)){const i=await this._personalizedFilterFetcher.loadFields(t);this._filterMetadataStorage.set(t,i)}return this._filterMetadataStorage.get(t)}},this._filterAssistentMode=!0,this._filterAssistent=void 0,this.messagesBuilder=void 0,this.entityUri=void 0,this.filterId=void 0,this.configName=void 0,this.resourceID=void 0,this.isDefaultFilter=!1}async createPersonalizedFilter(){const i={name:"",active:!0,expression:"",parameters:[],assistent:{id:l.generateUUID(),items:[{id:l.generateUUID(),entityName:"",fieldName:"",description:"",fieldLabel:this.getMessage("snkPersonalizedFilter.info.labelDefaultValue"),type:void 0,expression:void 0,operand:void 0,paramVariable:!1,value:void 0,systemConfig:null,userConfig:null}],childrenGroups:[],operand:p.AND}};this.isDefaultFilter&&this.buildDataDefaultFilter(i),this._originalFilterAssistent=a.copy(i),this._filterAssistent=a.copy(i)}loadFilter(i,t){null!=i&&t!=i&&null!=this.resourceID&&(i!==z.id?c.loadPersonalizedFilter(i,this.resourceID,this.configName).then((i=>{const t=this.applyDefaultValues(i);this._filterAssistent=t,this._originalFilterAssistent=a.copy(t),this._filterAssistentMode=this._filterAssistent.hasOwnProperty("assistent")&&null!=this._filterAssistent.assistent})):c.loadDefaultFilter(i,this.resourceID,this.configName).then((i=>{const t=this.applyDefaultValues(i);this._filterAssistent=t,this._originalFilterAssistent=a.copy(t),this._filterAssistentMode=this._filterAssistent.hasOwnProperty("assistent")&&null!=this._filterAssistent.assistent})))}componentWillLoad(){var i;null==u.get(`filterFieldsDataSource.${this.entityUri}`)&&u.set(`filterFieldsDataSource.${this.entityUri}`,this._dataSourceFetcher),this.messagesBuilder||(this._application=r.getContextValue("__SNK__APPLICATION__"),this.messagesBuilder=null===(i=this._application)||void 0===i?void 0:i.messagesBuilder),this.loadFilter(this.filterId,void 0)}componentDidRender(){var i;null===(i=this._viewStackRef)||void 0===i||i.show(this._filterAssistentMode?0:1),this._elButtonMode&&this._elButtonMode.setAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME,o.getInternalIDInfo(this._filterAssistentMode?"advancedMode_ezButton":"assistentMode_ezButton"))}buildDataDefaultFilter(i){i.name=z.name,i.id=z.id}getMessage(i,t){return this._application.messagesBuilder.getMessage(i,t)}async saveFilter(){let i;i=this.isDefaultFilter?await c.saveDefaultFilter(this._filterAssistent,this.resourceID,this.configName):await c.savePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName),this._elButtonSave.enabled=!1,f.info(this.getMessage(`snkPersonalizedFilter.${this._filterAssistent.id?"confirmEdit":"confirmSave"}.title`),{iconName:"check"});const t=Object.assign(Object.assign({},i),this._filterAssistent);t.parameters=h.buildVariableParameters(this._filterAssistent.assistent),this._originalFilterAssistent=a.copy(t),this._filterAssistent=a.copy(t),this.ezAfterSave.emit()}removeFilter(){c.removePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName)}hasChangesToSave(){return JSON.stringify(this._filterAssistent)===JSON.stringify(this._originalFilterAssistent)}async handleSave(){if(this._filterAssistentMode){if(!h.validateFields(this._filterAssistent.assistent)||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));this.saveAssistentMode()}else{if(!this._filterAssistent.expression||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));if(!await this.validateExpressionBeforeSaving())return;this.saveAdvancedMode()}}saveAssistentMode(){const{assistent:i,expression:t}=this._filterAssistent,e=i?h.buildGroupExpression(i):t;this._filterAssistent.expression=e,this.ezSave.emit(e),this.saveFilter()}saveAdvancedMode(){this._originalFilterAssistent.expression!==this._filterAssistent.expression&&this._filterAssistent.assistent?f.confirm(this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.description")).then((i=>{i&&this.saveAndTransformToAdvancedMode()})):this._filterAssistent.assistent?this.saveAssistentMode():this.saveAndTransformToAdvancedMode()}saveAndTransformToAdvancedMode(){this._filterAssistent.assistent=void 0,this.ezSave.emit(this._filterAssistent.expression),this.saveFilter()}async validateExpressionBeforeSaving(){const{valid:i,message:t=""}=await this._personalizedFilterFetcher.validatePersonalizedFilter(this.entityUri,this._filterAssistent.expression);return i||this._application.error(this.getMessage("snkPersonalizedFilter.errorValidation.title"),t.replace(/.*Exception: /,"")),i}handleCancel(){if(this.hasChangesToSave())return this.ezCancel.emit();f.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"),this.getMessage("snkPersonalizedFilter.confirmCancel.description")).then((i=>{var t;i&&(this._filterAssistent=a.copy(null!==(t=this._originalFilterAssistent)&&void 0!==t?t:{}),this.ezCancel.emit(),this._elButtonSave.enabled=!1)}))}handleTitleChange(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{name:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}applyDefaultValues(i){return this.addLabelToItems(i),this.addFilterGroupCondition(i),i}addFilterGroupCondition(i){i.assistent&&!i.assistent.operand&&(i.assistent.operand=p.AND)}addLabelToItems(i){i.assistent&&i.assistent.items&&i.assistent.items.length>0&&i.assistent.items.forEach((t=>{if(null==t.fieldLabel){const e=(i.parameters||[]).find((i=>i.fieldName===t.fieldName));e&&(t.fieldLabel=e.label)}}))}handleExpressionChangeAdvancedMode(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}handleChangeFilterAssistentMode(i){this._elButtonSave.enabled=!this.hasChangesToSave(),this._filterAssistent=Object.assign({},i)}selectField(i){if(!("name"in i))return;const t=this.buildExpression(i.entityName,i.name,i.entityPath);this._elAdvancedMode.querySelector("ez-text-area").appendTextToSelection(t)}buildExpression(i,t,e){return e.length>0&&e.shift(),e.length>0?`${e.join("->")}->${t}`:`${i}.${t}`}onAddField(i){this._elAdvancedMode.querySelector("ez-text-area").setFocus(),i.setBlur(),this._elFilterFieldSearch&&this._elFilterFieldSearch.show(i,{horizontalGap:0,verticalGap:12,fromRight:!0})}renderButtonAddField(){if(!this._filterAssistentMode)return e(s,null,e("ez-button",{class:"snk-personalized-filter__button-mode",label:this.getMessage("snkPersonalizedFilter.info.addField"),enabled:!0,onClick:i=>this.onAddField(i.target)},e("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:"plus"})),e("snk-filter-field-search",{class:"ez-padding-left--medium",ref:i=>this._elFilterFieldSearch=i,onEzSelectFilterItem:i=>this.selectField(i.detail),fieldsDataSource:this._dataSourceFetcher}))}buildContainerPersonalizedFilter(){return e("ez-view-stack",{ref:i=>this._viewStackRef=i},e("stack-item",null,this._filterAssistentMode&&e("snk-filter-assistent-mode",{filterAssistent:this._filterAssistent,messagesBuilder:this.messagesBuilder,filterId:this.filterId,entityUri:this.entityUri,application:this._application,onEzChangeFilter:i=>this.handleChangeFilterAssistentMode(i.detail),isDefaultFilter:this.isDefaultFilter})),e("stack-item",null,e("snk-filter-advanced-mode",{ref:i=>this._elAdvancedMode=i,filterAssistent:this._filterAssistent,application:this._application,onEzExpressionChange:i=>this.handleExpressionChangeAdvancedMode(i.detail)})))}handleModeChange(){var i,t;if(this._filterAssistentMode)f.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.description")).then((i=>{if(i&&(this._filterAssistentMode=!this._filterAssistentMode,!this.hasChangesToSave())){const i=h.buildGroupExpression(this._filterAssistent.assistent);this._filterAssistent.expression=i,this._elButtonSave.enabled=!this.hasChangesToSave()}}));else if((null===(i=this._filterAssistent)||void 0===i?void 0:i.expression)===(null===(t=this._originalFilterAssistent)||void 0===t?void 0:t.expression))this._filterAssistentMode=!this._filterAssistentMode;else{const i=this._filterAssistent.expression,t=h.buildGroupExpression(this._filterAssistent.assistent);i!==t?f.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.description")).then((i=>{i&&(this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:t}),this._filterAssistentMode=!this._filterAssistentMode)})):this._filterAssistentMode=!this._filterAssistentMode}}buildTitle(){return this.getMessage(this.isDefaultFilter&&!this.filterId?"snkPersonalizedFilter.info.titleCreateDefault":this.isDefaultFilter&&this.filterId?"snkPersonalizedFilter.info.titleEditDefault":this.filterId?"snkPersonalizedFilter.info.titleEdit":"snkPersonalizedFilter.info.titleAdd")}render(){var i,t,s,l;if((null===(i=this._filterAssistent)||void 0===i?void 0:i.assistent)||!this._filterAssistentMode)return e(n,null,e("div",{class:"snk-personalized-filter"},e("div",null,e("snk-simple-bar",{label:this.buildTitle(),onExit:()=>this.handleCancel()},e("div",{class:"snk-personalized-filter__header-actions",slot:"rightSlot"},e("ez-button",{size:"small",label:this.getMessage("snkPersonalizedFilter.info.labelCancel"),onClick:()=>this.handleCancel()}),e("ez-button",{size:"small",ref:i=>this._elButtonSave=i,enabled:!1,class:"ez-button--primary",label:this.getMessage("snkPersonalizedFilter.info.labelSave"),onClick:this.handleSave.bind(this)})))),e("div",{class:"ez-box ez-margin-bottom--medium ez-box__main"},e("div",{class:"ez-box__container"},e("div",{class:"ez-flex ez-flex--column ez-size-width--full"},e("div",{class:"ez-flex"},e("ez-tooltip",{message:this.getMessage("snkPersonalizedFilter.info.textInputDisabled"),active:this.isDefaultFilter},e("ez-text-input",{class:"ez-padding-right--medium",label:this.getMessage("snkPersonalizedFilter.info.labelNameFilter"),value:null===(t=this._filterAssistent)||void 0===t?void 0:t.name,onEzChange:i=>this.handleTitleChange(i.detail),enabled:!this.isDefaultFilter})),this.renderButtonAddField(),e("ez-button",{ref:i=>this._elButtonMode=i,class:"snk-personalized-filter__button-mode",label:this.getMessage(this._filterAssistentMode?"snkPersonalizedFilter.info.activeModeAdvanced":"snkPersonalizedFilter.info.activeModeAssistent"),onClick:()=>this.handleModeChange(),"data-tooltip":this._filterAssistentMode||(null===(s=this._filterAssistent)||void 0===s?void 0:s.assistent)?void 0:this.getMessage("snkPersonalizedFilter.info.tooltipDisabledAssistentMode"),"data-flow":"bottom",enabled:!this._filterAssistent.name||Boolean(this._filterAssistentMode||(null===(l=this._filterAssistent)||void 0===l?void 0:l.assistent))})),this.buildContainerPersonalizedFilter())))))}static get watchers(){return{filterId:["loadFilter"]}}};m.style=".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";export{m as snk_personalized_filter}
|
|
1
|
+
import{r as i,c as t,h as e,F as s,H as n}from"./p-82bb3eda.js";import{StringUtils as l,ObjectUtils as a,ApplicationContext as r,ElementIDUtils as o}from"@sankhyalabs/core";import{P as h}from"./p-988afe78.js";import{P as d,C as c}from"./p-1f310bc6.js";import{ApplicationUtils as f}from"@sankhyalabs/ezui/dist/collection/utils";import{a as p,D as z}from"./p-84345e7a.js";import{s as u}from"./p-8336900b.js";import"./p-ff1990ad.js";import"./p-7ee6b1bf.js";import"./p-6768f176.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";const m=class{constructor(e){i(this,e),this.ezCancel=t(this,"ezCancel",7),this.ezSave=t(this,"ezSave",7),this.ezAfterSave=t(this,"ezAfterSave",7),this._personalizedFilterFetcher=new d,this._filterMetadataStorage=new Map,this._dataSourceFetcher={fetchData:async i=>{let t=null==i?void 0:i.uri;if(l.isEmpty(t)&&(t=this.entityUri),!this._filterMetadataStorage.has(t)){const i=await this._personalizedFilterFetcher.loadFields(t);this._filterMetadataStorage.set(t,i)}return this._filterMetadataStorage.get(t)}},this._filterAssistentMode=!0,this._filterAssistent=void 0,this.messagesBuilder=void 0,this.entityUri=void 0,this.filterId=void 0,this.configName=void 0,this.resourceID=void 0,this.isDefaultFilter=!1}async createPersonalizedFilter(){const i={name:"",active:!0,expression:"",parameters:[],assistent:{id:l.generateUUID(),items:[{id:l.generateUUID(),entityName:"",fieldName:"",description:"",fieldLabel:this.getMessage("snkPersonalizedFilter.info.labelDefaultValue"),type:void 0,expression:void 0,operand:void 0,paramVariable:!1,value:void 0,systemConfig:null,userConfig:null}],childrenGroups:[],operand:p.AND}};this.isDefaultFilter&&this.buildDataDefaultFilter(i),this._originalFilterAssistent=a.copy(i),this._filterAssistent=a.copy(i)}loadFilter(i,t){null!=i&&t!=i&&null!=this.resourceID&&(i!==z.id?c.loadPersonalizedFilter(i,this.resourceID,this.configName).then((i=>{const t=this.applyDefaultValues(i);this._filterAssistent=t,this._originalFilterAssistent=a.copy(t),this._filterAssistentMode=this._filterAssistent.hasOwnProperty("assistent")&&null!=this._filterAssistent.assistent})):c.loadDefaultFilter(i,this.resourceID,this.configName).then((i=>{const t=this.applyDefaultValues(i);this._filterAssistent=t,this._originalFilterAssistent=a.copy(t),this._filterAssistentMode=this._filterAssistent.hasOwnProperty("assistent")&&null!=this._filterAssistent.assistent})))}componentWillLoad(){var i;null==u.get(`filterFieldsDataSource.${this.entityUri}`)&&u.set(`filterFieldsDataSource.${this.entityUri}`,this._dataSourceFetcher),this.messagesBuilder||(this._application=r.getContextValue("__SNK__APPLICATION__"),this.messagesBuilder=null===(i=this._application)||void 0===i?void 0:i.messagesBuilder),this.loadFilter(this.filterId,void 0)}componentDidRender(){var i;null===(i=this._viewStackRef)||void 0===i||i.show(this._filterAssistentMode?0:1),this._elButtonMode&&this._elButtonMode.setAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME,o.getInternalIDInfo(this._filterAssistentMode?"advancedMode_ezButton":"assistentMode_ezButton"))}buildDataDefaultFilter(i){i.name=z.name,i.id=z.id}getMessage(i,t){return this._application.messagesBuilder.getMessage(i,t)}async saveFilter(){let i;i=this.isDefaultFilter?await c.saveDefaultFilter(this._filterAssistent,this.resourceID,this.configName):await c.savePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName),this._elButtonSave.enabled=!1,f.info(this.getMessage(`snkPersonalizedFilter.${this._filterAssistent.id?"confirmEdit":"confirmSave"}.title`),{iconName:"check"});const t=Object.assign(Object.assign({},i),this._filterAssistent);t.parameters=h.buildVariableParameters(this._filterAssistent.assistent),this._originalFilterAssistent=a.copy(t),this._filterAssistent=a.copy(t),this.ezAfterSave.emit()}removeFilter(){c.removePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName)}hasChangesToSave(){return JSON.stringify(this._filterAssistent)===JSON.stringify(this._originalFilterAssistent)}async handleSave(){if(this._filterAssistentMode){if(!h.validateFields(this._filterAssistent.assistent)||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));this.saveAssistentMode()}else{if(!this._filterAssistent.expression||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));if(!await this.validateExpressionBeforeSaving())return;this.saveAdvancedMode()}}saveAssistentMode(){const{assistent:i,expression:t}=this._filterAssistent,e=i?h.buildGroupExpression(i):t;this._filterAssistent.expression=e,this.ezSave.emit(e),this.saveFilter()}saveAdvancedMode(){this._originalFilterAssistent.expression!==this._filterAssistent.expression&&this._filterAssistent.assistent?f.confirm(this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.description")).then((i=>{i&&this.saveAndTransformToAdvancedMode()})):this._filterAssistent.assistent?this.saveAssistentMode():this.saveAndTransformToAdvancedMode()}saveAndTransformToAdvancedMode(){this._filterAssistent.assistent=void 0,this.ezSave.emit(this._filterAssistent.expression),this.saveFilter()}async validateExpressionBeforeSaving(){const{valid:i,message:t=""}=await this._personalizedFilterFetcher.validatePersonalizedFilter(this.entityUri,this._filterAssistent.expression);return i||this._application.error(this.getMessage("snkPersonalizedFilter.errorValidation.title"),t.replace(/.*Exception: /,"")),i}handleCancel(){if(this.hasChangesToSave())return this.ezCancel.emit();f.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"),this.getMessage("snkPersonalizedFilter.confirmCancel.description")).then((i=>{var t;i&&(this._filterAssistent=a.copy(null!==(t=this._originalFilterAssistent)&&void 0!==t?t:{}),this.ezCancel.emit(),this._elButtonSave.enabled=!1)}))}handleTitleChange(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{name:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}applyDefaultValues(i){return this.addLabelToItems(i),this.addFilterGroupCondition(i),i}addFilterGroupCondition(i){i.assistent&&!i.assistent.operand&&(i.assistent.operand=p.AND)}addLabelToItems(i){i.assistent&&i.assistent.items&&i.assistent.items.length>0&&i.assistent.items.forEach((t=>{if(null==t.fieldLabel){const e=(i.parameters||[]).find((i=>i.fieldName===t.fieldName));e&&(t.fieldLabel=e.label)}}))}handleExpressionChangeAdvancedMode(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}handleChangeFilterAssistentMode(i){this._elButtonSave.enabled=!this.hasChangesToSave(),this._filterAssistent=Object.assign({},i)}selectField(i){if(!("name"in i))return;const t=this.buildExpression(i.entityName,i.name,i.entityPath);this._elAdvancedMode.querySelector("ez-text-area").appendTextToSelection(t)}buildExpression(i,t,e){return e.length>0&&e.shift(),e.length>0?`${e.join("->")}->${t}`:`${i}.${t}`}onAddField(i){this._elAdvancedMode.querySelector("ez-text-area").setFocus(),i.setBlur(),this._elFilterFieldSearch&&this._elFilterFieldSearch.show(i,{horizontalGap:0,verticalGap:12,fromRight:!0})}renderButtonAddField(){if(!this._filterAssistentMode)return e(s,null,e("ez-button",{class:"snk-personalized-filter__button-mode",label:this.getMessage("snkPersonalizedFilter.info.addField"),enabled:!0,onClick:i=>this.onAddField(i.target)},e("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:"plus"})),e("snk-filter-field-search",{class:"ez-padding-left--medium",ref:i=>this._elFilterFieldSearch=i,onEzSelectFilterItem:i=>this.selectField(i.detail),fieldsDataSource:this._dataSourceFetcher}))}buildContainerPersonalizedFilter(){return e("ez-view-stack",{ref:i=>this._viewStackRef=i},e("stack-item",null,this._filterAssistentMode&&e("snk-filter-assistent-mode",{filterAssistent:this._filterAssistent,messagesBuilder:this.messagesBuilder,filterId:this.filterId,entityUri:this.entityUri,application:this._application,onEzChangeFilter:i=>this.handleChangeFilterAssistentMode(i.detail),isDefaultFilter:this.isDefaultFilter})),e("stack-item",null,e("snk-filter-advanced-mode",{ref:i=>this._elAdvancedMode=i,filterAssistent:this._filterAssistent,application:this._application,onEzExpressionChange:i=>this.handleExpressionChangeAdvancedMode(i.detail)})))}handleModeChange(){var i,t;if(this._filterAssistentMode)f.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.description")).then((i=>{if(i&&(this._filterAssistentMode=!this._filterAssistentMode,!this.hasChangesToSave())){const i=h.buildGroupExpression(this._filterAssistent.assistent);this._filterAssistent.expression=i,this._elButtonSave.enabled=!this.hasChangesToSave()}}));else if((null===(i=this._filterAssistent)||void 0===i?void 0:i.expression)===(null===(t=this._originalFilterAssistent)||void 0===t?void 0:t.expression))this._filterAssistentMode=!this._filterAssistentMode;else{const i=this._filterAssistent.expression,t=h.buildGroupExpression(this._filterAssistent.assistent);i!==t?f.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.description")).then((i=>{i&&(this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:t}),this._filterAssistentMode=!this._filterAssistentMode)})):this._filterAssistentMode=!this._filterAssistentMode}}buildTitle(){return this.getMessage(this.isDefaultFilter&&!this.filterId?"snkPersonalizedFilter.info.titleCreateDefault":this.isDefaultFilter&&this.filterId?"snkPersonalizedFilter.info.titleEditDefault":this.filterId?"snkPersonalizedFilter.info.titleEdit":"snkPersonalizedFilter.info.titleAdd")}render(){var i,t,s,l;if((null===(i=this._filterAssistent)||void 0===i?void 0:i.assistent)||!this._filterAssistentMode)return e(n,null,e("div",{class:"snk-personalized-filter"},e("div",null,e("snk-simple-bar",{label:this.buildTitle(),onExit:()=>this.handleCancel()},e("div",{class:"snk-personalized-filter__header-actions",slot:"rightSlot"},e("ez-button",{size:"small",label:this.getMessage("snkPersonalizedFilter.info.labelCancel"),onClick:()=>this.handleCancel()}),e("ez-button",{size:"small",ref:i=>this._elButtonSave=i,enabled:!1,class:"ez-button--primary",label:this.getMessage("snkPersonalizedFilter.info.labelSave"),onClick:this.handleSave.bind(this)})))),e("div",{class:"ez-box ez-margin-bottom--medium ez-box__main"},e("div",{class:"ez-box__container"},e("div",{class:"ez-flex ez-flex--column ez-size-width--full"},e("div",{class:"ez-flex"},e("ez-tooltip",{message:this.getMessage("snkPersonalizedFilter.info.textInputDisabled"),active:this.isDefaultFilter},e("ez-text-input",{class:"ez-padding-right--medium",label:this.getMessage("snkPersonalizedFilter.info.labelNameFilter"),value:null===(t=this._filterAssistent)||void 0===t?void 0:t.name,onEzChange:i=>this.handleTitleChange(i.detail),enabled:!this.isDefaultFilter})),this.renderButtonAddField(),e("ez-button",{ref:i=>this._elButtonMode=i,class:"snk-personalized-filter__button-mode",label:this.getMessage(this._filterAssistentMode?"snkPersonalizedFilter.info.activeModeAdvanced":"snkPersonalizedFilter.info.activeModeAssistent"),onClick:()=>this.handleModeChange(),"data-tooltip":this._filterAssistentMode||(null===(s=this._filterAssistent)||void 0===s?void 0:s.assistent)?void 0:this.getMessage("snkPersonalizedFilter.info.tooltipDisabledAssistentMode"),"data-flow":"bottom",enabled:!this._filterAssistent.name||Boolean(this._filterAssistentMode||(null===(l=this._filterAssistent)||void 0===l?void 0:l.assistent))})),this.buildContainerPersonalizedFilter())))))}static get watchers(){return{filterId:["loadFilter"]}}};m.style=".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";export{m as snk_personalized_filter}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,H as e}from"./p-
|
|
1
|
+
import{r as t,c as i,h as s,H as e}from"./p-82bb3eda.js";import{ApplicationContext as o,ElementIDUtils as r}from"@sankhyalabs/core";import{DataBinder as h}from"@sankhyalabs/ezui/dist/collection/utils/form";import{focusOnFieldSerch as a,SEARCH_FIELD_FULL_WIDTH as n,FormLayout as l}from"@sankhyalabs/ezui/dist/collection/utils";const d=class{constructor(s){t(this,s),this.snkContentCardChanged=i(this,"snkContentCardChanged",7),this.snkRequestClearFieldToFocus=i(this,"snkRequestClearFieldToFocus",7),this.formItemsReady=i(this,"formItemsReady",7),this._customEditors=new Map,this._fieldProps=new Map,this._singleColumn=!1,this.levelPath=void 0,this.fieldSearch=void 0,this.label=void 0,this.name=void 0,this.fields=void 0,this.formMetadata=void 0,this.dataUnit=void 0,this.contracted=void 0,this.fixed=!1,this.summaryFields=void 0,this.canExpand=!0,this.canFix=!0,this.recordsValidator=void 0,this.fieldToFocus=void 0,this.customEditors=void 0,this.fieldsProps=void 0}async showUp(){this._formView&&this._formView.showUp()}async addCustomEditor(t,i,s){if(this._formView)return void this._formView.addCustomEditor(t,i,s);const e=new Map(this._customEditors);e.set(t,{customEditor:i,detailContext:s}),this._customEditors=e}async setFieldProp(t,i,s){const e=this._fieldProps.get(t)||[];this._fieldProps.set(t,[...e,{propName:i,value:s}])}async showSearchField(){if(!this._headerContainer||!this._ezPopoverFieldColumn)return;const t=this._headerContainer.getBoundingClientRect();await a(this.fieldSearch),this._ezPopoverFieldColumn.showUnder(this._headerContainer,{horizontalGap:t.width-n,verticalGap:-1*t.height})}observePropsCustomEditor(t){for(const i in t)this.addCustomEditor(i,t[i])}async observeFieldsProps(t){for(const i in t){const s=t[i],e=Object.keys(s);for(const t of e)await this.setFieldProp(i,t,s[t])}}changeFix(){this.fixed=!this.fixed,this.emitEvent("fixed")}changeContracted(){this.contracted=!this.contracted,this.emitEvent("presentation")}emitEvent(t){this.snkContentCardChanged.emit({formName:this.name,cardConfig:{fixed:this.fixed,presentation:this.contracted?"CONTRACTED":"EXPANDED"},propertyChanged:t})}getCardSummary(){const t={};return this.getSummaryFields().forEach((({field:i,label:s})=>{var e;const o=this.dataUnit.getFormattedValue(i);""!==o&&(null==s&&(s=null===(e=this.dataUnit.getField(i))||void 0===e?void 0:e.label),t[s]=o)})),t}getSummaryFields(){return null==this.summaryFields?this.fields.map((t=>{const i=this.dataUnit.getField(t.name);return{field:t.name,label:t.label||(null==i?void 0:i.label)}})):this.summaryFields}bindFields(t){null==this._dataBinder&&null!=this.dataUnit&&(this._dataBinder=new h(this.dataUnit)),this._dataBinder&&this._dataBinder.bind(t,this.dataUnit.dataUnitId,this.formMetadata,this.recordsValidator)}handleFormItemsReady(t){t.stopPropagation(),this.formItemsReady.emit(Object.assign(Object.assign({},t.detail),{formId:this.name}))}disconnectedCallback(){null!=this._dataBinder&&this._dataBinder.onDisconnectedCallback()}componentDidLoad(){this.observePropsCustomEditor(this.customEditors),this.observeFieldsProps(this.fieldsProps),this.initLayoutFormConfig()}async initLayoutFormConfig(){const t=o.getContextValue("__SNK__APPLICATION__"),i=await(null==t?void 0:t.getLayoutFormConfig());i&&(this.setSingleColumn(i),this.registerNotifyListeners(i))}setSingleColumn(t){this._singleColumn=(null==t?void 0:t.config)===l.CASCADE}registerNotifyListeners(t){t&&t.onConfigChange((t=>{this._singleColumn=t===l.CASCADE}))}componentDidRender(){this.setCustomEditors(),this.setFieldProps(),null!=this.fieldToFocus&&this.fields.some((t=>t.name===this.fieldToFocus))&&requestAnimationFrame((()=>{this._dataBinder.setFocus(this.fieldToFocus),this.snkRequestClearFieldToFocus.emit()}))}setCustomEditors(){if(this._formView)for(const[t,i]of this._customEditors)this._formView.addCustomEditor(t,i.customEditor,i.detailContext),this._customEditors.delete(t)}setFieldProps(){if(this._formView)for(const[t,i]of this._fieldProps)i.forEach((i=>{this._formView.setFieldProp(t,i.propName,i.value),this._fieldProps.delete(t)}))}render(){return s(e,{class:"ez-box__container"},s("div",{class:"summary-header ez-flex ez-size-width--full",ref:t=>this._headerContainer=t},s("div",{class:"ez-flex ez-text ez-title--primary ez-text--bold ez-flex--justify-start ez-flex--align-items-center ez-col--sd-9"},this.levelPath?s("span",{class:"level-path"},this.levelPath+" /"):void 0,this.label),s("div",{class:"ez-flex ez-flex--justify-end ez-col--sd-3"},this.canFix&&s("ez-button",{class:"ez-padding-left--medium",mode:"icon",size:"small",iconName:this.fixed?"un-pin":"push-pin","data-element-id":r.getInternalIDInfo("toggleFixed_ezFormCard"),onClick:()=>this.changeFix(),title:this.fixed?"Desafixar":"Fixar"}),this.canExpand&&s("ez-button",{class:"ez-padding-left--medium",mode:"icon",size:"small",iconName:this.contracted?"chevron-down":"chevron-up","data-element-id":r.getInternalIDInfo("toggleExpand_ezFormCard"),onClick:()=>this.changeContracted(),title:this.contracted?"Expandir":"Resumir"}))),s("slot",null),this.contracted?s("snk-form-summary",{summary:this.getCardSummary()}):s("ez-form-view",{ref:t=>this._formView=t,fields:this.fields,onEzContentReady:t=>this.bindFields(t.detail),onFormItemsReady:t=>this.handleFormItemsReady(t),singleColumn:this._singleColumn}),this.fieldSearch&&s("ez-popover",{ref:t=>this._ezPopoverFieldColumn=t,overlayType:"none"},this.fieldSearch))}static get watchers(){return{customEditors:["observePropsCustomEditor"],fieldsProps:["observeFieldsProps"]}}};d.style=".sc-snk-form-view-h{display:flex;width:100%;--ez-form-card-summary-field-content-weight:700}.level-path.sc-snk-form-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.summary-wrapper.sc-snk-form-view{display:flex;overflow:hidden}.summary-header.sc-snk-form-view{border-bottom:1px solid var(--color--strokes);margin-bottom:var(--space--medium);padding-bottom:var(--space--medium)}.summary-container.sc-snk-form-view{display:flex;flex-direction:column}.summary-container.sc-snk-form-view{padding-right:calc(var(--space--extra-large) / 1.5)}.summary-field.sc-snk-form-view{min-width:30px;max-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.summary-field__title.sc-snk-form-view{color:var(--text--primary, #626e82);font-size:var(--title--small);white-space:nowrap;font-weight:var(--text-weight--medium)}.summary-field__content.sc-snk-form-view{color:var(--title--primary, #2b3a54);font-size:var(--text--large);font-weight:var(--ez-form-card-summary-field-content-weight)}";export{d as snk_form_view}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as e,D as t}from"./p-
|
|
1
|
+
import{d as e,D as t}from"./p-6768f176.js";import{ObjectUtils as n}from"@sankhyalabs/core";class o{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchResource",e.gql`query($name: String!) {
|
|
2
2
|
$queryAlias$: fetchResource(name: $name){
|
|
3
3
|
resource
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,c as t,h as s,H as n}from"./p-
|
|
1
|
+
import{r as i,c as t,h as s,H as n}from"./p-82bb3eda.js";import{ApplicationUtils as e}from"@sankhyalabs/ezui/dist/collection/utils";const o=class{constructor(s){i(this,s),this.configClose=t(this,"configClose",7),this.saveConfig=t(this,"saveConfig",7),this.isEditingGuide=!1,this.isEditingGroup=!1,this.configOptions=[],this.selectedConfig=void 0,this.messagesBuilder=void 0,this.hasChanges=!1,this.optionConfigChanged=!1}handleIsEditingGuideName({detail:i}){this.isEditingGuide=i}handleIsEditingGroupName({detail:i}){this.isEditingGroup=i}saveFormConfig(){if(this.isEditingGuide||this.isEditingGroup){const i=this.getMessage("snkFormConfig.confirm.title"),t=this.getMessage(this.isEditingGuide?"snkFormConfig.alert.titleGuideEditing":"snkFormConfig.alert.titleGroupEditing");e.alert(i,t)}else this.saveConfig.emit()}async closeFormConfig(){if(this.hasChanges){const i=this.getMessage("snkFormConfig.confirm.title"),t=this.getMessage("snkFormConfig.confirm.cancel");if(!await e.confirm(i,t))return}this.configClose.emit()}getMessage(i,t){return this.messagesBuilder.getMessage(i,t)}openConfirmDialog(i="",t=this.getMessage("snkFormConfig.confirm.title")){return e.confirm(t,i)}async applyOptionConfig(){var i,t;const s=null!==(t=null===(i=this.selectedConfig)||void 0===i?void 0:i.name)&&void 0!==t?t:this.getMessage("snkFormConfig.configs.selectedConfig"),n=this.getMessage("snkFormConfig.confirm.apply").replace("{0}",s);await this.openConfirmDialog(n)&&this.saveConfig.emit()}renderSaveActions(){if(this.hasChanges||this.optionConfigChanged)return s("div",{class:"right-group"},s("ez-button",{title:this.getMessage("snkFormConfig.actions.cancel"),label:this.getMessage("snkFormConfig.actions.cancel"),onClick:this.closeFormConfig.bind(this),size:"medium"}),s("ez-button",this.hasChanges?{title:this.getMessage("snkFormConfig.actions.save"),label:this.getMessage("snkFormConfig.actions.save"),class:"ez-button--primary ez-padding-left--medium",onClick:()=>this.saveFormConfig(),size:"medium"}:{title:this.getMessage("snkFormConfig.actions.save"),label:this.getMessage("snkFormConfig.applyConfig"),class:"ez-button--primary ez-padding-left--medium",onClick:async()=>await this.applyOptionConfig(),size:"medium"}))}render(){return s(n,null,s("div",{class:"left-group"},s("ez-button",{mode:"icon",title:this.getMessage("snkFormConfig.goBackTitle"),iconName:"arrow_back",class:"ez-padding--small",size:"small",onClick:this.closeFormConfig.bind(this),id:"formConfigToBack"}),s("h1",{class:"ez-title ez-title--primary ez-title--extra-large ez-padding--small"},this.getMessage("snkFormConfig.title")),s("configs-button",{hasChanges:this.hasChanges,configOptions:this.configOptions,selectedConfig:this.selectedConfig,messagesBuilder:this.messagesBuilder})),this.renderSaveActions())}};o.style=".sc-config-header-h{display:flex;padding-top:12px;padding-left:12px;align-items:center;width:100%;justify-content:space-between}.left-group.sc-config-header{display:flex;gap:8px}.right-group.sc-config-header{padding-right:18px;display:flex}";export{o as config_header}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let e,t,n,l=!1,o=!1,s=!1,c=null,i=!1;const r="http://www.w3.org/1999/xlink",f={},u=e=>"object"==(e=typeof e)||"function"===e,a=(e,t,...n)=>{let l=null,o=null,s=null,c=!1,i=!1;const r=[],f=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?f(l):null!=l&&"boolean"!=typeof l&&((c="function"!=typeof e&&!u(l))&&(l+=""),c&&i?r[r.length-1].t+=l:r.push(c?d(null,l):l),i=c)};if(f(n),t){t.key&&(o=t.key),t.name&&(s=t.name);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,r,$);const a=d(e,null);return a.l=t,r.length>0&&(a.o=r),a.i=o,a.u=s,a},d=(e,t)=>({p:0,$:e,t,m:null,o:null,l:null,i:null,u:null}),p={},$={forEach:(e,t)=>e.map(m).forEach(t),map:(e,t)=>e.map(m).map(t).map(h)},m=e=>({vattrs:e.l,vchildren:e.o,vkey:e.i,vname:e.u,vtag:e.$,vtext:e.t}),h=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),a(e.vtag,t,...e.vchildren||[])}const t=d(e.vtag,e.vtext);return t.l=e.vattrs,t.o=e.vchildren,t.i=e.vkey,t.u=e.vname,t},y=e=>ie(e).h,b=(e,t,n)=>{const l=y(e);return{emit:e=>w(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},w=(e,t,n)=>{const l=ye.ce(t,n);return e.dispatchEvent(l),l},v=new WeakMap,k=e=>"sc-"+e.v,g=(e,t,n,l,o,s)=>{if(n!==l){let c=ue(e,t),i=t.toLowerCase();if("class"===t){const t=e.classList,o=j(n),s=j(l);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if("ref"===t)l&&l(e);else if(c||"o"!==t[0]||"n"!==t[1]){const f=u(l);if((c||f&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{const o=null==l?"":l;"list"===t?c=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(e){}let a=!1;i!==(i=i.replace(/^xlink\:?/,""))&&(t=i,a=!0),null==l||!1===l?!1===l&&""!==e.getAttribute(t)||(a?e.removeAttributeNS(r,t):e.removeAttribute(t)):(!c||4&s||o)&&!f&&(l=!0===l?"":l,a?e.setAttributeNS(r,t,l):e.setAttribute(t,l))}else t="-"===t[2]?t.slice(3):ue(me,i)?i.slice(2):i[2]+t.slice(3),n&&ye.rel(e,t,n,!1),l&&ye.ael(e,t,l,!1)}},S=/\s/,j=e=>e?e.split(S):[],C=(e,t,n,l)=>{const o=11===t.m.nodeType&&t.m.host?t.m.host:t.m,s=e&&e.l||f,c=t.l||f;for(l in s)l in c||g(o,l,s[l],void 0,n,t.p);for(l in c)g(o,l,s[l],c[l],n,t.p)},M=(o,c,i,r)=>{const f=c.o[i];let u,a,d,p=0;if(l||(s=!0,"slot"===f.$&&(e&&r.classList.add(e+"-s"),f.p|=f.o?2:1)),null!==f.t)u=f.m=he.createTextNode(f.t);else if(1&f.p)u=f.m=he.createTextNode("");else if(u=f.m=he.createElement(2&f.p?"slot-fb":f.$),C(null,f,!1),null!=e&&u["s-si"]!==e&&u.classList.add(u["s-si"]=e),f.o)for(p=0;p<f.o.length;++p)a=M(o,f,p,u),a&&u.appendChild(a);return u["s-hn"]=n,3&f.p&&(u["s-sr"]=!0,u["s-cr"]=t,u["s-sn"]=f.u||"",d=o&&o.o&&o.o[i],d&&d.$===f.$&&o.m&&O(o.m,!1)),u},O=(e,t)=>{ye.p|=1;const l=e.childNodes;for(let e=l.length-1;e>=0;e--){const o=l[e];o["s-hn"]!==n&&o["s-ol"]&&(W(o).insertBefore(o,T(o)),o["s-ol"].remove(),o["s-ol"]=void 0,s=!0),t&&O(o,t)}ye.p&=-2},R=(e,t,l,o,s,c)=>{let i,r=e["s-cr"]&&e["s-cr"].parentNode||e;for(r.shadowRoot&&r.tagName===n&&(r=r.shadowRoot);s<=c;++s)o[s]&&(i=M(null,l,s,e),i&&(o[s].m=i,r.insertBefore(i,T(t))))},x=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.m,F(l),o=!0,s["s-ol"]?s["s-ol"].remove():O(s,!0),s.remove())},P=(e,t)=>e.$===t.$&&("slot"===e.$?e.u===t.u:e.i===t.i),T=e=>e&&e["s-ol"]||e,W=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,E=(e,t)=>{const n=t.m=e.m,l=e.o,o=t.o,s=t.t;let c;null===s?("slot"===t.$||C(e,t,!1),null!==l&&null!==o?((e,t,n,l)=>{let o,s,c=0,i=0,r=0,f=0,u=t.length-1,a=t[0],d=t[u],p=l.length-1,$=l[0],m=l[p];for(;c<=u&&i<=p;)if(null==a)a=t[++c];else if(null==d)d=t[--u];else if(null==$)$=l[++i];else if(null==m)m=l[--p];else if(P(a,$))E(a,$),a=t[++c],$=l[++i];else if(P(d,m))E(d,m),d=t[--u],m=l[--p];else if(P(a,m))"slot"!==a.$&&"slot"!==m.$||O(a.m.parentNode,!1),E(a,m),e.insertBefore(a.m,d.m.nextSibling),a=t[++c],m=l[--p];else if(P(d,$))"slot"!==a.$&&"slot"!==m.$||O(d.m.parentNode,!1),E(d,$),e.insertBefore(d.m,a.m),d=t[--u],$=l[++i];else{for(r=-1,f=c;f<=u;++f)if(t[f]&&null!==t[f].i&&t[f].i===$.i){r=f;break}r>=0?(s=t[r],s.$!==$.$?o=M(t&&t[i],n,r,e):(E(s,$),t[r]=void 0,o=s.m),$=l[++i]):(o=M(t&&t[i],n,i,e),$=l[++i]),o&&W(a.m).insertBefore(o,T(a.m))}c>u?R(e,null==l[p+1]?null:l[p+1].m,n,l,i,p):i>p&&x(t,c,u)})(n,l,t,o):null!==o?(null!==e.t&&(n.textContent=""),R(n,null,t,o,0,o.length-1)):null!==l&&x(l,0,l.length-1)):(c=n["s-cr"])?c.parentNode.textContent=s:e.t!==s&&(n.data=s)},L=e=>{const t=e.childNodes;let n,l,o,s,c,i;for(l=0,o=t.length;l<o;l++)if(n=t[l],1===n.nodeType){if(n["s-sr"])for(c=n["s-sn"],n.hidden=!1,s=0;s<o;s++)if(i=t[s].nodeType,t[s]["s-hn"]!==n["s-hn"]||""!==c){if(1===i&&c===t[s].getAttribute("slot")){n.hidden=!0;break}}else if(1===i||3===i&&""!==t[s].textContent.trim()){n.hidden=!0;break}L(n)}},N=[],U=e=>{let t,n,l,s,c,i,r=0;const f=e.childNodes,u=f.length;for(;r<u;r++){if(t=f[r],t["s-sr"]&&(n=t["s-cr"])&&n.parentNode)for(l=n.parentNode.childNodes,s=t["s-sn"],i=l.length-1;i>=0;i--)n=l[i],n["s-cn"]||n["s-nr"]||n["s-hn"]===t["s-hn"]||(D(n,s)?(c=N.find((e=>e.k===n)),o=!0,n["s-sn"]=n["s-sn"]||s,c?c.g=t:N.push({g:t,k:n}),n["s-sr"]&&N.map((e=>{D(e.k,n["s-sn"])&&(c=N.find((e=>e.k===n)),c&&!e.g&&(e.g=c.g))}))):N.some((e=>e.k===n))||N.push({k:n}));1===t.nodeType&&U(t)}},D=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,F=e=>{e.l&&e.l.ref&&e.l.ref(null),e.o&&e.o.map(F)},A=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},H=(e,t)=>{if(e.p|=16,!(4&e.p))return A(e,e.j),Me((()=>q(e,t)));e.p|=512},q=(e,t)=>{const n=e.C;let l;return t?(e.p|=256,e.M&&(e.M.map((([e,t])=>J(n,e,t))),e.M=null),l=J(n,"componentWillLoad")):l=J(n,"componentWillUpdate"),l=K(l,(()=>J(n,"componentWillRender"))),K(l,(()=>V(e,n,t)))},V=async(e,t,n)=>{const l=e.h,o=l["s-rc"];n&&(e=>{const t=e.O,n=e.h,l=t.p,o=((e,t)=>{var n;let l=k(t);const o=$e.get(l);if(e=11===e.nodeType?e:he,o)if("string"==typeof o){let t,s=v.get(e=e.head||e);if(s||v.set(e,s=new Set),!s.has(l)){{t=he.createElement("style"),t.innerHTML=o;const l=null!==(n=ye.R)&&void 0!==n?n:function(e){var t,n,l;return null!==(l=null===(n=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===n?void 0:n.getAttribute("content"))&&void 0!==l?l:void 0}(he);null!=l&&t.setAttribute("nonce",l),e.insertBefore(t,e.querySelector("link"))}s&&s.add(l)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o]);return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"),2&l&&n.classList.add(o+"-s"))})(e);_(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>B(e);0===t.length?n():(Promise.all(t).then(n),e.p|=4,t.length=0)}},_=(i,r)=>{try{c=r,r=r.render(),i.p&=-17,i.p|=2,((c,i)=>{const r=c.h,f=c.O,u=c.P||d(null,null),$=(e=>e&&e.$===p)(i)?i:a(null,null,i);if(n=r.tagName,f.T&&($.l=$.l||{},f.T.map((([e,t])=>$.l[t]=r[e]))),$.$=null,$.p|=4,c.P=$,$.m=u.m=r.shadowRoot||r,e=r["s-sc"],t=r["s-cr"],l=0!=(1&f.p),o=!1,E(u,$),ye.p|=1,s){let e,t,n,l,o,s;U($.m);let c=0;for(;c<N.length;c++)e=N[c],t=e.k,t["s-ol"]||(n=he.createTextNode(""),n["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=n,t));for(c=0;c<N.length;c++)if(e=N[c],t=e.k,e.g){for(l=e.g.parentNode,o=e.g.nextSibling,n=t["s-ol"];n=n.previousSibling;)if(s=n["s-nr"],s&&s["s-sn"]===t["s-sn"]&&l===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&l!==t.parentNode||t.nextSibling!==o)&&t!==o&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),l.insertBefore(t,o))}else 1===t.nodeType&&(t.hidden=!0)}o&&L($.m),ye.p&=-2,N.length=0})(i,r)}catch(e){ae(e,i.h)}return c=null,null},z=()=>c,B=e=>{const t=e.h,n=e.C,l=e.j;J(n,"componentDidRender"),64&e.p?J(n,"componentDidUpdate"):(e.p|=64,Q(t),J(n,"componentDidLoad"),e.W(t),l||I()),e.L(t),e.S&&(e.S(),e.S=void 0),512&e.p&&Ce((()=>H(e,!1))),e.p&=-517},G=e=>{{const t=ie(e),n=t.h.isConnected;return n&&2==(18&t.p)&&H(t,!1),n}},I=()=>{Q(he.documentElement),Ce((()=>w(me,"appload",{detail:{namespace:"sankhyablocks"}})))},J=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){ae(e)}},K=(e,t)=>e&&e.then?e.then(t):t(),Q=e=>e.classList.add("hydrated"),X=(e,t,n)=>{if(t.N){e.watchers&&(t.U=e.watchers);const l=Object.entries(t.N),o=e.prototype;if(l.map((([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(o,e,{get(){return((e,t)=>ie(this).D.get(t))(0,e)},set(n){((e,t,n,l)=>{const o=ie(e),s=o.h,c=o.D.get(t),i=o.p,r=o.C;if(n=((e,t)=>null==e||u(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.N[t][0]),(!(8&i)||void 0===c)&&n!==c&&(!Number.isNaN(c)||!Number.isNaN(n))&&(o.D.set(t,n),r)){if(l.U&&128&i){const e=l.U[t];e&&e.map((e=>{try{r[e](n,c,t)}catch(e){ae(e,s)}}))}if(2==(18&i)){if(r.componentShouldUpdate&&!1===r.componentShouldUpdate(n,c,t))return;H(o,!1)}}})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(o,e,{value(...t){const n=ie(this);return n.F.then((()=>n.C[e](...t)))}})})),1&n){const n=new Map;o.attributeChangedCallback=function(e,t,l){ye.jmp((()=>{const t=n.get(e);if(this.hasOwnProperty(t))l=this[t],delete this[t];else if(o.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==l)return;this[t]=(null!==l||"boolean"!=typeof this[t])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,l])=>{const o=l[1]||e;return n.set(o,e),512&l[0]&&t.T.push([e,o]),o}))}}return e},Y=e=>{J(e,"connectedCallback")},Z=(e,t={})=>{const n=t.exclude||[],l=me.customElements,o=[];let s,c=!0;Object.assign(ye,t),ye.A=new URL(t.resourcesUrl||"./",he.baseURI).href,e.map((e=>{e[1].map((t=>{const i={p:t[0],v:t[1],N:t[2],H:t[3]};i.N=t[2],i.H=t[3],i.T=[],i.U={};const r=i.v,f=class extends HTMLElement{constructor(e){super(e),fe(e=this,i),1&i.p&&e.attachShadow({mode:"open"})}connectedCallback(){s&&(clearTimeout(s),s=null),c?o.push(this):ye.jmp((()=>(e=>{if(0==(1&ye.p)){const t=ie(e),n=t.O,l=()=>{};if(1&t.p)te(e,t,n.H),Y(t.C);else{t.p|=1,12&n.p&&(e=>{const t=e["s-cr"]=he.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){A(t,t.j=n);break}}n.N&&Object.entries(n.N).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,o)=>{if(0==(32&t.p)){{if(t.p|=32,(o=pe(n)).then){const e=()=>{};o=await o,e()}o.isProxied||(n.U=o.watchers,X(o,n,2),o.isProxied=!0);const e=()=>{};t.p|=8;try{new o(t)}catch(e){ae(e)}t.p&=-9,t.p|=128,e(),Y(t.C)}if(o.style){let e=o.style;const t=k(n);if(!$e.has(t)){const l=()=>{};((e,t,n)=>{let l=$e.get(e);we&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,$e.set(e,l)})(t,e,!!(1&n.p)),l()}}}const s=t.j,c=()=>H(t,!0);s&&s["s-rc"]?s["s-rc"].push(c):c()})(0,t,n)}l()}})(this)))}disconnectedCallback(){ye.jmp((()=>(()=>{if(0==(1&ye.p)){const e=ie(this),t=e.C;e.q&&(e.q.map((e=>e())),e.q=void 0),J(t,"disconnectedCallback")}})()))}componentOnReady(){return ie(this).V}};i._=e[0],n.includes(r)||l.get(r)||l.define(r,X(f,i,1))}))})),c=!1,o.length?o.map((e=>e.connectedCallback())):ye.jmp((()=>s=setTimeout(I,30)))},ee=(e,t)=>t,te=(e,t,n)=>{n&&n.map((([n,l,o])=>{const s=le(e,n),c=ne(t,o),i=oe(n);ye.ael(s,l,c,i),(t.q=t.q||[]).push((()=>ye.rel(s,l,c,i)))}))},ne=(e,t)=>n=>{try{256&e.p?e.C[t](n):(e.M=e.M||[]).push([t,n])}catch(e){ae(e)}},le=(e,t)=>8&t?me:16&t?he.body:e,oe=e=>0!=(2&e),se=e=>ye.R=e,ce=new WeakMap,ie=e=>ce.get(e),re=(e,t)=>ce.set(t.C=e,t),fe=(e,t)=>{const n={p:0,h:e,O:t,D:new Map};return n.F=new Promise((e=>n.L=e)),n.V=new Promise((e=>n.W=e)),e["s-p"]=[],e["s-rc"]=[],te(e,n,t.H),ce.set(e,n)},ue=(e,t)=>t in e,ae=(e,t)=>(0,console.error)(e,t),de=new Map,pe=e=>{const t=e.v.replace(/-/g,"_"),n=e._,l=de.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(de.set(n,e),e[t])),ae)
|
|
2
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/},$e=new Map,me="undefined"!=typeof window?window:{},he=me.document||{head:{}},ye={p:0,A:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},be=e=>Promise.resolve(e),we=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),ve=[],ke=[],ge=(e,t)=>n=>{e.push(n),i||(i=!0,t&&4&ye.p?Ce(je):ye.raf(je))},Se=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){ae(e)}e.length=0},je=()=>{Se(ve),Se(ke),(i=ve.length>0)&&ye.raf(je)},Ce=e=>be().then(e),Me=ge(ke,!0);export{ee as F,p as H,z as a,Z as b,b as c,G as f,y as g,a as h,be as p,re as r,se as s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,f as t}from"./p-
|
|
1
|
+
import{a as e,f as t}from"./p-82bb3eda.js";const s=e=>!("isConnected"in e)||e.isConnected,o=(()=>{let e;return(...t)=>{e&&clearTimeout(e),e=setTimeout((()=>{e=0,(e=>{for(let t of e.keys())e.set(t,e.get(t).filter(s))})(...t)}),2e3)}})(),r=e=>"function"==typeof e?e():e,n=(e,t)=>{const s=e.indexOf(t);s>=0&&(e[s]=e[e.length-1],e.length--)},c=(()=>{const s=((e,t=((e,t)=>e!==t))=>{const s=r(e);let o=new Map(Object.entries(s??{}));const c={dispose:[],get:[],set:[],reset:[]},a=new Map,i=()=>{o=new Map(Object.entries(r(e)??{})),c.reset.forEach((e=>e()))},p=e=>(c.get.forEach((t=>t(e))),o.get(e)),u=(e,s)=>{const r=o.get(e);t(s,r,e)&&(o.set(e,s),c.set.forEach((t=>t(e,s,r))))},d="undefined"==typeof Proxy?{}:new Proxy(s,{get:(e,t)=>p(t),ownKeys:()=>Array.from(o.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(e,t)=>o.has(t),set:(e,t,s)=>(u(t,s),!0)}),f=(e,t)=>(c[e].push(t),()=>{n(c[e],t)});return{state:d,get:p,set:u,on:f,onChange:(t,s)=>{const o=(e,o)=>{e===t&&s(o)},n=()=>s(r(e)[t]),c=f("set",o),i=f("reset",n);return a.set(s,{setHandler:o,resetHandler:n,propName:t}),()=>{c(),i(),a.delete(s)}},use:(...e)=>{const t=e.reduce(((e,t)=>(t.set&&e.push(f("set",t.set)),t.get&&e.push(f("get",t.get)),t.reset&&e.push(f("reset",t.reset)),t.dispose&&e.push(f("dispose",t.dispose)),e)),[]);return()=>t.forEach((e=>e()))},dispose:()=>{c.dispose.forEach((e=>e())),i()},reset:i,forceUpdate:e=>{const t=o.get(e);c.set.forEach((s=>s(e,t,t)))},removeListener:(e,t)=>{const s=a.get(t);s&&s.propName===e&&(n(c.set,s.setHandler),n(c.reset,s.resetHandler),a.delete(t))}}})({exporterProviders:{},filterFieldsDataSource:void 0},void 0);return s.use((()=>{if("function"!=typeof e)return{};const s=new Map;return{dispose:()=>s.clear(),get:t=>{const o=e();o&&((e,t,s)=>{const o=e.get(t);o?o.includes(s)||o.push(s):e.set(t,[s])})(s,t,o)},set:e=>{const r=s.get(e);r&&s.set(e,r.filter(t)),o(s)},reset:()=>{s.forEach((e=>e.forEach(t))),o(s)}}})()),s})();export{c as s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,H as e,g as h}from"./p-d8d8169b.js";import{Action as n,StringUtils as a,ElementIDUtils as o,ApplicationContext as r,KeyboardManager as d}from"@sankhyalabs/core";import"./p-1b1373b6.js";import"./p-3c046287.js";import{P as c,E as l}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-9ab6ae1e.js";import"./p-ff1990ad.js";import"./p-4db9dbf8.js";import{V as u}from"./p-9019a32f.js";import{A as m}from"./p-b9699067.js";import{S as f}from"./p-cad964b5.js";import{T as p}from"./p-b987e15d.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-55798617.js";const g=class{constructor(s){t(this,s),this.snkShowGuide=i(this,"snkShowGuide",7),this.actionClick=i(this,"actionClick",7),this.configuratorSave=i(this,"configuratorSave",7),this.configuratorCancel=i(this,"configuratorCancel",7),this.formItemsReady=i(this,"formItemsReady",7),this.viewModeChanged=i(this,"viewModeChanged",7),this.numberingConfigChanged=i(this,"numberingConfigChanged",7),this._viewHistory=[],this._customEditors=new Map,this._customRenders=new Map,this.loadEntitySuggestions=async t=>{var i;const s=null!==(i=null==t?void 0:t.argument)&&void 0!==i?i:"",e=(null==t?void 0:t.mode)||"PREDICTIVE";if(!s||0===s.trim().length)return[];try{this._showMoreOnSearch=!1;const t=this._snkDataUnit.entityName;return"PREDICTIVE"===e?await this.handlePredictiveSearch(s,t):await this._application.executePreparedSearch(e,s,this.buildSearchOptions(t))}catch(t){return console.error("Erro ao carregar sugestões de entidades:",t),[]}},this.searchEntitySelect=async t=>{if(this._entityPKField&&t)try{const i=[{name:this._entityPKField,value:t.value}];await this.refreshDataUnitByPk(i)}catch(t){console.error("Erro ao selecionar entidade:",t)}},this.dataUnitInterceptor={interceptAction:t=>(t.type===n.DATA_SAVED&&(t=this.interceptDataSaved(t)),t)},this._dataUnit=void 0,this._dataState=void 0,this.attachmentRegisterKey=void 0,this._currentViewMode=u.GRID,this._canEdit=void 0,this._resourceID=void 0,this.customContainerId=`SNK-CRUD-CUSTOM-CONTAINER-${a.generateUUID()}`,this.numberingConfig=void 0,this._showMoreOnSearch=!1,this._entityPKField=void 0,this.enableLockManagerLoadingComp=!1,this.enableLockManagerTaskbarClick=!1,this.configName=void 0,this.filterBarTitle=void 0,this.selectionToastConfig=void 0,this.showActionButtons=!1,this.actionsList=void 0,this.taskbarManager=void 0,this.recordsValidator=void 0,this.statusResolver=void 0,this.multipleSelection=!0,this.presentationMode=c.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.gridLegacyConfigName=void 0,this.filterBarLegacyConfigName=void 0,this.formLegacyConfigName=void 0,this.disablePersonalizedFilter=void 0,this.autoLoad=void 0,this.autoFocus=!0,this.enableGridInsert=!1,this.domainMessagesBuilder=void 0,this.ignoreReadOnlyFormFields=void 0,this.setCustomFormTitle=void 0,this.strategyExporter=l.SERVER_SIDE,this.layoutFormConfig=!0,this.multipleEditionEnabled=!0,this.paginationCounterMode="auto",this.customGuidesConfig=[],this.showEntitySearch=!0,this.disableNumberingConfig=!1}async goToView(t){this.executeAction(t)}async openConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.open()}async closeConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.close()}async reloadFilterBar(){var t;null===(t=this._snkGrid)||void 0===t||t.reloadFilterBar()}async getFilterBar(){return await this._snkGrid.getFilterBar()}async addCustomEditor(t,i){if(this._guidesViewer&&this._snkGrid)return this._guidesViewer.addCustomEditor(t,i),void this._snkGrid.addCustomEditor(t,i);const s=new Map(this._customEditors);s.set(t,i),this._customEditors=s}async addGridCustomRender(t,i){if(this._snkGrid)return void this._snkGrid.addGridCustomRender(t,i);const s=new Map(this._customRenders);s.set(t,i),this._customRenders=s}async addCustomValueFormatter(t,i){this._snkGrid.addCustomValueFormatter(t,i)}async removeCustomValueFormatter(t){this._snkGrid.removeCustomValueFormatter(t)}async setFieldProp(t,i,s){await this._guidesViewer.setFieldProp(t,i,s)}async getNumberingConfig(){return this.numberingConfig}async updateNumberingConfig(t){this.numberingConfig=t,this.applyNumberingConfigToFields()}currentViewModeWatcher(t){this._viewHistory=[...this._viewHistory.slice(-1),t]}async gridToForm(t=!1){this._backToGrid=!t&&await this._viewStack.getSelectedIndex()===u.GRID,this.setViewMode(u.FORM)}async executeAction(t){switch(t){case p.GRID_MODE:return this.setViewMode(u.GRID);case p.FORM_MODE:case p.UPDATE:return this.gridToForm(t!==p.UPDATE);case p.UPDATE_MULTIPLE:return this._dataUnit.isMultipleEdition=!0,this.setViewMode(u.FORM);case p.CONFIGURATOR:return this._snkConfigurator.open();case p.ATTACH:return this.setViewMode(u.ATTACHMENT)}}backView(){const t=this._viewHistory.at(-2)||u.GRID;this.setViewMode(t)}setViewMode(t){this._viewStack.show(t),this._currentViewMode=t,t===u.GRID?(this._dataUnit.isMultipleEdition=!1,this._snkGrid.setFocus()):t===u.FORM&&this._guidesViewer.setFocus(),this.viewModeChanged.emit(t)}openConfig(t){this._snkConfigurator.close(),t===u.GRID?this._snkGrid.showConfig():t===u.FORM&&this._guidesViewer.showFormConfig()}addDataElementID(){o.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}insertionModeHandler(){this.enableGridInsert||this.gridToForm()}cancelHandler(){this._backToGrid&&this.setViewMode(u.GRID)}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}setCustomRenders(){if(this._snkGrid)for(const[t,i]of this._customRenders)this._snkGrid.addGridCustomRender(t,i),this._customRenders.delete(t)}setCustomEditors(){if(this._snkGrid&&this._guidesViewer)for(const[t,i]of this._customEditors)this._guidesViewer.addCustomEditor(t,i),this._snkGrid.addCustomEditor(t,i),this._customEditors.delete(t)}componentDidRender(){this.setCustomRenders(),this.setCustomEditors()}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__");let t=this._element.parentElement;for(this._application.hasAccess(m.UPDATE,this._resourceID).then((t=>this._canEdit=t));t;){if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){this._snkDataUnit=t,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._snkDataUnit.domainMessagesBuilder=this.domainMessagesBuilder,this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.initDataUnit():this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail,this.initDataUnit()})),this._snkDataUnit.addEventListener("dataStateChange",this.handleDataStateChange.bind(this));break}t=t.parentElement}this.configName||(this.configName=this._application.configName)}componentDidLoad(){this.initKeyboardManager()}disconnectedCallback(){var t;this.removeShortcuts(),null===(t=this._dataUnit)||void 0===t||t.removeInterceptor(this.dataUnitInterceptor)}async handleDataStateChange(t){var i;this._dataState=t.detail,void 0!==this._dataState.selectedRecord&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey());const s=await this._snkDataUnit.getFieldsWithRmPrecision();for(const t of s||[]){if(!t)continue;const s=null===(i=this._dataState.rowMetadata)||void 0===i?void 0:i.getProp("rm_precision",t);(s||0===s)&&(await this.setFieldProp(t,"precision",s),await this.setFieldProp(t,"prettyPrecision",s))}}async initKeyboardManager(){this._keyboardManager=new d({propagate:!1,element:this._element});const t=this._dataUnit||await this._snkDataUnit.getDataUnit();async function i(){const i=document.activeElement,s=i==document.body;s||i.blur(),await t.saveData(),s||null==i.setFocus?s||i.focus():i.setFocus()}this._keyboardManager&&this._keyboardManager.bind("F6",this.toggleView.bind(this),{description:this.getMessage("snkCrud.shortcuts.toggleView"),element:this._element}).bind("F7",i.bind(this),{description:this.getMessage("snkCrud.shortcuts.saveData"),element:this._element}).bind("ctrl + \\",i.bind(this),{description:this.getMessage("snkCrud.shortcuts.addRecord"),element:this._element}).bind("F8",async function(){t.hasNewRecord()||t.addRecord()}.bind(this),{description:this.getMessage("snkCrud.shortcuts.addRecord"),element:this._element}).bind("F9",t.removeSelectedRecords.bind(t),{description:this.getMessage("snkCrud.shortcuts.removeRecord"),element:this._element}).bind("ctrl + F9",t.removeSelectedRecords.bind(t),{description:this.getMessage("snkCrud.shortcuts.removeRecord"),element:this._element}).bind("F5",(async()=>{const i=await this._viewStack.getSelectedIndex();u.GRID===i&&t.loadData()}),{description:this.getMessage("snkCrud.shortcuts.refreshData"),element:this._element}).bind("Escape",(()=>{t.isDirty()&&t.cancelEdition()}),{debounceTime:1e3,description:this.getMessage("snkCrud.shortcuts.cancelAction"),element:this._element})}getMessage(t,i){if(this.messagesBuilder)return this.messagesBuilder.getMessage(t,i)}async removeShortcuts(){var t;null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}async handlePredictiveSearch(t,i){var s,e;const h=await this._application.executePreparedSearchWithFullResponse(t,this.buildSearchOptions(i,5));return this._showMoreOnSearch=null!==(s=null==h?void 0:h.hasMore)&&void 0!==s&&s,this._entityPKField=null==h?void 0:h.pkField,null!==(e=null==h?void 0:h.data)&&void 0!==e?e:[]}async refreshDataUnitByPk(t){try{const i={term:"",filter:{name:"",params:[],expression:`(${t[0].name} = ${t[0].value})`}};await this._dataUnit.loadData(i),1===this._dataUnit.records.length&&(this._dataUnit.selectFirst(),this.gridToForm(!0))}catch(t){console.error("Erro ao atualizar dataset:",t)}}buildSearchOptions(t,i){return{entity:t,entityDescription:t,executeOnOpen:!0,searchOptions:{localEntityName:t,limit:i}}}async toggleView(){const t=await this._viewStack.getSelectedIndex();this.setViewMode(u.GRID===t?u.FORM:u.GRID)}getLastRecordSaved(t){var i;return(null===(i=t.payload)||void 0===i?void 0:i.records.length)?t.payload.records[t.payload.records.length-1]:null}async saveNumberingConfig(){const t={entityName:this._snkDataUnit.entityName,isAutoNum:this.numberingConfig.isAutoNumbering,numInicial:this.numberingConfig.initialNumber};await this._servicesNumberingConfig.saveConfig(t)}updateNumberingConfigAfterInsert(t){var i,s;if(!(null===(i=t.payload)||void 0===i?void 0:i.changes.length)||this.disableNumberingConfig||!(null===(s=this.numberingConfig)||void 0===s?void 0:s.isAutoNumbering)||!this._fieldAutoNum)return t;if(!t.payload.changes.some((t=>"INSERT"===t.operation||"COPY"===t.operation)))return t;const e=this.getLastRecordSaved(t);if(e&&e.hasOwnProperty(this._fieldAutoNum)){const t=Number(e[this._fieldAutoNum]);this.numberingConfig.initialNumber=t,this.saveNumberingConfig()}else this.numberingConfig.initialNumber=this.numberingConfig.initialNumber+1;return this.numberingConfigChanged.emit(this.numberingConfig),t}interceptDataSaved(t){return this.updateNumberingConfigAfterInsert(t),t}onDataUnitReady(){var t;null===(t=this._dataUnit)||void 0===t||t.addInterceptor(this.dataUnitInterceptor),this.loadNumberingConfig()}async initDataUnit(){this.addDataElementID(),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),null==this._resourceID&&(this._resourceID=this._snkDataUnit.resourceID,null==this._resourceID&&(this._resourceID=await this._application.getResourceID())),this.onDataUnitReady()}async loadNumberingConfig(){if(!this.numberingConfig&&this._snkDataUnit&&this._snkDataUnit.entityName&&!this.disableNumberingConfig){this._servicesNumberingConfig||(this._servicesNumberingConfig=new f(this._application,this._resourceID));try{this.numberingConfig=await this._servicesNumberingConfig.getConfig(this._snkDataUnit.entityName),this.getFieldAutoNum(),this.applyNumberingConfigToFields()}catch(t){console.error("Error loading numbering config in snk-crud:",t),this.numberingConfig={isAutoNumbering:!1,initialNumber:null}}}}getFieldAutoNum(){if(this._fieldAutoNum)return;const t=this._dataUnit.metadata.fields.find((t=>{var i;return"true"===(null===(i=t.properties)||void 0===i?void 0:i.isAutoNumField)}));this._fieldAutoNum=(null==t?void 0:t.name)||null}async applyNumberingConfigToFields(){if(!this.numberingConfig||!this._snkDataUnit||!this._fieldAutoNum)return;const t=this._dataUnit.getField(this._fieldAutoNum);t.readOnly=this.numberingConfig.isAutoNumbering,t.required=!this.numberingConfig.isAutoNumbering}handleConfiguratorEvent(t,i){if(t.stopImmediatePropagation(),"SAVE"===i)return this._guidesViewer.reloadGuides(),void this.configuratorSave.emit();this.configuratorCancel.emit()}renderCustomGuideSlots(){if(this.customGuidesConfig)return this.customGuidesConfig.map((t=>s("slot",{name:t.id})))}renderDynamicSearch(t){var i;if(this.showEntitySearch&&!0!==(null===(i=this._dataState)||void 0===i?void 0:i.insertionMode))return s("div",{slot:t,class:"entity-search-container",style:{position:"relative",display:"inline-block",marginLeft:"10px",minWidth:"200px"}},s("ez-search",{label:"Buscar registros",optionLoader:this.loadEntitySuggestions,onEzChange:t=>this.searchEntitySelect(t.detail),mode:"slim",showMore:this._showMoreOnSearch,suppressEmptyOption:!0,suppressInputPersist:!0}))}render(){if(null!=this._resourceID)return this._snkDataUnit.ignoreSaveMessage=this._currentViewMode===u.GRID&&!this.enableGridInsert,s(e,null,s("ez-view-stack",{ref:t=>this._viewStack=t,"data-element-id":"crud"},s("stack-item",{class:"ez-flex ez-flex--column ez-size-height--full ez-size-width--full ez-padding--medium"},s("snk-grid",{ref:t=>this._snkGrid=t,class:"ez-flex ez-flex--column ez-size-height--full ez-size-width--full",filterBarTitle:this.filterBarTitle,"data-element-id":"crud_grid",configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail),messagesBuilder:this.messagesBuilder,actionsList:this.actionsList,statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,presentationMode:this.presentationMode,recordsValidator:this.recordsValidator,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,canEdit:this._canEdit,resourceID:this._resourceID,disablePersonalizedFilter:this.disablePersonalizedFilter,gridLegacyConfigName:this.gridLegacyConfigName,filterBarLegacyConfigName:this.filterBarLegacyConfigName,autoLoad:this.autoLoad,autoFocus:this.autoFocus,enableGridInsert:this.enableGridInsert,enableLockManagerTaskbarClick:this.enableLockManagerTaskbarClick,enableLockManagerLoadingComp:this.enableLockManagerLoadingComp,strategyExporter:this.strategyExporter,multipleEditionEnabled:this.multipleEditionEnabled,paginationCounterMode:this.paginationCounterMode},s("slot",{name:"GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkGridHeader"}),s("slot",{name:"SnkGridFooter"}),s("slot",{name:"SnkGridTaskBar"}),this.renderDynamicSearch("GRID_HEADER_DYNAMIC_SEARCH"))),s("stack-item",null,s("snk-guides-viewer",{ref:t=>this._guidesViewer=t,customGuidesConfig:this.customGuidesConfig,entityPath:this._snkDataUnit.entityName,messagesBuilder:this.messagesBuilder,onExit:()=>this.setViewMode(u.GRID),dataState:this._dataState,dataUnit:this._dataUnit,actionsList:this.actionsList,taskbarManager:this.taskbarManager,configName:this.configName,onActionClick:t=>this.executeAction(t.detail),presentationMode:this.presentationMode,"data-element-id":"crud_form",canEdit:this._canEdit,recordsValidator:this.recordsValidator,resourceID:this._resourceID,detailTaskbarCustomContainerId:this.customContainerId,formLegacyConfigName:this.formLegacyConfigName,enableGridInsert:this.enableGridInsert,getCustomTitle:this.setCustomFormTitle,ignoreReadOnlyFormFields:this.ignoreReadOnlyFormFields},s("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"}),this.renderCustomGuideSlots(),this.renderDynamicSearch("GUIDES_VIEWER_DYNAMIC_SEARCH"),s("slot",{name:"SnkFormTaskBar"}))),s("stack-item",{tabIndex:"0"},s("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this._snkDataUnit.entityName,onBack:this.backView.bind(this)})),s("snk-configurator",{ref:t=>this._snkConfigurator=t,entityName:this._snkDataUnit.entityName,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:t=>this.setViewMode(t.detail),onOpenConfig:t=>this.openConfig(t.detail),showActionButtons:this.showActionButtons,onSave:t=>this.handleConfiguratorEvent(t,"SAVE"),onCancel:t=>this.handleConfiguratorEvent(t,"CANCEL"),resourceID:this._resourceID,customContainerId:this.customContainerId,layoutFormConfig:this.layoutFormConfig})),s("div",{id:`${this.customContainerId}`},s("slot",{name:"SnkConfigContainerSlot"}),s("slot",{name:"DETAIL_GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"})))}get _element(){return h(this)}static get watchers(){return{_currentViewMode:["currentViewModeWatcher"]}}};g.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{g as snk_crud}
|
|
1
|
+
import{r as t,c as i,h as s,H as e,g as h}from"./p-82bb3eda.js";import{Action as n,StringUtils as a,ElementIDUtils as o,ApplicationContext as r,KeyboardManager as d}from"@sankhyalabs/core";import"./p-6768f176.js";import"./p-48a5c311.js";import{P as c,E as l}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-9e4555ab.js";import"./p-ff1990ad.js";import"./p-7ee6b1bf.js";import{V as u}from"./p-9019a32f.js";import{A as m}from"./p-52691b42.js";import{S as f}from"./p-cad964b5.js";import{T as p}from"./p-1be69fd4.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-8336900b.js";const g=class{constructor(s){t(this,s),this.snkShowGuide=i(this,"snkShowGuide",7),this.actionClick=i(this,"actionClick",7),this.configuratorSave=i(this,"configuratorSave",7),this.configuratorCancel=i(this,"configuratorCancel",7),this.formItemsReady=i(this,"formItemsReady",7),this.viewModeChanged=i(this,"viewModeChanged",7),this.numberingConfigChanged=i(this,"numberingConfigChanged",7),this._viewHistory=[],this._customEditors=new Map,this._customRenders=new Map,this.loadEntitySuggestions=async t=>{var i;const s=null!==(i=null==t?void 0:t.argument)&&void 0!==i?i:"",e=(null==t?void 0:t.mode)||"PREDICTIVE";if(!s||0===s.trim().length)return[];try{this._showMoreOnSearch=!1;const t=this._snkDataUnit.entityName;return"PREDICTIVE"===e?await this.handlePredictiveSearch(s,t):await this._application.executePreparedSearch(e,s,this.buildSearchOptions(t))}catch(t){return console.error("Erro ao carregar sugestões de entidades:",t),[]}},this.searchEntitySelect=async t=>{if(this._entityPKField&&t)try{const i=[{name:this._entityPKField,value:t.value}];await this.refreshDataUnitByPk(i)}catch(t){console.error("Erro ao selecionar entidade:",t)}},this.dataUnitInterceptor={interceptAction:t=>(t.type===n.DATA_SAVED&&(t=this.interceptDataSaved(t)),t)},this._dataUnit=void 0,this._dataState=void 0,this.attachmentRegisterKey=void 0,this._currentViewMode=u.GRID,this._canEdit=void 0,this._resourceID=void 0,this.customContainerId=`SNK-CRUD-CUSTOM-CONTAINER-${a.generateUUID()}`,this.numberingConfig=void 0,this._showMoreOnSearch=!1,this._entityPKField=void 0,this.enableLockManagerLoadingComp=!1,this.enableLockManagerTaskbarClick=!1,this.configName=void 0,this.filterBarTitle=void 0,this.selectionToastConfig=void 0,this.showActionButtons=!1,this.actionsList=void 0,this.taskbarManager=void 0,this.recordsValidator=void 0,this.statusResolver=void 0,this.multipleSelection=!0,this.presentationMode=c.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.gridLegacyConfigName=void 0,this.filterBarLegacyConfigName=void 0,this.formLegacyConfigName=void 0,this.disablePersonalizedFilter=void 0,this.autoLoad=void 0,this.autoFocus=!0,this.enableGridInsert=!1,this.domainMessagesBuilder=void 0,this.ignoreReadOnlyFormFields=void 0,this.setCustomFormTitle=void 0,this.strategyExporter=l.SERVER_SIDE,this.layoutFormConfig=!0,this.multipleEditionEnabled=!0,this.paginationCounterMode="auto",this.customGuidesConfig=[],this.showEntitySearch=!0,this.disableNumberingConfig=!1}async goToView(t){this.executeAction(t)}async openConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.open()}async closeConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.close()}async reloadFilterBar(){var t;null===(t=this._snkGrid)||void 0===t||t.reloadFilterBar()}async getFilterBar(){return await this._snkGrid.getFilterBar()}async addCustomEditor(t,i){if(this._guidesViewer&&this._snkGrid)return this._guidesViewer.addCustomEditor(t,i),void this._snkGrid.addCustomEditor(t,i);const s=new Map(this._customEditors);s.set(t,i),this._customEditors=s}async addGridCustomRender(t,i){if(this._snkGrid)return void this._snkGrid.addGridCustomRender(t,i);const s=new Map(this._customRenders);s.set(t,i),this._customRenders=s}async addCustomValueFormatter(t,i){this._snkGrid.addCustomValueFormatter(t,i)}async removeCustomValueFormatter(t){this._snkGrid.removeCustomValueFormatter(t)}async setFieldProp(t,i,s){await this._guidesViewer.setFieldProp(t,i,s)}async getNumberingConfig(){return this.numberingConfig}async updateNumberingConfig(t){this.numberingConfig=t,this.applyNumberingConfigToFields()}currentViewModeWatcher(t){this._viewHistory=[...this._viewHistory.slice(-1),t]}async gridToForm(t=!1){this._backToGrid=!t&&await this._viewStack.getSelectedIndex()===u.GRID,this.setViewMode(u.FORM)}async executeAction(t){switch(t){case p.GRID_MODE:return this.setViewMode(u.GRID);case p.FORM_MODE:case p.UPDATE:return this.gridToForm(t!==p.UPDATE);case p.UPDATE_MULTIPLE:return this._dataUnit.isMultipleEdition=!0,this.setViewMode(u.FORM);case p.CONFIGURATOR:return this._snkConfigurator.open();case p.ATTACH:return this.setViewMode(u.ATTACHMENT)}}backView(){const t=this._viewHistory.at(-2)||u.GRID;this.setViewMode(t)}setViewMode(t){this._viewStack.show(t),this._currentViewMode=t,t===u.GRID?(this._dataUnit.isMultipleEdition=!1,this._snkGrid.setFocus()):t===u.FORM&&this._guidesViewer.setFocus(),this.viewModeChanged.emit(t)}openConfig(t){this._snkConfigurator.close(),t===u.GRID?this._snkGrid.showConfig():t===u.FORM&&this._guidesViewer.showFormConfig()}addDataElementID(){o.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}insertionModeHandler(){this.enableGridInsert||this.gridToForm()}cancelHandler(){this._backToGrid&&this.setViewMode(u.GRID)}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}setCustomRenders(){if(this._snkGrid)for(const[t,i]of this._customRenders)this._snkGrid.addGridCustomRender(t,i),this._customRenders.delete(t)}setCustomEditors(){if(this._snkGrid&&this._guidesViewer)for(const[t,i]of this._customEditors)this._guidesViewer.addCustomEditor(t,i),this._snkGrid.addCustomEditor(t,i),this._customEditors.delete(t)}componentDidRender(){this.setCustomRenders(),this.setCustomEditors()}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__");let t=this._element.parentElement;for(this._application.hasAccess(m.UPDATE,this._resourceID).then((t=>this._canEdit=t));t;){if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){this._snkDataUnit=t,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._snkDataUnit.domainMessagesBuilder=this.domainMessagesBuilder,this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.initDataUnit():this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail,this.initDataUnit()})),this._snkDataUnit.addEventListener("dataStateChange",this.handleDataStateChange.bind(this));break}t=t.parentElement}this.configName||(this.configName=this._application.configName)}componentDidLoad(){this.initKeyboardManager()}disconnectedCallback(){var t;this.removeShortcuts(),null===(t=this._dataUnit)||void 0===t||t.removeInterceptor(this.dataUnitInterceptor)}async handleDataStateChange(t){var i;this._dataState=t.detail,void 0!==this._dataState.selectedRecord&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey());const s=await this._snkDataUnit.getFieldsWithRmPrecision();for(const t of s||[]){if(!t)continue;const s=null===(i=this._dataState.rowMetadata)||void 0===i?void 0:i.getProp("rm_precision",t);(s||0===s)&&(await this.setFieldProp(t,"precision",s),await this.setFieldProp(t,"prettyPrecision",s))}}async initKeyboardManager(){this._keyboardManager=new d({propagate:!1,element:this._element});const t=this._dataUnit||await this._snkDataUnit.getDataUnit();async function i(){const i=document.activeElement,s=i==document.body;s||i.blur(),await t.saveData(),s||null==i.setFocus?s||i.focus():i.setFocus()}this._keyboardManager&&this._keyboardManager.bind("F6",this.toggleView.bind(this),{description:this.getMessage("snkCrud.shortcuts.toggleView"),element:this._element}).bind("F7",i.bind(this),{description:this.getMessage("snkCrud.shortcuts.saveData"),element:this._element}).bind("ctrl + \\",i.bind(this),{description:this.getMessage("snkCrud.shortcuts.addRecord"),element:this._element}).bind("F8",async function(){t.hasNewRecord()||t.addRecord()}.bind(this),{description:this.getMessage("snkCrud.shortcuts.addRecord"),element:this._element}).bind("F9",t.removeSelectedRecords.bind(t),{description:this.getMessage("snkCrud.shortcuts.removeRecord"),element:this._element}).bind("ctrl + F9",t.removeSelectedRecords.bind(t),{description:this.getMessage("snkCrud.shortcuts.removeRecord"),element:this._element}).bind("F5",(async()=>{const i=await this._viewStack.getSelectedIndex();u.GRID===i&&t.loadData()}),{description:this.getMessage("snkCrud.shortcuts.refreshData"),element:this._element}).bind("Escape",(()=>{t.isDirty()&&t.cancelEdition()}),{debounceTime:1e3,description:this.getMessage("snkCrud.shortcuts.cancelAction"),element:this._element})}getMessage(t,i){if(this.messagesBuilder)return this.messagesBuilder.getMessage(t,i)}async removeShortcuts(){var t;null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}async handlePredictiveSearch(t,i){var s,e;const h=await this._application.executePreparedSearchWithFullResponse(t,this.buildSearchOptions(i,5));return this._showMoreOnSearch=null!==(s=null==h?void 0:h.hasMore)&&void 0!==s&&s,this._entityPKField=null==h?void 0:h.pkField,null!==(e=null==h?void 0:h.data)&&void 0!==e?e:[]}async refreshDataUnitByPk(t){try{const i={term:"",filter:{name:"",params:[],expression:`(${t[0].name} = ${t[0].value})`}};await this._dataUnit.loadData(i),1===this._dataUnit.records.length&&(this._dataUnit.selectFirst(),this.gridToForm(!0))}catch(t){console.error("Erro ao atualizar dataset:",t)}}buildSearchOptions(t,i){return{entity:t,entityDescription:t,executeOnOpen:!0,searchOptions:{localEntityName:t,limit:i}}}async toggleView(){const t=await this._viewStack.getSelectedIndex();this.setViewMode(u.GRID===t?u.FORM:u.GRID)}getLastRecordSaved(t){var i;return(null===(i=t.payload)||void 0===i?void 0:i.records.length)?t.payload.records[t.payload.records.length-1]:null}async saveNumberingConfig(){const t={entityName:this._snkDataUnit.entityName,isAutoNum:this.numberingConfig.isAutoNumbering,numInicial:this.numberingConfig.initialNumber};await this._servicesNumberingConfig.saveConfig(t)}updateNumberingConfigAfterInsert(t){var i,s;if(!(null===(i=t.payload)||void 0===i?void 0:i.changes.length)||this.disableNumberingConfig||!(null===(s=this.numberingConfig)||void 0===s?void 0:s.isAutoNumbering)||!this._fieldAutoNum)return t;if(!t.payload.changes.some((t=>"INSERT"===t.operation||"COPY"===t.operation)))return t;const e=this.getLastRecordSaved(t);if(e&&e.hasOwnProperty(this._fieldAutoNum)){const t=Number(e[this._fieldAutoNum]);this.numberingConfig.initialNumber=t,this.saveNumberingConfig()}else this.numberingConfig.initialNumber=this.numberingConfig.initialNumber+1;return this.numberingConfigChanged.emit(this.numberingConfig),t}interceptDataSaved(t){return this.updateNumberingConfigAfterInsert(t),t}onDataUnitReady(){var t;null===(t=this._dataUnit)||void 0===t||t.addInterceptor(this.dataUnitInterceptor),this.loadNumberingConfig()}async initDataUnit(){this.addDataElementID(),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),null==this._resourceID&&(this._resourceID=this._snkDataUnit.resourceID,null==this._resourceID&&(this._resourceID=await this._application.getResourceID())),this.onDataUnitReady()}async loadNumberingConfig(){if(!this.numberingConfig&&this._snkDataUnit&&this._snkDataUnit.entityName&&!this.disableNumberingConfig){this._servicesNumberingConfig||(this._servicesNumberingConfig=new f(this._application,this._resourceID));try{this.numberingConfig=await this._servicesNumberingConfig.getConfig(this._snkDataUnit.entityName),this.getFieldAutoNum(),this.applyNumberingConfigToFields()}catch(t){console.error("Error loading numbering config in snk-crud:",t),this.numberingConfig={isAutoNumbering:!1,initialNumber:null}}}}getFieldAutoNum(){if(this._fieldAutoNum)return;const t=this._dataUnit.metadata.fields.find((t=>{var i;return"true"===(null===(i=t.properties)||void 0===i?void 0:i.isAutoNumField)}));this._fieldAutoNum=(null==t?void 0:t.name)||null}async applyNumberingConfigToFields(){if(!this.numberingConfig||!this._snkDataUnit||!this._fieldAutoNum)return;const t=this._dataUnit.getField(this._fieldAutoNum);t.readOnly=this.numberingConfig.isAutoNumbering,t.required=!this.numberingConfig.isAutoNumbering}handleConfiguratorEvent(t,i){if(t.stopImmediatePropagation(),"SAVE"===i)return this._guidesViewer.reloadGuides(),void this.configuratorSave.emit();this.configuratorCancel.emit()}renderCustomGuideSlots(){if(this.customGuidesConfig)return this.customGuidesConfig.map((t=>s("slot",{name:t.id})))}renderDynamicSearch(t){var i;if(this.showEntitySearch&&!0!==(null===(i=this._dataState)||void 0===i?void 0:i.insertionMode))return s("div",{slot:t,class:"entity-search-container",style:{position:"relative",display:"inline-block",marginLeft:"10px",minWidth:"200px"}},s("ez-search",{label:"Buscar registros",optionLoader:this.loadEntitySuggestions,onEzChange:t=>this.searchEntitySelect(t.detail),mode:"slim",showMore:this._showMoreOnSearch,suppressEmptyOption:!0,suppressInputPersist:!0}))}render(){if(null!=this._resourceID)return this._snkDataUnit.ignoreSaveMessage=this._currentViewMode===u.GRID&&!this.enableGridInsert,s(e,null,s("ez-view-stack",{ref:t=>this._viewStack=t,"data-element-id":"crud"},s("stack-item",{class:"ez-flex ez-flex--column ez-size-height--full ez-size-width--full ez-padding--medium"},s("snk-grid",{ref:t=>this._snkGrid=t,class:"ez-flex ez-flex--column ez-size-height--full ez-size-width--full",filterBarTitle:this.filterBarTitle,"data-element-id":"crud_grid",configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail),messagesBuilder:this.messagesBuilder,actionsList:this.actionsList,statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,presentationMode:this.presentationMode,recordsValidator:this.recordsValidator,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,canEdit:this._canEdit,resourceID:this._resourceID,disablePersonalizedFilter:this.disablePersonalizedFilter,gridLegacyConfigName:this.gridLegacyConfigName,filterBarLegacyConfigName:this.filterBarLegacyConfigName,autoLoad:this.autoLoad,autoFocus:this.autoFocus,enableGridInsert:this.enableGridInsert,enableLockManagerTaskbarClick:this.enableLockManagerTaskbarClick,enableLockManagerLoadingComp:this.enableLockManagerLoadingComp,strategyExporter:this.strategyExporter,multipleEditionEnabled:this.multipleEditionEnabled,paginationCounterMode:this.paginationCounterMode},s("slot",{name:"GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkGridHeader"}),s("slot",{name:"SnkGridFooter"}),s("slot",{name:"SnkGridTaskBar"}),this.renderDynamicSearch("GRID_HEADER_DYNAMIC_SEARCH"))),s("stack-item",null,s("snk-guides-viewer",{ref:t=>this._guidesViewer=t,customGuidesConfig:this.customGuidesConfig,entityPath:this._snkDataUnit.entityName,messagesBuilder:this.messagesBuilder,onExit:()=>this.setViewMode(u.GRID),dataState:this._dataState,dataUnit:this._dataUnit,actionsList:this.actionsList,taskbarManager:this.taskbarManager,configName:this.configName,onActionClick:t=>this.executeAction(t.detail),presentationMode:this.presentationMode,"data-element-id":"crud_form",canEdit:this._canEdit,recordsValidator:this.recordsValidator,resourceID:this._resourceID,detailTaskbarCustomContainerId:this.customContainerId,formLegacyConfigName:this.formLegacyConfigName,enableGridInsert:this.enableGridInsert,getCustomTitle:this.setCustomFormTitle,ignoreReadOnlyFormFields:this.ignoreReadOnlyFormFields},s("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"}),this.renderCustomGuideSlots(),this.renderDynamicSearch("GUIDES_VIEWER_DYNAMIC_SEARCH"),s("slot",{name:"SnkFormTaskBar"}))),s("stack-item",{tabIndex:"0"},s("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this._snkDataUnit.entityName,onBack:this.backView.bind(this)})),s("snk-configurator",{ref:t=>this._snkConfigurator=t,entityName:this._snkDataUnit.entityName,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:t=>this.setViewMode(t.detail),onOpenConfig:t=>this.openConfig(t.detail),showActionButtons:this.showActionButtons,onSave:t=>this.handleConfiguratorEvent(t,"SAVE"),onCancel:t=>this.handleConfiguratorEvent(t,"CANCEL"),resourceID:this._resourceID,customContainerId:this.customContainerId,layoutFormConfig:this.layoutFormConfig})),s("div",{id:`${this.customContainerId}`},s("slot",{name:"SnkConfigContainerSlot"}),s("slot",{name:"DETAIL_GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"})))}get _element(){return h(this)}static get watchers(){return{_currentViewMode:["currentViewModeWatcher"]}}};g.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{g as snk_crud}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as s,h as i,g as e}from"./p-
|
|
1
|
+
import{r as t,c as s,h as i,g as e}from"./p-82bb3eda.js";import{ElementIDUtils as h,ApplicationContext as r}from"@sankhyalabs/core";import{F as a}from"./p-ff1990ad.js";const o=class{constructor(i){t(this,i),this.valueChanged=s(this,"valueChanged",7),this._isSearchPlus=!1,this.config=void 0,this.value=void 0,this.errorMessage=void 0}async ezChangeListener(t){this.errorMessage=void 0,this.value=this._isSearchPlus?await this._searchInput.getValueAsync():this._searchInput.value,this.valueChanged.emit(this.value)}componentDidLoad(){this._element&&h.addIDInfo(this._element,"filterContentEditor")}doSearch(t,s,i=!1){const e=r.getContextValue("__SNK__APPLICATION__"),h=i?e.executePreparedSearchPlus:e.executePreparedSearch;return new Promise(((i,r)=>{h.bind(e)(t,s,this.config.props.searchContext).then((t=>{i(t)})).catch((t=>{r(t)}))}))}async setFocus(){this._searchInput.setFocus()}async clearValue(){this.value=this.config.value,this._searchInput&&(this._searchInput.value=this.config.value)}getInputItem(){var t;return this._isSearchPlus=1==(null===(t=this.config.props)||void 0===t?void 0:t.useSearchPlus),i("ez-tooltip",{active:!1===this.config.enabled,message:this.config.disabledMessage,type:"warning"},i(this._isSearchPlus?"ez-search-plus":"ez-search",{id:this.config.id,suppressEmptyOption:!0,value:this.config.value,label:this.config.label,enabled:this.config.enabled,ref:t=>this._searchInput=t,optionLoader:({mode:t,argument:s})=>this.doSearch(t,s,this._isSearchPlus),errorMessage:this.errorMessage}))}render(){if(this.config&&this.config.type===a.SEARCH)return this.getInputItem()}get _element(){return e(this)}};export{o as snk_filter_search}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as i,r as e,c as t,g as s}from"./p-d8d8169b.js";import{S as l}from"./p-f4184ce7.js";import{UserInterface as a,JSUtils as n,ElementIDUtils as r,ApplicationContext as o,StringUtils as h,DataType as d}from"@sankhyalabs/core";import{ModalAction as c}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{b as u,c as f,d as m}from"./p-84345e7a.js";import{P as p}from"./p-988afe78.js";import"./p-ff1990ad.js";const v={[a.SHORTTEXT]:"text",[a.LONGTEXT]:"text",[a.INTEGERNUMBER]:"number",[a.DECIMALNUMBER]:"number",[a.DATE]:"calendar",[a.DATETIME]:"calendar",[a.SWITCH]:"boolean",[a.CHECKBOX]:"check-circle-inverted",[a.OPTIONSELECTOR]:"list",[a.SEARCH]:"search",[a.HTML]:"tag_code",[a.IMAGE]:"png",[a.FILE]:"edit-file",[a.TIME]:"timer-outline",[a.ELAPSEDTIME]:"timer",[a.MASKEDTEXT]:"text",[a.PASSWORD]:"email"},b=({userInterface:e,description:t})=>i("ez-icon",{iconName:v[e],class:"ez-padding-left--small",title:t}),g="__SNK__APPLICATION__",z=/\w+:\/\/(\w+)/,k=class{constructor(i){e(this,i),this.ezSelectFilterItem=t(this,"ezSelectFilterItem",7),this._currentMetadata=null,this._filterText="",this._isLoading=!1,this.searchable=!0,this.fieldsDataSource=void 0,this.breadcrumbItems=[],this.linkItems=[],this.fieldItems=[],this.searchEmpty=!1,this.groupEmpty=!1}async show(i,e){var t;return i?null===(t=this._ezPopover)||void 0===t||t.showUnder(i,e):this._ezPopover.show(),this.loadData()}async applyFilter(i){if(this.searchable)throw new Error("This method is not available when searchable is true");this.handleFilterChange(i)}async loadData(){var i,e;this._isLoading=!0;let t=await this.fieldsDataSource.fetchData(this._currentLink);this._currentLink=t.currentLink;const{fields:s,links:l}=t||{};if(!Array.isArray(s)||!Array.isArray(l))throw new Error("Invalid metadata");this._currentMetadata=t,this.mapDataSourceToLinkItems(),this.mapDataSourceToFieldItems(),this._isLoading=!1,null===(i=this._ezFieldList)||void 0===i||i.scrollToTop(),null===(e=this._ezLinkList)||void 0===e||e.scrollToTop()}mapDataSourceToLinkItems(){var i;const{links:e}=this._currentMetadata,t=this.getMessage("snkFilterFieldSearch.linkLabel",{link:null===(i=this._currentLink)||void 0===i?void 0:i.description}),s=e.map((i=>Object.assign({label:i.description},i)));this.groupEmpty=Boolean(0===s.length),this.linkItems=[{group:t,items:s}],0===this.breadcrumbItems.length&&(this.breadcrumbItems=[Object.assign({id:n.generateUUID(),label:this._currentLink.description},this._currentLink)])}mapDataSourceToFieldItems(){var i;const e=this._currentMetadata.fields,t=this.getMessage("snkFilterFieldSearch.fieldLabel",{link:null===(i=this._currentLink)||void 0===i?void 0:i.description}),s=e.filter((i=>{if(!this._currentLink)return!0;const e=i.description.toLowerCase().includes(this._filterText.toLowerCase()),t=i.name.toLowerCase().includes(this._filterText.toLowerCase());return e||t})).map((i=>Object.assign({label:i.description},i)));this.searchEmpty=Boolean(this._filterText&&0===s.length),this.fieldItems=[{group:t,items:s}]}handleFilterChange(i){this._isLoading||(this._filterText=i,this.mapDataSourceToFieldItems())}handleSelectLink({detail:i}){if(this._isLoading)return;const e=this.breadcrumbItems.findIndex((e=>e.id===i.id));this.breadcrumbItems=e>-1?this.breadcrumbItems.slice(0,e+1):[...this.breadcrumbItems,Object.assign({id:n.generateUUID(),label:i.description},i)];const t=Object.assign(Object.assign({},i),{type:l.LINK});this._currentLink=t,this.ezSelectFilterItem.emit(t),this.loadData()}getEntityFromBreadCrumbItem(i){const e=z.exec(i.uri);if(e)return e[1]}handleSelectField({detail:i}){var e;const t=this.breadcrumbItems.map((i=>i.label)).join(">>"),s=Object.assign(Object.assign({},i),{type:l.FIELD,entityPath:this.breadcrumbItems.map((i=>this.getEntityFromBreadCrumbItem(i))).filter((i=>null!=i)),path:`${t} >> ${i.description}`});this.ezSelectFilterItem.emit(s),null===(e=this._ezPopover)||void 0===e||e.hide()}getElementID(i){return{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(i)}}getMessage(i,e){var t,s,l;return this._application||(this._application=o.getContextValue(g)),null===(l=null===(s=null===(t=this._application)||void 0===t?void 0:t.messagesBuilder)||void 0===s?void 0:s.getMessage)||void 0===l?void 0:l.call(s,i,e)}componentWillLoad(){this._application=o.getContextValue(g)}componentDidLoad(){r.addIDInfoIfNotExists(this._ezPopover,"popover")}disconnectedCallback(){var i;null===(i=this._ezPopover)||void 0===i||i.hide()}render(){var e;const t=this.getMessage("snkFilterFieldSearch.searchLabel");return i("ez-popover",Object.assign({ref:i=>this._ezPopover=i,role:"dialog",overlayType:"none","aria-hidden":!(null===(e=this._ezPopover)||void 0===e?void 0:e.opened)},this.getElementID("EzPopover")),i("div",{class:"snk-filter-field-search__container"},i("header",{class:"snk-filter-field-search__header"},this.searchable&&!!t&&i("ez-filter-input",Object.assign({class:"snk-filter-field-search__input",label:t,asyncSearch:!0,canShowError:!1,onEzSearching:i=>this.handleFilterChange.bind(this)(i.detail),"aria-label":t,"aria-required":"false","aria-invalid":"false"},this.getElementID("EzFilterInput"))),this.breadcrumbItems.length>0&&i("ez-breadcrumb",Object.assign({items:this.breadcrumbItems,onSelectedItem:this.handleSelectLink.bind(this),role:"navigation","aria-current":"step"},this.getElementID("EzBreadcrumb"))),i("hr",{class:"ez-divider-horizontal ez-margin-vertical--medium"})),i("section",{class:`snk-filter-field-search__section ${this.groupEmpty&&this.searchEmpty&&" ez-margin--auto"}`},this.groupEmpty?i("div",{class:"ez-margin--auto"},i("span",{class:"ez-text ez-text--secondary ez-text--medium"},this.getMessage("snkFilterFieldSearch.groupEmpty"))):i("ez-list",Object.assign({ref:i=>this._ezLinkList=i,class:"snk-filter-field-search__list",id:"filterLinkList",useGroups:!0,dataSource:this.linkItems,onEzSelectItem:this.handleSelectLink.bind(this),hoverFeedback:!0,ezSelectable:!0,itemSlotBuilder:e=>i("ez-badge",{label:e.fieldCount}),"aria-describedby":"filterLinkLabel"},this.getElementID("EzListLinks"))),this.searchEmpty?i("div",{class:"ez-margin--auto"},i("span",{class:"ez-text ez-text--secondary ez-text--medium"},this.getMessage("snkFilterFieldSearch.searchEmpty"))):i("ez-list",Object.assign({ref:i=>this._ezFieldList=i,class:"snk-filter-field-search__list",id:"filterFieldList",useGroups:!0,dataSource:this.fieldItems,onEzSelectItem:this.handleSelectField.bind(this),hoverFeedback:!0,ezSelectable:!0,itemSlotBuilder:b,"aria-describedby":"filterFieldLabel"},this.getElementID("EzListFields"))))))}};k.style=".sc-snk-filter-field-search-h{--snk-filter-field-search--container-width:468px;--snk-filter-field-search--container-height:322px}.snk-filter-field-search__container.sc-snk-filter-field-search{display:flex;flex-direction:column;padding:var(--space--medium);width:var(--snk-filter-field-search--container-width);height:var(--snk-filter-field-search--container-height)}.snk-filter-field-search__section.sc-snk-filter-field-search{display:grid;grid-template-columns:1fr 1fr;place-items:flex-start;overflow:hidden;gap:var(--space--small)}.snk-filter-field-search__input.sc-snk-filter-field-search{margin-bottom:var(--space--medium)}.snk-filter-field-search__list_container.sc-snk-filter-field-search{display:flex;flex-direction:column}.snk-filter-field-search__list.sc-snk-filter-field-search{overflow-y:auto}";const y=class{constructor(i){e(this,i),this._opened=!1,this._configType=u.SYSTEM_CONFIG,this._expressionItem=void 0,this._informedInstance=!1,this._canSave=!1,this.messagesBuilder=void 0}open(i){return this._opened=!0,this._expressionItem=i,this.loadValues(),new Promise((i=>{this._promiseResolver=i}))}close(){return this._opened=!1,new Promise((i=>{this._promiseResolver=i}))}getMessage(i,e){var t;return null===(t=this.messagesBuilder)||void 0===t?void 0:t.getMessage(i,e)}getConfigValue(i,e,t=""){var s,l,a;return(null===(l=null===(s=this._expressionItem)||void 0===s?void 0:s[i])||void 0===l?void 0:l[e])||(null===(a=this._expressionItem)||void 0===a?void 0:a[t||e])}loadValues(){var i;const e=this.getConfigValue("systemConfig","entity","entityName"),t=this.getConfigValue("systemConfig","fieldName"),s=this.getConfigValue("userConfig","description"),l=this.getConfigValue("userConfig","type");this._configType=null!=(null===(i=this._expressionItem)||void 0===i?void 0:i.userConfig)?u.USER_CONFIG:u.SYSTEM_CONFIG,h.isEmpty(e)||h.isEmpty(t)||(this._instanceElement.value={value:e,label:""},this._fieldElement.value={value:t,label:""}),h.isEmpty(s)||h.isEmpty(l)||(this._descriptionElement.value=s,this._typeElement.value=l),this.buildFilterExpression()}changeDefinitionUsed(i){if(this._configType=null!=i?i:u.SYSTEM_CONFIG,this._configType===u.SYSTEM_CONFIG){const i=this.getConfigValue("systemConfig","entity","entityName"),e=this.getConfigValue("systemConfig","fieldName");this._instanceElement.value=this._instanceElement.value||{value:i,label:""},this._fieldElement.value=this._fieldElement.value||{value:e,label:""}}else if(this._configType===u.USER_CONFIG){const i=this.getConfigValue("userConfig","description"),e=this.getConfigValue("userConfig","type");this._descriptionElement.value=this._descriptionElement.value||i,this._typeElement.value=this._typeElement.value||e}this.buildFilterExpression()}getTypeValue(){var i;const e=null===(i=this._typeElement)||void 0===i?void 0:i.value;return(null==e?void 0:e.value)||e}getExpressionValues(){var i,e,t,s,l;let a,n;return this._configType===u.SYSTEM_CONFIG?a={entity:null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value,fieldName:null===(s=null===(t=this._fieldElement)||void 0===t?void 0:t.value)||void 0===s?void 0:s.value}:this._configType===u.USER_CONFIG&&(n={description:null===(l=this._descriptionElement)||void 0===l?void 0:l.value,type:this.getTypeValue()}),Object.assign(Object.assign(Object.assign({},this._expressionItem),{systemConfig:a}),{userConfig:n})}isEnabled(i){return this._configType===i}isInformedInstance(){var i,e;return!h.isEmpty(null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value)}save(){var i;this._expressionItem=Object.assign(Object.assign({},this.getExpressionValues()),{expression:null===(i=this._expressionElement)||void 0===i?void 0:i.value}),this._promiseResolver(this._expressionItem),this._opened=!1}buildFilterExpression(){var i;this._informedInstance=this.isInformedInstance();const e=p.buildFilterExpression(this.getExpressionValues());this._expressionElement.value=e||(null===(i=this._expressionItem)||void 0===i?void 0:i.expression),this._canSave=this.getCanSave()}handleChangeInstance(){this._informedInstance=this.isInformedInstance(),null==this._fieldElement||h.isEmpty(this._fieldElement.value)||(this._fieldElement.value=null),this.buildFilterExpression()}getInstanceCriteria(){var i,e;const t=null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value;return{expression:"this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",params:[{name:"NOMEINSTANCIA",dataType:d.TEXT,value:t}]}}onSearch({mode:i,argument:e},t){if(null==this._application||!this._opened)return;const s=t===f.FIELD,l=s?this.getInstanceCriteria():void 0,a={entity:t,entityDescription:this.getMessage("snkFilterParamConfig.label"+(s?"Field":"Instance")),criteria:l,searchOptions:{descriptionFieldName:s?"DESCRCAMPO":"DESCRINSTANCIA",codeFieldName:s?"NOMECAMPO":"NOMEINSTANCIA",showInactives:!1}};return new Promise((t=>{this._application.executePreparedSearch(i,e,a).then((i=>t(i)))}))}getElementID(i){return{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(i)}}getCanSave(){var i;if(this._configType===u.USER_CONFIG){const e=null===(i=this._descriptionElement)||void 0===i?void 0:i.value,t=this.getTypeValue();return!h.isEmpty(e)&&!h.isEmpty(t)}return!0}componentWillLoad(){this._application=o.getContextValue("__SNK__APPLICATION__")}render(){return r.addIDInfoIfNotExists(this._element,"snkFilterParamConfig"),i("ez-popup",Object.assign({useHeader:!1,size:"small",heightMode:"auto",opened:this._opened},this.getElementID("popup")),i("ez-modal-container",Object.assign({onEzModalAction:i=>{i.detail===c.CLOSE&&this.close()},modalTitle:this.getMessage("snkFilterParamConfig.modalTitle")},this.getElementID("modalContainer")),i("div",{class:"ez-flex"},i("div",{class:"ez-col ez-col--sd-6 ez-flex--column"},i("ez-radio-button",Object.assign({value:this._configType,onEzChange:i=>this.changeDefinitionUsed(i.detail)},this.getElementID("systemConfigOption")),i("ez-radio-button-option",{label:this.getMessage("snkFilterParamConfig.labelSystemConfig"),value:u.SYSTEM_CONFIG})),i("ez-search",Object.assign({ref:i=>this._instanceElement=i,label:this.getMessage("snkFilterParamConfig.labelInstance"),enabled:this.isEnabled(u.SYSTEM_CONFIG),suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,onEzChange:()=>this.handleChangeInstance(),optionLoader:i=>this.onSearch(i,f.INSTANCE)},this.getElementID("configFindEntity"))),i("ez-search",Object.assign({ref:i=>this._fieldElement=i,label:this.getMessage("snkFilterParamConfig.labelField"),enabled:this.isEnabled(u.SYSTEM_CONFIG)&&this._informedInstance,suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,onEzChange:()=>this.buildFilterExpression(),optionLoader:i=>this.onSearch(i,f.FIELD)},this.getElementID("configFindField")))),i("div",{class:"ez-flex ez-padding--medium"},i("hr",{class:"ez-divider-vertical"})),i("div",{class:"ez-col ez-col--sd-6 ez-flex--column"},i("ez-radio-button",Object.assign({value:this._configType,onEzChange:i=>this.changeDefinitionUsed(i.detail)},this.getElementID("userConfigOption")),i("ez-radio-button-option",{label:this.getMessage("snkFilterParamConfig.labelUserConfig"),value:u.USER_CONFIG})),i("ez-text-input",Object.assign({ref:i=>this._descriptionElement=i,label:this.getMessage("snkFilterParamConfig.labelDescription"),enabled:this.isEnabled(u.USER_CONFIG),onEzChange:()=>this.buildFilterExpression()},this.getElementID("configParamLabel"))),i("ez-combo-box",Object.assign({ref:i=>this._typeElement=i,label:this.getMessage("snkFilterParamConfig.labelType"),enabled:this.isEnabled(u.USER_CONFIG),suppressEmptyOption:!0,onEzChange:()=>this.buildFilterExpression()},this.getElementID("configParamType")),Object.keys(m).map((e=>i("option",{value:m[e]},this.getMessage(`snkFilterParamConfig.labelTypeValues.${e.toLowerCase()}`))))))),i("ez-text-area",Object.assign({ref:i=>this._expressionElement=i,class:"snk-filter-param-config__expression",label:this.getMessage("snkFilterParamConfig.labelExpression"),enabled:!1},this.getElementID("presentationExpression"))),i("div",{class:"ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small"},i("ez-button",Object.assign({class:"ez-padding-right--medium",label:this.getMessage("snkFilterParamConfig.labelCancel"),onClick:()=>this.close()},this.getElementID("cancelEditParam"))),i("ez-button",Object.assign({class:"ez-button--primary",label:this.getMessage("snkFilterParamConfig.labelSave"),onClick:()=>this.save(),enabled:this._canSave},this.getElementID("saveEditParam"))))))}get _element(){return s(this)}};y.style=":host{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";export{k as snk_filter_field_search,y as snk_filter_param_config}
|
|
1
|
+
import{h as i,r as e,c as t,g as s}from"./p-82bb3eda.js";import{S as l}from"./p-f4184ce7.js";import{UserInterface as a,JSUtils as n,ElementIDUtils as r,ApplicationContext as o,StringUtils as h,DataType as d}from"@sankhyalabs/core";import{ModalAction as c}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{b as u,c as f,d as m}from"./p-84345e7a.js";import{P as p}from"./p-988afe78.js";import"./p-ff1990ad.js";const v={[a.SHORTTEXT]:"text",[a.LONGTEXT]:"text",[a.INTEGERNUMBER]:"number",[a.DECIMALNUMBER]:"number",[a.DATE]:"calendar",[a.DATETIME]:"calendar",[a.SWITCH]:"boolean",[a.CHECKBOX]:"check-circle-inverted",[a.OPTIONSELECTOR]:"list",[a.SEARCH]:"search",[a.HTML]:"tag_code",[a.IMAGE]:"png",[a.FILE]:"edit-file",[a.TIME]:"timer-outline",[a.ELAPSEDTIME]:"timer",[a.MASKEDTEXT]:"text",[a.PASSWORD]:"email"},b=({userInterface:e,description:t})=>i("ez-icon",{iconName:v[e],class:"ez-padding-left--small",title:t}),g="__SNK__APPLICATION__",z=/\w+:\/\/(\w+)/,k=class{constructor(i){e(this,i),this.ezSelectFilterItem=t(this,"ezSelectFilterItem",7),this._currentMetadata=null,this._filterText="",this._isLoading=!1,this.searchable=!0,this.fieldsDataSource=void 0,this.breadcrumbItems=[],this.linkItems=[],this.fieldItems=[],this.searchEmpty=!1,this.groupEmpty=!1}async show(i,e){var t;return i?null===(t=this._ezPopover)||void 0===t||t.showUnder(i,e):this._ezPopover.show(),this.loadData()}async applyFilter(i){if(this.searchable)throw new Error("This method is not available when searchable is true");this.handleFilterChange(i)}async loadData(){var i,e;this._isLoading=!0;let t=await this.fieldsDataSource.fetchData(this._currentLink);this._currentLink=t.currentLink;const{fields:s,links:l}=t||{};if(!Array.isArray(s)||!Array.isArray(l))throw new Error("Invalid metadata");this._currentMetadata=t,this.mapDataSourceToLinkItems(),this.mapDataSourceToFieldItems(),this._isLoading=!1,null===(i=this._ezFieldList)||void 0===i||i.scrollToTop(),null===(e=this._ezLinkList)||void 0===e||e.scrollToTop()}mapDataSourceToLinkItems(){var i;const{links:e}=this._currentMetadata,t=this.getMessage("snkFilterFieldSearch.linkLabel",{link:null===(i=this._currentLink)||void 0===i?void 0:i.description}),s=e.map((i=>Object.assign({label:i.description},i)));this.groupEmpty=Boolean(0===s.length),this.linkItems=[{group:t,items:s}],0===this.breadcrumbItems.length&&(this.breadcrumbItems=[Object.assign({id:n.generateUUID(),label:this._currentLink.description},this._currentLink)])}mapDataSourceToFieldItems(){var i;const e=this._currentMetadata.fields,t=this.getMessage("snkFilterFieldSearch.fieldLabel",{link:null===(i=this._currentLink)||void 0===i?void 0:i.description}),s=e.filter((i=>{if(!this._currentLink)return!0;const e=i.description.toLowerCase().includes(this._filterText.toLowerCase()),t=i.name.toLowerCase().includes(this._filterText.toLowerCase());return e||t})).map((i=>Object.assign({label:i.description},i)));this.searchEmpty=Boolean(this._filterText&&0===s.length),this.fieldItems=[{group:t,items:s}]}handleFilterChange(i){this._isLoading||(this._filterText=i,this.mapDataSourceToFieldItems())}handleSelectLink({detail:i}){if(this._isLoading)return;const e=this.breadcrumbItems.findIndex((e=>e.id===i.id));this.breadcrumbItems=e>-1?this.breadcrumbItems.slice(0,e+1):[...this.breadcrumbItems,Object.assign({id:n.generateUUID(),label:i.description},i)];const t=Object.assign(Object.assign({},i),{type:l.LINK});this._currentLink=t,this.ezSelectFilterItem.emit(t),this.loadData()}getEntityFromBreadCrumbItem(i){const e=z.exec(i.uri);if(e)return e[1]}handleSelectField({detail:i}){var e;const t=this.breadcrumbItems.map((i=>i.label)).join(">>"),s=Object.assign(Object.assign({},i),{type:l.FIELD,entityPath:this.breadcrumbItems.map((i=>this.getEntityFromBreadCrumbItem(i))).filter((i=>null!=i)),path:`${t} >> ${i.description}`});this.ezSelectFilterItem.emit(s),null===(e=this._ezPopover)||void 0===e||e.hide()}getElementID(i){return{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(i)}}getMessage(i,e){var t,s,l;return this._application||(this._application=o.getContextValue(g)),null===(l=null===(s=null===(t=this._application)||void 0===t?void 0:t.messagesBuilder)||void 0===s?void 0:s.getMessage)||void 0===l?void 0:l.call(s,i,e)}componentWillLoad(){this._application=o.getContextValue(g)}componentDidLoad(){r.addIDInfoIfNotExists(this._ezPopover,"popover")}disconnectedCallback(){var i;null===(i=this._ezPopover)||void 0===i||i.hide()}render(){var e;const t=this.getMessage("snkFilterFieldSearch.searchLabel");return i("ez-popover",Object.assign({ref:i=>this._ezPopover=i,role:"dialog",overlayType:"none","aria-hidden":!(null===(e=this._ezPopover)||void 0===e?void 0:e.opened)},this.getElementID("EzPopover")),i("div",{class:"snk-filter-field-search__container"},i("header",{class:"snk-filter-field-search__header"},this.searchable&&!!t&&i("ez-filter-input",Object.assign({class:"snk-filter-field-search__input",label:t,asyncSearch:!0,canShowError:!1,onEzSearching:i=>this.handleFilterChange.bind(this)(i.detail),"aria-label":t,"aria-required":"false","aria-invalid":"false"},this.getElementID("EzFilterInput"))),this.breadcrumbItems.length>0&&i("ez-breadcrumb",Object.assign({items:this.breadcrumbItems,onSelectedItem:this.handleSelectLink.bind(this),role:"navigation","aria-current":"step"},this.getElementID("EzBreadcrumb"))),i("hr",{class:"ez-divider-horizontal ez-margin-vertical--medium"})),i("section",{class:`snk-filter-field-search__section ${this.groupEmpty&&this.searchEmpty&&" ez-margin--auto"}`},this.groupEmpty?i("div",{class:"ez-margin--auto"},i("span",{class:"ez-text ez-text--secondary ez-text--medium"},this.getMessage("snkFilterFieldSearch.groupEmpty"))):i("ez-list",Object.assign({ref:i=>this._ezLinkList=i,class:"snk-filter-field-search__list",id:"filterLinkList",useGroups:!0,dataSource:this.linkItems,onEzSelectItem:this.handleSelectLink.bind(this),hoverFeedback:!0,ezSelectable:!0,itemSlotBuilder:e=>i("ez-badge",{label:e.fieldCount}),"aria-describedby":"filterLinkLabel"},this.getElementID("EzListLinks"))),this.searchEmpty?i("div",{class:"ez-margin--auto"},i("span",{class:"ez-text ez-text--secondary ez-text--medium"},this.getMessage("snkFilterFieldSearch.searchEmpty"))):i("ez-list",Object.assign({ref:i=>this._ezFieldList=i,class:"snk-filter-field-search__list",id:"filterFieldList",useGroups:!0,dataSource:this.fieldItems,onEzSelectItem:this.handleSelectField.bind(this),hoverFeedback:!0,ezSelectable:!0,itemSlotBuilder:b,"aria-describedby":"filterFieldLabel"},this.getElementID("EzListFields"))))))}};k.style=".sc-snk-filter-field-search-h{--snk-filter-field-search--container-width:468px;--snk-filter-field-search--container-height:322px}.snk-filter-field-search__container.sc-snk-filter-field-search{display:flex;flex-direction:column;padding:var(--space--medium);width:var(--snk-filter-field-search--container-width);height:var(--snk-filter-field-search--container-height)}.snk-filter-field-search__section.sc-snk-filter-field-search{display:grid;grid-template-columns:1fr 1fr;place-items:flex-start;overflow:hidden;gap:var(--space--small)}.snk-filter-field-search__input.sc-snk-filter-field-search{margin-bottom:var(--space--medium)}.snk-filter-field-search__list_container.sc-snk-filter-field-search{display:flex;flex-direction:column}.snk-filter-field-search__list.sc-snk-filter-field-search{overflow-y:auto}";const y=class{constructor(i){e(this,i),this._opened=!1,this._configType=u.SYSTEM_CONFIG,this._expressionItem=void 0,this._informedInstance=!1,this._canSave=!1,this.messagesBuilder=void 0}open(i){return this._opened=!0,this._expressionItem=i,this.loadValues(),new Promise((i=>{this._promiseResolver=i}))}close(){return this._opened=!1,new Promise((i=>{this._promiseResolver=i}))}getMessage(i,e){var t;return null===(t=this.messagesBuilder)||void 0===t?void 0:t.getMessage(i,e)}getConfigValue(i,e,t=""){var s,l,a;return(null===(l=null===(s=this._expressionItem)||void 0===s?void 0:s[i])||void 0===l?void 0:l[e])||(null===(a=this._expressionItem)||void 0===a?void 0:a[t||e])}loadValues(){var i;const e=this.getConfigValue("systemConfig","entity","entityName"),t=this.getConfigValue("systemConfig","fieldName"),s=this.getConfigValue("userConfig","description"),l=this.getConfigValue("userConfig","type");this._configType=null!=(null===(i=this._expressionItem)||void 0===i?void 0:i.userConfig)?u.USER_CONFIG:u.SYSTEM_CONFIG,h.isEmpty(e)||h.isEmpty(t)||(this._instanceElement.value={value:e,label:""},this._fieldElement.value={value:t,label:""}),h.isEmpty(s)||h.isEmpty(l)||(this._descriptionElement.value=s,this._typeElement.value=l),this.buildFilterExpression()}changeDefinitionUsed(i){if(this._configType=null!=i?i:u.SYSTEM_CONFIG,this._configType===u.SYSTEM_CONFIG){const i=this.getConfigValue("systemConfig","entity","entityName"),e=this.getConfigValue("systemConfig","fieldName");this._instanceElement.value=this._instanceElement.value||{value:i,label:""},this._fieldElement.value=this._fieldElement.value||{value:e,label:""}}else if(this._configType===u.USER_CONFIG){const i=this.getConfigValue("userConfig","description"),e=this.getConfigValue("userConfig","type");this._descriptionElement.value=this._descriptionElement.value||i,this._typeElement.value=this._typeElement.value||e}this.buildFilterExpression()}getTypeValue(){var i;const e=null===(i=this._typeElement)||void 0===i?void 0:i.value;return(null==e?void 0:e.value)||e}getExpressionValues(){var i,e,t,s,l;let a,n;return this._configType===u.SYSTEM_CONFIG?a={entity:null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value,fieldName:null===(s=null===(t=this._fieldElement)||void 0===t?void 0:t.value)||void 0===s?void 0:s.value}:this._configType===u.USER_CONFIG&&(n={description:null===(l=this._descriptionElement)||void 0===l?void 0:l.value,type:this.getTypeValue()}),Object.assign(Object.assign(Object.assign({},this._expressionItem),{systemConfig:a}),{userConfig:n})}isEnabled(i){return this._configType===i}isInformedInstance(){var i,e;return!h.isEmpty(null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value)}save(){var i;this._expressionItem=Object.assign(Object.assign({},this.getExpressionValues()),{expression:null===(i=this._expressionElement)||void 0===i?void 0:i.value}),this._promiseResolver(this._expressionItem),this._opened=!1}buildFilterExpression(){var i;this._informedInstance=this.isInformedInstance();const e=p.buildFilterExpression(this.getExpressionValues());this._expressionElement.value=e||(null===(i=this._expressionItem)||void 0===i?void 0:i.expression),this._canSave=this.getCanSave()}handleChangeInstance(){this._informedInstance=this.isInformedInstance(),null==this._fieldElement||h.isEmpty(this._fieldElement.value)||(this._fieldElement.value=null),this.buildFilterExpression()}getInstanceCriteria(){var i,e;const t=null===(e=null===(i=this._instanceElement)||void 0===i?void 0:i.value)||void 0===e?void 0:e.value;return{expression:"this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",params:[{name:"NOMEINSTANCIA",dataType:d.TEXT,value:t}]}}onSearch({mode:i,argument:e},t){if(null==this._application||!this._opened)return;const s=t===f.FIELD,l=s?this.getInstanceCriteria():void 0,a={entity:t,entityDescription:this.getMessage("snkFilterParamConfig.label"+(s?"Field":"Instance")),criteria:l,searchOptions:{descriptionFieldName:s?"DESCRCAMPO":"DESCRINSTANCIA",codeFieldName:s?"NOMECAMPO":"NOMEINSTANCIA",showInactives:!1}};return new Promise((t=>{this._application.executePreparedSearch(i,e,a).then((i=>t(i)))}))}getElementID(i){return{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(i)}}getCanSave(){var i;if(this._configType===u.USER_CONFIG){const e=null===(i=this._descriptionElement)||void 0===i?void 0:i.value,t=this.getTypeValue();return!h.isEmpty(e)&&!h.isEmpty(t)}return!0}componentWillLoad(){this._application=o.getContextValue("__SNK__APPLICATION__")}render(){return r.addIDInfoIfNotExists(this._element,"snkFilterParamConfig"),i("ez-popup",Object.assign({useHeader:!1,size:"small",heightMode:"auto",opened:this._opened},this.getElementID("popup")),i("ez-modal-container",Object.assign({onEzModalAction:i=>{i.detail===c.CLOSE&&this.close()},modalTitle:this.getMessage("snkFilterParamConfig.modalTitle")},this.getElementID("modalContainer")),i("div",{class:"ez-flex"},i("div",{class:"ez-col ez-col--sd-6 ez-flex--column"},i("ez-radio-button",Object.assign({value:this._configType,onEzChange:i=>this.changeDefinitionUsed(i.detail)},this.getElementID("systemConfigOption")),i("ez-radio-button-option",{label:this.getMessage("snkFilterParamConfig.labelSystemConfig"),value:u.SYSTEM_CONFIG})),i("ez-search",Object.assign({ref:i=>this._instanceElement=i,label:this.getMessage("snkFilterParamConfig.labelInstance"),enabled:this.isEnabled(u.SYSTEM_CONFIG),suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,onEzChange:()=>this.handleChangeInstance(),optionLoader:i=>this.onSearch(i,f.INSTANCE)},this.getElementID("configFindEntity"))),i("ez-search",Object.assign({ref:i=>this._fieldElement=i,label:this.getMessage("snkFilterParamConfig.labelField"),enabled:this.isEnabled(u.SYSTEM_CONFIG)&&this._informedInstance,suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,onEzChange:()=>this.buildFilterExpression(),optionLoader:i=>this.onSearch(i,f.FIELD)},this.getElementID("configFindField")))),i("div",{class:"ez-flex ez-padding--medium"},i("hr",{class:"ez-divider-vertical"})),i("div",{class:"ez-col ez-col--sd-6 ez-flex--column"},i("ez-radio-button",Object.assign({value:this._configType,onEzChange:i=>this.changeDefinitionUsed(i.detail)},this.getElementID("userConfigOption")),i("ez-radio-button-option",{label:this.getMessage("snkFilterParamConfig.labelUserConfig"),value:u.USER_CONFIG})),i("ez-text-input",Object.assign({ref:i=>this._descriptionElement=i,label:this.getMessage("snkFilterParamConfig.labelDescription"),enabled:this.isEnabled(u.USER_CONFIG),onEzChange:()=>this.buildFilterExpression()},this.getElementID("configParamLabel"))),i("ez-combo-box",Object.assign({ref:i=>this._typeElement=i,label:this.getMessage("snkFilterParamConfig.labelType"),enabled:this.isEnabled(u.USER_CONFIG),suppressEmptyOption:!0,onEzChange:()=>this.buildFilterExpression()},this.getElementID("configParamType")),Object.keys(m).map((e=>i("option",{value:m[e]},this.getMessage(`snkFilterParamConfig.labelTypeValues.${e.toLowerCase()}`))))))),i("ez-text-area",Object.assign({ref:i=>this._expressionElement=i,class:"snk-filter-param-config__expression",label:this.getMessage("snkFilterParamConfig.labelExpression"),enabled:!1},this.getElementID("presentationExpression"))),i("div",{class:"ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small"},i("ez-button",Object.assign({class:"ez-padding-right--medium",label:this.getMessage("snkFilterParamConfig.labelCancel"),onClick:()=>this.close()},this.getElementID("cancelEditParam"))),i("ez-button",Object.assign({class:"ez-button--primary",label:this.getMessage("snkFilterParamConfig.labelSave"),onClick:()=>this.save(),enabled:this._canSave},this.getElementID("saveEditParam"))))))}get _element(){return s(this)}};y.style=":host{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";export{k as snk_filter_field_search,y as snk_filter_param_config}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,r as t,g as n}from"./p-
|
|
1
|
+
import{h as e,r as t,g as n}from"./p-82bb3eda.js";import{ElementIDUtils as o}from"@sankhyalabs/core";import{ModalAction as i}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";const s=({getMessage:t,changeInfo:n,data:i})=>{const{format:s,email:l}=i||{};return e("div",null,e("ez-text-input",Object.assign({label:`${t("snkExporter.emailSenderInfoStep_sendTo")} (obrigatório) *`,value:null==l?void 0:l.to,onEzChange:e=>{var t;return n("to",null===(t=e.detail)||void 0===t?void 0:t.trim())}},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("sendTo")}`})),e("ez-text-input",Object.assign({label:`${t("snkExporter.emailSenderInfoStep_subject")} (obrigatório) *`,value:null==l?void 0:l.subject,onEzChange:e=>{var t;return n("subject",null===(t=e.detail)||void 0===t?void 0:t.trim())}},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("subject")}`})),e("ez-text-area",Object.assign({label:t("snkExporter.emailSenderInfoStep_message"),value:null==l?void 0:l.message,onEzChange:e=>n("message",e.detail)},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("message")}`})),((null==l?void 0:l.attachments)||[]).map(((t,n)=>e("ez-file-item",Object.assign({class:"ez-padding-bottom--large",fileName:`${t.name}.${s}`,fileSize:t.size,canRemove:!1},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("fileItem_")+(n+1)}`})))))},l=({getMessage:t,changeInfo:n,data:i})=>{const s=(null==i?void 0:i.selectedRows)||0,l=[{label:t("snkExporter.emailSenderOptStep_formatPDF"),value:"pdf"},{label:t("snkExporter.emailSenderOptStep_formatXLS"),value:"xls"}],a=[{label:t("snkExporter.emailSenderOptStep_allData"),value:"all"},{label:t("snkExporter.emailSenderOptStep_currentPage"),value:"page"}];if(s>0){const e=t(s>1?"snkExporter.emailSenderOptStep_someRecords":"snkExporter.emailSenderOptStep_oneRecord",{SELECTION_COUNT:s});a.push({label:e,value:"selection"})}return e("div",null,e("ez-radio-button",Object.assign({class:"ez-margin-bottom--large"},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("formato")}`},{label:t("snkExporter.emailSenderOptStep_lblFormat"),direction:"horizontal",value:null==i?void 0:i.format,onEzChange:e=>n("format",e.detail),options:l})),e("ez-radio-button",Object.assign({class:"ez-margin-bottom--large"},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("type")}`},{label:t("snkExporter.emailSenderOptStep_export"),value:(null==i?void 0:i.type)||"all",onEzChange:e=>n("type",e.detail),options:a})))},a=class{constructor(e){t(this,e),this._stepInfo=[{subTitle:"snkExporter.emailSenderOptStep_subtitle",firstButton:"snkExporter.emailSenderCancelButton",secondButton:"snkExporter.emailSenderNextButton",firstButtonAction:()=>this.close(),secondButtonAction:()=>this.changeStep(1)},{subTitle:"snkExporter.emailSenderInfoStep_subtitle",firstButton:"snkExporter.emailSenderBackButton",secondButton:"snkExporter.emailSenderSendButton",firstButtonAction:()=>this.changeStep(0),secondButtonAction:()=>this.send(),secondButtonEnabledTester:()=>this.isFilled(),secondButtonClass:"ez-button--primary"}],this._config=void 0,this._opened=!1,this._currentStep=0,this.getMessage=void 0}open(e){var t;return this._config=Object.assign(Object.assign({},e),{format:null!==(t=null==e?void 0:e.format)&&void 0!==t?t:"pdf"}),this._opened=!0,this.changeStep(0),new Promise((e=>{this._promiseResolver=e}))}close(){return this._opened=!1,new Promise((e=>{this._promiseResolver=e}))}getStepMessage(e){return this.getMessage((this._stepInfo[this._currentStep]||{})[e])}executeButtonAction(e){(this._stepInfo[this._currentStep]||{})[e?"firstButtonAction":"secondButtonAction"]()}checkButtonEnabled(e){const t=(this._stepInfo[this._currentStep]||{})[e?"firstButtonEnabledTester":"secondButtonEnabledTester"];return!t||t()}changeStep(e){this._currentStep=e,this._viewStack&&this._viewStack.show(this._currentStep)}send(){const{format:e,type:t,email:n,resolver:o}=this._config;o({format:e,type:t,email:n,report:void 0})}isFilled(){var e,t;return!(!(null===(e=this._config.email)||void 0===e?void 0:e.to)||!(null===(t=this._config.email)||void 0===t?void 0:t.subject))}updateEmailInfo(e,t){this._config=Object.assign(Object.assign({},this._config),{email:Object.assign(Object.assign({},this._config.email),{[e]:t})})}updateConfigInfo(e,t){this._config=Object.assign(Object.assign({},this._config),{[e]:t})}getSecondButtonClass(){return(this._stepInfo[this._currentStep]||{}).secondButtonClass||"ez-button--secondary"}render(){return o.addIDInfoIfNotExists(this._element,"snkExporterEmailSender"),e("ez-popup",{useHeader:!1,size:"x-small",heightMode:"auto",opened:this._opened},e("ez-modal-container",{onEzModalAction:e=>{e.detail===i.CLOSE&&this.close()},modalTitle:this.getMessage("snkExporter.emailSenderTitle"),modalSubTitle:this.getStepMessage("subTitle")},e("ez-view-stack",{ref:e=>this._viewStack=e},e("stack-item",null,e(l,{getMessage:this.getMessage,data:this._config,changeInfo:(e,t)=>this.updateConfigInfo(e,t)})),e("stack-item",null,e(s,{getMessage:this.getMessage,data:this._config,changeInfo:(e,t)=>this.updateEmailInfo(e,t)}))),e("div",{class:"ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small"},e("ez-button",Object.assign({class:"ez-button--tertiary ez-padding-right--medium",label:this.getStepMessage("firstButton"),onClick:()=>this.executeButtonAction(!0),enabled:this.checkButtonEnabled(!0)},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("firstButton")}`})),e("ez-button",Object.assign({class:this.getSecondButtonClass(),label:this.getStepMessage("secondButton"),onClick:()=>this.executeButtonAction(!1),enabled:this.checkButtonEnabled(!1)},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("secondButton")}`})))))}get _element(){return n(this)}};export{a as snk_exporter_email_sender}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,c as t,h as e,F as s,g as r}from"./p-d8d8169b.js";import{ObjectUtils as n,StringUtils as a,Action as d,KeyboardManager as o,ElementIDUtils as h}from"@sankhyalabs/core";import{SelectionMode as l}from"@sankhyalabs/core/dist/dataunit/DataUnit";import{buildFieldSearch as u,SHORTCUT_SEARCH_FIELD as v}from"@sankhyalabs/ezui/dist/collection/utils";import{buildFormMetadata as c,FormMetadata as g}from"@sankhyalabs/ezui/dist/collection/utils/form";import"./p-1b1373b6.js";import"./p-3c046287.js";import{P as m}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-9ab6ae1e.js";import"./p-ff1990ad.js";import"./p-4db9dbf8.js";import{V as k}from"./p-9019a32f.js";import{S as f}from"./p-aca74b21.js";import{T as p}from"./p-b987e15d.js";import{T as w}from"./p-1a0caadb.js";const b="__FORM:",_=class{constructor(e){i(this,e),this.snkShowGuide=t(this,"snkShowGuide",7),this.snkMasterFormConfigChange=t(this,"snkMasterFormConfigChange",7),this.formConfigVisibilityChanged=t(this,"formConfigVisibilityChanged",7),this.exit=t(this,"exit",7),this.actionClick=t(this,"actionClick",7),this.formItemsReady=t(this,"formItemsReady",7),this._guideBuilders=new Map,this.dataUnit=void 0,this.dataState=void 0,this.configName=void 0,this.entityPath=void 0,this.actionsList=void 0,this.recordsValidator=void 0,this.masterFormConfig=void 0,this.selectedGuide=void 0,this.taskbarManager=void 0,this.messagesBuilder=void 0,this.canEdit=!0,this.presentationMode=void 0,this.resourceID=void 0,this.detailTaskbarCustomContainerId=void 0,this.formLegacyConfigName=void 0,this.enableGridInsert=!1,this.ignoreReadOnlyFormFields=void 0,this.getCustomTitle=void 0,this.customGuidesConfig=[],this._hasToCreateFieldSearch=!0,this._breadcrumbItems=[],this._guides=void 0,this._formEditorConfigManager=void 0,this._formEditorDataUnit=void 0,this._fieldToGetFocus=void 0,this._customEditors=void 0,this._customRenders=void 0,this._fieldsProps={},this._mainForm=void 0}observeDataUnit(){this.loadGuides(!0)}async observeFormConfigManager(i){const t=!!i;await this._viewStack.show(t?y.CONFIG:y.GUIDES),this.formConfigVisibilityChanged.emit(t)}observeDataState(i,t){var e,s,r,a,d,o;const h=null!==(s=null===(e=null==i?void 0:i.selectionInfo)||void 0===e?void 0:e.recordIds)&&void 0!==s?s:null===(r=null==i?void 0:i.selectedRecord)||void 0===r?void 0:r.__record__id__,l=null!==(d=null===(a=null==t?void 0:t.selectionInfo)||void 0===a?void 0:a.recordIds)&&void 0!==d?d:null===(o=null==t?void 0:t.selectedRecord)||void 0===o?void 0:o.__record__id__;n.equals(h,l)||this.loadGuides((null==t?void 0:t.insertionMode)!=(null==i?void 0:i.insertionMode))}observeMasterFormConfig(){this.loadGuides(this.noGuideSelected()),this.snkMasterFormConfigChange.emit(this.masterFormConfig)}async showFormConfig(i=!1){const t=!i||null==this._currentDetail;this._formEditorConfigManager=t?this._configManager:this._currentDetail.formConfigManager,this._formEditorDataUnit=t?this.dataUnit:this._currentDetail.dataUnit}async addCustomEditor(i,t){this._customEditors=Object.assign(Object.assign({},this._customEditors),{[i]:t})}async addGridCustomRender(i,t){this._customRenders=Object.assign(Object.assign({},this._customRenders),{[i]:t})}async setFieldProp(i,t,e){const s={[i]:Object.assign(Object.assign({},this._fieldsProps[i]),{[t]:e})};this._fieldsProps=Object.assign(Object.assign({},this._fieldsProps),s)}async setFocus(){var i;null===(i=this._container)||void 0===i||i.focus()}async reloadGuides(){this.loadGuides(!1)}exitViewer(){!this.enableGridInsert&&this.dataUnit.isDirty()?this.dataUnit.cancelEdition({after:()=>this.exit.emit()}):this.exit.emit()}onActionClick(i){i.detail===p.CONFIGURATOR&&"master"!=i.target.dataset.taskbarOwner&&(this._snkConfigurator.open(),i.stopImmediatePropagation(),i.stopPropagation())}onContentCardChanged(i){_.updateContentCard(i.detail.formName,i.detail.cardConfig,i.detail.propertyChanged,this._configManager).then((()=>this.masterFormConfig=this._configManager.getConfig(this.dataUnit)))}getMessage(i){var t,e;if(this.dataUnit.isMultipleEdition){const i=null!==(e=null===(t=this.dataUnit.getSelectionInfo())||void 0===t?void 0:t.records)&&void 0!==e?e:[];return this.messagesBuilder.getMessage("snkCrud.multipleEdition.editing",{COUNT:i.length})}return this.messagesBuilder.getMessage(i,this.dataUnit.getSelectedRecord())}loadGuides(i){if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this._masterFormMetadata=c(this.masterFormConfig,this.dataUnit,!0,this.customGuidesConfig);const t=this._masterFormMetadata.getAllSheets(),e=this.dataUnit.getSelectedRecord(),s=this.hasToDisableDetails(e),r=[];Array.from(t.values()).forEach((i=>{const t={id:i.name,label:i.label};this.isDetail(i.name)&&s&&(t.tooltip=this.getMessage("snkCrud.detail.tooltip.needSingleSelection"),t.disabled=!0),i.isCustom&&i.ctxProps&&Object.entries(i.ctxProps).forEach((([i,e])=>{void 0!==e&&(t[i]=e)})),r.push(t)})),this._guides=r,this._guideNavigator&&this._guideNavigator.updateItem(this._guides),i&&(this.selectedGuide=this._guides.length>0?this._guides[0]:void 0)}hasToDisableDetails(i){return!i||this.dataUnit.isNewRecord(i.__record__id__)||this.dataUnit.isMultipleEdition}isDetail(i){return null!=g.getDetailName(i)}updateGuide(i){this._guideBuilders.set(i.id,i);const t=i.buildGuideItem(this._guideBuilders);this._guideNavigator&&(this._guideNavigator.updateItem(t).then((()=>{this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))})),this._guides=this._guides.map((i=>i.id===t.id?Object.assign(Object.assign(Object.assign({},i),t),void 0!==t.children?{}:{children:void 0}):i)))}getTaskBarId(){var i;return(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?C.FINISH_EDITION:this.dataUnit.isMultipleEdition?C.MUTIPLE_EDITION:C.REGULAR}loadTaskbarProcessor(){const i={};i[C.REGULAR]=this.buildBtnsRegularMode(),i[C.FINISH_EDITION]=[p.CANCEL,p.SAVE,this.handleAddGridMode()],i[C.MUTIPLE_EDITION]=[p.CANCEL],this._taskbarProcessor=new w(i),this._taskbarProcessor.process(this.getTaskBarId(),this.taskbarManager,this.dataState,this.buildDisabledButtons(),this.buildInvisibleButtons())}buildBtnsRegularMode(){var i,t;const e=[p.ATTACH,p.CLONE,p.REMOVE,p.MORE_OPTIONS,p.ACTIONS_BUTTON,p.DIVIDER,p.GRID_MODE,p.CONFIGURATOR];return(null===(t=null===(i=this.dataState)||void 0===i?void 0:i.selectionInfo)||void 0===t?void 0:t.length)<=1&&e.unshift(p.PREVIOUS,p.NEXT,p.DIVIDER),this.presentationMode==m.SECONDARY?e.unshift(p.INSERT):e.push(p.INSERT),e}buildDisabledButtons(){var i,t,e,s,r,n;const a=[];return(null===(i=this.dataState)||void 0===i?void 0:i.hasPrevious)||a.push(p.PREVIOUS),(null===(t=this.dataState)||void 0===t?void 0:t.hasNext)||a.push(p.NEXT),(null===(s=null===(e=this.dataState)||void 0===e?void 0:e.selectionInfo)||void 0===s?void 0:s.length)>1&&a.push(p.CLONE),(null===(n=null===(r=this.dataState)||void 0===r?void 0:r.selectionInfo)||void 0===n?void 0:n.isAllRecords())&&a.push(p.REMOVE),a}handleAddGridMode(){return this.enableGridInsert?p.GRID_MODE:""}buildInvisibleButtons(){const i=[];return this.dataState&&this.dataState.selectionInfo.mode===l.ALL_RECORDS&&i.push(p.ACTIONS_BUTTON),i}static updateContentCard(i,t,e,s){return s.saveCardState(i,t,e)}static buildFixedForms(i){var t;const r=null===(t=i.formConfig)||void 0===t?void 0:t.cardsState;if(null!=r)return e(s,null,Array.from(r.entries()).filter((([t,e])=>(null==e?void 0:e.fixed)&&t!=i.selectedForm)).sort((([,i],[,t])=>((null==i?void 0:i.fixSequence)||0)-((null==t?void 0:t.fixSequence)||0))).map((([t,s])=>{var r,n;const a=i.formMetadata.getSheet(t);if(null!=a)return e("snk-form-view",{levelPath:i.levelPath,label:a.label,name:t,fields:a.fields,formMetadata:i.formMetadata,dataUnit:i.dataUnit,recordsValidator:i.recordsValidator,contracted:"CONTRACTED"===(null==s?void 0:s.presentation),fixed:null==s?void 0:s.fixed,summaryFields:null===(n=null===(r=i.formConfig)||void 0===r?void 0:r.summary)||void 0===n?void 0:n.get(t),fieldToFocus:i.fieldToFocus,key:t,onSnkRequestClearFieldToFocus:()=>{var t;return null===(t=i.onRequestClearFieldToFocus)||void 0===t?void 0:t.call(i)},customEditors:i.propsCustomEditor,fieldsProps:i.fieldsProps})})))}wrapDetail(i,t){if(0===i.length)return t;const s=i.pop(),r=g.getDetailName(s);return r?this.wrapDetail(i,e("snk-data-unit",{dataUnitName:`${this.getDataUnitName(i,r)}`,entityName:r},t)):void 0}getDataUnitName(i,t){if(i.length>0){const e=i.map((i=>g.getDetailName(i)));return`${this.entityPath}/${e.join("/")}/${t}`}return`${this.entityPath}/${t}`}getContent(){if(!this.selectedGuide)return void this.snkShowGuide.emit(void 0);const i=this.selectedGuide.id;if(this.snkShowGuide.emit(i),this.isCustomGuide(i))return e("slot",{name:i});const t=i.split("::"),s=t.pop(),r=g.getDetailName(s);let n=i;return this.isDetailGuide(r,t)?this.buildDetailGuideContent(i,n,t,r):this.buildFormViewGuideContent(i)}buildFormViewGuideContent(i){var t,s,r,n;const a=this._masterFormMetadata.getSheet(i);if(!a)return;const d=null===(s=null===(t=this.masterFormConfig)||void 0===t?void 0:t.cardsState)||void 0===s?void 0:s.get(i);return e("snk-form-view",{ref:i=>this._mainForm=i,fixed:null==d?void 0:d.fixed,summaryFields:null===(n=null===(r=this.masterFormConfig)||void 0===r?void 0:r.summary)||void 0===n?void 0:n.get(i),name:i,label:a.label,fields:a.fields,dataUnit:this.dataUnit,formMetadata:this._masterFormMetadata,recordsValidator:this.recordsValidator,fieldToFocus:this._fieldToGetFocus,key:i,onSnkRequestClearFieldToFocus:()=>this.clearFieldToFocusHandler(),customEditors:this._customEditors,fieldsProps:this._fieldsProps,fieldSearch:this._fieldSearch},this.presentationMode==m.SECONDARY&&this.buildTaskBar())}isDetailGuide(i,t){return i||t.length>0}buildDetailGuideContent(i,t,s,r){var n;let a,d;if(i.includes(b)){[t,a]=i.split(b);const e=(null===(n=this._breadcrumbItems)||void 0===n?void 0:n.length)||0;d=e>1?this._breadcrumbItems[e-2]:this.selectedGuide}else d=this.selectedGuide;return this.wrapDetail(s,e("snk-detail-view",{ref:i=>this._currentDetail=i,dataUnitName:this.getDataUnitName(s,r),onSnkDetailGuidesChange:i=>this.updateGuide(i.detail),entityName:r,selectedForm:a,branchGuide:d,guideItemPath:this._breadcrumbItems,key:`detail${t}`,canEdit:this.canEdit,onSnkSwitchGuide:i=>this._guideNavigator.selectGuide(i.detail),resourceID:this.resourceID,taskbarCustomContainerId:this.detailTaskbarCustomContainerId,customEditors:this._customEditors,customRenders:this._customRenders,presentationMode:this.presentationMode}))}isCustomGuide(i){var t;return null===(t=this.customGuidesConfig)||void 0===t?void 0:t.map((i=>i.id)).includes(i)}onBreadcrumbClickHandler(i){null!=(null==i?void 0:i.id)&&this._guideNavigator.selectGuide(i.id)}updateSelectedGuideHandler(i){this._guideHasChanged=this.selectedGuide!=i,this.selectedGuide=i,this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i})),this.resetGuideBadge(i)}changeGuideHandler(i){var t;null===(t=this._guideNavigator)||void 0===t||t.selectGuide(i)}clearFieldToFocusHandler(){this._fieldToGetFocus=void 0}resetGuideBadge(i){var t;this._guides=[...null===(t=this._guides)||void 0===t?void 0:t.map((t=>this.canClearGuideBadge(t,i.id)?Object.assign(Object.assign({},t),{badge:null}):t))]}canClearGuideBadge(i,t){return i.id===t||this.isIncludedInChildrenList(i,t)}isIncludedInChildrenList(i,t){return this.hasChildren(i)&&this.getChildrenIdList(i).includes(t)}hasChildren(i){return i.children&&Array.isArray(i.children)}getChildrenIdList(i){return i.children.map((i=>i.id))}getConfigViewMode(){return k.GRID}changeConfigViewMode(i){this._currentDetail&&this._currentDetail.changeViewMode(i)}openConfig(i){this._snkConfigurator.close(),this._currentDetail&&(i===k.FORM?this.showFormConfig(!0):this._currentDetail.configGrid())}noGuideSelected(){var i;return void 0===this.selectedGuide||"__main"===(null===(i=this.selectedGuide)||void 0===i?void 0:i.id)}addFormLegacyConfigName(){this.formLegacyConfigName&&this._configManager.addFormLegacyConfig(this.formLegacyConfigName)}setMasterFormConfig(i){this.masterFormConfig=i}componentWillLoad(){if(null==this.resourceID)throw new Error(this.getMessage("snkCrud.errors.resourceIDNotProvided"));this._configManager=new f(this.configName,this.resourceID,this.setMasterFormConfig.bind(this),this.dataUnit),this.addFormLegacyConfigName(),this._configManager.loadConfig()}componentDidRender(){this._guideHasChanged&&(this._currentDetail?this._currentDetail.showUp():this._mainForm&&this._mainForm.showUp(),this._guideHasChanged=!1)}getFieldsSearch(i){return(null==this._fieldSearch||this._hasToCreateFieldSearch)&&(this._hasToCreateFieldSearch=!1,this._fieldSearch=u(i,(({argument:i})=>this.fieldsOptionLoader(i)),(i=>this.onSelectField(i)))),this._fieldSearch}fieldsOptionLoader(i){return Promise.resolve(this._configManager.getFieldsList(i).map((i=>({value:i.name,label:i.label}))))}onSelectField(i){if(null==i)return;this._fieldToGetFocus=i.value;const t=this.getGuideName(i.value);t!==this.selectedGuide.id&&this.changeGuideHandler(t)}getActionsList(){var i;return[].concat(null!=this.taskbarManager&&null!=this.taskbarManager.getMoreOptions?null!==(i=this.taskbarManager.getMoreOptions(this.getTaskBarId(),this.configName,this.dataState,this.actionsList))&&void 0!==i?i:[]:this.actionsList)}getSettingsListForm(){return[{value:a.generateUUID(),label:this.getMessage("snkCrud.findColumn"),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,t)=>this.getFieldsSearch(t)}]}buildTaskBar(){var i;return e("div",{class:"snk-guides-viewer__header-taskbar "+(this.presentationMode!=m.SECONDARY?"ez-align--right":"ez-padding-bottom--medium")},e("snk-taskbar",{key:"guideViewerTaskbar","data-element-id":"guideViewer",configName:this.configName,buttons:this._taskbarProcessor.buttons,disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,actionsList:this.getActionsList(),actionsSettingsList:this.getSettingsListForm(),messagesBuilder:this.messagesBuilder,presentationMode:this.presentationMode,primaryButton:(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?p.SAVE:p.INSERT,"data-taskbar-owner":"master",dataUnit:this.dataUnit,resourceID:this.resourceID,customSlotId:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS",additionalSlotId:"GUIDES_VIEWER_DYNAMIC_SEARCH",alignRigth:!0},e("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"}),e("slot",{name:"GUIDES_VIEWER_DYNAMIC_SEARCH"})))}async dataUnitActionHandler(i){var t;switch(i.type){case d.EDITION_CANCELED:case d.DATA_SAVED:this.dataUnit.isMultipleEdition&&(this.exitViewer(),this.dataUnit.isMultipleEdition=!1);break;case d.FIELD_INVALIDATED:const e=this.getGuideName(null===(t=i.payload)||void 0===t?void 0:t.fieldName);await this.addErrorBadgeToGuide(e),await this.openGuideNavigator(e);break;case d.METADATA_LOADED:case d.MULTIPLE_EDITION_CHANGED:this.loadGuides(this.noGuideSelected())}}async addErrorBadgeToGuide(i){var t;this._guides=[...null===(t=this._guides)||void 0===t?void 0:t.map((t=>Object.assign(Object.assign({},t),{badge:this.getBadge(t,i)})))]}async openGuideNavigator(i){this.selectedGuide.id!==i&&await this._guideNavigator.openGuideNavidator()}getBadge(i,t){var e;return this.selectedGuide.id===t?null:t===i.id?"error":null!==(e=i.badge)&&void 0!==e?e:null}getGuideName(i){var t;for(const e of this._masterFormMetadata.getAllSheets()){const s=null===(t=e[1])||void 0===t?void 0:t.fields;for(const t of s)if(t.name===i)return e[0]}return""}getTitle(){var i,t;return null!==(t=null===(i=this.getCustomTitle)||void 0===i?void 0:i.call(this))&&void 0!==t?t:this.getMessage("snkCrud.title")}getTitleTooltip(){if(this.dataUnit.isMultipleEdition)return this.buildRecordIdsArray()}buildRecordIdsArray(){var i,t;const e=null!==(t=null===(i=this.dataUnit.getSelectionInfo())||void 0===i?void 0:i.records)&&void 0!==t?t:[];return 0===e.length?"[]":`[${e.map((i=>this.messagesBuilder.getMessage("snkCrud.title",i))).join(", ")}]`}getCustomGuidesConfig(){return this._currentDetail?[]:this.customGuidesConfig}componentDidLoad(){this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this)),this.initKeyboardManager()}disconnectedCallback(){var i;null===(i=this._keyboardManager)||void 0===i||i.unbindAllShortcutKeys()}async initKeyboardManager(){this._keyboardManager=new o({propagate:!1,element:this._element}),this._keyboardManager.bind(v,(async()=>{this._mainForm&&await this._mainForm.showSearchField()}),{description:this.getMessage("snkSimpleCrud.findFields"),element:this._element})}renderFormConfig(){if(null!=this._formEditorConfigManager)return e("snk-form-config",{ref:i=>this._container=i,tabindex:-1,dataUnit:this._formEditorDataUnit,messagesBuilder:this.messagesBuilder,configManager:this._formEditorConfigManager,onConfigClose:()=>this._formEditorConfigManager=null,customGuidesConfig:this.getCustomGuidesConfig()})}renderGuidesNavigator(i){var t,s;return e("section",{class:"snk-guides-viewer",ref:i=>this._container=i,tabIndex:-1},e("div",{class:"ez-row snk-guides-viewer__header"},e("div",{class:"snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large",key:"header"},e("ez-button",{onClick:()=>this.exitViewer(),title:this.getMessage("snkCrud.goBackTitle"),mode:"icon",iconName:"arrow_back",class:"ez-padding-right--medium",size:"small"}),e("div",{class:"ez-flex ez-flex--column ez-flex-item--auto"},e("h1",{class:"ez-title ez-title--primary ez-title--xlarge",title:this.getTitleTooltip()},this.getTitle()),(null===(t=this._breadcrumbItems)||void 0===t?void 0:t.length)>1&&e("div",{class:"ez-margin-top--extra-small"},e("ez-breadcrumb",Object.assign({items:this._breadcrumbItems,onSelectedItem:i=>this.onBreadcrumbClickHandler(null==i?void 0:i.detail)},{[h.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${h.getInternalIDInfo("breadcrumb")}`}))))),this.presentationMode!=m.SECONDARY&&this.buildTaskBar()),e("div",{class:"snk-guides-viewer__container"},i?e("ez-guide-navigator",{ref:i=>this._guideNavigator=i,class:"snk-guides-viewer__guide-navigator",items:this._guides,selectedId:this.selectedGuide?this.selectedGuide.id:void 0,onEzSelectionChange:i=>this.updateSelectedGuideHandler(i.detail)}):e("div",null),e("div",{class:"snk-guides-viewer__detail-container"},_.buildFixedForms({formConfig:this.masterFormConfig,formMetadata:this._masterFormMetadata,selectedForm:null===(s=this.selectedGuide)||void 0===s?void 0:s.id,dataUnit:this.dataUnit,recordsValidator:this.recordsValidator,fieldToFocus:this._fieldToGetFocus,onRequestClearFieldToFocus:this.clearFieldToFocusHandler.bind(this),propsCustomEditor:this._customEditors,fieldsProps:this._fieldsProps}),this.getContent())),e("snk-configurator",{ref:i=>this._snkConfigurator=i,viewMode:this.getConfigViewMode(),onConfigSelected:i=>this.changeConfigViewMode(i.detail),messagesBuilder:this.messagesBuilder,onOpenConfig:i=>this.openConfig(i.detail),resourceID:this.resourceID}))}render(){if(this.dataUnit&&this._configManager.isLoaded)return this.loadTaskbarProcessor(),e("ez-view-stack",{ref:i=>this._viewStack=i,"data-element-id":"guides-viewer-stack"},e("stack-item",null,this.renderGuidesNavigator(this._guides&&this._guides.length>1)),e("stack-item",null,this.renderFormConfig()))}get _element(){return r(this)}static get watchers(){return{dataUnit:["observeDataUnit"],_formEditorConfigManager:["observeFormConfigManager"],dataState:["observeDataState"],masterFormConfig:["observeMasterFormConfig"]}}};var C,y;!function(i){i.FINISH_EDITION="snkGuideViewer.finish_edition",i.MUTIPLE_EDITION="snkGuideViewer.multiple_edition",i.REGULAR="snkGuideViewer.regular"}(C||(C={})),function(i){i[i.GUIDES=0]="GUIDES",i[i.CONFIG=1]="CONFIG"}(y||(y={})),_.style=".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-small:var(--space--2xs, 8px);--snk-guides-viewer__header--min-height:68px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-small);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-small)}.snk-guides-viewer__header-breadcrumb.sc-snk-guides-viewer{width:25%;display:flex}.snk-guides-viewer__header-taskbar.sc-snk-guides-viewer{width:75%}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-small));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-small))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";export{_ as S}
|
|
1
|
+
import{r as i,c as t,h as e,F as s,g as r}from"./p-82bb3eda.js";import{ObjectUtils as n,StringUtils as a,Action as d,KeyboardManager as o,ElementIDUtils as h}from"@sankhyalabs/core";import{SelectionMode as l}from"@sankhyalabs/core/dist/dataunit/DataUnit";import{buildFieldSearch as u,SHORTCUT_SEARCH_FIELD as v}from"@sankhyalabs/ezui/dist/collection/utils";import{buildFormMetadata as c,FormMetadata as g}from"@sankhyalabs/ezui/dist/collection/utils/form";import"./p-6768f176.js";import"./p-48a5c311.js";import{P as m}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-9e4555ab.js";import"./p-ff1990ad.js";import"./p-7ee6b1bf.js";import{V as k}from"./p-9019a32f.js";import{S as f}from"./p-2ac55a5d.js";import{T as p}from"./p-1be69fd4.js";import{T as w}from"./p-1a0caadb.js";const b="__FORM:",_=class{constructor(e){i(this,e),this.snkShowGuide=t(this,"snkShowGuide",7),this.snkMasterFormConfigChange=t(this,"snkMasterFormConfigChange",7),this.formConfigVisibilityChanged=t(this,"formConfigVisibilityChanged",7),this.exit=t(this,"exit",7),this.actionClick=t(this,"actionClick",7),this.formItemsReady=t(this,"formItemsReady",7),this._guideBuilders=new Map,this.dataUnit=void 0,this.dataState=void 0,this.configName=void 0,this.entityPath=void 0,this.actionsList=void 0,this.recordsValidator=void 0,this.masterFormConfig=void 0,this.selectedGuide=void 0,this.taskbarManager=void 0,this.messagesBuilder=void 0,this.canEdit=!0,this.presentationMode=void 0,this.resourceID=void 0,this.detailTaskbarCustomContainerId=void 0,this.formLegacyConfigName=void 0,this.enableGridInsert=!1,this.ignoreReadOnlyFormFields=void 0,this.getCustomTitle=void 0,this.customGuidesConfig=[],this._hasToCreateFieldSearch=!0,this._breadcrumbItems=[],this._guides=void 0,this._formEditorConfigManager=void 0,this._formEditorDataUnit=void 0,this._fieldToGetFocus=void 0,this._customEditors=void 0,this._customRenders=void 0,this._fieldsProps={},this._mainForm=void 0}observeDataUnit(){this.loadGuides(!0)}async observeFormConfigManager(i){const t=!!i;await this._viewStack.show(t?y.CONFIG:y.GUIDES),this.formConfigVisibilityChanged.emit(t)}observeDataState(i,t){var e,s,r,a,d,o;const h=null!==(s=null===(e=null==i?void 0:i.selectionInfo)||void 0===e?void 0:e.recordIds)&&void 0!==s?s:null===(r=null==i?void 0:i.selectedRecord)||void 0===r?void 0:r.__record__id__,l=null!==(d=null===(a=null==t?void 0:t.selectionInfo)||void 0===a?void 0:a.recordIds)&&void 0!==d?d:null===(o=null==t?void 0:t.selectedRecord)||void 0===o?void 0:o.__record__id__;n.equals(h,l)||this.loadGuides((null==t?void 0:t.insertionMode)!=(null==i?void 0:i.insertionMode))}observeMasterFormConfig(){this.loadGuides(this.noGuideSelected()),this.snkMasterFormConfigChange.emit(this.masterFormConfig)}async showFormConfig(i=!1){const t=!i||null==this._currentDetail;this._formEditorConfigManager=t?this._configManager:this._currentDetail.formConfigManager,this._formEditorDataUnit=t?this.dataUnit:this._currentDetail.dataUnit}async addCustomEditor(i,t){this._customEditors=Object.assign(Object.assign({},this._customEditors),{[i]:t})}async addGridCustomRender(i,t){this._customRenders=Object.assign(Object.assign({},this._customRenders),{[i]:t})}async setFieldProp(i,t,e){const s={[i]:Object.assign(Object.assign({},this._fieldsProps[i]),{[t]:e})};this._fieldsProps=Object.assign(Object.assign({},this._fieldsProps),s)}async setFocus(){var i;null===(i=this._container)||void 0===i||i.focus()}async reloadGuides(){this.loadGuides(!1)}exitViewer(){!this.enableGridInsert&&this.dataUnit.isDirty()?this.dataUnit.cancelEdition({after:()=>this.exit.emit()}):this.exit.emit()}onActionClick(i){i.detail===p.CONFIGURATOR&&"master"!=i.target.dataset.taskbarOwner&&(this._snkConfigurator.open(),i.stopImmediatePropagation(),i.stopPropagation())}onContentCardChanged(i){_.updateContentCard(i.detail.formName,i.detail.cardConfig,i.detail.propertyChanged,this._configManager).then((()=>this.masterFormConfig=this._configManager.getConfig(this.dataUnit)))}getMessage(i){var t,e;if(this.dataUnit.isMultipleEdition){const i=null!==(e=null===(t=this.dataUnit.getSelectionInfo())||void 0===t?void 0:t.records)&&void 0!==e?e:[];return this.messagesBuilder.getMessage("snkCrud.multipleEdition.editing",{COUNT:i.length})}return this.messagesBuilder.getMessage(i,this.dataUnit.getSelectedRecord())}loadGuides(i){if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this._masterFormMetadata=c(this.masterFormConfig,this.dataUnit,!0,this.customGuidesConfig);const t=this._masterFormMetadata.getAllSheets(),e=this.dataUnit.getSelectedRecord(),s=this.hasToDisableDetails(e),r=[];Array.from(t.values()).forEach((i=>{const t={id:i.name,label:i.label};this.isDetail(i.name)&&s&&(t.tooltip=this.getMessage("snkCrud.detail.tooltip.needSingleSelection"),t.disabled=!0),i.isCustom&&i.ctxProps&&Object.entries(i.ctxProps).forEach((([i,e])=>{void 0!==e&&(t[i]=e)})),r.push(t)})),this._guides=r,this._guideNavigator&&this._guideNavigator.updateItem(this._guides),i&&(this.selectedGuide=this._guides.length>0?this._guides[0]:void 0)}hasToDisableDetails(i){return!i||this.dataUnit.isNewRecord(i.__record__id__)||this.dataUnit.isMultipleEdition}isDetail(i){return null!=g.getDetailName(i)}updateGuide(i){this._guideBuilders.set(i.id,i);const t=i.buildGuideItem(this._guideBuilders);this._guideNavigator&&(this._guideNavigator.updateItem(t).then((()=>{this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))})),this._guides=this._guides.map((i=>i.id===t.id?Object.assign(Object.assign(Object.assign({},i),t),void 0!==t.children?{}:{children:void 0}):i)))}getTaskBarId(){var i;return(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?C.FINISH_EDITION:this.dataUnit.isMultipleEdition?C.MUTIPLE_EDITION:C.REGULAR}loadTaskbarProcessor(){const i={};i[C.REGULAR]=this.buildBtnsRegularMode(),i[C.FINISH_EDITION]=[p.CANCEL,p.SAVE,this.handleAddGridMode()],i[C.MUTIPLE_EDITION]=[p.CANCEL],this._taskbarProcessor=new w(i),this._taskbarProcessor.process(this.getTaskBarId(),this.taskbarManager,this.dataState,this.buildDisabledButtons(),this.buildInvisibleButtons())}buildBtnsRegularMode(){var i,t;const e=[p.ATTACH,p.CLONE,p.REMOVE,p.MORE_OPTIONS,p.ACTIONS_BUTTON,p.DIVIDER,p.GRID_MODE,p.CONFIGURATOR];return(null===(t=null===(i=this.dataState)||void 0===i?void 0:i.selectionInfo)||void 0===t?void 0:t.length)<=1&&e.unshift(p.PREVIOUS,p.NEXT,p.DIVIDER),this.presentationMode==m.SECONDARY?e.unshift(p.INSERT):e.push(p.INSERT),e}buildDisabledButtons(){var i,t,e,s,r,n;const a=[];return(null===(i=this.dataState)||void 0===i?void 0:i.hasPrevious)||a.push(p.PREVIOUS),(null===(t=this.dataState)||void 0===t?void 0:t.hasNext)||a.push(p.NEXT),(null===(s=null===(e=this.dataState)||void 0===e?void 0:e.selectionInfo)||void 0===s?void 0:s.length)>1&&a.push(p.CLONE),(null===(n=null===(r=this.dataState)||void 0===r?void 0:r.selectionInfo)||void 0===n?void 0:n.isAllRecords())&&a.push(p.REMOVE),a}handleAddGridMode(){return this.enableGridInsert?p.GRID_MODE:""}buildInvisibleButtons(){const i=[];return this.dataState&&this.dataState.selectionInfo.mode===l.ALL_RECORDS&&i.push(p.ACTIONS_BUTTON),i}static updateContentCard(i,t,e,s){return s.saveCardState(i,t,e)}static buildFixedForms(i){var t;const r=null===(t=i.formConfig)||void 0===t?void 0:t.cardsState;if(null!=r)return e(s,null,Array.from(r.entries()).filter((([t,e])=>(null==e?void 0:e.fixed)&&t!=i.selectedForm)).sort((([,i],[,t])=>((null==i?void 0:i.fixSequence)||0)-((null==t?void 0:t.fixSequence)||0))).map((([t,s])=>{var r,n;const a=i.formMetadata.getSheet(t);if(null!=a)return e("snk-form-view",{levelPath:i.levelPath,label:a.label,name:t,fields:a.fields,formMetadata:i.formMetadata,dataUnit:i.dataUnit,recordsValidator:i.recordsValidator,contracted:"CONTRACTED"===(null==s?void 0:s.presentation),fixed:null==s?void 0:s.fixed,summaryFields:null===(n=null===(r=i.formConfig)||void 0===r?void 0:r.summary)||void 0===n?void 0:n.get(t),fieldToFocus:i.fieldToFocus,key:t,onSnkRequestClearFieldToFocus:()=>{var t;return null===(t=i.onRequestClearFieldToFocus)||void 0===t?void 0:t.call(i)},customEditors:i.propsCustomEditor,fieldsProps:i.fieldsProps})})))}wrapDetail(i,t){if(0===i.length)return t;const s=i.pop(),r=g.getDetailName(s);return r?this.wrapDetail(i,e("snk-data-unit",{dataUnitName:`${this.getDataUnitName(i,r)}`,entityName:r},t)):void 0}getDataUnitName(i,t){if(i.length>0){const e=i.map((i=>g.getDetailName(i)));return`${this.entityPath}/${e.join("/")}/${t}`}return`${this.entityPath}/${t}`}getContent(){if(!this.selectedGuide)return void this.snkShowGuide.emit(void 0);const i=this.selectedGuide.id;if(this.snkShowGuide.emit(i),this.isCustomGuide(i))return e("slot",{name:i});const t=i.split("::"),s=t.pop(),r=g.getDetailName(s);let n=i;return this.isDetailGuide(r,t)?this.buildDetailGuideContent(i,n,t,r):this.buildFormViewGuideContent(i)}buildFormViewGuideContent(i){var t,s,r,n;const a=this._masterFormMetadata.getSheet(i);if(!a)return;const d=null===(s=null===(t=this.masterFormConfig)||void 0===t?void 0:t.cardsState)||void 0===s?void 0:s.get(i);return e("snk-form-view",{ref:i=>this._mainForm=i,fixed:null==d?void 0:d.fixed,summaryFields:null===(n=null===(r=this.masterFormConfig)||void 0===r?void 0:r.summary)||void 0===n?void 0:n.get(i),name:i,label:a.label,fields:a.fields,dataUnit:this.dataUnit,formMetadata:this._masterFormMetadata,recordsValidator:this.recordsValidator,fieldToFocus:this._fieldToGetFocus,key:i,onSnkRequestClearFieldToFocus:()=>this.clearFieldToFocusHandler(),customEditors:this._customEditors,fieldsProps:this._fieldsProps,fieldSearch:this._fieldSearch},this.presentationMode==m.SECONDARY&&this.buildTaskBar())}isDetailGuide(i,t){return i||t.length>0}buildDetailGuideContent(i,t,s,r){var n;let a,d;if(i.includes(b)){[t,a]=i.split(b);const e=(null===(n=this._breadcrumbItems)||void 0===n?void 0:n.length)||0;d=e>1?this._breadcrumbItems[e-2]:this.selectedGuide}else d=this.selectedGuide;return this.wrapDetail(s,e("snk-detail-view",{ref:i=>this._currentDetail=i,dataUnitName:this.getDataUnitName(s,r),onSnkDetailGuidesChange:i=>this.updateGuide(i.detail),entityName:r,selectedForm:a,branchGuide:d,guideItemPath:this._breadcrumbItems,key:`detail${t}`,canEdit:this.canEdit,onSnkSwitchGuide:i=>this._guideNavigator.selectGuide(i.detail),resourceID:this.resourceID,taskbarCustomContainerId:this.detailTaskbarCustomContainerId,customEditors:this._customEditors,customRenders:this._customRenders,presentationMode:this.presentationMode}))}isCustomGuide(i){var t;return null===(t=this.customGuidesConfig)||void 0===t?void 0:t.map((i=>i.id)).includes(i)}onBreadcrumbClickHandler(i){null!=(null==i?void 0:i.id)&&this._guideNavigator.selectGuide(i.id)}updateSelectedGuideHandler(i){this._guideHasChanged=this.selectedGuide!=i,this.selectedGuide=i,this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i})),this.resetGuideBadge(i)}changeGuideHandler(i){var t;null===(t=this._guideNavigator)||void 0===t||t.selectGuide(i)}clearFieldToFocusHandler(){this._fieldToGetFocus=void 0}resetGuideBadge(i){var t;this._guides=[...null===(t=this._guides)||void 0===t?void 0:t.map((t=>this.canClearGuideBadge(t,i.id)?Object.assign(Object.assign({},t),{badge:null}):t))]}canClearGuideBadge(i,t){return i.id===t||this.isIncludedInChildrenList(i,t)}isIncludedInChildrenList(i,t){return this.hasChildren(i)&&this.getChildrenIdList(i).includes(t)}hasChildren(i){return i.children&&Array.isArray(i.children)}getChildrenIdList(i){return i.children.map((i=>i.id))}getConfigViewMode(){return k.GRID}changeConfigViewMode(i){this._currentDetail&&this._currentDetail.changeViewMode(i)}openConfig(i){this._snkConfigurator.close(),this._currentDetail&&(i===k.FORM?this.showFormConfig(!0):this._currentDetail.configGrid())}noGuideSelected(){var i;return void 0===this.selectedGuide||"__main"===(null===(i=this.selectedGuide)||void 0===i?void 0:i.id)}addFormLegacyConfigName(){this.formLegacyConfigName&&this._configManager.addFormLegacyConfig(this.formLegacyConfigName)}setMasterFormConfig(i){this.masterFormConfig=i}componentWillLoad(){if(null==this.resourceID)throw new Error(this.getMessage("snkCrud.errors.resourceIDNotProvided"));this._configManager=new f(this.configName,this.resourceID,this.setMasterFormConfig.bind(this),this.dataUnit),this.addFormLegacyConfigName(),this._configManager.loadConfig()}componentDidRender(){this._guideHasChanged&&(this._currentDetail?this._currentDetail.showUp():this._mainForm&&this._mainForm.showUp(),this._guideHasChanged=!1)}getFieldsSearch(i){return(null==this._fieldSearch||this._hasToCreateFieldSearch)&&(this._hasToCreateFieldSearch=!1,this._fieldSearch=u(i,(({argument:i})=>this.fieldsOptionLoader(i)),(i=>this.onSelectField(i)))),this._fieldSearch}fieldsOptionLoader(i){return Promise.resolve(this._configManager.getFieldsList(i).map((i=>({value:i.name,label:i.label}))))}onSelectField(i){if(null==i)return;this._fieldToGetFocus=i.value;const t=this.getGuideName(i.value);t!==this.selectedGuide.id&&this.changeGuideHandler(t)}getActionsList(){var i;return[].concat(null!=this.taskbarManager&&null!=this.taskbarManager.getMoreOptions?null!==(i=this.taskbarManager.getMoreOptions(this.getTaskBarId(),this.configName,this.dataState,this.actionsList))&&void 0!==i?i:[]:this.actionsList)}getSettingsListForm(){return[{value:a.generateUUID(),label:this.getMessage("snkCrud.findColumn"),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,t)=>this.getFieldsSearch(t)}]}buildTaskBar(){var i;return e("div",{class:"snk-guides-viewer__header-taskbar "+(this.presentationMode!=m.SECONDARY?"ez-align--right":"ez-padding-bottom--medium")},e("snk-taskbar",{key:"guideViewerTaskbar","data-element-id":"guideViewer",configName:this.configName,buttons:this._taskbarProcessor.buttons,disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,actionsList:this.getActionsList(),actionsSettingsList:this.getSettingsListForm(),messagesBuilder:this.messagesBuilder,presentationMode:this.presentationMode,primaryButton:(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?p.SAVE:p.INSERT,"data-taskbar-owner":"master",dataUnit:this.dataUnit,resourceID:this.resourceID,customSlotId:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS",additionalSlotId:"GUIDES_VIEWER_DYNAMIC_SEARCH",alignRigth:!0},e("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"}),e("slot",{name:"GUIDES_VIEWER_DYNAMIC_SEARCH"})))}async dataUnitActionHandler(i){var t;switch(i.type){case d.EDITION_CANCELED:case d.DATA_SAVED:this.dataUnit.isMultipleEdition&&(this.exitViewer(),this.dataUnit.isMultipleEdition=!1);break;case d.FIELD_INVALIDATED:const e=this.getGuideName(null===(t=i.payload)||void 0===t?void 0:t.fieldName);await this.addErrorBadgeToGuide(e),await this.openGuideNavigator(e);break;case d.METADATA_LOADED:case d.MULTIPLE_EDITION_CHANGED:this.loadGuides(this.noGuideSelected())}}async addErrorBadgeToGuide(i){var t;this._guides=[...null===(t=this._guides)||void 0===t?void 0:t.map((t=>Object.assign(Object.assign({},t),{badge:this.getBadge(t,i)})))]}async openGuideNavigator(i){this.selectedGuide.id!==i&&await this._guideNavigator.openGuideNavidator()}getBadge(i,t){var e;return this.selectedGuide.id===t?null:t===i.id?"error":null!==(e=i.badge)&&void 0!==e?e:null}getGuideName(i){var t;for(const e of this._masterFormMetadata.getAllSheets()){const s=null===(t=e[1])||void 0===t?void 0:t.fields;for(const t of s)if(t.name===i)return e[0]}return""}getTitle(){var i,t;return null!==(t=null===(i=this.getCustomTitle)||void 0===i?void 0:i.call(this))&&void 0!==t?t:this.getMessage("snkCrud.title")}getTitleTooltip(){if(this.dataUnit.isMultipleEdition)return this.buildRecordIdsArray()}buildRecordIdsArray(){var i,t;const e=null!==(t=null===(i=this.dataUnit.getSelectionInfo())||void 0===i?void 0:i.records)&&void 0!==t?t:[];return 0===e.length?"[]":`[${e.map((i=>this.messagesBuilder.getMessage("snkCrud.title",i))).join(", ")}]`}getCustomGuidesConfig(){return this._currentDetail?[]:this.customGuidesConfig}componentDidLoad(){this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this)),this.initKeyboardManager()}disconnectedCallback(){var i;null===(i=this._keyboardManager)||void 0===i||i.unbindAllShortcutKeys()}async initKeyboardManager(){this._keyboardManager=new o({propagate:!1,element:this._element}),this._keyboardManager.bind(v,(async()=>{this._mainForm&&await this._mainForm.showSearchField()}),{description:this.getMessage("snkSimpleCrud.findFields"),element:this._element})}renderFormConfig(){if(null!=this._formEditorConfigManager)return e("snk-form-config",{ref:i=>this._container=i,tabindex:-1,dataUnit:this._formEditorDataUnit,messagesBuilder:this.messagesBuilder,configManager:this._formEditorConfigManager,onConfigClose:()=>this._formEditorConfigManager=null,customGuidesConfig:this.getCustomGuidesConfig()})}renderGuidesNavigator(i){var t,s;return e("section",{class:"snk-guides-viewer",ref:i=>this._container=i,tabIndex:-1},e("div",{class:"ez-row snk-guides-viewer__header"},e("div",{class:"snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large",key:"header"},e("ez-button",{onClick:()=>this.exitViewer(),title:this.getMessage("snkCrud.goBackTitle"),mode:"icon",iconName:"arrow_back",class:"ez-padding-right--medium",size:"small"}),e("div",{class:"ez-flex ez-flex--column ez-flex-item--auto"},e("h1",{class:"ez-title ez-title--primary ez-title--xlarge",title:this.getTitleTooltip()},this.getTitle()),(null===(t=this._breadcrumbItems)||void 0===t?void 0:t.length)>1&&e("div",{class:"ez-margin-top--extra-small"},e("ez-breadcrumb",Object.assign({items:this._breadcrumbItems,onSelectedItem:i=>this.onBreadcrumbClickHandler(null==i?void 0:i.detail)},{[h.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${h.getInternalIDInfo("breadcrumb")}`}))))),this.presentationMode!=m.SECONDARY&&this.buildTaskBar()),e("div",{class:"snk-guides-viewer__container"},i?e("ez-guide-navigator",{ref:i=>this._guideNavigator=i,class:"snk-guides-viewer__guide-navigator",items:this._guides,selectedId:this.selectedGuide?this.selectedGuide.id:void 0,onEzSelectionChange:i=>this.updateSelectedGuideHandler(i.detail)}):e("div",null),e("div",{class:"snk-guides-viewer__detail-container"},_.buildFixedForms({formConfig:this.masterFormConfig,formMetadata:this._masterFormMetadata,selectedForm:null===(s=this.selectedGuide)||void 0===s?void 0:s.id,dataUnit:this.dataUnit,recordsValidator:this.recordsValidator,fieldToFocus:this._fieldToGetFocus,onRequestClearFieldToFocus:this.clearFieldToFocusHandler.bind(this),propsCustomEditor:this._customEditors,fieldsProps:this._fieldsProps}),this.getContent())),e("snk-configurator",{ref:i=>this._snkConfigurator=i,viewMode:this.getConfigViewMode(),onConfigSelected:i=>this.changeConfigViewMode(i.detail),messagesBuilder:this.messagesBuilder,onOpenConfig:i=>this.openConfig(i.detail),resourceID:this.resourceID}))}render(){if(this.dataUnit&&this._configManager.isLoaded)return this.loadTaskbarProcessor(),e("ez-view-stack",{ref:i=>this._viewStack=i,"data-element-id":"guides-viewer-stack"},e("stack-item",null,this.renderGuidesNavigator(this._guides&&this._guides.length>1)),e("stack-item",null,this.renderFormConfig()))}get _element(){return r(this)}static get watchers(){return{dataUnit:["observeDataUnit"],_formEditorConfigManager:["observeFormConfigManager"],dataState:["observeDataState"],masterFormConfig:["observeMasterFormConfig"]}}};var C,y;!function(i){i.FINISH_EDITION="snkGuideViewer.finish_edition",i.MUTIPLE_EDITION="snkGuideViewer.multiple_edition",i.REGULAR="snkGuideViewer.regular"}(C||(C={})),function(i){i[i.GUIDES=0]="GUIDES",i[i.CONFIG=1]="CONFIG"}(y||(y={})),_.style=".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-small:var(--space--2xs, 8px);--snk-guides-viewer__header--min-height:68px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-small);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-small)}.snk-guides-viewer__header-breadcrumb.sc-snk-guides-viewer{width:25%;display:flex}.snk-guides-viewer__header-taskbar.sc-snk-guides-viewer{width:75%}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-small));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-small))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";export{_ as S}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as s,h as i,g as e}from"./p-
|
|
1
|
+
import{r as t,c as s,h as i,g as e}from"./p-82bb3eda.js";import{ElementIDUtils as h}from"@sankhyalabs/core";import{F as o}from"./p-ff1990ad.js";const a=class{constructor(i){t(this,i),this.valueChanged=s(this,"valueChanged",7),this.value=void 0,this.config=void 0,this.errorMessage=void 0}ezChangeListener(t){var s;this.errorMessage=void 0,this.value=null===(s=t.detail)||void 0===s?void 0:s.value,this.valueChanged.emit(this.value)}async setFocus(){this._comboElement.setFocus()}async clearValue(){this.value=this.config.value,this._comboElement&&(this._comboElement.value=this.config.value)}componentDidLoad(){this._element&&h.addIDInfo(this._element,"filterContentEditor")}render(){if(this.config&&this.config.type===o.MULTI_SELECT)return i("ez-tooltip",{active:!1===this.config.enabled,message:this.config.disabledMessage,type:"warning"},i("ez-combo-box",{id:this.config.id,ref:t=>this._comboElement=t,label:this.config.label,value:this.config.value,options:this.config.props.options,enabled:this.config.enabled,errorMessage:this.errorMessage,onEzVisibilityChange:t=>{t.stopPropagation()}}))}get _element(){return e(this)}};export{a as snk_filter_multi_select}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as s,h as i,g as e}from"./p-
|
|
1
|
+
import{r as t,c as s,h as i,g as e}from"./p-82bb3eda.js";import{ElementIDUtils as h}from"@sankhyalabs/core";const a=class{constructor(i){t(this,i),this.valueChanged=s(this,"valueChanged",7),this.config=void 0,this.value=void 0,this.errorMessage=void 0}ezChangeListener(t){this.errorMessage=void 0,this.value=t.detail,this.valueChanged.emit(this.value)}async setFocus(){this._textInputElement.setFocus()}async clearValue(){this.value=this.config.value,this._textInputElement&&(this._textInputElement.value=this.config.value)}componentDidLoad(){this._element&&h.addIDInfo(this._element,"filterContentEditor")}render(){var t;if(this.config)return i("ez-tooltip",{active:!1===this.config.enabled,message:this.config.disabledMessage,type:"warning"},i("ez-text-input",{id:this.config.id,label:this.config.label,ref:t=>this._textInputElement=t,value:this.config.value,mask:null===(t=this.config)||void 0===t?void 0:t.mask,enabled:this.config.enabled,cleanValueMask:!0,errorMessage:this.errorMessage}))}get _element(){return e(this)}};export{a as snk_filter_text}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as o,H as n}from"./p-
|
|
1
|
+
import{r as t,c as i,h as o,H as n}from"./p-82bb3eda.js";import{ObjectUtils as s}from"@sankhyalabs/core";import{ApplicationUtils as e}from"@sankhyalabs/ezui/dist/collection/utils";const a=class{constructor(o){t(this,o),this.formConfigOptionSelected=i(this,"formConfigOptionSelected",7),this.configOptions=[],this.selectedConfig=void 0,this.hasChanges=!1,this.messagesBuilder=void 0}getMessage(t,i){return this.messagesBuilder.getMessage(t,i)}async showShareConfigOptions(){this._refOptionsPopover&&this._refShareConfigBtn&&await this._refOptionsPopover.showUnder(this._refShareConfigBtn)}async handleSelectOption(t){if(!s.equals(t,this.selectedConfig)){if(this.hasChanges){const t=this.getMessage("snkFormConfig.confirm.title"),i=this.getMessage("snkFormConfig.confirm.cancel");if(!await e.confirm(t,i))return}this.selectedConfig=t,this.formConfigOptionSelected.emit(t),await this._refOptionsPopover.hide()}}getButtonLabel(){var t,i;return null!==(i=null===(t=this.selectedConfig)||void 0===t?void 0:t.name)&&void 0!==i?i:this.getMessage("snkFormConfig.configs.buttonLabel")}renderConfigOptions(){return this.configOptions.map((t=>o("div",{class:"main-item",onClick:async()=>await this.handleSelectOption(t)},o("span",{class:"item-label"}," ",t.name),this.renderCheckIcon(t))))}renderCheckIcon(t){if(this.selectedConfig&&this.selectedConfig.origin===t.origin)return o("ez-icon",{iconName:"check"})}render(){return o(n,null,o("ez-button",{ref:t=>this._refShareConfigBtn=t,label:this.getButtonLabel(),onClick:async()=>await this.showShareConfigOptions()},o("ez-icon",{slot:"rightIcon",iconName:"chevron-down"})),o("ez-popover-plus",{ref:t=>this._refOptionsPopover=t,autoClose:!0,overlayType:"none"},o("div",{class:"dropdown-container"},this.renderConfigOptions())))}};a.style=".dropdown-container.sc-configs-button{font-family:'Roboto';font-size:12px;font-weight:400;display:flex;flex-direction:column;color:#2b3a54;width:200px}.main-item.sc-configs-button{padding:12px;font-size:14px;cursor:pointer;transition:all .2s ease-in-out;display:flex;flex-direction:row;gap:8px;align-items:center;justify-content:start}.main-item.sc-configs-button ez-icon.sc-configs-button{--ez-icon--color:#008561}.main-item.sc-configs-button:nth-of-type(1){padding-bottom:6px}.main-item.sc-configs-button:nth-of-type(2){padding-top:6px}.main-item.sc-configs-button:hover{background-color:#FAFCFF}.item-label.sc-configs-button{display:flex}";export{a as configs_button}
|