@sankhyalabs/sankhyablocks 8.16.0-dev.41 → 8.16.0-dev.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. package/dist/cjs/{ConfigStorage-ecc0ed20.js → ConfigStorage-f079f5fd.js} +2 -2
  2. package/dist/cjs/{ContinuousInsertUtils-37c7cbcf.js → ContinuousInsertUtils-64e47516.js} +4 -4
  3. package/dist/cjs/{DataFetcher-cadeef8e.js → DataFetcher-e059eb72.js} +7 -5
  4. package/dist/cjs/{SnkFormConfigManager-f1c92f79.js → SnkFormConfigManager-63369164.js} +2 -2
  5. package/dist/cjs/{auth-fetcher-d68841bc.js → auth-fetcher-4f853233.js} +1 -1
  6. package/dist/cjs/{dataunit-fetcher-a36ae041.js → dataunit-fetcher-228016f4.js} +1 -1
  7. package/dist/cjs/{form-config-fetcher-ed497282.js → form-config-fetcher-39397ac5.js} +1 -1
  8. package/dist/cjs/{pesquisa-fetcher-490a86c3.js → pesquisa-fetcher-a9bfeb22.js} +1 -1
  9. package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -5
  10. package/dist/cjs/snk-application.cjs.entry.js +101 -59
  11. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  12. package/dist/cjs/snk-config-options_3.cjs.entry.js +4 -4
  13. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  14. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  15. package/dist/cjs/{snk-data-unit-b460f1da.js → snk-data-unit-3d4d0e2a.js} +1 -1
  16. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  17. package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
  18. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +3 -3
  19. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  20. package/dist/cjs/snk-grid.cjs.entry.js +6 -6
  21. package/dist/cjs/{snk-guides-viewer-de0a5c57.js → snk-guides-viewer-eee43c8b.js} +8 -5
  22. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  23. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  24. package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -7
  25. package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +28 -0
  26. package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +16 -0
  27. package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +52 -0
  28. package/dist/collection/components/snk-application/snk-application.js +3 -53
  29. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +3 -0
  30. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -6
  31. package/dist/components/DataFetcher.js +7 -5
  32. package/dist/components/snk-application2.js +95 -53
  33. package/dist/components/snk-detail-view2.js +3 -0
  34. package/dist/esm/{ConfigStorage-7b36d041.js → ConfigStorage-6514d66e.js} +2 -2
  35. package/dist/esm/{ContinuousInsertUtils-881c41a9.js → ContinuousInsertUtils-b62906f9.js} +4 -4
  36. package/dist/esm/{DataFetcher-a9c598f2.js → DataFetcher-5034df59.js} +7 -5
  37. package/dist/esm/{SnkFormConfigManager-f1a0fc92.js → SnkFormConfigManager-b409c745.js} +2 -2
  38. package/dist/esm/{auth-fetcher-749d880f.js → auth-fetcher-ca5d3a49.js} +1 -1
  39. package/dist/esm/{dataunit-fetcher-fd58c640.js → dataunit-fetcher-56cb648b.js} +1 -1
  40. package/dist/esm/{form-config-fetcher-adbe5d34.js → form-config-fetcher-a7d3e277.js} +1 -1
  41. package/dist/esm/{pesquisa-fetcher-50fc7e6b.js → pesquisa-fetcher-6bc2e41a.js} +1 -1
  42. package/dist/esm/snk-actions-button_4.entry.js +5 -5
  43. package/dist/esm/snk-application.entry.js +101 -59
  44. package/dist/esm/snk-attach.entry.js +5 -5
  45. package/dist/esm/snk-config-options_3.entry.js +4 -4
  46. package/dist/esm/snk-crud.entry.js +5 -5
  47. package/dist/esm/snk-data-exporter.entry.js +5 -5
  48. package/dist/esm/{snk-data-unit-590225b5.js → snk-data-unit-618e0b80.js} +1 -1
  49. package/dist/esm/snk-data-unit.entry.js +3 -3
  50. package/dist/esm/snk-detail-view.entry.js +7 -7
  51. package/dist/esm/snk-filter-bar_4.entry.js +3 -3
  52. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  53. package/dist/esm/snk-grid.entry.js +6 -6
  54. package/dist/esm/{snk-guides-viewer-2f4dcdc5.js → snk-guides-viewer-e8ca764a.js} +8 -5
  55. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  56. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  57. package/dist/esm/snk-simple-crud.entry.js +7 -7
  58. package/dist/sankhyablocks/{p-f3434fc4.js → p-00278e07.js} +1 -1
  59. package/dist/sankhyablocks/{p-fadc8339.js → p-0e206e62.js} +1 -1
  60. package/dist/sankhyablocks/{p-242d010e.entry.js → p-0e250436.entry.js} +1 -1
  61. package/dist/sankhyablocks/{p-06421fdb.js → p-126c58ea.js} +1 -1
  62. package/dist/sankhyablocks/{p-6114ee36.entry.js → p-1dbd5c18.entry.js} +1 -1
  63. package/dist/sankhyablocks/{p-fa6c5826.entry.js → p-30ebcbe0.entry.js} +1 -1
  64. package/dist/sankhyablocks/{p-8a9638ae.js → p-341465ce.js} +2 -2
  65. package/dist/sankhyablocks/{p-052213ba.entry.js → p-3858a2e4.entry.js} +1 -1
  66. package/dist/sankhyablocks/p-42130213.entry.js +1 -0
  67. package/dist/sankhyablocks/{p-cefb0ee1.entry.js → p-43353d86.entry.js} +1 -1
  68. package/dist/sankhyablocks/{p-47bce500.js → p-47d24ac8.js} +1 -1
  69. package/dist/sankhyablocks/{p-275de842.entry.js → p-563b7c28.entry.js} +1 -1
  70. package/dist/sankhyablocks/{p-72c10005.entry.js → p-9c3138f5.entry.js} +1 -1
  71. package/dist/sankhyablocks/{p-4d9549cf.js → p-9ffd9fc7.js} +1 -1
  72. package/dist/sankhyablocks/{p-0b6cd238.entry.js → p-a2c790ac.entry.js} +1 -1
  73. package/dist/sankhyablocks/{p-fd13b4d2.js → p-a75e9dcc.js} +1 -1
  74. package/dist/sankhyablocks/{p-212213d9.entry.js → p-aa003d4e.entry.js} +1 -1
  75. package/dist/sankhyablocks/p-aaf94476.js +1 -0
  76. package/dist/sankhyablocks/{p-583517ba.entry.js → p-c1adf0dd.entry.js} +1 -1
  77. package/dist/sankhyablocks/p-da87e42c.entry.js +11 -0
  78. package/dist/sankhyablocks/{p-7bd9683d.js → p-e3a285a2.js} +1 -1
  79. package/dist/sankhyablocks/{p-cfa1b199.js → p-e4391e16.js} +1 -1
  80. package/dist/sankhyablocks/{p-5e51e833.entry.js → p-f0aaad2b.entry.js} +1 -1
  81. package/dist/sankhyablocks/{p-fb34e0cf.entry.js → p-fca0e5cc.entry.js} +1 -1
  82. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  83. package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +11 -0
  84. package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +12 -0
  85. package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +13 -0
  86. package/dist/types/components/snk-application/snk-application.d.ts +3 -12
  87. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  88. package/package.json +1 -1
  89. package/dist/sankhyablocks/p-ab1645fb.entry.js +0 -1
  90. package/dist/sankhyablocks/p-ca5ec380.js +0 -1
  91. package/dist/sankhyablocks/p-dbe6174a.entry.js +0 -11
@@ -1 +1 @@
1
- import{r as t,c as i,h as e,H as s,g as r}from"./p-d2d301a6.js";import{ElementIDUtils as o,ObjectUtils as l}from"@sankhyalabs/core";import{F as a}from"./p-ff1990ad.js";import{E as n}from"./p-1a68fb59.js";import{C as d}from"./p-4d9549cf.js";import{F as h}from"./p-d9804798.js";import"./p-06421fdb.js";import"./p-f3434fc4.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";const c=class{constructor(e){t(this,e),this.filterChange=i(this,"filterChange",7),this.editPersonalizedFilter=i(this,"editPersonalizedFilter",7),this.addPersonalizedFilter=i(this,"addPersonalizedFilter",7),this.filterItem=void 0,this.configName=void 0,this.resourceID=void 0}observeFilterItem(t){var i,e;this._editor&&(this._editor.config=t),null===(e=null===(i=this._editor)||void 0===i?void 0:i.reloadList)||void 0===e||e.call(i),this.filterChange.emit(t)}getContentEditorConfig(){const t={presentationMode:n.MODAL};switch(this.filterItem.type){case a.BINARY_SELECT:return{tag:"snk-filter-binary-select",props:t};case a.MULTI_SELECT:return{tag:"snk-filter-multi-select"};case a.PERIOD:return{tag:"snk-filter-period",props:t};case a.SEARCH:return{tag:"snk-filter-search"};case a.NUMBER:return{tag:"snk-filter-number",props:t};case a.PERSONALIZED:return this.buildSnkFilterPersonalizedProps();case a.CHECK_BOX_LIST:return{tag:"snk-filter-checkbox-list",props:t};case a.MULTI_LIST:return{tag:"snk-entity-list",props:{maxHeightList:"640px",rightListSlotBuilder:t=>this.buildRightSlot(t)}}}return{tag:"snk-filter-text"}}buildSnkFilterPersonalizedProps(){return{tag:"snk-personalized-filter-editor",props:{onEditFilter:t=>this.editPersonalizedFilter.emit(t.detail),onAddFilter:()=>this.addPersonalizedFilter.emit()}}}isVisible(t){return!!this.filterItem.visible||void 0!==t}updateFilterValue(t){const i=void 0!==(null==t?void 0:t.value)?t.value:t;this.filterItem=Object.assign(Object.assign({},this.filterItem),null!=this.filterItem.groupedItems?{visible:i>0,value:i,groupedItems:t.items}:{value:this.filterItem.type===(a.SEARCH||a.CHECK_BOX_LIST)?t:i,visible:this.isVisible(i)})}handleDeleteFilter(t,i){i===a.PERSONALIZED&&d.removePersonalizedFilter(t,this.resourceID,this.configName)}componentDidLoad(){if(this._element){o.addIDInfo(this._element);const t=this._element.getAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.filterItem.id}`}}buildRightSlot(t){return e("ez-icon",{iconName:"delete",onClick:()=>this.removeValueFromConfig(t)})}removeValueFromConfig(t){var i,e,s;const r=null===(e=null===(i=this.filterItem)||void 0===i?void 0:i.value)||void 0===e?void 0:e.findIndex((({id:i})=>i===t.id)),o=l.copy(this.filterItem);null===(s=null==o?void 0:o.value)||void 0===s||s.splice(r,1),this.updateFilterValue(o.value)}canShowDetailModal(){const{CUSTOM_FILTER:t,OTHER_FILTERS:i}=h;return![t,i].includes(this.filterItem.filterType)&&this.filterItem.type!==a.BINARY_SELECT}render(){const{tag:t,props:i}=this.getContentEditorConfig();return e(s,null,e("div",{class:"ez-flex ez-flex--column grow"},this.canShowDetailModal()&&e("div",{class:"col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center"},e("div",{class:"ez-title ez-title--small ez-title--primary grow"},this.filterItem.detailModal)),e(t,Object.assign({ref:t=>this._editor=t,config:this.filterItem,value:this.filterItem.value,onValueChanged:t=>this.updateFilterValue(t.detail),"data-element-id":this._idContentEditor},i))))}get _element(){return r(this)}static get watchers(){return{filterItem:["observeFilterItem"]}}};c.style=".grow{flex-grow:1}.gap{gap:4px}";export{c as snk_filter_modal_item}
1
+ import{r as t,c as i,h as e,H as s,g as r}from"./p-d2d301a6.js";import{ElementIDUtils as o,ObjectUtils as l}from"@sankhyalabs/core";import{F as a}from"./p-ff1990ad.js";import{E as n}from"./p-1a68fb59.js";import{C as d}from"./p-9ffd9fc7.js";import{F as h}from"./p-d9804798.js";import"./p-126c58ea.js";import"./p-00278e07.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";const c=class{constructor(e){t(this,e),this.filterChange=i(this,"filterChange",7),this.editPersonalizedFilter=i(this,"editPersonalizedFilter",7),this.addPersonalizedFilter=i(this,"addPersonalizedFilter",7),this.filterItem=void 0,this.configName=void 0,this.resourceID=void 0}observeFilterItem(t){var i,e;this._editor&&(this._editor.config=t),null===(e=null===(i=this._editor)||void 0===i?void 0:i.reloadList)||void 0===e||e.call(i),this.filterChange.emit(t)}getContentEditorConfig(){const t={presentationMode:n.MODAL};switch(this.filterItem.type){case a.BINARY_SELECT:return{tag:"snk-filter-binary-select",props:t};case a.MULTI_SELECT:return{tag:"snk-filter-multi-select"};case a.PERIOD:return{tag:"snk-filter-period",props:t};case a.SEARCH:return{tag:"snk-filter-search"};case a.NUMBER:return{tag:"snk-filter-number",props:t};case a.PERSONALIZED:return this.buildSnkFilterPersonalizedProps();case a.CHECK_BOX_LIST:return{tag:"snk-filter-checkbox-list",props:t};case a.MULTI_LIST:return{tag:"snk-entity-list",props:{maxHeightList:"640px",rightListSlotBuilder:t=>this.buildRightSlot(t)}}}return{tag:"snk-filter-text"}}buildSnkFilterPersonalizedProps(){return{tag:"snk-personalized-filter-editor",props:{onEditFilter:t=>this.editPersonalizedFilter.emit(t.detail),onAddFilter:()=>this.addPersonalizedFilter.emit()}}}isVisible(t){return!!this.filterItem.visible||void 0!==t}updateFilterValue(t){const i=void 0!==(null==t?void 0:t.value)?t.value:t;this.filterItem=Object.assign(Object.assign({},this.filterItem),null!=this.filterItem.groupedItems?{visible:i>0,value:i,groupedItems:t.items}:{value:this.filterItem.type===(a.SEARCH||a.CHECK_BOX_LIST)?t:i,visible:this.isVisible(i)})}handleDeleteFilter(t,i){i===a.PERSONALIZED&&d.removePersonalizedFilter(t,this.resourceID,this.configName)}componentDidLoad(){if(this._element){o.addIDInfo(this._element);const t=this._element.getAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.filterItem.id}`}}buildRightSlot(t){return e("ez-icon",{iconName:"delete",onClick:()=>this.removeValueFromConfig(t)})}removeValueFromConfig(t){var i,e,s;const r=null===(e=null===(i=this.filterItem)||void 0===i?void 0:i.value)||void 0===e?void 0:e.findIndex((({id:i})=>i===t.id)),o=l.copy(this.filterItem);null===(s=null==o?void 0:o.value)||void 0===s||s.splice(r,1),this.updateFilterValue(o.value)}canShowDetailModal(){const{CUSTOM_FILTER:t,OTHER_FILTERS:i}=h;return![t,i].includes(this.filterItem.filterType)&&this.filterItem.type!==a.BINARY_SELECT}render(){const{tag:t,props:i}=this.getContentEditorConfig();return e(s,null,e("div",{class:"ez-flex ez-flex--column grow"},this.canShowDetailModal()&&e("div",{class:"col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center"},e("div",{class:"ez-title ez-title--small ez-title--primary grow"},this.filterItem.detailModal)),e(t,Object.assign({ref:t=>this._editor=t,config:this.filterItem,value:this.filterItem.value,onValueChanged:t=>this.updateFilterValue(t.detail),"data-element-id":this._idContentEditor},i))))}get _element(){return r(this)}static get watchers(){return{filterItem:["observeFilterItem"]}}};c.style=".grow{flex-grow:1}.gap{gap:4px}";export{c as snk_filter_modal_item}
@@ -0,0 +1 @@
1
+ import{ObjectUtils as t}from"@sankhyalabs/core";import{R as a}from"./p-126c58ea.js";class e extends a{getData(a){const e=`cfg://auth/${a}`;return new Promise(((a,s)=>{this.loadResource(e).then((e=>{let s=t.stringToObject(e);s&&"object"==typeof s&&a(s)})).catch((t=>{s(t)}))}))}}var s;!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(s||(s={}));export{s as A,e as a}
@@ -1 +1 @@
1
- export{S as snk_data_unit}from"./p-fd13b4d2.js";import"./p-d2d301a6.js";import"@sankhyalabs/core";import"@sankhyalabs/ezui/dist/collection/utils";import"./p-17425c72.js";import"./p-47bce500.js";import"./p-f3434fc4.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"@sankhyalabs/core/dist/dataunit/metadata/DataType";import"./p-7dd49d15.js";
1
+ export{S as snk_data_unit}from"./p-a75e9dcc.js";import"./p-d2d301a6.js";import"@sankhyalabs/core";import"@sankhyalabs/ezui/dist/collection/utils";import"./p-17425c72.js";import"./p-47d24ac8.js";import"./p-00278e07.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"@sankhyalabs/core/dist/dataunit/metadata/DataType";import"./p-7dd49d15.js";
@@ -0,0 +1,11 @@
1
+ import{r as t,c as s,h as e,g as i}from"./p-d2d301a6.js";import{DateUtils as n,StringUtils as r,ObjectUtils as o,WaitingChangeException as a,WarningException as c,ErrorException as h,KeyboardManager as u,OnboardingUtils as l,DependencyType as p,ArrayUtils as d,SearchUtils as w,ElementIDUtils as m,ApplicationContext as y,DataType as f,ErrorTracking as P}from"@sankhyalabs/core";import{ApplicationUtils as v}from"@sankhyalabs/ezui/dist/collection/utils";import{C as g}from"./p-9ffd9fc7.js";import{d as _,D as A,U as I}from"./p-00278e07.js";import{A as S,a as C}from"./p-aaf94476.js";import{D as N}from"./p-47d24ac8.js";import{P as b}from"./p-341465ce.js";import{S as T}from"./p-17425c72.js";import"./p-126c58ea.js";import"./p-ff1990ad.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 E{static webConnectionCaller(t,s,e){var i;null===(i=window.AppletCaller)||void 0===i||i.webConnectionCaller(t,s,e)}}const L=D;function D(t,s){const e=k();return(D=function(t){return e[t-=378]})(t,s)}function k(){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(k=function(){return t})()}!function(){const t=D,s=k();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;s.push(s.shift())}catch(t){s.push(s.shift())}}();class O{[L(397)](t){const s=L;if(typeof(t=utxt(t[s(390)]))==s(392)&&(t=JSON[s(400)](t)),null==t)throw Error(s(395));const e=new U("S"===t[s(402)]||!0===t[s(402)]);return Array[s(394)](t[s(391)])&&t[s(391)][s(385)]((t=>e.putAccess(t[s(382)],String(t.status)==s(398)))),e}}class U{constructor(t){const s=L;this.isSup=t,this[s(384)]={}}[L(378)](t,s){this[L(384)][t]=s}[L(393)](t){const s=L;if(this[s(402)])return!0;let e=!0;return this[s(384)][s(380)](t)&&(e=this.actions[t]),e}isUserSup(){return this.isSup}}class M{constructor(){this._embeddedParams=new Map,this.templateByQuery=new Map;try{if(null!=window.MGE_PARAMS){atob(window.MGE_PARAMS).split("__;__").forEach((t=>{const[s,e]=t.split("__=__");this._embeddedParams.set(s,e)}))}}catch(t){console.error("Problemas ao obter parâmetros embarcados"),console.error(t)}this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",_.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));const s=`param://application?params=${t}`;return A.get().callGraphQL({values:{name:s},query:this.templateByQuery.get("fetchParam")})}async asString(t){const s=await this.getParam(t);return this.getValue(s)}async asInteger(t){const s=await this.getParam(t);return parseInt(this.getValue(s))}async asFloat(t){const s=await this.getParam(t);return parseFloat(this.getValue(s))}async asBoolean(t){const s=await this.getParam(t);return"S"===this.getValue(s)}async asDate(t){const s=await this.getParam(t);return n.strToDate(this.getValue(s))}async getBatchParams(t){const s=await this.getParam(t.join(",")),e={};return s.forEach((t=>e[t.name]=t.resource)),e}getValue(t={}){if(Array.isArray(t)&&t.length>0&&(t=t[0]),"string"==typeof t)return t;if(r.isEmpty(t.resource))return"";try{const s=o.stringToObject(t.resource),[e]=Object.keys(s);return s[e]}catch(t){console.warn("Erro ao converter string JSON.")}}}class R{constructor(){this.templateByQuery=new Map,this.cancel=[],this.buildTemplates()}buildTemplates(){this.templateByQuery.set("fetchTotals",_.gql`query($filters: [InputFilter!] $name: String!) {
7
+ $queryAlias$: fetchTotals(name: $name, filters: $filters ){
8
+ name
9
+ value
10
+ }
11
+ }`)}fetchTotals(t,s,e=[]){const i=`${t}_${s}`,n=this.cancel.findIndex((t=>t[i]));return n>=0&&(this.cancel[n][i](),this.cancel.splice(n,1)),Promise.race([new Promise((t=>this.cancel.push({[i]:t}))),this.getTotals(t,s,e)]).then((t=>{let s=new Map;if(t){s=t;const e=this.cancel.findIndex((t=>t[i]));e>=0&&this.cancel.splice(e,1)}return s}))}getTotals(t,s,e=[]){return new Promise(((i,n)=>{A.get().callGraphQL({query:this.templateByQuery.get("fetchTotals"),values:{name:`totals://${t}/${s}`,filters:e}}).then((t=>{if(t.length>0){const s=new Map;return t.forEach((t=>s.set(t.name,parseFloat(t.value)))),i(s)}return n("Não foi possível recuperar os totalizadores")})).catch(n)}))}}function j(){const t=["2909523kXwted","CompanyName=Sankhya Jiva Tecnologia e Inovao Ltda,LicensedApplication=Sankhya Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869","1131048CARoeW","502909mLEPmu","447255iQEXuN","428UHbJwW","270AFTxAV","194369jhGqTI","1540nWuTrj","2044062GicUQI","30CkXPWg"];return(j=function(){return t})()}const F=$;function $(t,s){const e=j();return($=function(t){return e[t-=392]})(t,s)}!function(){const t=$,s=j();for(;;)try{if(951926==-parseInt(t(398))/1+-parseInt(t(393))/2+parseInt(t(395))/3+-parseInt(t(400))/4*(parseInt(t(392))/5)+-parseInt(t(401))/6*(-parseInt(t(402))/7)+parseInt(t(397))/8+-parseInt(t(399))/9*(-parseInt(t(394))/10))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const q=F(396);var z;class x{static openAppActivity(t,s){var e;null===(e=window.workspace)||void 0===e||e.openAppActivity(t,s)}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,s;null===(s=null===(t=window.workspace)||void 0===t?void 0:t.showDesktop)||void 0===s||s.call(t)}static searchApp(){var t,s;null===(s=null===(t=window.workspace)||void 0===t?void 0:t.searchApp)||void 0===s||s.call(t)}static openHelp(){var t,s;null===(s=null===(t=window.workspace)||void 0===t?void 0:t.openHelp)||void 0===s||s.call(t)}static applicationClick(){var t,s;(null===(t=window.workspace)||void 0===t?void 0:t.applicationClick)&&(null===(s=window.workspace)||void 0===s||s.applicationClick())}}x.resourceID=null===(z=window.workspace)||void 0===z?void 0:z.resourceID;class B{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}rejectionHandler(t){const s=t.reason;s instanceof a||(s?this.processException(s):this._app.isDebugMode().then((t=>{t&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(t){this.processException(t.error)}buildErrorCodeHTML(t){return'<br><a href="#" onclick="try{window.workspace.openHelp(\'_tbcode:'+t+"')} catch(e){alert('Não é possível abrir a ajuda fora do workspace Sankhya');}\">Código: "+t+"</a>"}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t.errorCode)),t instanceof a||t instanceof c?this._app.alert(t.title,t.message):t instanceof h?this._app.error(t.title,t.message):this._app.isDebugMode().then((s=>{if(s)if(t instanceof Error)this._app.error(t.name,t.message);else{const s=(null==t?void 0:t.title)||"Erro detectado",e="string"==typeof t?t:t.message||`Erro interno "${o.objectToString(t)}"`;this._app.error(s,e)}}))}}class K{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 s=setTimeout((()=>{this.ezLoadingBar.show()}),this._debounceTime);this.requests.set(t.requestId,s)}onRequestEnd(t){const s=this.requests.get(t.requestId);clearTimeout(s),this.requestsLoadingBar.includes(t.requestId)&&(this.requestsLoadingBar=this.requestsLoadingBar.filter((s=>s!==t.requestId)),!this.requestsLoadingBar.length&&this.ezLoadingBar.hide())}}class H{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:s}=t.requestBody[0].variables;if(s){const t=s.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class V{static create({strategy:t}){switch(t){case"request_name":return new H;case"request_time":return new K;default:throw new Error("Strategy not found")}}}const W=class{constructor(e){t(this,e),this.applicationLoaded=s(this,"applicationLoaded",7),this.applicationLoading=s(this,"applicationLoading",7),this.NEW_VERSION_POPUP_LOCKER="NEW_VERSION_POPUP_LOCKER",this._authPromises=[],this._keyboardManager=new u,this._waitingAppReady=new Array,this._duCache=new Map,this._duPromises=new Map,this._requestListener=V.create({strategy:"request_time"}),this._pendingActions=new Map,this._loadPkParameter=null,this._isLoadedByPk=!1,this.messagesBuilder=void 0,this.configName=void 0,this.gridLegacyConfigName=void 0,this.formLegacyConfigName=void 0,this.loadByPK=void 0}async processPendingActions(t){const s=this._pendingActions.get(t);s&&s.length&&(s.forEach((t=>t())),this._pendingActions.set(t,[]))}get parameters(){return this._parameters||(this._parameters=new M),this._parameters}async getAuth(t){return null==t?this.getApplicationAuth():new Promise(((s,e)=>{this.authFetcher.getData(t).then((t=>{s(t)})).catch((t=>{e(t)}))}))}async getApplicationAuth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,s)=>{const e=this._authPromises.length>0;this._authPromises.push(new G(t,s)),e||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,s){t&&this._loadPkParameter&&(this.loadByPK(this._loadPkParameter.pk,this._loadPkParameter.redirect),this._loadPkParameter=null)}async getKeyboardManager(){return Promise.resolve(this._keyboardManager)}async isUserSup(){return new Promise(((t,s)=>{this.getAuth().then((e=>{this.getAuthList(e).then((s=>{t(s.isSup)})).catch((t=>s(t)))}))}))}async addPendingAction(t,s){var e;const i=null!==(e=this._pendingActions.get(t))&&void 0!==e?e:[];this._pendingActions.set(t,[...i,s])}async callServiceBroker(t,s,e){return A.get().callServiceBroker(t,s,e)}async initOnboarding(t){this.hasToShowNewVersionPopup()?await this.addPendingAction(this.NEW_VERSION_POPUP_LOCKER,(()=>this.doInitOnboarding(t))):this.doInitOnboarding(t)}doInitOnboarding(t){l.getInstance().init(t,window.envContext)}async hasAccess(t,s){return new Promise(((e,i)=>{this.getAuth(s).then((s=>{this.getAuthList(s).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>i(t)))}))}))}async getAllAccess(t){return new Promise(((s,e)=>{this.getAuth(t).then((t=>{this.getAuthList(t).then((t=>{const e={};e.isSup=t.isSup,Object.entries(S).forEach((s=>{e[s[0]]=t.actions[s[1]]||!1})),s(e)})).catch((t=>e(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,s="full",e=!0,i){this.clearContent(this._popUp),this._popUp.addEventListener("ezClosePopup",(()=>{i()}),{once:!0}),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=s,this._popUp.useHeader=e,"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 v.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 s=t.split(",");return new Promise(((t,e)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(s.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((s=>{t(s.includes("1"))})).catch((t=>{e(t)}))})).catch((t=>{e(t)}))}))}async getConfig(t){let s={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,e)=>{A.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(s)).then((s=>{var e;return t(null===(e=s.config)||void 0===e?void 0:e.data)})).catch((t=>e(t)))}))}async saveConfig(t,s){let e={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:s}}};return new Promise(((t,s)=>{A.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(e)).then((s=>t(s))).catch((t=>s(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,s){x.openAppActivity(t,s)}async webConnection(t,s,e){this.getStringParam(t).then((t=>{E.webConnectionCaller(t,s,e)}))}getDuPromissesStack(t){let s;return t&&(s=this._duPromises.get(t),s||(s=[],this._duPromises.set(t,s))),s||[]}async createDataunit(t,s,e,i,n){return null==n&&(n=this.applicationResourceID),new Promise(((r,o)=>{const a=this.getDuPromissesStack(s),c=a.length>0;if(a.push(new G(r,o)),!c){const r=this.dataUnitFetcher.getDataUnit(t,n,e,i);r.loadMetadata().then((()=>{this.processResolveDataUnit(r,s,a)})).catch((t=>{for(;a.length>0;)a.pop().reject(t)}))}}))}processResolveDataUnit(t,s,e){for(s&&this.updateDataunitCache(void 0,s,t);e.length>0;)e.pop().resolve(t)}async updateDataunitCache(t,s,e){t&&this._duCache.delete(t),this._duCache.set(s,e)}async getDataUnit(t,s,e,i,n){return new Promise(((r,o)=>{const a=this._duCache.get(s);a?r(a):this.createDataunit(t,s,e,i,n).then((t=>{r(t)})).catch((t=>o(t)))}))}async addClientEvent(t,s){return new Promise((e=>{A.addClientEvent(t,s),e()}))}async removeClientEvent(t){return new Promise((s=>{A.removeClientEvent(t),s()}))}async hasClientEvent(t){return new Promise((s=>{s(A.hasClientEvent(t))}))}get applicationResourceID(){return this._applicationResourceID||(this._applicationResourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||x.resourceID||"unknown.resource.id"),this._applicationResourceID}async getResourceID(){return Promise.resolve(this.applicationResourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,s,e,i){return v.alert(t,s,e,i)}async error(t,s,e,i){return v.error(t,s,e,i)}async success(t,s,e,i){return v.success(t,s,e,i)}async message(t,s,e,i){return v.message(t,s,e,i)}async confirm(t,s,e,i,n){return v.confirm(t,s,e,i,n)}async info(t,s){return v.info(t,s)}async loadTotals(t,s,e){return this.totalsFetcher.fetchTotals(t,s,e)}async isLoadedByPk(){return Promise.resolve(this._isLoadedByPk)}async getAuthList(t){return await(new O).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=I.getQueryParams(location.search)),this._urlParams}getMessage(t,s){var e;return null===(e=this.messagesBuilder)||void 0===e?void 0:e.getMessage(t,s)}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new N),this._dataUnitFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new R),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new b),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new C),this._authFetcher}async executeSearch(t,s,e){const i=null==e?void 0:e.getField(s);if(i){const{mode:s,argument:n}=t,{ENTITYNAME:r,CODEFIELD:o,DESCRIPTIONFIELD:a,ROOTENTITY:c,DESCRIPTIONENTITY:h}=i.properties,u=i.dependencies;let l;const d={rootEntity:c,descriptionFieldName:a,codeFieldName:o,showInactives:!1,dataUnitId:e.dataUnitId};return null==u||u.filter((t=>t.masterFields)).forEach((t=>{var s;t.type===p.SEARCHING&&(null===(s=t.masterFields)||void 0===s?void 0:s.length)>0&&(l={expression:t.expression,params:t.masterFields.map((t=>{const s=e.getField(t),i=(null==s?void 0:s.dataType)||f.TEXT,n=e.getFieldValue(t);if(null==n)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${s.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${s.label} para executar a pesquisa.`);return{name:t,value:n,dataType:i}}))})})),this.executePreparedSearch(s,n,{entity:r,entityDescription:h,criteria:l,searchOptions:d})}}filterInvalidFields(t,s,e){return t.fieldsMetadata.filter((i=>{let n=!r.isEmpty(s[i.fieldName])&&!1!==i.visible&&"B"!==i.type&&t.pkField!==i.fieldName&&t.descriptionField!==i.fieldName&&(i.isPrimaryKey||!i.isLinkField)&&!("S"===i.type&&"H"===i.presentationType);return n&&(e[i.fieldName]=i),("string"!=typeof s[i.fieldName]||!(s[i.fieldName].indexOf("<img")>-1||s[i.fieldName].indexOf("<svg")>-1))&&n}))}filterMathFields(t,s,e,i){return t&&Array.isArray(t)&&t.forEach((t=>{let e=d.removeReference(s,i[t]);e&&s.unshift(e)})),s=s.slice(0,e)}builOptionItem(t,s,e,i,n){var o;return{value:r.highlightValue(t,s.__matchFields,null===(o=s[n])||void 0===o?void 0:o.toString(),e,!0),label:i?r.highlightValue(t,s.__matchFields,s[i],e,!0):"",details:w.buildDetails(t,e,s)}}async executePreparedSearch(t,s,e){const i={},{entity:n,entityDescription:r,criteria:a,searchOptions:c}=e;return new Promise("ADVANCED"===t?(t,e)=>{const i=document.createElement("snk-pesquisa");i[m.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${n}`,i.argument=s,i.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(n,t,a,c),i.selectItem=s=>{t(s),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(i,void 0,void 0,e)}:(t,e)=>{this.pesquisaFetcher.loadAdvancedSearch(n,s,a,c).then((e=>{let n=(e=o.stringToObject(e.json.$)).descriptionField,r=e.pkField;const a=[];e.data.forEach((t=>{let o=this.filterInvalidFields(e,t,i),c=this.filterMathFields(t.__matchFields,o,6,i);a.push(this.builOptionItem(s,t,c,n,r))})),t(a)})).catch((t=>{e(t)}))})}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return x.getAppLabel(this.applicationResourceID)}addSearchListener(t,s,e){return new Promise((i=>{i(this.pesquisaFetcher.addSearchListener(t,s.dataUnitId,e))}))}importScript(t){return new Promise((s=>{this.getApplicationPath().then((e=>{let i=[];Array.isArray(t)||(i=[t]),i.forEach((t=>{const s=document.createElement("script");s.src=`${e}/${t}`,s.async=!0,document.body.appendChild(s)})),s()}))}))}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,s,e){return this.dataUnitFetcher.loadSelectDistinct(t,s,e)}getDataFetcher(){return Promise.resolve(A.get())}async whenApplicationReady(){return y.getContextValue("__SNK__APPLICATION__LOADING__")?Promise.resolve(this):new Promise((t=>{this._waitingAppReady.push((()=>t(this)))}))}async setSearchFilterContext(t,s){y.setContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${t})__`,s)}clearContent(t){t&&Array.from(t.children).forEach((s=>{t.removeChild(s)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}async pkChangeListener(){const t=top.window.location.hash.split("/")[2];if(this._currentPkParameter===t)return;const s=this.getResourceIdFromToken(),e=I.getPkObjectFromUrlToken(top.window.location.hash),i=window.redirectFrom;if(void 0===e)return;if((!i||-1===i.split("_")[0].indexOf(s.split("_")[0]))&&s!==this.applicationResourceID)return;const n={pk:e};if(this._isLoadedByPk=!0,this.loadByPK)return this.loadByPK(n,i),void(this._currentPkParameter=t);this._loadPkParameter={pk:n,redirect:i},this.defaultLoadByPK(n,t)}getResourceIdFromToken(){return top.window.location.pathname.indexOf("tabContent.jsp")>-1?I.getResourceIdFromUrlToken(window.location.generateHash(window.location.hash)):I.getResourceIdFromUrlToken(top.window.location.hash)}defaultLoadByPK(t,s){if(!(null==t?void 0:t.pk))return;const e=this.getFirstDataUnitFromDOM(),i=e.dataUnit;if(!i)return console.warn("Dataunit não inicializado"),void e.addEventListener("dataUnitReady",(e=>{this.loadDataWithPKFilter(t,e.detail),this._currentPkParameter=s}));this.loadDataWithPKFilter(t,i),this._currentPkParameter=s}loadDataWithPKFilter(t,s){const e={term:"",filter:{name:"LOAD_BY_PK_FILTER",expression:this.buildFilterExpressionByPkObject(t),params:this.getFilterParamsFromPkObject(t,s)}};s.loadData(e)}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,s){var e;const i=[];for(const n in t.pk)t.pk.hasOwnProperty(n)&&!Array.isArray(t.pk[n])&&i.push({name:n,dataType:(null===(e=s.getField(n))||void 0===e?void 0:e.dataType)||this.getDefaultDataTypeLoadByPK(t.pk[n]),value:t.pk[n]});return i}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 s="";for(const e in t.pk)r.isEmpty(s)||(s+=" AND "),Array.isArray(t.pk[e])?s+=`${e} IN (${t.pk[e].toString()})`:s+=`${e} = :${e}`;return s}async showNewVersionPopup(){const t=document.createElement("ez-modal-container"),s=await this.getAppLabel();t.modalTitle=this.getMessage("snkApplication.newVersionPopup.title",{screenName:s}),t.okButtonLabel=this.getMessage("snkApplication.newVersionPopup.okButton"),t.cancelButtonLabel=this.getMessage("snkApplication.newVersionPopup.cancelButton");const e=document.createElement("p");e.innerText=this.getMessage("snkApplication.newVersionPopup.info"),e.className="ez-text",t.appendChild(e),t.addEventListener("ezModalAction",this.newVersionPopupEventListener.bind(this));const i=await v.showPopup({content:t});this._removeVersionLayoutPopup=async()=>{await i(),await this.processPendingActions(this.NEW_VERSION_POPUP_LOCKER)}}async newVersionPopupEventListener(t){"LOAD"!==t.detail&&("OK"===t.detail&&x.setScreenToUseV3Layout(),"CANCEL"===t.detail&&x.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(){y.setContextValue("__SNK__APPLICATION__LOADING__",!0),this._errorHandler=new B(this),this.messagesBuilder=new T,y.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${I.getUrlBase()}/mge/upload/file`),y.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,s,e)=>this.executeSearch(t,s,e))),y.setContextValue("__EZUI__GRID_LICENSE__",q),this.registerPkChangeListener(),P.init(),g.preload(this.applicationResourceID,this.configName,{gridLegacyConfig:this.gridLegacyConfigName,formLegacyConfig:this.formLegacyConfigName}),document.addEventListener("click",(()=>x.applicationClick())),this._waitingAppReady.forEach((t=>t()))}connectedCallback(){y.setContextValue("__SNK__APPLICATION__",this),A.addRequestListener(this._requestListener)}disconnectedCallback(){A.removeRequestListener(this._requestListener),this.removeShortcuts()}async componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{y.setContextValue("__SNK__APPLICATION__LOADING__",!1),this.applicationLoaded.emit(!0),this.pkChangeListener()})),m.addIDInfo(this._element,`resource_${this.applicationResourceID}`),await this.handleShowNewVersionPopup(),this.initKeyboardManager()}initKeyboardManager(){this._keyboardManager.bind("ctrl + g",x.searchApp.bind(this),{description:"Pesquisar por telas"}).bind("ctrl + d",x.showDesktop.bind(this),{description:"Mostrar o desktop"}).bind("F1",x.openHelp.bind(this),{description:"Abrir ajuda"})}removeShortcuts(){this._keyboardManager.unbind("ctrl + g").unbind("ctrl + d").unbind("F1")}render(){return e("div",null,e("ez-loading-bar",{ref:t=>this._requestListener.ezLoadingBar=t}),e("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),e("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}get _element(){return i(this)}static get watchers(){return{loadByPK:["watchPropHandler"]}}};class G{constructor(t,s){this.resolve=t,this.reject=s}}W.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{W as snk_application}
@@ -1 +1 @@
1
- import{r as i,c as e,h as t,F as s}from"./p-d2d301a6.js";import{Action as r,ElementIDUtils as a}from"@sankhyalabs/core";import{S as n}from"./p-fadc8339.js";import{buildFormMetadata as d,FormMetadata as o}from"@sankhyalabs/ezui/dist/collection/utils/form";import{o as h,T as l,b as u}from"./p-23736d75.js";import{T as c}from"./p-7e7a7473.js";import{V as v}from"./p-95ce311a.js";import"./p-f3434fc4.js";import"./p-8a9638ae.js";import{P as g}from"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-47bce500.js";import"./p-ff1990ad.js";import"./p-06421fdb.js";import{SelectionMode as m}from"@sankhyalabs/core/dist/dataunit/DataUnit";const k="__FORM:",f=class{constructor(t){i(this,t),this.exit=e(this,"exit",7),this.actionClick=e(this,"actionClick",7),this.formItemsReady=e(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={}}observeDataUnit(){this.loadGuides(!0)}observeDataState(i,e){const t=null==i?void 0:i.selectedRecord,s=null==e?void 0:e.selectedRecord;(null==t?void 0:t.__record__id__)!==(null==s?void 0:s.__record__id__)&&this.loadGuides((null==e?void 0:e.insertionMode)!=(null==i?void 0:i.insertionMode))}observeMasterFormConfig(){this.loadGuides(this.noGuideSelected())}async showFormConfig(i=!1){const e=!i||null==this._currentDetail;this._formEditorConfigManager=e?this._configManager:this._currentDetail.formConfigManager,this._formEditorDataUnit=e?this.dataUnit:this._currentDetail.dataUnit}async findField(){await h(this._moreOptions,this._fieldSearch)}async addCustomEditor(i,e){this._customEditors=Object.assign(Object.assign({},this._customEditors),{[i]:e})}async addGridCustomRender(i,e){this._customRenders=Object.assign(Object.assign({},this._customRenders),{[i]:e})}async setFieldProp(i,e,t){const s={[i]:Object.assign(Object.assign({},this._fieldsProps[i]),{[e]:t})};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===c.CONFIGURATOR&&"master"!=i.target.dataset.taskbarOwner&&(this._snkConfigurator.open(),i.stopImmediatePropagation(),i.stopPropagation())}onContentCardChanged(i){f.updateContentCard(i.detail.formName,i.detail.cardConfig,i.detail.propertyChanged,this._configManager).then((()=>this.masterFormConfig=this._configManager.getConfig(this.dataUnit)))}getMessage(i){return this.messagesBuilder.getMessage(i,this.dataUnit.getSelectedRecord())}loadGuides(i){if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this._masterFormMetadata=d(this.masterFormConfig,this.dataUnit,!0);const e=this._masterFormMetadata.getAllSheets(),t=this.dataUnit.getSelectedRecord(),s=!t||this.dataUnit.isNewRecord(t.__record__id__),r=[];Array.from(e.values()).forEach((i=>{const e={id:i.name,label:i.label};this.isDetail(i.name)&&s&&(e.tooltip="Para alterar detalhes é necessário estar com um registro selecionado.",e.disabled=!0),r.push(e)})),this._guides=r,this._guideNavigator&&this._guideNavigator.updateItem(this._guides),i&&(this.selectedGuide=this._guides.length>0?this._guides[0]:void 0)}isDetail(i){return null!=o.getDetailName(i)}updateGuide(i){this._guideBuilders.set(i.id,i);const e=i.buildGuideItem(this._guideBuilders);this._guideNavigator&&(this._guideNavigator.updateItem(e).then((()=>{this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))})),this._guides=this._guides.map((i=>i.id===e.id?Object.assign(Object.assign(Object.assign({},i),e),void 0!==e.children?{}:{children:void 0}):i)))}getTaskBarId(){var i;return(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"snkGuideViewer.finish_edition":"snkGuideViewer.regular"}loadTaskbarProcessor(){var i;const e=this.getTaskBarId(),t=[];this.dataState&&this.dataState.hasPrevious||t.push("PREVIOUS"),this.dataState&&this.dataState.hasNext||t.push("NEXT"),(null===(i=this.dataState)||void 0===i?void 0:i.selectionInfo)&&(this.dataState.selectionInfo.length>1&&t.push("CLONE"),this.dataState.selectionInfo.isAllRecords()&&t.push("REMOVE"));const s=["PREVIOUS","NEXT","DIVIDER","ATTACH","CLONE","REMOVE","MORE_OPTIONS","ACTIONS_BUTTON","DIVIDER","GRID_MODE","CONFIGURATOR"];this.presentationMode==g.SECONDARY?s.unshift("INSERT"):s.push("INSERT");const r=this.getInvisibleButtons();this._taskbarProcessor=new l({"snkGuideViewer.regular":s,"snkGuideViewer.finish_edition":["CANCEL","SAVE",this.handleAddGridMode()]}),this._taskbarProcessor.process(e,this.taskbarManager,this.dataState,t,r)}handleAddGridMode(){return this.enableGridInsert?c.GRID_MODE:""}getInvisibleButtons(){const i=[];return this.dataState&&this.dataState.selectionInfo.mode===m.ALL_RECORDS&&i.push("ACTIONS_BUTTON"),i}static updateContentCard(i,e,t,s){return s.saveCardState(i,e,t)}static buildFixedForms(i){var e;const r=null===(e=i.formConfig)||void 0===e?void 0:e.cardsState;if(null!=r)return t(s,null,Array.from(r.entries()).filter((([e,t])=>(null==t?void 0:t.fixed)&&e!=i.selectedForm)).sort((([,i],[,e])=>((null==i?void 0:i.fixSequence)||0)-((null==e?void 0:e.fixSequence)||0))).map((([e,s])=>{var r,a;const n=i.formMetadata.getSheet(e);if(null!=n)return t("snk-form-view",{levelPath:i.levelPath,label:n.label,name:e,fields:n.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===(a=null===(r=i.formConfig)||void 0===r?void 0:r.summary)||void 0===a?void 0:a.get(e),fieldToFocus:i.fieldToFocus,key:e,onSnkRequestClearFieldToFocus:()=>{var e;return null===(e=i.onRequestClearFieldToFocus)||void 0===e?void 0:e.call(i)},customEditors:i.propsCustomEditor,fieldsProps:i.fieldsProps})})))}wrapDetail(i,e){if(0===i.length)return e;const s=i.pop(),r=o.getDetailName(s);return r?this.wrapDetail(i,t("snk-data-unit",{dataUnitName:`${this.getDataUnitName(i,r)}`,entityName:r},e)):void 0}getDataUnitName(i,e){if(i.length>0){const t=i.map((i=>o.getDetailName(i)));return`${this.entityPath}/${t.join("/")}/${e}`}return`${this.entityPath}/${e}`}getContent(){var i,e,s,r,a;if(!this.selectedGuide)return;const n=this.selectedGuide.id;let d;const h=n.split("::"),l=h.pop(),u=o.getDetailName(l);let c=n;if(u||h.length>0){let e,s;if(n.includes(k)){[c,e]=n.split(k);const t=(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)||0;s=t>1?this._breadcrumbItems[t-2]:this.selectedGuide}else s=this.selectedGuide;d=this.wrapDetail(h,t("snk-detail-view",{ref:i=>this._currentDetail=i,dataUnitName:this.getDataUnitName(h,u),onSnkDetailGuidesChange:i=>this.updateGuide(i.detail),entityName:u,selectedForm:e,branchGuide:s,guideItemPath:this._breadcrumbItems,key:`detail${c}`,canEdit:this.canEdit,onSnkSwitchGuide:i=>this._guideNavigator.selectGuide(i.detail),resourceID:this.resourceID,taskbarCustomContainerId:this.detailTaskbarCustomContainerId,customEditors:this._customEditors,customRenders:this._customRenders}))}else{const i=this.selectedGuide.id,o=this._masterFormMetadata.getSheet(i);if(o){const h=null===(s=null===(e=this.masterFormConfig)||void 0===e?void 0:e.cardsState)||void 0===s?void 0:s.get(i);d=t("snk-form-view",{ref:i=>this._mainForm=i,fixed:null==h?void 0:h.fixed,summaryFields:null===(a=null===(r=this.masterFormConfig)||void 0===r?void 0:r.summary)||void 0===a?void 0:a.get(i),name:i,label:o.label,fields:o.fields,dataUnit:this.dataUnit,formMetadata:this._masterFormMetadata,recordsValidator:this.recordsValidator,fieldToFocus:this._fieldToGetFocus,key:n,onSnkRequestClearFieldToFocus:()=>this.clearFieldToFocusHandler(),customEditors:this._customEditors,fieldsProps:this._fieldsProps},this.presentationMode==g.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 e;null===(e=this._guideNavigator)||void 0===e||e.selectGuide(i)}clearFieldToFocusHandler(){this._fieldToGetFocus=void 0}resetGuideBadge(i){var e;this._guides=[...null===(e=this._guides)||void 0===e?void 0:e.map((e=>this.canClearGuideBadge(e,i.id)?Object.assign(Object.assign({},e),{badge:null}):e))]}canClearGuideBadge(i,e){return i.id===e||this.isIncludedInChildrenList(i,e)}isIncludedInChildrenList(i,e){return this.hasChildren(i)&&this.getChildrenIdList(i).includes(e)}hasChildren(i){return i.children&&Array.isArray(i.children)}getChildrenIdList(i){return i.children.map((i=>i.id))}getConfigViewMode(){return v.GRID}changeConfigViewMode(i){this._currentDetail&&this._currentDetail.changeViewMode(i)}openConfig(i){this._snkConfigurator.close(),this._currentDetail&&(i===v.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("Erro interno: resourceID não informado");this._configManager=new n(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,e){return(null==this._fieldSearch||this._hasToCreateFieldSearch)&&(this._hasToCreateFieldSearch=!1,this._moreOptions=i,i.addEventListener("taskbarActionsButtonDisconnected",(()=>this._hasToCreateFieldSearch=!0)),this._fieldSearch=u(e,(({argument:i})=>this.fieldsOptionLoader(i)),(e=>this.onSelectField(e,i)))),this._fieldSearch}fieldsOptionLoader(i){return Promise.resolve(this._configManager.getFieldsList(i).map((i=>({value:i.name,label:i.label}))))}onSelectField(i,e){if(null==i)return;this._fieldToGetFocus=i.value;const t=this.getGuideName(i.value);t!==this.selectedGuide.id&&this.changeGuideHandler(t),e.hideActions()}getActionsList(){return[{value:"",label:this.getMessage("snkCrud.findColumn"),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,e)=>this.getFieldsSearch(i,e)}].concat(null!=this.taskbarManager&&null!=this.taskbarManager.getMoreOptions?this.taskbarManager.getMoreOptions(this.getTaskBarId(),this.configName,this.dataState,this.actionsList):this.actionsList)}buildTaskBar(){var i;return t("div",{class:"snk-guides-viewer__header-taskbar "+(this.presentationMode!=g.SECONDARY?"ez-align--right":"ez-padding-bottom--medium")},t("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(),messagesBuilder:this.messagesBuilder,presentationMode:this.presentationMode,primaryButton:(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"SAVE":"INSERT","data-taskbar-owner":"master",dataUnit:this.dataUnit,resourceID:this.resourceID,customSlotId:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS",alignRigth:!0},t("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"})))}async dataUnitActionHandler(i){var e;if(i.type===r.FIELD_INVALIDATED){const t=this.getGuideName(null===(e=i.payload)||void 0===e?void 0:e.fieldName);await this.addErrorBadgeToGuide(t),await this.openGuideNavigator(t)}}async addErrorBadgeToGuide(i){var e;this._guides=[...null===(e=this._guides)||void 0===e?void 0:e.map((e=>Object.assign(Object.assign({},e),{badge:this.getBadge(e,i)})))]}async openGuideNavigator(i){this.selectedGuide.id!==i&&await this._guideNavigator.openGuideNavidator()}getBadge(i,e){var t;return this.selectedGuide.id===e?null:e===i.id?"error":null!==(t=i.badge)&&void 0!==t?t:null}getGuideName(i){var e;for(const t of this._masterFormMetadata.getAllSheets()){const s=null===(e=t[1])||void 0===e?void 0:e.fields;for(const e of s)if(e.name===i)return t[0]}return""}getTitle(){var i,e;return null!==(e=null===(i=this.getCustomTitle)||void 0===i?void 0:i.call(this))&&void 0!==e?e:this.getMessage("snkCrud.title")}componentDidLoad(){this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this))}render(){var i,e;if(null!=this._formEditorConfigManager)return t("snk-form-config",{ref:i=>this._container=i,tabindex:-1,dataUnit:this._formEditorDataUnit,messagesBuilder:this.messagesBuilder,configManager:this._formEditorConfigManager,onConfigClose:()=>this._formEditorConfigManager=null,ignoreReadOnlyFormFields:this.ignoreReadOnlyFormFields});if(!this.dataUnit||!this._configManager.isLoaded)return;this.loadTaskbarProcessor();const s=this._guides&&this._guides.length>1;return t("section",{class:"snk-guides-viewer",ref:i=>this._container=i,tabindex:-1},t("div",{class:"ez-row snk-guides-viewer__header"},t("div",{class:"snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large",key:"header"},t("ez-button",{onClick:()=>this.exitViewer(),title:this.getMessage("snkCrud.goBackTitle"),mode:"icon",iconName:"arrow_back",class:"ez-padding-right--medium",size:"small"}),t("div",{class:"ez-flex ez-flex--column ez-flex-item--auto"},t("h1",{class:"ez-title ez-title--primary ez-title--xlarge"},this.getTitle()),(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)>1&&t("div",{class:"ez-margin-top--extra-small"},t("ez-breadcrumb",Object.assign({items:this._breadcrumbItems,onSelectedItem:i=>this.onBreadcrumbClickHandler(null==i?void 0:i.detail)},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo("breadcrumb")}`}))))),this.presentationMode!=g.SECONDARY&&this.buildTaskBar()),t("div",{class:"snk-guides-viewer__container"},s?t("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)}):t("div",null),t("div",{class:"snk-guides-viewer__detail-container"},f.buildFixedForms({formConfig:this.masterFormConfig,formMetadata:this._masterFormMetadata,selectedForm:null===(e=this.selectedGuide)||void 0===e?void 0:e.id,dataUnit:this.dataUnit,recordsValidator:this.recordsValidator,fieldToFocus:this._fieldToGetFocus,onRequestClearFieldToFocus:this.clearFieldToFocusHandler.bind(this),propsCustomEditor:this._customEditors,fieldsProps:this._fieldsProps}),this.getContent())),t("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}))}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observeDataState"],masterFormConfig:["observeMasterFormConfig"]}}};f.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{f as S}
1
+ import{r as i,c as e,h as t,F as s}from"./p-d2d301a6.js";import{Action as r,ElementIDUtils as a}from"@sankhyalabs/core";import{S as n}from"./p-0e206e62.js";import{buildFormMetadata as d,FormMetadata as o}from"@sankhyalabs/ezui/dist/collection/utils/form";import{o as h,T as l,b as u}from"./p-23736d75.js";import{T as c}from"./p-7e7a7473.js";import{V as v}from"./p-95ce311a.js";import"./p-00278e07.js";import"./p-341465ce.js";import{P as g}from"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-47d24ac8.js";import"./p-ff1990ad.js";import"./p-126c58ea.js";import{SelectionMode as m}from"@sankhyalabs/core/dist/dataunit/DataUnit";const k="__FORM:",p=class{constructor(t){i(this,t),this.exit=e(this,"exit",7),this.actionClick=e(this,"actionClick",7),this.formItemsReady=e(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={}}observeDataUnit(){this.loadGuides(!0)}observeDataState(i,e){const t=null==i?void 0:i.selectedRecord,s=null==e?void 0:e.selectedRecord;(null==t?void 0:t.__record__id__)!==(null==s?void 0:s.__record__id__)&&this.loadGuides((null==e?void 0:e.insertionMode)!=(null==i?void 0:i.insertionMode))}observeMasterFormConfig(){this.loadGuides(this.noGuideSelected())}async showFormConfig(i=!1){const e=!i||null==this._currentDetail;this._formEditorConfigManager=e?this._configManager:this._currentDetail.formConfigManager,this._formEditorDataUnit=e?this.dataUnit:this._currentDetail.dataUnit}async findField(){await h(this._moreOptions,this._fieldSearch)}async addCustomEditor(i,e){this._customEditors=Object.assign(Object.assign({},this._customEditors),{[i]:e})}async addGridCustomRender(i,e){this._customRenders=Object.assign(Object.assign({},this._customRenders),{[i]:e})}async setFieldProp(i,e,t){const s={[i]:Object.assign(Object.assign({},this._fieldsProps[i]),{[e]:t})};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===c.CONFIGURATOR&&"master"!=i.target.dataset.taskbarOwner&&(this._snkConfigurator.open(),i.stopImmediatePropagation(),i.stopPropagation())}onContentCardChanged(i){p.updateContentCard(i.detail.formName,i.detail.cardConfig,i.detail.propertyChanged,this._configManager).then((()=>this.masterFormConfig=this._configManager.getConfig(this.dataUnit)))}getMessage(i){return this.messagesBuilder.getMessage(i,this.dataUnit.getSelectedRecord())}loadGuides(i){if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this._masterFormMetadata=d(this.masterFormConfig,this.dataUnit,!0);const e=this._masterFormMetadata.getAllSheets(),t=this.dataUnit.getSelectedRecord(),s=!t||this.dataUnit.isNewRecord(t.__record__id__),r=[];Array.from(e.values()).forEach((i=>{const e={id:i.name,label:i.label};this.isDetail(i.name)&&s&&(e.tooltip="Para alterar detalhes é necessário estar com um registro selecionado.",e.disabled=!0),r.push(e)})),this._guides=r,this._guideNavigator&&this._guideNavigator.updateItem(this._guides),i&&(this.selectedGuide=this._guides.length>0?this._guides[0]:void 0)}isDetail(i){return null!=o.getDetailName(i)}updateGuide(i){this._guideBuilders.set(i.id,i);const e=i.buildGuideItem(this._guideBuilders);this._guideNavigator&&(this._guideNavigator.updateItem(e).then((()=>{this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))})),this._guides=this._guides.map((i=>i.id===e.id?Object.assign(Object.assign(Object.assign({},i),e),void 0!==e.children?{}:{children:void 0}):i)))}getTaskBarId(){var i;return(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"snkGuideViewer.finish_edition":"snkGuideViewer.regular"}loadTaskbarProcessor(){var i;const e=this.getTaskBarId(),t=[];this.dataState&&this.dataState.hasPrevious||t.push("PREVIOUS"),this.dataState&&this.dataState.hasNext||t.push("NEXT"),(null===(i=this.dataState)||void 0===i?void 0:i.selectionInfo)&&(this.dataState.selectionInfo.length>1&&t.push("CLONE"),this.dataState.selectionInfo.isAllRecords()&&t.push("REMOVE"));const s=["PREVIOUS","NEXT","DIVIDER","ATTACH","CLONE","REMOVE","MORE_OPTIONS","ACTIONS_BUTTON","DIVIDER","GRID_MODE","CONFIGURATOR"];this.presentationMode==g.SECONDARY?s.unshift("INSERT"):s.push("INSERT");const r=this.getInvisibleButtons();this._taskbarProcessor=new l({"snkGuideViewer.regular":s,"snkGuideViewer.finish_edition":["CANCEL","SAVE",this.handleAddGridMode()]}),this._taskbarProcessor.process(e,this.taskbarManager,this.dataState,t,r)}handleAddGridMode(){return this.enableGridInsert?c.GRID_MODE:""}getInvisibleButtons(){const i=[];return this.dataState&&this.dataState.selectionInfo.mode===m.ALL_RECORDS&&i.push("ACTIONS_BUTTON"),i}static updateContentCard(i,e,t,s){return s.saveCardState(i,e,t)}static buildFixedForms(i){var e;const r=null===(e=i.formConfig)||void 0===e?void 0:e.cardsState;if(null!=r)return t(s,null,Array.from(r.entries()).filter((([e,t])=>(null==t?void 0:t.fixed)&&e!=i.selectedForm)).sort((([,i],[,e])=>((null==i?void 0:i.fixSequence)||0)-((null==e?void 0:e.fixSequence)||0))).map((([e,s])=>{var r,a;const n=i.formMetadata.getSheet(e);if(null!=n)return t("snk-form-view",{levelPath:i.levelPath,label:n.label,name:e,fields:n.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===(a=null===(r=i.formConfig)||void 0===r?void 0:r.summary)||void 0===a?void 0:a.get(e),fieldToFocus:i.fieldToFocus,key:e,onSnkRequestClearFieldToFocus:()=>{var e;return null===(e=i.onRequestClearFieldToFocus)||void 0===e?void 0:e.call(i)},customEditors:i.propsCustomEditor,fieldsProps:i.fieldsProps})})))}wrapDetail(i,e){if(0===i.length)return e;const s=i.pop(),r=o.getDetailName(s);return r?this.wrapDetail(i,t("snk-data-unit",{dataUnitName:`${this.getDataUnitName(i,r)}`,entityName:r},e)):void 0}getDataUnitName(i,e){if(i.length>0){const t=i.map((i=>o.getDetailName(i)));return`${this.entityPath}/${t.join("/")}/${e}`}return`${this.entityPath}/${e}`}getContent(){var i,e,s,r,a;if(!this.selectedGuide)return;const n=this.selectedGuide.id;let d;const h=n.split("::"),l=h.pop(),u=o.getDetailName(l);let c=n;if(u||h.length>0){let e,s;if(n.includes(k)){[c,e]=n.split(k);const t=(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)||0;s=t>1?this._breadcrumbItems[t-2]:this.selectedGuide}else s=this.selectedGuide;d=this.wrapDetail(h,t("snk-detail-view",{ref:i=>this._currentDetail=i,dataUnitName:this.getDataUnitName(h,u),onSnkDetailGuidesChange:i=>this.updateGuide(i.detail),entityName:u,selectedForm:e,branchGuide:s,guideItemPath:this._breadcrumbItems,key:`detail${c}`,canEdit:this.canEdit,onSnkSwitchGuide:i=>this._guideNavigator.selectGuide(i.detail),resourceID:this.resourceID,taskbarCustomContainerId:this.detailTaskbarCustomContainerId,customEditors:this._customEditors,customRenders:this._customRenders}))}else{const i=this.selectedGuide.id,o=this._masterFormMetadata.getSheet(i);if(o){const h=null===(s=null===(e=this.masterFormConfig)||void 0===e?void 0:e.cardsState)||void 0===s?void 0:s.get(i);d=t("snk-form-view",{ref:i=>this._mainForm=i,fixed:null==h?void 0:h.fixed,summaryFields:null===(a=null===(r=this.masterFormConfig)||void 0===r?void 0:r.summary)||void 0===a?void 0:a.get(i),name:i,label:o.label,fields:o.fields,dataUnit:this.dataUnit,formMetadata:this._masterFormMetadata,recordsValidator:this.recordsValidator,fieldToFocus:this._fieldToGetFocus,key:n,onSnkRequestClearFieldToFocus:()=>this.clearFieldToFocusHandler(),customEditors:this._customEditors,fieldsProps:this._fieldsProps},this.presentationMode==g.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 e;null===(e=this._guideNavigator)||void 0===e||e.selectGuide(i)}clearFieldToFocusHandler(){this._fieldToGetFocus=void 0}resetGuideBadge(i){var e;this._guides=[...null===(e=this._guides)||void 0===e?void 0:e.map((e=>this.canClearGuideBadge(e,i.id)?Object.assign(Object.assign({},e),{badge:null}):e))]}canClearGuideBadge(i,e){return i.id===e||this.isIncludedInChildrenList(i,e)}isIncludedInChildrenList(i,e){return this.hasChildren(i)&&this.getChildrenIdList(i).includes(e)}hasChildren(i){return i.children&&Array.isArray(i.children)}getChildrenIdList(i){return i.children.map((i=>i.id))}getConfigViewMode(){return v.GRID}changeConfigViewMode(i){this._currentDetail&&this._currentDetail.changeViewMode(i)}openConfig(i){this._snkConfigurator.close(),this._currentDetail&&(i===v.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("Erro interno: resourceID não informado");this._configManager=new n(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,e){return(null==this._fieldSearch||this._hasToCreateFieldSearch)&&(this._hasToCreateFieldSearch=!1,this._moreOptions=i,i.addEventListener("taskbarActionsButtonDisconnected",(()=>this._hasToCreateFieldSearch=!0)),this._fieldSearch=u(e,(({argument:i})=>this.fieldsOptionLoader(i)),(e=>this.onSelectField(e,i)))),this._fieldSearch}fieldsOptionLoader(i){return Promise.resolve(this._configManager.getFieldsList(i).map((i=>({value:i.name,label:i.label}))))}onSelectField(i,e){if(null==i)return;this._fieldToGetFocus=i.value;const t=this.getGuideName(i.value);t!==this.selectedGuide.id&&this.changeGuideHandler(t),e.hideActions()}getActionsList(){return[{value:"",label:this.getMessage("snkCrud.findColumn"),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,e)=>this.getFieldsSearch(i,e)}].concat(null!=this.taskbarManager&&null!=this.taskbarManager.getMoreOptions?this.taskbarManager.getMoreOptions(this.getTaskBarId(),this.configName,this.dataState,this.actionsList):this.actionsList)}buildTaskBar(){var i;return t("div",{class:"snk-guides-viewer__header-taskbar "+(this.presentationMode!=g.SECONDARY?"ez-align--right":"ez-padding-bottom--medium")},t("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(),messagesBuilder:this.messagesBuilder,presentationMode:this.presentationMode,primaryButton:(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"SAVE":"INSERT","data-taskbar-owner":"master",dataUnit:this.dataUnit,resourceID:this.resourceID,customSlotId:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS",alignRigth:!0},t("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"})))}async dataUnitActionHandler(i){var e;if(i.type===r.FIELD_INVALIDATED){const t=this.getGuideName(null===(e=i.payload)||void 0===e?void 0:e.fieldName);await this.addErrorBadgeToGuide(t),await this.openGuideNavigator(t)}i.type===r.METADATA_LOADED&&this.loadGuides(!1)}async addErrorBadgeToGuide(i){var e;this._guides=[...null===(e=this._guides)||void 0===e?void 0:e.map((e=>Object.assign(Object.assign({},e),{badge:this.getBadge(e,i)})))]}async openGuideNavigator(i){this.selectedGuide.id!==i&&await this._guideNavigator.openGuideNavidator()}getBadge(i,e){var t;return this.selectedGuide.id===e?null:e===i.id?"error":null!==(t=i.badge)&&void 0!==t?t:null}getGuideName(i){var e;for(const t of this._masterFormMetadata.getAllSheets()){const s=null===(e=t[1])||void 0===e?void 0:e.fields;for(const e of s)if(e.name===i)return t[0]}return""}getTitle(){var i,e;return null!==(e=null===(i=this.getCustomTitle)||void 0===i?void 0:i.call(this))&&void 0!==e?e:this.getMessage("snkCrud.title")}componentDidLoad(){this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this))}render(){var i,e;if(null!=this._formEditorConfigManager)return t("snk-form-config",{ref:i=>this._container=i,tabindex:-1,dataUnit:this._formEditorDataUnit,messagesBuilder:this.messagesBuilder,configManager:this._formEditorConfigManager,onConfigClose:()=>this._formEditorConfigManager=null,ignoreReadOnlyFormFields:this.ignoreReadOnlyFormFields});if(!this.dataUnit||!this._configManager.isLoaded)return;this.loadTaskbarProcessor();const s=this._guides&&this._guides.length>1;return t("section",{class:"snk-guides-viewer",ref:i=>this._container=i,tabindex:-1},t("div",{class:"ez-row snk-guides-viewer__header"},t("div",{class:"snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large",key:"header"},t("ez-button",{onClick:()=>this.exitViewer(),title:this.getMessage("snkCrud.goBackTitle"),mode:"icon",iconName:"arrow_back",class:"ez-padding-right--medium",size:"small"}),t("div",{class:"ez-flex ez-flex--column ez-flex-item--auto"},t("h1",{class:"ez-title ez-title--primary ez-title--xlarge"},this.getTitle()),(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)>1&&t("div",{class:"ez-margin-top--extra-small"},t("ez-breadcrumb",Object.assign({items:this._breadcrumbItems,onSelectedItem:i=>this.onBreadcrumbClickHandler(null==i?void 0:i.detail)},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo("breadcrumb")}`}))))),this.presentationMode!=g.SECONDARY&&this.buildTaskBar()),t("div",{class:"snk-guides-viewer__container"},s?t("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)}):t("div",null),t("div",{class:"snk-guides-viewer__detail-container"},p.buildFixedForms({formConfig:this.masterFormConfig,formMetadata:this._masterFormMetadata,selectedForm:null===(e=this.selectedGuide)||void 0===e?void 0:e.id,dataUnit:this.dataUnit,recordsValidator:this.recordsValidator,fieldToFocus:this._fieldToGetFocus,onRequestClearFieldToFocus:this.clearFieldToFocusHandler.bind(this),propsCustomEditor:this._customEditors,fieldsProps:this._fieldsProps}),this.getContent())),t("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}))}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observeDataState"],masterFormConfig:["observeMasterFormConfig"]}}};p.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{p as S}
@@ -1 +1 @@
1
- import{D as t}from"./p-f3434fc4.js";import"./p-8a9638ae.js";import{SortMode as i,ApplicationContext as s,UserInterface as e,DateUtils as r,ObjectUtils as a,StringUtils as n,NumberUtils as o,DataType as l}from"@sankhyalabs/core";import"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import{UserInterface as c}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{P as u}from"./p-47bce500.js";import"./p-ff1990ad.js";import"./p-06421fdb.js";import d from"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";import{h}from"./p-d2d301a6.js";class m{static assertDefaultSorting(t,s){t&&s&&(s.defaultSorting=t.columns.filter((t=>null!=t.ascending)).sort(((t,i)=>t.orderIndex-i.orderIndex)).map((({name:t,ascending:e})=>{const{dataType:r}=s.getField(t);return{field:t,dataType:r,mode:e?i.ASC:i.DESC}})))}static parseCrudResults(t,i){Array.isArray(t)||(t=[t]);const s=[];for(const e of t){let t={fields:new Map};for(let s in e){let r=e[s];if(r.hasOwnProperty("$")&&t.fields.set(s,r.$),i)break}s.push(t)}return s.length>1?s:s[0]}static find(i,e,r,a=!0,n,o){let l=[],c=[],u={},d=s.getContextValue("__SNK__APPLICATION__");if(e){if(!Array.isArray(e))throw new Error(d.messagesBuilder.getMessage("crudUtils.errorArray",null));e.forEach((t=>{l.push({name:t})}))}if(r)for(const t in r)r.hasOwnProperty(t)&&c.push({nome:t,valor:r[t]});n&&(u={expression:{$:n}});let h={requestBody:{entity:{name:i,criterio:c,fields:{field:l},literalCriteria:u,orderby:o}}};return new Promise((i=>{t.get().callServiceBroker("mge@crud.find",JSON.stringify(h)).then((t=>{var s;let e=null===(s=t.entidades)||void 0===s?void 0:s.entidade;e||i(null);const r=this.parseCrudResults(e,a);i(r)}))}))}}class f{setDataUnit(t){this._dataUnit=t}setApplication(t){this._application=t}formatLabel(t,i){const{userInterface:s}=this._dataUnit.getField(t);return s===e.DATETIME?r.formatDate(this._dataUnit.valueFromString(t,i)):String(this._dataUnit.getFormattedValue(t,i))}async getStaticOptions(t){return Promise.resolve(null==t?void 0:await u.getDistinct(this._dataUnit,t))}fetchData(t,i){return new Promise((s=>{this._application.executeSelectDistinct(this._dataUnit,i,t).then((t=>{s(t.map((t=>this._dataUnit.getField(i).userInterface===e.SEARCH?Object.assign(Object.assign({},JSON.parse(t)),{check:!0}):{value:t,label:this.formatLabel(i,t),check:!0})))}))}))}sortItems(t,i){return d.defaultSorterMultSelectionOption(this._dataUnit,t,i)}}class p{setGrid(t){this._grid||(this._grid=t,this.refreshSelectedRows())}setDataState(t){this._dataState&&a.equals(null==t?void 0:t.metadataByRow,this._dataState.metadataByRow)||(this._dataState=t,this.refreshSelectedRows())}format(t,i,s){var e;if(n.isEmpty(t))return t;const r=null===(e=this._dataState)||void 0===e?void 0:e.metadataByRow.get(s),a=null==r?void 0:r.getProp("rm_precision",i.name);return a||0===a?o.format(t,a,a):t}refreshSelectedRows(){var t;null===(t=this._grid)||void 0===t||t.refreshSelectedRows()}}class v{constructor(t,i){this.dataUnit=t,this.grid=i}async getColumnsMetadata(){var t;return this.columnsState=await(null===(t=this.grid)||void 0===t?void 0:t.getColumnsState())||[],await this.buildColumnsMetadata(this.columnsState)}getColumnsState(){return this.columnsState}async buildColumnsMetadata(t){var i,s;const e=[];for(const r of t){if(r.hidden&&"RECDESP"!==r.name)continue;const t=null===(i=this.dataUnit)||void 0===i?void 0:i.getField(r.name),a=await this.grid.getCustomValueFormatter(r.name);if(e.push({label:r.label,id:r.name,width:r.width,type:null==t?void 0:t.dataType,userInterface:null==t?void 0:t.userInterface,customFormatter:a}),null!=(null===(s=null==t?void 0:t.properties)||void 0===s?void 0:s.DESCRIPTIONFIELD)){const i=t.properties.mergedFrom;e.push({label:t.properties.DESCRIPTIONENTITY,id:`${i?i+".":""}${t.properties.ENTITYNAME}.${t.properties.DESCRIPTIONFIELD}`,width:r.width,type:l.TEXT,userInterface:c.LONGTEXT,descriptionFrom:t.name})}}return e||[]}}class b{constructor(t,i,s){this.snkApplication=t,this.keyConfigEnableContinuousInsert=`${i}enableContinuousInsert${s||""}`}handleSaveConfig(t){return this.snkApplication.saveConfig(this.keyConfigEnableContinuousInsert,t)}getConfig(){return this.snkApplication.getConfig(this.keyConfigEnableContinuousInsert).then((t=>!!t&&"true"==t)).catch((()=>!1))}actionContinuousInsert(t,i){return{value:n.generateUUID(),label:t?"Desativar inclusão contínua":"Ativar inclusão contínua",enabled:!0,itemBuilder:()=>h("div",{class:"ez-dropdown__item-wrapper",onClick:i},h("span",{class:"ez-dropdown__item-label"},t?"Desativar inclusão contínua":"Ativar inclusão contínua"))}}}export{v as C,p as R,f as S,m as a,b}
1
+ import{D as t}from"./p-00278e07.js";import"./p-341465ce.js";import{SortMode as i,ApplicationContext as s,UserInterface as e,DateUtils as r,ObjectUtils as a,StringUtils as n,NumberUtils as o,DataType as l}from"@sankhyalabs/core";import"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import{UserInterface as c}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{P as u}from"./p-47d24ac8.js";import"./p-ff1990ad.js";import"./p-126c58ea.js";import d from"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";import{h}from"./p-d2d301a6.js";class m{static assertDefaultSorting(t,s){t&&s&&(s.defaultSorting=t.columns.filter((t=>null!=t.ascending)).sort(((t,i)=>t.orderIndex-i.orderIndex)).map((({name:t,ascending:e})=>{const{dataType:r}=s.getField(t);return{field:t,dataType:r,mode:e?i.ASC:i.DESC}})))}static parseCrudResults(t,i){Array.isArray(t)||(t=[t]);const s=[];for(const e of t){let t={fields:new Map};for(let s in e){let r=e[s];if(r.hasOwnProperty("$")&&t.fields.set(s,r.$),i)break}s.push(t)}return s.length>1?s:s[0]}static find(i,e,r,a=!0,n,o){let l=[],c=[],u={},d=s.getContextValue("__SNK__APPLICATION__");if(e){if(!Array.isArray(e))throw new Error(d.messagesBuilder.getMessage("crudUtils.errorArray",null));e.forEach((t=>{l.push({name:t})}))}if(r)for(const t in r)r.hasOwnProperty(t)&&c.push({nome:t,valor:r[t]});n&&(u={expression:{$:n}});let h={requestBody:{entity:{name:i,criterio:c,fields:{field:l},literalCriteria:u,orderby:o}}};return new Promise((i=>{t.get().callServiceBroker("mge@crud.find",JSON.stringify(h)).then((t=>{var s;let e=null===(s=t.entidades)||void 0===s?void 0:s.entidade;e||i(null);const r=this.parseCrudResults(e,a);i(r)}))}))}}class f{setDataUnit(t){this._dataUnit=t}setApplication(t){this._application=t}formatLabel(t,i){const{userInterface:s}=this._dataUnit.getField(t);return s===e.DATETIME?r.formatDate(this._dataUnit.valueFromString(t,i)):String(this._dataUnit.getFormattedValue(t,i))}async getStaticOptions(t){return Promise.resolve(null==t?void 0:await u.getDistinct(this._dataUnit,t))}fetchData(t,i){return new Promise((s=>{this._application.executeSelectDistinct(this._dataUnit,i,t).then((t=>{s(t.map((t=>this._dataUnit.getField(i).userInterface===e.SEARCH?Object.assign(Object.assign({},JSON.parse(t)),{check:!0}):{value:t,label:this.formatLabel(i,t),check:!0})))}))}))}sortItems(t,i){return d.defaultSorterMultSelectionOption(this._dataUnit,t,i)}}class p{setGrid(t){this._grid||(this._grid=t,this.refreshSelectedRows())}setDataState(t){this._dataState&&a.equals(null==t?void 0:t.metadataByRow,this._dataState.metadataByRow)||(this._dataState=t,this.refreshSelectedRows())}format(t,i,s){var e;if(n.isEmpty(t))return t;const r=null===(e=this._dataState)||void 0===e?void 0:e.metadataByRow.get(s),a=null==r?void 0:r.getProp("rm_precision",i.name);return a||0===a?o.format(t,a,a):t}refreshSelectedRows(){var t;null===(t=this._grid)||void 0===t||t.refreshSelectedRows()}}class v{constructor(t,i){this.dataUnit=t,this.grid=i}async getColumnsMetadata(){var t;return this.columnsState=await(null===(t=this.grid)||void 0===t?void 0:t.getColumnsState())||[],await this.buildColumnsMetadata(this.columnsState)}getColumnsState(){return this.columnsState}async buildColumnsMetadata(t){var i,s;const e=[];for(const r of t){if(r.hidden&&"RECDESP"!==r.name)continue;const t=null===(i=this.dataUnit)||void 0===i?void 0:i.getField(r.name),a=await this.grid.getCustomValueFormatter(r.name);if(e.push({label:r.label,id:r.name,width:r.width,type:null==t?void 0:t.dataType,userInterface:null==t?void 0:t.userInterface,customFormatter:a}),null!=(null===(s=null==t?void 0:t.properties)||void 0===s?void 0:s.DESCRIPTIONFIELD)){const i=t.properties.mergedFrom;e.push({label:t.properties.DESCRIPTIONENTITY,id:`${i?i+".":""}${t.properties.ENTITYNAME}.${t.properties.DESCRIPTIONFIELD}`,width:r.width,type:l.TEXT,userInterface:c.LONGTEXT,descriptionFrom:t.name})}}return e||[]}}class b{constructor(t,i,s){this.snkApplication=t,this.keyConfigEnableContinuousInsert=`${i}enableContinuousInsert${s||""}`}handleSaveConfig(t){return this.snkApplication.saveConfig(this.keyConfigEnableContinuousInsert,t)}getConfig(){return this.snkApplication.getConfig(this.keyConfigEnableContinuousInsert).then((t=>!!t&&"true"==t)).catch((()=>!1))}actionContinuousInsert(t,i){return{value:n.generateUUID(),label:t?"Desativar inclusão contínua":"Ativar inclusão contínua",enabled:!0,itemBuilder:()=>h("div",{class:"ez-dropdown__item-wrapper",onClick:i},h("span",{class:"ez-dropdown__item-label"},t?"Desativar inclusão contínua":"Ativar inclusão contínua"))}}}export{v as C,p as R,f as S,m as a,b}
@@ -1 +1 @@
1
- import{r as t,c as i,h as s,H as e,g as a}from"./p-d2d301a6.js";import{StringUtils as o,ElementIDUtils as h,ApplicationContext as n,JSUtils as r,FloatingManager as d}from"@sankhyalabs/core";import{T as c}from"./p-7e7a7473.js";import"./p-f3434fc4.js";import"./p-8a9638ae.js";import{P as l}from"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-47bce500.js";import"./p-ff1990ad.js";import"./p-06421fdb.js";import{V as m}from"./p-95ce311a.js";import{A as u}from"./p-ca5ec380.js";import"./p-6dc031de.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";const p=class{constructor(s){t(this,s),this.actionClick=i(this,"actionClick",7),this.configuratorSave=i(this,"configuratorSave",7),this.configuratorCancel=i(this,"configuratorCancel",7),this.formItemsReady=i(this,"formItemsReady",7),this.viewModeChanged=i(this,"viewModeChanged",7),this._keyDownHandler=async t=>this.keyDownListener(t),this._viewHistory=[],this._customEditors=new Map,this._customRenders=new Map,this._dataUnit=void 0,this._dataState=void 0,this.attachmentRegisterKey=void 0,this._currentViewMode=m.GRID,this._canEdit=void 0,this._resourceID=void 0,this.configName=void 0,this.filterBarTitle=void 0,this.selectionToastConfig=void 0,this.showActionButtons=!1,this.actionsList=void 0,this.taskbarManager=void 0,this.recordsValidator=void 0,this.statusResolver=void 0,this.multipleSelection=!0,this.presentationMode=l.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.gridLegacyConfigName=void 0,this.filterBarLegacyConfigName=void 0,this.formLegacyConfigName=void 0,this.disablePersonalizedFilter=void 0,this.autoLoad=void 0,this.autoFocus=!0,this.enableGridInsert=!1,this.domainMessagesBuilder=void 0,this.ignoreReadOnlyFormFields=void 0,this.setCustomFormTitle=void 0,this.customContainerId=`SNK-CRUD-CUSTOM-CONTAINER-${o.generateUUID()}`}async goToView(t){this.executeAction(t)}async openConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.open()}async closeConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.close()}async reloadFilterBar(){var t;null===(t=this._snkGrid)||void 0===t||t.reloadFilterBar()}async getFilterBar(){return await this._snkGrid.getFilterBar()}async addCustomEditor(t,i){if(this._guidesViewer&&this._snkGrid)return this._guidesViewer.addCustomEditor(t,i),void this._snkGrid.addCustomEditor(t,i);const s=new Map(this._customEditors);s.set(t,i),this._customEditors=s}async addGridCustomRender(t,i){if(this._snkGrid)return void this._snkGrid.addGridCustomRender(t,i);const s=new Map(this._customRenders);s.set(t,i),this._customRenders=s}async addCustomValueFormatter(t,i){this._snkGrid.addCustomValueFormatter(t,i)}async removeCustomValueFormatter(t){this._snkGrid.removeCustomValueFormatter(t)}async setFieldProp(t,i,s){await this._guidesViewer.setFieldProp(t,i,s)}currentViewModeWatcher(t){this._viewHistory=[...this._viewHistory.slice(-1),t]}async gridToForm(t=!1){this._backToGrid=!t&&await this._viewStack.getSelectedIndex()===m.GRID,this.setViewMode(m.FORM)}async executeAction(t){return t===c.GRID_MODE?this.setViewMode(m.GRID):t===c.FORM_MODE||t===c.UPDATE?this.gridToForm(t!==c.UPDATE):t===c.CONFIGURATOR?this._snkConfigurator.open():"ATTACH"===t?this.setViewMode(m.ATTACHMENT):void 0}backView(){const t=this._viewHistory.at(-2)||m.GRID;this.setViewMode(t)}setViewMode(t){this._viewStack.show(t),this._currentViewMode=t,t===m.GRID?this._snkGrid.setFocus():t===m.FORM&&this._guidesViewer.setFocus(),this.viewModeChanged.emit(t)}openConfig(t){this._snkConfigurator.close(),t===m.GRID?this._snkGrid.showConfig():t===m.FORM&&this._guidesViewer.showFormConfig()}addDataElementID(){h.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}insertionModeHandler(){this.enableGridInsert||this.gridToForm()}cancelHandler(){this._backToGrid&&this.setViewMode(m.GRID)}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}setCustomRenders(){if(this._snkGrid)for(const[t,i]of this._customRenders)this._snkGrid.addGridCustomRender(t,i),this._customRenders.delete(t)}setCustomEditors(){if(this._snkGrid&&this._guidesViewer)for(const[t,i]of this._customEditors)this._guidesViewer.addCustomEditor(t,i),this._snkGrid.addCustomEditor(t,i),this._customEditors.delete(t)}componentDidRender(){this.setCustomRenders(),this.setCustomEditors()}componentWillLoad(){this._application=n.getContextValue("__SNK__APPLICATION__");let t=this._element.parentElement;for(this._application.hasAccess(u.UPDATE,this._resourceID).then((t=>this._canEdit=t));t;){if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){this._snkDataUnit=t,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._snkDataUnit.domainMessagesBuilder=this.domainMessagesBuilder,this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.initDataUnit():this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail,this.initDataUnit()})),this._snkDataUnit.addEventListener("dataStateChange",this.handleDataStateChange.bind(this));break}t=t.parentElement}this.configName||(this.configName=this._application.configName)}componentDidLoad(){this.initKeyboardManager()}disconnectedCallback(){this.removeShortcuts(),window.removeEventListener("keydown",this._keyDownHandler)}async handleDataStateChange(t){var i;this._dataState=t.detail,void 0!==this._dataState.selectedRecord&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey());const s=await this._snkDataUnit.getFieldsWithRmPrecision();for(const t of s||[]){if(!t)continue;const s=null===(i=this._dataState.rowMetadata)||void 0===i?void 0:i.getProp("rm_precision",t);(s||0===s)&&(await this.setFieldProp(t,"precision",s),await this.setFieldProp(t,"prettyPrecision",s))}}async initKeyboardManager(){var t;const i=await(null===(t=this._application)||void 0===t?void 0:t.getKeyboardManager());if(i){const s=this._dataUnit||await this._snkDataUnit.getDataUnit();async function e(){const t=document.activeElement,i=t==document.body;i||t.blur(),await s.saveData(),i||null==t.setFocus?i||t.focus():t.setFocus()}i.bind("F6",this.toggleView.bind(this),{description:"Alterna entre modo formulário e grade.",element:this._element}).bind("F7",e.bind(this),{description:"Salva os dados.",element:this._element}).bind("ctrl + \\",e.bind(this),{description:"Salva os dados.",element:this._element}).bind("F8",s.addRecord.bind(s),{description:"Adiciona um novo registro.",element:this._element}).bind("F9",s.removeSelectedRecords.bind(s),{description:"Remove o registro selecionado.",element:this._element}).bind("ctrl + F9",s.removeSelectedRecords.bind(s),{description:"Remove o registro selecionado.",element:this._element}).bind("ctrl + .",(()=>0===s.getSelectionInfo().records.length?s.selectFirst():s.nextRecord()),{description:"Avança para o próximo registro.",element:this._element}).bind("ctrl + ,",s.previousRecord.bind(s),{description:"Retorna ao registro anterior.",element:this._element}).bind("F5",(async()=>{const t=await this._viewStack.getSelectedIndex();m.GRID===t&&s.loadData()}),{description:"Atualiza os dados.",element:this._element}).bind("Escape",(()=>{s.isDirty()&&s.cancelEdition()}),{debounceTime:1e3,description:"Cancela uma ação.",element:this._element})}}async removeShortcuts(){var t;const i=await(null===(t=this._application)||void 0===t?void 0:t.getKeyboardManager());i&&i.unbind("F6").unbind("F7").unbind("ctrl + \\").unbind("F8").unbind("F9").unbind("ctrl + F9").unbind("ctrl + .").unbind("ctrl + ,").unbind("F5").unbind("Escape")}async toggleView(){const t=await this._viewStack.getSelectedIndex();this.setViewMode(m.GRID===t?m.FORM:m.GRID)}async initDataUnit(){this.addDataElementID(),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),null==this._resourceID&&(this._resourceID=this._snkDataUnit.resourceID,null==this._resourceID&&(this._resourceID=await this._application.getResourceID()))}handleConfiguratorEvent(t,i){t.stopImmediatePropagation(),"SAVE"!==i?this.configuratorCancel.emit():this.configuratorSave.emit()}async keyDownListener(t){t.ctrlKey&&null!=t.key&&"F"===t.key.toUpperCase()&&null!=this._element&&(r.isHiddenElement(this._element)||(d.closeAll(),this._currentViewMode===m.GRID?await this._snkGrid.findColumn():await this._guidesViewer.findField(),t.preventDefault()))}connectedCallback(){window.addEventListener("keydown",this._keyDownHandler,{capture:!0})}render(){if(null!=this._resourceID)return this._snkDataUnit.ignoreSaveMessage=this._currentViewMode===m.GRID&&!this.enableGridInsert,s(e,null,s("ez-view-stack",{ref:t=>this._viewStack=t,"data-element-id":"crud"},s("stack-item",null,s("snk-grid",{ref:t=>this._snkGrid=t,filterBarTitle:this.filterBarTitle,"data-element-id":"crud_grid",configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail),messagesBuilder:this.messagesBuilder,actionsList:this.actionsList,statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,presentationMode:this.presentationMode,recordsValidator:this.recordsValidator,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,canEdit:this._canEdit,resourceID:this._resourceID,disablePersonalizedFilter:this.disablePersonalizedFilter,gridLegacyConfigName:this.gridLegacyConfigName,filterBarLegacyConfigName:this.filterBarLegacyConfigName,autoLoad:this.autoLoad,autoFocus:this.autoFocus,enableGridInsert:this.enableGridInsert},s("slot",{name:"GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkGridHeader"}),s("slot",{name:"SnkGridFooter"}),s("slot",{name:"SnkGridTaskBar"}))),s("stack-item",null,s("snk-guides-viewer",{ref:t=>this._guidesViewer=t,entityPath:this._snkDataUnit.entityName,messagesBuilder:this.messagesBuilder,onExit:()=>this.setViewMode(m.GRID),dataState:this._dataState,dataUnit:this._dataUnit,actionsList:this.actionsList,taskbarManager:this.taskbarManager,configName:this.configName,onActionClick:t=>this.executeAction(t.detail),presentationMode:this.presentationMode,"data-element-id":"crud_form",canEdit:this._canEdit,recordsValidator:this.recordsValidator,resourceID:this._resourceID,detailTaskbarCustomContainerId:this.customContainerId,formLegacyConfigName:this.formLegacyConfigName,enableGridInsert:this.enableGridInsert,getCustomTitle:this.setCustomFormTitle,ignoreReadOnlyFormFields:this.ignoreReadOnlyFormFields},s("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkFormTaskBar"}))),s("stack-item",null,s("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this._snkDataUnit.entityName,onBack:this.backView.bind(this)})),s("snk-configurator",{ref:t=>this._snkConfigurator=t,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:t=>this.setViewMode(t.detail),onOpenConfig:t=>this.openConfig(t.detail),showActionButtons:this.showActionButtons,onSave:t=>this.handleConfiguratorEvent(t,"SAVE"),onCancel:t=>this.handleConfiguratorEvent(t,"CANCEL"),resourceID:this._resourceID,customContainerId:this.customContainerId})),s("div",{id:`${this.customContainerId}`},s("slot",{name:"SnkConfigContainerSlot"}),s("slot",{name:"DETAIL_GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"})))}get _element(){return a(this)}static get watchers(){return{_currentViewMode:["currentViewModeWatcher"]}}};p.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{p as snk_crud}
1
+ import{r as t,c as i,h as s,H as e,g as a}from"./p-d2d301a6.js";import{StringUtils as o,ElementIDUtils as h,ApplicationContext as n,JSUtils as r,FloatingManager as d}from"@sankhyalabs/core";import{T as c}from"./p-7e7a7473.js";import"./p-00278e07.js";import"./p-341465ce.js";import{P as l}from"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-47d24ac8.js";import"./p-ff1990ad.js";import"./p-126c58ea.js";import{V as m}from"./p-95ce311a.js";import{A as u}from"./p-aaf94476.js";import"./p-6dc031de.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";const p=class{constructor(s){t(this,s),this.actionClick=i(this,"actionClick",7),this.configuratorSave=i(this,"configuratorSave",7),this.configuratorCancel=i(this,"configuratorCancel",7),this.formItemsReady=i(this,"formItemsReady",7),this.viewModeChanged=i(this,"viewModeChanged",7),this._keyDownHandler=async t=>this.keyDownListener(t),this._viewHistory=[],this._customEditors=new Map,this._customRenders=new Map,this._dataUnit=void 0,this._dataState=void 0,this.attachmentRegisterKey=void 0,this._currentViewMode=m.GRID,this._canEdit=void 0,this._resourceID=void 0,this.configName=void 0,this.filterBarTitle=void 0,this.selectionToastConfig=void 0,this.showActionButtons=!1,this.actionsList=void 0,this.taskbarManager=void 0,this.recordsValidator=void 0,this.statusResolver=void 0,this.multipleSelection=!0,this.presentationMode=l.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.gridLegacyConfigName=void 0,this.filterBarLegacyConfigName=void 0,this.formLegacyConfigName=void 0,this.disablePersonalizedFilter=void 0,this.autoLoad=void 0,this.autoFocus=!0,this.enableGridInsert=!1,this.domainMessagesBuilder=void 0,this.ignoreReadOnlyFormFields=void 0,this.setCustomFormTitle=void 0,this.customContainerId=`SNK-CRUD-CUSTOM-CONTAINER-${o.generateUUID()}`}async goToView(t){this.executeAction(t)}async openConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.open()}async closeConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.close()}async reloadFilterBar(){var t;null===(t=this._snkGrid)||void 0===t||t.reloadFilterBar()}async getFilterBar(){return await this._snkGrid.getFilterBar()}async addCustomEditor(t,i){if(this._guidesViewer&&this._snkGrid)return this._guidesViewer.addCustomEditor(t,i),void this._snkGrid.addCustomEditor(t,i);const s=new Map(this._customEditors);s.set(t,i),this._customEditors=s}async addGridCustomRender(t,i){if(this._snkGrid)return void this._snkGrid.addGridCustomRender(t,i);const s=new Map(this._customRenders);s.set(t,i),this._customRenders=s}async addCustomValueFormatter(t,i){this._snkGrid.addCustomValueFormatter(t,i)}async removeCustomValueFormatter(t){this._snkGrid.removeCustomValueFormatter(t)}async setFieldProp(t,i,s){await this._guidesViewer.setFieldProp(t,i,s)}currentViewModeWatcher(t){this._viewHistory=[...this._viewHistory.slice(-1),t]}async gridToForm(t=!1){this._backToGrid=!t&&await this._viewStack.getSelectedIndex()===m.GRID,this.setViewMode(m.FORM)}async executeAction(t){return t===c.GRID_MODE?this.setViewMode(m.GRID):t===c.FORM_MODE||t===c.UPDATE?this.gridToForm(t!==c.UPDATE):t===c.CONFIGURATOR?this._snkConfigurator.open():"ATTACH"===t?this.setViewMode(m.ATTACHMENT):void 0}backView(){const t=this._viewHistory.at(-2)||m.GRID;this.setViewMode(t)}setViewMode(t){this._viewStack.show(t),this._currentViewMode=t,t===m.GRID?this._snkGrid.setFocus():t===m.FORM&&this._guidesViewer.setFocus(),this.viewModeChanged.emit(t)}openConfig(t){this._snkConfigurator.close(),t===m.GRID?this._snkGrid.showConfig():t===m.FORM&&this._guidesViewer.showFormConfig()}addDataElementID(){h.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}insertionModeHandler(){this.enableGridInsert||this.gridToForm()}cancelHandler(){this._backToGrid&&this.setViewMode(m.GRID)}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}setCustomRenders(){if(this._snkGrid)for(const[t,i]of this._customRenders)this._snkGrid.addGridCustomRender(t,i),this._customRenders.delete(t)}setCustomEditors(){if(this._snkGrid&&this._guidesViewer)for(const[t,i]of this._customEditors)this._guidesViewer.addCustomEditor(t,i),this._snkGrid.addCustomEditor(t,i),this._customEditors.delete(t)}componentDidRender(){this.setCustomRenders(),this.setCustomEditors()}componentWillLoad(){this._application=n.getContextValue("__SNK__APPLICATION__");let t=this._element.parentElement;for(this._application.hasAccess(u.UPDATE,this._resourceID).then((t=>this._canEdit=t));t;){if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){this._snkDataUnit=t,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._snkDataUnit.domainMessagesBuilder=this.domainMessagesBuilder,this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.initDataUnit():this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail,this.initDataUnit()})),this._snkDataUnit.addEventListener("dataStateChange",this.handleDataStateChange.bind(this));break}t=t.parentElement}this.configName||(this.configName=this._application.configName)}componentDidLoad(){this.initKeyboardManager()}disconnectedCallback(){this.removeShortcuts(),window.removeEventListener("keydown",this._keyDownHandler)}async handleDataStateChange(t){var i;this._dataState=t.detail,void 0!==this._dataState.selectedRecord&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey());const s=await this._snkDataUnit.getFieldsWithRmPrecision();for(const t of s||[]){if(!t)continue;const s=null===(i=this._dataState.rowMetadata)||void 0===i?void 0:i.getProp("rm_precision",t);(s||0===s)&&(await this.setFieldProp(t,"precision",s),await this.setFieldProp(t,"prettyPrecision",s))}}async initKeyboardManager(){var t;const i=await(null===(t=this._application)||void 0===t?void 0:t.getKeyboardManager());if(i){const s=this._dataUnit||await this._snkDataUnit.getDataUnit();async function e(){const t=document.activeElement,i=t==document.body;i||t.blur(),await s.saveData(),i||null==t.setFocus?i||t.focus():t.setFocus()}i.bind("F6",this.toggleView.bind(this),{description:"Alterna entre modo formulário e grade.",element:this._element}).bind("F7",e.bind(this),{description:"Salva os dados.",element:this._element}).bind("ctrl + \\",e.bind(this),{description:"Salva os dados.",element:this._element}).bind("F8",s.addRecord.bind(s),{description:"Adiciona um novo registro.",element:this._element}).bind("F9",s.removeSelectedRecords.bind(s),{description:"Remove o registro selecionado.",element:this._element}).bind("ctrl + F9",s.removeSelectedRecords.bind(s),{description:"Remove o registro selecionado.",element:this._element}).bind("ctrl + .",(()=>0===s.getSelectionInfo().records.length?s.selectFirst():s.nextRecord()),{description:"Avança para o próximo registro.",element:this._element}).bind("ctrl + ,",s.previousRecord.bind(s),{description:"Retorna ao registro anterior.",element:this._element}).bind("F5",(async()=>{const t=await this._viewStack.getSelectedIndex();m.GRID===t&&s.loadData()}),{description:"Atualiza os dados.",element:this._element}).bind("Escape",(()=>{s.isDirty()&&s.cancelEdition()}),{debounceTime:1e3,description:"Cancela uma ação.",element:this._element})}}async removeShortcuts(){var t;const i=await(null===(t=this._application)||void 0===t?void 0:t.getKeyboardManager());i&&i.unbind("F6").unbind("F7").unbind("ctrl + \\").unbind("F8").unbind("F9").unbind("ctrl + F9").unbind("ctrl + .").unbind("ctrl + ,").unbind("F5").unbind("Escape")}async toggleView(){const t=await this._viewStack.getSelectedIndex();this.setViewMode(m.GRID===t?m.FORM:m.GRID)}async initDataUnit(){this.addDataElementID(),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),null==this._resourceID&&(this._resourceID=this._snkDataUnit.resourceID,null==this._resourceID&&(this._resourceID=await this._application.getResourceID()))}handleConfiguratorEvent(t,i){t.stopImmediatePropagation(),"SAVE"!==i?this.configuratorCancel.emit():this.configuratorSave.emit()}async keyDownListener(t){t.ctrlKey&&null!=t.key&&"F"===t.key.toUpperCase()&&null!=this._element&&(r.isHiddenElement(this._element)||(d.closeAll(),this._currentViewMode===m.GRID?await this._snkGrid.findColumn():await this._guidesViewer.findField(),t.preventDefault()))}connectedCallback(){window.addEventListener("keydown",this._keyDownHandler,{capture:!0})}render(){if(null!=this._resourceID)return this._snkDataUnit.ignoreSaveMessage=this._currentViewMode===m.GRID&&!this.enableGridInsert,s(e,null,s("ez-view-stack",{ref:t=>this._viewStack=t,"data-element-id":"crud"},s("stack-item",null,s("snk-grid",{ref:t=>this._snkGrid=t,filterBarTitle:this.filterBarTitle,"data-element-id":"crud_grid",configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail),messagesBuilder:this.messagesBuilder,actionsList:this.actionsList,statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,presentationMode:this.presentationMode,recordsValidator:this.recordsValidator,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,canEdit:this._canEdit,resourceID:this._resourceID,disablePersonalizedFilter:this.disablePersonalizedFilter,gridLegacyConfigName:this.gridLegacyConfigName,filterBarLegacyConfigName:this.filterBarLegacyConfigName,autoLoad:this.autoLoad,autoFocus:this.autoFocus,enableGridInsert:this.enableGridInsert},s("slot",{name:"GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkGridHeader"}),s("slot",{name:"SnkGridFooter"}),s("slot",{name:"SnkGridTaskBar"}))),s("stack-item",null,s("snk-guides-viewer",{ref:t=>this._guidesViewer=t,entityPath:this._snkDataUnit.entityName,messagesBuilder:this.messagesBuilder,onExit:()=>this.setViewMode(m.GRID),dataState:this._dataState,dataUnit:this._dataUnit,actionsList:this.actionsList,taskbarManager:this.taskbarManager,configName:this.configName,onActionClick:t=>this.executeAction(t.detail),presentationMode:this.presentationMode,"data-element-id":"crud_form",canEdit:this._canEdit,recordsValidator:this.recordsValidator,resourceID:this._resourceID,detailTaskbarCustomContainerId:this.customContainerId,formLegacyConfigName:this.formLegacyConfigName,enableGridInsert:this.enableGridInsert,getCustomTitle:this.setCustomFormTitle,ignoreReadOnlyFormFields:this.ignoreReadOnlyFormFields},s("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkFormTaskBar"}))),s("stack-item",null,s("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this._snkDataUnit.entityName,onBack:this.backView.bind(this)})),s("snk-configurator",{ref:t=>this._snkConfigurator=t,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:t=>this.setViewMode(t.detail),onOpenConfig:t=>this.openConfig(t.detail),showActionButtons:this.showActionButtons,onSave:t=>this.handleConfiguratorEvent(t,"SAVE"),onCancel:t=>this.handleConfiguratorEvent(t,"CANCEL"),resourceID:this._resourceID,customContainerId:this.customContainerId})),s("div",{id:`${this.customContainerId}`},s("slot",{name:"SnkConfigContainerSlot"}),s("slot",{name:"DETAIL_GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"})))}get _element(){return a(this)}static get watchers(){return{_currentViewMode:["currentViewModeWatcher"]}}};p.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{p as snk_crud}
@@ -1 +1 @@
1
- import{r as i,c as e,h as s,F as t,H as n}from"./p-d2d301a6.js";import{StringUtils as l,ObjectUtils as r,ApplicationContext as a,ElementIDUtils as o}from"@sankhyalabs/core";import{P as h}from"./p-057fad05.js";import{P as d,C as c}from"./p-4d9549cf.js";import{ApplicationUtils as f}from"@sankhyalabs/ezui/dist/collection/utils";import{a as p}from"./p-933c0c0b.js";import{s as z}from"./p-6dc031de.js";import"./p-ff1990ad.js";import"./p-06421fdb.js";import"./p-f3434fc4.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";const m=class{constructor(s){i(this,s),this.ezCancel=e(this,"ezCancel",7),this.ezSave=e(this,"ezSave",7),this.ezAfterSave=e(this,"ezAfterSave",7),this._personalizedFilterFetcher=new d,this._filterMetadataStorage=new Map,this._dataSourceFetcher={fetchData:async i=>{let e=null==i?void 0:i.uri;if(l.isEmpty(e)&&(e=this.entityUri),!this._filterMetadataStorage.has(e)){const i=await this._personalizedFilterFetcher.loadFields(e);this._filterMetadataStorage.set(e,i)}return this._filterMetadataStorage.get(e)}},this._filterAssistentMode=!0,this._filterAssistent=void 0,this.messagesBuilder=void 0,this.entityUri=void 0,this.filterId=void 0,this.configName=void 0,this.resourceID=void 0}async createPersonalizedFilter(){const i={name:"",active:!0,expression:"",parameters:[],assistent:{id:l.generateUUID(),items:[{id:l.generateUUID(),entityName:"",fieldName:"",description:"",fieldLabel:"Valor",type:void 0,expression:void 0,operand:void 0,paramVariable:!1,value:void 0,systemConfig:null,userConfig:null}],childrenGroups:[],operand:p.AND}};this._originalFilterAssistent=r.copy(i),this._filterAssistent=r.copy(i)}loadFilter(i,e){null!=i&&e!=i&&null!=this.resourceID&&c.loadPersonalizedFilter(i,this.resourceID,this.configName).then((i=>{const e=this.applyDefaultValues(i);this._filterAssistent=e,this._originalFilterAssistent=r.copy(e),this._filterAssistentMode=this._filterAssistent.hasOwnProperty("assistent")&&null!=this._filterAssistent.assistent}))}componentWillLoad(){var i;null==z.get(`filterFieldsDataSource.${this.entityUri}`)&&z.set(`filterFieldsDataSource.${this.entityUri}`,this._dataSourceFetcher),this.messagesBuilder||(this._application=a.getContextValue("__SNK__APPLICATION__"),this.messagesBuilder=null===(i=this._application)||void 0===i?void 0:i.messagesBuilder),this.loadFilter(this.filterId,void 0)}componentDidRender(){var i;null===(i=this._viewStackRef)||void 0===i||i.show(this._filterAssistentMode?0:1),this._elButtonMode&&this._elButtonMode.setAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME,o.getInternalIDInfo(this._filterAssistentMode?"advancedMode_ezButton":"assistentMode_ezButton"))}getMessage(i,e){return this._application.messagesBuilder.getMessage(i,e)}saveFilter(){c.savePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName).then((i=>{this._elButtonSave.enabled=!1,f.info(this.getMessage(`snkPersonalizedFilter.${this._filterAssistent.id?"confirmEdit":"confirmSave"}.title`),{iconName:"check"});const e=Object.assign(Object.assign({},i),this._filterAssistent);e.parameters=h.buildVariableParameters(this._filterAssistent.assistent),this._originalFilterAssistent=r.copy(e),this._filterAssistent=r.copy(e),this.ezAfterSave.emit()}))}removeFilter(){c.removePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName)}hasChangesToSave(){return JSON.stringify(this._filterAssistent)===JSON.stringify(this._originalFilterAssistent)}async handleSave(){if(this._filterAssistentMode){if(!h.validateFields(this._filterAssistent.assistent)||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));this.saveAssistentMode()}else{if(!this._filterAssistent.expression||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));if(!await this.validateExpressionBeforeSaving())return;this.saveAdvancedMode()}}saveAssistentMode(){const{assistent:i,expression:e}=this._filterAssistent,s=i?h.buildGroupExpression(i):e;this._filterAssistent.expression=s,this.ezSave.emit(s),this.saveFilter()}saveAdvancedMode(){this._originalFilterAssistent.expression!==this._filterAssistent.expression&&this._filterAssistent.assistent?f.confirm(this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.description")).then((i=>{i&&this.saveAndTransformToAdvancedMode()})):this._filterAssistent.assistent?this.saveAssistentMode():this.saveAndTransformToAdvancedMode()}saveAndTransformToAdvancedMode(){this._filterAssistent.assistent=void 0,this.ezSave.emit(this._filterAssistent.expression),this.saveFilter()}async validateExpressionBeforeSaving(){const{valid:i,message:e=""}=await this._personalizedFilterFetcher.validatePersonalizedFilter(this.entityUri,this._filterAssistent.expression);return i||this._application.error(this.getMessage("snkPersonalizedFilter.errorValidation.title"),e.replace(/.*Exception: /,"")),i}handleCancel(){if(this.hasChangesToSave())return this.ezCancel.emit();f.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"),this.getMessage("snkPersonalizedFilter.confirmCancel.description")).then((i=>{var e;i&&(this._filterAssistent=r.copy(null!==(e=this._originalFilterAssistent)&&void 0!==e?e:{}),this.ezCancel.emit(),this._elButtonSave.enabled=!1)}))}handleTitleChange(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{name:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}applyDefaultValues(i){return this.addLabelToItems(i),this.addFilterGroupCondition(i),i}addFilterGroupCondition(i){i.assistent&&!i.assistent.operand&&(i.assistent.operand=p.AND)}addLabelToItems(i){i.assistent&&i.assistent.items&&i.assistent.items.length>0&&i.assistent.items.forEach((e=>{if(null==e.fieldLabel){const s=(i.parameters||[]).find((i=>i.fieldName===e.fieldName));s&&(e.fieldLabel=s.label)}}))}handleExpressionChangeAdvancedMode(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}handleChangeFilterAssistentMode(i){this._elButtonSave.enabled=!this.hasChangesToSave(),this._filterAssistent=Object.assign({},i)}selectField(i){if(!("name"in i))return;const e=this.buildExpression(i.entityName,i.name,i.entityPath);this._elAdvancedMode.querySelector("ez-text-area").appendTextToSelection(e)}buildExpression(i,e,s){return s.length>0&&s.shift(),s.length>0?`${s.join("->")}->${e}`:`${i}.${e}`}onAddField(i){this._elAdvancedMode.querySelector("ez-text-area").setFocus(),i.setBlur(),this._elFilterFieldSearch&&this._elFilterFieldSearch.show(i,{horizontalGap:0,verticalGap:12,fromRight:!0})}renderButtonAddField(){if(!this._filterAssistentMode)return s(t,null,s("ez-button",{class:"snk-personalized-filter__button-mode",label:this.getMessage("snkPersonalizedFilter.info.addField"),enabled:!0,onClick:i=>this.onAddField(i.target)},s("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:"plus"})),s("snk-filter-field-search",{class:"ez-padding-left--medium",ref:i=>this._elFilterFieldSearch=i,onEzSelectFilterItem:i=>this.selectField(i.detail),fieldsDataSource:this._dataSourceFetcher}))}buildContainerPersonalizedFilter(){return s("ez-view-stack",{ref:i=>this._viewStackRef=i},s("stack-item",null,this._filterAssistentMode&&s("snk-filter-assistent-mode",{filterAssistent:this._filterAssistent,messagesBuilder:this.messagesBuilder,filterId:this.filterId,entityUri:this.entityUri,application:this._application,onEzChangeFilter:i=>this.handleChangeFilterAssistentMode(i.detail)})),s("stack-item",null,s("snk-filter-advanced-mode",{ref:i=>this._elAdvancedMode=i,filterAssistent:this._filterAssistent,application:this._application,onEzExpressionChange:i=>this.handleExpressionChangeAdvancedMode(i.detail)})))}handleModeChange(){var i,e;if(this._filterAssistentMode)f.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.description")).then((i=>{if(i&&(this._filterAssistentMode=!this._filterAssistentMode,!this.hasChangesToSave())){const i=h.buildGroupExpression(this._filterAssistent.assistent);this._filterAssistent.expression=i,this._elButtonSave.enabled=!this.hasChangesToSave()}}));else if((null===(i=this._filterAssistent)||void 0===i?void 0:i.expression)===(null===(e=this._originalFilterAssistent)||void 0===e?void 0:e.expression))this._filterAssistentMode=!this._filterAssistentMode;else{const i=this._filterAssistent.expression,e=h.buildGroupExpression(this._filterAssistent.assistent);i!==e?f.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.description")).then((i=>{i&&(this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:e}),this._filterAssistentMode=!this._filterAssistentMode)})):this._filterAssistentMode=!this._filterAssistentMode}}render(){var i,e,t,l;if((null===(i=this._filterAssistent)||void 0===i?void 0:i.assistent)||!this._filterAssistentMode)return s(n,null,s("div",{class:"snk-personalized-filter"},s("div",null,s("snk-simple-bar",{label:this.getMessage(this.filterId?"snkPersonalizedFilter.info.titleEdit":"snkPersonalizedFilter.info.titleAdd"),onExit:()=>this.handleCancel()},s("div",{class:"snk-personalized-filter__header-actions",slot:"rightSlot"},s("ez-button",{size:"small",label:this.getMessage("snkPersonalizedFilter.info.labelCancel"),onClick:()=>this.handleCancel()}),s("ez-button",{size:"small",ref:i=>this._elButtonSave=i,enabled:!1,class:"ez-button--primary",label:this.getMessage("snkPersonalizedFilter.info.labelSave"),onClick:this.handleSave.bind(this)})))),s("div",{class:"ez-box ez-margin-bottom--medium ez-box__main"},s("div",{class:"ez-box__container"},s("div",{class:"ez-flex ez-flex--column ez-size-width--full"},s("div",{class:"ez-flex"},s("ez-text-input",{class:"ez-padding-right--medium",label:this.getMessage("snkPersonalizedFilter.info.labelNameFilter"),value:null===(e=this._filterAssistent)||void 0===e?void 0:e.name,onEzChange:i=>this.handleTitleChange(i.detail)}),this.renderButtonAddField(),s("ez-button",{ref:i=>this._elButtonMode=i,class:"snk-personalized-filter__button-mode",label:this.getMessage(this._filterAssistentMode?"snkPersonalizedFilter.info.activeModeAdvanced":"snkPersonalizedFilter.info.activeModeAssistent"),onClick:()=>this.handleModeChange(),"data-tooltip":this._filterAssistentMode||(null===(t=this._filterAssistent)||void 0===t?void 0:t.assistent)?void 0:this.getMessage("snkPersonalizedFilter.info.tooltipDisabledAssistentMode"),"data-flow":"bottom",enabled:!this._filterAssistent.name||Boolean(this._filterAssistentMode||(null===(l=this._filterAssistent)||void 0===l?void 0:l.assistent))})),this.buildContainerPersonalizedFilter())))))}static get watchers(){return{filterId:["loadFilter"]}}};m.style=".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";export{m as snk_personalized_filter}
1
+ import{r as i,c as e,h as s,F as t,H as n}from"./p-d2d301a6.js";import{StringUtils as l,ObjectUtils as r,ApplicationContext as a,ElementIDUtils as o}from"@sankhyalabs/core";import{P as h}from"./p-057fad05.js";import{P as d,C as c}from"./p-9ffd9fc7.js";import{ApplicationUtils as f}from"@sankhyalabs/ezui/dist/collection/utils";import{a as p}from"./p-933c0c0b.js";import{s as z}from"./p-6dc031de.js";import"./p-ff1990ad.js";import"./p-126c58ea.js";import"./p-00278e07.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";const m=class{constructor(s){i(this,s),this.ezCancel=e(this,"ezCancel",7),this.ezSave=e(this,"ezSave",7),this.ezAfterSave=e(this,"ezAfterSave",7),this._personalizedFilterFetcher=new d,this._filterMetadataStorage=new Map,this._dataSourceFetcher={fetchData:async i=>{let e=null==i?void 0:i.uri;if(l.isEmpty(e)&&(e=this.entityUri),!this._filterMetadataStorage.has(e)){const i=await this._personalizedFilterFetcher.loadFields(e);this._filterMetadataStorage.set(e,i)}return this._filterMetadataStorage.get(e)}},this._filterAssistentMode=!0,this._filterAssistent=void 0,this.messagesBuilder=void 0,this.entityUri=void 0,this.filterId=void 0,this.configName=void 0,this.resourceID=void 0}async createPersonalizedFilter(){const i={name:"",active:!0,expression:"",parameters:[],assistent:{id:l.generateUUID(),items:[{id:l.generateUUID(),entityName:"",fieldName:"",description:"",fieldLabel:"Valor",type:void 0,expression:void 0,operand:void 0,paramVariable:!1,value:void 0,systemConfig:null,userConfig:null}],childrenGroups:[],operand:p.AND}};this._originalFilterAssistent=r.copy(i),this._filterAssistent=r.copy(i)}loadFilter(i,e){null!=i&&e!=i&&null!=this.resourceID&&c.loadPersonalizedFilter(i,this.resourceID,this.configName).then((i=>{const e=this.applyDefaultValues(i);this._filterAssistent=e,this._originalFilterAssistent=r.copy(e),this._filterAssistentMode=this._filterAssistent.hasOwnProperty("assistent")&&null!=this._filterAssistent.assistent}))}componentWillLoad(){var i;null==z.get(`filterFieldsDataSource.${this.entityUri}`)&&z.set(`filterFieldsDataSource.${this.entityUri}`,this._dataSourceFetcher),this.messagesBuilder||(this._application=a.getContextValue("__SNK__APPLICATION__"),this.messagesBuilder=null===(i=this._application)||void 0===i?void 0:i.messagesBuilder),this.loadFilter(this.filterId,void 0)}componentDidRender(){var i;null===(i=this._viewStackRef)||void 0===i||i.show(this._filterAssistentMode?0:1),this._elButtonMode&&this._elButtonMode.setAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME,o.getInternalIDInfo(this._filterAssistentMode?"advancedMode_ezButton":"assistentMode_ezButton"))}getMessage(i,e){return this._application.messagesBuilder.getMessage(i,e)}saveFilter(){c.savePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName).then((i=>{this._elButtonSave.enabled=!1,f.info(this.getMessage(`snkPersonalizedFilter.${this._filterAssistent.id?"confirmEdit":"confirmSave"}.title`),{iconName:"check"});const e=Object.assign(Object.assign({},i),this._filterAssistent);e.parameters=h.buildVariableParameters(this._filterAssistent.assistent),this._originalFilterAssistent=r.copy(e),this._filterAssistent=r.copy(e),this.ezAfterSave.emit()}))}removeFilter(){c.removePersonalizedFilter(this._filterAssistent,this.resourceID,this.configName)}hasChangesToSave(){return JSON.stringify(this._filterAssistent)===JSON.stringify(this._originalFilterAssistent)}async handleSave(){if(this._filterAssistentMode){if(!h.validateFields(this._filterAssistent.assistent)||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));this.saveAssistentMode()}else{if(!this._filterAssistent.expression||!this._filterAssistent.name)return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"),this.getMessage("snkPersonalizedFilter.error.description"));if(!await this.validateExpressionBeforeSaving())return;this.saveAdvancedMode()}}saveAssistentMode(){const{assistent:i,expression:e}=this._filterAssistent,s=i?h.buildGroupExpression(i):e;this._filterAssistent.expression=s,this.ezSave.emit(s),this.saveFilter()}saveAdvancedMode(){this._originalFilterAssistent.expression!==this._filterAssistent.expression&&this._filterAssistent.assistent?f.confirm(this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.description")).then((i=>{i&&this.saveAndTransformToAdvancedMode()})):this._filterAssistent.assistent?this.saveAssistentMode():this.saveAndTransformToAdvancedMode()}saveAndTransformToAdvancedMode(){this._filterAssistent.assistent=void 0,this.ezSave.emit(this._filterAssistent.expression),this.saveFilter()}async validateExpressionBeforeSaving(){const{valid:i,message:e=""}=await this._personalizedFilterFetcher.validatePersonalizedFilter(this.entityUri,this._filterAssistent.expression);return i||this._application.error(this.getMessage("snkPersonalizedFilter.errorValidation.title"),e.replace(/.*Exception: /,"")),i}handleCancel(){if(this.hasChangesToSave())return this.ezCancel.emit();f.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"),this.getMessage("snkPersonalizedFilter.confirmCancel.description")).then((i=>{var e;i&&(this._filterAssistent=r.copy(null!==(e=this._originalFilterAssistent)&&void 0!==e?e:{}),this.ezCancel.emit(),this._elButtonSave.enabled=!1)}))}handleTitleChange(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{name:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}applyDefaultValues(i){return this.addLabelToItems(i),this.addFilterGroupCondition(i),i}addFilterGroupCondition(i){i.assistent&&!i.assistent.operand&&(i.assistent.operand=p.AND)}addLabelToItems(i){i.assistent&&i.assistent.items&&i.assistent.items.length>0&&i.assistent.items.forEach((e=>{if(null==e.fieldLabel){const s=(i.parameters||[]).find((i=>i.fieldName===e.fieldName));s&&(e.fieldLabel=s.label)}}))}handleExpressionChangeAdvancedMode(i){this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:i}),this._elButtonSave.enabled=!this.hasChangesToSave()}handleChangeFilterAssistentMode(i){this._elButtonSave.enabled=!this.hasChangesToSave(),this._filterAssistent=Object.assign({},i)}selectField(i){if(!("name"in i))return;const e=this.buildExpression(i.entityName,i.name,i.entityPath);this._elAdvancedMode.querySelector("ez-text-area").appendTextToSelection(e)}buildExpression(i,e,s){return s.length>0&&s.shift(),s.length>0?`${s.join("->")}->${e}`:`${i}.${e}`}onAddField(i){this._elAdvancedMode.querySelector("ez-text-area").setFocus(),i.setBlur(),this._elFilterFieldSearch&&this._elFilterFieldSearch.show(i,{horizontalGap:0,verticalGap:12,fromRight:!0})}renderButtonAddField(){if(!this._filterAssistentMode)return s(t,null,s("ez-button",{class:"snk-personalized-filter__button-mode",label:this.getMessage("snkPersonalizedFilter.info.addField"),enabled:!0,onClick:i=>this.onAddField(i.target)},s("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:"plus"})),s("snk-filter-field-search",{class:"ez-padding-left--medium",ref:i=>this._elFilterFieldSearch=i,onEzSelectFilterItem:i=>this.selectField(i.detail),fieldsDataSource:this._dataSourceFetcher}))}buildContainerPersonalizedFilter(){return s("ez-view-stack",{ref:i=>this._viewStackRef=i},s("stack-item",null,this._filterAssistentMode&&s("snk-filter-assistent-mode",{filterAssistent:this._filterAssistent,messagesBuilder:this.messagesBuilder,filterId:this.filterId,entityUri:this.entityUri,application:this._application,onEzChangeFilter:i=>this.handleChangeFilterAssistentMode(i.detail)})),s("stack-item",null,s("snk-filter-advanced-mode",{ref:i=>this._elAdvancedMode=i,filterAssistent:this._filterAssistent,application:this._application,onEzExpressionChange:i=>this.handleExpressionChangeAdvancedMode(i.detail)})))}handleModeChange(){var i,e;if(this._filterAssistentMode)f.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.description")).then((i=>{if(i&&(this._filterAssistentMode=!this._filterAssistentMode,!this.hasChangesToSave())){const i=h.buildGroupExpression(this._filterAssistent.assistent);this._filterAssistent.expression=i,this._elButtonSave.enabled=!this.hasChangesToSave()}}));else if((null===(i=this._filterAssistent)||void 0===i?void 0:i.expression)===(null===(e=this._originalFilterAssistent)||void 0===e?void 0:e.expression))this._filterAssistentMode=!this._filterAssistentMode;else{const i=this._filterAssistent.expression,e=h.buildGroupExpression(this._filterAssistent.assistent);i!==e?f.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.title"),this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.description")).then((i=>{i&&(this._filterAssistent=Object.assign(Object.assign({},this._filterAssistent),{expression:e}),this._filterAssistentMode=!this._filterAssistentMode)})):this._filterAssistentMode=!this._filterAssistentMode}}render(){var i,e,t,l;if((null===(i=this._filterAssistent)||void 0===i?void 0:i.assistent)||!this._filterAssistentMode)return s(n,null,s("div",{class:"snk-personalized-filter"},s("div",null,s("snk-simple-bar",{label:this.getMessage(this.filterId?"snkPersonalizedFilter.info.titleEdit":"snkPersonalizedFilter.info.titleAdd"),onExit:()=>this.handleCancel()},s("div",{class:"snk-personalized-filter__header-actions",slot:"rightSlot"},s("ez-button",{size:"small",label:this.getMessage("snkPersonalizedFilter.info.labelCancel"),onClick:()=>this.handleCancel()}),s("ez-button",{size:"small",ref:i=>this._elButtonSave=i,enabled:!1,class:"ez-button--primary",label:this.getMessage("snkPersonalizedFilter.info.labelSave"),onClick:this.handleSave.bind(this)})))),s("div",{class:"ez-box ez-margin-bottom--medium ez-box__main"},s("div",{class:"ez-box__container"},s("div",{class:"ez-flex ez-flex--column ez-size-width--full"},s("div",{class:"ez-flex"},s("ez-text-input",{class:"ez-padding-right--medium",label:this.getMessage("snkPersonalizedFilter.info.labelNameFilter"),value:null===(e=this._filterAssistent)||void 0===e?void 0:e.name,onEzChange:i=>this.handleTitleChange(i.detail)}),this.renderButtonAddField(),s("ez-button",{ref:i=>this._elButtonMode=i,class:"snk-personalized-filter__button-mode",label:this.getMessage(this._filterAssistentMode?"snkPersonalizedFilter.info.activeModeAdvanced":"snkPersonalizedFilter.info.activeModeAssistent"),onClick:()=>this.handleModeChange(),"data-tooltip":this._filterAssistentMode||(null===(t=this._filterAssistent)||void 0===t?void 0:t.assistent)?void 0:this.getMessage("snkPersonalizedFilter.info.tooltipDisabledAssistentMode"),"data-flow":"bottom",enabled:!this._filterAssistent.name||Boolean(this._filterAssistentMode||(null===(l=this._filterAssistent)||void 0===l?void 0:l.assistent))})),this.buildContainerPersonalizedFilter())))))}static get watchers(){return{filterId:["loadFilter"]}}};m.style=".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";export{m as snk_personalized_filter}
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-d2d301a6.js";export{s as setNonce}from"./p-d2d301a6.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t(JSON.parse('[["p-118e769b",[[1,"teste-pesquisa"]]],["p-ac8d1cd6",[[2,"snk-actions-form",{"action":[16],"applyParameters":[16],"dataUnit":[32],"openPopup":[64]}]]],["p-9531fd46",[[2,"snk-client-confirm",{"titleMessage":[1,"title-message"],"message":[1],"accept":[16],"cancel":[16],"openPopup":[64]}]]],["p-21a81901",[[6,"snk-custom-slot-elements",{"slotName":[1,"slot-name"]}]]],["p-33718dfc",[[2,"snk-entity-list",{"config":[1040],"rightListSlotBuilder":[1040],"maxHeightList":[1,"max-height-list"],"_searchValue":[32],"_ezListSource":[32],"reloadList":[64]}]]],["p-8c235d4c",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"presentationMode":[2,"presentation-mode"],"resetValues":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-5f157b09",[[0,"snk-filter-checkbox-list",{"config":[1040],"optionsList":[32]}]]],["p-bf2acf72",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-01ba23cd",[[0,"snk-filter-number",{"config":[16],"getMessage":[16],"value":[2],"presentationMode":[2,"presentation-mode"],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-7e2ded86",[[0,"snk-filter-period",{"config":[16],"getMessage":[16],"value":[8],"presentationMode":[2,"presentation-mode"],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-c8622597",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-96a89d58",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-5b51491f",[[2,"snk-personalized-filter-editor",{"messagesBuilder":[1040],"presentationMode":[2,"presentation-mode"],"config":[16],"value":[1040],"items":[32],"show":[64]}]]],["p-434817f0",[[2,"snk-print-selector",{"_printServerActive":[32],"_selectedPrinter":[32],"_remotePrintersDataSource":[32],"_localPrintersDataSource":[32],"_printJobData":[32],"openPrintSelector":[64]}]]],["p-d1791da2",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["p-dbe6174a",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"loadByPK":[16],"getKeyboardManager":[64],"isUserSup":[64],"addPendingAction":[64],"callServiceBroker":[64],"initOnboarding":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"showAlerts":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"webConnection":[64],"createDataunit":[64],"updateDataunitCache":[64],"getDataUnit":[64],"addClientEvent":[64],"removeClientEvent":[64],"hasClientEvent":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadTotals":[64],"isLoadedByPk":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64],"getAppLabel":[64],"addSearchListener":[64],"importScript":[64],"getApplicationPath":[64],"executeSelectDistinct":[64],"getDataFetcher":[64],"whenApplicationReady":[64],"setSearchFilterContext":[64]}]]],["p-212213d9",[[0,"snk-filter-modal-item",{"filterItem":[1040],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"]}]]],["p-26b0ce3e",[[2,"snk-form-summary",{"fixed":[1540],"contracted":[1540],"summary":[16]}]]],["p-1db45d26",[[6,"snk-form-view",{"levelPath":[1,"level-path"],"label":[1],"name":[1],"fields":[16],"formMetadata":[8,"form-metadata"],"dataUnit":[16],"contracted":[4],"fixed":[1540],"summaryFields":[16],"canExpand":[4,"can-expand"],"canFix":[4,"can-fix"],"recordsValidator":[16],"fieldToFocus":[1,"field-to-focus"],"customEditors":[16],"fieldsProps":[16],"showUp":[64],"addCustomEditor":[64],"setFieldProp":[64]}]]],["p-c2e468c9",[[6,"snk-simple-bar",{"label":[1],"breadcrumbItens":[16],"messagesBuilder":[1040]}]]],["p-8002dcd0",[[2,"snk-filter-field-search",{"searchable":[4],"fieldsDataSource":[16],"breadcrumbItems":[32],"linkItems":[32],"fieldItems":[32],"searchEmpty":[32],"groupEmpty":[32],"show":[64],"applyFilter":[64]}],[0,"snk-filter-param-config",{"messagesBuilder":[1040],"_opened":[32],"_configType":[32],"_expressionItem":[32],"_informedInstance":[32],"_canSave":[32],"open":[64],"close":[64]}]]],["p-fb34e0cf",[[2,"snk-personalized-filter",{"messagesBuilder":[1040],"entityUri":[1025,"entity-uri"],"filterId":[1025,"filter-id"],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"],"_filterAssistentMode":[32],"_filterAssistent":[32],"createPersonalizedFilter":[64]}]]],["p-41793e17",[[2,"snk-configurator",{"showActionButtons":[4,"show-action-buttons"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"viewMode":[2,"view-mode"],"customContainerId":[1,"custom-container-id"],"messagesBuilder":[1040],"_opened":[32],"_permissions":[32],"open":[64],"close":[64]}]]],["p-583517ba",[[2,"snk-data-unit",{"dataState":[1040],"messagesBuilder":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"useCancelConfirm":[4,"use-cancel-confirm"],"ignoreSaveMessage":[4,"ignore-save-message"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"domainMessagesBuilder":[1,"domain-messages-builder"],"fieldsToLink":[32],"getDataUnit":[64],"getSelectedRecordsIDsInfo":[64],"getFieldsWithRmp":[64],"getFieldsWithRmPrecision":[64],"getRowMetadata":[64]}]]],["p-54a5d52a",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"showHardFixed":[4,"show-hard-fixed"],"show":[64]}]]],["p-8b4fc28f",[[2,"snk-field-config",{"isConfigActive":[16],"fieldConfig":[16],"modeInsertion":[516,"mode-insertion"],"dataUnit":[16],"messagesBuilder":[1040]}]]],["p-16a1dd18",[[0,"snk-exporter-email-sender",{"getMessage":[16],"_config":[32],"_opened":[32],"_currentStep":[32],"open":[64],"close":[64]}]]],["p-72c10005",[[2,"snk-data-exporter",{"provider":[16],"messagesBuilder":[1040],"_items":[32],"_showDropdown":[32]}]]],["p-2aae03a1",[[6,"snk-taskbar",{"alignRigth":[4,"align-rigth"],"customSlotId":[1,"custom-slot-id"],"customContainerId":[1,"custom-container-id"],"overflowStrategy":[1,"overflow-strategy"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"presentationMode":[1537,"presentation-mode"],"messagesBuilder":[1040],"_permissions":[32],"_overFlowedElements":[32],"_customElements":[32],"_customElementsId":[32],"_slotContainer":[32],"_hiddenActionsList":[32],"_lastWidth":[32],"_hasToUpdateOverFlow":[32],"_isWaitingForSave":[32]},[[8,"snkCustomSlotElementsLoaded","handleCustomSlotElementsLoaded"],[8,"taskbarSaveLocker","handleTaskbarSaveLocker"],[8,"taskbarSaveUnlocker","handleTaskbarSaveUnlocker"]]]]],["p-242d010e",[[6,"snk-simple-crud",{"dataState":[16],"dataUnit":[16],"entityName":[1,"entity-name"],"mode":[2],"gridConfig":[1040],"formConfig":[1040],"multipleSelection":[4,"multiple-selection"],"useCancelConfirm":[4,"use-cancel-confirm"],"pageSize":[2,"page-size"],"resourceID":[1,"resource-i-d"],"enableGridInsert":[4,"enable-grid-insert"],"taskbarManager":[16],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"actionsList":[16],"configName":[1025,"config-name"],"showConfiguratorButtons":[4,"show-configurator-buttons"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"autoFocus":[4,"auto-focus"],"domainMessagesBuilder":[1,"domain-messages-builder"],"autoLoad":[4,"auto-load"],"_showPopUpGridConfig":[32],"_showFormConfig":[32],"_currentViewMode":[32],"_config":[32],"_fieldToGetFocus":[32],"_customContainerId":[32],"_formFields":[32],"_fieldsProps":[32],"_enableContinuousInsert":[32],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFieldProp":[64],"goToView":[64],"setMetadata":[64],"setRecords":[64],"getRecords":[64],"openConfigurator":[64],"closeConfigurator":[64],"updateConfig":[64]},[[0,"actionClick","actionClickListener"]]]]],["p-9d3a025a",[[2,"snk-expression-group",{"parentTop":[1026,"parent-top"],"group":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityURI":[1025,"entity-u-r-i"],"_conditionOperator":[32],"_group":[32],"_selfTop":[32],"canAddExpression":[32],"_showDashes":[32],"getExpressionGroup":[64]},[[8,"ezExpressionLayoutChanged","todoCompletedHandler"]]],[2,"snk-expression-item",{"expression":[16],"canRemove":[516,"can-remove"],"messagesBuilder":[1040],"entityURI":[1025,"entity-u-r-i"],"_showValueVariable":[32],"_fieldSelected":[32],"_optionNotNull":[32]}]]],["p-052213ba",[[0,"snk-filter-modal",{"getMessage":[16],"configName":[1025,"config-name"],"filters":[1040],"applyFilters":[16],"closeModal":[16],"addPersonalizedFilter":[16],"editPersonalizedFilter":[16],"deletePersonalizedFilter":[16],"filtersToDelete":[16],"disablePersonalizedFilter":[4,"disable-personalized-filter"]},[[0,"deleteFilter","deletePersonalizedFilterListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]],[2,"snk-filter-bar",{"customFilterBarConfig":[16],"dataUnit":[1040],"title":[1],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"mode":[1],"filterConfig":[1040],"messagesBuilder":[1040],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"autoLoad":[4,"auto-load"],"allowDefault":[32],"scrollerLocked":[32],"showPersonalizedFilter":[32],"personalizedFilterId":[32],"reload":[64],"getFilterItem":[64],"updateFilterItem":[64],"addFilterItem":[64],"removeFilterItem":[64],"showFilterModal":[64]},[[0,"filterChange","filterChangeListener"]]],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"showChips":[4,"show-chips"],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]]]],["p-6114ee36",[[6,"snk-grid",{"columnFilterDataSource":[1040],"configName":[1,"config-name"],"filterBarTitle":[1,"filter-bar-title"],"resourceID":[1,"resource-i-d"],"selectionToastConfig":[16],"actionsList":[16],"isDetail":[4,"is-detail"],"taskbarManager":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"gridHeaderCustomSlotId":[1,"grid-header-custom-slot-id"],"topTaskbarCustomSlotId":[1,"top-taskbar-custom-slot-id"],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"autoLoad":[4,"auto-load"],"autoFocus":[4,"auto-focus"],"enableGridInsert":[4,"enable-grid-insert"],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"_popUpGridConfig":[32],"_showSnkFilterBar":[32],"_enableContinuousInsert":[32],"showConfig":[64],"hideConfig":[64],"setConfig":[64],"reloadFilterBar":[64],"getFilterBar":[64],"findColumn":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFocus":[64]},[[2,"click","handleClick"]]]]],["p-2d3f9482",[[6,"snk-tab-config",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"tabItems":[16],"messagesBuilder":[1040],"_processedTabs":[32],"_activeEditText":[32],"_activeEditTextIndex":[32],"_actionsHide":[32],"_actionsShow":[32]}]]],["p-fa6c5826",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"messagesBuilder":[1040],"formLegacyConfigName":[1,"form-legacy-config-name"],"resourceID":[1,"resource-i-d"],"_dataUnit":[32],"_dataState":[32],"_showFormConfig":[32],"_configManager":[32],"showConfig":[64],"hideConfig":[64],"addCustomEditor":[64],"setFieldProp":[64]}],[2,"snk-form-config",{"dataUnit":[16],"configManager":[16],"messagesBuilder":[1040],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"_formConfigOptions":[32],"_fieldConfigSelected":[32],"_layoutFormConfig":[32],"_fieldsAvailable":[32],"_formConfig":[32],"_formConfigChanged":[32],"_optionFormConfigSelected":[32],"_optionFormConfigChanged":[32],"_tempGroups":[32]}],[2,"snk-config-options",{"fieldConfig":[16],"idConfig":[513,"id-config"],"dataUnit":[16],"messagesBuilder":[1040],"_defaultType":[32]}]]],["p-0b6cd238",[[2,"snk-attach",{"fetcherType":[1,"fetcher-type"],"fetcher":[16],"dataUnit":[16],"dataUnitBuilder":[16],"registerKey":[1,"register-key"],"entityName":[1,"entity-name"],"messagesBuilder":[1040],"_currentFetcher":[32],"_currentDataUnit":[32],"crudConfig":[32]}]]],["p-3ab6df3d",[[2,"snk-filter-assistent-mode",{"filterAssistent":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityUri":[1025,"entity-uri"],"application":[1040]}],[2,"snk-filter-advanced-mode",{"filterAssistent":[1040],"application":[1040]}]]],["p-275de842",[[2,"snk-grid-config",{"selectedIndex":[1026,"selected-index"],"columns":[1040],"config":[1040],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"]}],[2,"snk-actions-button",{"_items":[32],"_showDropdown":[32],"_actions":[32],"_isOrderActions":[32]}],[1,"snk-select-box",{"selectedOption":[1,"selected-option"]}],[2,"taskbar-actions-button",{"title":[1],"enabled":[4],"actions":[16],"_showDropdown":[32],"showActions":[64],"hideActions":[64],"isOpened":[64]},[[8,"keydown","handleKeyDown"],[8,"ezOpenModal","handleClose"]]]]],["p-cefb0ee1",[[6,"snk-detail-view",{"formConfigManager":[1040],"dataUnitName":[1,"data-unit-name"],"resourceID":[1,"resource-i-d"],"guideItemPath":[16],"entityName":[1,"entity-name"],"label":[1],"dataUnit":[1040],"selectedForm":[1025,"selected-form"],"dataState":[1040],"messagesBuilder":[1040],"branchGuide":[1040],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"customEditors":[16],"customRenders":[16],"_disabledButtons":[32],"_currentView":[32],"attachmentRegisterKey":[32],"changeViewMode":[64],"configGrid":[64],"showUp":[64],"addCustomEditor":[64],"addGridCustomRender":[64]},[[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-ab1645fb",[[6,"snk-guides-viewer",{"dataUnit":[16],"dataState":[16],"configName":[1,"config-name"],"entityPath":[1,"entity-path"],"actionsList":[16],"recordsValidator":[16],"masterFormConfig":[1040],"selectedGuide":[16],"taskbarManager":[16],"messagesBuilder":[1040],"canEdit":[4,"can-edit"],"presentationMode":[1,"presentation-mode"],"resourceID":[1,"resource-i-d"],"detailTaskbarCustomContainerId":[1,"detail-taskbar-custom-container-id"],"formLegacyConfigName":[1,"form-legacy-config-name"],"enableGridInsert":[4,"enable-grid-insert"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"getCustomTitle":[16],"_hasToCreateFieldSearch":[32],"_breadcrumbItems":[32],"_guides":[32],"_formEditorConfigManager":[32],"_formEditorDataUnit":[32],"_fieldToGetFocus":[32],"_customEditors":[32],"_customRenders":[32],"_fieldsProps":[32],"showFormConfig":[64],"findField":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"setFieldProp":[64],"setFocus":[64]},[[2,"actionClick","onActionClick"],[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-5e51e833",[[6,"snk-crud",{"configName":[1025,"config-name"],"filterBarTitle":[1,"filter-bar-title"],"selectionToastConfig":[16],"showActionButtons":[4,"show-action-buttons"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"autoLoad":[4,"auto-load"],"autoFocus":[4,"auto-focus"],"enableGridInsert":[4,"enable-grid-insert"],"domainMessagesBuilder":[1,"domain-messages-builder"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"setCustomFormTitle":[16],"_dataUnit":[32],"_dataState":[32],"attachmentRegisterKey":[32],"_currentViewMode":[32],"_canEdit":[32],"_resourceID":[32],"customContainerId":[32],"goToView":[64],"openConfigurator":[64],"closeConfigurator":[64],"reloadFilterBar":[64],"getFilterBar":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFieldProp":[64]}]]]]'),e)));
1
+ import{p as e,b as t}from"./p-d2d301a6.js";export{s as setNonce}from"./p-d2d301a6.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t(JSON.parse('[["p-118e769b",[[1,"teste-pesquisa"]]],["p-ac8d1cd6",[[2,"snk-actions-form",{"action":[16],"applyParameters":[16],"dataUnit":[32],"openPopup":[64]}]]],["p-9531fd46",[[2,"snk-client-confirm",{"titleMessage":[1,"title-message"],"message":[1],"accept":[16],"cancel":[16],"openPopup":[64]}]]],["p-21a81901",[[6,"snk-custom-slot-elements",{"slotName":[1,"slot-name"]}]]],["p-33718dfc",[[2,"snk-entity-list",{"config":[1040],"rightListSlotBuilder":[1040],"maxHeightList":[1,"max-height-list"],"_searchValue":[32],"_ezListSource":[32],"reloadList":[64]}]]],["p-8c235d4c",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"presentationMode":[2,"presentation-mode"],"resetValues":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-5f157b09",[[0,"snk-filter-checkbox-list",{"config":[1040],"optionsList":[32]}]]],["p-bf2acf72",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-01ba23cd",[[0,"snk-filter-number",{"config":[16],"getMessage":[16],"value":[2],"presentationMode":[2,"presentation-mode"],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-7e2ded86",[[0,"snk-filter-period",{"config":[16],"getMessage":[16],"value":[8],"presentationMode":[2,"presentation-mode"],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-c8622597",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-96a89d58",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-5b51491f",[[2,"snk-personalized-filter-editor",{"messagesBuilder":[1040],"presentationMode":[2,"presentation-mode"],"config":[16],"value":[1040],"items":[32],"show":[64]}]]],["p-434817f0",[[2,"snk-print-selector",{"_printServerActive":[32],"_selectedPrinter":[32],"_remotePrintersDataSource":[32],"_localPrintersDataSource":[32],"_printJobData":[32],"openPrintSelector":[64]}]]],["p-d1791da2",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["p-da87e42c",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"loadByPK":[16],"getKeyboardManager":[64],"isUserSup":[64],"addPendingAction":[64],"callServiceBroker":[64],"initOnboarding":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"showAlerts":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"webConnection":[64],"createDataunit":[64],"updateDataunitCache":[64],"getDataUnit":[64],"addClientEvent":[64],"removeClientEvent":[64],"hasClientEvent":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadTotals":[64],"isLoadedByPk":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64],"getAppLabel":[64],"addSearchListener":[64],"importScript":[64],"getApplicationPath":[64],"executeSelectDistinct":[64],"getDataFetcher":[64],"whenApplicationReady":[64],"setSearchFilterContext":[64]}]]],["p-aa003d4e",[[0,"snk-filter-modal-item",{"filterItem":[1040],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"]}]]],["p-26b0ce3e",[[2,"snk-form-summary",{"fixed":[1540],"contracted":[1540],"summary":[16]}]]],["p-1db45d26",[[6,"snk-form-view",{"levelPath":[1,"level-path"],"label":[1],"name":[1],"fields":[16],"formMetadata":[8,"form-metadata"],"dataUnit":[16],"contracted":[4],"fixed":[1540],"summaryFields":[16],"canExpand":[4,"can-expand"],"canFix":[4,"can-fix"],"recordsValidator":[16],"fieldToFocus":[1,"field-to-focus"],"customEditors":[16],"fieldsProps":[16],"showUp":[64],"addCustomEditor":[64],"setFieldProp":[64]}]]],["p-c2e468c9",[[6,"snk-simple-bar",{"label":[1],"breadcrumbItens":[16],"messagesBuilder":[1040]}]]],["p-8002dcd0",[[2,"snk-filter-field-search",{"searchable":[4],"fieldsDataSource":[16],"breadcrumbItems":[32],"linkItems":[32],"fieldItems":[32],"searchEmpty":[32],"groupEmpty":[32],"show":[64],"applyFilter":[64]}],[0,"snk-filter-param-config",{"messagesBuilder":[1040],"_opened":[32],"_configType":[32],"_expressionItem":[32],"_informedInstance":[32],"_canSave":[32],"open":[64],"close":[64]}]]],["p-fca0e5cc",[[2,"snk-personalized-filter",{"messagesBuilder":[1040],"entityUri":[1025,"entity-uri"],"filterId":[1025,"filter-id"],"configName":[1025,"config-name"],"resourceID":[1,"resource-i-d"],"_filterAssistentMode":[32],"_filterAssistent":[32],"createPersonalizedFilter":[64]}]]],["p-41793e17",[[2,"snk-configurator",{"showActionButtons":[4,"show-action-buttons"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"viewMode":[2,"view-mode"],"customContainerId":[1,"custom-container-id"],"messagesBuilder":[1040],"_opened":[32],"_permissions":[32],"open":[64],"close":[64]}]]],["p-c1adf0dd",[[2,"snk-data-unit",{"dataState":[1040],"messagesBuilder":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"useCancelConfirm":[4,"use-cancel-confirm"],"ignoreSaveMessage":[4,"ignore-save-message"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"domainMessagesBuilder":[1,"domain-messages-builder"],"fieldsToLink":[32],"getDataUnit":[64],"getSelectedRecordsIDsInfo":[64],"getFieldsWithRmp":[64],"getFieldsWithRmPrecision":[64],"getRowMetadata":[64]}]]],["p-54a5d52a",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"showHardFixed":[4,"show-hard-fixed"],"show":[64]}]]],["p-8b4fc28f",[[2,"snk-field-config",{"isConfigActive":[16],"fieldConfig":[16],"modeInsertion":[516,"mode-insertion"],"dataUnit":[16],"messagesBuilder":[1040]}]]],["p-16a1dd18",[[0,"snk-exporter-email-sender",{"getMessage":[16],"_config":[32],"_opened":[32],"_currentStep":[32],"open":[64],"close":[64]}]]],["p-9c3138f5",[[2,"snk-data-exporter",{"provider":[16],"messagesBuilder":[1040],"_items":[32],"_showDropdown":[32]}]]],["p-2aae03a1",[[6,"snk-taskbar",{"alignRigth":[4,"align-rigth"],"customSlotId":[1,"custom-slot-id"],"customContainerId":[1,"custom-container-id"],"overflowStrategy":[1,"overflow-strategy"],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"presentationMode":[1537,"presentation-mode"],"messagesBuilder":[1040],"_permissions":[32],"_overFlowedElements":[32],"_customElements":[32],"_customElementsId":[32],"_slotContainer":[32],"_hiddenActionsList":[32],"_lastWidth":[32],"_hasToUpdateOverFlow":[32],"_isWaitingForSave":[32]},[[8,"snkCustomSlotElementsLoaded","handleCustomSlotElementsLoaded"],[8,"taskbarSaveLocker","handleTaskbarSaveLocker"],[8,"taskbarSaveUnlocker","handleTaskbarSaveUnlocker"]]]]],["p-0e250436",[[6,"snk-simple-crud",{"dataState":[16],"dataUnit":[16],"entityName":[1,"entity-name"],"mode":[2],"gridConfig":[1040],"formConfig":[1040],"multipleSelection":[4,"multiple-selection"],"useCancelConfirm":[4,"use-cancel-confirm"],"pageSize":[2,"page-size"],"resourceID":[1,"resource-i-d"],"enableGridInsert":[4,"enable-grid-insert"],"taskbarManager":[16],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"actionsList":[16],"configName":[1025,"config-name"],"showConfiguratorButtons":[4,"show-configurator-buttons"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"autoFocus":[4,"auto-focus"],"domainMessagesBuilder":[1,"domain-messages-builder"],"autoLoad":[4,"auto-load"],"_showPopUpGridConfig":[32],"_showFormConfig":[32],"_currentViewMode":[32],"_config":[32],"_fieldToGetFocus":[32],"_customContainerId":[32],"_formFields":[32],"_fieldsProps":[32],"_enableContinuousInsert":[32],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFieldProp":[64],"goToView":[64],"setMetadata":[64],"setRecords":[64],"getRecords":[64],"openConfigurator":[64],"closeConfigurator":[64],"updateConfig":[64]},[[0,"actionClick","actionClickListener"]]]]],["p-9d3a025a",[[2,"snk-expression-group",{"parentTop":[1026,"parent-top"],"group":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityURI":[1025,"entity-u-r-i"],"_conditionOperator":[32],"_group":[32],"_selfTop":[32],"canAddExpression":[32],"_showDashes":[32],"getExpressionGroup":[64]},[[8,"ezExpressionLayoutChanged","todoCompletedHandler"]]],[2,"snk-expression-item",{"expression":[16],"canRemove":[516,"can-remove"],"messagesBuilder":[1040],"entityURI":[1025,"entity-u-r-i"],"_showValueVariable":[32],"_fieldSelected":[32],"_optionNotNull":[32]}]]],["p-3858a2e4",[[0,"snk-filter-modal",{"getMessage":[16],"configName":[1025,"config-name"],"filters":[1040],"applyFilters":[16],"closeModal":[16],"addPersonalizedFilter":[16],"editPersonalizedFilter":[16],"deletePersonalizedFilter":[16],"filtersToDelete":[16],"disablePersonalizedFilter":[4,"disable-personalized-filter"]},[[0,"deleteFilter","deletePersonalizedFilterListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]],[2,"snk-filter-bar",{"customFilterBarConfig":[16],"dataUnit":[1040],"title":[1],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"],"mode":[1],"filterConfig":[1040],"messagesBuilder":[1040],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"autoLoad":[4,"auto-load"],"allowDefault":[32],"scrollerLocked":[32],"showPersonalizedFilter":[32],"personalizedFilterId":[32],"reload":[64],"getFilterItem":[64],"updateFilterItem":[64],"addFilterItem":[64],"removeFilterItem":[64],"showFilterModal":[64]},[[0,"filterChange","filterChangeListener"]]],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"showChips":[4,"show-chips"],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]]]],["p-1dbd5c18",[[6,"snk-grid",{"columnFilterDataSource":[1040],"configName":[1,"config-name"],"filterBarTitle":[1,"filter-bar-title"],"resourceID":[1,"resource-i-d"],"selectionToastConfig":[16],"actionsList":[16],"isDetail":[4,"is-detail"],"taskbarManager":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"gridHeaderCustomSlotId":[1,"grid-header-custom-slot-id"],"topTaskbarCustomSlotId":[1,"top-taskbar-custom-slot-id"],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"autoLoad":[4,"auto-load"],"autoFocus":[4,"auto-focus"],"enableGridInsert":[4,"enable-grid-insert"],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"_popUpGridConfig":[32],"_showSnkFilterBar":[32],"_enableContinuousInsert":[32],"showConfig":[64],"hideConfig":[64],"setConfig":[64],"reloadFilterBar":[64],"getFilterBar":[64],"findColumn":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFocus":[64]},[[2,"click","handleClick"]]]]],["p-2d3f9482",[[6,"snk-tab-config",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"tabItems":[16],"messagesBuilder":[1040],"_processedTabs":[32],"_activeEditText":[32],"_activeEditTextIndex":[32],"_actionsHide":[32],"_actionsShow":[32]}]]],["p-30ebcbe0",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"messagesBuilder":[1040],"formLegacyConfigName":[1,"form-legacy-config-name"],"resourceID":[1,"resource-i-d"],"_dataUnit":[32],"_dataState":[32],"_showFormConfig":[32],"_configManager":[32],"showConfig":[64],"hideConfig":[64],"addCustomEditor":[64],"setFieldProp":[64]}],[2,"snk-form-config",{"dataUnit":[16],"configManager":[16],"messagesBuilder":[1040],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"_formConfigOptions":[32],"_fieldConfigSelected":[32],"_layoutFormConfig":[32],"_fieldsAvailable":[32],"_formConfig":[32],"_formConfigChanged":[32],"_optionFormConfigSelected":[32],"_optionFormConfigChanged":[32],"_tempGroups":[32]}],[2,"snk-config-options",{"fieldConfig":[16],"idConfig":[513,"id-config"],"dataUnit":[16],"messagesBuilder":[1040],"_defaultType":[32]}]]],["p-a2c790ac",[[2,"snk-attach",{"fetcherType":[1,"fetcher-type"],"fetcher":[16],"dataUnit":[16],"dataUnitBuilder":[16],"registerKey":[1,"register-key"],"entityName":[1,"entity-name"],"messagesBuilder":[1040],"_currentFetcher":[32],"_currentDataUnit":[32],"crudConfig":[32]}]]],["p-3ab6df3d",[[2,"snk-filter-assistent-mode",{"filterAssistent":[1040],"messagesBuilder":[1040],"filterId":[1025,"filter-id"],"entityUri":[1025,"entity-uri"],"application":[1040]}],[2,"snk-filter-advanced-mode",{"filterAssistent":[1040],"application":[1040]}]]],["p-563b7c28",[[2,"snk-grid-config",{"selectedIndex":[1026,"selected-index"],"columns":[1040],"config":[1040],"configName":[1,"config-name"],"resourceID":[1,"resource-i-d"]}],[2,"snk-actions-button",{"_items":[32],"_showDropdown":[32],"_actions":[32],"_isOrderActions":[32]}],[1,"snk-select-box",{"selectedOption":[1,"selected-option"]}],[2,"taskbar-actions-button",{"title":[1],"enabled":[4],"actions":[16],"_showDropdown":[32],"showActions":[64],"hideActions":[64],"isOpened":[64]},[[8,"keydown","handleKeyDown"],[8,"ezOpenModal","handleClose"]]]]],["p-43353d86",[[6,"snk-detail-view",{"formConfigManager":[1040],"dataUnitName":[1,"data-unit-name"],"resourceID":[1,"resource-i-d"],"guideItemPath":[16],"entityName":[1,"entity-name"],"label":[1],"dataUnit":[1040],"selectedForm":[1025,"selected-form"],"dataState":[1040],"messagesBuilder":[1040],"branchGuide":[1040],"canEdit":[4,"can-edit"],"taskbarCustomContainerId":[1,"taskbar-custom-container-id"],"customEditors":[16],"customRenders":[16],"_disabledButtons":[32],"_currentView":[32],"attachmentRegisterKey":[32],"changeViewMode":[64],"configGrid":[64],"showUp":[64],"addCustomEditor":[64],"addGridCustomRender":[64]},[[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-42130213",[[6,"snk-guides-viewer",{"dataUnit":[16],"dataState":[16],"configName":[1,"config-name"],"entityPath":[1,"entity-path"],"actionsList":[16],"recordsValidator":[16],"masterFormConfig":[1040],"selectedGuide":[16],"taskbarManager":[16],"messagesBuilder":[1040],"canEdit":[4,"can-edit"],"presentationMode":[1,"presentation-mode"],"resourceID":[1,"resource-i-d"],"detailTaskbarCustomContainerId":[1,"detail-taskbar-custom-container-id"],"formLegacyConfigName":[1,"form-legacy-config-name"],"enableGridInsert":[4,"enable-grid-insert"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"getCustomTitle":[16],"_hasToCreateFieldSearch":[32],"_breadcrumbItems":[32],"_guides":[32],"_formEditorConfigManager":[32],"_formEditorDataUnit":[32],"_fieldToGetFocus":[32],"_customEditors":[32],"_customRenders":[32],"_fieldsProps":[32],"showFormConfig":[64],"findField":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"setFieldProp":[64],"setFocus":[64]},[[2,"actionClick","onActionClick"],[0,"snkContentCardChanged","onContentCardChanged"]]]]],["p-f0aaad2b",[[6,"snk-crud",{"configName":[1025,"config-name"],"filterBarTitle":[1,"filter-bar-title"],"selectionToastConfig":[16],"showActionButtons":[4,"show-action-buttons"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"presentationMode":[1,"presentation-mode"],"messagesBuilder":[1040],"useEnterLikeTab":[4,"use-enter-like-tab"],"gridLegacyConfigName":[1,"grid-legacy-config-name"],"filterBarLegacyConfigName":[1,"filter-bar-legacy-config-name"],"formLegacyConfigName":[1,"form-legacy-config-name"],"disablePersonalizedFilter":[4,"disable-personalized-filter"],"autoLoad":[4,"auto-load"],"autoFocus":[4,"auto-focus"],"enableGridInsert":[4,"enable-grid-insert"],"domainMessagesBuilder":[1,"domain-messages-builder"],"ignoreReadOnlyFormFields":[4,"ignore-read-only-form-fields"],"setCustomFormTitle":[16],"_dataUnit":[32],"_dataState":[32],"attachmentRegisterKey":[32],"_currentViewMode":[32],"_canEdit":[32],"_resourceID":[32],"customContainerId":[32],"goToView":[64],"openConfigurator":[64],"closeConfigurator":[64],"reloadFilterBar":[64],"getFilterBar":[64],"addCustomEditor":[64],"addGridCustomRender":[64],"addCustomValueFormatter":[64],"removeCustomValueFormatter":[64],"setFieldProp":[64]}]]]]'),e)));
@@ -0,0 +1,11 @@
1
+ import { RequestListenerParams } from "../../../lib/http/data-fetcher/DataFetcher";
2
+ import { ILoadBarRequestListener } from "./RequestListenerFactory";
3
+ declare class DebouncedRequestListener implements ILoadBarRequestListener {
4
+ ezLoadingBar: HTMLEzLoadingBarElement;
5
+ private readonly _debounceTime;
6
+ private requests;
7
+ private requestsLoadingBar;
8
+ onRequestStart(param: RequestListenerParams): void;
9
+ onRequestEnd(param: RequestListenerParams): void;
10
+ }
11
+ export default DebouncedRequestListener;
@@ -0,0 +1,12 @@
1
+ import { RequestListener } from "../../../lib/http/data-fetcher/DataFetcher";
2
+ export interface ILoadBarRequestListener extends RequestListener {
3
+ ezLoadingBar: HTMLEzLoadingBarElement;
4
+ }
5
+ type RequestListenerStrategy = 'request_time' | 'request_name';
6
+ interface RequestListenerFactoryStrategyParams {
7
+ strategy: RequestListenerStrategy;
8
+ }
9
+ declare class RequestListenerFactory {
10
+ static create({ strategy }: RequestListenerFactoryStrategyParams): ILoadBarRequestListener;
11
+ }
12
+ export default RequestListenerFactory;
@@ -0,0 +1,13 @@
1
+ import { RequestListenerParams } from "../../../lib/http/data-fetcher/DataFetcher";
2
+ import { ILoadBarRequestListener } from "./RequestListenerFactory";
3
+ declare class RequestListenerLoadingBar implements ILoadBarRequestListener {
4
+ readonly _debounceTime: number;
5
+ readonly _ignoredNameTypes: string[];
6
+ _timerLoading: any;
7
+ _countRequest: number;
8
+ ezLoadingBar: HTMLEzLoadingBarElement;
9
+ onRequestStart(param: RequestListenerParams): void;
10
+ onRequestEnd(param: RequestListenerParams): void;
11
+ private isIgnoreLoadingOnRequest;
12
+ }
13
+ export default RequestListenerLoadingBar;
@@ -4,7 +4,7 @@ import { AlertItem } from "@sankhyalabs/ezui/dist/types/components/ez-alert-list
4
4
  import { IOption, ISearchArgument } from "@sankhyalabs/ezui/dist/types/components/ez-search/ez-search";
5
5
  import { EventEmitter } from "../../stencil-public-runtime";
6
6
  import { IAppletCallerParams } from "../../lib/applet-caller/applet-caller";
7
- import { DataFetcher, Options, RequestListener, RequestListenerParams } from "../../lib/http/data-fetcher/DataFetcher";
7
+ import { DataFetcher, Options } from "../../lib/http/data-fetcher/DataFetcher";
8
8
  import AuthFetcher, { AutorizationType } from "../../lib/http/data-fetcher/fetchers/auth-fetcher";
9
9
  import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher";
10
10
  import GridConfigFetcher from "../../lib/http/data-fetcher/fetchers/grid-config-fetcher";
@@ -15,6 +15,7 @@ import { IClientEventResponse } from "../../lib/http/data-fetcher/interfaces/ICl
15
15
  import { IDataFetcherRecaller } from "../../lib/http/data-fetcher/recaller/IDataFetcherRecaller";
16
16
  import { SnkMessageBuilder } from "../../lib/message/SnkMessageBuilder";
17
17
  import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
18
+ import { ILoadBarRequestListener } from "./request-listener/RequestListenerFactory";
18
19
  export declare class SnkApplication {
19
20
  private readonly NEW_VERSION_POPUP_LOCKER;
20
21
  _parameters: ParametersFetcher;
@@ -34,7 +35,7 @@ export declare class SnkApplication {
34
35
  _waitingAppReady: Array<any>;
35
36
  _duCache: Map<string, DataUnit>;
36
37
  _duPromises: Map<string, Array<PendingPromise>>;
37
- _requestListener: RequestListenerLoadingBar;
38
+ _requestListener: ILoadBarRequestListener;
38
39
  private _pendingActions;
39
40
  private _auth;
40
41
  private _currentPkParameter;
@@ -348,16 +349,6 @@ export declare class SnkApplication {
348
349
  private removeShortcuts;
349
350
  render(): any;
350
351
  }
351
- declare class RequestListenerLoadingBar implements RequestListener {
352
- readonly _debounceTime: number;
353
- readonly _ignoredNameTypes: string[];
354
- _timerLoading: any;
355
- _countRequest: number;
356
- loadingBar: HTMLEzLoadingBarElement;
357
- onRequestStart(param: RequestListenerParams): void;
358
- onRequestEnd(param: RequestListenerParams): void;
359
- private isIgnoreLoadingOnRequest;
360
- }
361
352
  type LoadByPkHandler = (objPK: {
362
353
  pk: Record<string, any>;
363
354
  }, redirectFrom?: string) => void;
@@ -44,6 +44,7 @@ export interface RequestListener {
44
44
  onRequestEnd(param: RequestListenerParams): void;
45
45
  }
46
46
  export interface RequestListenerParams {
47
+ requestId: string;
47
48
  url: string;
48
49
  requestBody?: any;
49
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/sankhyablocks",
3
- "version": "8.16.0-dev.41",
3
+ "version": "8.16.0-dev.43",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- export{S as snk_guides_viewer}from"./p-7bd9683d.js";import"./p-d2d301a6.js";import"@sankhyalabs/core";import"./p-fadc8339.js";import"./p-4d9549cf.js";import"./p-06421fdb.js";import"./p-f3434fc4.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-ff1990ad.js";import"./p-95ce311a.js";import"@sankhyalabs/ezui/dist/collection/utils/form";import"./p-23736d75.js";import"./p-7e7a7473.js";import"./p-30cf616e.js";import"./p-6dc031de.js";import"./p-8a9638ae.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"./p-47bce500.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"@sankhyalabs/core/dist/dataunit/DataUnit";
@@ -1 +0,0 @@
1
- import{ObjectUtils as t}from"@sankhyalabs/core";import{R as a}from"./p-06421fdb.js";class s extends a{getData(a){const s=`cfg://auth/${a}`;return new Promise(((a,e)=>{this.loadResource(s).then((s=>{let e=t.stringToObject(s);e&&"object"==typeof e&&a(e)})).catch((t=>{e(t)}))}))}}var e;!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(e||(e={}));export{e as A,s as a}