@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-49448.0 → 0.0.0-bugfix-dev-KB-50122.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.
Files changed (86) hide show
  1. package/dist/cjs/{ConfigStorage-34be11ce.js → ConfigStorage-8d4e9d53.js} +1 -1
  2. package/dist/cjs/{SnkFormConfigManager-6211fb28.js → SnkFormConfigManager-33995e92.js} +16 -13
  3. package/dist/cjs/{SnkMultiSelectionListDataSource-5213120b.js → SnkMultiSelectionListDataSource-1438f8f2.js} +1 -1
  4. package/dist/cjs/{auth-fetcher-5161d082.js → auth-fetcher-bb8e9ae4.js} +1 -1
  5. package/dist/cjs/{form-config-fetcher-9f1a13ca.js → form-config-fetcher-d73f4449.js} +12 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  8. package/dist/cjs/snk-actions-button_4.cjs.entry.js +2 -2
  9. package/dist/cjs/snk-application.cjs.entry.js +3 -3
  10. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  11. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
  13. package/dist/cjs/snk-filter-bar.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -2
  15. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  16. package/dist/cjs/snk-form.cjs.entry.js +3 -3
  17. package/dist/cjs/snk-grid.cjs.entry.js +4 -7
  18. package/dist/cjs/{snk-guides-viewer-508bb6fe.js → snk-guides-viewer-25721856.js} +2 -2
  19. package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
  20. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -2
  21. package/dist/cjs/snk-simple-crud.cjs.entry.js +85 -48
  22. package/dist/cjs/snk-taskbar.cjs.entry.js +24 -2
  23. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +14 -11
  24. package/dist/collection/components/snk-grid/snk-grid.js +1 -4
  25. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +119 -45
  26. package/dist/collection/components/snk-taskbar/snk-taskbar.js +28 -2
  27. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +12 -0
  28. package/dist/components/SnkFormConfigManager.js +14 -11
  29. package/dist/components/form-config-fetcher.js +12 -0
  30. package/dist/components/snk-grid2.js +1 -4
  31. package/dist/components/snk-simple-crud2.js +84 -45
  32. package/dist/components/snk-taskbar2.js +27 -3
  33. package/dist/esm/{ConfigStorage-101a2b4c.js → ConfigStorage-6e241cd7.js} +1 -1
  34. package/dist/esm/{SnkFormConfigManager-d86ba46f.js → SnkFormConfigManager-7a4e678f.js} +16 -13
  35. package/dist/esm/{SnkMultiSelectionListDataSource-7e7eada5.js → SnkMultiSelectionListDataSource-aad5d4ff.js} +1 -1
  36. package/dist/esm/{auth-fetcher-17dc5b5e.js → auth-fetcher-8ec448b0.js} +1 -1
  37. package/dist/esm/{form-config-fetcher-f121f880.js → form-config-fetcher-765b8498.js} +12 -0
  38. package/dist/esm/loader.js +1 -1
  39. package/dist/esm/sankhyablocks.js +1 -1
  40. package/dist/esm/snk-actions-button_4.entry.js +2 -2
  41. package/dist/esm/snk-application.entry.js +3 -3
  42. package/dist/esm/snk-attach.entry.js +2 -2
  43. package/dist/esm/snk-crud.entry.js +2 -2
  44. package/dist/esm/snk-detail-view.entry.js +4 -4
  45. package/dist/esm/snk-filter-bar.entry.js +2 -2
  46. package/dist/esm/snk-filter-modal-item.entry.js +2 -2
  47. package/dist/esm/snk-form-config.entry.js +1 -1
  48. package/dist/esm/snk-form.entry.js +3 -3
  49. package/dist/esm/snk-grid.entry.js +4 -7
  50. package/dist/esm/{snk-guides-viewer-18859840.js → snk-guides-viewer-b94752f2.js} +2 -2
  51. package/dist/esm/snk-guides-viewer.entry.js +4 -4
  52. package/dist/esm/snk-personalized-filter.entry.js +2 -2
  53. package/dist/esm/snk-simple-crud.entry.js +85 -48
  54. package/dist/esm/snk-taskbar.entry.js +24 -2
  55. package/dist/sankhyablocks/p-004c356e.js +26 -0
  56. package/dist/sankhyablocks/{p-5c0b53ce.js → p-0624f62d.js} +1 -1
  57. package/dist/sankhyablocks/{p-d01ceda6.entry.js → p-0bba5c9f.entry.js} +1 -1
  58. package/dist/sankhyablocks/{p-64c1b368.entry.js → p-1048bd26.entry.js} +1 -1
  59. package/dist/sankhyablocks/p-125bb902.js +1 -0
  60. package/dist/sankhyablocks/{p-7ddd95b6.entry.js → p-24ed6ad6.entry.js} +1 -1
  61. package/dist/sankhyablocks/{p-1f3174cb.entry.js → p-2d919e32.entry.js} +1 -1
  62. package/dist/sankhyablocks/{p-1fa5a18c.entry.js → p-400097f2.entry.js} +1 -1
  63. package/dist/sankhyablocks/{p-2897fb8c.js → p-6c9adfca.js} +1 -1
  64. package/dist/sankhyablocks/{p-b41a622a.entry.js → p-85ba3d6b.entry.js} +1 -1
  65. package/dist/sankhyablocks/{p-5dbc1a3f.js → p-88b29791.js} +1 -1
  66. package/dist/sankhyablocks/{p-ba4871b5.entry.js → p-9e8618ec.entry.js} +1 -1
  67. package/dist/sankhyablocks/p-a043314f.entry.js +1 -0
  68. package/dist/sankhyablocks/{p-7f97fee2.entry.js → p-a1642e7c.entry.js} +1 -1
  69. package/dist/sankhyablocks/{p-6b28cc74.entry.js → p-ac77949b.entry.js} +1 -1
  70. package/dist/sankhyablocks/p-b10b9934.entry.js +1 -0
  71. package/dist/sankhyablocks/{p-b4de81ac.entry.js → p-b47c2963.entry.js} +1 -1
  72. package/dist/sankhyablocks/{p-7e05bd83.entry.js → p-bf39bdb8.entry.js} +1 -1
  73. package/dist/sankhyablocks/{p-e4fb3308.entry.js → p-d5cb4b5a.entry.js} +1 -1
  74. package/dist/sankhyablocks/{p-60fa6c7a.js → p-efeca7ba.js} +1 -1
  75. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  76. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +1 -1
  77. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -1
  78. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +17 -6
  79. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -0
  80. package/dist/types/components.d.ts +16 -0
  81. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +2 -0
  82. package/package.json +1 -1
  83. package/dist/sankhyablocks/p-42ea9a35.entry.js +0 -1
  84. package/dist/sankhyablocks/p-50783a8b.js +0 -1
  85. package/dist/sankhyablocks/p-a13ccb86.js +0 -26
  86. package/dist/sankhyablocks/p-d304659d.entry.js +0 -1
@@ -1,26 +0,0 @@
1
- import{d as e,D as s}from"./p-be75153c.js";import{ObjectUtils as t}from"@sankhyalabs/core";class r{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchResource",e.gql`query($name: String!) {
2
- $queryAlias$: fetchResource(name: $name){
3
- resource
4
- }
5
- }`),this.templateByQuery.set("saveResource",e.gql`mutation($resource: InputResource!) {
6
- $queryAlias$: saveResource(resource: $resource){
7
- name
8
- resource
9
- }
10
- }`)}loadResource(e){if(r._loadingResource.has(e))return r._loadingResource.get(e);const t=new Promise(((t,n)=>{s.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchResource")}).then((s=>{t(null==s?void 0:s.resource),r._loadingResource.delete(e)})).catch((s=>{n(s),r._loadingResource.delete(e)}))}));return r._loadingResource.set(e,t),t}saveResource(e,t){return new Promise(((r,n)=>{s.get().callGraphQL({values:{resource:{name:t,resource:JSON.stringify(e)}},query:this.templateByQuery.get("saveResource")}).then((e=>{r(e)})).catch((e=>{n(e)}))}))}}r._loadingResource=new Map;class n extends r{constructor(){super(),this.queryConfig=new Map,this.buildTemplatesConfig()}buildTemplatesConfig(){this.queryConfig.set("fetchUserAvailableConfigs",e.gql`query($name: String!) {
11
- $queryAlias$: fetchUserAvailableConfigs(name: $name){
12
- name
13
- origin
14
- key
15
- }
16
- }`),this.queryConfig.set("fetchLegacyConfig",e.gql`query($name: String!) {
17
- $queryAlias$: fetchLegacyConfig(name: $name){
18
- name
19
- resource
20
- }
21
- }`),this.queryConfig.set("fetchDefaultConfig",e.gql`query($name: String!) {
22
- $queryAlias$: fetchDefaultConfig(name: $name){
23
- name
24
- resource
25
- }
26
- }`)}loadFormConfig(e,s){return new Promise(((t,r)=>{Promise.all([this.loadResource(this.getPath(s,e)),this.loadResource(this.getPath(`FormCardState:${s}`,e,"form-card")),this.loadResource(this.getPath(s,e,"summary")),this.loadResource(this.getPath(s,e,"defaultValues"))]).then((([e,s,r,n])=>{let a;if(null!=e){a=Object.assign(Object.assign({},JSON.parse(e)),{emptyConfig:!1});const{tabs:s,fields:t}=a;if(s){const e=new Map(s.map((e=>[e.label,e])));null==t||t.forEach((s=>{var t;return s.tab=(null===(t=e.get(this.getTabName(s.tab)))||void 0===t?void 0:t.label)||e.get(this.getTabName(s.tab))}))}a.fields=null==t?void 0:t.map((e=>{if("readonly"in e){const s=!0===e.readonly;delete e.readonly,e.readOnly=s}return e}))}null!=s&&(null==a&&(a={emptyConfig:!0,fields:[]}),a.cardsState=new Map(JSON.parse(s))),null!=r&&(null==a&&(a={emptyConfig:!0,fields:[]}),a.summary=new Map(Object.entries(JSON.parse(r)))),null!=n&&(null==a&&(a={emptyConfig:!0,fields:[]}),a.defaultVars=new Map(Object.entries(JSON.parse(n)))),t(a)})).catch((e=>{r(e)}))}))}getTabName(e){return"object"==typeof e?e.label:e}saveCardState(e,s,t){const r=this.getPath(`FormCardState:${t}`,s,"form-card");return new Promise(((s,t)=>{this.saveResource(Array.from(e.entries()),r).then((e=>{s(new Map(JSON.parse(e.resource)))})).catch((e=>{t(e)}))}))}saveConfig(e,s,t){delete e.cardsState,delete e.defaultVars,delete e.summary;const r=this.getPath(t,s);return new Promise(((s,t)=>{this.saveResource(e,r).then((e=>{s(JSON.parse(e.resource))})).catch((e=>{t(e)}))}))}fetchUserAvailableConfigs(e,t){const r=this.getPath(t,e);return new Promise(((e,t)=>{s.get().callGraphQL({values:{name:r},query:this.queryConfig.get("fetchUserAvailableConfigs")}).then((s=>{e(s)})).catch((e=>{t(e)}))}))}fetchLegacyConfig(e,r){const n=this.getPath(r,e);return new Promise(((e,r)=>{s.get().callGraphQL({values:{name:n},query:this.queryConfig.get("fetchLegacyConfig")}).then((s=>{e(t.stringToObject((null==s?void 0:s.resource)||""))})).catch((e=>{r(e)}))}))}fetchDefaultConfig(e,r){const n=this.getPath(r,e);return new Promise(((e,r)=>{s.get().callGraphQL({values:{name:n},query:this.queryConfig.get("fetchDefaultConfig")}).then((s=>{e(t.stringToObject((null==s?void 0:s.resource)||""))})).catch((e=>{r(e)}))}))}getPath(e,s,t="form"){return s?`cfg://${t}/${e}/${s}`:`cfg://${t}/${e}`}}var a;!function(e){e.USER="USER",e.DEFAULT="DEFAULT",e.SHARED="SHARED"}(a||(a={}));export{n as F,r as R,a as U}
@@ -1 +0,0 @@
1
- import{r as t,c as s,h as i,H as e,g as a}from"./p-d2d301a6.js";import{StringUtils as n,ApplicationContext as r,OVERFLOWED_CLASS_NAME as h,OverflowWatcher as o,OverflowDirection as l,ElementIDUtils as d}from"@sankhyalabs/core";import{A as u}from"./p-dc36cfbf.js";import{T as v,V as k,A as m,b as c,a as b}from"./p-ae4fc9a9.js";import{P as p}from"./p-38289a55.js";import"./p-6dc031de.js";const T=class{constructor(i){t(this,i),this.actionClick=s(this,"actionClick",7),this.TASKBAR_ITEM_ID_PREFIX="TASKBAR_ITEM_",this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME="taskbar-custom-elements-container",this.ACTIONS_BUTTON_TAG="TASKBAR-ACTIONS-BUTTON",this.NOT_OVERFLOW_ELEMENTS=["moreOptions","dataExporter_snkDataExporter","actionsButton_snkActionsButton"],this._titleKeyByElement={[v.UPDATE]:"snkTaskbar.titleUpdate",[v.PREVIOUS]:"snkTaskbar.titlePrevious",[v.NEXT]:"snkTaskbar.titleNext",[v.REFRESH]:"snkTaskbar.titleRefresh",[v.CLONE]:"snkTaskbar.titleClone",[v.REMOVE]:"snkTaskbar.titleRemove",[v.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[v.INSERT]:"snkTaskbar.titleInsert",[v.CANCEL]:"snkTaskbar.titleCancel",[v.SAVE]:"snkTaskbar.titleSave",[v.GRID_MODE]:"snkTaskbar.titleGridMode",[v.FORM_MODE]:"snkTaskbar.titleFormMode",[v.CONFIGURATOR]:"snkTaskbar.titleConfigurator",[v.ATTACH]:"snkTaskbar.titleAttach"},this._permissions=void 0,this._overFlowedElements=[],this._customElements=void 0,this._customElementsId=void 0,this._slotContainer=void 0,this._hiddenActionsList=[],this.alignRigth=!1,this.customSlotId="TASKBAR_CUSTOM_ELEMENTS",this.customContainerId=void 0,this.overflowStrategy="hiddenItems",this.configName=void 0,this.resourceID=void 0,this.buttons=void 0,this.customButtons=void 0,this.actionsList=void 0,this.primaryButton=void 0,this.disabledButtons=void 0,this.dataUnit=void 0,this.presentationMode=p.PRIMARY,this.messagesBuilder=void 0}observeButtons(){this._definitions=void 0,requestAnimationFrame((()=>{requestAnimationFrame((()=>{var t;return null===(t=this._overFlowWatcher)||void 0===t?void 0:t.forceUpdate()}))}))}observeDisabledButtons(){var t;null===(t=this._overFlowWatcher)||void 0===t||t.forceUpdate()}elementsFromString(t){const s=[];return null==t||t.split(",").forEach((t=>{t=t.trim(),(k[t]||this.isAllowed(t))&&s.push(t.trim())})),s}isAllowed(t){return t===m.CONFIGURATOR?!!this._permissions&&(this._permissions.isSup||this._permissions[u.CONFIG_GRID]||this._permissions[u.CONFIG]):!m[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){var s;let i;return i=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",i?null===(s=this.messagesBuilder)||void 0===s?void 0:s.getMessage(i,{}):""}elementClick(t){if(this.dataUnit)switch(t){case v.PREVIOUS:this.dataUnit.previousRecord();break;case v.NEXT:this.dataUnit.nextRecord();break;case v.REFRESH:this.dataUnit.loadData();break;case v.CLONE:this.dataUnit.copySelected();break;case v.REMOVE:this.dataUnit.removeSelectedRecords();break;case v.INSERT:this.dataUnit.addRecord();break;case v.CANCEL:this.dataUnit.cancelEdition();break;case v.SAVE:this.dataUnit.saveData()}this.isEnabled(t)&&this.actionClick.emit(t)}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}validatePresentationMode(){Object.values(p).includes(this.presentationMode)||(this.presentationMode=p.PRIMARY)}getElement(t,s){let i=s===this.primaryButton?"ez-button--primary ":"";return t>1&&(i+="ez-padding-left--medium"),v[s.toString()]?c(s,i,this.getIdElemBtnNative(s),(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),this.buildDynamicActionsList(),this.configName,this.presentationMode):b(s,i,this.getIdElemBtnCustom(s),(t=>this.elementClick(t)),(t=>this.isEnabled(t)))}buildDynamicActionsList(){var t;return this._hiddenActionsList.length?[...null!==(t=this.actionsList)&&void 0!==t?t:[],{type:"divider",label:"",value:""},...this._hiddenActionsList]:this.actionsList}getIdElemBtnNative(t){return n.toCamelCase(t)}getIdElemBtnCustom(t){return n.toCamelCase(t.name)}isDivider(t){var s;return void 0!==t&&(null===(s=t.t)||void 0===s?void 0:s["data-taskbar-divider"])}removeEmpty(t){let s;return t.filter((t=>!(null==t||this.isDivider(s)&&this.isDivider(t)||(s=t,0))))}appendCustomElementsInTaskbar(){this._customElementsId.forEach((t=>{const s=t.replace(this.TASKBAR_ITEM_ID_PREFIX,""),i=this._customElements.get(s),e=this._element.querySelector(`#${t}`);e?null==e||e.appendChild(i):this.unlinkCustomElementFromTaskbar(i)}))}addCustomElementContainer(t){var s;const e=`${this.TASKBAR_ITEM_ID_PREFIX}${t}`;return this._customElementsId.includes(e)||(this._customElementsId.push(e),null===(s=this._overFlowWatcher)||void 0===s||s.addNotOverFlowElement(e)),i("span",{class:"ez-padding-left--medium",key:e,id:e})}getCustomElements(){var t,s;this._customElementsId=[],this._customElements=new Map,this._slotContainer=this.buildSlotContainer(),Array.from(null!==(s=null===(t=this._slotContainer)||void 0===t?void 0:t.children)&&void 0!==s?s:[]).forEach((t=>this._customElements.set(t.id,t)))}buildSlotContainer(){if(this.customContainerId){const t=document.querySelector(`#${this.customContainerId}`);return null==t?void 0:t.querySelector(`#${this.customSlotId}`)}return this._element.querySelector(`#${this.customSlotId}`)}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess(this.resourceID).then((t=>this._permissions=t)):this._permissions={},this.getCustomElements()}componentWillRender(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons)),this.validatePresentationMode()}handleOverFlow(t){const s=t.filter((t=>!this.hasToIgnoreOverFlow(t)));this.resetOverFlowedElements(),this.doOverFlowElements(s)}resetOverFlowedElements(){this._overFlowedElements.forEach((t=>{t.classList.remove(h)})),this._hiddenActionsList=[],this._overFlowedElements=[]}doOverFlowElements(t){t.forEach((t=>{t.classList.add(h),this._overFlowedElements.push(t),this.addItemToActionList(t)}))}addItemToActionList(t){const s=this.getTaskbarElementName(t);if(s&&this.isEnabled(s)&&this.isAllowed(s)){const i={value:s,label:this.getTaskbarElementLabel(t),iconName:this.getTaskbarElementIcon(t)};this._hiddenActionsList.push(i)}}getTaskbarElementName(t){var s;return null!==(s=t.getAttribute("data-taskbar-element"))&&void 0!==s?s:""}getTaskbarElementIcon(t){var s;return null!==(s=t.getAttribute("data-taskbar-icon"))&&void 0!==s?s:""}getTaskbarElementLabel(t){var s;return null!==(s=t.getAttribute("data-taskbar-label"))&&void 0!==s?s:""}hasToIgnoreOverFlow(t){return t.classList.contains(this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME)}handleOverFlowStrategy(){"hiddenItems"===this.overflowStrategy&&(this._overFlowWatcher=new o(this.buildOverFlowWatcherParams()))}buildOverFlowWatcherParams(){return{element:this._element,callback:this.handleOverFlow.bind(this),overFlowDirection:l.HORIZONTAL,notOverFlow:this.NOT_OVERFLOW_ELEMENTS}}componentDidLoad(){d.addIDInfo(this._element,null,{dataUnit:this.dataUnit}),this.handleOverFlowStrategy()}componentDidRender(){this.appendCustomElementsInTaskbar()}disconnectedCallback(){var t;this.unlinkAllCustomElements(),null===(t=this._overFlowWatcher)||void 0===t||t.destroy()}unlinkAllCustomElements(){var t;null===(t=this._customElementsId)||void 0===t||t.forEach((t=>{const s=t.replace(this.TASKBAR_ITEM_ID_PREFIX,""),i=this._customElements.get(s);this.unlinkCustomElementFromTaskbar(i)}))}unlinkCustomElementFromTaskbar(t){this._slotContainer.appendChild(t)}render(){if(void 0===this._definitions)return;let t=0;return i(e,{class:this.getHostClasses()},this.removeEmpty(this._definitions.map((s=>{var e,a;return t++,v[s]?this.getElement(t,v[s]):(null===(e=this.customButtons)||void 0===e?void 0:e.has(s))?this.getElement(t,this.customButtons.get(s)):this._customElements.has(s)?this.addCustomElementContainer(s):(null===(a=this._overFlowWatcher)||void 0===a||a.addNotOverFlowElement(s),i("slot",{name:s}))}))),i("div",{class:this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME},i("slot",{name:this.customSlotId})))}getHostClasses(){return"hiddenItems"!==this.overflowStrategy?"no-wrap":"full-width "+(this.alignRigth?"align-right":"")}get _element(){return a(this)}static get watchers(){return{buttons:["observeButtons"],disabledButtons:["observeDisabledButtons"]}}};T.style=".sc-snk-taskbar-h{display:flex;flex-wrap:wrap}.no-wrap.sc-snk-taskbar-h{flex-wrap:nowrap}.full-width.sc-snk-taskbar-h{width:100%}.align-right.sc-snk-taskbar-h{justify-content:flex-end}.overflowed.sc-snk-taskbar{display:none}";export{T as snk_taskbar}