@sankhyalabs/sankhyablocks 1.3.31-beta.14 → 1.3.31-beta.16
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/{SnkMessageBuilder-bb55d4c4.js → SnkMessageBuilder-79cf15c5.js} +1 -0
- package/dist/cjs/{index-c6671817.js → index-5575fe3d.js} +434 -231
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +2 -2
- package/dist/cjs/snk-crud.cjs.entry.js +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-form_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
- package/dist/cjs/{taskbar-elements-2888ceb6.js → taskbar-elements-2ae0d005.js} +1 -1
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/snk-application/snk-application.js +688 -680
- package/dist/collection/components/snk-crud/snk-crud.js +75 -73
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +262 -250
- package/dist/collection/components/snk-form/snk-form.js +111 -111
- package/dist/collection/components/snk-grid/snk-grid.js +93 -92
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +80 -79
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +1 -2
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +128 -116
- package/dist/collection/components/teste-pesquisa/teste-pesquisa.js +12 -9
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
- package/dist/components/SnkMessageBuilder.js +1 -0
- package/dist/components/index.d.ts +8 -5
- package/dist/components/index.js +8 -0
- package/dist/components/snk-data-unit.js +1 -1
- package/dist/esm/{SnkMessageBuilder-17d91b88.js → SnkMessageBuilder-3cdde541.js} +1 -0
- package/dist/esm/{index-6a83ac96.js → index-cf91f542.js} +434 -231
- package/dist/esm/loader.js +2 -2
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +2 -2
- package/dist/esm/snk-crud.entry.js +1 -1
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-form_2.entry.js +2 -2
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +2 -2
- package/dist/esm/{taskbar-elements-5ea74223.js → taskbar-elements-bcccc0ff.js} +1 -1
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-825d2c38.entry.js → p-1ba29824.entry.js} +3 -3
- package/dist/sankhyablocks/{p-4c7b32d6.entry.js → p-2266555e.entry.js} +1 -1
- package/dist/sankhyablocks/p-23c4c94f.js +2 -0
- package/dist/sankhyablocks/{p-b559117b.js → p-2454be94.js} +1 -1
- package/dist/sankhyablocks/p-49743bc5.js +1 -0
- package/dist/sankhyablocks/{p-ce2d1214.entry.js → p-4fa389bd.entry.js} +1 -1
- package/dist/sankhyablocks/{p-56a32417.entry.js → p-5327ba05.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d25803a1.entry.js → p-7a922fb4.entry.js} +1 -1
- package/dist/sankhyablocks/p-92d6f826.entry.js +1 -0
- package/dist/sankhyablocks/{p-d25637c9.entry.js → p-bdeef7f2.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/stencil-public-runtime.d.ts +15 -4
- package/loader/package.json +1 -0
- package/package.json +5 -5
- package/dist/sankhyablocks/p-ab694dbc.js +0 -1
- package/dist/sankhyablocks/p-cd1dc099.js +0 -2
- package/dist/sankhyablocks/p-edf81d2c.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,g as e}from"./p-
|
|
1
|
+
import{r as t,c as i,h as s,g as e}from"./p-23c4c94f.js";import{ApplicationContext as a}from"@sankhyalabs/core";import{T as o}from"./p-2454be94.js";const r=class{constructor(s){t(this,s),this.exit=i(this,"exit",7),this.actionClick=i(this,"actionClick",7)}getFormConfig(){return this._dataState&&this._dataState.insertionMode?this._insertionFormConfig:this._editionFormConfig}getInsertionHiddenFields(t){const i=[];return null==t||t.forEach((t=>{const s=this._dataUnit.getField(t.name);(null==s?void 0:s.readOnly)&&i.push(t.name)})),i}exitForm(){this._dataUnit.isDirty()?this._dataUnit.cancelEdition({after:()=>this.exit.emit()}):this.exit.emit()}getDisabledButtons(){const t=[];return this._dataState.hasPrevious||t.push("PREVIOUS"),this._dataState.hasNext||t.push("NEXT"),t}loadInsertionConfig(){this._dataUnit&&this._configLoaded&&(this._insertionFormConfig=this._editionFormConfig.filter((t=>{const i=this._dataUnit.getField(t.name);return!(null==i?void 0:i.readOnly)})))}getMessage(t){return this._application.messagesBuilder.getMessage(t,this.getMessageParams())}getMessageParams(){var t;return(null===(t=this._dataState)||void 0===t?void 0:t.selectedRecords)?this._dataState.selectedRecords[0]:void 0}componentWillLoad(){this._application=a.getContextValue("__SNK__APPLICATION__"),this._application&&(this._application.loadFormConfig(this.configName).then((t=>{this._configLoaded=!0,this._editionFormConfig=t,this.loadInsertionConfig()})),this._application.getAllAccess());let t=this._element.parentElement;for(;t;){if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){this._snkDataUnit=t,this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.loadInsertionConfig():this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail,this.loadInsertionConfig()})),this._snkDataUnit.addEventListener("dataStateChange",(t=>{this._dataState=t.detail}));break}t=t.parentElement}}render(){if(this._configLoaded&&this._dataUnit&&this._dataState)return s("section",{class:"snk-form"},s("div",{class:"snk-form__header snk-form__header--fixed ez-row"},s("div",{class:"ez-col ez-col--sd-6 ez-col--tb-6",key:"formHeader"},s("ez-button",{title:this.getMessage("snkForm.goBackTitle"),mode:"icon",iconName:"arrow_back",class:"ez-padding-right--medium",size:"small",onClick:()=>this.exitForm()}),s("h1",{class:"ez-title ez-title--primary ez-title--xlarge ez-align--middle"},this.getMessage("snkForm.title"))),s("div",{class:"ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right"},s("snk-taskbar",{key:"formTaskbar",buttons:this._dataState.isDirty?"CANCEL,SAVE":"PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,INSERT",primaryButton:this._dataState.isDirty?"SAVE":"INSERT",disabledButtons:this.getDisabledButtons(),actionsList:this.actionsList,dataUnit:this._dataUnit}))),s("section",null,s("div",{class:"ez-row"},s("div",{class:"ez-col ez-col--sd-12"},s("ez-form",{key:"ezForm"+this._snkDataUnit.entityName,dataUnit:this._dataUnit,config:this.getFormConfig(),recordsValidator:this.recordsValidator})))))}get _element(){return e(this)}};r.style=".sc-snk-form-h{display:block}.snk-form.sc-snk-form{position:relative;padding:var(--space--large);padding-top:var(--space--medium)}.snk-form__header.sc-snk-form{position:relative;padding-top:var(--space--medium);padding-bottom:var(--space--medium);margin-bottom:var(--space--medium)}.snk-form__header--fixed.sc-snk-form{position:sticky;top:0;background:var(--background--body);z-index:var(--more-visible, 2);padding-left:var(--space--large);padding-right:var(--space--large);margin-left:calc(var(--space--large) * -1);margin-right:calc(var(--space--large) * -1);width:calc(100% + (var(--space--large) * 2))}";const n=class{constructor(s){t(this,s),this.actionClick=i(this,"actionClick",7),this.gridDoubleClick=i(this,"gridDoubleClick",7)}getHeaderButtons(){return this._dataState&&this._dataState.selectedRecords.length>0?"UPDATE,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,REFRESH":"REFRESH"}actionClickHandler(t){t.detail===o.CONFIG_GRID&&this._grid&&this._grid.openGridConfig()}saveConfig(t){const i=a.getContextValue("__SNK__APPLICATION__");i&&i.saveGridConfig(t)}componentWillLoad(){const t=a.getContextValue("__SNK__APPLICATION__");t&&(t.loadGridConfig(this.configName).then((t=>{this._gridConfig=t,this._configLoaded=!0})),t.getAllAccess());let i=this._element.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase()){this._snkDataUnit=i,this._dataUnit=this._snkDataUnit.dataUnit,this._dataUnit||this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail})),this._snkDataUnit.addEventListener("dataStateChange",(t=>{this._dataState=t.detail}));break}i=i.parentElement}}render(){if(this._configLoaded&&this._dataUnit)return s("div",{class:"ez-flex ez-flex--column ez-flex-item--auto ez-padding--large"},s("div",{class:"ez-row ez-padding-bottom--medium ez-margin-bottom--medium"},s("div",{class:"ez-col ez-col--sd-9 ez-col--tb-9 ez-align--bottom"},s("slot",{name:"SnkGridHeader"})),s("div",{class:"ez-col ez-col--sd-3 ez-col--tb-3 ez-align--right"},s("snk-taskbar",{onActionClick:t=>this.actionClickHandler(t),key:"topTaskbar",dataUnit:this._dataUnit,buttons:"FORM_MODE,CONFIG_GRID,INSERT",primaryButton:"INSERT"}))),s("ez-grid",{ref:t=>this._grid=t,dataUnit:this._dataUnit,key:"grid-"+this._snkDataUnit.entityName,config:this._gridConfig,onConfigChange:t=>{this.saveConfig(t.detail)},onEzDoubleClick:()=>this.gridDoubleClick.emit()},s("snk-taskbar",{dataUnit:this._dataUnit,buttons:this.getHeaderButtons(),slot:"leftButtons",actionsList:this.actionsList})),s("div",{class:"ez-col ez-col--sd-12"},s("slot",{name:"SnkGridFooter"})))}get _element(){return e(this)}};n.style=".sc-snk-grid-h{display:flex;height:100%;width:100%}";export{r as snk_form,n as snk_grid}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as i,g as s}from"./p-
|
|
1
|
+
import{r as t,h as i,g as s}from"./p-23c4c94f.js";const e=class{constructor(i){t(this,i)}async gridToForm(t=!1){this._backToGrid=!t&&0===await this._viewStack.getSelectedIndex(),this._viewStack.show(1)}async executeAction(t){"GRID_MODE"===t?this._viewStack.show(0):"FORM_MODE"!==t&&"UPDATE"!==t||this.gridToForm("UPDATE"!==t)}insertionModeHandler(){this.gridToForm()}cancelHandler(){this._backToGrid&&this._viewStack.show(0)}componentWillLoad(){let t=this._element.parentElement;for(;t;){if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){this._snkDataUnit=t,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit||this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail})),this._snkDataUnit.addEventListener("dataStateChange",(t=>{this._dataState=t.detail}));break}t=t.parentElement}}render(){return i("ez-view-stack",{ref:t=>this._viewStack=t},i("stack-item",null,i("snk-grid",{configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),onActionClick:t=>this.executeAction(t.detail),actionsList:this.actionsList},i("slot",{name:"SnkGridHeader"}),i("slot",{name:"SnkGridFooter"}))),i("stack-item",null,i("snk-form",{configName:this.configName,actionsList:this.actionsList,onExit:()=>this._viewStack.show(0),recordsValidator:this.recordsValidator,onActionClick:t=>this.executeAction(t.detail)})))}get _element(){return s(this)}};e.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{e as snk_crud}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as s,h as e,H as i}from"./p-
|
|
1
|
+
import{r as t,c as s,h as e,H as i}from"./p-23c4c94f.js";import{ApplicationContext as a}from"@sankhyalabs/core";import{T as r,V as n,A as h,b as k}from"./p-2454be94.js";const l=class{constructor(e){t(this,e),this.actionClick=s(this,"actionClick",7),this._titleKeyByElement={[r.UPDATE]:"snkTaskbar.titleUpdate",[r.PREVIOUS]:"snkTaskbar.titlePrevious",[r.NEXT]:"snkTaskbar.titleNext",[r.REFRESH]:"snkTaskbar.titleRefresh",[r.CLONE]:"snkTaskbar.titleClone",[r.REMOVE]:"snkTaskbar.titleRemove",[r.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[r.INSERT]:"snkTaskbar.titleInsert",[r.CANCEL]:"snkTaskbar.titleCancel",[r.SAVE]:"snkTaskbar.titleSave",[r.GRID_MODE]:"snkTaskbar.titleGridMode",[r.CONFIG_GRID]:"snkTaskbar.titleConfigGrid",[r.FORM_MODE]:"snkTaskbar.titleFormMode"}}observeButtons(){this._definitions=void 0}elementsFromString(t){const s=[];return t&&t.split(",").forEach((t=>{t=t.trim(),(n[t]||this.isAllowed(t))&&s.push(t.trim())})),s}isAllowed(t){return!h[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){let s;return s=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",s?this._application.messagesBuilder.getMessage(s,{}):""}elementClick(t){if(this.dataUnit)switch(t){case r.PREVIOUS:this.dataUnit.previousRecord();break;case r.NEXT:this.dataUnit.nextRecord();break;case r.REFRESH:this.dataUnit.loadData();break;case r.CLONE:this.dataUnit.copySelected();break;case r.REMOVE:this.dataUnit.removeSelectedRecords();break;case r.INSERT:this.dataUnit.addRecord();break;case r.CANCEL:this.dataUnit.cancelEdition();break;case r.SAVE:this.dataUnit.saveData()}this.actionClick.emit(t)}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}getElement(t,s){let e,i=s===this.primaryButton?"ez-button--primary ":"";return t>1&&(i+="ez-padding-left--medium"),e=k(s,i,(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),this.actionsList),e}componentWillLoad(){this._application=a.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))}render(){if(void 0===this._definitions)return;let t=0;return e(i,null,this._definitions.map((s=>(s===r.DIVIDER?t=0:t++,r[s]?this.getElement(t,r[s]):e("slot",{name:s})))))}static get watchers(){return{buttons:["observeButtons"]}}};l.style=".sc-snk-taskbar-h{display:flex}";export{l as snk_taskbar}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as i,g as e,H as a}from"./p-23c4c94f.js";import{Action as n,ApplicationContext as h}from"@sankhyalabs/core";import{ApplicationUtils as o,DialogType as r}from"@sankhyalabs/ezui/dist/collection/utils";import{O as c}from"./p-49743bc5.js";const l=class{constructor(i){t(this,i),this.dataStateChange=s(this,"dataStateChange",7),this.dataUnitReady=s(this,"dataUnitReady",7),this.insertionMode=s(this,"insertionMode",7),this.cancelEdition=s(this,"cancelEdition",7),this._onDataUnitResolve=[],this.pageSize=150,this.autoLoad=!0,this._dataUnitObserver=t=>{const s={insertionMode:!1,hasNext:this.dataUnit.hasNext(),hasPrevious:this.dataUnit.hasPrevious(),copyMode:!1,isDirty:this.dataUnit.isDirty(),hasDirtyRecords:this.dataUnit.hasDirtyRecords(),selectedRecords:this.dataUnit.getSelectedRecords()};if(this.dataUnit.records.forEach((t=>{t.__record__id__.startsWith("NEW_")&&(s.insertionMode=!0,s.copyMode||(s.copyMode=null!=t.__record__source__id__))})),this.dataState=s,t.type===n.DATA_SAVED){const s=this.getMessage("snkDataUnit.saveInfo",t.payload.records[0]);null!=s&&this.showSuccessMessage(s)}if(t.type!==n.RECORDS_ADDED&&t.type!==n.RECORDS_COPIED||this.insertionMode.emit(),t.type===n.EDITION_CANCELED){this.cancelEdition.emit();const t=this.getMessage("snkDataUnit.cancelInfo");null!=t&&this.showSuccessMessage(t)}if(t.type===n.RECORDS_REMOVED){const s=this.getMessage("snkDataUnit.removeInfo",t.payload.cachedRecords[0]);null!=s&&this.showSuccessMessage(s)}this._application.messagesBuilder.currentOperation=this.getMessageOperation()}}observePageSize(){this.dataUnit&&(this.dataUnit.pageSize=this.pageSize)}observeDataUnitName(t,s){s!=t&&(this.dataUnit=void 0,this.dataUnitName=t,this.loadDataUnit())}observeEntityName(t,s){s!=t&&(this.dataUnit=void 0,this.entityName=t,this.loadDataUnit())}observeDataState(t,s){s!=t&&this.dataStateChange.emit(t)}observeDataUnit(){this.dataUnitReady.emit(this.dataUnit)}async getDataUnit(){return new Promise((t=>{this.dataUnit?t(this.dataUnit):this._onDataUnitResolve.push(t)}))}async interceptAction(t){return new Promise((s=>{switch(t.type){case n.RECORDS_ADDED:this.isAllowed("INSERT")?s(t):o.info(this.getMessage("snkDataUnit.forbiddenInsert"));break;case n.RECORDS_COPIED:this.isAllowed("CLONE")?s(t):o.info(this.getMessage("snkDataUnit.forbiddenClone"));break;case n.DATA_CHANGED:case n.CHANGING_DATA:this.isAllowed("UPDATE")?s(t):(this.dataUnit.cancelEdition(),o.alert(this.getMessage("snkDataUnit.forbidden"),this.getMessage("snkDataUnit.forbiddenUpdate")));break;case n.SAVING_DATA:if(this.beforeSave){const i=this.beforeSave(this.dataUnit);i instanceof Promise?i.then((i=>s(i?t:void 0))):s(i?t:void 0)}else s(t);break;case n.DATA_SAVED:this.afterSave?this.afterSave(this.dataUnit):s(t);break;case n.EDITION_CANCELED:if(this.dataState.hasDirtyRecords){const i=this.getMessage("snkDataUnit.cancelConfirmation");if(null==i)s(t);else{const e=this.getMessage("snkDataUnit.cancelConfirmationTitle");o.confirm(e,i).then((i=>s(i?t:void 0)))}}else s(t);break;case n.REMOVING_RECORDS:if(this.isAllowed("REMOVE")){const i=this.getMessage("snkDataUnit.removeConfirmation");if(null==i)s(t);else{const e=this.getMessage("snkDataUnit.removeConfirmationTitle");o.confirm(e,i,"delete",r.CRITICAL,{btnConfirmDanger:!0}).then((i=>s(i?t:void 0)))}}else o.info(this.getMessage("snkDataUnit.forbiddenRemove"));break;default:s(t)}}))}showSuccessMessage(t){o.info(t,{iconName:"check"})}isAllowed(t){return!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getMessage(t,s){return s||(s=this.getMessageParams()),this._application.messagesBuilder.getMessage(t,s)}getMessageParams(){return this.dataState.selectedRecords?this.dataState.selectedRecords[0]:void 0}getMessageOperation(){return this.dataState.copyMode?c.CLONE:this.dataState.insertionMode?c.INSERT:this.dataState.isDirty?c.UPDATE:c.CLEAN}async loadDataUnit(){if(!this.dataUnit&&this._application&&this.entityName){const t=this.dataUnitName?this.dataUnitName:this.entityName;let s;for(this.dataUnit=await this._application.getDataUnit(this.entityName,t),this.dataUnit.pageSize=this.pageSize,this.dataUnit.unsubscribe(this._dataUnitObserver),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this._dataUnitObserver);s=this._onDataUnitResolve.pop();)s(this.dataUnit);this.autoLoad&&this.dataUnit.loadData()}}componentWillLoad(){this._application=h.getContextValue("__SNK__APPLICATION__"),this._application.getAllAccess().then((t=>this._permissions=t)),this.loadDataUnit()}render(){return i(a,null)}get element(){return e(this)}static get watchers(){return{pageSize:["observePageSize"],dataUnitName:["observeDataUnitName"],entityName:["observeEntityName"],dataState:["observeDataState"],dataUnit:["observeDataUnit"]}}};l.style=".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";export{l as snk_data_unit}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,h as e}from"./p-
|
|
1
|
+
import{r as a,h as e}from"./p-23c4c94f.js";import{DataUnit as r,DataType as o,UserInterface as i}from"@sankhyalabs/core";const s=class{constructor(e){a(this,e)}componentWillLoad(){this.dataUnit=new r("testes_com_formulario"),this.dataUnit.metadata={name:"dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",label:"Parceiro",fields:[{name:"CODPARC",label:"Parceiro",dataType:o.NUMBER,userInterface:i.SEARCH,required:!0,properties:{ENTITYNAME:"Parceiro"}}]}}render(){return e("snk-application",null,e("ez-form",{dataUnit:this.dataUnit}))}};s.style=":host{display:block}";export{s as teste_pesquisa}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as a,b as t}from"./p-
|
|
1
|
+
import{p as a,b as t}from"./p-23c4c94f.js";(()=>{const t=import.meta.url,e={};return""!==t&&(e.resourcesUrl=new URL(".",t).href),a(e)})().then((a=>t([["p-5327ba05",[[6,"snk-crud",{configName:[1,"config-name"],actionsList:[16],recordsValidator:[16],_dataUnit:[32],_dataState:[32]}]]],["p-bdeef7f2",[[1,"teste-pesquisa"]]],["p-92d6f826",[[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],autoLoad:[4,"auto-load"],getDataUnit:[64]}]]],["p-1ba29824",[[2,"snk-application",{messagesBuilder:[1040],isUserSup:[64],hasAccess:[64],getAllAccess:[64],getStringParam:[64],getIntParam:[64],getFloatParam:[64],getBooleanParam:[64],getDateParam:[64],showPopUp:[64],closePopUp:[64],temOpcional:[64],getConfig:[64],saveConfig:[64],getAttributeFromHTMLWrapper:[64],openApp:[64],createDataunit:[64],getDataUnit:[64],getResourceID:[64],alert:[64],error:[64],message:[64],confirm:[64],info:[64],loadFormConfig:[64],loadGridConfig:[64],loadTotals:[64],saveGridConfig:[64],executeSearch:[64],isDebugMode:[64]}]]],["p-4fa389bd",[[2,"snk-form",{configName:[1,"config-name"],recordsValidator:[16],actionsList:[16],_dataUnit:[32],_configLoaded:[32],_dataState:[32],_editionFormConfig:[32],_insertionFormConfig:[32]}],[6,"snk-grid",{configName:[1,"config-name"],actionsList:[16],_dataUnit:[32],_configLoaded:[32],_dataState:[32],_gridConfig:[32]}]]],["p-2266555e",[[2,"snk-pesquisa",{searchLoader:[16],selectItem:[16],argument:[1025],_itemList:[32],_startLoading:[32]}]]],["p-7a922fb4",[[6,"snk-taskbar",{buttons:[1],actionsList:[16],primaryButton:[1,"primary-button"],disabledButtons:[16],dataUnit:[16],_permissions:[32]}]]]],a)));
|
|
@@ -221,7 +221,8 @@ export declare type ErrorHandler = (err: any, element?: HTMLElement) => void;
|
|
|
221
221
|
*/
|
|
222
222
|
export declare const setMode: (handler: ResolutionHandler) => void;
|
|
223
223
|
/**
|
|
224
|
-
* getMode
|
|
224
|
+
* `getMode()` is used for libraries which provide multiple "modes" for styles.
|
|
225
|
+
* @param ref a reference to the node to get styles for
|
|
225
226
|
*/
|
|
226
227
|
export declare function getMode<T = string | undefined>(ref: any): T;
|
|
227
228
|
export declare function setPlatformHelpers(helpers: {
|
|
@@ -234,6 +235,8 @@ export declare function setPlatformHelpers(helpers: {
|
|
|
234
235
|
/**
|
|
235
236
|
* Get the base path to where the assets can be found. Use `setAssetPath(path)`
|
|
236
237
|
* if the path needs to be customized.
|
|
238
|
+
* @param path the path to use in calculating the asset path. this value will be
|
|
239
|
+
* used in conjunction with the base asset path
|
|
237
240
|
*/
|
|
238
241
|
export declare function getAssetPath(path: string): string;
|
|
239
242
|
/**
|
|
@@ -246,18 +249,22 @@ export declare function getAssetPath(path: string): string;
|
|
|
246
249
|
* `setAssetPath(document.currentScript.src)`, or using a bundler's replace plugin to
|
|
247
250
|
* dynamically set the path at build time, such as `setAssetPath(process.env.ASSET_PATH)`.
|
|
248
251
|
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
249
|
-
*
|
|
252
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
250
253
|
* will have to ensure the static assets are copied to its build directory.
|
|
254
|
+
* @param path the asset path to set
|
|
251
255
|
*/
|
|
252
256
|
export declare function setAssetPath(path: string): string;
|
|
253
257
|
/**
|
|
254
|
-
*
|
|
258
|
+
* Retrieve a Stencil element for a given reference
|
|
259
|
+
* @param ref the ref to get the Stencil element for
|
|
255
260
|
*/
|
|
256
261
|
export declare function getElement(ref: any): HTMLStencilElement;
|
|
257
262
|
/**
|
|
258
263
|
* Schedules a new render of the given instance or element even if no state changed.
|
|
259
264
|
*
|
|
260
|
-
* Notice `forceUpdate()` is not
|
|
265
|
+
* Notice `forceUpdate()` is not synchronous and might perform the DOM render in the next frame.
|
|
266
|
+
*
|
|
267
|
+
* @param ref the node/element to force the re-render of
|
|
261
268
|
*/
|
|
262
269
|
export declare function forceUpdate(ref: any): void;
|
|
263
270
|
/**
|
|
@@ -272,6 +279,8 @@ export interface HTMLStencilElement extends HTMLElement {
|
|
|
272
279
|
* in the best moment to perform DOM mutation without causing layout thrashing.
|
|
273
280
|
*
|
|
274
281
|
* For further information: https://developers.google.com/web/fundamentals/performance/rendering/avoid-large-complex-layouts-and-layout-thrashing
|
|
282
|
+
*
|
|
283
|
+
* @param task the DOM-write to schedule
|
|
275
284
|
*/
|
|
276
285
|
export declare function writeTask(task: RafCallback): void;
|
|
277
286
|
/**
|
|
@@ -279,6 +288,8 @@ export declare function writeTask(task: RafCallback): void;
|
|
|
279
288
|
* in the best moment to perform DOM reads without causing layout thrashing.
|
|
280
289
|
*
|
|
281
290
|
* For further information: https://developers.google.com/web/fundamentals/performance/rendering/avoid-large-complex-layouts-and-layout-thrashing
|
|
291
|
+
*
|
|
292
|
+
* @param task the DOM-read to schedule
|
|
282
293
|
*/
|
|
283
294
|
export declare function readTask(task: RafCallback): void;
|
|
284
295
|
/**
|
package/loader/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sankhyalabs/sankhyablocks",
|
|
3
|
-
"version": "1.3.31-beta.
|
|
3
|
+
"version": "1.3.31-beta.16",
|
|
4
4
|
"description": "Stencil Component Starter",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@babel/preset-env": "^7.18.2",
|
|
39
|
-
"@sankhyalabs/core": "^1.0.71-beta.
|
|
40
|
-
"@sankhyalabs/ezui": "^1.
|
|
39
|
+
"@sankhyalabs/core": "^1.0.71-beta.8",
|
|
40
|
+
"@sankhyalabs/ezui": "^1.2.0-beta.6",
|
|
41
41
|
"@sankhyalabs/skippeerdeps": "^1.0.2",
|
|
42
42
|
"@semantic-release/git": "^9.0.0",
|
|
43
43
|
"@semantic-release/gitlab": "^6.1.0",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"verbose": true
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@sankhyalabs/core": "^1.0.71-beta.
|
|
64
|
-
"@sankhyalabs/ezui": "^1.
|
|
63
|
+
"@sankhyalabs/core": "^1.0.71-beta.8",
|
|
64
|
+
"@sankhyalabs/ezui": "^1.2.0-beta.6"
|
|
65
65
|
},
|
|
66
66
|
"license": "MIT"
|
|
67
67
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={saveInfo:{clone:"Duplicação realizada!",insert:"Inclusão realizada!",update:"Aleração realizada!"},cancelInfo:{clone:"Duplicação descartada!",insert:"A inclusão descartada!",update:"A edição foi descartada!"},removeInfo:"Registro removido com sucesso!",cancelConfirmationTitle:"Aviso",cancelConfirmation:"As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de cancelar?",removeConfirmationTitle:"Excluir",removeConfirmation:"Deseja realmente excluir o registro atual?",forbiddenUpdate:"Não é possível fazer alterações. Verifique as permissões de acesso.",forbiddenInsert:"Não é possível incluir. Verifique as permissões de acesso.",forbiddenClone:"Não é possível duplicar. Verifique as permissões de acesso.",forbiddenRemove:"Não é possível remover. Verifique as permissões de acesso."},s={title:{clone:"Duplicar registro",insert:"Cadastrar registro",update:"Alterar registro",clean:"{{ENTITY_NAME}}"},goBackTitle:"Voltar"},r={titleUpdate:"Editar",titlePrevious:"Anterior",titleNext:"Próximo",titleRefresh:"Atualizar",titleClone:"Duplicar",titleRemove:"Excluir",titleMoreOptions:"Mais Opções",titleInsert:"Cadastrar",titleCancel:"Cancelar",titleSave:"Salvar",titleGridMode:"Modo Grade",titleFormMode:"Modo Formulário",titleConfigGrid:"Configuração da grade",forbidden:"Permissão não liberada"};class a{constructor(){this._defaults={snkDataUnit:e,snkForm:s,snkTaskbar:r},this._currentOperation=i.CLEAN,this.loadAppMessages().then((e=>{this._appMessages=e}),(e=>{console.info("O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages.js",e)}))}set currentOperation(e){this._currentOperation=e}getMessage(e,s){if(null==e)return;var r=e.split(".");let a=this.resolveMessage(r,this._appMessages);if(null==a&&(a=this.resolveMessage(r,this._defaults)),this.customMessageBuilder){const r=this.customMessageBuilder(e,a,s);a=r.message,s=r.params}return this.postProcess(a,s)}resolveMessage(e,s){if(null==s)return;const r=s[e[0]];return r?this.isOperationSensitive(r)?r[this._currentOperation]:1===e.length||null==r||"string"==typeof r?r:this.resolveMessage(e.slice(1),r):void 0}isOperationSensitive(e){return null!=e[i.CLONE]||null!=e[i.INSERT]||null!=e[i.UPDATE]||null!=e[i.CLEAN]}postProcess(e,s){if(e){const r=/(.*?)\{\{(.+?)\}\}/g;let a,i="",t=e;for(;null!==(a=r.exec(e));){const[r,o,n]=a,l=a.index+r.length;t=l<e.length?e.substring(l):"";let d=s?s[n]:void 0;null==d&&(d=""),i+=o+d}return i+t}return e}loadAppMessages(){return new Promise(((e,s)=>{const r="dev"!==window.applicationenv?`/${window.MGE_MODULE_NAME}/labsApps/${window.APPLICATION_NAME}/messages/appmessages.js`:"/messages/appmessages.js";import(r).then((s=>{e(s.default)})).catch((e=>{s(e)}))}))}}var i;!function(e){e.CLONE="clone",e.INSERT="insert",e.UPDATE="update",e.CLEAN="clean"}(i||(i={}));export{i as O,a as S}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
let e,t,l,n=!1,s=!1,o=!1,i=!1;const c="undefined"!=typeof window?window:{},r=c.document||{head:{}},f={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,l,n)=>e.addEventListener(t,l,n),rel:(e,t,l,n)=>e.removeEventListener(t,l,n),ce:(e,t)=>new CustomEvent(e,t)},a=e=>Promise.resolve(e),u=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),$=new WeakMap,d=e=>"sc-"+e.o,h={},b=e=>"object"==(e=typeof e)||"function"===e,m=(e,t,...l)=>{let n=null,s=null,o=null,i=!1,c=!1;const r=[],f=t=>{for(let l=0;l<t.length;l++)n=t[l],Array.isArray(n)?f(n):null!=n&&"boolean"!=typeof n&&((i="function"!=typeof e&&!b(n))&&(n+=""),i&&c?r[r.length-1].i+=n:r.push(i?y(null,n):n),c=i)};if(f(l),t){t.key&&(s=t.key),t.name&&(o=t.name);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const a=y(e,null);return a.u=t,r.length>0&&(a.$=r),a.h=s,a.m=o,a},y=(e,t)=>({t:0,p:e,i:t,k:null,$:null,u:null,h:null,m:null}),p={},w=(e,t,l,n,s,o)=>{if(l!==n){let i=le(e,t),r=t.toLowerCase();if("class"===t){const t=e.classList,s=S(l),o=S(n);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else if("key"===t);else if("ref"===t)n&&n(e);else if(i||"o"!==t[0]||"n"!==t[1]){const c=b(n);if((i||c&&null!==n)&&!s)try{if(e.tagName.includes("-"))e[t]=n;else{const s=null==n?"":n;"list"===t?i=!1:null!=l&&e[t]==s||(e[t]=s)}}catch(e){}null==n||!1===n?!1===n&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&o||s)&&!c&&e.setAttribute(t,n=!0===n?"":n)}else t="-"===t[2]?t.slice(3):le(c,r)?r.slice(2):r[2]+t.slice(3),l&&f.rel(e,t,l,!1),n&&f.ael(e,t,n,!1)}},k=/\s/,S=e=>e?e.split(k):[],g=(e,t,l,n)=>{const s=11===t.k.nodeType&&t.k.host?t.k.host:t.k,o=e&&e.u||h,i=t.u||h;for(n in o)n in i||w(s,n,o[n],void 0,l,t.t);for(n in i)w(s,n,o[n],i[n],l,t.t)},j=(s,i,c,f)=>{const a=i.$[c];let u,$,d,h=0;if(n||(o=!0,"slot"===a.p&&(e&&f.classList.add(e+"-s"),a.t|=a.$?2:1)),null!==a.i)u=a.k=r.createTextNode(a.i);else if(1&a.t)u=a.k=r.createTextNode("");else if(u=a.k=r.createElement(2&a.t?"slot-fb":a.p),g(null,a,!1),null!=e&&u["s-si"]!==e&&u.classList.add(u["s-si"]=e),a.$)for(h=0;h<a.$.length;++h)$=j(s,a,h,u),$&&u.appendChild($);return u["s-hn"]=l,3&a.t&&(u["s-sr"]=!0,u["s-cr"]=t,u["s-sn"]=a.m||"",d=s&&s.$&&s.$[c],d&&d.p===a.p&&s.k&&v(s.k,!1)),u},v=(e,t)=>{f.t|=1;const n=e.childNodes;for(let e=n.length-1;e>=0;e--){const s=n[e];s["s-hn"]!==l&&s["s-ol"]&&(P(s).insertBefore(s,R(s)),s["s-ol"].remove(),s["s-ol"]=void 0,o=!0),t&&v(s,t)}f.t&=-2},C=(e,t,n,s,o,i)=>{let c,r=e["s-cr"]&&e["s-cr"].parentNode||e;for(r.shadowRoot&&r.tagName===l&&(r=r.shadowRoot);o<=i;++o)s[o]&&(c=j(null,n,o,e),c&&(s[o].k=c,r.insertBefore(c,R(t))))},M=(e,t,l,n,o)=>{for(;t<=l;++t)(n=e[t])&&(o=n.k,E(n),s=!0,o["s-ol"]?o["s-ol"].remove():v(o,!0),o.remove())},O=(e,t)=>e.p===t.p&&("slot"===e.p?e.m===t.m:e.h===t.h),R=e=>e&&e["s-ol"]||e,P=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,T=(e,t)=>{const l=t.k=e.k,n=e.$,s=t.$,o=t.i;let i;null===o?("slot"===t.p||g(e,t,!1),null!==n&&null!==s?((e,t,l,n)=>{let s,o,i=0,c=0,r=0,f=0,a=t.length-1,u=t[0],$=t[a],d=n.length-1,h=n[0],b=n[d];for(;i<=a&&c<=d;)if(null==u)u=t[++i];else if(null==$)$=t[--a];else if(null==h)h=n[++c];else if(null==b)b=n[--d];else if(O(u,h))T(u,h),u=t[++i],h=n[++c];else if(O($,b))T($,b),$=t[--a],b=n[--d];else if(O(u,b))"slot"!==u.p&&"slot"!==b.p||v(u.k.parentNode,!1),T(u,b),e.insertBefore(u.k,$.k.nextSibling),u=t[++i],b=n[--d];else if(O($,h))"slot"!==u.p&&"slot"!==b.p||v($.k.parentNode,!1),T($,h),e.insertBefore($.k,u.k),$=t[--a],h=n[++c];else{for(r=-1,f=i;f<=a;++f)if(t[f]&&null!==t[f].h&&t[f].h===h.h){r=f;break}r>=0?(o=t[r],o.p!==h.p?s=j(t&&t[c],l,r,e):(T(o,h),t[r]=void 0,s=o.k),h=n[++c]):(s=j(t&&t[c],l,c,e),h=n[++c]),s&&P(u.k).insertBefore(s,R(u.k))}i>a?C(e,null==n[d+1]?null:n[d+1].k,l,n,c,d):c>d&&M(t,i,a)})(l,n,t,s):null!==s?(null!==e.i&&(l.textContent=""),C(l,null,t,s,0,s.length-1)):null!==n&&M(n,0,n.length-1)):(i=l["s-cr"])?i.parentNode.textContent=o:e.i!==o&&(l.data=o)},L=e=>{const t=e.childNodes;let l,n,s,o,i,c;for(n=0,s=t.length;n<s;n++)if(l=t[n],1===l.nodeType){if(l["s-sr"])for(i=l["s-sn"],l.hidden=!1,o=0;o<s;o++)if(c=t[o].nodeType,t[o]["s-hn"]!==l["s-hn"]||""!==i){if(1===c&&i===t[o].getAttribute("slot")){l.hidden=!0;break}}else if(1===c||3===c&&""!==t[o].textContent.trim()){l.hidden=!0;break}L(l)}},N=[],W=e=>{let t,l,n,o,i,c,r=0;const f=e.childNodes,a=f.length;for(;r<a;r++){if(t=f[r],t["s-sr"]&&(l=t["s-cr"])&&l.parentNode)for(n=l.parentNode.childNodes,o=t["s-sn"],c=n.length-1;c>=0;c--)l=n[c],l["s-cn"]||l["s-nr"]||l["s-hn"]===t["s-hn"]||(x(l,o)?(i=N.find((e=>e.S===l)),s=!0,l["s-sn"]=l["s-sn"]||o,i?i.g=t:N.push({g:t,S:l}),l["s-sr"]&&N.map((e=>{x(e.S,l["s-sn"])&&(i=N.find((e=>e.S===l)),i&&!e.g&&(e.g=i.g))}))):N.some((e=>e.S===l))||N.push({S:l}));1===t.nodeType&&W(t)}},x=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,E=e=>{e.u&&e.u.ref&&e.u.ref(null),e.$&&e.$.map(E)},A=e=>Z(e).j,F=(e,t,l)=>{const n=A(e);return{emit:e=>H(n,t,{bubbles:!!(4&l),composed:!!(2&l),cancelable:!!(1&l),detail:e})}},H=(e,t,l)=>{const n=f.ce(t,l);return e.dispatchEvent(n),n},U=(e,t)=>{t&&!e.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.v=t)))},q=(e,t)=>{if(e.t|=16,!(4&e.t))return U(e,e.C),de((()=>D(e,t)));e.t|=512},D=(e,t)=>{const l=e.M;let n;return t&&(n=G(l,"componentWillLoad")),n=I(n,(()=>G(l,"componentWillRender"))),I(n,(()=>V(e,l,t)))},V=async(e,t,l)=>{const n=e.j,s=n["s-rc"];l&&(e=>{const t=e.O,l=e.j,n=t.t,s=((e,t)=>{let l=d(t);const n=ie.get(l);if(e=11===e.nodeType?e:r,n)if("string"==typeof n){let t,s=$.get(e=e.head||e);s||$.set(e,s=new Set),s.has(l)||(t=r.createElement("style"),t.innerHTML=n,e.insertBefore(t,e.querySelector("link")),s&&s.add(l))}else e.adoptedStyleSheets.includes(n)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]);return l})(l.shadowRoot?l.shadowRoot:l.getRootNode(),t);10&n&&(l["s-sc"]=s,l.classList.add(s+"-h"),2&n&&l.classList.add(s+"-s"))})(e);_(e,t),s&&(s.map((e=>e())),n["s-rc"]=void 0);{const t=n["s-p"],l=()=>z(e);0===t.length?l():(Promise.all(t).then(l),e.t|=4,t.length=0)}},_=(i,c)=>{try{c=c.render(),i.t&=-17,i.t|=2,((i,c)=>{const a=i.j,u=i.O,$=i.R||y(null,null),d=(e=>e&&e.p===p)(c)?c:m(null,null,c);if(l=a.tagName,d.p=null,d.t|=4,i.R=d,d.k=$.k=a.shadowRoot||a,e=a["s-sc"],t=a["s-cr"],n=0!=(1&u.t),s=!1,T($,d),f.t|=1,o){let e,t,l,n,s,o;W(d.k);let i=0;for(;i<N.length;i++)e=N[i],t=e.S,t["s-ol"]||(l=r.createTextNode(""),l["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=l,t));for(i=0;i<N.length;i++)if(e=N[i],t=e.S,e.g){for(n=e.g.parentNode,s=e.g.nextSibling,l=t["s-ol"];l=l.previousSibling;)if(o=l["s-nr"],o&&o["s-sn"]===t["s-sn"]&&n===o.parentNode&&(o=o.nextSibling,!o||!o["s-nr"])){s=o;break}(!s&&n!==t.parentNode||t.nextSibling!==s)&&t!==s&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),n.insertBefore(t,s))}else 1===t.nodeType&&(t.hidden=!0)}s&&L(d.k),f.t&=-2,N.length=0})(i,c)}catch(e){ne(e,i.j)}return null},z=e=>{const t=e.j,l=e.M,n=e.C;64&e.t||(e.t|=64,J(t),G(l,"componentDidLoad"),e.P(t),n||B()),e.T(t),e.v&&(e.v(),e.v=void 0),512&e.t&&$e((()=>q(e,!1))),e.t&=-517},B=()=>{J(r.documentElement),$e((()=>H(c,"appload",{detail:{namespace:"sankhyablocks"}})))},G=(e,t,l)=>{if(e&&e[t])try{return e[t](l)}catch(e){ne(e)}},I=(e,t)=>e&&e.then?e.then(t):t(),J=e=>e.classList.add("hydrated"),K=(e,t,l)=>{if(t.L){e.watchers&&(t.N=e.watchers);const n=Object.entries(t.L),s=e.prototype;if(n.map((([e,[n]])=>{31&n||2&l&&32&n?Object.defineProperty(s,e,{get(){return((e,t)=>Z(this).W.get(t))(0,e)},set(l){((e,t,l,n)=>{const s=Z(e),o=s.j,i=s.W.get(t),c=s.t,r=s.M;if(l=((e,t)=>null==e||b(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(l,n.L[t][0]),(!(8&c)||void 0===i)&&l!==i&&(!Number.isNaN(i)||!Number.isNaN(l))&&(s.W.set(t,l),r)){if(n.N&&128&c){const e=n.N[t];e&&e.map((e=>{try{r[e](l,i,t)}catch(e){ne(e,o)}}))}2==(18&c)&&q(s,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0}):1&l&&64&n&&Object.defineProperty(s,e,{value(...t){const l=Z(this);return l.A.then((()=>l.M[e](...t)))}})})),1&l){const t=new Map;s.attributeChangedCallback=function(e,l,n){f.jmp((()=>{const l=t.get(e);if(this.hasOwnProperty(l))n=this[l],delete this[l];else if(s.hasOwnProperty(l)&&"number"==typeof this[l]&&this[l]==n)return;this[l]=(null!==n||"boolean"!=typeof this[l])&&n}))},e.observedAttributes=n.filter((([e,t])=>15&t[0])).map((([e,l])=>{const n=l[1]||e;return t.set(n,e),n}))}}return e},Q=e=>{G(e,"connectedCallback")},X=(e,t={})=>{const l=[],n=t.exclude||[],s=c.customElements,o=r.head,i=o.querySelector("meta[charset]"),a=r.createElement("style"),$=[];let h,b=!0;Object.assign(f,t),f.l=new URL(t.resourcesUrl||"./",r.baseURI).href,e.map((e=>{e[1].map((t=>{const o={t:t[0],o:t[1],L:t[2],F:t[3]};o.L=t[2],o.N={};const i=o.o,c=class extends HTMLElement{constructor(e){super(e),te(e=this,o),1&o.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),b?$.push(this):f.jmp((()=>(e=>{if(0==(1&f.t)){const t=Z(e),l=t.O,n=()=>{};if(1&t.t)Q(t.M);else{t.t|=1,12&l.t&&(e=>{const t=e["s-cr"]=r.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let l=e;for(;l=l.parentNode||l.host;)if(l["s-p"]){U(t,t.C=l);break}}l.L&&Object.entries(l.L).map((([t,[l]])=>{if(31&l&&e.hasOwnProperty(t)){const l=e[t];delete e[t],e[t]=l}})),(async(e,t,l,n,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=oe(l)).then){const e=()=>{};s=await s,e()}s.isProxied||(l.N=s.watchers,K(s,l,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){ne(e)}t.t&=-9,t.t|=128,e(),Q(t.M)}if(s.style){let e=s.style;const t=d(l);if(!ie.has(t)){const n=()=>{};((e,t,l)=>{let n=ie.get(e);u&&l?(n=n||new CSSStyleSheet,n.replace(t)):n=t,ie.set(e,n)})(t,e,!!(1&l.t)),n()}}}const o=t.C,i=()=>q(t,!0);o&&o["s-rc"]?o["s-rc"].push(i):i()})(0,t,l)}n()}})(this)))}disconnectedCallback(){f.jmp((()=>(()=>{0==(1&f.t)&&G(Z(this).M,"disconnectedCallback")})()))}componentOnReady(){return Z(this).H}};o.U=e[0],n.includes(i)||s.get(i)||(l.push(i),s.define(i,K(c,o,1)))}))})),a.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",a.setAttribute("data-styles",""),o.insertBefore(a,i?i.nextSibling:o.firstChild),b=!1,$.length?$.map((e=>e.connectedCallback())):f.jmp((()=>h=setTimeout(B,30)))},Y=new WeakMap,Z=e=>Y.get(e),ee=(e,t)=>Y.set(t.M=e,t),te=(e,t)=>{const l={t:0,j:e,O:t,W:new Map};return l.A=new Promise((e=>l.T=e)),l.H=new Promise((e=>l.P=e)),e["s-p"]=[],e["s-rc"]=[],Y.set(e,l)},le=(e,t)=>t in e,ne=(e,t)=>(0,console.error)(e,t),se=new Map,oe=e=>{const t=e.o.replace(/-/g,"_"),l=e.U,n=se.get(l);return n?n[t]:import(`./${l}.entry.js`).then((e=>(se.set(l,e),e[t])),ne)
|
|
2
|
-
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/},ie=new Map,ce=[],re=[],fe=(e,t)=>l=>{e.push(l),i||(i=!0,t&&4&f.t?$e(ue):f.raf(ue))},ae=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){ne(e)}e.length=0},ue=()=>{ae(ce),ae(re),(i=ce.length>0)&&f.raf(ue)},$e=e=>a().then(e),de=fe(re,!0);export{p as H,X as b,F as c,A as g,m as h,a as p,ee as r}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as s,h as i,g as e,H as a}from"./p-cd1dc099.js";import{Action as n,ApplicationContext as h}from"@sankhyalabs/core";import{ApplicationUtils as o,DialogType as r}from"@sankhyalabs/ezui/dist/collection/utils";import{O as c}from"./p-ab694dbc.js";const l=class{constructor(i){t(this,i),this.dataStateChange=s(this,"dataStateChange",7),this.dataUnitReady=s(this,"dataUnitReady",7),this.insertionMode=s(this,"insertionMode",7),this.cancelEdition=s(this,"cancelEdition",7),this._onDataUnitResolve=[],this.pageSize=150,this.autoLoad=!0,this._dataUnitObserver=t=>{const s={insertionMode:!1,hasNext:this.dataUnit.hasNext(),hasPrevious:this.dataUnit.hasPrevious(),copyMode:!1,isDirty:this.dataUnit.isDirty(),hasDirtyRecords:this.dataUnit.hasDirtyRecords(),selectedRecords:this.dataUnit.getSelectedRecords()};if(this.dataUnit.records.forEach((t=>{t.__record__id__.startsWith("NEW_")&&(s.insertionMode=!0,s.copyMode||(s.copyMode=null!=t.__record__source__id__))})),this.dataState=s,t.type===n.DATA_SAVED){const s=this.getMessage("snkDataUnit.saveInfo",t.payload.records[0]);null!=s&&this.showSuccessMessage(s)}if(t.type!==n.RECORDS_ADDED&&t.type!==n.RECORDS_COPIED||this.insertionMode.emit(),t.type===n.EDITION_CANCELED){this.cancelEdition.emit();const t=this.getMessage("snkDataUnit.cancelInfo");null!=t&&this.showSuccessMessage(t)}if(t.type===n.RECORDS_REMOVED){const s=this.getMessage("snkDataUnit.removeInfo",t.payload.cachedRecords[0]);null!=s&&this.showSuccessMessage(s)}this._application.messagesBuilder.currentOperation=this.getMessageOperation()}}observePageSize(){this.dataUnit&&(this.dataUnit.pageSize=this.pageSize)}observeDataUnitName(t,s){s!=t&&(this.dataUnit=void 0,this.dataUnitName=t,this.loadDataUnit())}observeEntityName(t,s){s!=t&&(this.dataUnit=void 0,this.entityName=t,this.loadDataUnit())}observeDataState(t,s){s!=t&&this.dataStateChange.emit(t)}observeDataUnit(){this.dataUnitReady.emit(this.dataUnit)}async getDataUnit(){return new Promise((t=>{this.dataUnit?t(this.dataUnit):this._onDataUnitResolve.push(t)}))}async interceptAction(t){return new Promise((s=>{switch(t.type){case n.RECORDS_ADDED:this.isAllowed("INSERT")?s(t):o.info(this.getMessage("snkDataUnit.forbiddenInsert"));break;case n.RECORDS_COPIED:this.isAllowed("CLONE")?s(t):o.info(this.getMessage("snkDataUnit.forbiddenClone"));break;case n.DATA_CHANGED:case n.CHANGING_DATA:this.isAllowed("UPDATE")?s(t):(this.dataUnit.cancelEdition(),o.info(this.getMessage("snkDataUnit.forbiddenUpdate")));break;case n.SAVING_DATA:if(this.beforeSave){const i=this.beforeSave(this.dataUnit);i instanceof Promise?i.then((i=>s(i?t:void 0))):s(i?t:void 0)}else s(t);break;case n.DATA_SAVED:this.afterSave?this.afterSave(this.dataUnit):s(t);break;case n.EDITION_CANCELED:if(this.dataState.hasDirtyRecords){const i=this.getMessage("snkDataUnit.cancelConfirmation");if(null==i)s(t);else{const e=this.getMessage("snkDataUnit.cancelConfirmationTitle");o.confirm(e,i).then((i=>s(i?t:void 0)))}}else s(t);break;case n.REMOVING_RECORDS:if(this.isAllowed("REMOVE")){const i=this.getMessage("snkDataUnit.removeConfirmation");if(null==i)s(t);else{const e=this.getMessage("snkDataUnit.removeConfirmationTitle");o.confirm(e,i,"delete",r.CRITICAL,{btnConfirmDanger:!0}).then((i=>s(i?t:void 0)))}}else o.info(this.getMessage("snkDataUnit.forbiddenRemove"));break;default:s(t)}}))}showSuccessMessage(t){o.info(t,{iconName:"check"})}isAllowed(t){return!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getMessage(t,s){return s||(s=this.getMessageParams()),this._application.messagesBuilder.getMessage(t,s)}getMessageParams(){return this.dataState.selectedRecords?this.dataState.selectedRecords[0]:void 0}getMessageOperation(){return this.dataState.copyMode?c.CLONE:this.dataState.insertionMode?c.INSERT:this.dataState.isDirty?c.UPDATE:c.CLEAN}async loadDataUnit(){if(!this.dataUnit&&this._application&&this.entityName){const t=this.dataUnitName?this.dataUnitName:this.entityName;let s;for(this.dataUnit=await this._application.getDataUnit(this.entityName,t),this.dataUnit.pageSize=this.pageSize,this.dataUnit.unsubscribe(this._dataUnitObserver),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this._dataUnitObserver);s=this._onDataUnitResolve.pop();)s(this.dataUnit);this.autoLoad&&this.dataUnit.loadData()}}componentWillLoad(){this._application=h.getContextValue("__SNK__APPLICATION__"),this._application.getAllAccess().then((t=>this._permissions=t)),this.loadDataUnit()}render(){return i(a,null)}get element(){return e(this)}static get watchers(){return{pageSize:["observePageSize"],dataUnitName:["observeDataUnitName"],entityName:["observeEntityName"],dataState:["observeDataState"],dataUnit:["observeDataUnit"]}}};l.style=".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";export{l as snk_data_unit}
|