@sankhyalabs/sankhyablocks 2.2.2-SKA-60656.4 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/snk-application.cjs.entry.js +3 -1
- package/dist/cjs/snk-configurator_3.cjs.entry.js +9 -1
- package/dist/cjs/snk-crud.cjs.entry.js +10 -2
- package/dist/cjs/snk-filter-bar_7.cjs.entry.js +32 -20
- package/dist/cjs/snk-filter-detail.cjs.entry.js +11 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -2
- package/dist/cjs/snk-form.cjs.entry.js +12 -3
- package/dist/cjs/{taskbar-elements-997af1c9.js → taskbar-elements-b995b84d.js} +26 -26
- package/dist/collection/components/snk-application/snk-application.js +4 -2
- package/dist/collection/components/snk-crud/snk-crud.js +10 -2
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +12 -2
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +1 -1
- package/dist/collection/components/snk-form/snk-form.js +13 -4
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +2 -2
- package/dist/collection/components/snk-grid/snk-grid.js +10 -1
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +2 -2
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +26 -26
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +28 -16
- package/dist/components/snk-application2.js +4 -2
- package/dist/components/snk-crud.js +10 -2
- package/dist/components/snk-filter-bar2.js +1 -1
- package/dist/components/snk-filter-detail2.js +12 -2
- package/dist/components/snk-filter-item2.js +1 -1
- package/dist/components/snk-form-config2.js +3 -3
- package/dist/components/snk-form2.js +13 -4
- package/dist/components/snk-grid-config2.js +3 -3
- package/dist/components/snk-grid2.js +10 -1
- package/dist/components/snk-taskbar2.js +54 -42
- package/dist/esm/snk-application.entry.js +5 -3
- package/dist/esm/snk-configurator_3.entry.js +9 -1
- package/dist/esm/snk-crud.entry.js +11 -3
- package/dist/esm/snk-filter-bar_7.entry.js +32 -20
- package/dist/esm/snk-filter-detail.entry.js +12 -2
- package/dist/esm/snk-form-config.entry.js +3 -3
- package/dist/esm/snk-form.entry.js +13 -4
- package/dist/esm/taskbar-elements-a0a8c3ac.js +95 -0
- package/dist/sankhyablocks/p-2e0747f9.entry.js +1 -0
- package/dist/sankhyablocks/p-4cbc4ae3.js +1 -0
- package/dist/sankhyablocks/{p-7dcce5aa.entry.js → p-60e7e86d.entry.js} +1 -1
- package/dist/sankhyablocks/p-825c8975.entry.js +1 -0
- package/dist/sankhyablocks/{p-6340d992.entry.js → p-a72a0a5d.entry.js} +8 -8
- package/dist/sankhyablocks/p-cd486089.entry.js +1 -0
- package/dist/sankhyablocks/p-d2b0f1fc.entry.js +1 -0
- package/dist/sankhyablocks/p-d61f2170.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +2 -0
- package/dist/types/components/snk-form/snk-form.d.ts +2 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +2 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -2
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -2
- package/package.json +3 -4
- package/dist/esm/taskbar-elements-a0a8b106.js +0 -95
- package/dist/sankhyablocks/p-09720dd1.js +0 -1
- package/dist/sankhyablocks/p-0ffee54f.entry.js +0 -1
- package/dist/sankhyablocks/p-133cf71d.entry.js +0 -1
- package/dist/sankhyablocks/p-7e79ab39.entry.js +0 -1
- package/dist/sankhyablocks/p-9b0f99fd.entry.js +0 -1
- package/dist/sankhyablocks/p-bc41625b.entry.js +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{r as t,c as e,h as s}from"./p-9ba3df4c.js";import{WaitingChangeException as
|
|
1
|
+
import{r as t,c as e,h as s,g as i}from"./p-9ba3df4c.js";import{WaitingChangeException as r,WarningException as n,ErrorException as a,ObjectUtils as o,DataType as c,DataUnit as h,StringUtils as u,ChangeOperation as l,DateUtils as d,DependencyType as p,ElementIDUtils as m,ApplicationContext as f,ErrorTracking as y}from"@sankhyalabs/core";import{d as g,D as v,R as w,U as I,F as _,G as P,C as $}from"./p-6ba8f415.js";import{ApplicationUtils as D}from"@sankhyalabs/ezui/dist/collection/utils";import{S}from"./p-877bd6cf.js";import"./p-112455b1.js";class C{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}rejectionHandler(t){const e=t.reason;e instanceof r||(e?this.processException(e):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.errorCode+"')} catch(e){alert('Não é possível abrir a ajuda fora do workspace Sankhya');}\">Código: "+t.errorCode+"</a>"}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t)),t instanceof r||t instanceof n?this._app.alert(t.title,t.message):t instanceof a?this._app.error(t.title,t.message):this._app.isDebugMode().then((e=>{if(e)if(t instanceof Error)this._app.error(t.name,t.message);else{const e=(null==t?void 0:t.title)||"Erro detectado",s="string"==typeof t?t:t.message||`Erro interno "${o.objectToString(t)}"`;this._app.error(e,s)}}))}}class A{constructor(){this._defaultPageSize=100,this._templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this._templateByQuery.set("search",g.gql`query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
|
|
2
2
|
$queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
|
|
3
3
|
value
|
|
4
4
|
label
|
|
5
5
|
}
|
|
6
|
-
}`)}loadSearchOptions(t,e,s,i){const r=(null==e?void 0:e.trim())||void 0;return e=isNaN(Number(r))&&r?`%${r}`:r,new Promise(((r,n)=>{
|
|
6
|
+
}`)}loadSearchOptions(t,e,s,i){const r=(null==e?void 0:e.trim())||void 0;return e=isNaN(Number(r))&&r?`%${r}`:r,new Promise(((r,n)=>{v.get().callGraphQL({values:{argument:e,entityName:t,criteria:s,options:i},query:this._templateByQuery.get("search")}).then((t=>{r(t)})).catch((t=>{n(t)}))}))}loadAdvancedSearch(t,e,s,i){const r={query:{$:null==s?void 0:s.expression}};(null==s?void 0:s.params.length)>0&&(r.params={param:s.params.map((t=>{let e=t.value,s=t.dataType;return s===c.OBJECT?(e=e.value,s="S"):s=function(t){switch(t){case c.NUMBER:return"I";case c.DATE:return"D";default:return"S"}}(t.dataType),{$:e,type:s}}))});const n={serviceName:"PesquisaSP.getSuggestion",requestBody:{criteria:{entityName:t,compacted:!1,ignoreEntityCriteria:!1,limit:this._defaultPageSize,query:{$:e},orderByDesc:!1,externalCriteria:r,localEntityName:null==i?void 0:i.rootEntity},clientEventList:{clientEvent:[]}}};return new Promise(((t,e)=>{v.get().callServiceBroker("PesquisaSP.getSuggestion",JSON.stringify(n)).then((e=>t(e))).catch((t=>e(t)))}))}}function T(){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(T=function(){return t})()}const N=E;function E(t,e){const s=T();return(E=function(t){return s[t-=392]})(t,e)}!function(){const t=E,e=T();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;e.push(e.shift())}catch(t){e.push(e.shift())}}();const b=N(396);class q{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchTotals",g.gql`query($filters: [InputFilter!] $name: String!) {
|
|
7
7
|
$queryAlias$: fetchTotals(name: $name, filters: $filters ){
|
|
8
8
|
name
|
|
9
9
|
value
|
|
10
10
|
}
|
|
11
|
-
}`)}async getTotals(t,e,s){let i={name:`totals://${t}/${e}`,filters:s};return
|
|
11
|
+
}`)}async getTotals(t,e,s){let i={name:`totals://${t}/${e}`,filters:s};return v.get().callGraphQL({values:i,query:this.templateByQuery.get("fetchTotals")})}fetchTotals(t,e,s=[]){return new Promise(((i,r)=>{this.getTotals(t,e,s).then((t=>{if(t.length>0){const e=new Map;t.forEach((t=>{e.set(t.name,parseFloat(t.value))})),i(e)}else r("Não foi possível recuperar os totalizadores")})).catch((t=>{r(t)}))}))}}class U{constructor(){this.templateByQuery=new Map,this._loadDataTimeout={},this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchDataUnit",g.gql`query($name: String!) {
|
|
12
12
|
$queryAlias$: fetchDataUnit(name: $name){
|
|
13
13
|
name
|
|
14
14
|
fields{
|
|
@@ -33,7 +33,7 @@ import{r as t,c as e,h as s}from"./p-9ba3df4c.js";import{WaitingChangeException
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
}`),this.templateByQuery.set("fetchData",
|
|
36
|
+
}`),this.templateByQuery.set("fetchData",g.gql`query($dataunit: String! $limit: Int $offset:Int $filters: [InputFilter!] $sort: [InputSort!]) {
|
|
37
37
|
$queryAlias$: fetchDataUnit(name: $dataunit){
|
|
38
38
|
data(limit: $limit offset: $offset filters: $filters sort: $sort){
|
|
39
39
|
limit
|
|
@@ -49,7 +49,7 @@ import{r as t,c as e,h as s}from"./p-9ba3df4c.js";import{WaitingChangeException
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
}`),this.templateByQuery.set("saveData",
|
|
52
|
+
}`),this.templateByQuery.set("saveData",g.gql`mutation($changes: [InputBatchChange!]!) {
|
|
53
53
|
$queryAlias$: batchOperationDataUnit(changes: $changes){
|
|
54
54
|
oldId
|
|
55
55
|
id
|
|
@@ -58,7 +58,7 @@ import{r as t,c as e,h as s}from"./p-9ba3df4c.js";import{WaitingChangeException
|
|
|
58
58
|
value
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
}`),this.templateByQuery.set("fetchDataRecord",
|
|
61
|
+
}`),this.templateByQuery.set("fetchDataRecord",g.gql`query($dataunit: String! $recordID: [String!]) {
|
|
62
62
|
$queryAlias$: fetchDataUnit(name: $dataunit){
|
|
63
63
|
record(id: $recordID){
|
|
64
64
|
id
|
|
@@ -68,9 +68,9 @@ import{r as t,c as e,h as s}from"./p-9ba3df4c.js";import{WaitingChangeException
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
}`)}getDataUnit(t,e){const s=new
|
|
71
|
+
}`)}getDataUnit(t,e){const s=new h(`dd://${t}/${e}`);return s.metadataLoader=t=>this.loadMetadata(t),s.dataLoader=(t,e)=>this.loadData(t,e),s.saveLoader=(t,e)=>this.saveData(t,e),s.removeLoader=(t,e)=>this.removeRecords(t,e),s.recordLoader=(t,e)=>this.loadRecord(t,e),s}loadMetadata(t){return new Promise(((e,s)=>{v.get().callGraphQL({values:{name:t.name},query:this.templateByQuery.get("fetchDataUnit")}).then((t=>{var s;const i={name:t.name,label:t.name,fields:[]};null===(s=t.fields)||void 0===s||s.forEach((t=>{let e;Array.isArray(t.properties)&&(e={},t.calculated&&(e.gridHeaderTooltip="Campos calculados não podem ser ordenados"),t.properties.forEach((t=>e[t.name]=t.value))),i.fields.push(Object.assign(Object.assign({},t),{properties:e}))})),e(i)})).catch((t=>{s(t)}))}))}loadData(t,e){const s=t.name;return this._loadDataTimeout[s]&&(clearTimeout(this._loadDataTimeout[s]),delete this._loadDataTimeout[s]),new Promise(((i,r)=>{this._loadDataTimeout[s]=setTimeout((()=>{delete this._loadDataTimeout[s],this.doLoadData(t,e).then((t=>i(t))).catch((t=>r(t)))}),200)}))}doLoadData(t,e){return new Promise(((s,i)=>{var r;const{sort:n,filters:a,limit:o,offset:h,quickFilter:l}=e,d={dataunit:t.name,sort:n,filters:a};if(d.limit=o,d.offset=h,!u.isEmpty(null==l?void 0:l.term)){void 0===d.filter&&(d.filter=[]);const t={name:"__QUICK_FILTER__",expression:"__QUICK_FILTER__",params:[{name:"term",dataType:c.TEXT,value:l.term}]};(null===(r=null==l?void 0:l.fields)||void 0===r?void 0:r.length)>0&&t.params.push({name:"fields",dataType:c.OBJECT,value:l.fields}),d.filter.push(t)}v.get().callGraphQL({values:d,query:this.templateByQuery.get("fetchData")}).then((e=>{const{limit:i,offset:r,total:n,hasMore:a,records:o}=e.data;let c;i&&(c={firstRecord:0==n?0:r+1,lastRecord:r+Math.min(o.length,i),total:n,currentPage:r/i,hasMore:a});const h=[];o.forEach((e=>{const s={__record__id__:e.id};e.fields.forEach((({name:e,value:i})=>{s[e]=t.valueFromString(e,i)})),h.push(s)})),s({paginationInfo:c,records:h})})).catch((t=>{i(t)}))}))}saveData(t,e){const s=e.map((e=>{const{dataUnit:s,record:i,updatingFields:r,operation:n}=e;let a;r&&(a=Object.entries(r).map((([e,s])=>{const i=t.getField(e);return{fieldName:e,dataType:i?i.dataType:c.TEXT,value:t.valueToString(e,s)}})));const o={dataUnit:s,fields:a,operation:n,recordId:i.__record__id__};return e.sourceId&&(o.sourceId=e.sourceId),o}));return new Promise(((e,i)=>{v.get().callGraphQL({values:{changes:s},query:this.templateByQuery.get("saveData")}).then((s=>{const i=[];null==s||s.forEach((e=>{const s={__record__id__:e.id};e.oldId&&(s.__old__id__=e.oldId),e.fields.forEach((({name:e,value:i})=>{s[e]=t.valueFromString(e,i)})),i.push(s)})),e(i)})).catch((t=>{i(t)}))}))}removeRecords(t,e){const s=e.map((e=>({dataUnit:t.name,operation:l.DELETE,recordId:e})));return new Promise(((t,i)=>{v.get().callGraphQL({values:{changes:s},query:this.templateByQuery.get("saveData")}).then((()=>{t(e)})).catch((t=>{i(t)}))}))}loadRecord(t,e){return new Promise(((s,i)=>{v.get().callGraphQL({values:{recordID:e,dataunit:t.name},query:this.templateByQuery.get("fetchDataRecord")}).then((e=>{const i=[];e.record.forEach((e=>{const s={__record__id__:e.id};e.fields.forEach((({name:e,value:i})=>{s[e]=t.valueFromString(e,i)})),i.push(s)})),s(i)})).catch((t=>{i(t)}))}))}}var O;class F{static openAppActivity(t,e){var s;null===(s=window.workspace)||void 0===s||s.openAppActivity(t,e)}}F.resourceID=null===(O=window.workspace)||void 0===O?void 0:O.resourceID;class R{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",g.gql`query($name: String!) {
|
|
72
72
|
$queryAlias$: fetchResource(name: $name){
|
|
73
73
|
name
|
|
74
74
|
resource
|
|
75
75
|
}
|
|
76
|
-
}`)}async getParam(t){const e=`param://application?params=${t}`;return y.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchParam")})}async asString(t){const e=await this.getParam(t);return this.getValue(e)}async asInteger(t){const e=await this.getParam(t);return parseInt(this.getValue(e))}async asFloat(t){const e=await this.getParam(t);return parseFloat(this.getValue(e))}async asBoolean(t){const e=await this.getParam(t);return this.getValue(e).includes('"S"')}async asDate(t){const e=await this.getParam(t);return l.strToDate(this.getValue(e))}async getBatchParams(t){const e=await this.getParam(t.join(",")),s={};return e.forEach((t=>s[t.name]=t.resource)),s}getValue(t={}){return Array.isArray(t)&&t.length>0&&(t=t[0]),h.isEmpty(t.resource)?"":t.resource}}const F=R;function R(t,e){const s=L();return(R=function(t){return s[t-=378]})(t,e)}function L(){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(L=function(){return t})()}!function(){const t=R,e=L();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class j{[F(397)](t){const e=F;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const s=new k("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>s.putAccess(t[e(382)],String(t.status)==e(398)))),s}}class k{constructor(t){const e=F;this.isSup=t,this[e(384)]={}}[F(378)](t,e){this[F(384)][t]=e}[F(393)](t){const e=F;if(this[e(402)])return!0;let s=!0;return this[e(384)][e(380)](t)&&(s=this.actions[t]),s}isUserSup(){return this.isSup}}class M extends g{getData(t){const e=`cfg://auth/${t}`;return new Promise(((t,s)=>{this.loadResource(e).then((e=>{let s=a.stringToObject(e);s&&"object"==typeof s&&t(s)})).catch((t=>{s(t)}))}))}}var x;function B(t){if(null==t)return t;if(t instanceof Date)return t.toISOString();if("object"==typeof t){if(t instanceof Array)return t.map((t=>B(t)));{const e=Object.assign({},t);return Object.keys(t).forEach((s=>{t[s]?e[s]=B(t[s]):delete e[s]})),e}}return t}!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"}(x||(x={}));class z extends g{saveConfig(t,e,s){const i=t.map((t=>{const{id:e,value:s,fixed:i,visible:r}=t,n={id:e};return s&&(n.value=B(s)),i&&(n.fixed=i),r&&(n.visible=!0),n}));return this.saveResource(i,`cfg://filter/FilterBarState:${e}/${s}`)}getConfig(t,e){return new Promise(((s,i)=>{this.loadResource(`cfg://filter/FilterBarState:${t}/${e}`).then((t=>{let e;t&&(e=JSON.parse(t).items),s(e||[])})).catch((t=>{i(t)}))}))}}class G extends g{getDefaultValues(t){return new Promise(((e,s)=>{this.loadResource(`cfg://defaultValues/${t}`).then((t=>{let s;t&&(s=JSON.parse(t)),e(s)})).catch((t=>{s(t)}))}))}}const J=class{constructor(s){t(this,s),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new H}get parameters(){return this._parameters||(this._parameters=new O),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||U.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,e)=>{const s=this._authPromises.length>0;this._authPromises.push(new V(t,e)),s||this.authFetcher.getData(this.resourceID).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)}))}))}async isUserSup(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{t(e.isSup)})).catch((t=>e(t)))}))}))}async hasAccess(t){return new Promise(((e,s)=>{this.auth.then((i=>{this.getAuthList(i).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>s(t)))}))}))}async getAllAccess(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{const s={};s.isSup=e.isSup,Object.entries(x).forEach((t=>{s[t[0]]=e.actions[t[1]]||!1})),t(s)})).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,e="full",s=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=e,this._popUp.useHeader=s,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const e=t.split(",");return new Promise(((t,s)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{s(t)}))})).catch((t=>{s(t)}))}))}async getConfig(t){let e={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,s)=>{y.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(e)).then((e=>{var s;return t(null===(s=e.config)||void 0===s?void 0:s.data)})).catch((t=>s(t)))}))}async saveConfig(t,e){let s={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:e}}};return new Promise(((t,e)=>{y.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(s)).then((e=>t(e))).catch((t=>e(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){U.openAppActivity(t,e)}getDuPromissesStack(t){let e;return t&&(e=this._duPromises.get(t),e||(e=[],this._duPromises.set(t,e))),e||[]}async createDataunit(t,e){return new Promise(((s,i)=>{const r=this.getDuPromissesStack(e),n=r.length>0;if(r.push(new V(s,i)),!n){const s=this.dataUnitFetcher.getDataUnit(t,this.resourceID);s.loadMetadata().then((()=>{for(e&&this._duCache.set(e,s);r.length>0;)r.pop().resolve(s)})).catch((t=>{for(;r.length>0;)r.pop().reject(t)}))}}))}async getDataUnit(t,e){return new Promise(((s,i)=>{const r=this._duCache.get(e);r?s(r):this.createDataunit(t,e).then((t=>{s(t)})).catch((t=>i(t)))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,e,s,i){return _.alert(t,e,s,i)}async error(t,e,s,i){return _.error(t,e,s,i)}async success(t,e,s,i){return _.success(t,e,s,i)}async message(t,e,s,i){return _.message(t,e,s,i)}async confirm(t,e,s,i,r){return _.confirm(t,e,s,i,r)}async info(t,e){return _.info(t,e)}async loadFormConfig(t){return this.formConfigFetcher.loadFormConfig(t,this.resourceID)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async fetchUserAvailableConfigs(t){return this.formConfigFetcher.fetchUserAvailableConfigs(t,this.resourceID)}async fetchLegacyConfig(t){return this.formConfigFetcher.fetchLegacyConfig(t,this.resourceID)}async fetchDefaultConfig(t){return this.formConfigFetcher.fetchDefaultConfig(t,this.resourceID)}async loadTotals(t,e,s){return this.totalsFetcher.fetchTotals(t,e,s)}async saveGridConfig(t){return this.gridConfigFetcher.saveConfig(t,this.resourceID)}async getFilterBarConfig(t){return new Promise(((e,s)=>{this.configName===t&&this._filterBarConfig?e(this._filterBarConfig):this.configName===t&&null!=this._filterConfigPromise?Promise.all([this._filterConfigPromise]).then((t=>e(t[0]))).catch((t=>s(t[0]))):this.filterBarConfigFetcher.getConfig(this.resourceID,t).then((t=>e(t))).catch((t=>s(t)))}))}async saveFilterBarConfig(t,e){return this.filterBarConfigFetcher.saveConfig(t,this.resourceID,e)}async saveFormConfig(t,e){return this.formConfigFetcher.saveConfig(t,e,this.resourceID)}async getDefaultValues(){return this.defaultValuesFetcher.getDefaultValues(this.resourceID)}async getDefaultValue(t){return this._defaultValues&&this._defaultValues[t]}async getAuthList(t){return await(new j).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=v.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new b),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new w),this._formConfigFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new I),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new E),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new S),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new M),this._authFetcher}get filterBarConfigFetcher(){return this._filterBarConfigFetcher||(this._filterBarConfigFetcher=new z),this._filterBarConfigFetcher}get defaultValuesFetcher(){return this._defaultValuesFetcher||(this._defaultValuesFetcher=new G),this._defaultValuesFetcher}async executeSearch(t,e,s){const i=null==s?void 0:s.getField(e);if(i){const{mode:e,argument:r}=t,{ENTITYNAME:n,CODEFIELD:a,DESCRIPTIONFIELD:c,ROOTENTITY:h,DESCRIPTIONENTITY:u}=i.properties,l=i.dependencies;let p;const m={rootEntity:h,descriptionFieldName:c,codeFieldName:a,showInactives:!1};return null==l||l.filter((t=>{var e;return null===(e=t.masterFields)||void 0===e?void 0:e.every((t=>{var e;return null===(e=s.getField(t))||void 0===e?void 0:e.visible}))})).forEach((t=>{var e;t.type===d.SEARCHING&&(null===(e=t.masterFields)||void 0===e?void 0:e.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const e=s.getField(t),i=(null==e?void 0:e.dataType)||o.TEXT,r=s.getFieldValue(t);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${e.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${e.label} para executar a pesquisa.`);return{name:t,value:r,dataType:i}}))})})),this.executePreparedSearch(e,r,{entity:n,entityDescription:u,criteria:p,searchOptions:m})}}async executePreparedSearch(t,e,s){const{entity:i,entityDescription:r,criteria:n,searchOptions:a}=s;return"ADVANCED"===t?new Promise((t=>{const s=document.createElement("snk-pesquisa");s["data-element-id"]=`entity_${i}`,s.argument=e,s.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,n,a),s.selectItem=e=>{t(e),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(s)})):this.pesquisaFetcher.loadSearchOptions(i,e,n,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}clearContent(t){t&&Array.from(t.children).forEach((e=>{t.removeChild(e)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new D(this),this.messagesBuilder=new $,p.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${v.getUrlBase()}/mge/upload/file`),p.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,e,s)=>this.executeSearch(t,e,s))),p.setContextValue("__EZUI__GRID_LICENSE__",N),this.configName&&(this._filterConfigPromise=new Promise(((t,e)=>{this.filterBarConfigFetcher.getConfig(this.resourceID,this.configName).then((e=>{this._filterBarConfig=e,t(e)})).catch((t=>e(t)))}))),m.init(),P.get(),this.getDefaultValues().then((t=>{this._defaultValues=t}))}connectedCallback(){p.setContextValue("__SNK__APPLICATION__",this),y.addRequestListener(this._requestListener)}disconnectedCallback(){y.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)}))}render(){return s("div",null,s("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),s("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),s("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}};class H{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var e;if(1==(null===(e=null==t?void 0:t.requestBody)||void 0===e?void 0:e.length)){const{name:e}=t.requestBody[0].variables;if(e){const t=e.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class V{constructor(t,e){this.resolve=t,this.reject=e}}J.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{J as snk_application}
|
|
76
|
+
}`)}async getParam(t){const e=`param://application?params=${t}`;return v.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchParam")})}async asString(t){const e=await this.getParam(t);return this.getValue(e)}async asInteger(t){const e=await this.getParam(t);return parseInt(this.getValue(e))}async asFloat(t){const e=await this.getParam(t);return parseFloat(this.getValue(e))}async asBoolean(t){const e=await this.getParam(t);return this.getValue(e).includes('"S"')}async asDate(t){const e=await this.getParam(t);return d.strToDate(this.getValue(e))}async getBatchParams(t){const e=await this.getParam(t.join(",")),s={};return e.forEach((t=>s[t.name]=t.resource)),s}getValue(t={}){return Array.isArray(t)&&t.length>0&&(t=t[0]),u.isEmpty(t.resource)?"":t.resource}}const L=j;function j(t,e){const s=k();return(j=function(t){return s[t-=378]})(t,e)}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=j,e=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;e.push(e.shift())}catch(t){e.push(e.shift())}}();class M{[L(397)](t){const e=L;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const s=new x("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>s.putAccess(t[e(382)],String(t.status)==e(398)))),s}}class x{constructor(t){const e=L;this.isSup=t,this[e(384)]={}}[L(378)](t,e){this[L(384)][t]=e}[L(393)](t){const e=L;if(this[e(402)])return!0;let s=!0;return this[e(384)][e(380)](t)&&(s=this.actions[t]),s}isUserSup(){return this.isSup}}class B extends w{getData(t){const e=`cfg://auth/${t}`;return new Promise(((t,s)=>{this.loadResource(e).then((e=>{let s=o.stringToObject(e);s&&"object"==typeof s&&t(s)})).catch((t=>{s(t)}))}))}}var z;function G(t){if(null==t)return t;if(t instanceof Date)return t.toISOString();if("object"==typeof t){if(t instanceof Array)return t.map((t=>G(t)));{const e=Object.assign({},t);return Object.keys(t).forEach((s=>{t[s]?e[s]=G(t[s]):delete e[s]})),e}}return t}!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"}(z||(z={}));class J extends w{saveConfig(t,e,s){const i=t.map((t=>{const{id:e,value:s,fixed:i,visible:r}=t,n={id:e};return s&&(n.value=G(s)),i&&(n.fixed=i),r&&(n.visible=!0),n}));return this.saveResource(i,`cfg://filter/FilterBarState:${e}/${s}`)}getConfig(t,e){return new Promise(((s,i)=>{this.loadResource(`cfg://filter/FilterBarState:${t}/${e}`).then((t=>{let e;t&&(e=JSON.parse(t).items),s(e||[])})).catch((t=>{i(t)}))}))}}class H extends w{getDefaultValues(t){return new Promise(((e,s)=>{this.loadResource(`cfg://defaultValues/${t}`).then((t=>{let s;t&&(s=JSON.parse(t)),e(s)})).catch((t=>{s(t)}))}))}}const V=class{constructor(s){t(this,s),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new W}get parameters(){return this._parameters||(this._parameters=new R),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||F.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,e)=>{const s=this._authPromises.length>0;this._authPromises.push(new Z(t,e)),s||this.authFetcher.getData(this.resourceID).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)}))}))}async isUserSup(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{t(e.isSup)})).catch((t=>e(t)))}))}))}async hasAccess(t){return new Promise(((e,s)=>{this.auth.then((i=>{this.getAuthList(i).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>s(t)))}))}))}async getAllAccess(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{const s={};s.isSup=e.isSup,Object.entries(z).forEach((t=>{s[t[0]]=e.actions[t[1]]||!1})),t(s)})).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,e="full",s=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=e,this._popUp.useHeader=s,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const e=t.split(",");return new Promise(((t,s)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{s(t)}))})).catch((t=>{s(t)}))}))}async getConfig(t){let e={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,s)=>{v.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(e)).then((e=>{var s;return t(null===(s=e.config)||void 0===s?void 0:s.data)})).catch((t=>s(t)))}))}async saveConfig(t,e){let s={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:e}}};return new Promise(((t,e)=>{v.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(s)).then((e=>t(e))).catch((t=>e(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){F.openAppActivity(t,e)}getDuPromissesStack(t){let e;return t&&(e=this._duPromises.get(t),e||(e=[],this._duPromises.set(t,e))),e||[]}async createDataunit(t,e){return new Promise(((s,i)=>{const r=this.getDuPromissesStack(e),n=r.length>0;if(r.push(new Z(s,i)),!n){const s=this.dataUnitFetcher.getDataUnit(t,this.resourceID);s.loadMetadata().then((()=>{for(e&&this._duCache.set(e,s);r.length>0;)r.pop().resolve(s)})).catch((t=>{for(;r.length>0;)r.pop().reject(t)}))}}))}async getDataUnit(t,e){return new Promise(((s,i)=>{const r=this._duCache.get(e);r?s(r):this.createDataunit(t,e).then((t=>{s(t)})).catch((t=>i(t)))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,e,s,i){return D.alert(t,e,s,i)}async error(t,e,s,i){return D.error(t,e,s,i)}async success(t,e,s,i){return D.success(t,e,s,i)}async message(t,e,s,i){return D.message(t,e,s,i)}async confirm(t,e,s,i,r){return D.confirm(t,e,s,i,r)}async info(t,e){return D.info(t,e)}async loadFormConfig(t){return this.formConfigFetcher.loadFormConfig(t,this.resourceID)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async fetchUserAvailableConfigs(t){return this.formConfigFetcher.fetchUserAvailableConfigs(t,this.resourceID)}async fetchLegacyConfig(t){return this.formConfigFetcher.fetchLegacyConfig(t,this.resourceID)}async fetchDefaultConfig(t){return this.formConfigFetcher.fetchDefaultConfig(t,this.resourceID)}async loadTotals(t,e,s){return this.totalsFetcher.fetchTotals(t,e,s)}async saveGridConfig(t){return this.gridConfigFetcher.saveConfig(t,this.resourceID)}async getFilterBarConfig(t){return new Promise(((e,s)=>{this.configName===t&&this._filterBarConfig?e(this._filterBarConfig):this.configName===t&&null!=this._filterConfigPromise?Promise.all([this._filterConfigPromise]).then((t=>e(t[0]))).catch((t=>s(t[0]))):this.filterBarConfigFetcher.getConfig(this.resourceID,t).then((t=>e(t))).catch((t=>s(t)))}))}async saveFilterBarConfig(t,e){return this.filterBarConfigFetcher.saveConfig(t,this.resourceID,e)}async saveFormConfig(t,e){return this.formConfigFetcher.saveConfig(t,e,this.resourceID)}async getDefaultValues(){return this.defaultValuesFetcher.getDefaultValues(this.resourceID)}async getDefaultValue(t){return this._defaultValues&&this._defaultValues[t]}async getAuthList(t){return await(new M).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=I.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new U),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new _),this._formConfigFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new P),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new q),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new A),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new B),this._authFetcher}get filterBarConfigFetcher(){return this._filterBarConfigFetcher||(this._filterBarConfigFetcher=new J),this._filterBarConfigFetcher}get defaultValuesFetcher(){return this._defaultValuesFetcher||(this._defaultValuesFetcher=new H),this._defaultValuesFetcher}async executeSearch(t,e,s){const i=null==s?void 0:s.getField(e);if(i){const{mode:e,argument:r}=t,{ENTITYNAME:n,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:h,DESCRIPTIONENTITY:u}=i.properties,l=i.dependencies;let d;const m={rootEntity:h,descriptionFieldName:o,codeFieldName:a,showInactives:!1};return null==l||l.filter((t=>{var e;return null===(e=t.masterFields)||void 0===e?void 0:e.every((t=>{var e;return null===(e=s.getField(t))||void 0===e?void 0:e.visible}))})).forEach((t=>{var e;t.type===p.SEARCHING&&(null===(e=t.masterFields)||void 0===e?void 0:e.length)>0&&(d={expression:t.expression,params:t.masterFields.map((t=>{const e=s.getField(t),i=(null==e?void 0:e.dataType)||c.TEXT,r=s.getFieldValue(t);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${e.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${e.label} para executar a pesquisa.`);return{name:t,value:r,dataType:i}}))})})),this.executePreparedSearch(e,r,{entity:n,entityDescription:u,criteria:d,searchOptions:m})}}async executePreparedSearch(t,e,s){const{entity:i,entityDescription:r,criteria:n,searchOptions:a}=s;return"ADVANCED"===t?new Promise((t=>{const s=document.createElement("snk-pesquisa");s[m.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${i}`,s.argument=e,s.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,n,a),s.selectItem=e=>{t(e),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(s)})):this.pesquisaFetcher.loadSearchOptions(i,e,n,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}clearContent(t){t&&Array.from(t.children).forEach((e=>{t.removeChild(e)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new C(this),this.messagesBuilder=new S,f.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${I.getUrlBase()}/mge/upload/file`),f.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,e,s)=>this.executeSearch(t,e,s))),f.setContextValue("__EZUI__GRID_LICENSE__",b),this.configName&&(this._filterConfigPromise=new Promise(((t,e)=>{this.filterBarConfigFetcher.getConfig(this.resourceID,this.configName).then((e=>{this._filterBarConfig=e,t(e)})).catch((t=>e(t)))}))),y.init(),$.get(),this.getDefaultValues().then((t=>{this._defaultValues=t}))}connectedCallback(){f.setContextValue("__SNK__APPLICATION__",this),v.addRequestListener(this._requestListener)}disconnectedCallback(){v.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)})),m.addIDInfo(this._element,`resource_${this._resourceID}`)}render(){return s("div",null,s("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),s("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),s("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}get _element(){return i(this)}};class W{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var e;if(1==(null===(e=null==t?void 0:t.requestBody)||void 0===e?void 0:e.length)){const{name:e}=t.requestBody[0].variables;if(e){const t=e.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class Z{constructor(t,e){this.resolve=t,this.reject=e}}V.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{V as snk_application}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,h as i,H as s,g as r}from"./p-9ba3df4c.js";import{ApplicationUtils as l}from"@sankhyalabs/ezui/dist/collection/utils";import{F as n}from"./p-9dd2b8cb.js";import{ElementIDUtils as a,DataType as o}from"@sankhyalabs/core";const h=class{constructor(i){t(this,i),this.filterChange=e(this,"filterChange",7)}async show(){this._editor.show()}componentDidLoad(){if(this._element){a.addIDInfo(this._element);const t=this._element.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.config.id}`}}changeConfig(t){this.filterChange.emit(t)}getContentEditor(){switch(this.config.type){case n.BINARY_SELECT:return"snk-filter-binary-select";case n.MULTI_SELECT:return"snk-filter-multi-select";case n.PERIOD:return"snk-filter-period";case n.SEARCH:return"snk-filter-search";case n.NUMBER:return"snk-filter-number";case n.PERSONALIZED:return"snk-filter-personalized"}return"snk-filter-text"}removeItem(){this.changeConfig(Object.assign(Object.assign({},this.config),{visible:!1,fixed:!1,value:void 0}))}getPopUpHeaderButtons(){if(!this.config.hardFixed)return[this.buildIcon(this.getMessage("snkFilterBar.removeFilter"),"delete",(()=>this.removeItem())),this.buildIcon(this.getMessage(this.config.fixed?"snkFilterBar.unpinFilter":"snkFilterBar.pinFilter"),this.config.fixed?"un-pin":"push-pin",(()=>this.changeConfig(Object.assign(Object.assign({},this.config),{fixed:!this.config.fixed}))))]}buildIcon(t,e,s){return i("button",{onClick:()=>s(),class:"sc-snk-filter-bar snk-filter-item__editor-header-button"},i("ez-icon",{title:t,iconName:e}))}getNormalizedValue(t,e){return t.reduce(((t,e,i)=>(e.dataType!==o.BOOLEAN||null!=t&&null!=t[i]||((t=t||[])[i]=!1),t)),e)}apply(){var t;let e=this._editor.value,i=!0;if(this.config.type===n.PERSONALIZED){const s=(null===(t=this.config.props.personalizedFilter)||void 0===t?void 0:t.parameters)||[];e=this.getNormalizedValue(s,e);const r=s.length;0===r?e=[]:i=this.validateAllFilled(r,e)}i&&this.changeConfig(Object.assign(Object.assign({},this.config),{value:e}))}validateAllFilled(t,e){let i=!0;return null!=e&&t>1&&(t>e.length?i=!1:e.forEach((t=>{null==t&&(i=!1)}))),i||l.alert("Filtro parcialmente preenchido","Favor completar todas as informações do filtro."),i}clear(){this.changeConfig(Object.assign(Object.assign({},this.config),{value:void 0}))}onKeyDonwListener(t){"Enter"===t.key&&this._applyButton.setFocus().then((()=>this.apply()))}render(){const t=this.getContentEditor();return i(s,null,i("div",{class:"col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center"},i("div",{class:"ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header"},this.config.detailTitle),this.getPopUpHeaderButtons()),i(t,{ref:t=>this._editor=t,value:this.config.value,config:this.config,onKeyDown:t=>this.onKeyDonwListener(t),"data-element-id":this._idContentEditor}),i("hr",{class:"sc-snk-filter-bar snk-filter__popover-rule"}),i("div",{class:"ez-col ez-col--sd-12 ez-align--right"},i("ez-button",{label:this.getMessage("snkFilterBar.cleanFilter"),onClick:()=>this.clear(),size:"small"}),i("ez-button",{ref:t=>this._applyButton=t,label:this.getMessage("snkFilterBar.applyFilter"),onClick:()=>this.apply(),size:"small",class:"ez-button--primary ez-padding-left--medium"})))}get _element(){return r(this)}};export{h as snk_filter_detail}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,H as e,g as s,c as r}from"./p-9ba3df4c.js";import{DataType as n,ObjectUtils as l,ElementIDUtils as a,StringUtils as o,ErrorException as h,ApplicationContext as c,FloatingManager as d,ArrayUtils as f}from"@sankhyalabs/core";import{F as u}from"./p-9dd2b8cb.js";import{ModalAction as m,ModalButtonStatus as g}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{toString as b}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{CheckMode as k,ApplicationUtils as p,DialogType as _}from"@sankhyalabs/ezui/dist/collection/utils";import{C as v}from"./p-6ba8f415.js";import{O as x}from"./p-6673c77c.js";import{A as z}from"./p-dc36cfbf.js";import{T as y,V as C,A as F,b as w,a as T}from"./p-4cbc4ae3.js";import"./p-112455b1.js";const L=class{constructor(i){t(this,i),this._updateSequence=[],this._loadingPending=!1,this._configUpdated=!1,this._pendingFilters=[],this._calculateSortIndex=t=>{let i=t.hardFixed?1e6:0;return t.hardFixed||(i+=t.fixed?1e5:0,i+=null==t.value?0:1e4,i+=this._updateSequence.lastIndexOf(t.id)+1),i},this._filtersComparator=(t,i)=>this._calculateSortIndex(i)-this._calculateSortIndex(t),this.scrollerLocked=!1}observeFilterConfig(t,i){if(null!=i&&null==t)this._loadingPending=!0,this._configUpdated=!0;else{const e=new Map(i?i.map((t=>[t.id,t])):void 0);t.forEach((t=>{const i=e.get(t.id);null!=i?(this._configUpdated=this._configUpdated||l.objectToString(i)!=l.objectToString(t),this._loadingPending=this._loadingPending||l.objectToString(i.value)!==l.objectToString(t.value)):(this._configUpdated=!0,this._loadingPending=this._loadingPending||null!=t.value)}))}this.processAfterUpdateConfig()}componentDidLoad(){if(this._element){a.addIDInfo(this._element,null,{dataUnit:this.dataUnit});const t=this._element.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idSnkFilterItem=t,this._idSnkFilterList=t}}processPendingFilter(){this._pendingFilters.length>0&&null==this._currentPendingFilter&&(this._currentPendingFilter=this._element.querySelector("#filter-"+this._pendingFilters.pop()),this._currentPendingFilter&&this._currentPendingFilter.showUp(!0).then((()=>{this._currentPendingFilter=void 0,this.processPendingFilter()}))),null==this._currentPendingFilter&&this.processAfterUpdateConfig()}processAfterUpdateConfig(){this._pendingFilters.length>0||(this._loadingPending&&(this._loadingPending=!1,this.dataUnit.loadData()),this._configUpdated&&(this._configUpdated=!1,this._application.saveFilterBarConfig(this.filterConfig,this.configName)))}getMessage(t,i){return this._application.messagesBuilder.getMessage(t,i)}getFilter(t){var i;const e=[];return null===(i=this.filterConfig)||void 0===i||i.filter((t=>this.isActiveFilter(t))).forEach((t=>{const i=(t=>{switch(t.type){case u.DEFAULT_FILTER:return function(t){return{name:t.id,expression:t.props.expression,params:[]}}(t);case u.BINARY_SELECT:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.options.find((t=>t.name===e)).expression,params:[]}}(t);case u.MULTI_SELECT:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:n.TEXT,value:e}]}}(t);case u.PERIOD:return function(t){const{id:i,value:e,props:s}=t;let{end:r,start:l}=e;"string"==typeof r&&(r=new Date(r)),"string"==typeof l&&(l=new Date(l));const a=[];let o;return r&&l?(o=s.expression.fullfill,a.push({name:`${i}.START`,dataType:n.DATE,value:b(n.DATE,l)},{name:`${i}.END`,dataType:n.DATE,value:b(n.DATE,r)})):l?(o=s.expression.onlystart,a.push({name:i,dataType:n.DATE,value:b(n.DATE,l)})):(o=s.expression.onlyend,a.push({name:i,dataType:n.DATE,value:b(n.DATE,r)})),{name:i,expression:o,params:a}}(t);case u.SEARCH:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:n.TEXT,value:b(n.TEXT,e.value)}]}}(t);case u.TEXT:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:n.TEXT,value:b(n.TEXT,e)}]}}(t);case u.NUMBER:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:n.NUMBER,value:b(n.NUMBER,e)}]}}(t);case u.PERSONALIZED:return function(t){var i;const{id:e,value:s,props:r}=t;return{name:e,expression:r.expression,params:((null===(i=r.personalizedFilter)||void 0===i?void 0:i.parameters)||[]).map(((t,i)=>{const e=Array.from(s),r=t.dataType;let l=i>=0&&i<e.length?e[i]:null;return null!=l&&"object"==typeof l&&"value"in l&&(l=l.value),null==l&&r===n.BOOLEAN&&(l=!1),{name:t.name,dataType:r,value:"string"==typeof l?l:b(r,l)}}))}}(t);default:return}})(t);i&&e.push(i)})),e}isActiveFilter(t){return t.visible&&null!=t.value||t.type===u.DEFAULT_FILTER}registryFilterProvider(){this.dataUnit.addFilterProvider(this),this.filterConfig&&this.dataUnit.loadData()}itemFocused(t){this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach((i=>{i.id===t?"snk-filter-item"===i.tagName.toLowerCase()&&i.getClientRects()[0].x<0&&i.scrollIntoView({behavior:"auto",inline:"nearest"}):i.hideDetail()}))}getFilterItems(){const t=[],e=[];this.filterConfig.filter((t=>t.visible)).forEach(((s,r)=>{const n=`filter-${s.id}`,l=i("snk-filter-item",{onVisibleChanged:t=>this.scrollerLocked=t.detail,onFocusin:()=>this.itemFocused(n),id:n,config:s,class:r>0?"ez-padding-left--medium":"",getMessage:(t,i)=>this.getMessage(t,i),key:s.id});return s.fixed||s.hardFixed?t.push(l):e.push(l),l}));const s=[];return s.push(...t),t.length>0&&e.length>0&&s.push(i("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider"})),s.push(...e),s}calculateUpdateSequence(t){t&&(this._updateSequence=this._updateSequence.filter((i=>t.id!==i)),this._updateSequence.push(t.id))}normalizeItem(t){const i=Object.assign({},t);return["props","value","hardFixed","fixed"].forEach((t=>{null==i[t]&&delete i[t]})),""===t.value&&delete t.value,i}updateFilter(t){this.filterConfig=this.filterConfig.map((i=>(t=this.normalizeItem(t),i.id===t.id?(l.objectToString(i)!=l.objectToString(t)&&this.calculateUpdateSequence(t),t):i))).sort(((t,i)=>this._filtersComparator(t,i)))}getAddListItems(){const t=this.filterConfig.filter((t=>!t.visible&&this.isListable(t))),i=[{name:"PERSONALIZED_FILTER",label:this.getMessage("snkFilterBar.customFilter"),iconName:"tune",kind:"FOOTER"}];return this.allowDefault&&i.push({name:"DEFAULT_FILTER",label:this.getMessage("snkFilterBar.defaultFilter"),iconName:"configuration",kind:"FOOTER"}),t.map((t=>({name:t.id,label:t.label,kind:"FILTER",iconName:null}))).concat(i)}getActiveClass(){return this.filterConfig.filter((t=>null!=t.value)).length>0?"sc-snk-filter-bar snk-filter-bar__filter-list-items-button--active":""}isListable(t,i=!1){return t.type!==u.DEFAULT_FILTER&&(i||t.type!==u.PERSONALIZED)}getAppliedListItems(){return this.filterConfig.filter((t=>this.isActiveFilter(t)&&this.isListable(t,!0))).map((t=>({name:t.id,label:t.label,kind:"FILTER",iconName:null}))).concat([{name:"CLEAR_ALL_FILTERS",label:this.getMessage("snkFilterBar.clearAllFilters"),iconName:"cleaning",kind:"FOOTER"}])}addPersonalizedFilters(t){const i={};t.forEach((t=>{t.active&&(i[t.id]=!0)})),this.filterConfig=this.filterConfig.map((t=>{var e,s;if(t.type===u.PERSONALIZED){const r=i[t.id];return!t.visible&&r&&(this.calculateUpdateSequence(t),null!=(null===(s=null===(e=t.props)||void 0===e?void 0:e.personalizedFilter)||void 0===s?void 0:s.parameters)&&this._pendingFilters.push(t.id)),this.normalizeItem(Object.assign(Object.assign({},t),r?{visible:r}:{visible:r,value:void 0,fixed:void 0}))}return t})).sort(((t,i)=>this._filtersComparator(t,i)))}openDefaultFilterModal(){const t=document.createElement("snk-filter-modal"),i=this.filterConfig.filter((t=>t.type===u.DEFAULT_FILTER));t.getMessage=(t,i)=>this.getMessage(t,i),t.modalTitle=this.getMessage("snkFilterBar.modalDefaultFilterTitle"),t.infoText=this.getMessage(0==i.length?"snkFilterBar.modalInfoTextCreateDefault":"snkFilterBar.modalInfoTextEditDefault"),t.items=i.map((t=>({id:t.id,active:!0,enabled:!1,label:t.label}))),t.processModalAction=()=>{this._application.closeModal()},this._application.showModal(t)}openPersonalizedModal(){const t=document.createElement("snk-filter-modal"),i=this.filterConfig.filter((t=>t.type===u.PERSONALIZED)).sort(((t,i)=>o.compare(t.label,i.label)));t.getMessage=(t,i)=>this.getMessage(t,i),t.modalTitle=this.getMessage("snkFilterBar.modalPersonalizedFilterTitle"),t.modalSubTitle=this.getMessage("snkFilterBar.modalPersonalizedFilterSubTitle"),t.okButtonLabel=this.getMessage("snkFilterBar.modalOkButtonLabel"),t.cancelButtonLabel=this.getMessage("snkFilterBar.modalCancelButtonLabel"),t.infoText=this.getMessage("snkFilterBar.modalInfoTextCreateEditPersonalized"),t.useSearch=!0,t.items=i.map((t=>({id:t.id,active:t.visible,enabled:!0,label:t.label}))),t.processModalAction=i=>{i===m.CANCEL?t.items=t.items.map((t=>Object.assign(Object.assign({},t),{active:!1}))):(i===m.OK&&this.addPersonalizedFilters(t.items),this._application.closeModal())},this._application.showModal(t)}clearFilters(){let t=!1;return this.filterConfig=this.filterConfig.map((i=>(null!=i.value&&(t=!0),Object.assign(Object.assign({},i),{value:void 0})))).sort(((t,i)=>this._filtersComparator(t,i))),t}loadPermitions(){this._application.isUserSup().then((t=>this.allowDefault=t))}loadConfigFromApplication(){this._application.getFilterBarConfig(this.configName).then((t=>{this.filterConfig=t.map((t=>this.normalizeItem(t))),this.dataUnit&&this.dataUnit.loadData()})).catch((t=>{throw new h(this.getMessage("snkFilterBar.failToLoadConfig"),t)}))}attachDataUnit(){if(null==this.dataUnit){let t=this._element.parentElement;for(;t;)if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){const i=t;this.dataUnit=i.dataUnit,this.dataUnit?this.registryFilterProvider():i.addEventListener("dataUnitReady",(t=>{this.dataUnit=t.detail,this.registryFilterProvider()}));break}t=t.parentElement}else this.registryFilterProvider()}filterChangeListener(t){this.updateFilter(t.detail)}addFilterHandler(t){const i=this.filterConfig.find((i=>i.id===t));"PERSONALIZED_FILTER"===t?this.openPersonalizedModal():"DEFAULT_FILTER"===t?this.openDefaultFilterModal():i&&(this._pendingFilters.push(t),this.updateFilter(Object.assign(Object.assign({},i),{visible:!0})))}appliedFilterHandler(t){if("CLEAR_ALL_FILTERS"===t)this.clearFilters()&&this._application.info(this.getMessage("snkFilterBar.successfullyCleaned"),{iconName:"check"});else{const i=this._element.querySelector("#filter-"+t);i&&i.showUp(!0)}}componentWillLoad(){this._application=c.getContextValue("__SNK__APPLICATION__"),this._application&&(this.loadPermitions(),this.loadConfigFromApplication()),this.attachDataUnit()}componentDidRender(){this.processPendingFilter()}render(){if(this.dataUnit&&this.filterConfig&&0!==this.filterConfig.length)return i(e,null,i("ez-scroller",{direction:"horizontal",activeShadow:!0,locked:this.scrollerLocked},this.getFilterItems()),i("snk-filter-list",{id:"APPLIED_FILTERS",onFocusin:()=>this.itemFocused("APPLIED_FILTERS"),items:this.getAppliedListItems(),getMessage:(t,i)=>this.getMessage(t,i),emptyText:this.getMessage("snkFilterBar.emptyAppliedFiltersList"),findFilterText:this.getMessage("snkFilterBar.findFilter"),iconName:"filter",class:"ez-padding-left--medium",buttonClass:this.getActiveClass(),onSnkItemSelected:t=>this.appliedFilterHandler(t.detail),"data-element-id":this._idSnkFilterList}),i("snk-filter-list",{id:"ADD_FILTER",onFocusin:()=>this.itemFocused("ADD_FILTER"),items:this.getAddListItems(),label:this.getMessage("snkFilterBar.addFilter"),getMessage:(t,i)=>this.getMessage(t,i),emptyText:this.getMessage("snkFilterBar.emptyFiltersList"),findFilterText:this.getMessage("snkFilterBar.findField"),class:"ez-padding-left--medium",onSnkItemSelected:t=>this.addFilterHandler(t.detail),"data-element-id":this._idSnkFilterList},i("ez-icon",{slot:"leftIcon",class:"ez-padding-right--small",iconName:"plus"})))}get _element(){return s(this)}static get watchers(){return{filterConfig:["observeFilterConfig"]}}};L.style='.sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 2);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:"";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}';const I=class{constructor(i){t(this,i),this.visibleChanged=r(this,"visibleChanged",7),this.filterChange=r(this,"filterChange",7),this.innerClickCheck=(t,i)=>i.id!=d.MODAL_ELEMENT_ID||(this.detailIsVisible=!1,!1)}observeDetailIsVisible(t){this.visibleChanged.emit(t)}async showUp(t=!1){return new Promise((i=>{this._filterItemElement.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"}),t&&(this._closeCallback=i,window.requestAnimationFrame((()=>{this._floatingID=d.float(this._popover,this._popoverContainer,{autoClose:!0,innerClickTest:this.innerClickCheck,backClickListener:()=>this.onDetailCloseCallback(),left:this.getScrollOffset(),useOverlay:!0}),this._popover.show(),this.detailIsVisible=!0})))}))}getScrollOffset(){const t=getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");return`calc(${this._filterItemElement.getBoundingClientRect().left}px + ${t})`}async hideDetail(){this.detailIsVisible&&null!=this._floatingID&&d.close(this._floatingID)}onDetailCloseCallback(){this._floatingID=void 0,this.detailIsVisible=!1,this._closeCallback&&(this._closeCallback(),this._closeCallback=void 0)}clickListener(t){[this._chipElement,this._leftIconElement,this._rightIconElement].includes(t.target)&&(t.target===this._rightIconElement&&null!=this.config.value?this.filterChange.emit(Object.assign(Object.assign({},this.config),{value:void 0})):this.detailIsVisible?this.hideDetail():this.showUp(!0),t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation())}mouseDownListener(t){this.detailIsVisible&&[this._chipElement,this._leftIconElement,this._rightIconElement].includes(t.target)&&(t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation())}getLabel(){const{type:t,value:i,label:e,props:s}=this.config;if(i){if(t===u.BINARY_SELECT){const[t,e]=s.options;if(t.name===i)return t.label;if(e.name===i)return e.label}if(t===u.MULTI_SELECT)return`${e}: ${s.options.find((t=>t.value===i)).label}`;if(t===u.PERIOD){let{end:t,start:s}=i;"string"==typeof t&&(t=new Date(t),t.setMinutes(t.getMinutes()+t.getTimezoneOffset())),"string"==typeof s&&(s=new Date(s),s.setMinutes(s.getMinutes()+s.getTimezoneOffset()));const r=new Intl.DateTimeFormat("pt-BR");return t&&s?`${e}: ${r.format(s)} a ${r.format(t)}`:s?`${e}: A partir de ${r.format(s)}`:t?`${e}: Até ${r.format(t)}`:e}return t===u.SEARCH?`${e}: ${i.value} - ${i.label}`:t===u.PERSONALIZED?e:`${e}: ${i}`}return e}componentDidLoad(){if(this._filterItemElement){a.addIDInfo(this._filterItemElement);const t=this._filterItemElement.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idSnkFilterDetail=`${t}_${this.config.id}`,this._idEzChip=`${t}_${this.config.id}`}}componentDidRender(){null==this._floatingID&&this._popover&&this._popover.remove()}filterChangeListener(){this.hideDetail()}getRightIconName(){return null!=this.config.value?"close":this.detailIsVisible?"chevron-up":"chevron-down"}getLeftIconName(){switch(this.config.type){case u.PERIOD:return"calendar";case u.PERSONALIZED:return"tune"}}render(){const t=this.getLeftIconName();return i(e,null,i("ez-chip",{ref:t=>this._chipElement=t,label:this.getLabel(),value:null!=this.config.value,"data-element-id":this._idEzChip},t?i("ez-icon",{ref:t=>this._leftIconElement=t,iconName:t,class:"ez-padding-right--small",slot:"leftIcon"}):void 0,i("ez-icon",{ref:t=>this._rightIconElement=t,iconName:this.getRightIconName(),class:"ez-padding-left--small",slot:"rightIcon"})),i("section",{class:"ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container",ref:t=>this._popoverContainer=t},i("snk-filter-detail",{config:this.config,getMessage:this.getMessage,class:"sc-snk-filter-bar snk-filter__popover ez-padding--small",ref:t=>this._popover=t,key:this.config.id,"data-element-id":this._idSnkFilterDetail})))}get _filterItemElement(){return s(this)}static get watchers(){return{detailIsVisible:["observeDetailIsVisible"]}}},E=class{constructor(i){t(this,i),this.snkItemSelected=r(this,"snkItemSelected",7),this._preselection=-1,this.innerClickCheck=(t,i)=>i.id!=d.MODAL_ELEMENT_ID||(this._detailIsVisible=!1,!1)}showDetail(){this._preselection=-1,this._floatingID=d.float(this._popover,this._popoverContainer,{autoClose:!0,innerClickTest:this.innerClickCheck,backClickListener:()=>this.onListCloseCallback(),useOverlay:!0}),this._detailIsVisible=!0,this._showAll=!1,this._filterArgument="",this._filterInput.setFocus()}async hideDetail(){null!=this._floatingID&&d.close(this._floatingID)}onListCloseCallback(){this._floatingID=void 0,this._detailIsVisible=!1}buttonClick(){this._detailIsVisible?this.hideDetail():this.showDetail()}componentDidLoad(){this._element&&a.addIDInfo(this._element)}componentDidRender(){null==this._floatingID&&this._popover&&this._popover.remove()}buildItemElement(t){const e=++this._selectableItemsCount;return this._buttonElement&&a.addIDInfo(this._buttonElement),i("button",{id:`filter-item${e}`,onFocusin:()=>this._preselection=e,class:"ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item",onClick:()=>this.itemSelected(t.name),ref:t=>this._buttonElement=t},t.iconName?i("ez-icon",{iconName:t.iconName,size:"small",class:`ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${t.iconClass||""}`}):void 0,i("div",{class:`ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${t.labelClass||""}`},t.label))}itemSelected(t){"__SHOWMORE__"===t?this._showAll=!0:(this.hideDetail(),this.snkItemSelected.emit(t))}getFilterItems(){const t=this.items?f.applyStringFilter(this._filterArgument,this.items.filter((t=>"FILTER"===t.kind))):[];return 0===t.length?i("div",{class:"ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty"},this.emptyText):(!this._filterArgument&&!this._showAll&&t.length>6&&(t.splice(5),t.push({kind:"INTERNAL",label:"Mostrar mais",iconName:"dots-horizontal",name:"__SHOWMORE__",iconClass:"snk-filter-bar__filter-list-item__icon--secondary",labelClass:"snk-filter-bar__filter-list-item__label--secondary"})),this._selectableItemsCount=0,i("div",{class:"sc-snk-filter-bar snk-filter-bar__filter-list-items-container"},t.map((t=>this.buildItemElement(t)))))}getFooterItems(){return this.items.filter((t=>"FOOTER"===t.kind))}keyDownHandler(t){switch(t.key){case"ArrowDown":this.changePreselection(this._preselection+1),t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.changePreselection(this._preselection-1),t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault()}}changePreselection(t){if(t<0&&(t=this._selectableItemsCount),this._preselection=t>this._selectableItemsCount?0:t,0===this._preselection)this._filterInput.setFocus();else{const t=this._element.querySelector(`#filter-item${this._preselection}`);t&&t.focus()}}render(){return i(e,{class:"ez-flex ez-flex--column"},i("ez-button",{class:this.buttonClass,label:this.label,onClick:()=>this.buttonClick(),mode:this.iconName?"icon":void 0,iconName:this.iconName,size:"small"},i("slot",{name:"leftIcon"})),i("section",{class:"ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container",ref:t=>this._popoverContainer=t},i("div",{class:"sc-snk-filter-bar snk-filter__popover ez-padding--small",ref:t=>this._popover=t},i("ez-filter-input",{ref:t=>this._filterInput=t,mode:"slim",label:this.findFilterText,value:this._filterArgument,onEzChange:t=>this._filterArgument=t.detail,onFocus:()=>this._preselection=0}),this.getFilterItems(),i("hr",{class:"sc-snk-filter-bar snk-filter__popover-rule"}),this.items?this.getFooterItems().map((t=>this.buildItemElement(t))):void 0)))}get _element(){return s(this)}},A=class{constructor(i){t(this,i)}updateValue(t,i){this.items=this.items.map((e=>e.id===t&&e.enabled?(null==i&&(i=!e.active),Object.assign(Object.assign({},e),{active:i})):e))}getActiveFiltersMsg(){const t=this.items.filter((t=>t.active)).length;return 0===t?this.getMessage("snkFilterBar.noActiveFilters"):this.getMessage(t>1?"snkFilterBar.activeFilters":"snkFilterBar.activeFilter",{ACTIVE_FILTERS:t})}buildItems(t){return t.map((t=>i("button",{onClick:()=>this.updateValue(t.id),class:"ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small"},i("ez-check",{id:`checkbox_${t.id}`,tabIndex:"-1",class:"sc-snk-filter-bar snk-filter-bar__filter-modal-item__check",onEzChange:i=>this.updateValue(t.id,i.detail),enabled:t.enabled,value:t.active,mode:k.SWITCH}),i("div",{class:"ez-text ez-title--primary ez-text--medium ez-margin-left--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item__label"},t.label))))}itemKeyBoardSelect(t,i){"Enter"!==t.key&&" "!==t.key||this.updateValue(i.id)}modalActionListener(t){const i=t.detail;i===m.LOAD?this._filterInput&&this._filterInput.setFocus():this.processModalAction(i)}render(){const t=this.items.filter((t=>t.active)).length>0,e=this.items?f.applyStringFilter(this._filterArgument,this.items):[];return i("ez-modal-container",{class:"snk-filter__modal-container",modalTitle:this.modalTitle,modalSubTitle:this.modalSubTitle,cancelButtonLabel:this.cancelButtonLabel,okButtonLabel:this.okButtonLabel,onEzModalAction:t=>this.modalActionListener(t),cancelButtonStatus:t?g.ENABLED:g.DISABLED},i("div",{class:"sc-snk-filter-bar snk-filter-bar__filter-modal-content"},i("div",null,this.useSearch?i("ez-filter-input",{ref:t=>this._filterInput=t,label:this.getMessage("snkFilterBar.modalFindFilter"),onEzChange:t=>this._filterArgument=t.detail}):void 0),e.length>0?i("div",{class:"ez-text ez-text--medium ez-text--primary ez-padding-bottom--small"},this.getActiveFiltersMsg()):void 0,i("div",null,this.buildItems(e)),i("div",{class:"ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large"},this.infoText)))}};A.style=".snk-filter__modal-container{width:359px;max-width:359px}";const D=class{constructor(i){t(this,i),this.configChange=r(this,"configChange",7),this.configCancel=r(this,"configCancel",7),this._orderListItems=[],this._orderPriorityList=[],this._columListItems=[],this._selectedIndex=-1,this._dataChanged=!1,this._componenteInternalKey=Date.now(),this.selectedIndex=0}async saveConfig(t){var i;null!=t&&null!=(null===(i=this._application)||void 0===i?void 0:i.configName)&&v.saveGridConfig(t,this._application.configName).then((i=>{null!=(null==i?void 0:i.resource)&&(this.configChange.emit(t),this._orderList.clearHistory())}))}getMessage(t,i){return this._application.messagesBuilder.getMessage(t,i)}createOrderList(){let t=[];this.columns.filter((t=>{var i;return o.getBooleanValue(null===(i=null==t?void 0:t.props)||void 0===i?void 0:i.get("sortable"),!0)})).forEach((i=>{var e;let s=null===(e=this.config)||void 0===e?void 0:e.columns.find((t=>t.name===i.name)),r={name:i.name,label:i.label};s&&(r.orderIndex=s.orderIndex,r.ascending=s.ascending),i.hidden||t.push(r)})),t.sort(((t,i)=>0!=t.orderIndex||0!=i.orderIndex||null==t.ascending&&null==i.ascending?null!=t.ascending&&null!=i.ascending?t.orderIndex-i.orderIndex:null!=t.ascending||null!=i.ascending?null!=t.ascending?-1:null!=i.ascending?1:0:t.orderIndex-i.orderIndex:null!=t.ascending?-1:null!=i.ascending?1:0)),this._orderListItems=t}createColumnList(){let t={group:this.getMessage("snkGridConfig.group.visible"),items:[]},i={group:this.getMessage("snkGridConfig.group.hidden"),items:[],sort:x.asc.value};this.columns.forEach((e=>{let s={label:e.label};e.hidden?i.items.push(s):t.items.push(s)})),this._columListItems=[t,i]}buildColumnListSlot(t,e){const s=`${this._element.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME)}_configItem_${o.toCamelCase(t.label)}`;return i("div",null,i("ez-check",{mode:"switch",id:"switch"+((null==t?void 0:t.label)||"")+((null==e?void 0:e.group)||""),value:e.group===this.getMessage("snkGridConfig.group.visible"),"data-element-id":s,onEzChange:i=>{this.switchColumnGroup(i,t)}}))}buildOrderListSlot(t){const e=`${this._element.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME)}_configItem_${o.toCamelCase(t.label)}`;let s=x.none.value;return null!=(null==t?void 0:t.ascending)&&(s=1==t.ascending?x.asc.value:x.desc.value),i("div",null,i("snk-select-box",{selectedOption:s,key:"snk-select-box-"+this._componenteInternalKey+"-"+t,"data-element-id":e,onEzChange:i=>{i.stopPropagation(),this.updateOrder(i.detail,t.label)}}))}updateOrder(t,i){var e;this._dataChanged=!0;let s,r=[...this.columns],n=r.find((t=>t.label===i));n&&(n.sort=t.value===x.none.value?void 0:t.value),(null===(e=this._orderPriorityList)||void 0===e?void 0:e.length)>0?(this._orderPriorityList.find((t=>t.label===n.label)).sort=t,this._orderPriorityList.filter((t=>t.sort)).map(((t,i)=>{t.label===n.label&&(n.sortIndex=i)}))):(s=r.filter((t=>t.sort&&!0!==t.hidden)).map(((t,i)=>({label:t.label,orderIndex:i}))),s.forEach((t=>{r.find((i=>i.label===t.label)).sortIndex=t.orderIndex}))),this.columns=r}switchColumnGroup(t,i){t.stopPropagation();let e=[...this._columListItems];if(this._dataChanged=!0,!0===t.detail){let t=e.find((t=>t.group===this.getMessage("snkGridConfig.group.hidden"))),s=t.items.findIndex((t=>t.label===i.label));s>=0&&t.items.splice(s,1),e.find((t=>t.group===this.getMessage("snkGridConfig.group.visible"))).items.push(i),this._columListItems=e,this.createOrderList()}else if(!1===t.detail){let t=e.find((t=>t.group===this.getMessage("snkGridConfig.group.visible"))),s=t.items.findIndex((t=>t.label===i.label));s>=0&&t.items.splice(s,1),e.find((t=>t.group===this.getMessage("snkGridConfig.group.hidden"))).items.push(i),this._columListItems=e,this.createOrderList()}}finish(){if(!this._dataChanged)return void this.closeConfig();let t=[];this._columListItems.forEach((i=>{i.items.forEach((e=>{const s=this.columns.find((t=>t.label===e.label));let r=Object.assign({},s);r.hidden=i.group===this.getMessage("snkGridConfig.group.hidden"),t.push(r)}))})),this.columns=t,this._dataChanged=!1,this.closeConfig(),this.save()}save(){var t;let i;i=this.config?this.config:this.createConfigFromState(this.columns);let e,s=[];if((null===(t=this._orderPriorityList)||void 0===t?void 0:t.length)>0){e=this.columns.filter((t=>t.sort&&!0!==t.hidden)).map((t=>({label:t.label,orderIndex:0})));let t=0,i=[];this._orderPriorityList.forEach((s=>{let r=e.find((t=>t.label===s.label));r&&(r.orderIndex=t,i.push(r),t++)})),i.length>0&&(e=i)}for(let t=0;t<this.columns.length;t++){const n=this.columns[t];let l=i.columns.find((t=>n.name===t.name));!0===n.hidden&&l||(l?l.width=n.width:!1===n.hidden&&(l={name:n.name,width:n.width,orderIndex:0}),l&&(n.sort?(l.ascending=n.sort.toUpperCase()===x.asc.value,e?r(n,l):l.orderIndex=n.sortIndex):(delete l.ascending,l.orderIndex=0),s.push(l)))}function r(t,i){if(e){let s=e.find((i=>i.label===t.label));s&&(i.orderIndex=s.orderIndex)}}i.columns=s,this.saveConfig(i).then((()=>{p.info(this.getMessage("snkGridConfig.info.successfullyConfigSaved"),{iconName:"check"})}))}createConfigFromState(t){let i={columns:[]};return t.forEach((t=>{if(!t.hidden){let e={name:t.name};t.width&&(e.width=t.width),t.sort?(e.ascending=t.sort.toUpperCase()===x.asc.value,e.orderIndex=t.sortIndex):e.orderIndex=0,e&&i.columns.push(e)}})),i}async locateColumn(t,i){var e;const s="Enter"===t.key;i||(i=null===(e=t.currentTarget)||void 0===e?void 0:e.value);let r=-1;if(1===this.selectedIndex)if(i){const t=[];let e,n;if(await this._orderList.getList().then((s=>{e=s,e.forEach(((e,s)=>{this.compareWords(e,i)&&t.push(s)}))})),t.length>0){if(s)for(let i=0;i<t.length;i++)if(t[i]>this._selectedIndex){r=t[i];break}-1===r&&(r=t[0])}this._selectedIndex=r,n=e[r],n?this._orderList.setSelection({label:n.label},!0):this._orderList.setSelection(void 0)}else this._orderList.setSelection(void 0);else if(i){const t=[];if(this.columns.forEach(((e,s)=>{this.compareWords(e,i)&&t.push(s)})),t.length>0){if(s)for(let i=0;i<t.length;i++)if(t[i]>this._selectedIndex){r=t[i];break}-1===r&&(r=t[0])}this._selectedIndex=r;let e=this.columns[r];e?this._columnList.setSelection({label:e.label},!0):this._columnList.setSelection(void 0)}else this._columnList.setSelection(void 0)}compareWords(t,i){return o.replaceAccentuatedChars(t.label).indexOf(o.replaceAccentuatedChars(i))>-1}getColumnNames(){const t=[];return t.push(this.getMessage("snkGridConfig.tab.columns")),t.push(this.getMessage("snkGridConfig.tab.lineOrdering")),t.join(",")}closeConfig(){if(this._orderList.scrollToTop(),this._columnList.scrollToTop(),this._searchElement.value="",this._dataChanged){let t={canClose:!1,labelCancel:this.getMessage("snkGridConfig.confirm.cancel"),labelConfirm:this.getMessage("snkGridConfig.confirm.save"),btnConfirmDanger:!1};p.confirm(this.getMessage("snkGridConfig.confirm.alert"),this.getMessage("snkGridConfig.confirm.msgCancel"),null,_.WARN,t).then((t=>{t?this.finish():(this._dataChanged=!1,this.configCancel.emit(),this._orderList.clearHistory(),this._componenteInternalKey=Date.now())}))}else this.configCancel.emit(),this._orderList.clearHistory()}handleTabChange(t){null!=(null==t?void 0:t.index)&&(this.selectedIndex!==t.index&&(0===t.index?this._orderList.scrollToTop():1===t.index&&this._columnList.scrollToTop(),this._searchElement.value=""),1===t.index&&this.createOrderList(),this.selectedIndex=t.index)}handleColumnListChange(t){var i;if(t.detail){let e=null===(i=t.detail.find((t=>t.group===this.getMessage("snkGridConfig.group.visible"))))||void 0===i?void 0:i.items;e&&(this._dataChanged=!0,this._orderListItems=e)}}handleOrderListChange(t){if(t.detail){let i=t.detail;i&&(this._dataChanged=!0,this._orderPriorityList=i)}}componentWillRender(){var t;(null===(t=this.columns)||void 0===t?void 0:t.length)>0&&this.createColumnList()}componentDidRender(){var t;(null===(t=this.columns)||void 0===t?void 0:t.length)>0&&this.locateColumn(new KeyboardEvent("arrow-right",{key:"ArrowRight"}),this._searchElement.value)}componentWillLoad(){this._application=c.getContextValue("__SNK__APPLICATION__")}componentDidLoad(){a.addIDInfo(this._element)}render(){return i(e,null,i("div",{class:"grid-config__header"},i("div",{class:"title-container"},i("div",{class:""},i("label",{class:"title"},this.getMessage("snkGridConfig.gridConfiguration")),i("label",{class:"subtitle"},this.getMessage("snkGridConfig.columnVisibilityOrder"))),i("div",{class:"button-close"},i("ez-button",{mode:"icon",iconName:"close",size:"medium",onClick:()=>this.closeConfig()}))),i("div",{class:"tabselector-container"},i("ez-tabselector",{selectedIndex:this.selectedIndex,onEzChange:t=>{this.handleTabChange(t.detail)},tabs:this.getColumnNames()})),i("div",null,i("ez-text-input",{ref:t=>this._searchElement=t,label:this.getMessage("snkGridConfig.findColumn"),onKeyUp:t=>this.locateColumn(t)},i("ez-icon",{slot:"leftIcon",size:"medium",iconName:"search"})))),i("div",{class:"grid-config__main"},i("ez-list",{ref:t=>this._columnList=t,class:0===this.selectedIndex?"":"hidden",dataSource:this._columListItems,onEzChange:t=>this.handleColumnListChange(t),ezDraggable:!0,ezSelectable:!0,itemSlotBuilder:(t,i)=>this.buildColumnListSlot(t,i),useGroups:!0}),i("div",{class:1===this.selectedIndex?"group-name":"hidden"},this.getMessage("snkGridConfig.info.sortingSequence")),i("ez-list",{ref:t=>this._orderList=t,class:1===this.selectedIndex?"height-calc":"hidden",dataSource:this._orderListItems,ezSelectable:!0,onEzChange:t=>this.handleOrderListChange(t),ezDraggable:!0,itemSlotBuilder:t=>this.buildOrderListSlot(t)})),i("div",{class:"grid-config__footer"},i("ez-button",{class:"padding-right--medium",label:this.getMessage("snkGridConfig.cancel"),onClick:()=>this.closeConfig()}),i("ez-button",{label:this.getMessage("snkGridConfig.complete"),class:"ez-button--primary",onClick:()=>this.finish()})))}static get assetsDirs(){return["../assets"]}get _element(){return s(this)}};D.style='.sc-snk-grid-config-h{--snk-grid-config__footer--padding-top:var(--space--medium, 12px);--snk-grid-config__main--padding-right:var(--space--medium, 12px);--snk-grid-config__tabselector-container--padding:var(--space--medium, 12px);--snk-grid-config__button-close--padding-left:var(--space--medium, 12px);--snk-grid-config__title--color:var(--title--primary, #2B3A54);--snk-grid-config__title--font-family:var(--font-pattern, "Roboto");--snk-grid-config__title--font-size:var(--title--large, 20px);--snk-grid-config__title--font-weight:var(--text-weight--extra-large, 700);--snk-grid-config__subtitle--font-family:var(--font-pattern, "Roboto");--snk-grid-config__subtitle--font-size:var(--text--medium, 14px);--snk-grid-config__scrollbar--width:var(--space--medium, 12px);--snk-grid-config__scrollbar--background-color-primary:var(--scrollbar--primary, #2B3A54);--snk-grid-config__scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);--snk-grid-config__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-grid-config__group--font-family:var(--font-pattern, "Roboto");--snk-grid-config__group--font-size:var(--text--medium, 14px);--snk-grid-config__group--font-weight:var(--text-weight--large, 600);--snk-grid-config__group--padding-bottom:var(--space-small, 6px);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}@media screen and (min-width: 480px){.sc-snk-grid-config-h{width:359px;max-width:359px}}.padding-right--medium.sc-snk-grid-config{padding-right:var(--space--medium)}ez-list.sc-snk-grid-config{height:100%}.height-calc.sc-snk-grid-config{max-height:calc(100% - 24px)}.grid-config__footer.sc-snk-grid-config{display:flex;justify-content:flex-end;width:100%;padding-top:var(--snk-grid-config__footer--padding-top)}.hidden.sc-snk-grid-config{display:none}.tabselector-container.sc-snk-grid-config{padding:var(--snk-grid-config__tabselector-container--padding) 0}.button-close.sc-snk-grid-config{padding-left:var(--snk-grid-config__button-close--padding-left)}.title-container.sc-snk-grid-config{display:flex;justify-content:space-between;align-items:center;width:100%}.title.sc-snk-grid-config{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-grid-config__title--color);font-size:var(--snk-grid-config__title--font-size);font-family:var(--snk-grid-config__title--font-family);font-weight:var(--snk-grid-config__title--font-weight)}.subtitle.sc-snk-grid-config{color:var(--text--primary);font-size:var(--snk-grid-config__subtitle--font-size);font-family:var(--snk-grid-config__subtitle--font-family)}.grid-config__main.sc-snk-grid-config{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-grid-config__scrollbar--background-color-primary) var(--snk-grid-config__scrollbar--background-color-secondary);padding-right:var(--snk-grid-config__main--padding-right)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-track{background-color:var(--snk-grid-config__scrollbar--background-color-secondary)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar-thumb{background-color:var(--snk-grid-config__scrollbar--background-color-primary);border-radius:var(--snk-grid-config__scrollbar--border-radius)}.grid-config__main.sc-snk-grid-config::-webkit-scrollbar{width:var(--snk-grid-config__scrollbar--width);max-width:var(--snk-grid-config__scrollbar--width);min-width:var(--snk-grid-config__scrollbar--width);background-color:var(--snk-grid-config__scrollbar--background-color-secondary)}.group-name.sc-snk-grid-config{font-family:var(--snk-grid-config__group--font-family);font-size:var(--snk-grid-config__group--font-size);font-weight:var(--snk-grid-config__group--font-weight);padding-bottom:var(--snk-grid-config__group--padding-bottom)}';const O=class{constructor(i){t(this,i),this.ezChange=r(this,"ezChange",7),this.selectedOption=x.none}render(){return i("ez-combo-box",{class:"grid-config-combo ez-input--inverted",label:"",suppressSearch:!0,value:this.selectedOption,enabled:!0,canShowError:!1,suppressEmptyOption:!0},Object.keys(x).map((t=>i("option",{value:x[t].value},x[t].label))))}static get assetsDirs(){return["../assets"]}};O.style="ez-combo-box{width:100px}.grid-config-combo{--ez-text-input--height:28px;--ez-text-input__input--background-color:#fff;--ez-text-input__input--border-color:#dce0e8}";const S=class{constructor(i){t(this,i),this.actionClick=r(this,"actionClick",7),this.actionChange=r(this,"actionChange",7),this._titleKeyByElement={[y.UPDATE]:"snkTaskbar.titleUpdate",[y.PREVIOUS]:"snkTaskbar.titlePrevious",[y.NEXT]:"snkTaskbar.titleNext",[y.REFRESH]:"snkTaskbar.titleRefresh",[y.CLONE]:"snkTaskbar.titleClone",[y.REMOVE]:"snkTaskbar.titleRemove",[y.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[y.INSERT]:"snkTaskbar.titleInsert",[y.CANCEL]:"snkTaskbar.titleCancel",[y.SAVE]:"snkTaskbar.titleSave",[y.GRID_MODE]:"snkTaskbar.titleGridMode",[y.FORM_MODE]:"snkTaskbar.titleFormMode",[y.CONFIGURATOR]:"snkTaskbar.titleConfigurator"}}observeButtons(){this._definitions=void 0}elementsFromString(t){const i=[];return null==t||t.split(",").forEach((t=>{t=t.trim(),(C[t]||this.isAllowed(t))&&i.push(t.trim())})),i}isAllowed(t){return t===F.CONFIGURATOR?!!this._permissions&&(this._permissions.isSup||this._permissions[z.CONFIG_GRID]||this._permissions[z.CONFIG]):!F[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){let i;return i=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",i?this._application.messagesBuilder.getMessage(i,{}):""}elementClick(t){if(this.dataUnit)switch(t){case y.PREVIOUS:this.dataUnit.previousRecord();break;case y.NEXT:this.dataUnit.nextRecord();break;case y.REFRESH:this.dataUnit.loadData();break;case y.CLONE:this.dataUnit.copySelected();break;case y.REMOVE:this.dataUnit.removeSelectedRecords();break;case y.INSERT:this.dataUnit.addRecord();break;case y.CANCEL:this.dataUnit.cancelEdition();break;case y.SAVE:this.dataUnit.saveData()}this.actionClick.emit(t)}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}getElement(t,i){let e=i===this.primaryButton?"ez-button--primary ":"";return t>1&&(e+="ez-padding-left--medium"),y[i.toString()]?w(i,e,this.getIdElemBtnNative(i),(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),this.actionsList):T(i,e,this.getIdElemBtnCustom(i),(t=>this.elementClick(t)),(t=>this.isEnabled(t)))}getIdElemBtnNative(t){return`${this._element.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME)}_${o.toCamelCase(t)}`}getIdElemBtnCustom(t){return`${this._element.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME)}_${o.toCamelCase(t.name)}`}isDivider(t){var i;return void 0!==t&&(null===(i=t.t)||void 0===i?void 0:i["data-taskbar-divider"])}removeEmpty(t){let i;return t.filter((t=>!(null==t||this.isDivider(i)&&this.isDivider(t)||(i=t,0))))}componentWillLoad(){this._application=c.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess().then((t=>this._permissions=t)):this._permissions={}}componentWillRender(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons))}componentDidLoad(){a.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}render(){if(void 0===this._definitions)return;let t=0;return i(e,null,this.removeEmpty(this._definitions.map((e=>(e===y.DIVIDER?t=0:t++,y[e]?this.getElement(t,y[e]):this.customButtons.has(e)?this.getElement(t,this.customButtons.get(e)):i("slot",{name:e}))))))}get _element(){return s(this)}static get watchers(){return{buttons:["observeButtons"]}}};S.style=".sc-snk-taskbar-h{display:flex}";export{L as snk_filter_bar,I as snk_filter_item,E as snk_filter_list,A as snk_filter_modal,D as snk_grid_config,O as snk_select_box,S as snk_taskbar}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,c as o,h as t,H as n,g as l}from"./p-9ba3df4c.js";import{d as e}from"./p-b6d6b172.js";import{ObjectUtils as s,ElementIDUtils as a,ArrayUtils as r,ApplicationContext as d}from"@sankhyalabs/core";import{ApplicationUtils as h,DialogType as c}from"@sankhyalabs/ezui/dist/collection/utils";import{C as f,T as g,A as u,D as m}from"./p-6673c77c.js";import{a as v,C as b}from"./p-6ba8f415.js";import"./p-112455b1.js";const p=class{constructor(t){i(this,t),this.configChange=o(this,"configChange",7),this.configClose=o(this,"configClose",7),this._listEnabledFields=[],this._renderTimer=500,this._sortableTimer=100,this._tabSelected=1,this._labelNewGroup="Novo grupo",this._mouseOnFieldConfig=!1,this._mouseOnConfigOptions=!1,this._editingTitleGroup=!1,this._newGroupBoxes=[],this._currentGroupBoxes=[],this._formFieldsStyle="ez-col ez-col--sd-12 ez-col--tb-4 ez-padding-right--small ez-padding-bottom--medium sc-snk-form-config",this._fieldsAvailableStyle="ez-col ez-col--sd-12 ez-col--tb-12 ez-margin-bottom--medium ez-margin-right--medium sc-snk-form-config",this._fieldFloatingStyle="form-config__field-config--dragged",this._formConfigOptions=[],this._formConfig={},this._formConfigChanged=!1,this._optionFormConfigChanged=!1,this._tempGroups=[],this.formConfig={}}observeFormConfig(){this.loadConfig(this._sortableTimer)}loadFields(i=0){this._layoutFormConfig=[],i>0?setTimeout((()=>{this.buildFields()}),i):this.buildFields()}buildFields(){this.buildFormConfig(),this.buildAvailableFields()}loadFormConfig(i){var o;this._formConfig=s.copy(this.formConfig),this.loadFields(i),this.controlFieldConfig(),null!=(null===(o=this._filterFieldsAvailable)||void 0===o?void 0:o.value)&&(this._filterFieldsAvailable.value="")}cancelChangeConfig(){!0===this._formConfigChanged?this.openConfirmDialog(this.getMessage("snkFormConfig.confirm.cancel")).then((i=>{i&&(this._formConfigChanged=!1,this.resetChangeConfig())})):this.resetChangeConfig()}cancelChangeOptionConfig(){!0===this._optionFormConfigChanged?this.openConfirmDialog(this.getMessage("snkFormConfig.confirm.cancel")).then((i=>{i&&(this._optionFormConfigChanged=!1,this.resetChangeOptionConfig())})):this.resetChangeOptionConfig()}resetChangeConfig(){this.loadFormConfig(this._sortableTimer),this.clearTempGroups()}resetChangeOptionConfig(){this._formConfigChanged=!1,this.loadConfig(this._sortableTimer),this.clearTempGroups()}getTabsToSave(){return this._layoutFormConfig.map(((i,o)=>({label:i.tab,order:o,visible:i.visible})))}getFieldsToSave(){const i=[];return this._formContainer.querySelectorAll("snk-field-config").forEach((o=>{const t=o.fieldConfig;if(null==t)return;const n={cleanOnCopy:t.cleanOnCopy||!1,group:t.group,label:t.label,name:t.name,required:t.required,readOnly:t.readOnly,tab:t.tab};null!=t.defaultValue&&(n.defaultValue=null==t.defaultValue.type?{type:m.fixed,value:t.defaultValue}:t.defaultValue),i.push(n)})),i}isDefaultConfiguration(){var i;return(null===(i=this._optionFormConfigSelected)||void 0===i?void 0:i.origin)===v.DEFAULT&&!0===this._optionFormConfigChanged&&!1===this._formConfigChanged}buildConfigToSave(){let i={};const o=this.isDefaultConfiguration();if(i=s.copy(o?this.formConfig:this._formConfig),!1===o){const o=this.getTabsToSave();(null==o?void 0:o.length)>0&&(i.tabs=o);const t=this.getFieldsToSave();(null==t?void 0:t.length)>0&&(i.fields=t)}return i.defaultConfiguration=o,i}saveConfig(){var i;if((null===(i=this._tempGroups)||void 0===i?void 0:i.length)>0)return void h.alert(this.getMessage("snkFormConfig.confirm.title"),this.getMessage("snkFormConfig.confirm.group"));const o=this.buildConfigToSave();this._formConfigChanged=!1,this._optionFormConfigChanged=!1,b.saveFormConfig(o,this.configName).then((i=>{null!=(null==i?void 0:i.resource)&&(h.info(this.getMessage("snkFormConfig.info.successfullyConfigSaved"),{iconName:"check"}),this.configChange.emit(o))}))}applyOptionConfig(){if(!0===this._optionFormConfigChanged&&null!=this._optionFormConfigSelected){const i=this._optionFormConfigSelected.name||"configuração selecionada",o=this._optionFormConfigSelected.origin===v.DEFAULT?"pessoal":"padrão",t=this.getMessage("snkFormConfig.confirm.apply").replace("{0}",i).replace("{1}",o);this.openConfirmDialog(t).then((i=>{i&&this.saveConfig()}))}else this.saveConfig()}controlFieldConfig(i){var o;this._fieldConfigSelected=null!=i?(null===(o=this._fieldConfigSelected)||void 0===o?void 0:o.name)===(null==i?void 0:i.name)?void 0:i:void 0}getFieldConfigStyle(i){var o;return this._formFieldsStyle+((null===(o=this._fieldConfigSelected)||void 0===o?void 0:o.name)===i.name?" form-config__field-config--selected":"")}getFieldsByGroup(i){var o;return(null===(o=i.fields)||void 0===o?void 0:o.length)?i.fields.map((i=>{var o,n;return t("div",{key:i.name,class:this.getFieldConfigStyle(i),"data-draggable-element":"field",onMouseDown:i=>this.controlMoveField(i)},t("snk-field-config",{onEzClickIcon:i=>{this.handleFieldConfigChange(i)},modeInsertion:!1,fieldConfig:i,"data-element-id":this._element.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME),dataUnit:this.dataUnit,isConfigActive:(null===(o=this._fieldConfigSelected)||void 0===o?void 0:o.name)===i.name}),(null===(n=this._fieldConfigSelected)||void 0===n?void 0:n.name)===i.name&&t("div",{class:"ez-flex form-config__config-options"},t("snk-config-options",{idConfig:i.name,dataUnit:this.dataUnit,fieldConfig:this._fieldConfigSelected,"data-element-id":this._element.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME),onConfigOptionsChanged:i=>this.handleconfigOptionsChanged(i.detail)})))})):t("div",{class:"form-config__add-group-container"},t("div",{class:"form-config__add-group-content"},t("div",{class:"form-config__add-group-label"},t("label",{class:"ez-text ez-text--center ez-text--medium ez-text--primary ez-text--bold"},this.getMessage("snkFormConfig.form.labelDropField")))))}handleconfigOptionsChanged(i){var o;null===(o=this._formConfig.fields)||void 0===o||o.forEach((()=>{})),this._formConfigChanged=!0}closeFormConfig(){!0===this._formConfigChanged||!0===this._optionFormConfigChanged?this.openConfirmDialog(this.getMessage("snkFormConfig.confirm.exit")).then((i=>{i&&(this._formConfigChanged=!1,this.configClose.emit())})):this.configClose.emit()}openConfirmDialog(i="",o=this.getMessage("snkFormConfig.confirm.title")){return h.confirm(o,i)}controlMoveField(i){const o=null==i?void 0:i.target;null!=(null==o?void 0:o.closest('[data-draggable-element="field"]'))&&(this._mouseOnFieldConfig=!0,null!=(null==o?void 0:o.closest(".form-config__config-options"))||null!=(null==o?void 0:o.closest(".field-config__options"))?this._mouseOnConfigOptions=!0:!1===["minus","settings-inverted","chevron-up"].includes(null==o?void 0:o.iconName)&&this.controlFieldConfig())}controlStartDraggingField(i){var o,t,n;if(this._mouseOnConfigOptions)null==i||i.cancel(),this._mouseOnConfigOptions=!1;else{const l=null===(n=null===(t=null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.dragEvent)||void 0===t?void 0:t.data)||void 0===n?void 0:n.sourceContainer;null!=l&&l.classList.add(this._fieldFloatingStyle)}}controlSortedDraggingField(i){var o,t,n,l,e,s,a,r;const d=null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.oldContainer,h=null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.newContainer,c=null===(e=null===(l=null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.dragEvent)||void 0===l?void 0:l.data)||void 0===e?void 0:e.source,f=null===(r=null===(a=null===(s=null==i?void 0:i.data)||void 0===s?void 0:s.dragEvent)||void 0===a?void 0:a.data)||void 0===r?void 0:r.originalSource;null!=d&&null!=h&&null!=c&&null!=f&&("EZ-COLLAPSIBLE-BOX"!==h.tagName&&"fieldsWithoutGroupContainer"!==h.id||"fieldsAvailableContainer"!==d.id?"EZ-COLLAPSIBLE-BOX"!==d.tagName&&"fieldsWithoutGroupContainer"!==d.id||"fieldsAvailableContainer"!==h.id||(c.className=this._fieldsAvailableStyle,c.querySelector("snk-field-config").modeInsertion=!0,f.className=this._fieldsAvailableStyle,f.querySelector("snk-field-config").modeInsertion=!0):(c.className=this._formFieldsStyle,c.querySelector("snk-field-config").modeInsertion=!1,f.className=this._formFieldsStyle,f.querySelector("snk-field-config").modeInsertion=!1))}isCancelDragAvailableField(i,o,t){var n,l;return null!=i&&null!=o&&null!=t&&(null===(n=t.data)||void 0===n?void 0:n.newIndex)!==(null===(l=t.data)||void 0===l?void 0:l.oldIndex)&&"fieldsAvailableContainer"===i.id&&o.id===i.id&&(t.cancel(),this._fieldsAvailable=[],setTimeout((()=>{this.buildAvailableFields()}),this._sortableTimer),!0)}isRemoveField(i,o,t){if(null==i||null==o||null==t)return!1;if(("EZ-COLLAPSIBLE-BOX"===o.tagName||"fieldsWithoutGroupContainer"===o.id)&&"fieldsAvailableContainer"===i.id){const i={detail:{field:t,type:u.remove}};return setTimeout((()=>{this.handleFieldConfigChange(i,this._sortableTimer)}),this._renderTimer),!0}return!1}isAddOrMoveField(i,o,t,n){var l;return null!=i&&null!=o&&null!=t&&null!=n&&(n.newIndex!==n.oldIndex||o.dataset.groupName!==i.dataset.groupName||"fieldsWithoutGroupContainer"===i.id&&"fieldsAvailableContainer"===o.id)&&(this.isFieldAvailable(i,o)&&(t.tab=null===(l=this._tabConfig)||void 0===l?void 0:l.selectedTab),t.group=i.dataset.groupName,setTimeout((()=>{i.id.includes("addNewGroupContainer")&&this.clearTempGroups(!0),this.updateFieldsToSave(o.dataset.groupName!==i.dataset.groupName||"fieldsWithoutGroupContainer"===i.id&&"fieldsAvailableContainer"===o.id?this._sortableTimer:0)}),this._renderTimer),!0)}isFieldAvailable(i,o){return null!=i&&null!=o&&("EZ-COLLAPSIBLE-BOX"===i.tagName||"fieldsWithoutGroupContainer"===i.id)&&"fieldsAvailableContainer"===o.id}controlStopDraggingField(i){var o,t,n,l,e,s;const a=null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.oldContainer,r=null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.newContainer;if(this.isCancelDragAvailableField(r,a,i))return;const d=null===(e=null===(l=null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.dragEvent)||void 0===l?void 0:l.data)||void 0===e?void 0:e.originalSource,h=null===(s=null==d?void 0:d.querySelector("snk-field-config"))||void 0===s?void 0:s.fieldConfig;this.isRemoveField(r,a,h)||this.isAddOrMoveField(r,a,h,null==i?void 0:i.data)}updateFieldsToSave(i=0){const o=this.getFieldsToSave();(null==o?void 0:o.length)>0&&(this._formConfig.fields=o),this.loadFields(i),this._formConfigChanged=!0}controlSortableField(){null!=this._sortableContainer&&(this._sortableField&&this._sortableField.destroy(),this._sortableField=new e.Sortable(this._sortableContainer.querySelectorAll('[data-draggable-parent="field"]'),{draggable:'[data-draggable-element="field"]',mirror:{constrainDimensions:!0}}),this._sortableField.on(f.dragStart,(i=>this.controlStartDraggingField(i))),this._sortableField.on(f.dragSorted,(i=>this.controlSortedDraggingField(i))),this._sortableField.on(f.dragStop,(i=>this.controlStopDraggingField(i))))}controlStartDraggingGroup(i){(this._mouseOnFieldConfig||this._editingTitleGroup)&&(null==i||i.cancel(),this._mouseOnFieldConfig=!1)}controlStopDraggingGroup(i){i.data.newIndex!==i.data.oldIndex&&setTimeout((()=>{this.updateFieldsToSave(this._sortableTimer)}),this._renderTimer)}controlSortableGroup(){null!=this._sortableContainer&&(this._sortableGroup&&this._sortableGroup.destroy(),this._sortableGroup=new e.Sortable(this._sortableContainer.querySelectorAll('[data-draggable-parent="group"]'),{draggable:'[data-draggable-element="group"]',mirror:{constrainDimensions:!0}}),this._sortableGroup.on(f.dragStart,(i=>this.controlStartDraggingGroup(i))),this._sortableGroup.on(f.dragStop,(i=>this.controlStopDraggingGroup(i))))}loadUserConfig(){null!=this._application&&this._application.fetchUserAvailableConfigs(this.configName).then((i=>{this._formConfigOptions=i;let o=null==this._formConfig||this._formConfig.defaultConfiguration;const t=i.find((i=>i.origin===(o?v.DEFAULT:v.USER)));this.setFormConfig(t)}))}setFormConfig(i){this._optionFormConfigSelected=i}controlSelectFormConfig(i){const o=null==i?void 0:i.detail,t=this._formConfigOptions.find((i=>i.origin===(null==o?void 0:o.value)));this.setFormConfig(t),this._optionFormConfigChanged=!0,this.loadConfigByUser()}changeTabOrder(i){const o=[],t=this._tabConfig.querySelectorAll(".tab-config__tab");this._tabSelected=i,t.forEach(((i,t)=>{var n;if(t){const l=null===(n=i.querySelector(".tab-config__tab-label"))||void 0===n?void 0:n.getAttribute("title");o.push({label:l,order:t-1})}})),this._layoutFormConfig.map((i=>{o.forEach((o=>{o.label===i.tab&&(o.visible=i.visible)}))})),o.length>0&&(this._formConfig.tabs=o,this.loadFields(this._sortableTimer),this.controlFieldConfig(),this._formConfigChanged=!0)}loadConfigByUser(){if(null!=this._application){const i=this._optionFormConfigSelected,o=(null==i?void 0:i.origin)===v.DEFAULT?"fetchDefaultConfig":(null==i?void 0:i.origin)===v.USER?"fetchLegacyConfig":void 0;null!=o&&this._application[o](this.configName).then((i=>{null!=i&&(this._formConfig=i,this._tabSelected=1,this.loadFields(this._sortableTimer),this.controlFieldConfig(),this.clearTempGroups())}))}}loadConfig(i=0){this.loadFormConfig(i),this.loadUserConfig()}addNewGroup(){var i,o;const t=null===(i=this._tabConfig)||void 0===i?void 0:i.selectedTab;null==(null===(o=this._tempGroups)||void 0===o?void 0:o.find((i=>i.tab===t&&i.group.includes(this._labelNewGroup))))&&(this._tempGroups.push({tab:t,group:this.handleDuplicateGroups(this._labelNewGroup,this._tabConfig.selectedTab)}),this.loadFields(),this.controlFieldConfig(),this._formConfigChanged=!0)}clearTempGroups(i=!1){var o;(null===(o=this._tempGroups)||void 0===o?void 0:o.length)>0&&(this._tempGroups=i?this._tempGroups.filter((i=>i.tab!==this._tabConfig.selectedTab)):[])}removeGroup(i){null!=i?this._tempGroups=this._tempGroups.filter(((o,t)=>t!==i&&o.tab===this._tabConfig.selectedTab||o.tab!==this._tabConfig.selectedTab)):this.updateFieldsToSave(this._sortableTimer)}checkGroupExists(i,o,t=!1){var n,l,e;const s=null===(n=this._tabConfig)||void 0===n?void 0:n.selectedTab,a=null===(l=this._layoutFormConfig)||void 0===l?void 0:l.find((i=>i.tab===s)),r=null===(e=null==a?void 0:a.groups)||void 0===e?void 0:e.map((i=>{var o;return null===(o=i.group)||void 0===o?void 0:o.toLowerCase()}));if(null==r?void 0:r.includes(null==i?void 0:i.toLowerCase())){const n=this.getMessage("snkFormConfig.confirm.title"),l=`\n ${this.getMessage("snkFormConfig.alert.titleGroupExists")} \n <b>${i}</b> \n ${this.getMessage("snkFormConfig.alert.inTab")} \n <b>${s===g.main?this.getMessage("snkFormConfig.form.mainArea"):s}</b>. \n <br/><br/> \n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `;return h.alert(n,l).then((()=>{var i,n;t?null===(i=this._newGroupBoxes[o])||void 0===i||i.applyFocusTextEdit():null===(n=this._currentGroupBoxes[s][o])||void 0===n||n.applyFocusTextEdit()})),!1}return!0}saveEditLabelTempGroup(i,o){const{newValue:t}=i.detail;null!=this._newGroupBoxes&&null!=this._newGroupBoxes[o]&&(this._newGroupBoxes[o].dataset.groupName=t)}saveEditLabelGroup(i){var o;const{value:t,newValue:n}=i.detail;null===(o=this._formConfig.fields)||void 0===o||o.forEach((i=>{i.group===t&&(i.group=n)})),this.loadFields(this._sortableTimer),this.controlFieldConfig(),this._formConfigChanged=!0}renderTempGroupByTab(i){return this._tempGroups.map(((o,n)=>{if(o.tab===i)return t("ez-collapsible-box",{ref:i=>this._newGroupBoxes[n]=i,id:`addNewGroupContainer-${n}`,editable:!0,removable:!0,"header-size":"large",label:o.group,"icon-placement":"left","data-group-name":o.group,"data-draggable-parent":"field",class:"form-config__add-group",onEzRemove:()=>this.removeGroup(n),onEzSaveEditLabel:i=>this.saveEditLabelTempGroup(i,n),onEzEditLabelMode:i=>this._editingTitleGroup=i.detail,conditionalSave:i=>this.checkGroupExists(i,n,!0)},this.getFieldsByGroup(o))}))}handleDuplicateGroups(i,o){var t;const n=this._layoutFormConfig[this._tabConfig.selectedIndex].groups.map((i=>i.group));return null!=n&&(null===(t=this._layoutFormConfig)||void 0===t||t.map((t=>{t.tab===o&&t.groups.some((o=>o.group===i))&&(i+=`${this.captureHighestValueTitle(n)}`)}))),i}captureHighestValueTitle(i){let o=[];return null==i||i.map((i=>{null!=i&&o.push(i.replace(/[^0-9]/g,""))})),Math.max.apply(null,o)>0?` (${Math.max.apply(null,o)+1})`:" (1)"}getLayoutFormConfig(){var i,o;if(null==(null===(i=this._formConfig)||void 0===i?void 0:i.fields))return;let t=[],n=[];for(const i of this._formConfig.fields)if(null==n.find((o=>i.name===o.name&&i.tab===o.tab))){n.push(i);const l=this.dataUnit.getField(i.name);if(null==l?void 0:l.visible){null!=i.label&&""!==i.label||(i.label=l.label),null!=i.tab&&""!==i.tab||(i.tab=this.getMessage("snkFormConfig.form.tabGeneral"));let n=t.find((o=>o.tab===i.tab));if(null==n){let l=null;if(null!=this._formConfig.tabs){const o=this._formConfig.tabs.filter((o=>o.label===i.tab));o.length>0&&(l=o[0].visible)}const e=(null===(o=i.tab)||void 0===o?void 0:o.label)||i.tab;n=null!==l?{tab:e,groups:[],visible:l}:{tab:e,groups:[],visible:!0},t.push(n)}const e=n.groups.find((o=>o.group===i.group));if(e)e.fields.push(i);else{const o={group:i.group,fields:[i]};void 0===i.group?n.groups.unshift(o):n.groups.push(o)}}}return t}configureTabs(i){var o;return null==(null===(o=this._formConfig)||void 0===o?void 0:o.tabs)?i:(null==i&&(i=[]),this._formConfig.tabs.map((o=>i.find((i=>{var t,n;return(null===(t=o.label)||void 0===t?void 0:t.toLowerCase())===(null===(n=i.tab)||void 0===n?void 0:n.toLowerCase())}))||{tab:o.label,groups:[],visible:o.visible})))}configureTabMain(i){return null==i&&(i=[]),null==i.find((i=>i.tab===g.main))&&i.unshift({tab:g.main,groups:[],visible:!0}),i}updateTabs(){const i=this.getTabsToSave();(null==i?void 0:i.length)>0&&(this._formConfig.tabs=i,1===i.length&&(this._tabSelected=0))}buildFormConfig(){var i;if(null==(null===(i=this._formConfig)||void 0===i?void 0:i.fields))return;let o=this.getLayoutFormConfig();o=this.configureTabs(o),o=this.configureTabMain(o),this._layoutFormConfig=o,this.updateTabs()}buildAvailableFields(){var i,o;if(null==(null===(i=this._formConfig)||void 0===i?void 0:i.fields))return;let t=[],n=this.dataUnit.metadata.fields;for(const i of this._formConfig.fields)t.push(i);const l=n.filter((({name:i,visible:o})=>!0===o&&!1===t.some((({name:o})=>o===i))));this._fieldsAvailable=l,this._listEnabledFields=l,null!=(null===(o=this._filterFieldsAvailable)||void 0===o?void 0:o.value)&&this.onFilterChange(this._filterFieldsAvailable.value)}changeTabSelected(i){this._tabSelected=i.index;const o=this._formContainer.querySelector("div#tab"+i.index);this._formContainer.querySelectorAll(".form-config__tab-content").forEach((i=>i.className="form-config__hide-content sc-snk-form-config")),o&&(o.className="form-config__tab-content ez-flex ez-flex--column ez-size-width--full ez-padding--medium sc-snk-form-config")}onFilterChange(i){this._fieldsAvailable=r.applyStringFilter(i,this._listEnabledFields,!0,"label")}orderFieldsAvailable(i){return r.sortAlphabetically(i)}handleLabelCounter(i){const o=[this.getMessage("snkFormConfig.availableFields.labelNoFields"),this.getMessage("snkFormConfig.availableFields.labelOneField")];return i>1?`${i} ${this.getMessage("snkFormConfig.availableFields.labelAvailableFields")}`:o[i]}controlAddFieldConfig(i){var o;if(this._formConfigChanged=!1,null==i)return;null==this._formConfig.fields&&(this._formConfig.fields=[]);const t=this._formConfig.fields.filter((o=>o.name===i.name&&o.tab&&i.tab));t.length>0?t.forEach((o=>{o.name=i.name,o.label=i.label,o.required=i.required,o.readOnly=i.readOnly,o.group=i.group})):this._formConfig.fields.push({name:i.name,label:i.label,required:i.required,readOnly:i.readOnly,group:i.group,tab:null===(o=this._tabConfig)||void 0===o?void 0:o.selectedTab}),this.loadFields(),this.controlFieldConfig(),this._formConfigChanged=!0,this.resetSortables()}controlRemoveFieldConfig(i,o){var t;this._formConfigChanged=!1,null!=i&&(this._formConfig.fields=null===(t=this._formConfig.fields)||void 0===t?void 0:t.filter((o=>o.name!==i.name)),this.loadFields(o),this.controlFieldConfig(),this._formConfigChanged=!0,this.resetSortables())}resetSortables(){this.controlSortableField(),this.controlSortableGroup()}handleFieldConfigChange(i,o=0){const{field:t,type:n}=i.detail;n!==u.configuration?n!==u.remove?n!==u.add||this.controlAddFieldConfig(t):this.controlRemoveFieldConfig(t,o):this.controlFieldConfig(t)}changeTabLabel(i){var o,t;const{value:n,newValue:l}=i.detail.detail;null===(o=this._formConfig.fields)||void 0===o||o.forEach((i=>{i.tab===n&&(i.tab=l)})),null===(t=this._formConfig.tabs)||void 0===t||t.forEach((i=>{i.label===n&&(i.label=l)})),this.loadFields(this._sortableTimer),this.controlFieldConfig(),this._formConfigChanged=!0}handleDeleteTab(i){let o={canClose:!1,labelCancel:this.getMessage("snkFormConfig.confirm.labelCancel"),labelConfirm:this.getMessage("snkFormConfig.confirm.labelDelete"),btnConfirmDanger:!1};const t=this.getMessage("snkFormConfig.confirm.title"),n=this.getMessage("snkFormConfig.confirm.deleteTab")+` <b>${i.detail.label}</b>?`;h.confirm(t,n,null,c.WARN,o).then((o=>{var t;o&&(this._formConfig.tabs=null===(t=this._formConfig.tabs)||void 0===t?void 0:t.filter((o=>o.label!==i.detail.label)),this.loadFields(this._sortableTimer),this.controlFieldConfig(),this._formConfigChanged=!0)}))}changeHideTab(i){var o;null===(o=this._formConfig.tabs)||void 0===o||o.forEach((o=>{o.label===i.detail.label&&(o.visible=!o.visible)})),this.loadFields(this._sortableTimer),this.controlFieldConfig(),this._formConfigChanged=!0}handleCanStartDragTab(){var i,o;const t=this._layoutFormConfig.map((i=>i.tab));for(const o of t)null===(i=this._currentGroupBoxes[o])||void 0===i||i.map((i=>null==i?void 0:i.cancelEdition()));null===(o=this._newGroupBoxes)||void 0===o||o.map((i=>null==i?void 0:i.cancelEdition()))}getMessage(i,o){return this._application.messagesBuilder.getMessage(i,o)}componentDidRender(){this.controlSortableField(),this.controlSortableGroup()}componentWillLoad(){this._application=d.getContextValue("__SNK__APPLICATION__"),this.loadConfig()}componentDidLoad(){a.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}render(){var i,o,l,e;const s=this._formConfigOptions.map((i=>({value:i.origin,label:i.name})));return t(n,null,t("div",{class:"ez-row ez-padding--medium"},t("div",{class:"ez-col ez-col--sd-7 ez-col--tb-9 ez-align--middle"},t("ez-button",{mode:"icon",iconName:"arrow_back",class:"ez-padding--small",size:"small",onClick:()=>this.closeFormConfig()}),t("h1",{class:"ez-title ez-title--extra-large ez-padding--small"},this.getMessage("snkFormConfig.title")),t("ez-actions-button",{class:"form-config__actions-button ez-margin-left--medium",value:null===(i=this._optionFormConfigSelected)||void 0===i?void 0:i.origin,showLabel:!0,displayIcon:"chevron-down",checkOption:!0,size:"small",actions:s,onEzAction:i=>this.controlSelectFormConfig(i)})),t("div",{class:"ez-col ez-col--sd-5 ez-col--tb-3 ez-align--middle ez-align--right"},!0===this._formConfigChanged&&!1===this._optionFormConfigChanged&&t("div",{class:"ez-row ez-align--middle ez-align--right"},t("ez-button",{label:"Cancelar",class:"ez-padding-left--medium",size:"small",onClick:()=>this.cancelChangeConfig()}),t("ez-button",{label:"Salvar",class:"ez-button--primary ez-padding-left--medium",size:"small",onClick:()=>this.saveConfig()},t("ez-icon",{class:"ez-margin-right--small",slot:"leftIcon",iconName:"save"}))),!0===this._optionFormConfigChanged&&t("div",{class:"ez-row ez-align--middle ez-align--right"},t("ez-button",{label:"Cancelar",class:"ez-padding-left--medium",size:"small",onClick:()=>this.cancelChangeOptionConfig()}),t("ez-button",{label:this.getMessage("snkFormConfig.applyConfig"),class:"ez-button--primary ez-padding-left--medium",size:"small",onClick:()=>this.applyOptionConfig()})))),t("div",{class:"ez-row ez-padding--medium",ref:i=>this._sortableContainer=i},t("div",{class:"form-config__tab-container ez-col ez-col--sd-9 ez-col--tb-9 ez-padding-right--medium"},(null===(o=this._layoutFormConfig)||void 0===o?void 0:o.length)>0&&t("section",{class:"ez-box__container",ref:i=>this._formContainer=i},t("snk-tab-config",{ref:i=>this._tabConfig=i,selectedIndex:this._tabSelected,onEzTabChange:i=>this.changeTabSelected(i.detail),onEzOrderChange:i=>this.changeTabOrder(i.detail),onEditionTitleTab:i=>this.changeTabLabel(i),onDeleteTab:i=>this.handleDeleteTab(i),onHideTab:i=>this.changeHideTab(i),onCanStartDrag:()=>this.handleCanStartDragTab()},this._layoutFormConfig.map((i=>t("snk-tab",{tabKey:i.tab,label:i.tab,visible:i.visible})))),this._layoutFormConfig.map(((i,o)=>t("div",{id:"tab"+o,"data-draggable-parent":"group",class:this._tabSelected===o?"form-config__tab-content ez-flex ez-flex--column ez-size-width--full ez-padding--medium":"form-config__hide-content"},i.groups.map(((o,n)=>o.group?(null==this._currentGroupBoxes[i.tab]&&(this._currentGroupBoxes[i.tab]=[]),t("ez-collapsible-box",{ref:o=>this._currentGroupBoxes[i.tab][n]=o,editable:!0,removable:!0,"header-size":"large",label:o.group,"icon-placement":"left","data-group-name":o.group,"data-draggable-parent":"field","data-draggable-element":"group",onEzRemove:()=>this.removeGroup(),onEzSaveEditLabel:i=>this.saveEditLabelGroup(i),onEzEditLabelMode:i=>this._editingTitleGroup=i.detail,conditionalSave:i=>this.checkGroupExists(i,n)},this.getFieldsByGroup(o))):t("div",{class:"ez-flex ez-flex--column ez-size-width--full"},t("label",{class:"ez-text ez-text--secondary ez-margin-vertical--small"},this.getMessage("snkFormConfig.form.subTitleInfo")),t("div",{id:"fieldsWithoutGroupContainer",class:"ez-row","data-draggable-parent":"field"},this.getFieldsByGroup(o)),t("hr",{class:"ez-divider-horizontal ez-margin-vertical--medium"})))),this.renderTempGroupByTab(i.tab)))),t("div",{class:"form-config__btn-add-group ez-row"},t("div",{class:"form-config__btn-add-group-container ez-col ez-col--sd-12 ez-col--tb-12 ez-align--center"},t("ez-button",{label:this.getMessage("snkFormConfig.form.labelNewGroup"),class:"ez-padding-horizontal--small ez-button--primary",size:"small",onClick:()=>this.addNewGroup()},t("ez-icon",{class:"ez-margin-right--small",slot:"leftIcon",iconName:"plus"})))))),t("div",{class:"form-config__fields-available ez-col ez-col--sd-3 ez-col--tb-3"},t("section",{class:"ez-box__container ez-col ez-col--pn-12"},t("h1",{class:"ez-title ez-title--large ez-title--primary ez-padding-bottom--medium"},this.getMessage("snkFormConfig.availableFields.title")),t("ez-filter-input",{ref:i=>this._filterFieldsAvailable=i,label:this.getMessage("snkFormConfig.availableFields.labelSearchField"),onEzChange:i=>this.onFilterChange(i.detail)}),t("span",{class:"ez-box__label-counter ez-text ez-text--medium ez-text--primary ez-margin-bottom--medium"},this.handleLabelCounter(null===(l=this._fieldsAvailable)||void 0===l?void 0:l.length)),(null===(e=this._layoutFormConfig)||void 0===e?void 0:e.length)>0&&t("div",{id:"fieldsAvailableContainer",class:"ez-row","data-draggable-parent":"field"},this.orderFieldsAvailable(this._fieldsAvailable).map((i=>t("div",{key:i.name,class:this._fieldsAvailableStyle,"data-draggable-element":"field",onMouseDown:i=>this.controlMoveField(i)},t("snk-field-config",{onEzClickIcon:i=>{this.handleFieldConfigChange(i)},dataUnit:this.dataUnit,fieldConfig:i})))))))))}get _element(){return l(this)}static get watchers(){return{formConfig:["observeFormConfig"]}}};p.style='.sc-snk-form-config-h{--snk-form-config__title--font-pattern:var(--font-pattern, "Roboto");--snk-form-config__title--weight--large:var(--text-weight--large, 600);display:flex;flex-direction:column;position:absolute;top:0;left:0;width:100%;height:100%;z-index:var(--more-visible, 2);background-color:var(--background--xlight)}.form-config__title.sc-snk-form-config{display:flex;margin:0;line-height:1.3;font-family:var(--snk-form-config__title--font-pattern);font-weight:var(--snk-form-config__title--weight--large)}.form-config__header-container.sc-snk-form-config{display:flex}.form-config__field-container.sc-snk-form-config{width:32%;padding:6px}.form-config__hide-content.sc-snk-form-config{display:none}ez-icon.sc-snk-form-config .left-icon.sc-snk-form-config{--ez-icon--color:var(--text--disable)}.ez-box__label-counter.sc-snk-form-config{font-weight:var(--text-weight--extra-small);margin-top:-7px}.form-config__btn-options.sc-snk-form-config{--ez-button--min-width:300px;--ez-button--background-color:#FFFFFF}[data-draggable-parent].sc-snk-form-config{position:relative}.form-config__field-config--selected.sc-snk-form-config{position:static}.form-config__field-config--dragged.sc-snk-form-config .draggable-mirror.sc-snk-form-config{z-index:var(--more-visible, 2)}.form-config__config-options.sc-snk-form-config{position:relative;margin-top:-3px;min-width:100%;z-index:1}.form-config__tab-container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config{position:relative;height:100%;max-height:calc(100vh - 92px)}.form-config__tab-container.sc-snk-form-config .ez-box__container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config .ez-box__container.sc-snk-form-config{align-content:flex-start;height:100%}.form-config__fields-available.sc-snk-form-config [data-draggable-parent].sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:100%;max-height:calc(100% - 122px)}.form-config__tab-content.sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:auto;max-height:calc(100% - 128px)}[data-draggable-element].sc-snk-form-config{cursor:grab}.form-config__actions-button.sc-snk-form-config{--ez-actions-button__btn-action--min-width:235px}.form-config__add-group.sc-snk-form-config{position:relative;min-height:120px;margin-bottom:10px}.form-config__add-group-container.sc-snk-form-config{position:absolute;display:flex;flex-wrap:wrap;width:100%;box-sizing:border-box;border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #d2dce9);padding:var(--space--small, 6px)}.form-config__add-group-content.sc-snk-form-config{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;box-sizing:border-box;border:2px dashed var(--color-strokes, #DCE0E8);border-radius:var(--border--radius-small, 6px)}.form-config__add-group-label.sc-snk-form-config{display:flex;justify-content:center;box-sizing:border-box;padding:var(--space--large, 24px)}.form-config__btn-add-group.sc-snk-form-config{position:relative;padding:var(--space--large, 24px) var(--space--medium, 12px) 0}.form-config__btn-add-group-container.sc-snk-form-config{padding:var(--space--medium, 12px);border-radius:var(--border--radius-medium, 12px);border:2px solid var(--color-strokes, #DCE0E8);background-color:var(--background--body, #fafcff)}.form-config__left-icon--eye-off.sc-snk-form-config{padding-top:var(--space--medium, 8px)}ez-collapsible-box.draggable-mirror.sc-snk-form-config{display:table;background-color:#FFFFFF}ez-collapsible-box.sc-snk-form-config{margin-bottom:10px}@media screen and (min-width: 480px){.form-config__field-config--selected.sc-snk-form-config .ez-flex.form-config__config-options.sc-snk-form-config{min-width:calc(300% + 12px)}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+2) .ez-flex.form-config__config-options.sc-snk-form-config{transform:translate(calc(100% / 3 * -1))}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+3) .ez-flex.form-config__config-options.sc-snk-form-config{transform:translate(calc(100% / 3 * -2))}}';export{p as snk_form_config}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-9ba3df4c.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-44ce5b90",[[1,"teste-pesquisa"]]],["p-eb94df0b",[[2,"snk-data-unit",{dataState:[1040],dataUnitName:[1,"data-unit-name"],entityName:[1,"entity-name"],pageSize:[2,"page-size"],dataUnit:[1040],beforeSave:[16],afterSave:[16],getDataUnit:[64]}]]],["p-63229ecb",[[0,"snk-filter-binary-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-4f9aa0b0",[[0,"snk-filter-multi-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-5fc34bc1",[[0,"snk-filter-number",{config:[16],value:[2],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-da0a0b8c",[[0,"snk-filter-period",{config:[16],value:[8],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-f50c6ef6",[[0,"snk-filter-personalized",{config:[16],value:[1040],fix:[16],unfix:[16],show:[64]}]]],["p-b5799889",[[0,"snk-filter-search",{config:[16],value:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-8fca7910",[[0,"snk-filter-text",{config:[16],value:[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-b4e199d9",[[2,"snk-pesquisa",{searchLoader:[16],selectItem:[16],argument:[1025],_itemList:[32],_startLoading:[32]}]]],["p-570cc474",[[2,"snk-config-options",{fieldConfig:[16],idConfig:[513,"id-config"],dataUnit:[16],_defaultType:[32]}]]],["p-cd03ea9e",[[6,"snk-tab-config",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1],_processedTabs:[32],_activeEditText:[32],_activeEditTextIndex:[32],_actionsHide:[32],_actionsShow:[32]}]]],["p-
|
|
1
|
+
import{p as e,b as t}from"./p-9ba3df4c.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-44ce5b90",[[1,"teste-pesquisa"]]],["p-eb94df0b",[[2,"snk-data-unit",{dataState:[1040],dataUnitName:[1,"data-unit-name"],entityName:[1,"entity-name"],pageSize:[2,"page-size"],dataUnit:[1040],beforeSave:[16],afterSave:[16],getDataUnit:[64]}]]],["p-63229ecb",[[0,"snk-filter-binary-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-4f9aa0b0",[[0,"snk-filter-multi-select",{value:[1544],config:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-5fc34bc1",[[0,"snk-filter-number",{config:[16],value:[2],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-da0a0b8c",[[0,"snk-filter-period",{config:[16],value:[8],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-f50c6ef6",[[0,"snk-filter-personalized",{config:[16],value:[1040],fix:[16],unfix:[16],show:[64]}]]],["p-b5799889",[[0,"snk-filter-search",{config:[16],value:[16],show:[64]},[[0,"ezChange","ezChangeListener"]]]]],["p-8fca7910",[[0,"snk-filter-text",{config:[16],value:[1]},[[0,"ezChange","ezChangeListener"]]]]],["p-b4e199d9",[[2,"snk-pesquisa",{searchLoader:[16],selectItem:[16],argument:[1025],_itemList:[32],_startLoading:[32]}]]],["p-570cc474",[[2,"snk-config-options",{fieldConfig:[16],idConfig:[513,"id-config"],dataUnit:[16],_defaultType:[32]}]]],["p-cd03ea9e",[[6,"snk-tab-config",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1],_processedTabs:[32],_activeEditText:[32],_activeEditTextIndex:[32],_actionsHide:[32],_actionsShow:[32]}]]],["p-cd486089",[[0,"snk-filter-detail",{config:[1040],getMessage:[16],show:[64]}]]],["p-60e7e86d",[[6,"snk-grid",{configName:[1,"config-name"],actionsList:[16],taskbarManager:[16],statusResolver:[16],multipleSelection:[4,"multiple-selection"],_dataUnit:[32],_dataState:[32],_gridConfig:[32],_popUpGridConfig:[32],showConfig:[64],hideConfig:[64],setConfig:[64]}],[2,"snk-configurator",{configName:[1,"config-name"],viewMode:[1,"view-mode"],_opened:[32],_permissions:[32],open:[64],close:[64]}],[2,"snk-field-config",{isConfigActive:[16],fieldConfig:[16],modeInsertion:[516,"mode-insertion"],dataUnit:[16]}]]],["p-d61f2170",[[2,"snk-form-config",{dataUnit:[16],formConfig:[16],configName:[513,"config-name"],_formConfigOptions:[32],_fieldConfigSelected:[32],_layoutFormConfig:[32],_fieldsAvailable:[32],_formConfig:[32],_formConfigChanged:[32],_optionFormConfigSelected:[32],_optionFormConfigChanged:[32],_tempGroups:[32]}]]],["p-d2b0f1fc",[[2,"snk-filter-bar",{dataUnit:[1040],configName:[1,"config-name"],filterConfig:[1040],allowDefault:[32],scrollerLocked:[32]},[[0,"filterChange","filterChangeListener"]]],[2,"snk-grid-config",{selectedIndex:[1026,"selected-index"],columns:[1040],config:[1040],saveConfig:[64]}],[0,"snk-filter-item",{config:[1040],getMessage:[16],detailIsVisible:[32],showUp:[64],hideDetail:[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[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"]]],[0,"snk-filter-modal",{getMessage:[16],items:[1040],modalTitle:[1,"modal-title"],modalSubTitle:[1,"modal-sub-title"],cancelButtonLabel:[1,"cancel-button-label"],okButtonLabel:[1,"ok-button-label"],infoText:[1,"info-text"],useSearch:[4,"use-search"],processModalAction:[16],_filterArgument:[32]}],[1,"snk-select-box",{selectedOption:[1,"selected-option"]}],[6,"snk-taskbar",{configName:[1,"config-name"],buttons:[1],customButtons:[16],actionsList:[16],primaryButton:[1,"primary-button"],disabledButtons:[16],dataUnit:[16],_permissions:[32]}]]],["p-2e0747f9",[[2,"snk-form",{configName:[1,"config-name"],recordsValidator:[16],actionsList:[16],taskbarManager:[16],_dataUnit:[32],_dataState:[32],_editionFormConfig:[32],_insertionFormConfig:[32],_showFormConfig:[32],showConfig:[64],hideConfig:[64]}]]],["p-825c8975",[[6,"snk-crud",{configName:[1025,"config-name"],actionsList:[16],taskbarManager:[16],recordsValidator:[16],statusResolver:[16],multipleSelection:[4,"multiple-selection"],_dataUnit:[32],_dataState:[32],_viewMode:[32],goToView:[64]}]]],["p-a72a0a5d",[[2,"snk-application",{messagesBuilder:[1040],configName:[1,"config-name"],isUserSup:[64],hasAccess:[64],getAllAccess:[64],getStringParam:[64],getIntParam:[64],getFloatParam:[64],getBooleanParam:[64],getDateParam:[64],showPopUp:[64],showModal:[64],closeModal:[64],closePopUp:[64],temOpcional:[64],getConfig:[64],saveConfig:[64],getAttributeFromHTMLWrapper:[64],openApp:[64],createDataunit:[64],getDataUnit:[64],getResourceID:[64],getUserID:[64],alert:[64],error:[64],success:[64],message:[64],confirm:[64],info:[64],loadFormConfig:[64],loadGridConfig:[64],fetchUserAvailableConfigs:[64],fetchLegacyConfig:[64],fetchDefaultConfig:[64],loadTotals:[64],saveGridConfig:[64],getFilterBarConfig:[64],saveFilterBarConfig:[64],saveFormConfig:[64],getDefaultValues:[64],getDefaultValue:[64],executeSearch:[64],executePreparedSearch:[64],isDebugMode:[64]}]]]],e)));
|
|
@@ -43,6 +43,7 @@ export declare class SnkApplication {
|
|
|
43
43
|
private get parameters();
|
|
44
44
|
private get resourceID();
|
|
45
45
|
private get auth();
|
|
46
|
+
private _element;
|
|
46
47
|
/**
|
|
47
48
|
* messagesBuilder é um utilitário responsável por flexibilizar e padronizar
|
|
48
49
|
* o uso de mensagens nos blocos de construção.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
2
|
import { SnkFilterItemConfig } from './snk-filter-item';
|
|
3
|
+
import { FilterParameter } from './editors/snk-filter-personalized';
|
|
3
4
|
export declare class SnkFilterDetail {
|
|
4
5
|
_element: HTMLElement;
|
|
5
6
|
_editor: HTMLElement;
|
|
@@ -15,6 +16,7 @@ export declare class SnkFilterDetail {
|
|
|
15
16
|
removeItem(): void;
|
|
16
17
|
getPopUpHeaderButtons(): any[];
|
|
17
18
|
buildIcon(title: string, iconName: string, action: Function): any;
|
|
19
|
+
getNormalizedValue(params: Array<FilterParameter>, value: Array<any>): any[];
|
|
18
20
|
apply(): void;
|
|
19
21
|
validateAllFilled(paramsCount: number, value: Array<any>): boolean;
|
|
20
22
|
clear(): void;
|
|
@@ -64,6 +64,8 @@ export declare class SnkForm {
|
|
|
64
64
|
private changeConfig;
|
|
65
65
|
private closeConfig;
|
|
66
66
|
getDisabledButtons(): Array<string>;
|
|
67
|
+
dataunitReady(): void;
|
|
68
|
+
getDataElementId(suffix: string): string;
|
|
67
69
|
componentWillLoad(): void;
|
|
68
70
|
componentWillRender(): void;
|
|
69
71
|
render(): any;
|
|
@@ -25,5 +25,5 @@ export declare enum AuthorizationElements {
|
|
|
25
25
|
export declare enum VisibleWhenForbidden {
|
|
26
26
|
CONFIGURATOR = "CONFIGURATOR"
|
|
27
27
|
}
|
|
28
|
-
export declare const buildCustomButton: (def: CustomButton, className: string, action: (name: string) => void, isEnabled: (name: string) => boolean) => HTMLElement;
|
|
29
|
-
export declare const buildElem: (element: TaskbarElement, className: string, getTitle: (name: string) => string, action: (name: string) => void, isEnabled: (name: string) => boolean, actions: Array<Action>) => HTMLElement;
|
|
28
|
+
export declare const buildCustomButton: (def: CustomButton, className: string, dataElementId: string, action: (name: string) => void, isEnabled: (name: string) => boolean) => HTMLElement;
|
|
29
|
+
export declare const buildElem: (element: TaskbarElement, className: string, dataElementId: string, getTitle: (name: string) => string, action: (name: string) => void, isEnabled: (name: string) => boolean, actions: Array<Action>) => HTMLElement;
|
|
@@ -6,6 +6,7 @@ import { TaskbarElement } from './elements/taskbar-elements';
|
|
|
6
6
|
export declare class SnkTaskbar {
|
|
7
7
|
_application: SnkApplication;
|
|
8
8
|
_definitions: Array<string>;
|
|
9
|
+
private _element;
|
|
9
10
|
_permissions: any;
|
|
10
11
|
/**
|
|
11
12
|
* Nome usado para guardar/recuperar as configurações do formulário
|
|
@@ -72,10 +73,13 @@ export declare class SnkTaskbar {
|
|
|
72
73
|
private elementClick;
|
|
73
74
|
private isEnabled;
|
|
74
75
|
getElement(index: number, def: TaskbarElement | CustomButton): HTMLElement;
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
getIdElemBtnNative(taskbarElem: TaskbarElement): string;
|
|
77
|
+
getIdElemBtnCustom(btnCustom: CustomButton): string;
|
|
77
78
|
isDivider(element: VNode): boolean;
|
|
78
79
|
removeEmpty(elements: Array<VNode>): VNode[];
|
|
80
|
+
componentWillLoad(): void;
|
|
81
|
+
componentWillRender(): void;
|
|
82
|
+
componentDidLoad(): void;
|
|
79
83
|
render(): any;
|
|
80
84
|
}
|
|
81
85
|
export interface Action {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sankhyalabs/sankhyablocks",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Stencil Component Starter",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/preset-env": "^7.18.2",
|
|
42
|
-
"@sankhyalabs/core": "^2.
|
|
42
|
+
"@sankhyalabs/core": "^2.3.0",
|
|
43
43
|
"@sankhyalabs/ezui": "^2.0.0",
|
|
44
44
|
"@sankhyalabs/skippeerdeps": "^1.0.2",
|
|
45
45
|
"@semantic-release/exec": "^5.0.0",
|
|
@@ -67,6 +67,5 @@
|
|
|
67
67
|
"@sankhyalabs/core": "^2.0.0",
|
|
68
68
|
"@sankhyalabs/ezui": "^2.0.0"
|
|
69
69
|
},
|
|
70
|
-
"license": "MIT"
|
|
71
|
-
"docs": "typedoc --plugin typedoc-plugin-markdown --out .docs src/*.ts"
|
|
70
|
+
"license": "MIT"
|
|
72
71
|
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { h } from './index-e4121713.js';
|
|
2
|
-
|
|
3
|
-
var TaskbarElement;
|
|
4
|
-
(function (TaskbarElement) {
|
|
5
|
-
TaskbarElement["PREVIOUS"] = "PREVIOUS";
|
|
6
|
-
TaskbarElement["NEXT"] = "NEXT";
|
|
7
|
-
TaskbarElement["REFRESH"] = "REFRESH";
|
|
8
|
-
TaskbarElement["UPDATE"] = "UPDATE";
|
|
9
|
-
TaskbarElement["CLONE"] = "CLONE";
|
|
10
|
-
TaskbarElement["REMOVE"] = "REMOVE";
|
|
11
|
-
TaskbarElement["INSERT"] = "INSERT";
|
|
12
|
-
TaskbarElement["CANCEL"] = "CANCEL";
|
|
13
|
-
TaskbarElement["SAVE"] = "SAVE";
|
|
14
|
-
TaskbarElement["GRID_MODE"] = "GRID_MODE";
|
|
15
|
-
TaskbarElement["FORM_MODE"] = "FORM_MODE";
|
|
16
|
-
TaskbarElement["MORE_OPTIONS"] = "MORE_OPTIONS";
|
|
17
|
-
TaskbarElement["DIVIDER"] = "DIVIDER";
|
|
18
|
-
TaskbarElement["CONFIGURATOR"] = "CONFIGURATOR";
|
|
19
|
-
})(TaskbarElement || (TaskbarElement = {}));
|
|
20
|
-
var AuthorizationElements;
|
|
21
|
-
(function (AuthorizationElements) {
|
|
22
|
-
AuthorizationElements["UPDATE"] = "UPDATE";
|
|
23
|
-
AuthorizationElements["CLONE"] = "CLONE";
|
|
24
|
-
AuthorizationElements["REMOVE"] = "REMOVE";
|
|
25
|
-
AuthorizationElements["INSERT"] = "INSERT";
|
|
26
|
-
AuthorizationElements["CONFIGURATOR"] = "CONFIGURATOR";
|
|
27
|
-
})(AuthorizationElements || (AuthorizationElements = {}));
|
|
28
|
-
var VisibleWhenForbidden;
|
|
29
|
-
(function (VisibleWhenForbidden) {
|
|
30
|
-
VisibleWhenForbidden["CONFIGURATOR"] = "CONFIGURATOR";
|
|
31
|
-
})(VisibleWhenForbidden || (VisibleWhenForbidden = {}));
|
|
32
|
-
const buildCustomButton = (def, className, action, isEnabled) => {
|
|
33
|
-
const { hint, text, iconName } = def;
|
|
34
|
-
if (iconName) {
|
|
35
|
-
if (text) {
|
|
36
|
-
return iconTextButton(iconName, def.name, className, hint, text, action, isEnabled);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return iconButton(iconName, def.name, className, hint, action, isEnabled);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
return textButton(def.name, className, text, hint, action, isEnabled);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const buildElem = (element, className, getTitle, action, isEnabled, actions) => {
|
|
47
|
-
const title = getTitle(element);
|
|
48
|
-
switch (element) {
|
|
49
|
-
case TaskbarElement.PREVIOUS:
|
|
50
|
-
return iconButton("chevron-left", element, className, title, action, isEnabled);
|
|
51
|
-
case TaskbarElement.NEXT:
|
|
52
|
-
return iconButton("chevron-right", element, className, title, action, isEnabled);
|
|
53
|
-
case TaskbarElement.REFRESH:
|
|
54
|
-
return iconButton("sync", element, className, title, action, isEnabled);
|
|
55
|
-
case TaskbarElement.UPDATE:
|
|
56
|
-
return iconButton("edit", element, className, title, action, isEnabled);
|
|
57
|
-
case TaskbarElement.CLONE:
|
|
58
|
-
return iconButton("copy", element, className, title, action, isEnabled);
|
|
59
|
-
case TaskbarElement.REMOVE:
|
|
60
|
-
return iconButton("delete", element, className, title, action, isEnabled);
|
|
61
|
-
case TaskbarElement.INSERT:
|
|
62
|
-
return iconTextButton("plus", element, className, title, title, action, isEnabled);
|
|
63
|
-
case TaskbarElement.CANCEL:
|
|
64
|
-
return textButton(element, className, title, title, action, isEnabled);
|
|
65
|
-
case TaskbarElement.SAVE:
|
|
66
|
-
return iconTextButton("save", element, className, title, title, action, isEnabled);
|
|
67
|
-
case TaskbarElement.GRID_MODE:
|
|
68
|
-
return iconButton("table", element, className, title, action, isEnabled);
|
|
69
|
-
case TaskbarElement.FORM_MODE:
|
|
70
|
-
return iconButton("list", element, className, title, action, isEnabled);
|
|
71
|
-
case TaskbarElement.CONFIGURATOR:
|
|
72
|
-
return iconButton("settings-inverted", element, className, title, action, isEnabled);
|
|
73
|
-
case TaskbarElement.MORE_OPTIONS:
|
|
74
|
-
return actionButton(element, className, title, action, isEnabled, actions);
|
|
75
|
-
case TaskbarElement.DIVIDER:
|
|
76
|
-
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium", "data-taskbar-divider": true });
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
function textButton(name, className, text, title, action, isEnabled) {
|
|
80
|
-
return h("ez-button", { title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) });
|
|
81
|
-
}
|
|
82
|
-
function iconButton(iconName, name, className, title, action, isEnabled) {
|
|
83
|
-
return h("ez-button", { name: iconName, title: title, mode: "icon", size: "small", class: className, iconName: iconName, enabled: isEnabled(name), onClick: () => action(name) });
|
|
84
|
-
}
|
|
85
|
-
function iconTextButton(iconName, name, className, text, title, action, isEnabled) {
|
|
86
|
-
return h("ez-button", { name: iconName, title: title, label: text, size: "small", class: className, enabled: isEnabled(name), onClick: () => action(name) },
|
|
87
|
-
h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
|
|
88
|
-
}
|
|
89
|
-
function actionButton(element, className, title, action, isEnabled, actions) {
|
|
90
|
-
return actions && actions.length > 0
|
|
91
|
-
? h("ez-actions-button", { title: title, size: "small", arrowActive: true, class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions })
|
|
92
|
-
: undefined;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export { AuthorizationElements as A, TaskbarElement as T, VisibleWhenForbidden as V, buildCustomButton as a, buildElem as b };
|