@sankhyalabs/sankhyablocks 9.2.0-dev.2 → 9.2.0-dev.20
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-1931defc.js → ConfigStorage-8b6def32.js} +2 -2
- package/dist/cjs/{DataFetcher-ad9fb3bb.js → DataFetcher-2c37b6a1.js} +52 -1
- package/dist/cjs/{ISave-18ffb73e.js → ISave-b22b3cf0.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-65e5288e.js → SnkFormConfigManager-477a27de.js} +2 -2
- package/dist/cjs/{ClientSideExporterProvider-994f6e26.js → SnkMultiSelectionListDataSource-b7ab26ba.js} +82 -79
- package/dist/cjs/{auth-fetcher-afbe69ab.js → auth-fetcher-78a90b36.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-c7253b02.js → dataunit-fetcher-877944a9.js} +1 -1
- package/dist/cjs/filter-validate-6993f6f2.js +30 -0
- package/dist/cjs/{form-config-fetcher-f6e66d64.js → form-config-fetcher-dee08eb4.js} +1 -1
- package/dist/cjs/{index-0ad2baeb.js → index-13d05f03.js} +21 -5
- package/dist/cjs/index-1cf293c1.js +8 -8
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -4
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_8.cjs.entry.js +5 -5
- package/dist/cjs/snk-application.cjs.entry.js +6 -9
- package/dist/cjs/snk-attach.cjs.entry.js +7 -7
- package/dist/cjs/snk-crud.cjs.entry.js +7 -7
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
- package/dist/cjs/{snk-data-unit-448fce74.js → snk-data-unit-6b0101fe.js} +13 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +9 -9
- package/dist/cjs/snk-entity-list.cjs.entry.js +10 -3
- package/dist/cjs/snk-expression-group_2.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +189 -115
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +23 -2
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +20 -2
- package/dist/cjs/snk-filter-detail.cjs.entry.js +25 -8
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +9 -14
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +16 -3
- package/dist/cjs/snk-filter-number.cjs.entry.js +34 -3
- package/dist/cjs/snk-filter-period.cjs.entry.js +59 -14
- package/dist/cjs/snk-filter-search.cjs.entry.js +14 -3
- package/dist/cjs/snk-filter-text.cjs.entry.js +18 -1
- package/dist/cjs/snk-form_2.cjs.entry.js +31 -5
- package/dist/cjs/snk-grid.cjs.entry.js +158 -66
- package/dist/cjs/{snk-guides-viewer-c23ed218.js → snk-guides-viewer-38277265.js} +6 -6
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +14 -6
- package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -4
- package/dist/cjs/snk-simple-bar.cjs.entry.js +5 -5
- package/dist/cjs/snk-simple-crud.cjs.entry.js +60 -23
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
- package/dist/cjs/{taskbar-elements-3b74cd21.js → taskbar-elements-fb5d1e08.js} +1 -1
- package/dist/collection/components/snk-application/snk-application.js +0 -2
- package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +4 -1
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +173 -28
- package/dist/collection/components/snk-entity-list/snk-entity-list.js +28 -4
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +72 -2
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +73 -2
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +51 -5
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +83 -3
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +118 -27
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +49 -5
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +71 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +62 -11
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +70 -8
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +0 -4
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +112 -16
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +8 -16
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +315 -114
- package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +3 -1
- package/dist/collection/components/snk-filter-bar/utils/filter-validate.js +24 -0
- package/dist/collection/components/snk-form/snk-form.js +133 -22
- package/dist/collection/components/snk-grid/snk-grid.js +488 -133
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +83 -21
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +80 -14
- package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +9 -9
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +414 -119
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +102 -36
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +1 -0
- package/dist/collection/lib/http/data-fetcher/custom-xhr-override.js +39 -0
- package/dist/collection/lib/message/resources/en-us/snk-filter-bar.msg.js +1 -0
- package/dist/collection/lib/message/resources/en-us/snk-grid.msg.js +4 -0
- package/dist/collection/lib/message/resources/es-es/snk-filter-bar.msg.js +1 -0
- package/dist/collection/lib/message/resources/es-es/snk-grid.msg.js +4 -0
- package/dist/collection/lib/message/resources/pt-br/snk-filter-bar.msg.js +1 -0
- package/dist/collection/lib/message/resources/pt-br/snk-grid.msg.js +4 -0
- package/dist/components/ContinuousInsertUtils.js +4 -1
- package/dist/components/DataFetcher.js +52 -1
- package/dist/components/index2.js +21 -5
- package/dist/components/snk-application2.js +0 -3
- package/dist/components/snk-crud.js +62 -44
- package/dist/components/snk-data-unit2.js +11 -1
- package/dist/components/snk-detail-view2.js +89 -56
- package/dist/components/snk-entity-list.js +11 -3
- package/dist/components/snk-filter-bar2.js +103 -108
- package/dist/components/snk-filter-binary-select.js +27 -3
- package/dist/components/snk-filter-checkbox-list.js +24 -3
- package/dist/components/snk-filter-detail2.js +28 -9
- package/dist/components/snk-filter-item2.js +70 -8
- package/dist/components/snk-filter-modal-item2.js +7 -12
- package/dist/components/snk-filter-modal.js +1 -325
- package/dist/components/snk-filter-modal2.js +391 -0
- package/dist/components/snk-filter-multi-select.js +19 -4
- package/dist/components/snk-filter-number.js +38 -4
- package/dist/components/snk-filter-period.js +64 -16
- package/dist/components/snk-filter-search.js +17 -4
- package/dist/components/snk-filter-text.js +22 -2
- package/dist/components/snk-form.js +29 -2
- package/dist/components/snk-grid2.js +188 -75
- package/dist/components/snk-personalized-filter2.js +10 -2
- package/dist/components/snk-simple-bar2.js +5 -5
- package/dist/components/snk-simple-crud2.js +45 -8
- package/dist/esm/{ConfigStorage-b5a1dba3.js → ConfigStorage-22eace3a.js} +2 -2
- package/dist/esm/{DataFetcher-6f6de657.js → DataFetcher-f6b2961a.js} +52 -1
- package/dist/esm/{ISave-7ecdca20.js → ISave-6b7b0423.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-34fc1dc7.js → SnkFormConfigManager-968b97e7.js} +2 -2
- package/dist/esm/{ClientSideExporterProvider-7c2781f4.js → SnkMultiSelectionListDataSource-1136c4e7.js} +87 -84
- package/dist/esm/{auth-fetcher-7332a9a9.js → auth-fetcher-cf39e42b.js} +1 -1
- package/dist/esm/{dataunit-fetcher-f21cbad0.js → dataunit-fetcher-6314b19d.js} +1 -1
- package/dist/esm/filter-validate-d765d450.js +27 -0
- package/dist/esm/{form-config-fetcher-6ab4e805.js → form-config-fetcher-bc6f0f1f.js} +1 -1
- package/dist/esm/{index-b72af127.js → index-446f9341.js} +21 -5
- package/dist/esm/index-479e1293.js +8 -8
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +4 -4
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_8.entry.js +5 -5
- package/dist/esm/snk-application.entry.js +6 -9
- package/dist/esm/snk-attach.entry.js +7 -7
- package/dist/esm/snk-crud.entry.js +7 -7
- package/dist/esm/snk-data-exporter.entry.js +5 -5
- package/dist/esm/{snk-data-unit-b7e6e7a6.js → snk-data-unit-d4a42b59.js} +13 -3
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +9 -9
- package/dist/esm/snk-entity-list.entry.js +10 -3
- package/dist/esm/snk-expression-group_2.entry.js +1 -1
- package/dist/esm/snk-filter-bar_4.entry.js +190 -116
- package/dist/esm/snk-filter-binary-select.entry.js +23 -2
- package/dist/esm/snk-filter-checkbox-list.entry.js +20 -2
- package/dist/esm/snk-filter-detail.entry.js +25 -8
- package/dist/esm/snk-filter-modal-item.entry.js +9 -14
- package/dist/esm/snk-filter-multi-select.entry.js +16 -3
- package/dist/esm/snk-filter-number.entry.js +34 -3
- package/dist/esm/snk-filter-period.entry.js +59 -14
- package/dist/esm/snk-filter-search.entry.js +14 -3
- package/dist/esm/snk-filter-text.entry.js +18 -1
- package/dist/esm/snk-form_2.entry.js +31 -5
- package/dist/esm/snk-grid.entry.js +152 -60
- package/dist/esm/{snk-guides-viewer-fbfece85.js → snk-guides-viewer-19cb7f1f.js} +6 -6
- package/dist/esm/snk-guides-viewer.entry.js +9 -9
- package/dist/esm/snk-personalized-filter.entry.js +14 -6
- package/dist/esm/snk-pesquisa.entry.js +4 -4
- package/dist/esm/snk-simple-bar.entry.js +5 -5
- package/dist/esm/snk-simple-crud.entry.js +55 -18
- package/dist/esm/snk-taskbar.entry.js +2 -2
- package/dist/esm/{taskbar-elements-171476d4.js → taskbar-elements-faaf5d8f.js} +1 -1
- package/dist/sankhyablocks/{p-0e495575.js → p-0237c565.js} +1 -1
- package/dist/sankhyablocks/p-093f58fa.entry.js +1 -0
- package/dist/sankhyablocks/{p-8d1508aa.entry.js → p-0affc07a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ad2ae575.entry.js → p-0e1f0344.entry.js} +1 -1
- package/dist/sankhyablocks/p-29cacaf3.entry.js +1 -0
- package/dist/sankhyablocks/{p-eb0616d3.entry.js → p-32450ea2.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b49281be.entry.js → p-3c29939c.entry.js} +1 -1
- package/dist/sankhyablocks/p-3ed04f0d.entry.js +1 -0
- package/dist/sankhyablocks/{p-4872dc3a.entry.js → p-44c5ec49.entry.js} +1 -1
- package/dist/sankhyablocks/p-49ddc27a.entry.js +1 -0
- package/dist/sankhyablocks/p-4c763b10.entry.js +1 -0
- package/dist/sankhyablocks/p-4eeb06fc.js +1 -0
- package/dist/sankhyablocks/p-505172c8.entry.js +1 -0
- package/dist/sankhyablocks/p-55798617.js +1 -0
- package/dist/sankhyablocks/{p-158adf33.entry.js → p-605ef7b2.entry.js} +1 -1
- package/dist/sankhyablocks/p-658f67a5.js +1 -0
- package/dist/sankhyablocks/p-72a9285d.entry.js +1 -0
- package/dist/sankhyablocks/p-7f7fe6c4.entry.js +1 -0
- package/dist/sankhyablocks/p-88b7bc09.js +1 -0
- package/dist/sankhyablocks/{p-c6331595.js → p-8d256def.js} +1 -1
- package/dist/sankhyablocks/p-8f37b75b.entry.js +1 -0
- package/dist/sankhyablocks/{p-b35574b5.js → p-9062d640.js} +1 -1
- package/dist/sankhyablocks/{p-72c8c847.entry.js → p-95c71f5e.entry.js} +1 -1
- package/dist/sankhyablocks/p-96d45943.entry.js +1 -0
- package/dist/sankhyablocks/{p-eacff4b7.entry.js → p-b2d7f4cd.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6a015ba2.js → p-b7f5caf6.js} +1 -1
- package/dist/sankhyablocks/p-b9200e77.entry.js +11 -0
- package/dist/sankhyablocks/{p-7de79adf.js → p-b987e15d.js} +1 -1
- package/dist/sankhyablocks/{p-ba4979b4.js → p-bf017a1f.js} +1 -1
- package/dist/sankhyablocks/{p-735a1175.entry.js → p-c3dbf441.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3dba3468.js → p-c71dcb2d.js} +1 -1
- package/dist/sankhyablocks/{p-5e282b33.entry.js → p-c95f20d9.entry.js} +1 -1
- package/dist/sankhyablocks/p-c98e2085.js +1 -0
- package/dist/sankhyablocks/p-cb4343c4.entry.js +1 -0
- package/dist/sankhyablocks/p-d03ae54e.entry.js +1 -0
- package/dist/sankhyablocks/p-d235314c.entry.js +1 -0
- package/dist/sankhyablocks/p-d75a732c.js +1 -0
- package/dist/sankhyablocks/{p-f39b0ebe.entry.js → p-df7979fd.entry.js} +1 -1
- package/dist/sankhyablocks/p-e258de96.entry.js +1 -0
- package/dist/sankhyablocks/{p-d377aa7a.entry.js → p-f8e87cf1.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +46 -3
- package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +8 -4
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +12 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.d.ts +12 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +12 -4
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +16 -4
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +17 -3
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +10 -2
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +12 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +8 -3
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +27 -4
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +17 -3
- package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +2 -3
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +60 -30
- package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +4 -2
- package/dist/types/components/snk-filter-bar/utils/filter-validate.d.ts +11 -0
- package/dist/types/components/snk-form/snk-form.d.ts +29 -4
- package/dist/types/components/snk-grid/snk-grid.d.ts +132 -58
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +53 -5
- package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +44 -6
- package/dist/types/components/snk-simple-bar/snk-simple-bar.d.ts +15 -15
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +100 -43
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +23 -21
- package/dist/types/components.d.ts +771 -255
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
- package/package.json +4 -3
- package/dist/collection/lib/licenses/sankhyalicense.module.js +0 -1
- package/dist/sankhyablocks/p-012208e0.entry.js +0 -1
- package/dist/sankhyablocks/p-07b14811.entry.js +0 -1
- package/dist/sankhyablocks/p-0dac8fef.js +0 -1
- package/dist/sankhyablocks/p-1210500e.js +0 -1
- package/dist/sankhyablocks/p-16fc4acd.js +0 -1
- package/dist/sankhyablocks/p-25209340.entry.js +0 -1
- package/dist/sankhyablocks/p-295b83ae.entry.js +0 -1
- package/dist/sankhyablocks/p-398cdd67.entry.js +0 -1
- package/dist/sankhyablocks/p-4e63ffed.entry.js +0 -1
- package/dist/sankhyablocks/p-5bab470d.entry.js +0 -1
- package/dist/sankhyablocks/p-5c7af8a9.entry.js +0 -1
- package/dist/sankhyablocks/p-81769310.entry.js +0 -11
- package/dist/sankhyablocks/p-9fd87bfd.entry.js +0 -1
- package/dist/sankhyablocks/p-a349689a.js +0 -1
- package/dist/sankhyablocks/p-a76e6d51.entry.js +0 -1
- package/dist/sankhyablocks/p-a86eee47.entry.js +0 -1
- package/dist/sankhyablocks/p-c6a8a8bc.entry.js +0 -1
- package/dist/sankhyablocks/p-c9e6d720.js +0 -1
- package/dist/sankhyablocks/p-dff65083.entry.js +0 -1
- package/dist/sankhyablocks/p-fa18530e.entry.js +0 -1
@@ -1 +1 @@
|
|
1
|
-
import{r as t,c as s,h as i,H as e,g as a}from"./p-d8d8169b.js";import{Action as h,LockManager as n,LockManagerOperation as r,SilentException as o,StringUtils as l,ApplicationContext as d,OVERFLOWED_CLASS_NAME as v,OverflowWatcher as u,OverflowDirection as c,ElementIDUtils as k}from"@sankhyalabs/core";import{A as m}from"./p-dc36cfbf.js";import{T as b,V as p,A as T,b as f,a as g}from"./p-7de79adf.js";import{P as w}from"./p-0f3698af.js";import"./p-a349689a.js";const E=class{constructor(i){t(this,i),this.actionClick=s(this,"actionClick",7),this.taskbarSaveLocker=s(this,"taskbarSaveLocker",7),this.taskbarSaveUnlocker=s(this,"taskbarSaveUnlocker",7),this.TASKBAR_ITEM_ID_PREFIX="TASKBAR_ITEM_",this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME="taskbar-custom-elements-container",this.ACTIONS_BUTTON_TAG="TASKBAR-ACTIONS-BUTTON",this.NOT_OVERFLOW_ELEMENTS=["moreOptions","dataExporter_snkDataExporter","actionsButton_snkActionsButton"],this.TASKBAR_CUSTOM_ELEMENTS="taskbar-custom-elements-container",this._titleKeyByElement={[b.UPDATE_MULTIPLE]:"snkTaskbar.titleUpdateMultiple",[b.UPDATE]:"snkTaskbar.titleUpdate",[b.PREVIOUS]:"snkTaskbar.titlePrevious",[b.NEXT]:"snkTaskbar.titleNext",[b.REFRESH]:"snkTaskbar.titleRefresh",[b.CLONE]:"snkTaskbar.titleClone",[b.REMOVE]:"snkTaskbar.titleRemove",[b.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[b.INSERT]:"snkTaskbar.titleInsert",[b.CANCEL]:"snkTaskbar.titleCancel",[b.SAVE]:"snkTaskbar.titleSave",[b.GRID_MODE]:"snkTaskbar.titleGridMode",[b.FORM_MODE]:"snkTaskbar.titleFormMode",[b.CONFIGURATOR]:"snkTaskbar.titleConfigurator",[b.ATTACH]:"snkTaskbar.titleAttach"},this.onSaveEvent=t=>{switch(t.type){case h.FIELD_INVALIDATED:case h.INVALIDATE_CLEAN:case h.DATA_SAVED:case h.SAVING_ERROR:case h.SAVING_CANCELED:this._isWaitingForSave=!1;break;case h.SAVING_DATA:this._isWaitingForSave=!0}},this._permissions=void 0,this._overFlowedElements=[],this._customElements=void 0,this._customElementsId=void 0,this._slotContainer=void 0,this._hiddenActionsList=[],this._lastWidth=void 0,this._hasToUpdateOverFlow=!1,this._isWaitingForSave=!1,this.alignRigth=!1,this.customSlotId="TASKBAR_CUSTOM_ELEMENTS",this.customContainerId=void 0,this.overflowStrategy="hiddenItems",this.configName=void 0,this.resourceID=void 0,this.buttons=void 0,this.customButtons=void 0,this.actionsList=void 0,this.actionsSettingsList=void 0,this.primaryButton=void 0,this.disabledButtons=void 0,this.dataUnit=void 0,this.presentationMode=w.PRIMARY,this.messagesBuilder=void 0}handleCustomSlotElementsLoaded(t){this.hasToSearchCustomElements(t)&&this.getCustomElements(!0)}handleTaskbarSaveLocker(){!0!==this._isWaitingForSave&&(this._isWaitingForSave=!0)}handleTaskbarSaveUnlocker(){!0===this._isWaitingForSave&&(this._isWaitingForSave=!1)}hasToSearchCustomElements(t){return this.customSlotId===t.detail&&!this._slotContainer}observeButtons(){this._definitions=void 0,requestAnimationFrame((()=>{requestAnimationFrame((()=>{var t;return null===(t=this._overFlowWatcher)||void 0===t?void 0:t.forceUpdate()}))}))}observeDisabledButtons(){var t;null===(t=this._overFlowWatcher)||void 0===t||t.forceUpdate()}observeLastWidth(t,s){0===s&&0!==t&&(this._hasToUpdateOverFlow=!0)}observeIsWaitingForSave(t,s){1==t&&0==s&&this.taskbarSaveLocker.emit(),0==t&&1==s&&this.taskbarSaveUnlocker.emit()}elementsFromString(t){const s=[];return null==t||t.split(",").forEach((t=>{t=t.trim(),(p[t]||this.isAllowed(t))&&s.push(t.trim())})),s}isAllowed(t){return t===T.CONFIGURATOR?!!this._permissions&&(this._permissions.isSup||this._permissions[m.CONFIG_GRID]||this._permissions[m.CONFIG]):!T[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){var s;let i;return i=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",i?null===(s=this.messagesBuilder)||void 0===s?void 0:s.getMessage(i,{}):""}elementClick(t){n.whenResolve(this._element,r.TASKBAR_CLICK).then((()=>{if(this.dataUnit)switch(t){case b.PREVIOUS:this.dataUnit.previousRecord();break;case b.NEXT:this.dataUnit.nextRecord();break;case b.REFRESH:this.dataUnit.loadData();break;case b.CLONE:this.dataUnit.copySelected();break;case b.REMOVE:this.dataUnit.removeSelectedRecords();break;case b.INSERT:this.dataUnit.addRecord();break;case b.CANCEL:this.dataUnit.cancelEdition();break;case b.SAVE:this._isWaitingForSave||(this._isWaitingForSave=!0,this.dataUnit.saveData().catch((t=>{if(!(t instanceof o))throw t})).finally((()=>{this._isWaitingForSave=!1})))}this.isEnabled(t)&&this.actionClick.emit(t)}))}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}validatePresentationMode(){Object.values(w).includes(this.presentationMode)||(this.presentationMode=w.PRIMARY)}getElement(t,s){let i=s===this.primaryButton?"ez-button--primary ":"";t>1&&(i+="ez-padding-left--medium");const e=b[s.toString()],a=this._element.dataset.exporterStoreKey||this.configName;return e?f(s,i,this.getIdElemBtnNative(s),(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),s!==b.CONFIGURATOR?this.buildDynamicActionsList():this.buildActionsSettingsList(),a,this.presentationMode):g(s,i,this.getIdElemBtnCustom(s),(t=>this.elementClick(t)),(t=>this.isEnabled(t)))}buildDynamicActionsList(){var t;return this._hiddenActionsList.length?[...null!==(t=this.actionsList)&&void 0!==t?t:[],...this._hiddenActionsList]:this.actionsList}buildActionsSettingsList(){return this.actionsSettingsList}getIdElemBtnNative(t){return l.toCamelCase(t)}getIdElemBtnCustom(t){return l.toCamelCase(t.name)}isDivider(t){var s;return void 0!==t&&(null===(s=t.t)||void 0===s?void 0:s["data-taskbar-divider"])}removeEmpty(t){let s;return t.filter((t=>!(null==t||this.isDivider(s)&&this.isDivider(t)||(s=t,0))))}appendCustomElementsInTaskbar(){this._customElementsId.forEach((t=>{const s=t.replace(this.TASKBAR_ITEM_ID_PREFIX,""),i=this._customElements.get(s),e=this._element.querySelector(`#${t}`);e?null==e||e.appendChild(i):this.unlinkCustomElementFromTaskbar(i)}))}addCustomElementContainer(t){var s;const e=`${this.TASKBAR_ITEM_ID_PREFIX}${t}`;return this._customElementsId.includes(e)||(this._customElementsId.push(e),null===(s=this._overFlowWatcher)||void 0===s||s.addNotOverFlowElement(e)),i("span",{class:"ez-padding-left--medium",key:e,id:e})}getCustomElements(t){var s,i;this._customElementsId=[],this._customElements=new Map,this._slotContainer=this.buildSlotContainer(t),Array.from(null!==(i=null===(s=this._slotContainer)||void 0===s?void 0:s.children)&&void 0!==i?i:[]).forEach((t=>this._customElements.set(t.id,t)))}buildSlotContainer(t){let s;if(this.customContainerId){const t=document.querySelector(`#${this.customContainerId}`);s=null==t?void 0:t.querySelector(`#${this.customSlotId}`)}else s=this._element.querySelector(`#${this.customSlotId}`);return t&&!s&&(s=document.querySelector(`#${this.customSlotId}`)),s}componentWillLoad(){this._application=d.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess(this.resourceID).then((t=>this._permissions=t)):this._permissions={},this.getCustomElements()}componentWillRender(){this.handleDefinitions(),this.validatePresentationMode(),this.updateOverFlowIfNeeded()}handleDefinitions(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons))}updateOverFlowIfNeeded(){this._hasToUpdateOverFlow&&(requestAnimationFrame((()=>{var t;return null===(t=this._overFlowWatcher)||void 0===t?void 0:t.forceUpdate()})),this._hasToUpdateOverFlow=!1)}handleOverFlow(t){const s=t.filter((t=>!this.hasToIgnoreOverFlow(t)));this.resetOverFlowedElements(),this.doOverFlowElements(s)}resetOverFlowedElements(){this._overFlowedElements.forEach((t=>{t.classList.remove(v)})),this._hiddenActionsList=[],this._overFlowedElements=[]}doOverFlowElements(t){t.forEach((t=>{t.classList.add(v),this._overFlowedElements.push(t),this.addItemToActionList(t)}))}addItemToActionList(t){const s=this.getTaskbarElementName(t);if(s&&this.isEnabled(s)&&this.isAllowed(s)){const i={value:s,label:this.getTaskbarElementLabel(t),iconName:this.getTaskbarElementIcon(t)};this._hiddenActionsList.push(i)}}getTaskbarElementName(t){var s;return null!==(s=t.getAttribute("data-taskbar-element"))&&void 0!==s?s:""}getTaskbarElementIcon(t){var s;return null!==(s=t.getAttribute("data-taskbar-icon"))&&void 0!==s?s:""}getTaskbarElementLabel(t){var s;return null!==(s=t.getAttribute("data-taskbar-label"))&&void 0!==s?s:""}hasToIgnoreOverFlow(t){return t.classList.contains(this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME)}handleOverFlowStrategy(){"hiddenItems"===this.overflowStrategy&&(this._overFlowWatcher=new u(this.buildOverFlowWatcherParams()))}buildOverFlowWatcherParams(){return{element:this._element,callback:this.handleOverFlow.bind(this),overFlowDirection:c.HORIZONTAL,notOverFlow:this.NOT_OVERFLOW_ELEMENTS}}componentDidLoad(){k.addIDInfo(this._element,null,{dataUnit:this.dataUnit}),this.handleOverFlowStrategy(),this.dataUnit.subscribe(this.onSaveEvent)}componentDidRender(){this.appendCustomElementsInTaskbar(),this.updateLastWidth()}updateLastWidth(){this._lastWidth=this._element.getBoundingClientRect().width}disconnectedCallback(){var t,s;null===(t=this.dataUnit)||void 0===t||t.unsubscribe(this.onSaveEvent),this.unlinkAllCustomElements(),null===(s=this._overFlowWatcher)||void 0===s||s.destroy()}unlinkAllCustomElements(){var t;null===(t=this._customElementsId)||void 0===t||t.forEach((t=>{const s=t.replace(this.TASKBAR_ITEM_ID_PREFIX,""),i=this._customElements.get(s);this.unlinkCustomElementFromTaskbar(i)}))}unlinkCustomElementFromTaskbar(t){this._slotContainer.appendChild(t)}render(){var t;if(void 0===this._definitions)return;let s=0;return i(e,{class:this.getHostClasses()},this.removeEmpty(this._definitions.map((t=>{var e,a;return s++,b[t]?this.getElement(s,b[t]):(null===(e=this.customButtons)||void 0===e?void 0:e.has(t))?this.getElement(s,this.customButtons.get(t)):this._customElements.has(t)?this.addCustomElementContainer(t):(null===(a=this._overFlowWatcher)||void 0===a||a.addNotOverFlowElement(t),i("slot",{name:t}))}))),i("div",{id:this.TASKBAR_CUSTOM_ELEMENTS,class:this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME},i("slot",{name:this.customSlotId}),null===(t=this._overFlowWatcher)||void 0===t?void 0:t.addNotOverFlowElement(this.TASKBAR_CUSTOM_ELEMENTS)))}getHostClasses(){return"hiddenItems"!==this.overflowStrategy?"no-wrap":"full-width "+(this.alignRigth?"align-right":"")}get _element(){return a(this)}static get watchers(){return{buttons:["observeButtons"],disabledButtons:["observeDisabledButtons"],_lastWidth:["observeLastWidth"],_isWaitingForSave:["observeIsWaitingForSave"]}}};E.style=".sc-snk-taskbar-h{display:flex;flex-wrap:wrap}.no-wrap.sc-snk-taskbar-h{flex-wrap:nowrap}.full-width.sc-snk-taskbar-h{width:100%}.align-right.sc-snk-taskbar-h{justify-content:flex-end}.overflowed.sc-snk-taskbar{display:none}";export{E as snk_taskbar}
|
1
|
+
import{r as t,c as s,h as i,H as e,g as a}from"./p-d8d8169b.js";import{Action as h,LockManager as n,LockManagerOperation as r,SilentException as o,StringUtils as l,ApplicationContext as d,OVERFLOWED_CLASS_NAME as v,OverflowWatcher as u,OverflowDirection as c,ElementIDUtils as k}from"@sankhyalabs/core";import{A as m}from"./p-dc36cfbf.js";import{T as b,V as p,A as T,b as f,a as g}from"./p-b987e15d.js";import{P as w}from"./p-0f3698af.js";import"./p-55798617.js";const E=class{constructor(i){t(this,i),this.actionClick=s(this,"actionClick",7),this.taskbarSaveLocker=s(this,"taskbarSaveLocker",7),this.taskbarSaveUnlocker=s(this,"taskbarSaveUnlocker",7),this.TASKBAR_ITEM_ID_PREFIX="TASKBAR_ITEM_",this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME="taskbar-custom-elements-container",this.ACTIONS_BUTTON_TAG="TASKBAR-ACTIONS-BUTTON",this.NOT_OVERFLOW_ELEMENTS=["moreOptions","dataExporter_snkDataExporter","actionsButton_snkActionsButton"],this.TASKBAR_CUSTOM_ELEMENTS="taskbar-custom-elements-container",this._titleKeyByElement={[b.UPDATE_MULTIPLE]:"snkTaskbar.titleUpdateMultiple",[b.UPDATE]:"snkTaskbar.titleUpdate",[b.PREVIOUS]:"snkTaskbar.titlePrevious",[b.NEXT]:"snkTaskbar.titleNext",[b.REFRESH]:"snkTaskbar.titleRefresh",[b.CLONE]:"snkTaskbar.titleClone",[b.REMOVE]:"snkTaskbar.titleRemove",[b.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[b.INSERT]:"snkTaskbar.titleInsert",[b.CANCEL]:"snkTaskbar.titleCancel",[b.SAVE]:"snkTaskbar.titleSave",[b.GRID_MODE]:"snkTaskbar.titleGridMode",[b.FORM_MODE]:"snkTaskbar.titleFormMode",[b.CONFIGURATOR]:"snkTaskbar.titleConfigurator",[b.ATTACH]:"snkTaskbar.titleAttach"},this.onSaveEvent=t=>{switch(t.type){case h.FIELD_INVALIDATED:case h.INVALIDATE_CLEAN:case h.DATA_SAVED:case h.SAVING_ERROR:case h.SAVING_CANCELED:this._isWaitingForSave=!1;break;case h.SAVING_DATA:this._isWaitingForSave=!0}},this._permissions=void 0,this._overFlowedElements=[],this._customElements=void 0,this._customElementsId=void 0,this._slotContainer=void 0,this._hiddenActionsList=[],this._lastWidth=void 0,this._hasToUpdateOverFlow=!1,this._isWaitingForSave=!1,this.alignRigth=!1,this.customSlotId="TASKBAR_CUSTOM_ELEMENTS",this.customContainerId=void 0,this.overflowStrategy="hiddenItems",this.configName=void 0,this.resourceID=void 0,this.buttons=void 0,this.customButtons=void 0,this.actionsList=void 0,this.actionsSettingsList=void 0,this.primaryButton=void 0,this.disabledButtons=void 0,this.dataUnit=void 0,this.presentationMode=w.PRIMARY,this.messagesBuilder=void 0}handleCustomSlotElementsLoaded(t){this.hasToSearchCustomElements(t)&&this.getCustomElements(!0)}handleTaskbarSaveLocker(){!0!==this._isWaitingForSave&&(this._isWaitingForSave=!0)}handleTaskbarSaveUnlocker(){!0===this._isWaitingForSave&&(this._isWaitingForSave=!1)}hasToSearchCustomElements(t){return this.customSlotId===t.detail&&!this._slotContainer}observeButtons(){this._definitions=void 0,requestAnimationFrame((()=>{requestAnimationFrame((()=>{var t;return null===(t=this._overFlowWatcher)||void 0===t?void 0:t.forceUpdate()}))}))}observeDisabledButtons(){var t;null===(t=this._overFlowWatcher)||void 0===t||t.forceUpdate()}observeLastWidth(t,s){0===s&&0!==t&&(this._hasToUpdateOverFlow=!0)}observeIsWaitingForSave(t,s){1==t&&0==s&&this.taskbarSaveLocker.emit(),0==t&&1==s&&this.taskbarSaveUnlocker.emit()}elementsFromString(t){const s=[];return null==t||t.split(",").forEach((t=>{t=t.trim(),(p[t]||this.isAllowed(t))&&s.push(t.trim())})),s}isAllowed(t){return t===T.CONFIGURATOR?!!this._permissions&&(this._permissions.isSup||this._permissions[m.CONFIG_GRID]||this._permissions[m.CONFIG]):!T[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){var s;let i;return i=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",i?null===(s=this.messagesBuilder)||void 0===s?void 0:s.getMessage(i,{}):""}elementClick(t){n.whenResolve(this._element,r.TASKBAR_CLICK).then((()=>{if(this.dataUnit)switch(t){case b.PREVIOUS:this.dataUnit.previousRecord();break;case b.NEXT:this.dataUnit.nextRecord();break;case b.REFRESH:this.dataUnit.loadData();break;case b.CLONE:this.dataUnit.copySelected();break;case b.REMOVE:this.dataUnit.removeSelectedRecords();break;case b.INSERT:this.dataUnit.addRecord();break;case b.CANCEL:this.dataUnit.cancelEdition();break;case b.SAVE:this._isWaitingForSave||(this._isWaitingForSave=!0,this.dataUnit.saveData().catch((t=>{if(!(t instanceof o))throw t})).finally((()=>{this._isWaitingForSave=!1})))}this.isEnabled(t)&&this.actionClick.emit(t)}))}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}validatePresentationMode(){Object.values(w).includes(this.presentationMode)||(this.presentationMode=w.PRIMARY)}getElement(t,s){let i=s===this.primaryButton?"ez-button--primary ":"";t>1&&(i+="ez-padding-left--medium");const e=b[s.toString()],a=this._element.dataset.exporterStoreKey||this.configName;return e?f(s,i,this.getIdElemBtnNative(s),(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),s!==b.CONFIGURATOR?this.buildDynamicActionsList():this.buildActionsSettingsList(),a,this.presentationMode):g(s,i,this.getIdElemBtnCustom(s),(t=>this.elementClick(t)),(t=>this.isEnabled(t)))}buildDynamicActionsList(){var t;return this._hiddenActionsList.length?[...null!==(t=this.actionsList)&&void 0!==t?t:[],...this._hiddenActionsList]:this.actionsList}buildActionsSettingsList(){return this.actionsSettingsList}getIdElemBtnNative(t){return l.toCamelCase(t)}getIdElemBtnCustom(t){return l.toCamelCase(t.name)}isDivider(t){var s;return void 0!==t&&(null===(s=t.t)||void 0===s?void 0:s["data-taskbar-divider"])}removeEmpty(t){let s;return t.filter((t=>!(null==t||this.isDivider(s)&&this.isDivider(t)||(s=t,0))))}appendCustomElementsInTaskbar(){this._customElementsId.forEach((t=>{const s=t.replace(this.TASKBAR_ITEM_ID_PREFIX,""),i=this._customElements.get(s),e=this._element.querySelector(`#${t}`);e?null==e||e.appendChild(i):this.unlinkCustomElementFromTaskbar(i)}))}addCustomElementContainer(t){var s;const e=`${this.TASKBAR_ITEM_ID_PREFIX}${t}`;return this._customElementsId.includes(e)||(this._customElementsId.push(e),null===(s=this._overFlowWatcher)||void 0===s||s.addNotOverFlowElement(e)),i("span",{class:"ez-padding-left--medium",key:e,id:e})}getCustomElements(t){var s,i;this._customElementsId=[],this._customElements=new Map,this._slotContainer=this.buildSlotContainer(t),Array.from(null!==(i=null===(s=this._slotContainer)||void 0===s?void 0:s.children)&&void 0!==i?i:[]).forEach((t=>this._customElements.set(t.id,t)))}buildSlotContainer(t){let s;if(this.customContainerId){const t=document.querySelector(`#${this.customContainerId}`);s=null==t?void 0:t.querySelector(`#${this.customSlotId}`)}else s=this._element.querySelector(`#${this.customSlotId}`);return t&&!s&&(s=document.querySelector(`#${this.customSlotId}`)),s}componentWillLoad(){this._application=d.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess(this.resourceID).then((t=>this._permissions=t)):this._permissions={},this.getCustomElements()}componentWillRender(){this.handleDefinitions(),this.validatePresentationMode(),this.updateOverFlowIfNeeded()}handleDefinitions(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons))}updateOverFlowIfNeeded(){this._hasToUpdateOverFlow&&(requestAnimationFrame((()=>{var t;return null===(t=this._overFlowWatcher)||void 0===t?void 0:t.forceUpdate()})),this._hasToUpdateOverFlow=!1)}handleOverFlow(t){const s=t.filter((t=>!this.hasToIgnoreOverFlow(t)));this.resetOverFlowedElements(),this.doOverFlowElements(s)}resetOverFlowedElements(){this._overFlowedElements.forEach((t=>{t.classList.remove(v)})),this._hiddenActionsList=[],this._overFlowedElements=[]}doOverFlowElements(t){t.forEach((t=>{t.classList.add(v),this._overFlowedElements.push(t),this.addItemToActionList(t)}))}addItemToActionList(t){const s=this.getTaskbarElementName(t);if(s&&this.isEnabled(s)&&this.isAllowed(s)){const i={value:s,label:this.getTaskbarElementLabel(t),iconName:this.getTaskbarElementIcon(t)};this._hiddenActionsList.push(i)}}getTaskbarElementName(t){var s;return null!==(s=t.getAttribute("data-taskbar-element"))&&void 0!==s?s:""}getTaskbarElementIcon(t){var s;return null!==(s=t.getAttribute("data-taskbar-icon"))&&void 0!==s?s:""}getTaskbarElementLabel(t){var s;return null!==(s=t.getAttribute("data-taskbar-label"))&&void 0!==s?s:""}hasToIgnoreOverFlow(t){return t.classList.contains(this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME)}handleOverFlowStrategy(){"hiddenItems"===this.overflowStrategy&&(this._overFlowWatcher=new u(this.buildOverFlowWatcherParams()))}buildOverFlowWatcherParams(){return{element:this._element,callback:this.handleOverFlow.bind(this),overFlowDirection:c.HORIZONTAL,notOverFlow:this.NOT_OVERFLOW_ELEMENTS}}componentDidLoad(){k.addIDInfo(this._element,null,{dataUnit:this.dataUnit}),this.handleOverFlowStrategy(),this.dataUnit.subscribe(this.onSaveEvent)}componentDidRender(){this.appendCustomElementsInTaskbar(),this.updateLastWidth()}updateLastWidth(){this._lastWidth=this._element.getBoundingClientRect().width}disconnectedCallback(){var t,s;null===(t=this.dataUnit)||void 0===t||t.unsubscribe(this.onSaveEvent),this.unlinkAllCustomElements(),null===(s=this._overFlowWatcher)||void 0===s||s.destroy()}unlinkAllCustomElements(){var t;null===(t=this._customElementsId)||void 0===t||t.forEach((t=>{const s=t.replace(this.TASKBAR_ITEM_ID_PREFIX,""),i=this._customElements.get(s);this.unlinkCustomElementFromTaskbar(i)}))}unlinkCustomElementFromTaskbar(t){this._slotContainer.appendChild(t)}render(){var t;if(void 0===this._definitions)return;let s=0;return i(e,{class:this.getHostClasses()},this.removeEmpty(this._definitions.map((t=>{var e,a;return s++,b[t]?this.getElement(s,b[t]):(null===(e=this.customButtons)||void 0===e?void 0:e.has(t))?this.getElement(s,this.customButtons.get(t)):this._customElements.has(t)?this.addCustomElementContainer(t):(null===(a=this._overFlowWatcher)||void 0===a||a.addNotOverFlowElement(t),i("slot",{name:t}))}))),i("div",{id:this.TASKBAR_CUSTOM_ELEMENTS,class:this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME},i("slot",{name:this.customSlotId}),null===(t=this._overFlowWatcher)||void 0===t?void 0:t.addNotOverFlowElement(this.TASKBAR_CUSTOM_ELEMENTS)))}getHostClasses(){return"hiddenItems"!==this.overflowStrategy?"no-wrap":"full-width "+(this.alignRigth?"align-right":"")}get _element(){return a(this)}static get watchers(){return{buttons:["observeButtons"],disabledButtons:["observeDisabledButtons"],_lastWidth:["observeLastWidth"],_isWaitingForSave:["observeIsWaitingForSave"]}}};E.style=".sc-snk-taskbar-h{display:flex;flex-wrap:wrap}.no-wrap.sc-snk-taskbar-h{flex-wrap:nowrap}.full-width.sc-snk-taskbar-h{width:100%}.align-right.sc-snk-taskbar-h{justify-content:flex-end}.overflowed.sc-snk-taskbar{display:none}";export{E as snk_taskbar}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as t,c as s,h as e,H as i,g as h}from"./p-d8d8169b.js";import{ElementIDUtils as l}from"@sankhyalabs/core";import{F as a}from"./p-ff1990ad.js";import{E as o}from"./p-1a68fb59.js";const r=class{constructor(e){t(this,e),this.valueChanged=s(this,"valueChanged",7),this._noOptionValue="NO_VALUE",this._radioButtonValue=void 0,this.value=void 0,this.config=void 0,this.presentationMode=o.CHIP,this.errorMessage=void 0}isSelected(t){return null==this.value||this.value===t}ezChangeListener(t){if(this.errorMessage=void 0,this.presentationMode===o.MODAL)return t.detail||this.assertCheckedOption(t.target),void this.updateValue();this.value=t.detail===this._noOptionValue?void 0:t.detail,this._radioButtonValue=t.detail}async resetValues(){this.ezChangeListener({detail:this._noOptionValue})}async clearValue(){this.value=this.config.value,this._radioButtonValue=this.value||this._noOptionValue}async setFocus(){this.presentationMode!==o.MODAL?this._element.querySelector("ez-radio-button").focus():this._checkOne.setFocus()}assertCheckedOption(t){t===this._checkOne?this._checkTwo.value=!0:this._checkOne.value=!0}updateValue(){if(this._checkOne.value&&this._checkTwo.value)this.value=void 0;else{const[t,s]=this.config.props.options;this.value=this._checkOne.value?t.name:s.name}this.valueChanged.emit(this.value)}setRadioValue(){this._radioButtonValue=this.value||this._noOptionValue}componentDidLoad(){this._element&&l.addIDInfo(this._element,"filterContentEditor")}componentWillLoad(){this.setRadioValue()}componentShouldUpdate(){this.setRadioValue()}disconnectedCallback(){this.value=this.config.value}render(){if(!this.config||this.config.type!==a.BINARY_SELECT)return;const[t,s]=this.config.props.options;return e(i,null,this.presentationMode===o.MODAL?e("div",{class:"ez-row ez-size-height--full"},e("label",{class:"ez-text ez-title--small ez-title--primary ez-size-height--full ez-flex ez-flex--row ez-flex--align-items-center ez-col ez-col--sd-4"},this.config.detailModal),e("div",{class:"ez-col ez-col--sd-4"},e("ez-check",{ref:t=>this._checkOne=t,id:`${this.config.id}_${t.name||"option1"}`,class:"sc-snk-filter-bar editor__ez-check",label:t.label,enabled:this.config.enabled,value:this.isSelected(t.name)})),e("div",{class:"ez-col ez-col--sd-4"},e("ez-check",{ref:t=>this._checkTwo=t,id:`${this.config.id}_${s.name||"option2"}`,class:"sc-snk-filter-bar editor__ez-check",label:s.label,enabled:this.config.enabled,value:this.isSelected(s.name)})),this.errorMessage&&e("span",{class:"ez-text ez-text--small ez-text--error ez-margin--small"},this.errorMessage)):e("ez-tooltip",{active:!1===this.config.enabled,message:this.config.disabledMessage,type:"warning"},e("ez-radio-button",{value:this._radioButtonValue},e("ez-radio-button-option",{id:`${this.config.id}_${t.name||"option1"}`,class:"sc-snk-filter-bar editor__ez-check",label:t.label,value:t.name}),e("ez-radio-button-option",{id:`${this.config.id}_${s.name||"option2"}`,class:"sc-snk-filter-bar editor__ez-check",label:s.label,value:s.name}),e("ez-radio-button-option",{id:`${this.config.id}_option3`,class:"sc-snk-filter-bar editor__ez-check",label:`${t.label} + ${s.label}`,value:this._noOptionValue})),this.errorMessage&&e("span",{class:"ez-text ez-text--small ez-text--error ez-margin--small"},this.errorMessage)))}get _element(){return h(this)}};export{r as snk_filter_binary_select}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,c as s,h as i,H as e,F as a}from"./p-d8d8169b.js";import{I as o}from"./p-
|
1
|
+
import{r as t,c as s,h as i,H as e,F as a}from"./p-d8d8169b.js";import{I as o}from"./p-9062d640.js";import"./p-d75a732c.js";import{P as r}from"./p-bf017a1f.js";import"@sankhyalabs/core";import"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-ff1990ad.js";import"./p-8d256def.js";import"./p-9019a32f.js";import{ApplicationUtils as n}from"@sankhyalabs/ezui/dist/collection/utils";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-8d884fab.js";const h=class{constructor(i){t(this,i),this.pesquisaGridSelectItem=s(this,"pesquisaGridSelectItem",7),this._pesquisaFetcher=new r,this.metadata=void 0,this.dataSource=[],this.pkField=void 0,this.descriptionField=void 0,this.entityName=void 0,this.shouldLoadConfig=!1,this._gridConfig=void 0,this._inMemoryLoader=void 0,this._dataunit=void 0}observeDataSource(t){this._inMemoryLoader&&this._dataunit&&t&&(this._inMemoryLoader.records=[...t])}observeMetadata(){this.initializeDataUnit()}async observeShouldLoadConfig(t){t&&!this._gridConfig&&await this.loadGridConfig()}async loadGridConfig(){this._gridConfig=await this._pesquisaFetcher.loadPesquisaGridConfig(this.entityName)}initializeDataUnit(){var t;this.metadata&&!this._dataunit&&(this._inMemoryLoader=new o(this.metadata,null!==(t=this.dataSource)&&void 0!==t?t:[]),this._dataunit=this._inMemoryLoader.dataUnit,this._dataunit.pageSize=0)}handleDbClick(t){this.pesquisaGridSelectItem.emit({value:t[this.pkField],label:t[this.descriptionField]})}async handleConfigChanged({detail:t}){var s;const i=null!==(s=null==t?void 0:t.columns)&&void 0!==s?s:[];await this._pesquisaFetcher.savePesquisaGridConfig(this.entityName,i)}render(){if(this.metadata&&this._dataunit)return i(e,null,i("ez-grid",{dataUnit:this._dataunit,config:this._gridConfig,mode:"simple",autoFocus:!1,onEzDoubleClick:({detail:t})=>this.handleDbClick(t),onConfigChange:async t=>this.handleConfigChanged(t)}))}static get watchers(){return{dataSource:["observeDataSource"],metadata:["observeMetadata"],shouldLoadConfig:["observeShouldLoadConfig"]}}};h.style=".sc-pesquisa-grid-h{background:var(--background--xlight, #FFF);overflow-x:auto}ez-grid.sc-pesquisa-grid{--ez-grid__container--shadow:none;--ez-grid__header--shadow:none}";const l=class{constructor(i){t(this,i),this.pesquisaTreeSelectItem=s(this,"pesquisaTreeSelectItem",7),this.treeLoader=void 0,this.argument=void 0,this.allowsNonAnalytic=!1,this.shouldLoadTree=!1,this.messagesBuilder=void 0,this.items=[]}async applyFilter(){await this._tree.applyFilter(this.argument)}async observeShouldLoadTree(t){!t||this.items.length>0||await this.loadTree()}async loadTree(){if(!this.shouldLoadTree)return;if(!this.treeLoader||"function"!=typeof this.treeLoader)return;const t=await this.treeLoader((this.argument||"").trim());this.items=[...t]}expandOrCloseAllItems(t,s){return t.map((t=>Object.assign(Object.assign({},t),{expanded:s,children:t.children?this.expandOrCloseAllItems(t.children,s):void 0})))}handleExpandAll(){this.items=[...this.expandOrCloseAllItems(this.items,!0)]}handleCloseAll(){this.items=[...this.expandOrCloseAllItems(this.items,!1)]}handleDbClick(t){var s;if(this.allowsNonAnalytic||(null===(s=t.props)||void 0===s?void 0:s.analitico))this.pesquisaTreeSelectItem.emit({value:t.id,label:t.label});else{const t=this.getMessage("snkPesquisa.tree.errorTitle"),s=this.getMessage("snkPesquisa.tree.nonAnalyticError");n.error(t,s)}}renderEmptyMessage(){return i("div",{class:"ez-flex ez-flex--justify-center ez-flex--align-items-center ez-margin--large ez-text ez-text--xlarge ez-text--secondary"},i("span",null,this.getMessage("snkPesquisa.tree.emptyMessage")))}getMessage(t,s){return this.messagesBuilder.getMessage(t,s)}render(){var t;return i(e,null,(null===(t=this.items)||void 0===t?void 0:t.length)?i(a,null,i("div",{class:"actions-container"},i("ez-button",{size:"small",mode:"icon",class:"ez-margin-right--small",iconName:"show-list",title:this.getMessage("snkPesquisa.tree.expandButton"),onClick:()=>this.handleExpandAll()}),i("ez-button",{size:"small",mode:"icon",iconName:"hide-list",title:this.getMessage("snkPesquisa.tree.collapseButton"),onClick:()=>this.handleCloseAll()})),i("ez-tree",{ref:t=>this._tree=t,onEzDbClickItem:({detail:t})=>this.handleDbClick(t),items:this.items})):this.renderEmptyMessage())}static get watchers(){return{shouldLoadTree:["observeShouldLoadTree"]}}};l.style=".sc-pesquisa-tree-h{--snk-pesquisa--tree__action-container--top:var(--space--sm);--snk-pesquisa--tree__action-container--right:var(--space--small);--snk-pesquisa--tree__min-height:var(--space--extra-large);background:var(--background--xlight, #FFF);position:relative;min-height:var(--snk-pesquisa--tree__min-height);height:100%;display:block;overflow-y:auto}.sc-pesquisa-tree-h:hover .actions-container.sc-pesquisa-tree{display:flex}.actions-container.sc-pesquisa-tree{flex-direction:row;position:absolute;top:var(--snk-pesquisa--tree__action-container--top);right:var(--snk-pesquisa--tree__action-container--right);display:none}";export{h as pesquisa_grid,l as pesquisa_tree}
|
@@ -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{S as l}from"./p-1210500e.js";import{buildFormMetadata as u,FormMetadata as v}from"@sankhyalabs/ezui/dist/collection/utils/form";import{T as c}from"./p-1a0caadb.js";import{T as g}from"./p-7de79adf.js";import{V as m}from"./p-9019a32f.js";import"./p-0dac8fef.js";import"./p-ba4979b4.js";import{P as k}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-b35574b5.js";import"./p-ff1990ad.js";import"./p-c6331595.js";import{SelectionMode as p}from"@sankhyalabs/core/dist/dataunit/DataUnit";import{buildFieldSearch as f,SHORTCUT_SEARCH_FIELD as w}from"@sankhyalabs/ezui/dist/collection/utils";const b="__FORM:",_=class{constructor(e){i(this,e),this.snkMasterFormConfigChange=t(this,"snkMasterFormConfigChange",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._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)}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(){this._container.focus()}exitViewer(){!this.enableGridInsert&&this.dataUnit.isDirty()?this.dataUnit.cancelEdition({after:()=>this.exit.emit()}):this.exit.emit()}onActionClick(i){i.detail===g.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=u(this.masterFormConfig,this.dataUnit,!0);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),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!=v.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]=[g.CANCEL,g.SAVE,this.handleAddGridMode()],i[C.MUTIPLE_EDITION]=[g.CANCEL],this._taskbarProcessor=new c(i),this._taskbarProcessor.process(this.getTaskBarId(),this.taskbarManager,this.dataState,this.buildDisabledButtons(),this.buildInvisibleButtons())}buildBtnsRegularMode(){var i,t;const e=[g.ATTACH,g.CLONE,g.REMOVE,g.MORE_OPTIONS,g.ACTIONS_BUTTON,g.DIVIDER,g.GRID_MODE,g.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(g.PREVIOUS,g.NEXT,g.DIVIDER),this.presentationMode==k.SECONDARY?e.unshift(g.INSERT):e.push(g.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(g.PREVIOUS),(null===(t=this.dataState)||void 0===t?void 0:t.hasNext)||a.push(g.NEXT),(null===(s=null===(e=this.dataState)||void 0===e?void 0:e.selectionInfo)||void 0===s?void 0:s.length)>1&&a.push(g.CLONE),(null===(n=null===(r=this.dataState)||void 0===r?void 0:r.selectionInfo)||void 0===n?void 0:n.isAllRecords())&&a.push(g.REMOVE),a}handleAddGridMode(){return this.enableGridInsert?g.GRID_MODE:""}buildInvisibleButtons(){const i=[];return this.dataState&&this.dataState.selectionInfo.mode===p.ALL_RECORDS&&i.push(g.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=v.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=>v.getDetailName(i)));return`${this.entityPath}/${e.join("/")}/${t}`}return`${this.entityPath}/${t}`}getContent(){var i,t,s,r,n;if(!this.selectedGuide)return;const a=this.selectedGuide.id;let d;const o=a.split("::"),h=o.pop(),l=v.getDetailName(h);let u=a;if(l||o.length>0){let t,s;if(a.includes(b)){[u,t]=a.split(b);const e=(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)||0;s=e>1?this._breadcrumbItems[e-2]:this.selectedGuide}else s=this.selectedGuide;d=this.wrapDetail(o,e("snk-detail-view",{ref:i=>this._currentDetail=i,dataUnitName:this.getDataUnitName(o,l),onSnkDetailGuidesChange:i=>this.updateGuide(i.detail),entityName:l,selectedForm:t,branchGuide:s,guideItemPath:this._breadcrumbItems,key:`detail${u}`,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}))}else{const i=this.selectedGuide.id,o=this._masterFormMetadata.getSheet(i);if(o){const h=null===(s=null===(t=this.masterFormConfig)||void 0===t?void 0:t.cardsState)||void 0===s?void 0:s.get(i);d=e("snk-form-view",{ref:i=>this._mainForm=i,fixed:null==h?void 0:h.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:o.label,fields:o.fields,dataUnit:this.dataUnit,formMetadata:this._masterFormMetadata,recordsValidator:this.recordsValidator,fieldToFocus:this._fieldToGetFocus,key:a,onSnkRequestClearFieldToFocus:()=>this.clearFieldToFocusHandler(),customEditors:this._customEditors,fieldsProps:this._fieldsProps,fieldSearch:this._fieldSearch},this.presentationMode==k.SECONDARY&&this.buildTaskBar())}}return d}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 m.GRID}changeConfigViewMode(i){this._currentDetail&&this._currentDetail.changeViewMode(i)}openConfig(i){this._snkConfigurator.close(),this._currentDetail&&(i===m.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 l(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=f(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!=k.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)?g.SAVE:g.INSERT,"data-taskbar-owner":"master",dataUnit:this.dataUnit,resourceID:this.resourceID,customSlotId:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS",alignRigth:!0},e("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"})))}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(", ")}]`}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(w,(async()=>{this._mainForm&&await this._mainForm.showSearchField()}),{description:this.getMessage("snkSimpleCrud.findFields"),element:this._element})}render(){var i,t;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});if(!this.dataUnit||!this._configManager.isLoaded)return;this.loadTaskbarProcessor();const s=this._guides&&this._guides.length>1;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===(i=this._breadcrumbItems)||void 0===i?void 0:i.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!=k.SECONDARY&&this.buildTaskBar()),e("div",{class:"snk-guides-viewer__container"},s?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===(t=this.selectedGuide)||void 0===t?void 0:t.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}))}get _element(){return r(this)}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observeDataState"],masterFormConfig:["observeMasterFormConfig"]}}};var C;!function(i){i.FINISH_EDITION="snkGuideViewer.finish_edition",i.MUTIPLE_EDITION="snkGuideViewer.multiple_edition",i.REGULAR="snkGuideViewer.regular"}(C||(C={})),_.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-d8d8169b.js";import{ObjectUtils as n,StringUtils as a,Action as d,KeyboardManager as o,ElementIDUtils as h}from"@sankhyalabs/core";import{S as l}from"./p-658f67a5.js";import{buildFormMetadata as u,FormMetadata as v}from"@sankhyalabs/ezui/dist/collection/utils/form";import{T as c}from"./p-1a0caadb.js";import{T as g}from"./p-b987e15d.js";import{V as m}from"./p-9019a32f.js";import"./p-d75a732c.js";import"./p-bf017a1f.js";import{P as k}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-9062d640.js";import"./p-ff1990ad.js";import"./p-8d256def.js";import{SelectionMode as p}from"@sankhyalabs/core/dist/dataunit/DataUnit";import{buildFieldSearch as f,SHORTCUT_SEARCH_FIELD as w}from"@sankhyalabs/ezui/dist/collection/utils";const b="__FORM:",_=class{constructor(e){i(this,e),this.snkMasterFormConfigChange=t(this,"snkMasterFormConfigChange",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._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)}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(){this._container.focus()}exitViewer(){!this.enableGridInsert&&this.dataUnit.isDirty()?this.dataUnit.cancelEdition({after:()=>this.exit.emit()}):this.exit.emit()}onActionClick(i){i.detail===g.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=u(this.masterFormConfig,this.dataUnit,!0);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),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!=v.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]=[g.CANCEL,g.SAVE,this.handleAddGridMode()],i[C.MUTIPLE_EDITION]=[g.CANCEL],this._taskbarProcessor=new c(i),this._taskbarProcessor.process(this.getTaskBarId(),this.taskbarManager,this.dataState,this.buildDisabledButtons(),this.buildInvisibleButtons())}buildBtnsRegularMode(){var i,t;const e=[g.ATTACH,g.CLONE,g.REMOVE,g.MORE_OPTIONS,g.ACTIONS_BUTTON,g.DIVIDER,g.GRID_MODE,g.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(g.PREVIOUS,g.NEXT,g.DIVIDER),this.presentationMode==k.SECONDARY?e.unshift(g.INSERT):e.push(g.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(g.PREVIOUS),(null===(t=this.dataState)||void 0===t?void 0:t.hasNext)||a.push(g.NEXT),(null===(s=null===(e=this.dataState)||void 0===e?void 0:e.selectionInfo)||void 0===s?void 0:s.length)>1&&a.push(g.CLONE),(null===(n=null===(r=this.dataState)||void 0===r?void 0:r.selectionInfo)||void 0===n?void 0:n.isAllRecords())&&a.push(g.REMOVE),a}handleAddGridMode(){return this.enableGridInsert?g.GRID_MODE:""}buildInvisibleButtons(){const i=[];return this.dataState&&this.dataState.selectionInfo.mode===p.ALL_RECORDS&&i.push(g.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=v.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=>v.getDetailName(i)));return`${this.entityPath}/${e.join("/")}/${t}`}return`${this.entityPath}/${t}`}getContent(){var i,t,s,r,n;if(!this.selectedGuide)return;const a=this.selectedGuide.id;let d;const o=a.split("::"),h=o.pop(),l=v.getDetailName(h);let u=a;if(l||o.length>0){let t,s;if(a.includes(b)){[u,t]=a.split(b);const e=(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)||0;s=e>1?this._breadcrumbItems[e-2]:this.selectedGuide}else s=this.selectedGuide;d=this.wrapDetail(o,e("snk-detail-view",{ref:i=>this._currentDetail=i,dataUnitName:this.getDataUnitName(o,l),onSnkDetailGuidesChange:i=>this.updateGuide(i.detail),entityName:l,selectedForm:t,branchGuide:s,guideItemPath:this._breadcrumbItems,key:`detail${u}`,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}))}else{const i=this.selectedGuide.id,o=this._masterFormMetadata.getSheet(i);if(o){const h=null===(s=null===(t=this.masterFormConfig)||void 0===t?void 0:t.cardsState)||void 0===s?void 0:s.get(i);d=e("snk-form-view",{ref:i=>this._mainForm=i,fixed:null==h?void 0:h.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:o.label,fields:o.fields,dataUnit:this.dataUnit,formMetadata:this._masterFormMetadata,recordsValidator:this.recordsValidator,fieldToFocus:this._fieldToGetFocus,key:a,onSnkRequestClearFieldToFocus:()=>this.clearFieldToFocusHandler(),customEditors:this._customEditors,fieldsProps:this._fieldsProps,fieldSearch:this._fieldSearch},this.presentationMode==k.SECONDARY&&this.buildTaskBar())}}return d}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 m.GRID}changeConfigViewMode(i){this._currentDetail&&this._currentDetail.changeViewMode(i)}openConfig(i){this._snkConfigurator.close(),this._currentDetail&&(i===m.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 l(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=f(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!=k.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)?g.SAVE:g.INSERT,"data-taskbar-owner":"master",dataUnit:this.dataUnit,resourceID:this.resourceID,customSlotId:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS",alignRigth:!0},e("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"})))}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(", ")}]`}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(w,(async()=>{this._mainForm&&await this._mainForm.showSearchField()}),{description:this.getMessage("snkSimpleCrud.findFields"),element:this._element})}render(){var i,t;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});if(!this.dataUnit||!this._configManager.isLoaded)return;this.loadTaskbarProcessor();const s=this._guides&&this._guides.length>1;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===(i=this._breadcrumbItems)||void 0===i?void 0:i.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!=k.SECONDARY&&this.buildTaskBar()),e("div",{class:"snk-guides-viewer__container"},s?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===(t=this.selectedGuide)||void 0===t?void 0:t.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}))}get _element(){return r(this)}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observeDataState"],masterFormConfig:["observeMasterFormConfig"]}}};var C;!function(i){i.FINISH_EDITION="snkGuideViewer.finish_edition",i.MUTIPLE_EDITION="snkGuideViewer.multiple_edition",i.REGULAR="snkGuideViewer.regular"}(C||(C={})),_.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}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import{r as t,c as e,h as i,H as s,g as n}from"./p-d8d8169b.js";import{DateUtils as r,StringUtils as a,ObjectUtils as o,WaitingChangeException as h,SilentException as l,WarningException as c,ErrorException as d,ElementIDUtils as u,SearchUtils as p,ArrayUtils as m,KeyboardManager as g,OnboardingUtils as w,DependencyType as y,ApplicationContext as v,DataType as f,ErrorTracking as P,UserAgentUtils as k,LockManager as z,LockManagerOperation as _}from"@sankhyalabs/core";import{ApplicationUtils as x}from"@sankhyalabs/ezui/dist/collection/utils";import{C as A}from"./p-c71dcb2d.js";import{d as S,D as b,U as I,S as T}from"./p-d75a732c.js";import{A as N,a as L}from"./p-c98e2085.js";import{P as E,D as C}from"./p-9062d640.js";import{P as O}from"./p-bf017a1f.js";import{T as D}from"./p-9019a32f.js";import"./p-0f3698af.js";import"./p-ff1990ad.js";import{F as R}from"./p-8d256def.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class M{static webConnectionCaller(t,e,i){var s;null===(s=window.AppletCaller)||void 0===s||s.webConnectionCaller(t,e,i)}}const F=U;function U(t,e){const i=$();return(U=function(t){return i[t-=378]})(t,e)}function $(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return($=function(){return t})()}!function(){const t=U,e=$();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class j{[F(397)](t){const e=F;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const i=new H("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>i.putAccess(t[e(382)],String(t.status)==e(398)))),i}}class H{constructor(t){const e=F;this.isSup=t,this[e(384)]={}}[F(378)](t,e){this[F(384)][t]=e}[F(393)](t){const e=F;if(this[e(402)])return!0;let i=!0;return this[e(384)][e(380)](t)&&(i=this.actions[t]),i}isUserSup(){return this.isSup}}class B{constructor(){this._embeddedParams=new Map,this._cachedParams=new Map,this.templateByQuery=new Map;try{if(null!=window.MGE_PARAMS){atob(window.MGE_PARAMS).split("__;__").forEach((t=>{const[e,i]=t.split("__=__");this._embeddedParams.set(e,i)}))}}catch(t){console.error("Problemas ao obter parâmetros embarcados"),console.error(t)}this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",S.gql`query($name: String!) {
|
2
|
+
$queryAlias$: fetchResource(name: $name){
|
3
|
+
name
|
4
|
+
resource
|
5
|
+
}
|
6
|
+
}`)}async getParam(t){if(this._embeddedParams.has(t))return Promise.resolve(this._embeddedParams.get(t));if(this._cachedParams.has(t))return this._cachedParams.get(t);const e=`param://application?params=${t}`,i=await b.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchParam")});return this._cachedParams.set(t,i),i}async asString(t){const e=await this.getParam(t);return this.getValue(e)}async asInteger(t){const e=await this.getParam(t);return parseInt(this.getValue(e))}async asFloat(t){const e=await this.getParam(t);return parseFloat(this.getValue(e))}async asBoolean(t){const e=await this.getParam(t);return"S"===this.getValue(e)}async asDate(t){const e=await this.getParam(t);return r.strToDate(this.getValue(e))}async getBatchParams(t){const e=await this.getParam(t.join(",")),i={};return e.forEach((t=>i[t.name]=t.resource)),i}getValue(t={}){if(Array.isArray(t)&&t.length>0&&(t=t[0]),"string"==typeof t)return t;if(a.isEmpty(t.resource))return"";try{const e=o.stringToObject(t.resource),[i]=Object.keys(e);return e[i]}catch(t){console.warn("Erro ao converter string JSON.")}}}class q{constructor(){this.templateByQuery=new Map,this.cancel=[],this.buildTemplates()}buildTemplates(){this.templateByQuery.set("fetchTotals",S.gql`query($filters: [InputFilter!] $name: String!) {
|
7
|
+
$queryAlias$: fetchTotals(name: $name, filters: $filters ){
|
8
|
+
name
|
9
|
+
value
|
10
|
+
}
|
11
|
+
}`)}fetchTotals(t,e,i=[]){const s=`${t}_${e}`,n=this.cancel.findIndex((t=>t[s]));return n>=0&&(this.cancel[n][s](),this.cancel.splice(n,1)),Promise.race([new Promise((t=>this.cancel.push({[s]:t}))),this.getTotals(t,e,i)]).then((t=>{let e=new Map;if(t){e=t;const i=this.cancel.findIndex((t=>t[s]));i>=0&&this.cancel.splice(i,1)}return e}))}getTotals(t,e,i=[]){return new Promise(((s,n)=>{b.get().callGraphQL({query:this.templateByQuery.get("fetchTotals"),values:{name:`totals://${t}/${e}`,filters:i}}).then((t=>{if(t.length>0){const e=new Map;return t.forEach((t=>e.set(t.name,parseFloat(t.value)))),s(e)}return n("Não foi possível recuperar os totalizadores")})).catch(n)}))}}var K;class V{static openAppActivity(t,e){var i;null===(i=window.workspace)||void 0===i||i.openAppActivity(t,e)}static getAppLabel(t){if(null!=(null===window||void 0===window?void 0:window.workspace))return null==window.workspace.getAppLabel&&(window.workspace.getAppLabel=t=>(t||"").split(".").pop()),window.workspace.getAppLabel(t)}static setScreenToUseV3Layout(){var t;null===(t=window.workspace)||void 0===t||t.setScreenToUseV3Layout()}static setScreenToUseOldLayout(){var t;null===(t=window.workspace)||void 0===t||t.setScreenToUseOldLayout()}static showDesktop(){var t,e;null===(e=null===(t=window.workspace)||void 0===t?void 0:t.showDesktop)||void 0===e||e.call(t)}static searchApp(){var t,e;null===(e=null===(t=window.workspace)||void 0===t?void 0:t.searchApp)||void 0===e||e.call(t)}static openHelp(){var t,e;null===(e=null===(t=window.workspace)||void 0===t?void 0:t.openHelp)||void 0===e||e.call(t)}static applicationClick(){var t,e;(null===(t=window.workspace)||void 0===t?void 0:t.applicationClick)&&(null===(e=window.workspace)||void 0===e||e.applicationClick())}}V.resourceID=null===(K=window.workspace)||void 0===K?void 0:K.resourceID;class W{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}getMessage(t,e){return this._app.messagesBuilder.getMessage(t,e)}rejectionHandler(t){const e=t.reason;e instanceof h||(e?this.processException(e):this._app.isDebugMode().then((t=>{t&&this._app.error(this.getMessage("snkErrorHandler.title.promiseRejected"),this.getMessage("snkErrorHandler.message.undeterminedPromiseRejection"))})))}errorHandler(t){this.processException(t.error)}buildErrorCodeHTML(t){return`<br><a href="#" onclick="try{window.workspace.openHelp('_tbcode:${t}')} catch(e){alert('${this.getMessage("snkErrorHandler.message.cannotOpenHelp")}');}">${this.getMessage("snkErrorHandler.errorCode.label")}${t}</a>`}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t.errorCode)),t instanceof l?console.warn(this.getMessage("snkErrorHandler.message.silentExceptionIgnored"),t):t instanceof h||t instanceof c?this._app.alert(t.title,t.message):t instanceof d?this._app.error(t.title,t.message):this._app.isDebugMode().then((e=>{if(e)if(t instanceof Error)this._app.error(t.name,t.message);else{const e=(null==t?void 0:t.title)||this.getMessage("snkErrorHandler.title.errorDetected",void 0),i="string"==typeof t?t:t.message||`${this.getMessage("snkErrorHandler.error.internal")} "${o.objectToString(t)}"`;this._app.error(e,i)}}))}}class G{constructor(){this._debounceTime=1500,this.requests=new Map,this.requestsLoadingBar=[]}onRequestStart(t){if(t.url.includes("quietMode=true"))return;this.requestsLoadingBar.push(t.requestId);const e=setTimeout((()=>{this.ezLoadingBar.show()}),this._debounceTime);this.requests.set(t.requestId,e)}onRequestEnd(t){var e,i,s;const n=this.requests.get(t.requestId);clearTimeout(n),(null===(e=this.requestsLoadingBar)||void 0===e?void 0:e.includes(t.requestId))&&(this.requestsLoadingBar=null===(i=this.requestsLoadingBar)||void 0===i?void 0:i.filter((e=>e!==t.requestId)),!this.requestsLoadingBar.length&&(null===(s=this.ezLoadingBar)||void 0===s||s.hide()))}}class J{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.ezLoadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.ezLoadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){if(null==t)return!1;if(t.url.includes("quietMode=true"))return!0;if(null==t.requestBody)return!1;if(1==t.requestBody.length){const{name:e}=t.requestBody[0].variables;if(e){const t=e.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class Y{static create({strategy:t}){switch(t){case"request_name":return new J;case"request_time":return new G;default:throw new Error("Strategy not found")}}}const Z=["<img","<svg"];class X{constructor(){this._config=null,this.listeners=[]}static getInstance(){return X.instance||(X.instance=new X),X.instance}get config(){return this._config}setConfig(t){this._config=t,this.notifyListeners()}onConfigChange(t){this.listeners.push(t)}notifyListeners(){this.listeners.forEach((t=>t(this._config)))}}const Q=class{constructor(i){t(this,i),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7),this.NEW_VERSION_POPUP_LOCKER="NEW_VERSION_POPUP_LOCKER",this.FEATURE_FLAG_CACHE_DURATION=36e5,this._authPromises=[],this._keyboardManager=new g,this._waitingAppReady=new Array,this._duCache=new Map,this._duPromises=new Map,this._requestListener=Y.create({strategy:"request_time"}),this._maxTimerAppLoading=1e4,this._featureFlagsCache=new Map,this._isBrowserTypeElectron=!1,this._pendingActions=new Map,this._loadPkParameter=null,this._isLoadedByPk=!1,this._formConfigFetcher=new R,this._LayoutFormConfigSingleton=X.getInstance(),this._applicationReady=!1,this._templateSkeleton=D.GRID,this._activeScrimWindow=!1,this.enableLockManagerLoadingApp=void 0,this.messagesBuilder=void 0,this.configName=void 0,this.gridLegacyConfigName=void 0,this.formLegacyConfigName=void 0,this.loadByPK=void 0}async processPendingActions(t){const e=this._pendingActions.get(t);e&&e.length&&(e.forEach((t=>t())),this._pendingActions.set(t,[]))}get parameters(){return this._parameters||(this._parameters=new B),this._parameters}async getAuth(t){return null==t?this.getApplicationAuth():new Promise(((e,i)=>{this.authFetcher.getData(t).then((t=>{e(t)})).catch((t=>{i(t)}))}))}async getApplicationAuth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,e)=>{const i=this._authPromises.length>0;this._authPromises.push(new tt(t,e)),i||this.authFetcher.getData(this.applicationResourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}watchPropHandler(t,e){t&&this._loadPkParameter&&(this.loadByPK(this._loadPkParameter.pk,this._loadPkParameter.redirect),this._loadPkParameter=null)}async getKeyboardManager(){return Promise.resolve(this._keyboardManager)}async getLayoutFormConfig(){return Promise.resolve(this._LayoutFormConfigSingleton)}async isUserSup(){return new Promise(((t,e)=>{this.getAuth().then((i=>{this.getAuthList(i).then((e=>{t(e.isSup)})).catch((t=>e(t)))}))}))}async addPendingAction(t,e){var i;const s=null!==(i=this._pendingActions.get(t))&&void 0!==i?i:[];this._pendingActions.set(t,[...s,e])}async callServiceBroker(t,e,i){return b.get().callServiceBroker(t,e,i)}async initOnboarding(t){this.hasToShowNewVersionPopup()?await this.addPendingAction(this.NEW_VERSION_POPUP_LOCKER,(()=>this.doInitOnboarding(t))):this.doInitOnboarding(t)}doInitOnboarding(t){w.getInstance().init(t,window.envContext)}async hasAccess(t,e){return new Promise(((i,s)=>{this.getAuth(e).then((e=>{this.getAuthList(e).then((e=>{i(e.isSup||e.actions[t])})).catch((t=>s(t)))}))}))}async getAllAccess(t){return new Promise(((e,i)=>{this.getAuth(t).then((t=>{this.getAuthList(t).then((t=>{const i={};i.isSup=t.isSup,Object.entries(N).forEach((e=>{i[e[0]]=e[1]===N.CLONE?t.actions[N.INSERT]&&t.actions[N.CLONE]||!1:t.actions[e[1]]||!1})),e(i)})).catch((t=>i(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,e="full",i=!0,s){this.clearContent(this._popUp),this._popUp.addEventListener("ezClosePopup",(()=>{s()}),{once:!0}),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=e,this._popUp.useHeader=i,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}showAlerts(t){return x.showAlerts({alerts:t})}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const e=t.split(",");return new Promise(((t,i)=>{this.getAttributeFromHTMLWrapper("opc0009").then((s=>{"1"===s?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{i(t)}))})).catch((t=>{i(t)}))}))}async getConfig(t){let e={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,i)=>{b.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(e)).then((e=>{var i;return t(null===(i=e.config)||void 0===i?void 0:i.data)})).catch((t=>i(t)))}))}async isFeatureActive(t){const e=Date.now();let i={serviceName:"SystemUtilsSP.featureIsActive",requestBody:{featureName:t}};if(this._featureFlagsCache.get(t)&&e<this._featureFlagsCache.get(t).expires)return Promise.resolve(this._featureFlagsCache.get(t).isActive);const s=(await b.get().callServiceBroker("SystemUtilsSP.featureIsActive",JSON.stringify(i))).isActive;return this._featureFlagsCache.set(t,{isActive:s,expires:e+this.FEATURE_FLAG_CACHE_DURATION}),s}async saveConfig(t,e){let i={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:e}}};return new Promise(((t,e)=>{b.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(i)).then((e=>t(e))).catch((t=>e(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){V.openAppActivity(t,e)}async webConnection(t,e,i){this.getStringParam(t).then((t=>{M.webConnectionCaller(t,e,i)}))}getDuPromissesStack(t){let e;return t&&(e=this._duPromises.get(t),e||(e=[],this._duPromises.set(t,e))),e||[]}async createDataunit(t,e,i,s,n){return null==n&&(n=this.applicationResourceID),new Promise(((r,a)=>{const o=this.getDuPromissesStack(e),h=o.length>0;if(o.push(new tt(r,a)),!h){const r=this.dataUnitFetcher.getDataUnit(t,n,i,s);r.loadMetadata().then((()=>{this.processResolveDataUnit(r,e,o)})).catch((t=>{for(;o.length>0;)o.pop().reject(t)}))}}))}processResolveDataUnit(t,e,i){for(e&&this.updateDataunitCache(void 0,e,t);i.length>0;)i.pop().resolve(t)}async updateDataunitCache(t,e,i){t&&this._duCache.delete(t),this._duCache.set(e,i)}async getDataUnit(t,e,i,s,n){return new Promise(((r,a)=>{const o=this._duCache.get(e);o?r(o):this.createDataunit(t,e,i,s,n).then((t=>{r(t)})).catch((t=>a(t)))}))}async addClientEvent(t,e){return new Promise((i=>{b.addClientEvent(t,e),i()}))}async removeClientEvent(t){return new Promise((e=>{b.removeClientEvent(t),e()}))}async hasClientEvent(t){return new Promise((e=>{e(b.hasClientEvent(t))}))}get applicationResourceID(){return this._applicationResourceID||(this._applicationResourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||V.resourceID||"unknown.resource.id"),this._applicationResourceID}async getResourceID(){return Promise.resolve(this.applicationResourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,e,i,s){return x.alert(t,e,i,s)}async error(t,e,i,s){return x.error(t,e,i,s)}async success(t,e,i,s){return x.success(t,e,i,s)}async message(t,e,i,s){return x.message(t,e,i,s)}async confirm(t,e,i,s,n){return x.confirm(t,e,i,s,n)}async info(t,e){return x.info(t,e)}async loadTotals(t,e,i){return this.totalsFetcher.fetchTotals(t,e,i)}async isLoadedByPk(){return Promise.resolve(this._isLoadedByPk)}async preloadMangerRemoveRecord(t,e){const i=e.map((t=>({__record__id__:t})));E.removeRecords(t,i)}getCountSkeleton(t,e,i){i=i||160;const s=window.innerHeight-i;return Math.floor(s/(t+(e||10)))-1||1}getSkeletonRandomWidth(){return`${Math.floor(71*Math.random())+30}%`}async getAuthList(t){return await(new j).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=I.getQueryParams(location.search)),this._urlParams}getMessage(t,e){var i;return null===(i=this.messagesBuilder)||void 0===i?void 0:i.getMessage(t,e)}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new C),this._dataUnitFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new q),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new O),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new L),this._authFetcher}async executeSearch(t,e,i,s){const n=null==i?void 0:i.getField(e);if(n){const{mode:e,argument:r}=t,{ENTITYNAME:a,CODEFIELD:o,DESCRIPTIONFIELD:h,ROOTENTITY:l,DESCRIPTIONENTITY:c,ISHIERARCHYENTITY:d}=n.properties,u=n.dependencies;let p;const m={rootEntity:l,descriptionFieldName:h,codeFieldName:o,showInactives:!1,dataUnitId:i.dataUnitId};null==u||u.filter((t=>t.masterFields)).forEach((t=>{var e;t.type===y.SEARCHING&&(null===(e=t.masterFields)||void 0===e?void 0:e.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const e=i.getField(t),s=(null==e?void 0:e.dataType)||f.TEXT,n=i.getFieldValue(t);if(null==n)throw this.alert(this.getMessage("snkApplication.search.error.title"),this.getMessage("snkApplication.search.error.requiredField",{fieldLabel:e.label})),new Error(this.getMessage("snkApplication.search.error.requiredField",{fieldLabel:e.label}));return{name:t,value:n,dataType:s}}))})}));const g={entity:a,entityDescription:c,isHierarchyEntity:d,criteria:p,searchOptions:m,allowsNonAnalytic:null==s?void 0:s.allowsNonAnalytic};return(null==s?void 0:s.useSearchPlus)?this.executePreparedSearchPlus(e,r,g):this.executePreparedSearch(e,r,g)}}filterInvalidFields(t,e,i){return t.fieldsMetadata.filter((s=>{let n=!a.isEmpty(e[s.fieldName])&&!1!==s.visible&&"B"!==s.type&&t.pkField!==s.fieldName&&t.descriptionField!==s.fieldName&&(s.isPrimaryKey||!s.isLinkField)&&!("S"===s.type&&"H"===s.presentationType);return n&&(i[s.fieldName]=s),("string"!=typeof e[s.fieldName]||!(e[s.fieldName].indexOf("<img")>-1||e[s.fieldName].indexOf("<svg")>-1))&&n}))}filterMathFields(t,e,i,s){return t&&Array.isArray(t)&&t.forEach((t=>{let i=m.removeReference(e,s[t]);i&&e.unshift(i)})),e=e.slice(0,i)}builOptionItem(t,e,i,s,n){var r;return{value:a.highlightValue(t,e.__matchFields,null===(r=e[n])||void 0===r?void 0:r.toString(),i,!0),label:s?a.highlightValue(t,e.__matchFields,e[s],i,!0):"",details:p.buildDetails(t,i,e)}}async executePreparedSearchPlus(t,e,i){return await this.executePreparedSearch(t,e,Object.assign(Object.assign({},i),{useSearchPlus:!0}))}async executePreparedSearch(t,e,i){const s={},{entity:n,entityDescription:r,criteria:h,searchOptions:l,isHierarchyEntity:c,allowsNonAnalytic:d,useSearchPlus:g}=i;return g?(async(t,e,i,s,n)=>{var r;const h={},{entity:l,entityDescription:c,criteria:d,searchOptions:g,isHierarchyEntity:w,allowsNonAnalytic:y}=i;if("ADVANCED"===t)return new Promise(((t,i)=>{const r=document.createElement("snk-pesquisa");r[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${l}`,r.entityName=l,r.argument=e,r.searchLoader=t=>n.loadAdvancedSearch(l,t,d,g),r.isHierarchyEntity=w,w&&(r.treeLoader=t=>n.loadTree(l,t,d,g),r.allowsNonAnalytic=y),r.selectItem=e=>{t(e),s.clearPopUpTitle(),s.closePopUp()},s.setPopUpTitle(c),s.showPopUp(r,void 0,void 0,i)}));if("LOAD_DESCRIPTION"===t){let t=await n.loadByCode(l,e,d,g);t=o.stringToObject(t.json.$);const i=null===(r=t.data)||void 0===r?void 0:r[0];return i?{value:e,label:i[t.descriptionField]}:{value:e,label:""}}{let t,i=await n.loadAdvancedSearch(l,e,d,g,t);i=o.stringToObject(i.json.$);let s=i.descriptionField,r=i.pkField;return i.data.map((t=>{let n=((t,e,i)=>t.fieldsMetadata.filter((s=>{let n=!a.isEmpty(e[s.fieldName])&&!1!==s.visible&&"B"!==s.type&&t.pkField!==s.fieldName&&t.descriptionField!==s.fieldName&&(s.isPrimaryKey||!s.isLinkField)&&!("S"===s.type&&"H"===s.presentationType);return n&&(i[s.fieldName]=s),("string"!=typeof e[s.fieldName]||!Z.some((t=>e[s.fieldName].includes(t))))&&n})))(i,t,h),o=((t,e,i,s)=>(t&&Array.isArray(t)&&t.forEach((t=>{let i=m.removeReference(e,s[t]);i&&e.unshift(i)})),e=e.slice(0,i)))(t.__matchFields,n,6,h);return((t,e,i,s,n)=>{var r;const o=e.__matchFields,h=null!==(r=e[s])&&void 0!==r?r:"",l=e[n];return{value:l,label:h,presentationValue:a.highlightValue(t,o,l,i,!0),presentationLabel:s?a.highlightValue(t,o,h,i,!0):"",details:p.buildDetails(t,i,e)}})(e,t,o,s,r)}))}})(t,e,i,this,this.pesquisaFetcher):new Promise("ADVANCED"===t?(t,i)=>{const s=document.createElement("snk-pesquisa");s[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${n}`,s.entityName=n,s.argument=e,s.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(n,t,h,l),s.isHierarchyEntity=c,c&&(s.treeLoader=t=>this.pesquisaFetcher.loadTree(n,t,h,l),s.allowsNonAnalytic=d),s.selectItem=e=>{t(e),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(s,void 0,void 0,i)}:(t,i)=>{this.pesquisaFetcher.loadAdvancedSearch(n,e,h,l).then((i=>{let n=(i=o.stringToObject(i.json.$)).descriptionField,r=i.pkField;const a=[];i.data.forEach((t=>{let o=this.filterInvalidFields(i,t,s),h=this.filterMathFields(t.__matchFields,o,6,s);a.push(this.builOptionItem(e,t,h,n,r))})),t(a)})).catch((t=>{i(t)}))})}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return V.getAppLabel(this.applicationResourceID)}addSearchListener(t,e,i){return new Promise((s=>{s(this.pesquisaFetcher.addSearchListener(t,e.dataUnitId,i))}))}importScript(t){return new Promise((e=>{this.getApplicationPath().then((i=>{let s=[];Array.isArray(t)||(s=[t]),s.forEach((t=>{const e=document.createElement("script");e.src=`${i}/${t}`,e.async=!0,document.body.appendChild(e)})),e()}))}))}async getApplicationPath(){return new Promise((t=>{"dev"===window.applicationenv?t(""):t(`/${this.getModuleName()}/labsApps/${window.APPLICATION_NAME}/build`)}))}getModuleName(){return window.MGE_MODULE_NAME||"mgefin-bff"}executeSelectDistinct(t,e,i){return this.dataUnitFetcher.loadSelectDistinct(t,e,i)}getDataFetcher(){return Promise.resolve(b.get())}async whenApplicationReady(){return v.getContextValue("__SNK__APPLICATION__LOADING__")?Promise.resolve(this):new Promise((t=>{this._waitingAppReady.push((()=>t(this)))}))}async setSearchFilterContext(t,e){v.setContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${t})__`,e)}clearContent(t){t&&Array.from(t.children).forEach((e=>{t.removeChild(e)}))}async clearPopUpTitle(){this._popUp.ezTitle=""}async setPopUpTitle(t){this._popUp.ezTitle=t}async pkChangeListener(){const t=top.window.location.hash.split("/")[2];if(this._currentPkParameter===t)return;const e=this.getResourceIdFromToken(),i=I.getPkObjectFromUrlToken(top.window.location.hash),s=window.redirectFrom;if(void 0===i)return;if((!s||-1===s.split("_")[0].indexOf(e.split("_")[0]))&&e!==this.applicationResourceID)return;const n={pk:i};if(this._isLoadedByPk=!0,this.loadByPK)return this.loadByPK(n,s),void(this._currentPkParameter=t);this._loadPkParameter={pk:n,redirect:s},this.defaultLoadByPK(n,t)}getResourceIdFromToken(){var t;return(null===(t=top.window.location.pathname)||void 0===t?void 0:t.indexOf("tabContent.jsp"))>-1&&window.location.generateHash?I.getResourceIdFromUrlToken(window.location.generateHash(window.location.hash)):I.getResourceIdFromUrlToken(top.window.location.hash)}defaultLoadByPK(t,e){if(!(null==t?void 0:t.pk))return;const i=this.getFirstDataUnitFromDOM(),s=i.dataUnit;if(!s)return console.warn(this.getMessage("snkApplication.dataUnit.initDataUnitError")),void i.addEventListener("dataUnitReady",(i=>{this.loadDataWithPKFilter(t,i.detail),this._currentPkParameter=e}));this.loadDataWithPKFilter(t,s),this._currentPkParameter=e}loadDataWithPKFilter(t,e){const i={term:"",filter:{name:"LOAD_BY_PK_FILTER",expression:this.buildFilterExpressionByPkObject(t),params:this.getFilterParamsFromPkObject(t,e)}};e.loadData(i)}getFirstDataUnitFromDOM(){let t=this._element.querySelector("snk-data-unit[data-load-by-pk]");if(t||(t=this._element.querySelector("snk-data-unit")),t)return t}getFilterParamsFromPkObject(t,e){var i;const s=[];for(const n in t.pk)t.pk.hasOwnProperty(n)&&!Array.isArray(t.pk[n])&&s.push({name:n,dataType:(null===(i=e.getField(n))||void 0===i?void 0:i.dataType)||this.getDefaultDataTypeLoadByPK(t.pk[n]),value:t.pk[n]});return s}getDefaultDataTypeLoadByPK(t){return"number"==typeof t||t instanceof Number?f.NUMBER:"boolean"==typeof t||t instanceof Boolean?f.BOOLEAN:t instanceof Date?f.DATE:f.TEXT}buildFilterExpressionByPkObject(t){let e="";for(const i in t.pk)a.isEmpty(e)||(e+=" AND "),Array.isArray(t.pk[i])?e+=`${i} IN (${t.pk[i].toString()})`:e+=`${i} = :${i}`;return e}async showNewVersionPopup(){const t=document.createElement("ez-modal-container"),e=await this.getAppLabel();t.modalTitle=this.getMessage("snkApplication.newVersionPopup.title",{screenName:e}),t.okButtonLabel=this.getMessage("snkApplication.newVersionPopup.okButton"),t.cancelButtonLabel=this.getMessage("snkApplication.newVersionPopup.cancelButton");const i=document.createElement("p");i.innerText=this.getMessage("snkApplication.newVersionPopup.info"),i.className="ez-text",t.appendChild(i),t.addEventListener("ezModalAction",this.newVersionPopupEventListener.bind(this));const s=await x.showPopup({content:t});this._removeVersionLayoutPopup=async()=>{await s(),await this.processPendingActions(this.NEW_VERSION_POPUP_LOCKER)}}async newVersionPopupEventListener(t){"LOAD"!==t.detail&&("OK"===t.detail&&V.setScreenToUseV3Layout(),"CANCEL"===t.detail&&V.setScreenToUseOldLayout(),this._popUp.opened=!1,this._removeVersionLayoutPopup&&await this._removeVersionLayoutPopup())}async handleShowNewVersionPopup(){this.hasToShowNewVersionPopup()&&await this.showNewVersionPopup()}hasToShowNewVersionPopup(){const t=new URLSearchParams(window.location.search).get("firstLoadConv");return t&&"S"===t}registerPkChangeListener(){window.hasOwnProperty("onhashchange")?window.onhashchange=this.pkChangeListener.bind(this):setInterval(this.pkChangeListener.bind(this),100)}componentWillLoad(){v.setContextValue("__SNK__APPLICATION__LOADING__",!0),this._errorHandler=new W(this),this.messagesBuilder=new T,v.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${I.getUrlBase()}/mge/upload/file`),v.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,e,i,s)=>this.executeSearch(t,e,i,s))),v.setContextValue("__EZUI__SEARCH__PLUS__OPTION__LOADER__",((t,e,i,s)=>this.executeSearch(t,e,i,Object.assign(Object.assign({},s),{useSearchPlus:!0})))),this.registerPkChangeListener(),P.init(),A.preload(this.applicationResourceID,this.configName,{gridLegacyConfig:this.gridLegacyConfigName,formLegacyConfig:this.formLegacyConfigName}),document.addEventListener("click",(()=>V.applicationClick())),this._waitingAppReady.forEach((t=>t())),this.setLayoutFormConfig()}async setLayoutFormConfig(){const t=await this._formConfigFetcher.fetchLayoutFormConfig("formColCfg."+this.applicationResourceID),e=isNaN(Number(null==t?void 0:t.config))?null:Number(null==t?void 0:t.config);this._LayoutFormConfigSingleton.setConfig(e)}connectedCallback(){this._isBrowserTypeElectron=k.isElectron(),v.setContextValue("__SNK__APPLICATION__",this),b.addRequestListener(this._requestListener)}disconnectedCallback(){null==b||b.removeRequestListener(this._requestListener),this.removeShortcuts(),this._lockManagerTimer&&clearTimeout(this._lockManagerTimer),this._scrimWindowTimer&&clearTimeout(this._scrimWindowTimer)}async componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{v.setContextValue("__SNK__APPLICATION__LOADING__",!1),this.applicationLoaded.emit(!0),this.pkChangeListener()})),u.addIDInfo(this._element,`resource_${this.applicationResourceID}`),await this.handleShowNewVersionPopup(),this.initKeyboardManager(),this.enableLockManagerLoadingApp?(z.addLockManagerCtxId(this._element),this.resolveApplicationReady()):this._applicationReady=!0}async showScrimApp(t){if(!this.enableLockManagerLoadingApp||!this._applicationReady||!t)return this._activeScrimWindow=!1,void(this._scrimWindowTimer&&clearTimeout(this._scrimWindowTimer));this._activeScrimWindow=!0,this._scrimWindowTimer=setTimeout((async()=>{this._activeScrimWindow&&(this._activeScrimWindow=!1,clearTimeout(this._scrimWindowTimer))}),this._maxTimerAppLoading)}async changeTemplateSkeleton(t){this._templateSkeleton=t||this._templateSkeleton}async markToReload(t){this.enableLockManagerLoadingApp&&(await this.changeTemplateSkeleton(t),this._applicationReady=!1,await z.resetLocks(this._element,_.APP_LOADING),this.resolveApplicationReady())}async addLoadingLock(t=!1,e){if(this.enableLockManagerLoadingApp)return await this.changeTemplateSkeleton(e),t&&(this._applicationReady=!1,this._activeScrimWindow=!!this._applicationReady,await z.resetLocks(this._element,_.APP_LOADING)),this.resolveApplicationReady(),await z.lock(this._element,_.APP_LOADING)}async resolveApplicationReady(){if(!this._applicationReady)try{await this.checkTimeoutLimitLockManager(),await z.whenHasLock(this._element,_.APP_LOADING),await z.whenResolve(this._element,_.APP_LOADING,200),await z.resetLocks(this._element,_.APP_LOADING),this._applicationReady=!0}catch(t){console.warn(t),this._applicationReady=!0}}stopTimeoutLockManager(){this._lockManagerTimer&&clearTimeout(this._lockManagerTimer)}async checkTimeoutLimitLockManager(){this.stopTimeoutLockManager(),this._applicationReady||(this._lockManagerTimer=setTimeout((async()=>{this._applicationReady||(await z.resetLocks(this._element,_.APP_LOADING),this.stopTimeoutLockManager(),this._applicationReady=!0)}),this._maxTimerAppLoading))}initKeyboardManager(){this._keyboardManager.bind("ctrl + g",V.searchApp.bind(this),{description:this.getMessage("snkApplication.keyboard.shortcuts.searchApp")}).bind("ctrl + d",V.showDesktop.bind(this),{description:this.getMessage("snkApplication.keyboard.shortcuts.showDesktop")}).bind("F1",V.openHelp.bind(this),{description:this.getMessage("snkApplication.keyboard.shortcuts.openHelp")})}removeShortcuts(){this._keyboardManager.unbindAllShortcutKeys()}renderLoadingSkeleton(){if(this.enableLockManagerLoadingApp){if(this._isBrowserTypeElectron)return this.getSpinnerLoadingDefault();switch(this._templateSkeleton){case D.CUSTOM_TEMPLATE:case D.GRID:return this.getSkeletonTemplateGrid();case D.GRID_WITH_SIDEBAR:return this.getSkeletonTemplateGridWithSidebar();case D.GRID_WITH_PANEL:return this.getSkeletonTemplateGridWithPanel();case D.FORM_WITH_SIDEBAR:return this.getSkeletonTemplateFormWithSidebar();default:return this.getSkeletonTemplateGrid()}}}getLoadingVisibilityStyle(){return{visibility:this._applicationReady?"hidden":"initial",display:this._applicationReady?"none":"unset"}}getSkeletonTemplateGrid(){return i("div",{class:"loading-hidden",style:this.getLoadingVisibilityStyle()},i("div",{class:"ez-flex ez-flex--column ez-margin--large ez-margin-top--medium"},i("div",{class:"ez-margin-bottom--medium"},i("ez-skeleton",{count:1,variant:"text",width:"20%",height:"35px",animation:"progress"})),i("div",{class:""},i("ez-skeleton",{count:1,variant:"text",width:"70%",height:"25px",animation:"progress"}))),i("div",{class:"ez-flex ez-flex--justify-start skeleton-content-column ez-margin-horizontal--large",style:{height:"calc(-105px + 100vh)"}},[1,2,3,4].map(((t,e)=>i("div",{class:"ez-margin-right--large",key:e,style:{width:"25%"}},i("ez-skeleton",{count:this.getCountSkeleton(50,10),variant:"text",width:"100%",height:"50px",animation:"progress",marginBottom:"10px"}))))))}getSkeletonTemplateGridWithSidebar(){return i("div",{class:"loading-hidden",style:this.getLoadingVisibilityStyle()},i("div",{class:"ez-flex ez-flex--column ez-margin--large ez-margin-top--medium"},i("div",{class:"ez-margin-bottom--medium"},i("ez-skeleton",{count:1,variant:"text",width:"20%",height:"35px",animation:"progress"})),i("div",{class:""},i("ez-skeleton",{count:1,variant:"text",width:"70%",height:"25px",animation:"progress"}))),i("div",{class:"ez-flex ez-flex--justify-start skeleton-content-column ez-margin-horizontal--large",style:{height:"calc(100vh - 160px)"}},i("div",{class:"ez-flex ez-flex--column ez-margin-right--large",style:{width:"25%",overflow:"hidden"}},Array(this.getCountSkeleton(30,6)).fill(null).map(((t,e)=>i("ez-skeleton",{key:e,count:1,variant:"text",width:this.getSkeletonRandomWidth(),height:"30px",animation:"progress",marginBottom:"10px"})))),i("div",{class:"ez-margin-right--large",style:{width:"75%"}},i("ez-skeleton",{count:this.getCountSkeleton(50,10),variant:"text",width:"100%",height:"50px",animation:"progress",marginBottom:"10px"}))))}getSkeletonTemplateGridWithPanel(){return i("div",{class:"loading-hidden",style:this.getLoadingVisibilityStyle()},i("div",{class:"ez-margin--medium ez-margin-top--medium ez-padding--medium"},i("ez-skeleton",{count:1,variant:"text",width:"70%",height:"25px",animation:"progress"})),i("div",{class:"ez-flex ez-margin--medium ez-margin-top--medium",style:{maxHeight:"calc(-105px + 100vh)",overflow:"hidden"}},i("div",{class:"",style:{width:"70%",overflow:"hidden"}},i("div",{class:"ez-padding--medium",style:{height:"50%"}},i("ez-skeleton",{count:1,variant:"text",width:"100%",height:"100%",animation:"progress"})),i("div",{class:"ez-padding--medium",style:{}},i("ez-skeleton",{count:1,variant:"text",width:"250px",height:"25px",animation:"progress"})),i("div",{class:"ez-flex ez-padding--medium",style:{height:"45%"}},[1,2].map((()=>i("div",{style:{width:"50%"}},i("ez-skeleton",{count:1,variant:"text",width:"100%",height:"100%",animation:"progress"})))))),i("div",{class:"ez-flex ez-flex--column ez-padding--medium",style:{width:"30%",overflow:"hidden"}},Array(this.getCountSkeleton(30,10)).fill(null).map(((t,e)=>i("ez-skeleton",{key:e,count:1,variant:"text",width:"100%",height:"50px",animation:"progress",marginBottom:"10px"}))))))}getSkeletonTemplateFormWithSidebar(){return i("div",{class:"loading-hidden",style:this.getLoadingVisibilityStyle()},i("div",{class:"ez-margin--medium ez-margin-top--medium ez-padding--medium"},i("ez-skeleton",{count:1,variant:"text",width:"70%",height:"25px",animation:"progress"})),i("div",{class:"ez-flex ez-margin--medium ez-margin-top--medium",style:{maxHeight:"calc(-105px + 100vh)",overflow:"hidden"}},i("div",{class:"ez-flex ez-flex--column ez-margin-right--large",style:{width:"25%",overflow:"hidden"}},Array(this.getCountSkeleton(30,6)).fill(null).map(((t,e)=>i("ez-skeleton",{key:e,count:1,variant:"text",width:this.getSkeletonRandomWidth(),height:"30px",animation:"progress",marginBottom:"10px"})))),i("div",{class:"ez-flex ez-flex--column",style:{width:"75%"}},i("div",{class:"ez-padding--medium",style:{width:"100%"}},i("ez-skeleton",{count:1,variant:"text",width:"30%",height:"25px",animation:"progress"})),i("div",{class:"ez-padding--medium",style:{height:"45%"}},i("div",{class:"ez-flex",style:{width:"100%",height:"100%"}},[1,2,3,4].map(((t,e)=>i("div",{key:e,class:"ez-padding-right--large",style:{width:"25%",overflow:"hidden"}},Array(this.getCountSkeleton(50,20)).fill(null).map(((t,e)=>i("ez-skeleton",{key:e,count:1,variant:"text",width:"100%",height:"50px",animation:"progress",marginBottom:"10px"})))))))),i("div",{class:"ez-padding--medium",style:{width:"100%"}},i("ez-skeleton",{count:1,variant:"text",width:"30%",height:"25px",animation:"progress"})),i("div",{class:"ez-padding--medium",style:{height:"45%"}},i("div",{class:"ez-flex",style:{width:"100%",height:"100%"}},[1,2,3,4].map(((t,e)=>i("div",{key:e,class:"ez-padding-right--large",style:{width:"25%",overflow:"hidden"}},Array(this.getCountSkeleton(50,20)).fill(null).map(((t,e)=>i("ez-skeleton",{key:e,count:1,variant:"text",width:"100%",height:"50px",animation:"progress",marginBottom:"10px"})))))))))))}getSpinnerLoadingDefault(){return i("div",{class:"loading-hidden",style:this.getLoadingVisibilityStyle()},i("div",{class:"ez-flex ez-size-height--full ez-size-width--full ez-flex--justify-center ez-flex--align-items-center spinner"},i("ez-icon",{iconName:"sync",size:"x-large",class:"spin"}),i("span",{class:"ez-title ez-title--secondary ez-title--extra-large"},this.getMessage("snkApplication.loading.text"))))}render(){return i(s,{style:{visibility:!this.enableLockManagerLoadingApp||this._applicationReady?"unset":"hidden",overflow:!this.enableLockManagerLoadingApp||this._applicationReady?"unset":"hidden"}},i("div",null,i("ez-loading-bar",{ref:t=>this._requestListener.ezLoadingBar=t}),i("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),i("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}),this.renderLoadingSkeleton(),this._activeScrimWindow&&i("div",{class:"ez-scrim ez-scrim--light",style:{cursor:"progress",zIndex:"var(--scrim-z-index)"}})))}get _element(){return n(this)}static get watchers(){return{loadByPK:["watchPropHandler"]}}};class tt{constructor(t,e){this.resolve=t,this.reject=e}}Q.style=".sc-snk-application-h{--scrim-z-index:var(--elevation--100, 100);display:flex;flex-direction:column;height:100%}.sc-snk-application-h>.loading-hidden.sc-snk-application{display:none;pointer-events:none}.skeleton-content-left.sc-snk-application{width:300px;padding-right:5px}.skeleton-content.sc-snk-application{height:calc(100vh - 310px)}.spinner.sc-snk-application{height:100vh;gap:10px}.spinner.sc-snk-application>.spin.sc-snk-application{animation-name:spin;animation-duration:5000ms;animation-iteration-count:infinite;animation-timing-function:linear}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}";export{Q as snk_application}
|
@@ -1 +1 @@
|
|
1
|
-
import{h as e}from"./p-d8d8169b.js";import{P as a}from"./p-0f3698af.js";import{s as t}from"./p-
|
1
|
+
import{h as e}from"./p-d8d8169b.js";import{P as a}from"./p-0f3698af.js";import{s as t}from"./p-55798617.js";var n,r,s;!function(e){e.PREVIOUS="PREVIOUS",e.NEXT="NEXT",e.REFRESH="REFRESH",e.UPDATE="UPDATE",e.CLONE="CLONE",e.REMOVE="REMOVE",e.INSERT="INSERT",e.CANCEL="CANCEL",e.SAVE="SAVE",e.GRID_MODE="GRID_MODE",e.FORM_MODE="FORM_MODE",e.MORE_OPTIONS="MORE_OPTIONS",e.DIVIDER="DIVIDER",e.CONFIGURATOR="CONFIGURATOR",e.DATA_EXPORTER="DATA_EXPORTER",e.ATTACH="ATTACH",e.ACTIONS_BUTTON="ACTIONS_BUTTON",e.UPDATE_MULTIPLE="UPDATE_MULTIPLE"}(n||(n={})),function(e){e.UPDATE="UPDATE",e.CLONE="CLONE",e.REMOVE="REMOVE",e.INSERT="INSERT",e.CONFIGURATOR="CONFIGURATOR"}(r||(r={})),function(e){e.CONFIGURATOR="CONFIGURATOR"}(s||(s={}));const i=(e,a,t,n,r)=>{const{hint:s,text:i,iconName:l}=e;return l?i?o(l,e.name,a,t,s,i,n,r):d(l,e.name,a,t,s,n,r):c(e.name,a,t,i,s,n,r)},l=(r,s,i,l,u,b,m,k,E)=>{var O;const T=l(r);switch(r){case n.PREVIOUS:return d("chevron-left",r,s,i,T,u,b);case n.NEXT:return d("chevron-right",r,s,i,T,u,b);case n.REFRESH:return d("sync",r,s,i,T,u,b);case n.UPDATE:return d("edit",r,s,i,T,u,b);case n.UPDATE_MULTIPLE:return d("edit-table",r,s,i,T,u,b);case n.CLONE:return d("copy",r,s,i,T,u,b);case n.REMOVE:return d("delete",r,s,i,T,u,b);case n.INSERT:return E===a.PRIMARY?o("plus",r,s,i,T,T,u,b):d("plus",r,s,i,T,u,b);case n.CANCEL:return c(r,s,i,T,T,u,b);case n.SAVE:return E===a.PRIMARY?o("save",r,s,i,T,T,u,b):d("save",r,s,i,T,u,b);case n.GRID_MODE:return d("table",r,s,i,T,u,b);case n.FORM_MODE:return d("list",r,s,i,T,u,b);case n.CONFIGURATOR:return(null==m?void 0:m.length)>0?function(a,t,n,r,s,i,l,c){return l&&l.length>0?e("taskbar-split-button",{iconName:a,class:n,key:s,"data-taskbar-icon":a,"data-taskbar-label":r,"data-taskbar-element":t,"data-element-id":s,enabled:i(t),actions:l,title:r,action:()=>c(t)}):void 0}("settings-inverted",r,s,T,i,b,m,u):d("settings-inverted",r,s,i,T,u,b);case n.MORE_OPTIONS:return function(a,t,n,r,s,i,l){return i&&i.length>0?e("taskbar-actions-button",{class:t,key:n,title:r,"data-taskbar-element":a,"data-element-id":n,enabled:s(a),actions:i,onTaskbarActionSelected:e=>l(e.detail.value)}):void 0}(r,s,i,T,b,m,u);case n.DIVIDER:return e("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin--none ez-margin-left--medium","data-taskbar-divider":!0});case n.DATA_EXPORTER:const l=null===(O=t.get("exporterProviders"))||void 0===O?void 0:O[k];return e("snk-data-exporter",{class:s,provider:l,"data-element-id":i,"data-taskbar-element":r});case n.ATTACH:return d("anexo",r,s,i,T,u,b);case n.ACTIONS_BUTTON:return e("snk-actions-button",{"data-element-id":i,"data-taskbar-element":r})}};function c(a,t,n,r,s,i,l){return e("ez-button",{key:n,title:s,label:r,size:"small",class:t,"data-taskbar-label":r,"data-taskbar-element":a,"data-element-id":n,enabled:l(a),onClick:()=>i(a)})}function d(a,t,n,r,s,i,l){return e("ez-button",{key:r,title:s,mode:"icon",size:"small",class:n,"data-taskbar-label":s,"data-taskbar-element":t,"data-taskbar-icon":a,"data-element-id":r,iconName:a,enabled:l(t),onClick:()=>i(t)})}function o(a,t,n,r,s,i,l,c){return e("ez-button",{key:r,title:i,label:s,size:"small",class:n,"data-taskbar-label":s,"data-taskbar-icon":a,"data-taskbar-element":t,"data-element-id":r,enabled:c(t),onClick:()=>l(t)},e("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:a}))}export{r as A,n as T,s as V,i as a,l as b}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{UserInterface as e,DataType as t,ApplicationContext as n,ErrorException as i}from"@sankhyalabs/core";import{d as o,D as r}from"./p-
|
1
|
+
import{UserInterface as e,DataType as t,ApplicationContext as n,ErrorException as i}from"@sankhyalabs/core";import{d as o,D as r}from"./p-d75a732c.js";function a(e){const t=(n=e.fieldsMetadata)&&n.length?n.map((e=>({name:e.fieldName,label:e.description,dataType:u(e.type),userInterface:l(e),properties:s(e)}))):[];var n;return{label:e.entityDescription,name:e.descriptionField,fields:t}}function s(e){const t={};return t.options=function(e){const t=e.options;if(!t)return;const n=[];return Object.keys(t).forEach((e=>{n.push({label:e,value:t[e]})})),n}(e),t.mask=function(e){const t=e.uiType;return t?String(t).toLowerCase():void 0}(e),t}function l(t){const n=t.options;return n&&Object.keys(n).length>0?e.OPTIONSELECTOR:"D"===t.type?e.DATE:"H"===t.type?e.DATETIME:"T"===t.type?e.TIME:"I"===t.type?e.INTEGERNUMBER:void 0}function u(e){switch(e){case"F":case"I":return t.NUMBER;case"D":case"H":return t.DATE;case"B":return t.OBJECT;default:return t.TEXT}}function c(e){return Object.assign({id:e.codigo,label:`${e.caminho} - ${e.descricao}`,bold:"N"===e.analitico,props:{analitico:"S"===e.analitico}},e.no&&{children:e.no.map(c)})}var d,v,f;!function(e){e[e.GRID=0]="GRID",e[e.CARDS=1]="CARDS",e[e.TREE=2]="TREE"}(d||(d={}));class m{constructor(){this._defaultPageSize=100,this._templateByQuery=new Map,this._searchListenersByDataUnit=new Map,this.buldTemplates()}buldTemplates(){this._templateByQuery.set("search",o.gql`query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
|
2
2
|
$queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
|
3
3
|
value
|
4
4
|
label
|
@@ -1 +1 @@
|
|
1
|
-
import{r as e,c as i,h as s,f as t,H as n,g as o}from"./p-d8d8169b.js";import{a as r,F as a}from"./p-84345e7a.js";import{ApplicationUtils as l,CheckMode as h}from"@sankhyalabs/ezui/dist/collection/utils";import{ApplicationContext as d,StringUtils as p,ElementIDUtils as u,UserInterface as c}from"@sankhyalabs/core";import{S as v}from"./p-f4184ce7.js";import{fieldBuilder as m}from"@sankhyalabs/ezui/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder";import{s as x}from"./p-a349689a.js";import{convertType as b}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";const g=class{constructor(s){e(this,s),this.ezFilterGroupChange=i(this,"ezFilterGroupChange",7),this.ezFilterGroupRemove=i(this,"ezFilterGroupRemove",7),this.ezExpressionGroupLayoutChanged=i(this,"ezExpressionLayoutChanged",7),this.FIRST_LEVEL="0",this.LIMIT_GROUP_LEVEL=4,this.application=d.getContextValue("__SNK__APPLICATION__"),this._conditionOperator=r.AND,this._group=void 0,this._selfTop=0,this.canAddExpression=!0,this._showDashes=!0,this.parentTop=0,this.group=void 0,this.messagesBuilder=void 0,this.filterId=void 0,this.entityURI=void 0,this.isDefaultFilter=!1}todoCompletedHandler(e){this.updateDashes()}async getExpressionGroup(){return this._group}watchGroup(e){this._group=e,this._conditionOperator=this.getOperand()}componentWillLoad(){this._group=this.group,this._conditionOperator=this.getOperand(),this.getDataGroupLevel()||this._element.setAttribute("data-group-level",this.FIRST_LEVEL),this.canAddExpression=this.group.items.every(this.isFilledItem)}componentDidRender(){this.setSelfTop()}changeHandler(){this.ezExpressionGroupLayoutChanged.emit()}setSelfTop(){this._selfTop=this._element.getBoundingClientRect().top}getDashedHeight(){return this._selfTop-this.parentTop}getOperand(){return this._group.operand?this._group.operand:r.AND}getMessage(e,i){return this.application.messagesBuilder.getMessage(e,i)}updateDashes(){this._showDashes=!1,this.setSelfTop(),this._showDashes=!0}renderExpressionItems(){var e;return null===(e=this._group.items)||void 0===e?void 0:e.map((e=>s("snk-expression-item",{key:e.id,class:"ez-padding-top--small snk-expression-group__item",expression:e,canRemove:this._group.items.length>1,onEzFilterItemChange:()=>this.handleFilterItemChange(),onEzFilterItemRemove:i=>this.handleFilterItemRemove(i,e.id),messagesBuilder:this.messagesBuilder,entityURI:this.entityURI,isDefaultFilter:this.isDefaultFilter})))}renderGroups(){var e;const i=parseInt(this.getDataGroupLevel()||"0")+1;return null===(e=this._group.childrenGroups)||void 0===e?void 0:e.map((e=>s("snk-expression-group",{key:e.id,group:e,messagesBuilder:this.messagesBuilder,parentTop:this._selfTop,"data-group-level":i,onEzFilterGroupRemove:i=>this.handleFilterGroupRemove(i,e.id),entityURI:this.entityURI})))}handleFilterGroupRemove(e,i){this.onStopPropagation(e),this._group.childrenGroups=this._group.childrenGroups.filter((e=>e.id!==i)),t(this),this.ezFilterGroupChange.emit(this._group),this.changeHandler()}handleFilterItemRemove(e,i){this.onStopPropagation(e),this._group.items=this._group.items.filter((e=>e.id!==i)),t(this),this.ezFilterGroupChange.emit(this._group),this.changeHandler(),this.canAddExpression=!0}isFilledItem(e){return!(!e.fieldName||!e.operand||"NULL"!==e.operand&&"NOT_NULL"!==e.operand&&!e.paramVariable&&"SWITCH"!==e.userInterface&&!e.value)}handleFilterItemChange(){this.ezFilterGroupChange.emit(this._group),this.canAddExpression=this.group.items.every(this.isFilledItem)}handleAddExpression(){const e={id:p.generateUUID(),entityName:"",fieldName:"",description:"",label:this.getMessage("snkPersonalizedFilter.info.labelDefaultValue"),type:void 0,expression:void 0,operand:void 0,paramVariable:!1,value:void 0,systemConfig:null,userConfig:null};this._group.items.push(e),t(this),this.ezFilterGroupChange.emit(this.group),this.changeHandler(),this.canAddExpression=!1}handleAddGroup(){var e;const i={id:p.generateUUID(),items:[{id:p.generateUUID(),entityName:"",fieldName:"",description:"",label: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:r.AND};this._group.childrenGroups=null!==(e=this._group.childrenGroups)&&void 0!==e?e:[],this._group.childrenGroups.push(i),t(this),this.group.operand||(this.group.operand=r.AND),this.ezFilterGroupChange.emit(this.group),this.changeHandler()}buildGroupStyle(){return{height:`${this.getDashedHeight()}px`,marginTop:20-this.getDashedHeight()+"px"}}handleConditionOperatorChange(e){this._conditionOperator=e,this._group.operand=r[e],this.ezFilterGroupChange.emit(this._group)}confirmRemoveGroup(e){this.onStopPropagation(e),l.confirm(this.getMessage("snkPersonalizedFilter.confirmGroup.title"),this.getMessage("snkPersonalizedFilter.confirmGroup.description")).then((e=>{e&&this.ezFilterGroupRemove.emit(this._group)}))}getTooltipMessageForOperator(){return this.getDataGroupLevel()===this.FIRST_LEVEL&&1===this._group.items.length?this.getMessage("snkPersonalizedFilter.operador.firstLevel"):this._conditionOperator===r.AND?this.getMessage("snkPersonalizedFilter.operador.and"):this._conditionOperator===r.OR?this.getMessage("snkPersonalizedFilter.operador.or"):void 0}getDataGroupLevel(){return this._element.getAttribute("data-group-level")}canAddGroup(){return Number(this.getDataGroupLevel()||this.FIRST_LEVEL)<this.LIMIT_GROUP_LEVEL}isFirstLevel(){return Boolean(this.getDataGroupLevel()===this.FIRST_LEVEL)}onStopPropagation(e){e.preventDefault(),e.stopPropagation()}getMessageAddTooltip(){if(this.isFirstLevel()){const e=this.group.items.every((e=>!(!e.fieldName||!e.operand)&&(e.paramVariable||!!e.value)));return this.getMessage(e?"snkPersonalizedFilter.info.labelAddNewExpression":"snkPersonalizedFilter.info.labelDisabledAddExpressionButton")}return this.getMessage(this.canAddExpression?"snkPersonalizedFilter.info.labelAddNewExpression":"snkPersonalizedFilter.info.labelDisabledAddExpressionButton")}canChangeGroupCondition(){return this._group.items.length+this._group.childrenGroups.length>1}render(){const e=this.canAddGroup();return s(n,null,s("div",{class:!this.isFirstLevel()&&this._showDashes?"dashes":"hidden",style:this.buildGroupStyle()}),s("div",{class:!this.isFirstLevel()&&this._showDashes?"horizontal-dashes":"hidden"}),s("div",{class:"ez-flex ez-flex--align-items-center"},s("div",{class:"snk-expression-group__container-condition ez-flex ez-flex-item--align-center ez-flex--align-items-center","data-condition":this._conditionOperator,title:this.getTooltipMessageForOperator()},s("label",{class:"ez-label ez-padding-right--medium ez-padding-left--medium ez-title--primary"},this.getMessage("snkPersonalizedFilter.info.condition")),s("div",null,s("ez-combo-box",Object.assign({class:"snk-expression-group__container-option",canShowError:!1,mode:"slim",suppressEmptyOption:!0,enabled:this.canChangeGroupCondition(),value:this._conditionOperator,onEzChange:e=>this.handleConditionOperatorChange(e.detail.value)},{[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`comboBoxConditions_level_${this.getDataGroupLevel()}`}),s("option",{value:r.AND},this.getMessage("snkPersonalizedFilter.info.conditionAnd")),s("option",{value:r.OR},this.getMessage("snkPersonalizedFilter.info.conditionOr"))))),s("ez-button",{class:"ez-padding-right--medium ez-padding-left--medium",mode:"icon",iconName:"plus",size:"small",enabled:this.canAddExpression,title:this.getMessageAddTooltip(),onClick:()=>this.handleAddExpression()}),s("ez-button",{label:this.getMessage("snkPersonalizedFilter.info.addGroup"),size:"small",enabled:e,title:e?"":this.getMessage("snkPersonalizedFilter.info.labelDisabledAddGroupButton",{LIMIT_GROUP_LEVEL:this.LIMIT_GROUP_LEVEL+1}),onClick:()=>this.handleAddGroup()},s("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:"plus"})),!this.isFirstLevel()&&s("ez-button",{title:this.getMessage("snkPersonalizedFilter.info.labelDeleteExpression"),class:"ez-padding-left--medium",mode:"icon",iconName:"delete",size:"small",onClick:e=>this.confirmRemoveGroup(e)})),s("div",{class:"ez-padding-top--small snk-expression-group__container-expression"},s("div",{class:"ez-padding-top--small"},this.renderExpressionItems())),s("div",{class:"ez-padding-top--small snk-expression-group__container-expression"},s("div",{class:"ez-padding-top--small"},this.renderGroups())))}get _element(){return o(this)}static get watchers(){return{group:["watchGroup"]}}};g.style='.sc-snk-expression-group-h{display:block;--snk-expression-group--container-condition--width:184px;--snk-expression-group--container-condition--height:38px;--snk-expression-group--container-condition--border-radius:var(--border--radius-medium, 12px);--snk-expression-group--container-option--width:85px;--snk-expression-group__container-condition--background-and:#66B6A0;--snk-expression-group__container-condition--background-or:#EBC65E;--snk-expression-group__container-expression--padding-left:26px;--snk-expression-group__background-color-dashed:var(--background--body, #fafcff);--ez-text-input__margin-bottom:0px}.snk-expression-group__container-condition.sc-snk-expression-group{width:var(--snk-expression-group--container-condition--width);height:var(--snk-expression-group--container-condition--height);border-radius:var(--snk-expression-group--container-condition--border-radius);z-index:var(--more-visible--2x, 3);padding:var(--space--nano, 2px)}.snk-expression-group__container-option.sc-snk-expression-group{width:var(--snk-expression-group--container-option--width)}.snk-expression-group__container-condition[data-condition="AND"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-and)}.snk-expression-group__container-condition[data-condition="OR"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-or)}.snk-expression-group__container-expression.sc-snk-expression-group{padding-left:var(--snk-expression-group__container-expression--padding-left)}.dashes.sc-snk-expression-group{z-index:var(--visible, 1);background:var(--snk-expression-group__background-color-dashed);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:58px;margin-left:-15px;margin-top:-36.5px}.horizontal-dashes.sc-snk-expression-group{z-index:var(--more-visible, 2);border-bottom:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:54px;margin-left:-15px;margin-top:-33.5px}.hidden.sc-snk-expression-group{display:none}';const k=[{label:"snkPersonalizedFilter.operands.equal",value:"EQUAL"},{label:"snkPersonalizedFilter.operands.different",value:"DIFFERENT"},{label:"snkPersonalizedFilter.operands.like",value:"LIKE"},{label:"snkPersonalizedFilter.operands.in",value:"IN"},{label:"snkPersonalizedFilter.operands.startWith",value:"START_WITH"},{label:"snkPersonalizedFilter.operands.finishedWith",value:"FINISHED_WITH"},{label:"snkPersonalizedFilter.operands.null",value:"NULL"},{label:"snkPersonalizedFilter.operands.notNull",value:"NOT_NULL"}],_=k.concat([{label:"snkPersonalizedFilter.operands.larger",value:"LARGER"},{label:"snkPersonalizedFilter.operands.largerEqual",value:"LARGER_EQUAL"},{label:"snkPersonalizedFilter.operands.smaller",value:"SMALLER"},{label:"snkPersonalizedFilter.operands.smallerEqual",value:"SMALLER_EQUAL"}]),f=k,z=[c.SEARCH,c.SHORTTEXT,c.PASSWORD,c.MASKEDTEXT,c.LONGTEXT,c.HTML],F=class{constructor(s){e(this,s),this.ezFilterItemChange=i(this,"ezFilterItemChange",7),this.ezFilterItemRemove=i(this,"ezFilterItemRemove",7),this.application=d.getContextValue("__SNK__APPLICATION__"),this.filterOperandDefault=_,this.filterOperandTypeTextSearch=f,this.DEFAULT_FIELD_NAME="NOT_DEFINED",this._showValueVariable=!1,this._fieldSelected=void 0,this._optionNotNull=!1,this.expression=void 0,this.canRemove=!0,this.messagesBuilder=void 0,this.isDefaultFilter=!1,this.entityURI=void 0}expressionChanged(e,i){e!==i&&(this.ezFilterItemChange.emit(e),this.updateFieldSelected())}componentWillLoad(){this._dataSourceFetcher=x.get(`filterFieldsDataSource.${this.entityURI}`),x.onChange(`filterFieldsDataSource.${this.entityURI}`,(()=>{this._dataSourceFetcher=x.get(`filterFieldsDataSource.${this.entityURI}`)})),this.expression&&(this.updateFieldSelected(),this._optionNotNull="NULL"===this.expression.operand||"NOT_NULL"===this.expression.operand)}componentDidRender(){var e;this._showValueVariable=null===(e=this._elValueVariable)||void 0===e?void 0:e.value}updateFieldSelected(){const e={dataType:this.expression.type,description:this.expression.description,name:this.expression.fieldName,label:this.expression.fieldLabel,entityName:this.expression.entityName,onlyDate:!1,path:this.expression.description,properties:this.expressionPropsToFieldProps(this.expression.props),type:v.FIELD,uri:"",userInterface:this.expression.userInterface};this._fieldSelected=e}buildExpression(e,i,s){return s.length>0&&s.shift(),s.length>0?`${s.join("->")}->${i}`:`${e}.${i}`}setValueExpression(e,i){"fieldName"===e?(this.expression.description=i.path,this.expression.expression=this.buildExpression(i.entityName,i.name,i.entityPath),this.expression.fieldName=i.name,this.expression.fieldLabel=i.label,this.expression.type=i.dataType,this.expression.userInterface=i.userInterface,this.expression.entityName=i.entityName,this.expression.value=void 0,this.expression.props=this.fieldPropsToExpressionProps(i.properties)):this.expression[e]=i,this.expressionChanged(this.expression)}fieldPropsToExpressionProps(e){const i=[];if(!e)return i;for(const s in e){let t=e[s];"object"==typeof t&&(t=JSON.stringify(t)),i.push({name:s,value:t})}return i}expressionPropsToFieldProps(e){const i={};return e?(e.forEach((e=>{try{i[e.name]=JSON.parse(e.value)}catch(s){i[e.name]=e.value}})),i):i}getMessage(e,i){return this.application.messagesBuilder.getMessage(e,i)}handleSelectItem(e){if(this.hasNoChanges(e))this._elFilterInput.value=e.path;else if(e.type===v.FIELD){const i=e;this._fieldSelected=i,this.setValueExpression("fieldName",i)}}hasNoChanges(e){return e.name===this.expression.fieldName&&e.path===this.expression.description}handleFocus(){this._elFilterFieldSearch&&this._elFilterFieldSearch.show()}handleChangeFilterInput(e){this._elFilterFieldSearch.applyFilter(e.detail)}handleChangeValueVariable(e){this._showValueVariable=e,this._elFieldDynamic&&(this._elFieldDynamic.value=void 0,this._elFieldDynamic.enabled=!e),this.expression.paramVariable=e,this.expressionChanged(this.expression)}openSnkFilterParamConfig(){var e;null===(e=this._elFilterParamConfigRef)||void 0===e||e.open(this.expression).then(this.onOpenPromiseReady.bind(this)).catch((e=>{console.error(e)}))}onOpenPromiseReady(e){this.expression=e}buildOptionsOperator(){var e;return z.includes(null===(e=this._fieldSelected)||void 0===e?void 0:e.userInterface)?this.translateOperandOptions(this.filterOperandTypeTextSearch):this.translateOperandOptions(this.filterOperandDefault)}translateOperandOptions(e){return e.map((e=>({label:this.getMessage(e.label),value:e.value})))}handleChangeOperator(e){this.checkOptionIsNull(e),this.setValueExpression("operand",e)}checkOptionIsNull(e){[a.NULL,a.NOT_NULL].includes(a[e])?(this._optionNotNull=!0,this._elFieldDynamic&&(this._elFieldDynamic.enabled=!1,this._elFieldDynamic.value=void 0)):(this._optionNotNull=!1,this._elFieldDynamic&&(this._elFieldDynamic.enabled=!this._showValueVariable))}confirmRemove(e){e.preventDefault(),e.stopPropagation(),l.confirm(this.getMessage("snkPersonalizedFilter.confirmExpression.title"),this.getMessage("snkPersonalizedFilter.confirmExpression.description")).then((e=>{e&&this.ezFilterItemRemove.emit(this.expression)}))}buildFieldByType(){var e,i,t;if(!this._fieldSelected)return;const n=null===(e=m(this.configureFieldByType()))||void 0===e?void 0:e.i.shift();return(this._optionNotNull&&n||(null===(i=this._elValueVariable)||void 0===i?void 0:i.value)&&n||this.expression.paramVariable||this._showValueVariable||!(null===(t=this._fieldSelected)||void 0===t?void 0:t.dataType))&&(n.t.enabled=!1),null!=this.expression.value&&(n.t.value=this.getExpressiontValue(this.expression)),n.t.onEzChange=e=>{this.setValueExpression("value",e.target.value)},"SWITCH"===this.expression.userInterface&&null==this.expression.value&&this.setValueExpression("value",!1),s(n.o,Object.assign(Object.assign({},n.t),{ref:e=>{this._elFieldDynamic=e},label:this.expression.fieldLabel||this._fieldSelected.label}))}getExpressiontValue(e){return b(e.type,e.value)}configureFieldByType(){var e,i;const s={userInterface:this._fieldSelected.userInterface,name:this._fieldSelected.name,label:this._fieldSelected.label,canShowError:!1};switch(s.userInterface){case c.OPTIONSELECTOR:s.props={options:null===(i=null===(e=this._fieldSelected)||void 0===e?void 0:e.properties)||void 0===i?void 0:i.options};break;case c.LONGTEXT:s.rows=1;break;case c.SEARCH:s.optionLoader=e=>this.setCriteriaSearch(e,this.application)}return s}setCriteriaSearch({mode:e,argument:i},s){var t,n,o;if(null==s)return;const r={entity:null!==(o=null===(n=null===(t=this._fieldSelected)||void 0===t?void 0:t.properties)||void 0===n?void 0:n.ENTITYNAME)&&void 0!==o?o:this._fieldSelected.entityName,searchOptions:{showInactives:!1},entityDescription:this._fieldSelected.description};return s.executePreparedSearch(e,i,r)}render(){var e;return s(n,null,s("div",{class:"dashes"}),s("div",{class:"box"},s("div",{class:"box__container"},s("div",{class:"box__container--input-filter"},s("ez-filter-input",Object.assign({ref:e=>this._elFilterInput=e,value:null===(e=this._fieldSelected)||void 0===e?void 0:e.path,label:this.getMessage("snkPersonalizedFilter.info.labelSearchField"),canShowError:!1,onEzChange:e=>this.handleChangeFilterInput(e),onFocus:()=>this.handleFocus()},{[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`expressionFilterInput_${this.expression.fieldName||this.DEFAULT_FIELD_NAME}`})),s("snk-filter-field-search",{ref:e=>this._elFilterFieldSearch=e,searchable:!1,onEzSelectFilterItem:e=>this.handleSelectItem(e.detail),fieldsDataSource:this._dataSourceFetcher})),s("div",{class:"box__container--input-operator"},s("ez-combo-box",Object.assign({label:this.getMessage("snkPersonalizedFilter.info.labelOperator"),value:this.expression.operand,canShowError:!1,options:this.buildOptionsOperator(),onEzChange:e=>{var i;return this.handleChangeOperator(null===(i=e.detail)||void 0===i?void 0:i.value)},suppressEmptyOption:!0},{[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`comboBoxOperand_${this.expression.fieldName||this.DEFAULT_FIELD_NAME}`}))),s("div",{class:"box__container--input-value"},this._fieldSelected?this.buildFieldByType():s("ez-number-input",{label:this.getMessage("snkPersonalizedFilter.info.labelDefaultValue"),canShowError:!1,enabled:!this._showValueVariable&&!this._optionNotNull})),s("div",{class:"box__container--input-value-variable"},!this._optionNotNull&&s("ez-tooltip",{message:this.getMessage("snkPersonalizedFilter.info.checkVariableDisabled"),active:this.isDefaultFilter},s("ez-check",{ref:e=>this._elValueVariable=e,value:this.expression.paramVariable,label:this.getMessage("snkPersonalizedFilter.info.labelValueVarible"),mode:h.SWITCH,onEzChange:e=>this.handleChangeValueVariable(e.detail),enabled:!this.isDefaultFilter})),this._showValueVariable&&!this._optionNotNull&&s("ez-icon",Object.assign({class:"box__container--input-value-variable--icon",size:"large",iconName:"settings-inverted"},{[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:"iconConfig"},{title:this.getMessage("snkPersonalizedFilter.info.titleTooltip"),onClick:()=>this.openSnkFilterParamConfig()})),s("snk-filter-param-config",{ref:e=>this._elFilterParamConfigRef=e,messagesBuilder:this.messagesBuilder})),s("div",{class:"box__container--button-delete"},s("div",{class:"box__container--button-delete--icon"},s("ez-button",{mode:"icon",iconName:"delete",enabled:this.canRemove,label:this.getMessage("snkPersonalizedFilter.info.labelDeleteItem"),onClick:e=>this.confirmRemove(e)}))))))}static get watchers(){return{expression:["expressionChanged"]}}};F.style=".sc-snk-expression-item-h{display:flex;width:100%;--snk-expression-item--background-color:var(--background--xlight, #fff);--snk-expression-item__itens--padding:var(--space--small, 6px);--snk-expression-item__width--input-operator:220px;--snk-expression-item__width--input-value:240px;--snk-expression-item__width--input-value-variable:176px;--snk-expression-item--border-radius:var(--border--radius-medium, 12px);--snk-expression-item--border-color:var(--color--strokes, #DCE0E8);--snk-expression-item--border-style:var(--border--small, 1px solid);--snk-expression-item__background-color-dashed:var(--background--body, #fafcff)}.box.sc-snk-expression-item{width:100%;height:56px;background:var(--snk-expression-item--background-color);border:var(--snk-expression-item--border-color) var(--snk-expression-item--border-style);border-radius:var(--snk-expression-item--border-radius)}.box__container.sc-snk-expression-item{display:flex;align-items:center;justify-content:space-between;white-space:nowrap;margin:var(--space--small, 6px)}.box__container--input-filter.sc-snk-expression-item{width:100%}.box__container--input-operator.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-operator);min-width:var(--snk-expression-item__width--input-operator)}.box__container--input-value.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value);min-width:var(--snk-expression-item__width--input-value)}.box__container--input-value-variable.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value-variable);min-width:var(--snk-expression-item__width--input-value-variable)}.box__container--button-delete.sc-snk-expression-item{display:flex}.box__container.sc-snk-expression-item>div.sc-snk-expression-item{padding-left:var(--snk-expression-item__itens--padding);padding-right:var(--snk-expression-item__itens--padding)}.box__container--button-delete--icon.sc-snk-expression-item{width:42px;min-width:42px}.box__container--input-value-variable--icon.sc-snk-expression-item{cursor:pointer}.dashes.sc-snk-expression-item{z-index:var(--more-visible, 2);background:var(--snk-expression-item__background-color-dashed);border-bottom:2px dashed var(--text-secondary, #A2ABB9);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:62px;margin-left:-15px;margin-top:-33.5px}";export{g as snk_expression_group,F as snk_expression_item}
|
1
|
+
import{r as e,c as i,h as s,f as t,H as n,g as o}from"./p-d8d8169b.js";import{a as r,F as a}from"./p-84345e7a.js";import{ApplicationUtils as l,CheckMode as h}from"@sankhyalabs/ezui/dist/collection/utils";import{ApplicationContext as d,StringUtils as p,ElementIDUtils as u,UserInterface as c}from"@sankhyalabs/core";import{S as v}from"./p-f4184ce7.js";import{fieldBuilder as m}from"@sankhyalabs/ezui/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder";import{s as x}from"./p-55798617.js";import{convertType as b}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";const g=class{constructor(s){e(this,s),this.ezFilterGroupChange=i(this,"ezFilterGroupChange",7),this.ezFilterGroupRemove=i(this,"ezFilterGroupRemove",7),this.ezExpressionGroupLayoutChanged=i(this,"ezExpressionLayoutChanged",7),this.FIRST_LEVEL="0",this.LIMIT_GROUP_LEVEL=4,this.application=d.getContextValue("__SNK__APPLICATION__"),this._conditionOperator=r.AND,this._group=void 0,this._selfTop=0,this.canAddExpression=!0,this._showDashes=!0,this.parentTop=0,this.group=void 0,this.messagesBuilder=void 0,this.filterId=void 0,this.entityURI=void 0,this.isDefaultFilter=!1}todoCompletedHandler(e){this.updateDashes()}async getExpressionGroup(){return this._group}watchGroup(e){this._group=e,this._conditionOperator=this.getOperand()}componentWillLoad(){this._group=this.group,this._conditionOperator=this.getOperand(),this.getDataGroupLevel()||this._element.setAttribute("data-group-level",this.FIRST_LEVEL),this.canAddExpression=this.group.items.every(this.isFilledItem)}componentDidRender(){this.setSelfTop()}changeHandler(){this.ezExpressionGroupLayoutChanged.emit()}setSelfTop(){this._selfTop=this._element.getBoundingClientRect().top}getDashedHeight(){return this._selfTop-this.parentTop}getOperand(){return this._group.operand?this._group.operand:r.AND}getMessage(e,i){return this.application.messagesBuilder.getMessage(e,i)}updateDashes(){this._showDashes=!1,this.setSelfTop(),this._showDashes=!0}renderExpressionItems(){var e;return null===(e=this._group.items)||void 0===e?void 0:e.map((e=>s("snk-expression-item",{key:e.id,class:"ez-padding-top--small snk-expression-group__item",expression:e,canRemove:this._group.items.length>1,onEzFilterItemChange:()=>this.handleFilterItemChange(),onEzFilterItemRemove:i=>this.handleFilterItemRemove(i,e.id),messagesBuilder:this.messagesBuilder,entityURI:this.entityURI,isDefaultFilter:this.isDefaultFilter})))}renderGroups(){var e;const i=parseInt(this.getDataGroupLevel()||"0")+1;return null===(e=this._group.childrenGroups)||void 0===e?void 0:e.map((e=>s("snk-expression-group",{key:e.id,group:e,messagesBuilder:this.messagesBuilder,parentTop:this._selfTop,"data-group-level":i,onEzFilterGroupRemove:i=>this.handleFilterGroupRemove(i,e.id),entityURI:this.entityURI})))}handleFilterGroupRemove(e,i){this.onStopPropagation(e),this._group.childrenGroups=this._group.childrenGroups.filter((e=>e.id!==i)),t(this),this.ezFilterGroupChange.emit(this._group),this.changeHandler()}handleFilterItemRemove(e,i){this.onStopPropagation(e),this._group.items=this._group.items.filter((e=>e.id!==i)),t(this),this.ezFilterGroupChange.emit(this._group),this.changeHandler(),this.canAddExpression=!0}isFilledItem(e){return!(!e.fieldName||!e.operand||"NULL"!==e.operand&&"NOT_NULL"!==e.operand&&!e.paramVariable&&"SWITCH"!==e.userInterface&&!e.value)}handleFilterItemChange(){this.ezFilterGroupChange.emit(this._group),this.canAddExpression=this.group.items.every(this.isFilledItem)}handleAddExpression(){const e={id:p.generateUUID(),entityName:"",fieldName:"",description:"",label:this.getMessage("snkPersonalizedFilter.info.labelDefaultValue"),type:void 0,expression:void 0,operand:void 0,paramVariable:!1,value:void 0,systemConfig:null,userConfig:null};this._group.items.push(e),t(this),this.ezFilterGroupChange.emit(this.group),this.changeHandler(),this.canAddExpression=!1}handleAddGroup(){var e;const i={id:p.generateUUID(),items:[{id:p.generateUUID(),entityName:"",fieldName:"",description:"",label: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:r.AND};this._group.childrenGroups=null!==(e=this._group.childrenGroups)&&void 0!==e?e:[],this._group.childrenGroups.push(i),t(this),this.group.operand||(this.group.operand=r.AND),this.ezFilterGroupChange.emit(this.group),this.changeHandler()}buildGroupStyle(){return{height:`${this.getDashedHeight()}px`,marginTop:20-this.getDashedHeight()+"px"}}handleConditionOperatorChange(e){this._conditionOperator=e,this._group.operand=r[e],this.ezFilterGroupChange.emit(this._group)}confirmRemoveGroup(e){this.onStopPropagation(e),l.confirm(this.getMessage("snkPersonalizedFilter.confirmGroup.title"),this.getMessage("snkPersonalizedFilter.confirmGroup.description")).then((e=>{e&&this.ezFilterGroupRemove.emit(this._group)}))}getTooltipMessageForOperator(){return this.getDataGroupLevel()===this.FIRST_LEVEL&&1===this._group.items.length?this.getMessage("snkPersonalizedFilter.operador.firstLevel"):this._conditionOperator===r.AND?this.getMessage("snkPersonalizedFilter.operador.and"):this._conditionOperator===r.OR?this.getMessage("snkPersonalizedFilter.operador.or"):void 0}getDataGroupLevel(){return this._element.getAttribute("data-group-level")}canAddGroup(){return Number(this.getDataGroupLevel()||this.FIRST_LEVEL)<this.LIMIT_GROUP_LEVEL}isFirstLevel(){return Boolean(this.getDataGroupLevel()===this.FIRST_LEVEL)}onStopPropagation(e){e.preventDefault(),e.stopPropagation()}getMessageAddTooltip(){if(this.isFirstLevel()){const e=this.group.items.every((e=>!(!e.fieldName||!e.operand)&&(e.paramVariable||!!e.value)));return this.getMessage(e?"snkPersonalizedFilter.info.labelAddNewExpression":"snkPersonalizedFilter.info.labelDisabledAddExpressionButton")}return this.getMessage(this.canAddExpression?"snkPersonalizedFilter.info.labelAddNewExpression":"snkPersonalizedFilter.info.labelDisabledAddExpressionButton")}canChangeGroupCondition(){return this._group.items.length+this._group.childrenGroups.length>1}render(){const e=this.canAddGroup();return s(n,null,s("div",{class:!this.isFirstLevel()&&this._showDashes?"dashes":"hidden",style:this.buildGroupStyle()}),s("div",{class:!this.isFirstLevel()&&this._showDashes?"horizontal-dashes":"hidden"}),s("div",{class:"ez-flex ez-flex--align-items-center"},s("div",{class:"snk-expression-group__container-condition ez-flex ez-flex-item--align-center ez-flex--align-items-center","data-condition":this._conditionOperator,title:this.getTooltipMessageForOperator()},s("label",{class:"ez-label ez-padding-right--medium ez-padding-left--medium ez-title--primary"},this.getMessage("snkPersonalizedFilter.info.condition")),s("div",null,s("ez-combo-box",Object.assign({class:"snk-expression-group__container-option",canShowError:!1,mode:"slim",suppressEmptyOption:!0,enabled:this.canChangeGroupCondition(),value:this._conditionOperator,onEzChange:e=>this.handleConditionOperatorChange(e.detail.value)},{[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`comboBoxConditions_level_${this.getDataGroupLevel()}`}),s("option",{value:r.AND},this.getMessage("snkPersonalizedFilter.info.conditionAnd")),s("option",{value:r.OR},this.getMessage("snkPersonalizedFilter.info.conditionOr"))))),s("ez-button",{class:"ez-padding-right--medium ez-padding-left--medium",mode:"icon",iconName:"plus",size:"small",enabled:this.canAddExpression,title:this.getMessageAddTooltip(),onClick:()=>this.handleAddExpression()}),s("ez-button",{label:this.getMessage("snkPersonalizedFilter.info.addGroup"),size:"small",enabled:e,title:e?"":this.getMessage("snkPersonalizedFilter.info.labelDisabledAddGroupButton",{LIMIT_GROUP_LEVEL:this.LIMIT_GROUP_LEVEL+1}),onClick:()=>this.handleAddGroup()},s("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:"plus"})),!this.isFirstLevel()&&s("ez-button",{title:this.getMessage("snkPersonalizedFilter.info.labelDeleteExpression"),class:"ez-padding-left--medium",mode:"icon",iconName:"delete",size:"small",onClick:e=>this.confirmRemoveGroup(e)})),s("div",{class:"ez-padding-top--small snk-expression-group__container-expression"},s("div",{class:"ez-padding-top--small"},this.renderExpressionItems())),s("div",{class:"ez-padding-top--small snk-expression-group__container-expression"},s("div",{class:"ez-padding-top--small"},this.renderGroups())))}get _element(){return o(this)}static get watchers(){return{group:["watchGroup"]}}};g.style='.sc-snk-expression-group-h{display:block;--snk-expression-group--container-condition--width:184px;--snk-expression-group--container-condition--height:38px;--snk-expression-group--container-condition--border-radius:var(--border--radius-medium, 12px);--snk-expression-group--container-option--width:85px;--snk-expression-group__container-condition--background-and:#66B6A0;--snk-expression-group__container-condition--background-or:#EBC65E;--snk-expression-group__container-expression--padding-left:26px;--snk-expression-group__background-color-dashed:var(--background--body, #fafcff);--ez-text-input__margin-bottom:0px}.snk-expression-group__container-condition.sc-snk-expression-group{width:var(--snk-expression-group--container-condition--width);height:var(--snk-expression-group--container-condition--height);border-radius:var(--snk-expression-group--container-condition--border-radius);z-index:var(--more-visible--2x, 3);padding:var(--space--nano, 2px)}.snk-expression-group__container-option.sc-snk-expression-group{width:var(--snk-expression-group--container-option--width)}.snk-expression-group__container-condition[data-condition="AND"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-and)}.snk-expression-group__container-condition[data-condition="OR"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-or)}.snk-expression-group__container-expression.sc-snk-expression-group{padding-left:var(--snk-expression-group__container-expression--padding-left)}.dashes.sc-snk-expression-group{z-index:var(--visible, 1);background:var(--snk-expression-group__background-color-dashed);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:58px;margin-left:-15px;margin-top:-36.5px}.horizontal-dashes.sc-snk-expression-group{z-index:var(--more-visible, 2);border-bottom:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:54px;margin-left:-15px;margin-top:-33.5px}.hidden.sc-snk-expression-group{display:none}';const k=[{label:"snkPersonalizedFilter.operands.equal",value:"EQUAL"},{label:"snkPersonalizedFilter.operands.different",value:"DIFFERENT"},{label:"snkPersonalizedFilter.operands.like",value:"LIKE"},{label:"snkPersonalizedFilter.operands.in",value:"IN"},{label:"snkPersonalizedFilter.operands.startWith",value:"START_WITH"},{label:"snkPersonalizedFilter.operands.finishedWith",value:"FINISHED_WITH"},{label:"snkPersonalizedFilter.operands.null",value:"NULL"},{label:"snkPersonalizedFilter.operands.notNull",value:"NOT_NULL"}],_=k.concat([{label:"snkPersonalizedFilter.operands.larger",value:"LARGER"},{label:"snkPersonalizedFilter.operands.largerEqual",value:"LARGER_EQUAL"},{label:"snkPersonalizedFilter.operands.smaller",value:"SMALLER"},{label:"snkPersonalizedFilter.operands.smallerEqual",value:"SMALLER_EQUAL"}]),f=k,z=[c.SEARCH,c.SHORTTEXT,c.PASSWORD,c.MASKEDTEXT,c.LONGTEXT,c.HTML],F=class{constructor(s){e(this,s),this.ezFilterItemChange=i(this,"ezFilterItemChange",7),this.ezFilterItemRemove=i(this,"ezFilterItemRemove",7),this.application=d.getContextValue("__SNK__APPLICATION__"),this.filterOperandDefault=_,this.filterOperandTypeTextSearch=f,this.DEFAULT_FIELD_NAME="NOT_DEFINED",this._showValueVariable=!1,this._fieldSelected=void 0,this._optionNotNull=!1,this.expression=void 0,this.canRemove=!0,this.messagesBuilder=void 0,this.isDefaultFilter=!1,this.entityURI=void 0}expressionChanged(e,i){e!==i&&(this.ezFilterItemChange.emit(e),this.updateFieldSelected())}componentWillLoad(){this._dataSourceFetcher=x.get(`filterFieldsDataSource.${this.entityURI}`),x.onChange(`filterFieldsDataSource.${this.entityURI}`,(()=>{this._dataSourceFetcher=x.get(`filterFieldsDataSource.${this.entityURI}`)})),this.expression&&(this.updateFieldSelected(),this._optionNotNull="NULL"===this.expression.operand||"NOT_NULL"===this.expression.operand)}componentDidRender(){var e;this._showValueVariable=null===(e=this._elValueVariable)||void 0===e?void 0:e.value}updateFieldSelected(){const e={dataType:this.expression.type,description:this.expression.description,name:this.expression.fieldName,label:this.expression.fieldLabel,entityName:this.expression.entityName,onlyDate:!1,path:this.expression.description,properties:this.expressionPropsToFieldProps(this.expression.props),type:v.FIELD,uri:"",userInterface:this.expression.userInterface};this._fieldSelected=e}buildExpression(e,i,s){return s.length>0&&s.shift(),s.length>0?`${s.join("->")}->${i}`:`${e}.${i}`}setValueExpression(e,i){"fieldName"===e?(this.expression.description=i.path,this.expression.expression=this.buildExpression(i.entityName,i.name,i.entityPath),this.expression.fieldName=i.name,this.expression.fieldLabel=i.label,this.expression.type=i.dataType,this.expression.userInterface=i.userInterface,this.expression.entityName=i.entityName,this.expression.value=void 0,this.expression.props=this.fieldPropsToExpressionProps(i.properties)):this.expression[e]=i,this.expressionChanged(this.expression)}fieldPropsToExpressionProps(e){const i=[];if(!e)return i;for(const s in e){let t=e[s];"object"==typeof t&&(t=JSON.stringify(t)),i.push({name:s,value:t})}return i}expressionPropsToFieldProps(e){const i={};return e?(e.forEach((e=>{try{i[e.name]=JSON.parse(e.value)}catch(s){i[e.name]=e.value}})),i):i}getMessage(e,i){return this.application.messagesBuilder.getMessage(e,i)}handleSelectItem(e){if(this.hasNoChanges(e))this._elFilterInput.value=e.path;else if(e.type===v.FIELD){const i=e;this._fieldSelected=i,this.setValueExpression("fieldName",i)}}hasNoChanges(e){return e.name===this.expression.fieldName&&e.path===this.expression.description}handleFocus(){this._elFilterFieldSearch&&this._elFilterFieldSearch.show()}handleChangeFilterInput(e){this._elFilterFieldSearch.applyFilter(e.detail)}handleChangeValueVariable(e){this._showValueVariable=e,this._elFieldDynamic&&(this._elFieldDynamic.value=void 0,this._elFieldDynamic.enabled=!e),this.expression.paramVariable=e,this.expressionChanged(this.expression)}openSnkFilterParamConfig(){var e;null===(e=this._elFilterParamConfigRef)||void 0===e||e.open(this.expression).then(this.onOpenPromiseReady.bind(this)).catch((e=>{console.error(e)}))}onOpenPromiseReady(e){this.expression=e}buildOptionsOperator(){var e;return z.includes(null===(e=this._fieldSelected)||void 0===e?void 0:e.userInterface)?this.translateOperandOptions(this.filterOperandTypeTextSearch):this.translateOperandOptions(this.filterOperandDefault)}translateOperandOptions(e){return e.map((e=>({label:this.getMessage(e.label),value:e.value})))}handleChangeOperator(e){this.checkOptionIsNull(e),this.setValueExpression("operand",e)}checkOptionIsNull(e){[a.NULL,a.NOT_NULL].includes(a[e])?(this._optionNotNull=!0,this._elFieldDynamic&&(this._elFieldDynamic.enabled=!1,this._elFieldDynamic.value=void 0)):(this._optionNotNull=!1,this._elFieldDynamic&&(this._elFieldDynamic.enabled=!this._showValueVariable))}confirmRemove(e){e.preventDefault(),e.stopPropagation(),l.confirm(this.getMessage("snkPersonalizedFilter.confirmExpression.title"),this.getMessage("snkPersonalizedFilter.confirmExpression.description")).then((e=>{e&&this.ezFilterItemRemove.emit(this.expression)}))}buildFieldByType(){var e,i,t;if(!this._fieldSelected)return;const n=null===(e=m(this.configureFieldByType()))||void 0===e?void 0:e.i.shift();return(this._optionNotNull&&n||(null===(i=this._elValueVariable)||void 0===i?void 0:i.value)&&n||this.expression.paramVariable||this._showValueVariable||!(null===(t=this._fieldSelected)||void 0===t?void 0:t.dataType))&&(n.t.enabled=!1),null!=this.expression.value&&(n.t.value=this.getExpressiontValue(this.expression)),n.t.onEzChange=e=>{this.setValueExpression("value",e.target.value)},"SWITCH"===this.expression.userInterface&&null==this.expression.value&&this.setValueExpression("value",!1),s(n.o,Object.assign(Object.assign({},n.t),{ref:e=>{this._elFieldDynamic=e},label:this.expression.fieldLabel||this._fieldSelected.label}))}getExpressiontValue(e){return b(e.type,e.value)}configureFieldByType(){var e,i;const s={userInterface:this._fieldSelected.userInterface,name:this._fieldSelected.name,label:this._fieldSelected.label,canShowError:!1};switch(s.userInterface){case c.OPTIONSELECTOR:s.props={options:null===(i=null===(e=this._fieldSelected)||void 0===e?void 0:e.properties)||void 0===i?void 0:i.options};break;case c.LONGTEXT:s.rows=1;break;case c.SEARCH:s.optionLoader=e=>this.setCriteriaSearch(e,this.application)}return s}setCriteriaSearch({mode:e,argument:i},s){var t,n,o;if(null==s)return;const r={entity:null!==(o=null===(n=null===(t=this._fieldSelected)||void 0===t?void 0:t.properties)||void 0===n?void 0:n.ENTITYNAME)&&void 0!==o?o:this._fieldSelected.entityName,searchOptions:{showInactives:!1},entityDescription:this._fieldSelected.description};return s.executePreparedSearch(e,i,r)}render(){var e;return s(n,null,s("div",{class:"dashes"}),s("div",{class:"box"},s("div",{class:"box__container"},s("div",{class:"box__container--input-filter"},s("ez-filter-input",Object.assign({ref:e=>this._elFilterInput=e,value:null===(e=this._fieldSelected)||void 0===e?void 0:e.path,label:this.getMessage("snkPersonalizedFilter.info.labelSearchField"),canShowError:!1,onEzChange:e=>this.handleChangeFilterInput(e),onFocus:()=>this.handleFocus()},{[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`expressionFilterInput_${this.expression.fieldName||this.DEFAULT_FIELD_NAME}`})),s("snk-filter-field-search",{ref:e=>this._elFilterFieldSearch=e,searchable:!1,onEzSelectFilterItem:e=>this.handleSelectItem(e.detail),fieldsDataSource:this._dataSourceFetcher})),s("div",{class:"box__container--input-operator"},s("ez-combo-box",Object.assign({label:this.getMessage("snkPersonalizedFilter.info.labelOperator"),value:this.expression.operand,canShowError:!1,options:this.buildOptionsOperator(),onEzChange:e=>{var i;return this.handleChangeOperator(null===(i=e.detail)||void 0===i?void 0:i.value)},suppressEmptyOption:!0},{[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`comboBoxOperand_${this.expression.fieldName||this.DEFAULT_FIELD_NAME}`}))),s("div",{class:"box__container--input-value"},this._fieldSelected?this.buildFieldByType():s("ez-number-input",{label:this.getMessage("snkPersonalizedFilter.info.labelDefaultValue"),canShowError:!1,enabled:!this._showValueVariable&&!this._optionNotNull})),s("div",{class:"box__container--input-value-variable"},!this._optionNotNull&&s("ez-tooltip",{message:this.getMessage("snkPersonalizedFilter.info.checkVariableDisabled"),active:this.isDefaultFilter},s("ez-check",{ref:e=>this._elValueVariable=e,value:this.expression.paramVariable,label:this.getMessage("snkPersonalizedFilter.info.labelValueVarible"),mode:h.SWITCH,onEzChange:e=>this.handleChangeValueVariable(e.detail),enabled:!this.isDefaultFilter})),this._showValueVariable&&!this._optionNotNull&&s("ez-icon",Object.assign({class:"box__container--input-value-variable--icon",size:"large",iconName:"settings-inverted"},{[u.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:"iconConfig"},{title:this.getMessage("snkPersonalizedFilter.info.titleTooltip"),onClick:()=>this.openSnkFilterParamConfig()})),s("snk-filter-param-config",{ref:e=>this._elFilterParamConfigRef=e,messagesBuilder:this.messagesBuilder})),s("div",{class:"box__container--button-delete"},s("div",{class:"box__container--button-delete--icon"},s("ez-button",{mode:"icon",iconName:"delete",enabled:this.canRemove,label:this.getMessage("snkPersonalizedFilter.info.labelDeleteItem"),onClick:e=>this.confirmRemove(e)}))))))}static get watchers(){return{expression:["expressionChanged"]}}};F.style=".sc-snk-expression-item-h{display:flex;width:100%;--snk-expression-item--background-color:var(--background--xlight, #fff);--snk-expression-item__itens--padding:var(--space--small, 6px);--snk-expression-item__width--input-operator:220px;--snk-expression-item__width--input-value:240px;--snk-expression-item__width--input-value-variable:176px;--snk-expression-item--border-radius:var(--border--radius-medium, 12px);--snk-expression-item--border-color:var(--color--strokes, #DCE0E8);--snk-expression-item--border-style:var(--border--small, 1px solid);--snk-expression-item__background-color-dashed:var(--background--body, #fafcff)}.box.sc-snk-expression-item{width:100%;height:56px;background:var(--snk-expression-item--background-color);border:var(--snk-expression-item--border-color) var(--snk-expression-item--border-style);border-radius:var(--snk-expression-item--border-radius)}.box__container.sc-snk-expression-item{display:flex;align-items:center;justify-content:space-between;white-space:nowrap;margin:var(--space--small, 6px)}.box__container--input-filter.sc-snk-expression-item{width:100%}.box__container--input-operator.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-operator);min-width:var(--snk-expression-item__width--input-operator)}.box__container--input-value.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value);min-width:var(--snk-expression-item__width--input-value)}.box__container--input-value-variable.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value-variable);min-width:var(--snk-expression-item__width--input-value-variable)}.box__container--button-delete.sc-snk-expression-item{display:flex}.box__container.sc-snk-expression-item>div.sc-snk-expression-item{padding-left:var(--snk-expression-item__itens--padding);padding-right:var(--snk-expression-item__itens--padding)}.box__container--button-delete--icon.sc-snk-expression-item{width:42px;min-width:42px}.box__container--input-value-variable--icon.sc-snk-expression-item{cursor:pointer}.dashes.sc-snk-expression-item{z-index:var(--more-visible, 2);background:var(--snk-expression-item__background-color-dashed);border-bottom:2px dashed var(--text-secondary, #A2ABB9);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:62px;margin-left:-15px;margin-top:-33.5px}";export{g as snk_expression_group,F as snk_expression_item}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{R as e,F as t}from"./p-
|
1
|
+
import{R as e,F as t}from"./p-8d256def.js";import{D as i,d as s}from"./p-d75a732c.js";import{F as r}from"./p-ff1990ad.js";import{ObjectUtils as a}from"@sankhyalabs/core";var n;function l(e,t){if(null==e)return e;if(e instanceof Date)return e.toISOString();if("object"==typeof e){if(e instanceof Array)return e.map((e=>l(r.MULTI_LIST===t?function(e,t){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(i[s[r]]=e[s[r]])}return i}(e,["label"]):e)));{const i=Object.assign({},e);return Object.keys(e).forEach((s=>{void 0!==e[s]?i[s]=l(e[s],t):delete i[s]})),i}}return e}class o{constructor(){this.DEFAULT_RESOURCE="_default",this.templateByQuery=new Map,this.buildTemplates()}resolveURI(e,t,i){let s="filter-assistent-config://"+e;return t&&(s+="."+t),i&&(s+=this.DEFAULT_RESOURCE),s}resolveLegacyConfigName(e,t){if(!e)return"";let i=`?legacyResourceID=${e}`;return t&&(i+=this.DEFAULT_RESOURCE),i}buildTemplates(){this.templateByQuery.set("fetchFilterFields",s.gql`
|
2
2
|
query($name: String!) {
|
3
3
|
$queryAlias$: fetchFilterFields(name: $name){
|
4
4
|
currentLink {
|