@sankhyalabs/sankhyablocks 8.16.0-rc.7 → 8.16.0-rc.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  4. package/dist/cjs/snk-actions-button_4.cjs.entry.js +12 -9
  5. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  6. package/dist/cjs/{snk-data-unit-8af43aa3.js → snk-data-unit-486c7ac4.js} +2 -2
  7. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  8. package/dist/cjs/snk-detail-view.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-grid.cjs.entry.js +2 -2
  10. package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
  11. package/dist/cjs/snk-taskbar.cjs.entry.js +23 -1
  12. package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
  13. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +1 -1
  14. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +1 -1
  15. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
  16. package/dist/collection/components/snk-data-unit/snk-data-unit.js +2 -2
  17. package/dist/collection/components/snk-taskbar/snk-taskbar.js +64 -0
  18. package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
  19. package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
  20. package/dist/components/snk-actions-button2.js +12 -9
  21. package/dist/components/snk-data-unit2.js +4 -41
  22. package/dist/components/snk-detail-view2.js +1 -1
  23. package/dist/components/snk-grid2.js +2 -2
  24. package/dist/components/snk-simple-crud2.js +3 -2
  25. package/dist/components/snk-taskbar2.js +24 -2
  26. package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
  27. package/dist/esm/loader.js +1 -1
  28. package/dist/esm/sankhyablocks.js +1 -1
  29. package/dist/esm/snk-actions-button_4.entry.js +12 -9
  30. package/dist/esm/snk-data-exporter.entry.js +2 -2
  31. package/dist/esm/{snk-data-unit-008cb9aa.js → snk-data-unit-ac3423fa.js} +2 -2
  32. package/dist/esm/snk-data-unit.entry.js +2 -2
  33. package/dist/esm/snk-detail-view.entry.js +1 -1
  34. package/dist/esm/snk-grid.entry.js +2 -2
  35. package/dist/esm/snk-simple-crud.entry.js +2 -2
  36. package/dist/esm/snk-taskbar.entry.js +23 -1
  37. package/dist/sankhyablocks/p-18ed15f4.entry.js +1 -0
  38. package/dist/sankhyablocks/p-1e596b15.entry.js +1 -0
  39. package/dist/sankhyablocks/{p-89451692.entry.js → p-27b57eb7.entry.js} +1 -1
  40. package/dist/sankhyablocks/{p-684a2590.entry.js → p-2d6dc51d.entry.js} +1 -1
  41. package/dist/sankhyablocks/p-7dd49d15.js +1 -0
  42. package/dist/sankhyablocks/{p-53eb35c1.entry.js → p-81f6d043.entry.js} +1 -1
  43. package/dist/sankhyablocks/p-e8bd4c15.js +1 -0
  44. package/dist/sankhyablocks/{p-3c50e9d4.entry.js → p-fa155ad6.entry.js} +1 -1
  45. package/dist/sankhyablocks/{p-46bb200a.entry.js → p-fd8a58ff.entry.js} +1 -1
  46. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  47. package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
  48. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
  49. package/dist/types/components.d.ts +8 -0
  50. package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
  51. package/package.json +1 -1
  52. package/dist/sankhyablocks/p-421bec84.entry.js +0 -1
  53. package/dist/sankhyablocks/p-9863d682.js +0 -1
  54. package/dist/sankhyablocks/p-cc935517.js +0 -1
  55. package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
  56. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -1 +0,0 @@
1
- import{r as t,c as s,h as i,H as e,g as h}from"./p-d2d301a6.js";import{Action as a,StringUtils as n,ApplicationContext as r,OVERFLOWED_CLASS_NAME as o,OverflowWatcher as l,OverflowDirection as d,ElementIDUtils as u}from"@sankhyalabs/core";import{A as v}from"./p-dc36cfbf.js";import{T as m,V as c,A as k,b,a as p}from"./p-7e7a7473.js";import{P as T}from"./p-30cf616e.js";import"./p-6dc031de.js";const f=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={[m.UPDATE]:"snkTaskbar.titleUpdate",[m.PREVIOUS]:"snkTaskbar.titlePrevious",[m.NEXT]:"snkTaskbar.titleNext",[m.REFRESH]:"snkTaskbar.titleRefresh",[m.CLONE]:"snkTaskbar.titleClone",[m.REMOVE]:"snkTaskbar.titleRemove",[m.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[m.INSERT]:"snkTaskbar.titleInsert",[m.CANCEL]:"snkTaskbar.titleCancel",[m.SAVE]:"snkTaskbar.titleSave",[m.GRID_MODE]:"snkTaskbar.titleGridMode",[m.FORM_MODE]:"snkTaskbar.titleFormMode",[m.CONFIGURATOR]:"snkTaskbar.titleConfigurator",[m.ATTACH]:"snkTaskbar.titleAttach"},this.onSaveEvent=t=>{switch(t.type){case a.FIELD_INVALIDATED:case a.DATA_SAVED:case a.SAVING_ERROR:this._isWaitingForSave=!1;break;case a.SAVING_DATA:this._isWaitingForSave=!0}},this._permissions=void 0,this._overFlowedElements=[],this._customElements=void 0,this._customElementsId=void 0,this._slotContainer=void 0,this._hiddenActionsList=[],this._lastWidth=void 0,this._hasToUpdateOverFlow=!1,this._isWaitingForSave=!1,this.alignRigth=!1,this.customSlotId="TASKBAR_CUSTOM_ELEMENTS",this.customContainerId=void 0,this.overflowStrategy="hiddenItems",this.configName=void 0,this.resourceID=void 0,this.buttons=void 0,this.customButtons=void 0,this.actionsList=void 0,this.primaryButton=void 0,this.disabledButtons=void 0,this.dataUnit=void 0,this.presentationMode=T.PRIMARY,this.messagesBuilder=void 0}handleCustomSlotElementsLoaded(t){this.hasToSearchCustomElements(t)&&this.getCustomElements(!0)}hasToSearchCustomElements(t){return this.customSlotId===t.detail&&!this._slotContainer}observeButtons(){this._definitions=void 0,requestAnimationFrame((()=>{requestAnimationFrame((()=>{var t;return null===(t=this._overFlowWatcher)||void 0===t?void 0:t.forceUpdate()}))}))}observeDisabledButtons(){var t;null===(t=this._overFlowWatcher)||void 0===t||t.forceUpdate()}observeLastWidth(t,s){0===s&&0!==t&&(this._hasToUpdateOverFlow=!0)}elementsFromString(t){const s=[];return null==t||t.split(",").forEach((t=>{t=t.trim(),(c[t]||this.isAllowed(t))&&s.push(t.trim())})),s}isAllowed(t){return t===k.CONFIGURATOR?!!this._permissions&&(this._permissions.isSup||this._permissions[v.CONFIG_GRID]||this._permissions[v.CONFIG]):!k[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 m.PREVIOUS:this.dataUnit.previousRecord();break;case m.NEXT:this.dataUnit.nextRecord();break;case m.REFRESH:this.dataUnit.loadData();break;case m.CLONE:this.dataUnit.copySelected();break;case m.REMOVE:this.dataUnit.removeSelectedRecords();break;case m.INSERT:this.dataUnit.addRecord();break;case m.CANCEL:this.dataUnit.cancelEdition();break;case m.SAVE:this._isWaitingForSave||(this._isWaitingForSave=!0,this.dataUnit.saveData().finally((()=>{this._isWaitingForSave=!1})))}this.isEnabled(t)&&this.actionClick.emit(t)}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}validatePresentationMode(){Object.values(T).includes(this.presentationMode)||(this.presentationMode=T.PRIMARY)}getElement(t,s){let i=s===this.primaryButton?"ez-button--primary ":"";t>1&&(i+="ez-padding-left--medium");const e=m[s.toString()],h=this._element.dataset.exporterStoreKey||this.configName;return e?b(s,i,this.getIdElemBtnNative(s),(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),this.buildDynamicActionsList(),h,this.presentationMode):p(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(t){var s,i;this._customElementsId=[],this._customElements=new Map,this._slotContainer=this.buildSlotContainer(t),Array.from(null!==(i=null===(s=this._slotContainer)||void 0===s?void 0:s.children)&&void 0!==i?i:[]).forEach((t=>this._customElements.set(t.id,t)))}buildSlotContainer(t){let s;if(this.customContainerId){const t=document.querySelector(`#${this.customContainerId}`);s=null==t?void 0:t.querySelector(`#${this.customSlotId}`)}else s=this._element.querySelector(`#${this.customSlotId}`);return t&&!s&&(s=document.querySelector(`#${this.customSlotId}`)),s}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess(this.resourceID).then((t=>this._permissions=t)):this._permissions={},this.getCustomElements()}componentWillRender(){this.handleDefinitions(),this.validatePresentationMode(),this.updateOverFlowIfNeeded()}handleDefinitions(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons))}updateOverFlowIfNeeded(){this._hasToUpdateOverFlow&&(requestAnimationFrame((()=>{var t;return null===(t=this._overFlowWatcher)||void 0===t?void 0:t.forceUpdate()})),this._hasToUpdateOverFlow=!1)}handleOverFlow(t){const s=t.filter((t=>!this.hasToIgnoreOverFlow(t)));this.resetOverFlowedElements(),this.doOverFlowElements(s)}resetOverFlowedElements(){this._overFlowedElements.forEach((t=>{t.classList.remove(o)})),this._hiddenActionsList=[],this._overFlowedElements=[]}doOverFlowElements(t){t.forEach((t=>{t.classList.add(o),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 l(this.buildOverFlowWatcherParams()))}buildOverFlowWatcherParams(){return{element:this._element,callback:this.handleOverFlow.bind(this),overFlowDirection:d.HORIZONTAL,notOverFlow:this.NOT_OVERFLOW_ELEMENTS}}componentDidLoad(){u.addIDInfo(this._element,null,{dataUnit:this.dataUnit}),this.handleOverFlowStrategy(),this.dataUnit.subscribe(this.onSaveEvent)}componentDidRender(){this.appendCustomElementsInTaskbar(),this.updateLastWidth()}updateLastWidth(){this._lastWidth=this._element.getBoundingClientRect().width}disconnectedCallback(){var t;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,h;return t++,m[s]?this.getElement(t,m[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===(h=this._overFlowWatcher)||void 0===h||h.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 h(this)}static get watchers(){return{buttons:["observeButtons"],disabledButtons:["observeDisabledButtons"],_lastWidth:["observeLastWidth"]}}};f.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{f as snk_taskbar}
@@ -1,3 +0,0 @@
1
- import { DataUnit } from "@sankhyalabs/core";
2
- import { IRecordID } from "../interfaces/IRecordID";
3
- export declare const getSelectedIDs: (dataUnit: DataUnit) => Array<IRecordID>;